File tree Expand file tree Collapse file tree 3 files changed +35
-2
lines changed Expand file tree Collapse file tree 3 files changed +35
-2
lines changed Original file line number Diff line number Diff line change 11__version__ = '0.2.1'
22
33from .date_parser import DateParser
4+ from .date_formats import DateFormats
Original file line number Diff line number Diff line change 1+ """"
2+ Defines various supported locale/types
3+ """
4+
5+
16class DateFormats :
2- locale = {'USA' :[
7+ '''
8+ standard dateformats, according to the various locales.
9+ '''
10+ locale = {'USA' : [
311 '%b %d %Y' ,
412 '%b %-d %Y' ,
513 '%b %d, %Y' ,
@@ -13,7 +21,7 @@ class DateFormats:
1321 '%m/%d/%y' ,
1422 '%m/%-d/%y'
1523 ],
16- 'EU' :[
24+ 'EU' : [
1725 '%b %d %Y' ,
1826 '%b %-d %Y' ,
1927 '%b %d, %Y' ,
Original file line number Diff line number Diff line change 1+ """"
2+ Date Parser Adapter.
3+ """
4+
15import attr
26from ._loggers import logger
37from collections import namedtuple
1115class DateParser :
1216 """
1317 CoreDateParser Adapter class.
18+
19+ Parameters:
20+ ----------
21+
22+ text: str
23+ a string/text document from which we can extract dates.
24+
25+ start_year: int
26+ define the start year from which to look for the date.
27+
28+ end_year: int
29+ define the end year from which to look for the date.
30+
31+ locale: None, str, list
32+ define the type of dateformat(currently supports 'USA', 'EU'), default is None.
33+ or pass your own list of patterns.
34+
35+ Returns:
36+ -------
37+ list of `DATE` objects.
1438 """
1539 text = attr .ib (validator = attr .validators .instance_of (str ))
1640 start_year = attr .ib (validator = attr .validators .instance_of (int ))
You can’t perform that action at this time.
0 commit comments