Skip to content

Commit b663c14

Browse files
committed
add docstrings
1 parent 9bcbf4c commit b663c14

File tree

3 files changed

+35
-2
lines changed

3 files changed

+35
-2
lines changed

pydateparser/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
__version__ = '0.2.1'
22

33
from .date_parser import DateParser
4+
from .date_formats import DateFormats

pydateparser/date_formats.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1+
""""
2+
Defines various supported locale/types
3+
"""
4+
5+
16
class 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',

pydateparser/date_parser.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
""""
2+
Date Parser Adapter.
3+
"""
4+
15
import attr
26
from ._loggers import logger
37
from collections import namedtuple
@@ -11,6 +15,26 @@
1115
class 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))

0 commit comments

Comments
 (0)