Skip to content

Commit

Permalink
style: switch to ruff formatting (#595)
Browse files Browse the repository at this point in the history
Signed-off-by: Justin Sawatzky <[email protected]>
  • Loading branch information
justinsaws authored Feb 10, 2025
1 parent 7c63ca1 commit 25b809f
Show file tree
Hide file tree
Showing 92 changed files with 171 additions and 234 deletions.
1 change: 1 addition & 0 deletions .github/scripts/get_latest_changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
```
"""

import re

h2 = r"^##\s.*$"
Expand Down
6 changes: 3 additions & 3 deletions hatch.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ test_docker = "./scripts/run_sudo_tests.sh --build"
typing = "mypy {args:src test} --always-false=PYQT5 --always-false=PYSIDE2 --always-false=PYQT6 --always-true=PYSIDE6"
style = [
"ruff check {args:.}",
"black --check --diff {args:.}",
"ruff format --check --diff {args:.}",
]
fmt = [
"black {args:.}",
"ruff format {args:.}",
"style",
]
lint = [
"style",
"typing",
]
quality = [
"black {args:.}",
"ruff format {args:.}",
"typing",
"style",
]
Expand Down
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,6 @@ known-first-party = [
# This causes imports to come after regular Python statements causing flake8 rule E402 to be flagged
"src/deadline/job_attachments/_windows/*.py" = ["E402"]

[tool.black]
line-length = 100

# Configuration for pytest; enable coverage for deadline_worker_agent, emit
# XML, HTML, and terminal reports.
Expand Down
2 changes: 0 additions & 2 deletions requirements-testing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ freezegun == 1.*
types-pyyaml == 6.*
twine == 4.*; python_version == '3.7'
twine == 6.*; python_version > '3.7'
black == 24.8.*; python_version == '3.8'
black == 24.10.*; python_version > '3.8'
mypy == 1.13.*; python_version == '3.7'
mypy == 1.*; python_version > '3.7'
ruff == 0.9.*
Expand Down
1 change: 1 addition & 0 deletions scripts/pyinstaller/deadline.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
This file should be built with PyInstaller into its own executable which depends on the actual `deadline` package's
PyInstaller executable.
"""

import pathlib
import subprocess
import sys
Expand Down
1 change: 1 addition & 0 deletions scripts/pyinstaller/make_exe.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
$ pip install -e .
$ python scripts/pyinstaller/make_exe.py
"""

import argparse
import os
import shutil
Expand Down
1 change: 1 addition & 0 deletions src/deadline/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""
This file makes "python -m deadline ..." equivalent to "deadline ..."
"""

import sys
from .client.cli import main

Expand Down
6 changes: 3 additions & 3 deletions src/deadline/client/api/_queue_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ def get_queue_parameter_definitions(
parameter["userInterface"] = {
"control": get_ui_control_for_parameter_definition(parameter)
}
parameter["userInterface"][
"groupLabel"
] = f"Queue Environment: {template['environment']['name']}"
parameter["userInterface"]["groupLabel"] = (
f"Queue Environment: {template['environment']['name']}"
)
existing_parameter = queue_parameters_definitions.get(parameter["name"])
if existing_parameter:
differences = parameter_definition_difference(existing_parameter, parameter)
Expand Down
1 change: 1 addition & 0 deletions src/deadline/client/api/_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Provides functionality for boto3 Sessions, Clients, and properties
of the Deadline-configured IAM credentials.
"""

from __future__ import annotations

import logging
Expand Down
1 change: 1 addition & 0 deletions src/deadline/client/api/_submit_job_bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""
Provides the function to submit a job bundle to AWS Deadline Cloud.
"""

from __future__ import annotations

import json
Expand Down
1 change: 1 addition & 0 deletions src/deadline/client/cli/_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""
Functionality common to all the CLI groups.
"""

__all__ = [
"_PROMPT_WHEN_COMPLETE",
"_prompt_at_completion",
Expand Down
1 change: 1 addition & 0 deletions src/deadline/client/cli/_groups/attachment_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* upload
* download
"""

from __future__ import annotations

import click
Expand Down
1 change: 1 addition & 0 deletions src/deadline/client/cli/_groups/auth_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* logout
* status
"""

import click
import json
import logging
Expand Down
1 change: 1 addition & 0 deletions src/deadline/client/cli/_groups/bundle_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""
All the `deadline bundle` commands.
"""

from __future__ import annotations

import json
Expand Down
2 changes: 1 addition & 1 deletion src/deadline/client/cli/_groups/job_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ def _get_summary_of_files_to_download_message(
f"{os.path.commonpath([os.path.join(directory, p) for p in output_paths])} ({len(output_paths)} file{'s' if len(output_paths) > 1 else ''})"
for directory, output_paths in output_paths_by_root.items()
)
return "\n" "Summary of files to download:\n" f"{paths_message_joined}" "\n"
return f"\nSummary of files to download:\n{paths_message_joined}\n"


def _get_roots_list_message(asset_roots: list[str], is_json_format: bool) -> str:
Expand Down
1 change: 1 addition & 0 deletions src/deadline/client/cli/_groups/manifest_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* diff
* download
"""

from __future__ import annotations

from configparser import ConfigParser
Expand Down
1 change: 1 addition & 0 deletions src/deadline/client/cli/deadline_dev_gui_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Runs the Deadline Dev GUI. Can be run as a python script file.
"""

from ..config import get_setting


Expand Down
1 change: 1 addition & 0 deletions src/deadline/client/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
the environment variable DEADLINE_CONFIG_FILE_PATH, it is used as the configuration
file path instead.
"""

__all__ = [
"get_setting_default",
"get_setting",
Expand Down
1 change: 1 addition & 0 deletions src/deadline/client/job_bundle/submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""
Helper functions to enable submission of a Job Bundle to CreateJob
"""

from __future__ import annotations
import dataclasses
import logging
Expand Down
3 changes: 2 additions & 1 deletion src/deadline/client/ui/dataclasses/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""
Contains dataclasses for holding UI parameter values, used by the widgets.
"""

from __future__ import annotations

import os
Expand Down Expand Up @@ -290,7 +291,7 @@ def _validate_amount(amount: Union[dict, CustomAmountRequirement]) -> CustomAmou

@staticmethod
def _validate_attribute(
attribute: Union[dict, CustomAttributeRequirement]
attribute: Union[dict, CustomAttributeRequirement],
) -> CustomAttributeRequirement:
if isinstance(attribute, dict):
attribute = CustomAttributeRequirement(**attribute)
Expand Down
3 changes: 2 additions & 1 deletion src/deadline/client/ui/deadline_authentication_status.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

"""
Provides an object that can be used to track current status of AWS Deadline Cloud
Provides an object that can be used to track current status of AWS Deadline Cloud
authentication.
The object emits the following Qt Signals:
Expand All @@ -20,6 +20,7 @@
This is checked by looking for the relevant properties
in the AWS profile configuration.
"""

import os
import threading
from configparser import ConfigParser
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Provides a modal dialog box for the submission progress when submitting to
AWS Deadline Cloud
"""

from __future__ import annotations

import json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

"""UI Components for the Render Submitter"""

from __future__ import annotations

import logging
Expand Down
4 changes: 3 additions & 1 deletion src/deadline/client/ui/job_bundle_submitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ def show_job_bundle_submitter(
# Get the main application window so we can parent ours to it
app = QApplication.instance()
main_windows = [
widget for widget in app.topLevelWidgets() if isinstance(widget, QMainWindow) # type: ignore[union-attr]
widget
for widget in app.topLevelWidgets()
if isinstance(widget, QMainWindow) # type: ignore[union-attr]
]
if main_windows:
parent = main_windows[0]
Expand Down
1 change: 1 addition & 0 deletions src/deadline/client/ui/widgets/cli_job_settings_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""
UI widgets for the Scene Settings tab.
"""

import os

from qtpy.QtCore import Qt # type: ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
the current status of AWS Deadline Cloud authentication and API.
The current status is handled by DeadlineAuthenticationStatus.
"""

from logging import getLogger
from typing import Optional

Expand Down
1 change: 1 addition & 0 deletions src/deadline/client/ui/widgets/host_requirements_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""
UI widgets for the host requirements tab.
"""

import re
from logging import getLogger
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions src/deadline/client/ui/widgets/job_attachments_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""
UI widgets for the job attachments tab.
"""

from __future__ import annotations
import os
from logging import getLogger
Expand Down
1 change: 1 addition & 0 deletions src/deadline/client/ui/widgets/job_bundle_settings_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""
UI widgets for the scene settings tab.
"""

from __future__ import annotations

import os
Expand Down
1 change: 1 addition & 0 deletions src/deadline/client/ui/widgets/openjd_parameters_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
UI widgets for the Scene Settings tab.
"""

from __future__ import annotations

import os
Expand Down
1 change: 1 addition & 0 deletions src/deadline/client/ui/widgets/shared_job_settings_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""
A UI Widget containing the render setup tab
"""

from __future__ import annotations

import sys
Expand Down
1 change: 1 addition & 0 deletions src/deadline/job_attachments/_aws/aws_clients.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

"""Functions for handling and retrieving AWS clients."""

from __future__ import annotations

from functools import lru_cache
Expand Down
1 change: 1 addition & 0 deletions src/deadline/job_attachments/_aws/aws_config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

"""AWS configuration."""

VENDOR_CODE: str = "deadline"

# S3 related
Expand Down
1 change: 1 addition & 0 deletions src/deadline/job_attachments/_aws/deadline.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

"""Functions for interfacing with Deadline API calls."""

from typing import Optional

import boto3
Expand Down
1 change: 0 additions & 1 deletion src/deadline/job_attachments/api/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ def _manifest_snapshot(
force_rehash: bool = False,
logger: ClickLogger = ClickLogger(False),
) -> Optional[ManifestSnapshot]:

# Get all files in the root.
glob_config: GlobConfig
if include or exclude:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

""" Module that defines the second iteration of the asset manifest """
"""Module that defines the second iteration of the asset manifest"""

from __future__ import annotations

import dataclasses
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

""" Contains the base asset manifest and entities that are part of the Asset Manifest """
"""Contains the base asset manifest and entities that are part of the Asset Manifest"""

from __future__ import annotations

from abc import ABC, abstractmethod
Expand Down
3 changes: 2 additions & 1 deletion src/deadline/job_attachments/asset_manifests/decode.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

""" Contains methods for decoding and validating Asset Manifests. """
"""Contains methods for decoding and validating Asset Manifests."""

from __future__ import annotations

import json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

""" Module that defines the hashing algorithms supported by this library. """
"""Module that defines the hashing algorithms supported by this library."""

import io

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

""" Module for the base Manifest Model. """
"""Module for the base Manifest Model."""

from __future__ import annotations

from typing import Type
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

""" Module that defines the v2023-03-03 version of the asset manifest """
"""Module that defines the v2023-03-03 version of the asset manifest"""

from __future__ import annotations

from dataclasses import dataclass
Expand Down
2 changes: 1 addition & 1 deletion src/deadline/job_attachments/asset_manifests/versions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

""" Module that defines the asset manifest versions. """
"""Module that defines the asset manifest versions."""

from enum import Enum

Expand Down
3 changes: 2 additions & 1 deletion src/deadline/job_attachments/asset_sync.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

""" Module for File Attachment synching """
"""Module for File Attachment synching"""

from __future__ import annotations
from dataclasses import asdict
import os
Expand Down
Loading

0 comments on commit 25b809f

Please sign in to comment.