diff --git a/scripts/script_utils/fastapi_app_location.py b/scripts/script_utils/fastapi_app_location.py index 582e64b..4e96df6 100644 --- a/scripts/script_utils/fastapi_app_location.py +++ b/scripts/script_utils/fastapi_app_location.py @@ -16,9 +16,7 @@ """Used to define the location of the main FastAPI app object.""" -# flake8: noqa - -from typing import Any, Dict +from typing import Any from fastapi import FastAPI @@ -29,7 +27,8 @@ app.include_router(router) -def custom_openapi() -> Dict[str, Any]: +def custom_openapi() -> dict[str, Any]: + """Get custom OpenAPI schema.""" if app.openapi_schema: return app.openapi_schema openapi_schema = get_openapi_schema(app) @@ -37,4 +36,4 @@ def custom_openapi() -> Dict[str, Any]: return app.openapi_schema -app.openapi = custom_openapi # type: ignore [assignment] +app.openapi = custom_openapi # type: ignore[method-assign] diff --git a/src/wps/adapters/inbound/fastapi_/openapi.py b/src/wps/adapters/inbound/fastapi_/openapi.py index 255806c..b420b13 100644 --- a/src/wps/adapters/inbound/fastapi_/openapi.py +++ b/src/wps/adapters/inbound/fastapi_/openapi.py @@ -28,7 +28,7 @@ def get_openapi_schema(api) -> dict[str, Any]: """Generate a custom OpenAPI schema for the service.""" - config = Config() # pyright: ignore + config = Config() # type: ignore return get_openapi( title="Work Package Service", diff --git a/src/wps/main.py b/src/wps/main.py index 6ddf464..8011c15 100644 --- a/src/wps/main.py +++ b/src/wps/main.py @@ -55,14 +55,14 @@ def custom_openapi(): api.openapi_schema = openapi_schema return api.openapi_schema - api.openapi = custom_openapi # type: ignore [assignment] + api.openapi = custom_openapi # type: ignore[method-assign] return api async def run_rest(): """Run the HTTP REST API.""" - config = Config() # pyright: ignore + config = Config() # type: ignore async with get_container(config=config): api = get_rest_api(config=config) @@ -71,7 +71,7 @@ async def run_rest(): async def consume_events(run_forever: bool = True): """Run an event consumer listening to the configured topic.""" - config = Config() # pyright: ignore + config = Config() # type: ignore async with get_container(config=config) as container: event_subscriber = await container.event_subscriber() diff --git a/tests/fixtures/__init__.py b/tests/fixtures/__init__.py index 3160caf..d7fb452 100644 --- a/tests/fixtures/__init__.py +++ b/tests/fixtures/__init__.py @@ -99,7 +99,7 @@ def fixture_auth_context() -> AuthContext: async def fixture_repository(mongodb_fixture: MongoDbFixture) -> WorkPackageRepository: """Fixture for creating a configured repository""" work_package_config = WorkPackageConfig( - work_package_signing_key=SIGNING_KEY_PAIR.export_private() # pyright: ignore + work_package_signing_key=SIGNING_KEY_PAIR.export_private() # type: ignore ) dataset_dao = await DatasetDaoConstructor.construct( config=work_package_config, diff --git a/tests/test_models.py b/tests/test_models.py index 6515b5c..14feb68 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -39,7 +39,7 @@ def test_work_order_token(): user_id="some-user-id", user_public_crypt4gh_key="some-public-key", full_user_name="Dr. John Doe", - email="john@home.org", # pyright: ignore + email="john@home.org", # type: ignore ) assert token.full_user_name == "Dr. John Doe" @@ -78,7 +78,7 @@ def test_bad_creation_data(): """Test instantiating invalid work package creation DTO.""" with raises(ValidationError, match="dataset_id"): WorkPackageCreationData( - dataset_id=["foo", "bar"], # pyright: ignore + dataset_id=["foo", "bar"], # type: ignore type=WorkType.DOWNLOAD, file_ids=["some-file-id", "another-file-id"], user_public_crypt4gh_key=user_public_crypt4gh_key, @@ -86,7 +86,7 @@ def test_bad_creation_data(): with raises(ValidationError, match="type"): WorkPackageCreationData( dataset_id="some-dataset-id", - type="UNKNOWN_TYPE", # pyright: ignore + type="UNKNOWN_TYPE", # type: ignore file_ids=["some-file-id", "another-file-id"], user_public_crypt4gh_key=user_public_crypt4gh_key, ) @@ -94,7 +94,7 @@ def test_bad_creation_data(): WorkPackageCreationData( dataset_id="some-dataset-id", type=WorkType.DOWNLOAD, - file_ids="some-file-id", # pyright: ignore + file_ids="some-file-id", # type: ignore user_public_crypt4gh_key=user_public_crypt4gh_key, ) with raises(ValidationError, match="user_public_crypt4gh_key"): @@ -116,7 +116,7 @@ def test_work_package(): files={"some-file-id": ".sam", "another-file-id": ".bam"}, user_public_crypt4gh_key=user_public_crypt4gh_key, full_user_name="Dr. John Doe", - email="john@home.org", # pyright: ignore + email="john@home.org", # type: ignore token_hash="308eda9daf26b7446b284449a5895ab9a04ff30c129d4454e471cfb81bf5557d", created=datetime(2022, 2, 2, 2, tzinfo=timezone.utc), # pyright: ignore expires=datetime(2022, 2, 2, 3, tzinfo=timezone.utc), # pyright: ignore diff --git a/tests/test_tokens.py b/tests/test_tokens.py index e2968ef..5edad65 100644 --- a/tests/test_tokens.py +++ b/tests/test_tokens.py @@ -64,7 +64,7 @@ def test_sign_work_order_token(): user_id="some-user-id", user_public_crypt4gh_key="some-public-key", full_user_name="Dr. John Doe", - email="john@home.org", # pyright: ignore + email="john@home.org", # type: ignore ) token_str = sign_work_order_token(work_order_token=work_order_token, key=key) assert isinstance(token_str, str)