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

Linting and deprecation fixes #234

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

Linting and deprecation fixes #234

wants to merge 13 commits into from

Conversation

mrichar1
Copy link
Member

I've gone through the output of pylint and pyflakes 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.

Copy link
Member

@jensens jensens left a 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
Copy link
Member

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
Copy link
Member

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)

Comment on lines +53 to +54
return {[(k, v[0] if not isinstance(v, str) and len(v) == 1 else v)
for k, v in list(dict_.items())]}
Copy link

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:

Suggested change
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():
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
class BaseAdapter():
class BaseAdapter:

@@ -75,7 +75,7 @@ def items_to_dict(items):
return normalize_dict(dict(res))


class Counter(object):
class Counter():
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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():
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
class ReprMixin():
class ReprMixin:

@@ -11,7 +11,7 @@
import abc


class BaseSession(object):
class BaseSession():
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
class BaseSession():
class BaseSession:

@@ -53,7 +53,7 @@ def get(self, key):
"""


class BaseConfig(object):
class BaseConfig():
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
class BaseConfig():
class BaseConfig:


return wrap


class BaseProvider(object):
class BaseProvider():
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
class BaseProvider():
class BaseProvider:

@@ -70,7 +70,7 @@
"""


class SessionOpenIDStore(object):
class SessionOpenIDStore():
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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():
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
class BaseSignatureGenerator():
class BaseSignatureGenerator:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

redundant code
3 participants