From 215d8d35243c9276624b56d8c0520a8fa02fd6b2 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 10 Jun 2024 15:45:44 -0400 Subject: [PATCH] [pre-commit.ci] pre-commit autoupdate (#1807) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/pre-commit/pre-commit-hooks: v4.4.0 → v4.6.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.4.0...v4.6.0) - [github.com/PyCQA/isort: 5.12.0 → 5.13.2](https://github.com/PyCQA/isort/compare/5.12.0...5.13.2) - [github.com/psf/black: 23.9.1 → 24.4.2](https://github.com/psf/black/compare/23.9.1...24.4.2) - [github.com/PyCQA/flake8: 6.1.0 → 7.0.0](https://github.com/PyCQA/flake8/compare/6.1.0...7.0.0) - [github.com/pre-commit/mirrors-prettier: v3.0.3 → v4.0.0-alpha.8](https://github.com/pre-commit/mirrors-prettier/compare/v3.0.3...v4.0.0-alpha.8) - [github.com/hadialqattan/pycln: v2.2.2 → v2.4.0](https://github.com/hadialqattan/pycln/compare/v2.2.2...v2.4.0) - [github.com/Yelp/detect-secrets: v1.4.0 → v1.5.0](https://github.com/Yelp/detect-secrets/compare/v1.4.0...v1.5.0) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Will Cunningham --- .pre-commit-config.yaml | 14 ++-- .../_file_transfer/strategies/s3_strategy.py | 1 - covalent/_shared_files/defaults.py | 14 ++-- covalent/_shared_files/qinfo.py | 6 +- covalent/_workflow/qdevice.py | 1 - covalent/_workflow/transportable_object.py | 1 - covalent/cloud_resource_manager/core.py | 16 +++-- .../qiskit_plugin/devices_base.py | 1 - covalent/executor/schemas.py | 1 - covalent/quantum/qserver/core.py | 6 +- covalent_dispatcher/_dal/asset.py | 1 - covalent_ui/api/v1/data_layer/electron_dal.py | 70 +++++++++++-------- covalent_ui/api/v1/data_layer/summary_dal.py | 12 ++-- doc/requirements.txt | 1 - 14 files changed, 77 insertions(+), 68 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a3120b17c..dcb12f309 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -20,7 +20,7 @@ fail_fast: true repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.6.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer @@ -30,25 +30,25 @@ repos: - id: requirements-txt-fixer - repo: https://github.com/PyCQA/isort - rev: 5.12.0 + rev: 5.13.2 hooks: - id: isort args: ["--profile", "black"] - repo: https://github.com/psf/black - rev: 23.9.1 + rev: 24.4.2 hooks: - id: black - repo: https://github.com/PyCQA/flake8 - rev: 6.1.0 + rev: 7.0.0 hooks: - id: flake8 args: - "--max-complexity=50" - repo: https://github.com/pre-commit/mirrors-prettier - rev: v3.0.3 + rev: v4.0.0-alpha.8 hooks: - id: prettier types: [yaml, markdown] @@ -58,13 +58,13 @@ repos: )$ - repo: https://github.com/hadialqattan/pycln - rev: v2.2.2 + rev: v2.4.0 hooks: - id: pycln args: [--config=pyproject.toml] - repo: https://github.com/Yelp/detect-secrets - rev: v1.4.0 + rev: v1.5.0 hooks: - id: detect-secrets args: diff --git a/covalent/_file_transfer/strategies/s3_strategy.py b/covalent/_file_transfer/strategies/s3_strategy.py index 7431ad03f..5011d2744 100644 --- a/covalent/_file_transfer/strategies/s3_strategy.py +++ b/covalent/_file_transfer/strategies/s3_strategy.py @@ -27,7 +27,6 @@ class S3(FileTransferStrategy): - """ Implements Base FileTransferStrategy class to upload/download files from S3 Bucket. """ diff --git a/covalent/_shared_files/defaults.py b/covalent/_shared_files/defaults.py index a1b9983a4..aef61086d 100644 --- a/covalent/_shared_files/defaults.py +++ b/covalent/_shared_files/defaults.py @@ -67,9 +67,9 @@ def get_default_sdk_config(): + "/covalent/dispatches" ), "task_packing": "true" if os.environ.get("COVALENT_ENABLE_TASK_PACKING") else "false", - "multistage_dispatch": "false" - if os.environ.get("COVALENT_DISABLE_MULTISTAGE_DISPATCH") == "1" - else "true", + "multistage_dispatch": ( + "false" if os.environ.get("COVALENT_DISABLE_MULTISTAGE_DISPATCH") == "1" else "true" + ), "results_dir": os.environ.get( "COVALENT_RESULTS_DIR" ) # COVALENT_RESULTS_DIR is where the client downloads workflow artifacts during get_result() which is different from COVALENT_DATA_DIR @@ -156,9 +156,11 @@ def get_default_workflow_data_config(): def get_default_ui_config(): return { "address": "localhost", - "port": int(os.environ.get("COVALENT_SVC_PORT")) - if os.environ.get("COVALENT_SVC_PORT") - else 48008, + "port": ( + int(os.environ.get("COVALENT_SVC_PORT")) + if os.environ.get("COVALENT_SVC_PORT") + else 48008 + ), "dev_port": 49009, "log_dir": os.environ.get("COVALENT_LOGDIR") or os.path.join( diff --git a/covalent/_shared_files/qinfo.py b/covalent/_shared_files/qinfo.py index 4c93bfc2f..67568b9d2 100644 --- a/covalent/_shared_files/qinfo.py +++ b/covalent/_shared_files/qinfo.py @@ -54,9 +54,9 @@ class QElectronInfo(BaseModel): description: Optional[str] = None device_name: str # name of the original device, e.g. "default.qubit" device_import_path: str # used to inherit type converters and other methods - device_shots: Union[ - None, int, Sequence[int], Sequence[Union[int, Sequence[int]]] - ] = None # optional default for execution devices + device_shots: Union[None, int, Sequence[int], Sequence[Union[int, Sequence[int]]]] = ( + None # optional default for execution devices + ) device_shots_type: Any = None device_wires: int # this can not be reliably inferred from tapes alone pennylane_active_return: bool # client-side status of `pennylane.active_return()` diff --git a/covalent/_workflow/qdevice.py b/covalent/_workflow/qdevice.py index 418c167f9..a9d26ea58 100644 --- a/covalent/_workflow/qdevice.py +++ b/covalent/_workflow/qdevice.py @@ -28,7 +28,6 @@ class QEDevice(QubitDevice): - """ The purpose of this device is to redirect circuit execution through Covalent's Quantum Executors and to enable asynchronous execution. diff --git a/covalent/_workflow/transportable_object.py b/covalent/_workflow/transportable_object.py index 4ba789662..7dcb4e073 100644 --- a/covalent/_workflow/transportable_object.py +++ b/covalent/_workflow/transportable_object.py @@ -32,7 +32,6 @@ class _TOArchive: - """Archived transportable object.""" def __init__(self, header: bytes, object_string: bytes, data: bytes): diff --git a/covalent/cloud_resource_manager/core.py b/covalent/cloud_resource_manager/core.py index eb63bb604..2d31a47a6 100644 --- a/covalent/cloud_resource_manager/core.py +++ b/covalent/cloud_resource_manager/core.py @@ -98,13 +98,15 @@ def get_plugin_settings( infra_settings = ExecutorInfraDefaults.schema()["properties"] settings_dict = { - key: { - "required": "No", - "default": value["default"], - "value": value["default"], - } - if "default" in value - else {"required": "Yes", "default": None, "value": None} + key: ( + { + "required": "No", + "default": value["default"], + "value": value["default"], + } + if "default" in value + else {"required": "Yes", "default": None, "value": None} + ) for key, value in plugin_settings.items() } for key, value in infra_settings.items(): diff --git a/covalent/executor/quantum_plugins/qiskit_plugin/devices_base.py b/covalent/executor/quantum_plugins/qiskit_plugin/devices_base.py index 744c3034e..bb5f850f6 100644 --- a/covalent/executor/quantum_plugins/qiskit_plugin/devices_base.py +++ b/covalent/executor/quantum_plugins/qiskit_plugin/devices_base.py @@ -131,7 +131,6 @@ def post_process_all(self, *args) -> Tuple[Any, List[dict]]: class QiskitSamplerDevice(_PennylaneQiskitDevice): - """ A base class for devices that use the Sampler primitive. """ diff --git a/covalent/executor/schemas.py b/covalent/executor/schemas.py index 40b4c732e..f8a5f1bd1 100644 --- a/covalent/executor/schemas.py +++ b/covalent/executor/schemas.py @@ -69,7 +69,6 @@ class TaskSpec(BaseModel): class ResourceMap(BaseModel): - """Map resource identifiers to URIs. The resources may be loaded in the compute environment from these diff --git a/covalent/quantum/qserver/core.py b/covalent/quantum/qserver/core.py index 2bc31c913..ac7e4b668 100644 --- a/covalent/quantum/qserver/core.py +++ b/covalent/quantum/qserver/core.py @@ -348,9 +348,9 @@ def get_results(self, batch_id): { "execution_time": sub_result_obj.execution_time, "result": sub_result_obj.results if executor.persist_data else None, - "result_metadata": sub_result_obj.metadata - if executor.persist_data - else None, + "result_metadata": ( + sub_result_obj.metadata if executor.persist_data else None + ), } ) diff --git a/covalent_dispatcher/_dal/asset.py b/covalent_dispatcher/_dal/asset.py index d524dc389..146b47624 100644 --- a/covalent_dispatcher/_dal/asset.py +++ b/covalent_dispatcher/_dal/asset.py @@ -56,7 +56,6 @@ class StorageType(Enum): class Asset(Record[AssetRecord]): - """Metadata for an object in blob storage""" model = AssetRecord diff --git a/covalent_ui/api/v1/data_layer/electron_dal.py b/covalent_ui/api/v1/data_layer/electron_dal.py index 9e10ee154..b064a25a3 100644 --- a/covalent_ui/api/v1/data_layer/electron_dal.py +++ b/covalent_ui/api/v1/data_layer/electron_dal.py @@ -105,9 +105,11 @@ def get_jobs( "job_id": circuit["circuit_id"], "start_time": circuit["save_time"], "executor": circuit["result_metadata"]["executor_name"], - "status": "COMPLETED" - if len(circuit["result"]) != 0 and len(circuit["result_metadata"]) != 0 - else "RUNNING", + "status": ( + "COMPLETED" + if len(circuit["result"]) != 0 and len(circuit["result_metadata"]) != 0 + else "RUNNING" + ), }, jobs.values(), ) @@ -164,39 +166,49 @@ def get_job_detail(self, dispatch_id, electron_id, job_id) -> JobDetailsResponse selected_job["result"] = str(selected_job["result"])[1:-1] job_overview = { "overview": { - "job_name": selected_job["circuit_name"] - if "circuit_name" in selected_job - else None, - "backend": selected_job["result_metadata"]["executor_backend_name"] - if "result_metadata" in selected_job - and "executor_backend_name" in selected_job["result_metadata"] - else None, - "time_elapsed": selected_job["execution_time"] - if "execution_time" in selected_job - else None, + "job_name": ( + selected_job["circuit_name"] if "circuit_name" in selected_job else None + ), + "backend": ( + selected_job["result_metadata"]["executor_backend_name"] + if "result_metadata" in selected_job + and "executor_backend_name" in selected_job["result_metadata"] + else None + ), + "time_elapsed": ( + selected_job["execution_time"] + if "execution_time" in selected_job + else None + ), "result": selected_job["result"] if "result" in selected_job else None, - "status": "COMPLETED" - if len(selected_job["result"]) != 0 - and len(selected_job["result_metadata"]) != 0 - else "RUNNING", - "start_time": selected_job["save_time"] - if "save_time" in selected_job - else None, + "status": ( + "COMPLETED" + if len(selected_job["result"]) != 0 + and len(selected_job["result_metadata"]) != 0 + else "RUNNING" + ), + "start_time": ( + selected_job["save_time"] if "save_time" in selected_job else None + ), }, "circuit": { "total_qbits": None, "depth": None, - "circuit_diagram": selected_job["circuit_diagram"] - if "circuit_diagram" in selected_job - else None, + "circuit_diagram": ( + selected_job["circuit_diagram"] + if "circuit_diagram" in selected_job + else None + ), }, "executor": { - "name": selected_job["qexecutor"]["name"] - if "qexecutor" in selected_job and "name" in selected_job["qexecutor"] - else None, - "executor": str(selected_job["qexecutor"]) - if "qexecutor" in selected_job - else None, + "name": ( + selected_job["qexecutor"]["name"] + if "qexecutor" in selected_job and "name" in selected_job["qexecutor"] + else None + ), + "executor": ( + str(selected_job["qexecutor"]) if "qexecutor" in selected_job else None + ), }, } diff --git a/covalent_ui/api/v1/data_layer/summary_dal.py b/covalent_ui/api/v1/data_layer/summary_dal.py index 892db0406..f9da85635 100644 --- a/covalent_ui/api/v1/data_layer/summary_dal.py +++ b/covalent_ui/api/v1/data_layer/summary_dal.py @@ -230,12 +230,12 @@ def get_summary_overview(self) -> Lattice: return DispatchDashBoardResponse( total_jobs_running=total_jobs_running[0], total_jobs_completed=total_jobs_done[0], - latest_running_task_status=last_ran_job_status[0] - if last_ran_job_status is not None - else None, - total_dispatcher_duration=int(run_time[0]) - if run_time is not None and run_time[0] is not None - else 0, + latest_running_task_status=( + last_ran_job_status[0] if last_ran_job_status is not None else None + ), + total_dispatcher_duration=( + int(run_time[0]) if run_time is not None and run_time[0] is not None else 0 + ), total_jobs_failed=total_failed[0], total_jobs_cancelled=total_jobs_cancelled[0], total_jobs_new_object=total_jobs_new_object[0], diff --git a/doc/requirements.txt b/doc/requirements.txt index 02b9d5eb6..2c815e37a 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -4,7 +4,6 @@ docutils furo>=2022.6.21 ipython>=8.4.0 ipython_genutils==0.2.0 -ipython_genutils==0.2.0 jinja2<3.1.0 myst-parser nbsphinx