-
Notifications
You must be signed in to change notification settings - Fork 3
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
Warning cleanup. #42
Warning cleanup. #42
Conversation
Raw strings (marked by the `r` prefix) are normally used for regular expression patterns to allow that module to expand any backslash-escape sequences without interference from the Python interpreter's string expansion, and thus the requirement for extra quoting. This practice is further encouraged by python 3.5 and later raising a `DepreciationWarning` when encountering escape sequences it can't expand, as is common is re patterns. However, in python 2.7, the `re` module doesn't expand \u and \U escapes for unicode codepoints, so patterns with non-ascii characters can only be used in raw strings when using python 3.3 or later, or the external `regex` module, and neither `u` nor `r` quoted strings will work for patterns in both languages. However, Python will concatenate whitespace-separated string literals even if they use different quoting. Take advantage of this to split the lexer patterns into raw- and unicode-quoted segments as appropriate. Also remove some unnecessary escape sequences.
The pep8 name is deprecated, and the tool continues under the new name.
Now that we're using a newer pytest, we can invoke it as such even in the jython build, instead of using the older `py.test`.
The parser's token pattern strings escaped almost all punctuation characters, but the Python `re` module has a fairly limited set of special characters which must be backslash-escaped. In particular, characters like @ ! : and space do not need escapes, and even more are fine inside a [] environment describing a set of characters. Audit the expression strings and remove most unnecessary escapes. I left some sequences like `[^\^\[]` which aren't ambiguous without escapes for clarity of reading.
The default osx image on travis doesn't have an up-to-date set of homebrew packages, so the `brew upgrade` step must compile many packages from source and takes tens of minutes to complete. This makes for very slow test feedback and occasionally failures when the job times out. Travis itself doesn't provide python3 packages through the `language` and `python` yaml keys like it does on Linux. Setting these keys fails trying to download the requested tarball. Give up therefore, and just use whatever python3 was installed on the image by default. Currently that is 3.6.5 from homebrew. This significantly speeds up test feedback.
The main function here is decorated with command-line options through the click library, but as far as I can tell, this change is needed to actually invoke it as a python executable when testing.
I find this more readable than running it together with the filename extension and the timestamp.
Mostly reformatting the code to fit in 80 characters. Also change some variable names, split out function argument tuple unpacking, move some info messages to the --verbose options, and handle all-success in the summary report.
The travis failures are all pycodestyle warnings. There are fewer than there were before, so we're moving in the right direction. codeclimate marks the complexity warnings on |
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.
Looks all good to me. Nice improvements!
Thanks! |
Steps toward a green travis build, similar to what I did upstream. Please review, since I made some changes to the report output.