Skip to content

Commit

Permalink
remove base-formats parser (#721)
Browse files Browse the repository at this point in the history
  • Loading branch information
noviluni committed Jul 15, 2020
1 parent 4f74470 commit b256f14
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 27 deletions.
18 changes: 0 additions & 18 deletions dateparser/date.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ def __init__(self, locale, date_string, date_formats, settings=None):
'relative-time': self._try_freshness_parser,
'custom-formats': self._try_given_formats,
'absolute-time': self._try_parser,
'base-formats': self._try_hardcoded_formats,
}
unknown_parsers = set(self._settings.PARSERS) - set(self._parsers.keys())
if unknown_parsers:
Expand Down Expand Up @@ -239,23 +238,6 @@ def _try_given_formats(self):
self.date_formats, settings=self._settings
)

def _try_hardcoded_formats(self):
hardcoded_date_formats = [
'%B %d, %Y, %I:%M:%S %p',
'%b %d, %Y at %I:%M %p',
'%d %B %Y %H:%M:%S',
'%A, %B %d, %Y',
'%Y-%m-%dT%H:%M:%S.%fZ'
]
try:
return parse_with_formats(
self._get_translated_date_with_formatting(),
hardcoded_date_formats,
settings=self._settings
)
except TypeError:
return None

def _get_translated_date(self):
if self._translated_date is None:
self._translated_date = self.locale.translate(
Expand Down
1 change: 0 additions & 1 deletion dateparser_data/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
'relative-time',
'custom-formats',
'absolute-time',
'base-formats',
]

settings = {
Expand Down
8 changes: 0 additions & 8 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,6 @@ The following parsers exist:
(e.g. “May 4th”, “1991-05-17”). It takes into account settings such as
``DATE_ORDER`` or ``PREFER_LOCALE_DATE_ORDER``.

- ``'base-formats'``: Parses dates that match one of the following date
formats::

%B %d, %Y, %I:%M:%S %p
%b %d, %Y at %I:%M %p
%d %B %Y %H:%M:%S
%A, %B %d, %Y
%Y-%m-%dT%H:%M:%S.%fZ

:data:`dateparser.settings.default_parsers` contains the default value of
``PARSERS`` (the list above, in that order) and can be used to write code that
Expand Down

0 comments on commit b256f14

Please sign in to comment.