ReproNim / reproman

ReproMan (AKA NICEMAN, AKA ReproNim TRD3)
https://reproman.readthedocs.io
Other
24 stars 14 forks source link

MNT: Avoid invalid escape sequences in strings #573

Closed kyleam closed 3 years ago

kyleam commented 3 years ago

A good number of regexps and a few other strings don't use an r-prefix when the string contains non-escape-sequence backslashes. This doesn't make a functional difference at the moment because, when Python encounters a backslash that produces an invalid escape sequence, it automatically escapes the backslash. But Python 3.6 and later give a DeprecationWarning (https://bugs.python.org/issue32912), with the goal of eventually making invalid escape sequences a syntax error.


~This PR is marked as a draft because it sits on top of gh-571. Here's the effective diff: https://github.com/repronim/reproman/compare/migrate-to-github-ci...invalid-escapes~

kyleam commented 3 years ago

There are some test failures. Marking as draft...

yarikoptic commented 3 years ago

thank you @kyleam ! I had been fixing for those here and there (in other projects) and totally forgot about the trove of them here ;)

yarikoptic commented 3 years ago

probably here (and datalad) we should tune up tests execution so we fail on deprecation warnings and only whitelist the ones out of our control etc. We do have such setup e.g. in dandi-cli so far for the short term pain and long term gain ;-)

codecov[bot] commented 3 years ago

Codecov Report

Merging #573 (2f70a77) into master (a7c5055) will increase coverage by 0.01%. The diff coverage is 99.05%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #573      +/-   ##
==========================================
+ Coverage   89.20%   89.22%   +0.01%     
==========================================
  Files         149      149              
  Lines       13035    13054      +19     
==========================================
+ Hits        11628    11647      +19     
  Misses       1407     1407              
Impacted Files Coverage Δ
reproman/distributions/debian.py 95.34% <ø> (ø)
reproman/interface/base.py 95.74% <ø> (ø)
reproman/support/jobs/submitters.py 69.36% <0.00%> (ø)
reproman/cmdline/helpers.py 44.13% <100.00%> (ø)
reproman/distributions/tests/test_vcs.py 100.00% <100.00%> (ø)
reproman/dochelpers.py 84.44% <100.00%> (ø)
reproman/resource/tests/test_shell.py 100.00% <100.00%> (ø)
reproman/resource/tests/test_ssh.py 100.00% <100.00%> (ø)
reproman/support/constraints.py 84.89% <100.00%> (ø)
reproman/support/distributions/debian.py 97.19% <100.00%> (ø)
... and 9 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update a7c5055...2901b53. Read the comment docs.

kyleam commented 3 years ago

probably here (and datalad) we should tune up tests execution so we fail on deprecation warnings and only whitelist the ones out of our control etc.

Sounds good. This PR takes care of the bulk of those that are in our control, but there are still a few remaining ones.


The latest push should resolve the test failures. I think it's correct, but perhaps I'm missing some (untested) detail of the apt-cache-policy output.