Skip to content

Commit 8baa94f

Browse files
committed
Fix fake flake8 issues
1 parent ed30d45 commit 8baa94f

File tree

13 files changed

+26
-24
lines changed

13 files changed

+26
-24
lines changed

config/settings/production.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@
7070
# ------------------------
7171
STATICFILES_STORAGE = "sde_indexing_helper.utils.storages.StaticRootS3Boto3Storage"
7272
COLLECTFAST_STRATEGY = "collectfast.strategies.boto3.Boto3Strategy"
73-
STATIC_URL = f"https://{aws_s3_domain}/static/"
73+
STATIC_URL = f"https://{aws_s3_domain}/static/" # noqa: E231
7474
# MEDIA
7575
# ------------------------------------------------------------------------------
7676
DEFAULT_FILE_STORAGE = "sde_indexing_helper.utils.storages.MediaRootS3Boto3Storage"
77-
MEDIA_URL = f"https://{aws_s3_domain}/media/"
77+
MEDIA_URL = f"https://{aws_s3_domain}/media/" # noqa: E231
7878

7979
# EMAIL
8080
# ------------------------------------------------------------------------------

config_generation/db_to_xml_file_based.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def update_or_add_element_value(
9898
parent_element = xml_root if not parent_element_name else xml_root.find(parent_element_name)
9999

100100
if parent_element is None:
101-
raise ValueError(f"Parent element '{parent_element_name}' not found in XML.")
101+
raise ValueError(f"Parent element '{parent_element_name}' not found in XML.") # noqa: E713
102102

103103
existing_element = parent_element.find(element_name)
104104
if not add_duplicate and existing_element:

feedback/models.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def format_notification_message(self):
3333
Returns a formatted notification message containing details from this Feedback instance.
3434
"""
3535
notification_message = (
36-
f"<!here> New Feedback Received : \n"
36+
f"<!here> New Feedback Received : \n" # noqa: E203
3737
f"Name: {self.name}\n"
3838
f"Email: {self.email}\n"
3939
f"Subject: {self.subject}\n"

scraper/url_grouper.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,12 @@
4242
output_file.write(f"<h1>{BASE_URL}</h1>\n")
4343
output_file.write("<ul>\n")
4444
for key, value in my_dict.items():
45-
output_file.write(f'<li><a href="{PROTOCOL}://{BASE_URL}{key}" target=_blank>{key}</a>\n')
45+
output_file.write(f'<li><a href="{PROTOCOL}://{BASE_URL}{key}" target=_blank>{key}</a>\n') # noqa: E231
4646
output_file.write("<ul>\n")
4747
for item in value:
48-
output_file.write(f'<li><a href="{PROTOCOL}://{BASE_URL}{key}/{item}" target=_blank>{item}</a></li>\n')
48+
output_file.write(
49+
f'<li><a href="{PROTOCOL}://{BASE_URL}{key}/{item}" target=_blank>{item}</a></li>\n'
50+
) # noqa: E231
4951
output_file.write("</ul>\n")
5052
output_file.write("</li>\n")
5153
output_file.write("</ul>\n")

scripts/ej/create_ej_dump.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
inferences are supplied by the classification model. the contact point is Bishwas
3-
cmr is supplied by running https://github.com/NASA-IMPACT/llm-app-EJ-classifier/blob/develop/scripts/data_processing/download_cmr.py
3+
cmr is supplied by running
4+
github.com/NASA-IMPACT/llm-app-EJ-classifier/blob/develop/scripts/data_processing/download_cmr.py
45
move to the serve like this: scp ej_dump_20240814_143036.json sde:/home/ec2-user/sde_indexing_helper/backups/
56
"""
67

scripts/find_redirects_solar_urls.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ def csv_to_dict_list(file_path):
4343
scraped_title = soup.find("title").text.strip() if soup.find("title") else ""
4444
except (AssertionError, Exception) as parse_error:
4545
scraped_title = ""
46-
print(f"Error parsing URL {url_info['url']}: {parse_error}")
46+
print(f"Error parsing URL {url_info['url']}: {parse_error}") # noqa: F821
4747
except requests.RequestException as e:
48-
print(f"Error fetching URL {url_info['url']}: {e}")
48+
print(f"Error fetching URL {url_info['url']}: {e}") # noqa: F821
4949
response_url = ""
5050
scraped_title = ""
5151

scripts/quality_and_indexing/restore_deleted_files.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""
2-
you need to run this script in the root of the repository that from which the file was deleted, in this case the root of the sinequa_configs repository.
2+
you need to run this script in the root of the repository that from which the file was deleted,
3+
in this case the root of the sinequa_configs repository.
34
"""
45

56
import subprocess

sde_collections/admin.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def export_as_csv(self, request, queryset):
154154
field_names = [field.name for field in meta.fields]
155155

156156
response = HttpResponse(content_type="text/csv")
157-
response["Content-Disposition"] = f"attachment; filename={meta}.csv"
157+
response["Content-Disposition"] = f"attachment; filename={meta}.csv" # noqa: E702
158158
writer = csv.writer(response)
159159

160160
writer.writerow(field_names)

sde_collections/models/collection.py

+5-7
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import requests
55
from django.contrib.auth import get_user_model
66
from django.db import models
7-
from django.db.models import Q
87
from django.db.models.signals import post_save
98
from django.dispatch import receiver
109
from model_utils import FieldTracker
@@ -130,7 +129,7 @@ def tree_root(self) -> str:
130129

131130
@property
132131
def server_url_secret_prod(self) -> str:
133-
base_url = "https://sciencediscoveryengine.nasa.gov"
132+
base_url = "https://sciencediscoveryengine.nasa.gov" # noqa: E231
134133
payload = {
135134
"name": "secret-prod",
136135
"scope": "All",
@@ -144,7 +143,7 @@ def server_url_secret_prod(self) -> str:
144143

145144
@property
146145
def server_url_prod(self) -> str:
147-
base_url = "https://sciencediscoveryengine.nasa.gov"
146+
base_url = "https://sciencediscoveryengine.nasa.gov" # noqa: E231
148147
payload = {
149148
"name": "query-smd-primary",
150149
"scope": "All",
@@ -371,13 +370,12 @@ def candidate_urls_count(self) -> int:
371370

372371
@property
373372
def sinequa_configuration(self) -> str:
374-
return (
375-
f"https://github.com/NASA-IMPACT/sde-backend/blob/production/sources/SDE/{self.config_folder}/default.xml"
376-
)
373+
URL = f"https://github.com/NASA-IMPACT/sde-backend/blob/production/sources/SDE/{self.config_folder}/default.xml" # noqa: E231, E501
374+
return URL
377375

378376
@property
379377
def github_issue_link(self) -> str:
380-
return f"https://github.com/NASA-IMPACT/sde-project/issues/{self.github_issue_number}"
378+
return f"https://github.com/NASA-IMPACT/sde-project/issues/{self.github_issue_number}" # noqa: E231
381379

382380
@classmethod
383381
def _fetch_json_results(cls, url):

sde_collections/models/pattern.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def validate_title_pattern(title_pattern_string):
143143

144144
if element_type == "xpath":
145145
if not is_valid_xpath(element_value):
146-
raise ValidationError(f"'xpath:{element_value}' is not a valid xpath.")
146+
raise ValidationError(f"'xpath:{element_value}' is not a valid xpath.") # noqa: E231
147147
elif element_type == "brace":
148148
try:
149149
is_valid_fstring(element_value)

sde_collections/utils/health_check.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,12 @@ def create_exclude_pattern_report(match_pattern, url):
127127

128128
# check with http://
129129
if match_pattern.find("http://") == -1:
130-
url = f"http://{match_pattern}"
130+
url = f"http://{match_pattern}" # noqa: E231
131131
if url in candidate_urls_sinequa:
132132
exclude_pattern_report.append(create_exclude_pattern_report(match_pattern, url))
133133

134134
if match_pattern.find("https://") == -1:
135-
url = f"https://{match_pattern}"
135+
url = f"https://{match_pattern}" # noqa: E231
136136
if url in candidate_urls_sinequa:
137137
exclude_pattern_report.append(create_exclude_pattern_report(match_pattern, url))
138138
else:

sde_collections/utils/slack_utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
def format_slack_message(name, details, collection_id):
9191
message_template = details["message"]
9292
tags = " ".join([f"<{user}>" for user in details["tags"]])
93-
link = f"https://sde-indexing-helper.nasa-impact.net/{collection_id}/"
93+
link = f"https://sde-indexing-helper.nasa-impact.net/{collection_id}/" # noqa: E231
9494
linked_name = f"<{link}|{name}>"
9595
return tags + " " + message_template.format(name=linked_name)
9696

@@ -101,5 +101,5 @@ def send_slack_message(message):
101101
response = requests.post(webhook_url, json=payload)
102102
if response.status_code != 200:
103103
raise ValueError(
104-
f"Request to Slack returned an error {response.status_code}, the response is:\n{response.text}"
104+
f"Request to Slack returned an error {response.status_code}, the response is:\n{response.text}" # noqa: E231, E501
105105
)

sde_collections/utils/title_resolver.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def is_valid_fstring(pattern: str) -> bool:
3232
if node.value.id not in context:
3333
variables_allowed = ", ".join([key for key in context.keys()])
3434
raise ValueError(
35-
f"Variable '{node.value.id}' not allowed in f-string pattern."
35+
f"Variable '{node.value.id}' not allowed in f-string pattern." # noqa: E713
3636
f" Allowed variables are: {variables_allowed}"
3737
)
3838

0 commit comments

Comments
 (0)