Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 1823654 - Mostly use double quotes #7900

Merged
merged 2 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ repos:
hooks:
- id: black
language_version: python3.9
exclude: ^treeherder/.*/migrations
2 changes: 1 addition & 1 deletion manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# Display deprecation warnings, which are hidden by default:
# https://docs.python.org/3.7/library/warnings.html#default-warning-filters
warnings.simplefilter('default', DeprecationWarning)
warnings.simplefilter("default", DeprecationWarning)

if __name__ == "__main__":
os.environ["DJANGO_SETTINGS_MODULE"] = "treeherder.config.settings"
Expand Down
2 changes: 1 addition & 1 deletion misc/compare_pushes.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def main(args):
production_client = TreeherderClient(server_url=HOSTS["production"])

# Support comma separated projects
projects = args.projects.split(',')
projects = args.projects.split(",")
for _project in projects:
logger.info("Comparing {} against production.".format(_project))
# Remove properties that are irrelevant for the comparison
Expand Down
8 changes: 0 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,7 @@ mdx_truly_sane_lists = { version = "1.3", optional = true }
[tool.black]
line-length = 100
target-version = ['py39']
skip-string-normalization = true
include = '\.pyi?$'
exclude = '''
/(
treeherder/model/migrations
| treeherder/perf/migrations
| treeherder/changelog/migrations
)/
'''

[tool.ruff]
# Same as Black.
Expand Down
6 changes: 3 additions & 3 deletions tests/autoclassify/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ def create_failure_lines(job, failure_line_list, start_line=0):
failure_line = FailureLine(**data)
job_log = JobLog.objects.create(
job=job,
name='{}{}'.format(base_data.get('test'), job.id),
url='bar{}'.format(i),
name="{}{}".format(base_data.get("test"), job.id),
url="bar{}".format(i),
status=1,
)
print('create jobLog for job id: {}'.format(job.id))
print("create jobLog for job id: {}".format(job.id))
failure_line.job_log = job_log
failure_line.save()
failure_lines.append(failure_line)
Expand Down
32 changes: 16 additions & 16 deletions tests/client/test_perfherder_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,37 @@ class PerfherderClientTest(unittest.TestCase):
@responses.activate
def test_get_performance_signatures(self):
pc = PerfherderClient()
url = pc._get_endpoint_url(pc.PERFORMANCE_SIGNATURES_ENDPOINT, project='mozilla-central')
url = pc._get_endpoint_url(pc.PERFORMANCE_SIGNATURES_ENDPOINT, project="mozilla-central")
content = {
'signature1': {'cheezburgers': 1},
'signature2': {'hamburgers': 2},
'signature3': {'cheezburgers': 2},
"signature1": {"cheezburgers": 1},
"signature2": {"hamburgers": 2},
"signature3": {"cheezburgers": 2},
}
responses.add(responses.GET, url, json=content, status=200)

sigs = pc.get_performance_signatures('mozilla-central')
sigs = pc.get_performance_signatures("mozilla-central")
self.assertEqual(len(sigs), 3)
self.assertEqual(sigs.get_signature_hashes(), ['signature1', 'signature2', 'signature3'])
self.assertEqual(sigs.get_property_names(), set(['cheezburgers', 'hamburgers']))
self.assertEqual(sigs.get_property_values('cheezburgers'), set([1, 2]))
self.assertEqual(sigs.get_signature_hashes(), ["signature1", "signature2", "signature3"])
self.assertEqual(sigs.get_property_names(), set(["cheezburgers", "hamburgers"]))
self.assertEqual(sigs.get_property_values("cheezburgers"), set([1, 2]))

@responses.activate
def test_get_performance_data(self):
pc = PerfherderClient()

url = '{}?{}'.format(
pc._get_endpoint_url(pc.PERFORMANCE_DATA_ENDPOINT, project='mozilla-central'),
'signatures=signature1&signatures=signature2',
url = "{}?{}".format(
pc._get_endpoint_url(pc.PERFORMANCE_DATA_ENDPOINT, project="mozilla-central"),
"signatures=signature1&signatures=signature2",
)
content = {
'signature1': [{'value': 1}, {'value': 2}],
'signature2': [{'value': 2}, {'value': 1}],
"signature1": [{"value": 1}, {"value": 2}],
"signature2": [{"value": 2}, {"value": 1}],
}
responses.add(responses.GET, url, json=content, status=200)

series_list = pc.get_performance_data(
'mozilla-central', signatures=['signature1', 'signature2']
"mozilla-central", signatures=["signature1", "signature2"]
)
self.assertEqual(len(series_list), 2)
self.assertEqual(series_list['signature1']['value'], [1, 2])
self.assertEqual(series_list['signature2']['value'], [2, 1])
self.assertEqual(series_list["signature1"]["value"], [1, 2])
self.assertEqual(series_list["signature2"]["value"], [2, 1])
6 changes: 3 additions & 3 deletions tests/client/test_treeherder_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class TreeherderClientTest(unittest.TestCase):
@responses.activate
def test_get_job(self):
tdc = TreeherderClient()
url = tdc._get_endpoint_url(tdc.JOBS_ENDPOINT, project='autoland')
url = tdc._get_endpoint_url(tdc.JOBS_ENDPOINT, project="autoland")
content = {
"meta": {"count": 3, "repository": "autoland", "offset": 0},
"results": self.JOB_RESULTS,
Expand All @@ -26,7 +26,7 @@ def test_get_job(self):
@responses.activate
def test_get_pushes(self):
tdc = TreeherderClient()
url = tdc._get_endpoint_url(tdc.PUSH_ENDPOINT, project='autoland')
url = tdc._get_endpoint_url(tdc.PUSH_ENDPOINT, project="autoland")
content = {
"meta": {"count": 3, "repository": "autoland", "offset": 0},
"results": self.PUSHES,
Expand All @@ -38,5 +38,5 @@ def test_get_pushes(self):
self.assertEqual(pushes, self.PUSHES)


if __name__ == '__main__':
if __name__ == "__main__":
unittest.main()
Loading