개발자를 위한 AI 보조 코딩
Francesca Donadoni
AI Curriculum Manager, DataCamp

def sales_trend(self):
...
if increasing > decreasing:
return "Increasing trend"
else:
return "Decreasing or stable trend"
def sales_trend(self):
"""Analyze sales data to determine the overall trend"""
[...]
사용자 프롬프트: 다음 내용을 포함하는 docstring을 생성해 주세요:
모델 응답:
다음은 함수에 사용할 수 있는 전체 docstring입니다:
def sales_trend(self):
"""
Analyze the sales data to determine whether there is an increasing trend
or a decreasing/stable trend over time.
[...]
"""
다음은 함수에 사용할 수 있는 전체 docstring입니다:
def sales_trend(self):
"""
Analyze the sales data to determine whether there is an increasing trend
or a decreasing/stable trend over time.
Parameters
----------
self : object
An object that contains an attribute `daily_sales` (list of int or float),
which represents daily sales values in chronological order.
[...]
"""



다음은 SalesAnalyzer 클래스에 대한 README.md 초안입니다:
SalesAnalyzer
SalesAnalyzer 클래스는 일별 판매 데이터를 분석하고 판매 추세가 전반적으로 증가하는지 또는 감소/안정적인지를 간단하게 파악할 수 있는 도구입니다. 시간 경과에 따른 판매 실적을 빠르게 개략적으로 파악하고자 하는 기업이나 개인에게 유용합니다.

(base) datacamp@test:~/datacamp/docstring-generation$ git diff
+
+ Raises:
+ ValueError: If daily_sales contains non-numeric values.
"""
- return sum(self.daily_sales)
+ if not all(isinstance(sale, (int, float)) for sale in self.daily_sales):
+ raise ValueError("All sales figures must be numeric.")
+ return sum(sale for sale in self.daily_sales)


개발자를 위한 AI 보조 코딩