Skip to content

Commit e159141

Browse files
committed
Reapply "Make flake8 happy"
This reverts commit 3302522.
1 parent 2b4b0fa commit e159141

9 files changed

Lines changed: 18 additions & 15 deletions

File tree

.flake8

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@
55
[flake8]
66
max-complexity = 15
77
max-line-length = 120
8+
per-file-ignores =
9+
src/hermes/commands/marketplace.py:E231

src/hermes/commands/deposit/invenio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def resolve_doi(self, doi) -> str:
152152
:return: The record ID on the respective instance.
153153
"""
154154

155-
res = self.client.get(f'https://doi.org/{doi}')
155+
res = self.client.get(f'https://doi.org/{doi}') # noqa E231
156156

157157
# This is a mean hack due to DataCite answering a 404 with a 200 status
158158
if res.url == 'https://datacite.org/404.html':

src/hermes/commands/harvest/cff.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def _convert_cff_to_codemeta(self, cff_data: str) -> t.Any:
8080
def _validate(self, cff_file: pathlib.Path, cff_dict: t.Dict) -> bool:
8181
audit_log = logging.getLogger('audit.cff')
8282

83-
cff_schema_url = f'https://citation-file-format.github.io/{_CFF_VERSION}/schema.json'
83+
cff_schema_url = f'https://citation-file-format.github.io/{_CFF_VERSION}/schema.json' # noqa E231
8484

8585
# TODO: we should ship the schema we reference to by default to avoid unnecessary network traffic.
8686
# If the requested version is not already downloaded, go ahead and download it.
@@ -101,7 +101,7 @@ def _validate(self, cff_file: pathlib.Path, cff_dict: t.Dict) -> bool:
101101
audit_log.info('')
102102
audit_log.info('See the Citation File Format schema guide for further details:')
103103
audit_log.info(
104-
f'<https://github.com/citation-file-format/citation-file-format/blob/{_CFF_VERSION}/schema-guide.md>.')
104+
f'<https://github.com/citation-file-format/citation-file-format/blob/{_CFF_VERSION}/schema-guide.md>.') # noqa E231
105105
return False
106106

107107
elif len(errors) == 0:

src/hermes/commands/init/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def get_git_hoster_from_url(url: str) -> GitHoster:
9999
Returns the matching GitHoster value to the given url. Returns GitHoster.Empty if none is found.
100100
"""
101101
parsed_url = urlparse(url)
102-
git_base_url = f"{parsed_url.scheme}://{parsed_url.netloc}/"
102+
git_base_url = f"{parsed_url.scheme}://{parsed_url.netloc}/" # noqa E231
103103
if "github.com" in url:
104104
return GitHoster.GitHub
105105
elif connect_gitlab.is_url_gitlab(git_base_url):

src/hermes/commands/init/util/connect_github.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def allow_actions(project_url: str, token):
4949
repo_name = url_split[-1]
5050

5151
# GitHub API URLs
52-
repo_url = f"https://api.github.com/repos/{repo_owner}/{repo_name}"
52+
repo_url = f"https://api.github.com/repos/{repo_owner}/{repo_name}" # noqa E231
5353
action_permissions_url = f"{repo_url}/actions/permissions/workflow"
5454

5555
# Headers for GitHub API requests
@@ -89,7 +89,7 @@ def create_secret(project_url: str, secret_name: str, secret_value, token):
8989
repo_name = url_split[-1]
9090

9191
# GitHub API URLs
92-
repo_url = f"https://api.github.com/repos/{repo_owner}/{repo_name}"
92+
repo_url = f"https://api.github.com/repos/{repo_owner}/{repo_name}" # noqa E231
9393
public_key_url = f"{repo_url}/actions/secrets/public-key"
9494
secrets_url = f"{repo_url}/actions/secrets/{secret_name}"
9595

src/hermes/commands/init/util/connect_gitlab.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
site_specific_oauth_clients = [
1818
{
19-
"url": "https://gitlab.com/",
19+
"url": "https://gitlab.com/", # noqa E231
2020
"client_id": "1133e9cee188c31bd68c9d0e8531774a4aae9d2458e13d83e67991213f868007",
2121
"name_addition": "gitlab.com"
2222
}, {
@@ -33,14 +33,14 @@
3333

3434
def is_url_gitlab(url: str) -> bool:
3535
parsed_url = urlparse(url)
36-
return requests.get(f"{parsed_url.scheme}://{parsed_url.netloc}/api/v4/version").status_code == 401
36+
return requests.get(f"{parsed_url.scheme}://{parsed_url.netloc}/api/v4/version").status_code == 401 # noqa E231
3737

3838

3939
class GitLabConnection:
4040
def __init__(self, project_url: str):
4141
self.project_url: str = project_url
4242
parsed_url = urlparse(project_url)
43-
self.base_url: str = f"{parsed_url.scheme}://{parsed_url.netloc}/"
43+
self.base_url: str = f"{parsed_url.scheme}://{parsed_url.netloc}/" # noqa E231
4444
self.api_url: str = urljoin(self.base_url, "api/v4/")
4545
self.project_namespace_name: str = parsed_url.path.removeprefix("/")
4646
self.gitlab_instance_name: str = f"GitLab ({parsed_url.netloc})"

src/hermes/commands/init/util/oauth_process.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def open_browser(self, port: int = None) -> bool:
9292
if DEACTIVATE_BROWSER_OPENING:
9393
return False
9494
port = port or self.local_port
95-
return webbrowser.open(f'http://localhost:{port}')
95+
return webbrowser.open(f'http://localhost:{port}') # noqa E231
9696

9797
def get_tokens_from_refresh_token(self, refresh_token: str) -> dict[str: str]:
9898
"""Returns access and refresh token as dict using a refresh token"""

src/hermes/commands/init/util/slim_click.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,9 @@ def choose(text: str, options: list[str], default: int = 0) -> int:
137137
assert 0 <= default < len(options), "Default index should match the options list."
138138
echo(text)
139139
for i, option in enumerate(options):
140-
index = f"{i:>2d}"
140+
index = f"{i:>2d}" # noqa E231
141141
if i == default:
142-
index = f"*{i:>1d}"
142+
index = f"*{i:>1d}" # noqa E231
143143
print(f"[{index}] {option}")
144144
while True:
145145
chosen_index = -1
@@ -171,7 +171,7 @@ def next_step(description: str):
171171
def create_console_hyperlink(url: str, word: str) -> str:
172172
"""Use this to have a consistent display of hyperlinks."""
173173
if USE_FANCY_HYPERLINKS:
174-
return f"\033]8;;{url}\033\\{word}\033]8;;\033\\"
174+
return f"\033]8;;{url}\033\\{word}\033]8;;\033\\" # noqa E231,E702
175175
return f"{word} ({url})"
176176

177177

src/hermes/commands/postprocess/invenio.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ def cff_doi(ctx):
3434
try:
3535
cff = yaml.load(open('CITATION.cff', 'r'), yaml.Loader)
3636
new_identifier = {
37-
'description': f"DOI for the published version {deposition['metadata']['version']} "
38-
f"[generated by hermes]",
37+
'description': "DOI for the published version "
38+
f"{deposition['metadata']['version']} "
39+
"[generated by hermes]",
3940
'type': 'doi',
4041
'value': deposition['doi']
4142
}

0 commit comments

Comments
 (0)