Skip to content
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

Fix Regex Deprecation Warnings in Python 3 #1646

Closed
franklsf95 opened this issue Oct 23, 2017 · 3 comments
Closed

Fix Regex Deprecation Warnings in Python 3 #1646

franklsf95 opened this issue Oct 23, 2017 · 3 comments
Labels
bug Issue described a bug difficulty easy Easy issue: required small fix good first issue Issue for new contributors (not required gensim understanding + very simple)

Comments

@franklsf95
Copy link
Contributor

Description

When I import gensim in Python 3, I get a lot of deprecation warnings like

DeprecationWarning: invalid escape sequence \[
  RE_P2 = re.compile("(\n\[\[[a-z][a-z][\w-]*:[^:\]]+\]\])+$", re.UNICODE)

which is a 2 to 3 issue which I believe can be fixed by adding a raw flag before the string.

Steps/Code/Corpus to Reproduce

On Python 3...

import gensim

Observe the warnings.

Expected Results

No deprecation warnings.

Actual Results

Deprecation warnings.

Versions

Python 3.6.3, gensim 3.0.0

@menshikh-iv menshikh-iv added bug Issue described a bug difficulty easy Easy issue: required small fix good first issue Issue for new contributors (not required gensim understanding + very simple) labels Oct 24, 2017
@menshikh-iv
Copy link
Contributor

Thanks for report @franklsf95

@franklsf95
Copy link
Contributor Author

@menshikh-iv I can fix these warnings and put up a pull request, if you don't mind?

@menshikh-iv
Copy link
Contributor

Of course @franklsf95, feel free to contribute 👍

franklsf95 added a commit to franklsf95/gensim that referenced this issue Oct 24, 2017
Add raw flag before all Regex strings so Python 3 can stop complaining.
menshikh-iv pushed a commit that referenced this issue Oct 26, 2017
* Fix deprecation warnings for regex string literals. Fix #1646

Add raw flag before all Regex strings so Python 3 can stop complaining.

* Fix two more occurrences of unescaped Regex strings
horpto pushed a commit to horpto/gensim that referenced this issue Oct 28, 2017
piskvorky#1649)

* Fix deprecation warnings for regex string literals. Fix piskvorky#1646

Add raw flag before all Regex strings so Python 3 can stop complaining.

* Fix two more occurrences of unescaped Regex strings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue described a bug difficulty easy Easy issue: required small fix good first issue Issue for new contributors (not required gensim understanding + very simple)
Projects
None yet
Development

No branches or pull requests

2 participants