diff --git a/.flake8 b/.flake8 new file mode 100644 index 00000000..e17ae4f4 --- /dev/null +++ b/.flake8 @@ -0,0 +1,2 @@ +[flake8] +ignore = E501,E266,W503,F401,F403 diff --git a/.travis.yml b/.travis.yml index 2201fb88..093c5117 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,8 +8,9 @@ matrix: - python: "3.7" dist: xenial # required for Python >= 3.7 (travis-ci/travis-ci#9069) install: - - pip install codecov + - pip install codecov flake8 script: + - flake8 - coverage run --source github,tests setup.py test after_success: - codecov diff --git a/doc/conf.py b/doc/conf.py index e26c68b7..3bbc4048 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -37,7 +37,7 @@ import datetime # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. sys.path.insert(0, os.path.abspath('..')) -from setup import version as setupVersion +from setup import version as setupVersion # noqa: E402 # -- General configuration ----------------------------------------------------- diff --git a/github/Issue.py b/github/Issue.py index cc8a482a..9fe6aab6 100644 --- a/github/Issue.py +++ b/github/Issue.py @@ -43,7 +43,7 @@ ################################################################################ from __future__ import absolute_import -import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error +import six.moves.urllib.parse import datetime import github.GithubObject import github.PaginatedList diff --git a/github/Label.py b/github/Label.py index edffca7d..b819d4e8 100644 --- a/github/Label.py +++ b/github/Label.py @@ -32,7 +32,7 @@ ################################################################################ from __future__ import absolute_import -import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error +import six.moves.urllib.parse import github.GithubObject diff --git a/github/Organization.py b/github/Organization.py index e9daa8af..dd5777cb 100644 --- a/github/Organization.py +++ b/github/Organization.py @@ -666,10 +666,10 @@ class Organization(github.GithubObject.CompletableGithubObject): :param role: string :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser` """ - assert (filter_ is github.GithubObject.NotSet or - isinstance(filter_, (str, six.text_type))), filter_ - assert (role is github.GithubObject.NotSet or - isinstance(role, (str, six.text_type))), role + assert (filter_ is github.GithubObject.NotSet + or isinstance(filter_, (str, six.text_type))), filter_ + assert (role is github.GithubObject.NotSet + or isinstance(role, (str, six.text_type))), role url_parameters = {} if filter_ is not github.GithubObject.NotSet: @@ -720,8 +720,8 @@ class Organization(github.GithubObject.CompletableGithubObject): :param filter_: string :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser` """ - assert (filter_ is github.GithubObject.NotSet or - isinstance(filter_, (str, six.text_type))), filter_ + assert (filter_ is github.GithubObject.NotSet + or isinstance(filter_, (str, six.text_type))), filter_ url_parameters = {} if filter_ is not github.GithubObject.NotSet: diff --git a/github/PullRequest.py b/github/PullRequest.py index 590fc07f..2dd4a9f0 100644 --- a/github/PullRequest.py +++ b/github/PullRequest.py @@ -44,7 +44,7 @@ from __future__ import absolute_import import datetime -import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error +import six.moves.urllib.parse import github.GithubObject import github.PaginatedList diff --git a/github/Repository.py b/github/Repository.py index e2e1291f..5b2aa1c9 100644 --- a/github/Repository.py +++ b/github/Repository.py @@ -87,7 +87,7 @@ from __future__ import absolute_import import sys -import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error +import six.moves.urllib.parse import datetime from base64 import b64encode diff --git a/github/Requester.py b/github/Requester.py index 63daaac2..46f68e10 100644 --- a/github/Requester.py +++ b/github/Requester.py @@ -62,7 +62,6 @@ import re import requests import sys import time -import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error import six.moves.urllib.parse from io import IOBase @@ -310,8 +309,8 @@ class Requester: elif status == 403 and output.get("message").startswith("Missing or invalid User Agent string"): cls = GithubException.BadUserAgentException elif status == 403 and ( - output.get("message").lower().startswith("api rate limit exceeded") or - output.get("message").lower().endswith("please wait a few minutes before you try again.") + output.get("message").lower().startswith("api rate limit exceeded") + or output.get("message").lower().endswith("please wait a few minutes before you try again.") ): cls = GithubException.RateLimitExceededException elif status == 404 and output.get("message") == "Not Found": diff --git a/tests/AllTests.py b/tests/AllTests.py index 84b172e2..66b819f9 100644 --- a/tests/AllTests.py +++ b/tests/AllTests.py @@ -127,4 +127,4 @@ from .Issue494 import * from .Issue572 import * from .Issue937 import * from .Issue945 import * -from .Issue823 import * \ No newline at end of file +from .Issue823 import *