-
-
Notifications
You must be signed in to change notification settings - Fork 7.8k
[Sprint] Rc fixes #2193
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
[Sprint] Rc fixes #2193
Conversation
…urn True for either bytestrings or unicode strings. So, in order to allow unicode in the matplotlibrc, we need to use this typechecking rather than the former (which was type(s) is string )
…ts passed along with the file sometime.
…than the = that it currently uses.
…ophes. Removing the apostrophes seemed to work. I'm curious about why this occured for some but not all variables. Anyway, my test complained about these but not the others.
return [validate_color(c.strip()) for c in s.split(',')] | ||
else: | ||
assert type(s) in [list, tuple] | ||
return [validate_color(c) for c in s] | ||
|
||
|
||
def validate_string(s): | ||
'return a clean string' | ||
assert isinstance(s, basestring) |
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'm not a big fan of doing asserts in code. Not only do they raise exception that are hard to understand, but they are also only evaluated when the code is not run as optimized. Maybe we should do a proper verification, and raise a more explicit error message?
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.
sure. will do.
The assert has been removed and the improper docstring is now proper, as requested by @NelleV . Thanks for the review! As an aside, the rest of the class uses lots of improper docstrings and asserts. An issue should probably be added to clean it up, since I imagine a standard style is better than an inconsistent one. Maybe this fits within MEP8 goals - should we make a new issue? |
This reminds me -- and it is probably best as a follow-on to this PR -- the matplotlibrc.template is a real mess formatting-wise, and it would be great to give in a consistent look, possibly with a little more whitespace throughout, to make it easier to use and read. |
This is really cool work and fixes a lot of niggly inconsistencies, which I really like. My one worry with this approach is that it might be hard to keep So I wonder if there isn't some way we could automate the conversion of
Here, you could only remove the comment character when it's followed by a non-space. Am I making sense? |
Yep, I agree, you're making plenty of sense. Thanks! I'll close this pr for now and reopen it when I'm done. |
This pull request achieves approximately two things.
Changes in rcsetup.py :
type("astring") is str
doesn't work for unicode, butisinstance("astring", basestring)
works for both bytestrings and unicode. (http://www.evanjones.ca/python-utf8.html). So, I exchanged instances of the former with the latter.Changes in matplotlibrc.template :
New test files :