Skip to content

Commit dcf525b

Browse files
update black formatter to 24.8.0 (#4952)
* update black formatter * reformatted 25.1.0 * removed 25.1.0 * downgrade to 24.8 * downgrade to 24.8
1 parent 8e9a3be commit dcf525b

File tree

17 files changed

+45
-65
lines changed

17 files changed

+45
-65
lines changed

.github/workflows/black.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ jobs:
77
runs-on: ubuntu-latest
88
steps:
99
- uses: actions/checkout@v3
10-
- uses: psf/black@23.12.1
10+
- uses: psf/black@24.8.0
1111
with:
1212
options: "--check --verbose -l 100"

scheduler/job_requester/requester.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,7 @@ def assign_sagemaker_instance_type(self, image):
116116
return (
117117
"ml.g5.12xlarge"
118118
if "gpu" in image
119-
else "ml.c5.4xlarge"
120-
if "tensorflow" in image
121-
else "ml.c5.9xlarge"
119+
else "ml.c5.4xlarge" if "tensorflow" in image else "ml.c5.9xlarge"
122120
)
123121

124122
def extract_timestamp(self, ticket_key):

src/patch_helper.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -216,13 +216,13 @@ def conduct_autopatch_build_setup(pre_push_image_object: DockerImage, download_p
216216
s3_downloaded_path=download_path,
217217
python_version=info.get("python_version"),
218218
)
219-
THREADS[
220-
f"trigger_enhanced_scan_patching-{base_image_uri_for_patch_builds}"
221-
] = executor.submit(
222-
trigger_enhanced_scan_patching,
223-
image_uri=base_image_uri_for_patch_builds,
224-
patch_details_path=current_patch_details_path,
225-
python_version=info.get("python_version"),
219+
THREADS[f"trigger_enhanced_scan_patching-{base_image_uri_for_patch_builds}"] = (
220+
executor.submit(
221+
trigger_enhanced_scan_patching,
222+
image_uri=base_image_uri_for_patch_builds,
223+
patch_details_path=current_patch_details_path,
224+
python_version=info.get("python_version"),
225+
)
226226
)
227227
FORMATTER.progress(THREADS)
228228

src/prepare_dlc_dev_environment.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -599,9 +599,9 @@ def handle_restore_option(toml_path, buildspec_paths, to_commit, to_push):
599599
if buildspec_paths:
600600
for buildspec_path in buildspec_paths:
601601
orig_buildspec = restore_buildspec(buildspec_path)
602-
changes[
603-
os.path.join(get_cloned_folder_path(), buildspec_path)
604-
] = f"Restored {buildspec_path} to {orig_buildspec}"
602+
changes[os.path.join(get_cloned_folder_path(), buildspec_path)] = (
603+
f"Restored {buildspec_path} to {orig_buildspec}"
604+
)
605605

606606
if not buildspec_paths or toml_path not in changes:
607607
restore_default_toml(toml_path)

src/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ docker==6.1.3
77
pyfiglet==0.8.post1
88
reprint==0.5.2
99
ruamel.yaml==0.18.10
10-
black==23.3.0
10+
black==24.8.0
1111
junit-xml==1.9
1212
toml==0.10.2
1313
retrying

src/utils.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -313,19 +313,15 @@ def get_safety_ignore_dict(image_uri, framework, python_version, job_type):
313313
else (
314314
"inference-neuronx"
315315
if "neuronx" in image_uri
316-
else "inference-neuron"
317-
if "neuron" in image_uri
318-
else "inference"
316+
else "inference-neuron" if "neuron" in image_uri else "inference"
319317
)
320318
)
321319

322320
if job_type == "training":
323321
job_type = (
324322
"training-neuronx"
325323
if "neuronx" in image_uri
326-
else "training-neuron"
327-
if "neuron" in image_uri
328-
else "training"
324+
else "training-neuron" if "neuron" in image_uri else "training"
329325
)
330326

331327
if "habana" in image_uri:

test/dlc_tests/sanity/quick_checks/test_required_fixture.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ def _update_test_fixtures_mapping(file_to_check, test_fixtures_mapping):
136136
if re.match(test_func_pattern, line):
137137
function_name = re.match(test_func_pattern, line).group(1)
138138
# Map list of fixtures per tests
139-
test_fixtures_mapping[
140-
f"{os.path.basename(file_to_check)}::{function_name}"
141-
] = fixture_list
139+
test_fixtures_mapping[f"{os.path.basename(file_to_check)}::{function_name}"] = (
140+
fixture_list
141+
)
142142
# Empty test_fixtures list for the next test method
143143
fixture_list = []

test/dlc_tests/sanity/test_dlc_labels.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ def test_dlc_standard_labels(image, region):
5050
arch_type = (
5151
"graviton"
5252
if test_utils.is_graviton_architecture()
53-
else "arm64"
54-
if test_utils.is_arm64_architecture()
55-
else "x86"
53+
else "arm64" if test_utils.is_arm64_architecture() else "x86"
5654
)
5755

5856
contributor = test_utils.get_contributor_from_image_uri(image)

test/dlc_tests/sanity/test_pre_release.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,9 +1204,9 @@ def test_core_package_version(image):
12041204
package_name = package_name.lower()
12051205
installed_version = None
12061206
if package_name not in installed_package_version_dict:
1207-
violation_data[
1208-
package_name
1209-
] = f"Package: {package_name} not installed in {installed_package_version_dict}"
1207+
violation_data[package_name] = (
1208+
f"Package: {package_name} not installed in {installed_package_version_dict}"
1209+
)
12101210
else:
12111211
installed_version = Version(installed_package_version_dict[package_name])
12121212
if installed_version and installed_version not in SpecifierSet(
@@ -1279,15 +1279,15 @@ def test_package_version_regression_in_image(image):
12791279
violating_packages = {}
12801280
for package_name, version_in_released_image in released_image_package_version_dict.items():
12811281
if package_name not in current_image_package_version_dict:
1282-
violating_packages[
1283-
package_name
1284-
] = "Not present in the image that is being currently built."
1282+
violating_packages[package_name] = (
1283+
"Not present in the image that is being currently built."
1284+
)
12851285
continue
12861286
version_in_current_image = current_image_package_version_dict[package_name]
12871287
if Version(version_in_released_image) > Version(version_in_current_image):
1288-
violating_packages[
1289-
package_name
1290-
] = f"Version in already released image: {version_in_released_image} is greater that version in current image: {version_in_current_image}"
1288+
violating_packages[package_name] = (
1289+
f"Version in already released image: {version_in_released_image} is greater that version in current image: {version_in_current_image}"
1290+
)
12911291

12921292
assert (
12931293
not violating_packages

test/dlc_tests/sanity/test_safety_check.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,9 +1027,7 @@ def _get_safety_ignore_list(image_uri):
10271027
else (
10281028
"inference-neuronx"
10291029
if "inference-neuronx" in image_uri
1030-
else "inference-neuron"
1031-
if "inference-neuron" in image_uri
1032-
else "inference"
1030+
else "inference-neuron" if "inference-neuron" in image_uri else "inference"
10331031
)
10341032
)
10351033
)

0 commit comments

Comments
 (0)