Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace arrow with iso8601 #15

Merged
merged 2 commits into from
Jan 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.rst
Expand Up @@ -79,6 +79,11 @@ Cobalt is Copyright 2015-2017 AfricanLII.
Change Log
----------

3.1.0
-----

- Replace arrow with iso8601, avoiding [arrow issue 612](https://github.com/crsmithdev/arrow/issues/612)

3.0.0
.....

Expand Down
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
3.0.0
3.1.0
14 changes: 7 additions & 7 deletions cobalt/act.py
Expand Up @@ -3,7 +3,7 @@

from lxml import objectify
from lxml import etree
import arrow
from iso8601 import parse_date

from .uri import FrbrUri

Expand Down Expand Up @@ -90,7 +90,7 @@ def title(self, value):
@property
def work_date(self):
""" Date from the FRBRWork element """
return arrow.get(self.meta.identification.FRBRWork.FRBRdate.get('date')).date()
return parse_date(self.meta.identification.FRBRWork.FRBRdate.get('date')).date()

@work_date.setter
def work_date(self, value):
Expand All @@ -99,7 +99,7 @@ def work_date(self, value):
@property
def expression_date(self):
""" Date from the FRBRExpression element """
return arrow.get(self.meta.identification.FRBRExpression.FRBRdate.get('date')).date()
return parse_date(self.meta.identification.FRBRExpression.FRBRdate.get('date')).date()

@expression_date.setter
def expression_date(self, value):
Expand All @@ -110,7 +110,7 @@ def expression_date(self, value):
@property
def manifestation_date(self):
""" Date from the FRBRManifestation element """
return arrow.get(self.meta.identification.FRBRManifestation.FRBRdate.get('date')).date()
return parse_date(self.meta.identification.FRBRManifestation.FRBRdate.get('date')).date()

@manifestation_date.setter
def manifestation_date(self, value):
Expand All @@ -134,7 +134,7 @@ def publication_date(self):
""" Date of the publication """
pub = self._get('meta.publication')
if pub is not None and pub.get('date'):
return arrow.get(pub.get('date')).date()
return parse_date(pub.get('date')).date()
return None

@publication_date.setter
Expand Down Expand Up @@ -240,7 +240,7 @@ def amendments(self):
amendments = []

for e in self.meta.iterfind('.//{*}lifecycle/{*}eventRef[@type="amendment"]'):
date = arrow.get(e.get('date')).date()
date = parse_date(e.get('date')).date()
event = AmendmentEvent(date=date)
amendments.append(event)

Expand Down Expand Up @@ -296,7 +296,7 @@ def amendments(self, value):
def repeal(self):
e = self.meta.find('.//{*}lifecycle/{*}eventRef[@type="repeal"]')
if e is not None:
date = arrow.get(e.get('date')).date()
date = parse_date(e.get('date')).date()
event = RepealEvent(date=date)

id = e.get('source')[1:]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -65,7 +65,7 @@
# requirements files see:
# https://packaging.python.org/en/latest/requirements.html
install_requires=[
'arrow >= 0.5.0',
'iso8601 >= 0.1',
'lxml >= 3.4.1',
],

Expand Down