Skip to content

Separate parsing functions out from tslib #17363

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

Merged
merged 20 commits into from
Sep 26, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
Merge branch 'master' of https://github.com/pandas-dev/pandas into ts…
…libs-parsing

Remove unused imports from tslib; test file to import directly
  • Loading branch information
jbrockmendel committed Sep 23, 2017
commit a5f8ecafc78143a57def8a3559b8375b6b4e9b2a
13 changes: 2 additions & 11 deletions pandas/_libs/tslib.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,8 @@ from khash cimport (
kh_init_int64, kh_int64_t,
kh_resize_int64, kh_get_int64)

from .tslibs import parsing # noqa
from .tslibs.parsing import ( # noqa
DateParseError,
_format_is_iso,
_DATEUTIL_LEXER_SPLIT,
_guess_datetime_format,
NAT_SENTINEL,
parse_datetime_string,
parse_time_string,
_does_string_look_like_datetime,
parse_datetime_string_with_reso)
from .tslibs.parsing import parse_datetime_string
from .tslibs.parsing import DateParseError # noqa
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is DateParseError actually used anywhere here? it doesn't look like it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. Retained it because it is used/imported in many places around pandas (and conceivably downstream). Will change on request.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, ok let's fix that in a followup then.


cimport cython

Expand Down
3 changes: 2 additions & 1 deletion pandas/core/tools/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
from collections import MutableMapping

from pandas._libs import tslib
from pandas._libs.tslibs.timezones import get_timezone
from pandas._libs.tslibs import parsing
from pandas._libs.tslib import ( # noqa
from pandas._libs.tslibs.parsing import ( # noqa
parse_time_string,
_format_is_iso,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can come back in future and de-privatize these in tslib.parsing (and change here)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just added to TODO list in #17652

_DATEUTIL_LEXER_SPLIT,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think _DATEUTIL_LEXER_SPLIT Is now private to tstlib.parsing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just pushed a commit that removes this import.

Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/indexes/datetimes/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,7 @@ def test_does_not_convert_mixed_integer(self):
bad_date_strings = ('-50000', '999', '123.1234', 'm', 'T')

for bad_date_string in bad_date_strings:
assert not tslib._does_string_look_like_datetime(bad_date_string)
assert not parsing._does_string_look_like_datetime(bad_date_string)

good_date_strings = ('2012-01-01',
'01/01/2012',
Expand All @@ -1074,7 +1074,7 @@ def test_does_not_convert_mixed_integer(self):
'1-1', )

for good_date_string in good_date_strings:
assert tslib._does_string_look_like_datetime(good_date_string)
assert parsing._does_string_look_like_datetime(good_date_string)

def test_parsers(self):

Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.