Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions datetimeparser/parsermethods.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,8 @@ class AbsolutePrepositionParser:
"before"
)

MAX_RECURSION_DEPTH = 13

def _split_data(self, string: str) -> Optional[Tuple[dict, dict, dict]]:
"""
Splits the data into 3 parts
Expand Down Expand Up @@ -661,8 +663,10 @@ def _split_data(self, string: str) -> Optional[Tuple[dict, dict, dict]]:
absolute = string[char_count:]

# There may be more prepositions in the absolute part so we try it again via recursion
if self._split_data(absolute) is not None:
absolute = self._split_data(absolute)
recursion_result = self._split_data(absolute)

if recursion_result is not None:
absolute = recursion_result

return {'type': 'relative', 'data': relative}, {'type': 'keyword', 'data': word}, {'type': 'absolute', 'data': absolute}

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
long_description_content_type="text/markdown",
long_description=long_description,
packages=['datetimeparser'],
version='0.4a', # version number: https://peps.python.org/pep-0440/
version='0.4rc', # version number: https://peps.python.org/pep-0440/
license='MIT',
description='A parser library built for parsing the english language into datetime objects.',
author='Ari24',
Expand Down