Skip to content

Commit

Permalink
Ruff unsafe fixes auto fix
Browse files Browse the repository at this point in the history
  • Loading branch information
yschneider-sinneria committed Feb 2, 2024
1 parent 11671af commit 1c59886
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ def _fetch_data(self, project):
% project
)
files_bugzilla_data = None
file_name = "files_bugzilla_map_%s_%s.json" % (project, self.run_id)
file_name = f"files_bugzilla_map_{project}_{self.run_id}.json"
exception = None
try:
tests_folder = os.path.dirname(__file__)
Expand Down
4 changes: 2 additions & 2 deletions tests/sampledata.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def __init__(self):
self.text_log_summary = json.load(f)

with open(
"{0}/sample_data/pulse_consumer/taskcluster_pulse_messages.json".format(
"{}/sample_data/pulse_consumer/taskcluster_pulse_messages.json".format(
os.path.dirname(__file__)
)
) as f:
Expand All @@ -31,7 +31,7 @@ def __init__(self):
self.taskcluster_tasks = json.load(f)

with open(
"{0}/sample_data/pulse_consumer/taskcluster_transformed_jobs.json".format(
"{}/sample_data/pulse_consumer/taskcluster_transformed_jobs.json".format(
os.path.dirname(__file__)
)
) as f:
Expand Down
2 changes: 1 addition & 1 deletion treeherder/changelog/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Meta:
unique_together = ("id", "remote_id", "type")

def __str__(self):
return "[%s] %s by %s" % (self.id, self.message, self.author)
return f"[{self.id}] {self.message} by {self.author}"


class ChangelogFile(models.Model):
Expand Down
2 changes: 1 addition & 1 deletion treeherder/etl/push_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def get_branch(self):
if self.message_body["details"].get("event.head.tag"):
return "tag"

return super(GithubPushTransformer, self).get_branch()
return super().get_branch()

def transform(self, repository):
push_data = compare_shas(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def handle(self, *args, **options):

if not options["profile"]:
for name, artifact in artifact_bc.artifacts.items():
print("%s, %s" % (name, json.dumps(artifact, indent=2)))
print(f"{name}, {json.dumps(artifact, indent=2)}")

if options["profile"]:
print("Timings: %s" % times)
Expand Down
10 changes: 5 additions & 5 deletions treeherder/perf/management/commands/import_perf_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ def progress_notifier(
tabs_no=0,
):
total_items = len(iterable)
print("{0}Fetching {1} {2} item(s)...".format("\t" * tabs_no, total_items, item_name))
print("{}Fetching {} {} item(s)...".format("\t" * tabs_no, total_items, item_name))

prev_percentage = None
for idx, item in enumerate(iterable):
item_processor(item)
percentage = int((idx + 1) * 100 / total_items)
if percentage % 10 == 0 and percentage != prev_percentage:
print("{0}Fetched {1}% of {2} item(s)".format("\t" * tabs_no, percentage, item_name))
print("{}Fetched {}% of {} item(s)".format("\t" * tabs_no, percentage, item_name))
prev_percentage = percentage


Expand Down Expand Up @@ -124,7 +124,7 @@ def fillup_target(self, **filters):
print("Fetching all affordable data...\n")
# TODO: JSON dump the list
print(
"From tables {0}".format(
"From tables {}".format(
", ".join([model._meta.db_table for model in self.DECENT_SIZED_TABLES])
)
)
Expand Down Expand Up @@ -314,7 +314,7 @@ def bring_in_alert(self, alert):
if alert.id in self.models_instances["performance_alert"]:
return

print("{0}Fetching alert #{1}...".format("\t" * 2, alert.id))
print("{}Fetching alert #{}...".format("\t" * 2, alert.id))
if alert.related_summary:
if alert.related_summary not in self.models_instances["performance_alert_summary"]:
# if the alert summary identified isn't registered yet
Expand Down Expand Up @@ -365,7 +365,7 @@ def bring_in_job(self, job):
if job.id in self.models_instances["job"]:
return

occasional_log("{0}Fetching job #{1}".format("\t" * 4, job.id))
occasional_log("{}Fetching job #{}".format("\t" * 4, job.id))

self.update_list("reference_data_signature", job.signature)
self.update_list("build_platform", job.build_platform)
Expand Down
4 changes: 2 additions & 2 deletions treeherder/perf/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ class PerformanceAlertSummary(models.Model):
issue_tracker = models.ForeignKey(IssueTracker, on_delete=models.PROTECT, default=1) # Bugzilla

def __init__(self, *args, **kwargs):
super(PerformanceAlertSummary, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)

# allows updating timestamps only on new values
self.__prev_bug_number = self.bug_number
Expand All @@ -333,7 +333,7 @@ def save(self, *args, **kwargs):
self.triage_due_date = triage_due
if self.bug_due_date != bug_due:
self.bug_due_date = bug_due
super(PerformanceAlertSummary, self).save(*args, **kwargs)
super().save(*args, **kwargs)
self.__prev_bug_number = self.bug_number

def update_status(self, using=None):
Expand Down
2 changes: 1 addition & 1 deletion treeherder/perfalert/perfalert/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def __lt__(self, o):

def __repr__(self):
values_str = "[ %s ]" % ", ".join(["%.3f" % value for value in self.values])
return "<%s: %s, %s, %.3f, %s>" % (
return "<{}: {}, {}, {:.3f}, {}>".format(
self.push_timestamp,
self.push_id,
values_str,
Expand Down
2 changes: 1 addition & 1 deletion treeherder/push_health/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def clean_test(test, signature, message):
elif clean_name.startswith("http://10.0"):
left = "/tests/".join(left.split("/tests/")[1:])
right = "/tests/".join(right.split("/tests/")[1:])
clean_name = "%s%s%s" % (left, splitter, right)
clean_name = f"{left}{splitter}{right}"

if "test_end for" in clean_name:
clean_name = clean_name.split()[2]
Expand Down
2 changes: 1 addition & 1 deletion treeherder/webapp/api/note.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def create(self, request, project):
exc_info=True,
)

return Response({"message": "note stored for job {0}".format(request.data["job_id"])})
return Response({"message": "note stored for job {}".format(request.data["job_id"])})

def destroy(self, request, project, pk=None):
"""
Expand Down

0 comments on commit 1c59886

Please sign in to comment.