Skip to content

Commit

Permalink
deprecate CounterReport.year
Browse files Browse the repository at this point in the history
(this attribute is no longer set on COUNTER 5 reports, and doesn't
really make sense when a report can span multiple years or even
just a bunch of months in the middle of a year.)
  • Loading branch information
Wooble committed Sep 13, 2019
1 parent b644eea commit d353c4b
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion pycounter/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def __init__(
self.date_run = datetime.date.today()
else:
self.date_run = date_run
self.year = None
self._year = None
self.section_type = section_type

def __repr__(self):
Expand All @@ -93,6 +93,21 @@ def __repr__(self):
self.period[1],
)

@property
def year(self):
warnings.warn(
DeprecationWarning(
"CounterReport.year is deprecated."
"Reports may span multiple years. "
"COUNTER 5 reports will not have a year set."
)
)
return self._year

@year.setter
def year(self, value):
self._year = value

def __iter__(self):
return iter(self.pubs)

Expand Down

0 comments on commit d353c4b

Please sign in to comment.