Skip to content

Commit

Permalink
Added changes to get us to 9.72 for pylint
Browse files Browse the repository at this point in the history
  • Loading branch information
duckduckgrayduck committed Nov 29, 2023
1 parent 0a79cbc commit 6d81c97
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ max-line-length=88
good-names=i,x1,x2,y1,y2

[MESSAGES CONTROL]
disable=missing-docstring,too-many-ancestors,too-few-public-methods,no-else-return,no-member,attribute-defined-outside-init,similarities,import-outside-toplevel,cyclic-import,no-member,no-else-raise,too-many-instance-attributes,too-many-arguments,ungrouped-imports,useless-object-inheritance,no-else-continue
disable=W1201,W1202,W1203,missing-docstring,too-many-ancestors,too-few-public-methods,no-else-return,no-member,attribute-defined-outside-init,similarities,import-outside-toplevel,cyclic-import,no-member,no-else-raise,too-many-instance-attributes,too-many-arguments,ungrouped-imports,useless-object-inheritance,no-else-continue
2 changes: 1 addition & 1 deletion documentcloud/addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def _create_client(self, args):
self.client.refresh_token = args["refresh_token"]
if args["token"] is not None:
self.client.session.headers.update(
{"Authorization": "Bearer {}".format(args["token"])}
{"Authorization": f"Bearer {args['token']}"}
)

# custom user agent for AddOns
Expand Down
4 changes: 1 addition & 3 deletions documentcloud/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,7 @@ def get(self, id_, expand=None):
params = {"expand": ",".join(expand)}
else:
params = {}
response = self.client.get(
"{}/{}/".format(self.api_path, get_id(id_)), params=params
)
response = self.client.get(f"{self.api_path}/{get_id(id_)}/", params=params)
# pylint: disable=not-callable
return self.resource(self.client, response.json())

Expand Down
7 changes: 5 additions & 2 deletions documentcloud/documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,10 @@ def get_page_text_url(self, page=1):
return f"{self.asset_url}documents/{self.id}/pages/{self.slug}-p{page}.txt"

def get_page_position_json_url(self, page=1):
return f"{self.asset_url}documents/{self.id}/pages/{self.slug}-p{page}.position.json"
return (
f"{self.asset_url}documents/{self.id}/pages/"
f"{self.slug}-p{page}.position.json"
)

def get_json_text_url(self):
return f"{self.asset_url}documents/{self.id}/{self.slug}.txt.json"
Expand Down Expand Up @@ -375,7 +378,7 @@ def upload_directory(self, path, handle_errors=False, extensions=".pdf", **kwarg
# Do not set the same title for all documents
kwargs.pop("title", None)

# If extensions are specified as None, it will check for all supported filetypes.
# If extensions are specified as None, check for all supported filetypes.
if extensions is None:
extensions = SUPPORTED_EXTENSIONS

Expand Down
11 changes: 5 additions & 6 deletions documentcloud/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,17 @@ class ProjectClient(BaseAPIClient):
def all(self, **params):
return self.list(user=self.client.user_id, **params)

def get(self, id=None, title=None):
# pylint:disable=redefined-builtin, arguments-differ
def get(self, id_=None, title=None): # pylint:disable=arguments-renamed
# pylint disables are necessary for backward compatibility
if id is not None and title is not None:
if id_ is not None and title is not None:
raise ValueError(
"You can only retrieve a Project by id or title, not by both"
)
elif id is None and title is None:
elif id_ is None and title is None:
raise ValueError("You must provide an id or a title to make a request.")

if id is not None:
return self.get_by_id(id)
if id_ is not None:
return self.get_by_id(id_)
else:
return self.get_by_title(title)

Expand Down
4 changes: 2 additions & 2 deletions documentcloud/toolbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"""

# Third Party
from urllib.parse import urlparse
from itertools import zip_longest
import requests
from requests.adapters import HTTPAdapter
from urllib3.util.retry import Retry
from urllib.parse import urlparse
from itertools import zip_longest


def requests_retry_session(
Expand Down

0 comments on commit 6d81c97

Please sign in to comment.