-
Notifications
You must be signed in to change notification settings - Fork 481
remove some python2 specific code #749
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #749 +/- ##
==========================================
+ Coverage 95.21% 95.57% +0.36%
==========================================
Files 304 304
Lines 2632 2600 -32
==========================================
- Hits 2506 2485 -21
+ Misses 126 115 -11
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding the backward-incompatible changes in dateparser.utils
, it could be argued that these are internal functions. However, given they are not prefixed with _
and they are listed in the documentation, it may be better to deprecate instead of remove.
dateparser/search/search.py
Outdated
@@ -180,7 +174,7 @@ def __init__(self): | |||
self.search = ExactLanguageSearch(self.loader) | |||
|
|||
def detect_language(self, text, languages): | |||
if isinstance(languages, (list, tuple, Set)): | |||
if isinstance(languages, (list, tuple, set)): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is technically a backward-incompatible change, as it is technically possible for an object to be an instance of a class inheriting from Set
that is not a set
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I change it because we accepted as valid this other PR: #509
but now I'm thinking that we should probably keep using Set as it would accept a frozenset
for example.
>>> a = frozenset([1,2,3])
>>> isinstance(a, Set)
True
>>> isinstance(a, set)
False
So it is not only "backward-incompatible", but also not desirable. 🤔
@@ -18,9 +18,6 @@ def strip_braces(date_string): | |||
|
|||
|
|||
def normalize_unicode(string, form='NFKD'): | |||
if isinstance(string, bytes): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Backward-incompatible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we are going to release a new major version I think it's a good moment to make these backward-incompatible changes. What do you think?
Apart from that, we could also move some of these functions to the private scope by adding a _
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either works. We just need to take this into account when writing the release notes, to make sure we cover backward-incompatible changes.
@@ -44,25 +41,6 @@ def combine_dicts(primary_dict, supplementary_dict): | |||
return combined_dict | |||
|
|||
|
|||
def convert_to_unicode(info): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Backward-incompatible.
I reverted the change in the @Gallaecio, could you check it again? |
ac60a7d
to
4ef94a3
Compare
4ef94a3
to
7bec52e
Compare
I fixed some cases with Python 2 specific code that were detected when removing Python 2 from the pipelines (#744) (https://codecov.io/gh/scrapinghub/dateparser/pull/744/changes)