From 5ce8d5c824514fa989e1cf473d5b199dd786b633 Mon Sep 17 00:00:00 2001 From: korikuzma Date: Sun, 8 Oct 2023 16:29:29 -0400 Subject: [PATCH] style: resolve mypy errors --- therapy/etl/drugsatfda.py | 4 +++- therapy/schemas.py | 12 +++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/therapy/etl/drugsatfda.py b/therapy/etl/drugsatfda.py index 7b0ec272..b54bde1e 100644 --- a/therapy/etl/drugsatfda.py +++ b/therapy/etl/drugsatfda.py @@ -36,7 +36,9 @@ def get_latest_version(self) -> str: raise DownloadException(msg) return date else: - raise requests.HTTPError("Unable to retrieve version from FDA API") + raise requests.HTTPError( + "Unable to retrieve version from FDA API", response=requests.Response() + ) def _load_meta(self) -> None: """Add Drugs@FDA metadata.""" diff --git a/therapy/schemas.py b/therapy/schemas.py index 0067114d..f2c70bd6 100644 --- a/therapy/schemas.py +++ b/therapy/schemas.py @@ -1,11 +1,11 @@ """This module contains data models for representing VICC therapy records.""" -from typing import List, Optional, Dict, Union, Any, Type, Set +from typing import List, Optional, Dict, Union, Any, Type, Set, Literal from enum import Enum, IntEnum from datetime import datetime from ga4gh.vrsatile.pydantic.core_models import CURIE from ga4gh.vrsatile.pydantic.vrsatile_models import TherapeuticDescriptor -from pydantic import BaseModel, StrictBool +from pydantic import BaseModel, StrictBool, StrictStr from therapy.version import __version__ @@ -395,10 +395,12 @@ def schema_extra(schema: Dict[str, Any], model: Type["MatchesListed"]) -> None: class ServiceMeta(BaseModel): """Metadata regarding the therapy-normalization service.""" - name = "thera-py" - version = __version__ + name: Literal["thera-py"] = "thera-py" + version: StrictStr = __version__ response_datetime: datetime - url = "https://github.com/cancervariants/therapy-normalization" + url: Literal[ + "https://github.com/cancervariants/therapy-normalization" + ] = "https://github.com/cancervariants/therapy-normalization" class Config: """Configure OpenAPI schema"""