-
Notifications
You must be signed in to change notification settings - Fork 388
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
Linting and deprecation fixes #234
base: master
Are you sure you want to change the base?
Conversation
…arguments (super-with-arguments)
…om bases in python3 (useless-object-inheritance).
… (use-dict-literal)
…-variable) (noted in #34 but never patched).
…ds (chained-comparison).
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.
Some suggestions, but overall fine and this can be done later too.
I wonder if we still need six.py
?
Anyway, green to merge.
@@ -765,8 +762,7 @@ def valid(self): | |||
|
|||
if self.expiration_time: | |||
return self.expiration_time > int(time.time()) | |||
else: | |||
return True | |||
return True |
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.
Even simpler:
return self.expiration_time and self.expiration_time > int(time.time())
@@ -783,8 +779,7 @@ def expire_soon(self, seconds): | |||
|
|||
if self.expiration_time: | |||
return self.expiration_time < int(time.time()) + int(seconds) | |||
else: | |||
return False | |||
return False |
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.
Same here:
return self.expiration_time and self.expiration_time < int(time.time()) + int(seconds)
return {[(k, v[0] if not isinstance(v, str) and len(v) == 1 else v) | ||
for k, v in list(dict_.items())]} |
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 it could be rewritten like this:
return {[(k, v[0] if not isinstance(v, str) and len(v) == 1 else v) | |
for k, v in list(dict_.items())]} | |
return {k: v[0] if not isinstance(v, str) and len(v) == 1 else v for k, v in dict_.items()} |
|
||
|
||
class BaseAdapter(object): | ||
class BaseAdapter(): |
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.
class BaseAdapter(): | |
class BaseAdapter: |
@@ -75,7 +75,7 @@ def items_to_dict(items): | |||
return normalize_dict(dict(res)) | |||
|
|||
|
|||
class Counter(object): | |||
class Counter(): |
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.
class Counter(): | |
class Counter: |
@@ -228,7 +226,7 @@ def id_to_name(config, short_name): | |||
'No provider with id={0} found in the config!'.format(short_name)) | |||
|
|||
|
|||
class ReprMixin(object): | |||
class ReprMixin(): |
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.
class ReprMixin(): | |
class ReprMixin: |
@@ -11,7 +11,7 @@ | |||
import abc | |||
|
|||
|
|||
class BaseSession(object): | |||
class BaseSession(): |
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.
class BaseSession(): | |
class BaseSession: |
@@ -53,7 +53,7 @@ def get(self, key): | |||
""" | |||
|
|||
|
|||
class BaseConfig(object): | |||
class BaseConfig(): |
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.
class BaseConfig(): | |
class BaseConfig: |
|
||
return wrap | ||
|
||
|
||
class BaseProvider(object): | ||
class BaseProvider(): |
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.
class BaseProvider(): | |
class BaseProvider: |
@@ -70,7 +70,7 @@ | |||
""" | |||
|
|||
|
|||
class SessionOpenIDStore(object): | |||
class SessionOpenIDStore(): |
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.
class SessionOpenIDStore(): | |
class SessionOpenIDStore: |
@@ -102,7 +102,7 @@ def _create_base_string(method, base, params): | |||
return _join_by_ampersand(method, base, normalized_qs) | |||
|
|||
|
|||
class BaseSignatureGenerator(object): | |||
class BaseSignatureGenerator(): |
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.
class BaseSignatureGenerator(): | |
class BaseSignatureGenerator: |
I've gone through the output of
pylint
andpyflakes
and tried to pick off low-hanging fruit.It should be a noop commit, but it would be good to have a 2nd pair of eyes review this one, as it's lots of small changes so the chance of mistakes are higher.
This should fix #34, #222, #232, add some future-proofing and simplify some code.