Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mypy errors #217

Closed
1 task done
jpmckinney opened this issue Nov 28, 2023 · 2 comments · Fixed by #346
Closed
1 task done

Fix mypy errors #217

jpmckinney opened this issue Nov 28, 2023 · 2 comments · Fixed by #346
Labels

Comments

@jpmckinney
Copy link
Member

jpmckinney commented Nov 28, 2023

mypy --strict --show-error-codes app reportlab_mods.py reports:

Found 76 errors in 17 files (checked 31 source files)

Since FastAPI, Pydantic, etc. all rely heavily on type annotations, we should ideally fix most of these, and then # type: ignore any that we can't fix. Then, add a mypy workflow to prevent regressions:

name: Mypy
on: [push, pull_request]
jobs:
  build:
    if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v4
        with:
          python-version: '3.11'
          cache: pip
          cache-dependency-path: setup.cfg
      - run: pip install .[types]
      - run: mypy --strict --show-error-codes yapw

Correctable

Use one with func.max instead of first (using one can probably be done a lot more throughout the code #218):

app/commands.py:37: error: Argument 1 to "fetch_new_awards_from_date" has incompatible type "datetime | None"; expected "datetime"  [arg-type]
app/models.py:692: error: Returning Any from function declared to return "datetime | None"  [no-any-return]

These relate to str.split, so can probably be fixed:

app/util.py:73: error: Value of type variable "AnyOrLiteralStr" of "splitext" cannot be "str | None"  [type-var]
app/util.py:73: error: Item "None" of "str | None" has no attribute "lower"  [union-attr]
app/routers/guest/emails.py:93: error: Item "None" of "str | None" has no attribute "split"  [union-attr]

Might be easiest to split respond_to_auth_challenge into separate methods:

app/routers/users.py:77: error: Incompatible types in assignment (expression has type "RespondToAuthChallengeResponseTypeDef | dict[str, str]", variable has type "InitiateAuthResponseTypeDef")  [assignment]
app/routers/users.py:229: error: TypedDict "RespondToAuthChallengeResponseTypeDef" has no key "access_token"  [typeddict-item]
app/routers/users.py:230: error: TypedDict "RespondToAuthChallengeResponseTypeDef" has no key "refresh_token"  [typeddict-item]

Can be fixed by importing _Environ, but I don't like the idea of importing a private class:

app/settings.py:48: error: Argument 2 to "merge_dicts_with_condition" has incompatible type "_Environ[str]"; expected "dict[str, Any]"  [arg-type]

I know why this occurs (dict() is a method on SQLModel, to which ActiveRecordMixin is mixed), but not sure how to fix:

app/models.py:95: error: "Self" has no attribute "dict"  [attr-defined]

Not sure what this attribute's type is, but can be annotated once known:

app/aws.py:58: error: Function is missing a return type annotation  [no-untyped-def]
app/routers/users.py:48: error: Call to untyped function "exceptions" in typed context  [no-untyped-call]

Not investigated yet

app/auth.py:61: error: Return type "Coroutine[Any, Any, JWTAuthorizationCredentials | None]" of "__call__" incompatible with return type "Coroutine[Any, Any, HTTPAuthorizationCredentials | None]" in supertype "HTTPBearer"  [override]
app/auth.py:61: error: Return type "Coroutine[Any, Any, JWTAuthorizationCredentials | None]" of "__call__" incompatible with return type "Coroutine[Any, Any, HTTPAuthorizationCredentials | None]" in supertype "HTTPBase"  [override]

Not sure if this has a possible annotation that won't cause new errors:

app/util.py:28: error: Function is missing a return type annotation  [no-untyped-def]

Other miscellaneous:

app/auth.py:52: error: Value of type "dict[str, dict[str, str]] | None" is not indexable  [index]

FastAPI: None

These might be resolved by using a different model that doesn't allow None:

app/routers/users.py:74: error: Argument 2 to "initiate_auth" of "CognitoClient" has incompatible type "str | None"; expected "str"  [arg-type]
app/routers/users.py:77: error: Argument 4 to "respond_to_auth_challenge" of "CognitoClient" has incompatible type "str | None"; expected "str"  [arg-type]
app/routers/users.py:163: error: Argument 2 to "initiate_auth" of "CognitoClient" has incompatible type "str | None"; expected "str"  [arg-type]
app/routers/users.py:167: error: Argument "user" to "LoginResponse" has incompatible type "User | None"; expected "User"  [arg-type]
app/routers/users.py:207: error: Argument 2 to "initiate_auth" of "CognitoClient" has incompatible type "str | None"; expected "str"  [arg-type]
app/routers/users.py:216: error: Argument "mfa_code" to "respond_to_auth_challenge" of "CognitoClient" has incompatible type "str | None"; expected "str"  [arg-type]
app/routers/users.py:293: error: Argument "user" to "UserResponse" has incompatible type "User | None"; expected "User"  [arg-type]
app/mail.py:211: error: Item "None" of "Lender | None" has no attribute "name"  [union-attr]
app/mail.py:233: error: Item "None" of "Lender | None" has no attribute "name"  [union-attr]
app/mail.py:251: error: Item "None" of "Lender | None" has no attribute "name"  [union-attr]
app/mail.py:253: error: Item "None" of "Lender | None" has no attribute "email_group"  [union-attr]
app/mail.py:305: error: Item "None" of "Lender | None" has no attribute "email_group"  [union-attr]
app/mail.py:329: error: Item "None" of "Lender | None" has no attribute "email_group"  [union-attr]
app/mail.py:617: error: Item "None" of "Lender | None" has no attribute "name"  [union-attr]
app/mail.py:637: error: Item "None" of "Lender | None" has no attribute "name"  [union-attr]
app/utils/tables.py:46: error: Item "None" of "Lender | None" has no attribute "name"  [union-attr]
app/routers/applications.py:576: error: Item "None" of "Lender | None" has no attribute "name"  [union-attr]
app/routers/applications.py:593: error: Item "None" of "Lender | None" has no attribute "id"  [union-attr]
app/routers/guest/applications.py:602: error: Item "None" of "Lender | None" has no attribute "email_group"  [union-attr]
app/commands.py:71: error: Item "None" of "list[BorrowerDocument] | None" has no attribute "__iter__" (not iterable)  [union-attr]
app/routers/applications.py:185: error: Item "None" of "list[BorrowerDocument] | None" has no attribute "__iter__" (not iterable)  [union-attr]
app/routers/downloads.py:83: error: Argument 1 to "list" has incompatible type "list[BorrowerDocument] | None"; expected "Iterable[BorrowerDocument]"  [arg-type]
app/routers/guest/applications.py:439: error: Item "None" of "list[BorrowerDocument] | None" has no attribute "append"  [union-attr]
app/models.py:471: error: Item "None" of "datetime | None" has no attribute "tzinfo"  [union-attr]
app/routers/applications.py:199: error: Item "None" of "datetime | None" has no attribute "tzinfo"  [union-attr]
app/routers/applications.py:490: error: Item "None" of "datetime | None" has no attribute "tzinfo"  [union-attr]
app/routers/applications.py:570: error: Item "None" of "datetime | None" has no attribute "tzinfo"  [union-attr]
app/routers/guest/applications.py:78: error: Item "None" of "datetime | None" has no attribute "tzinfo"  [union-attr]
app/routers/guest/applications.py:190: error: Item "None" of "datetime | None" has no attribute "tzinfo"  [union-attr]
app/routers/guest/applications.py:297: error: Item "None" of "datetime | None" has no attribute "tzinfo"  [union-attr]
app/routers/guest/applications.py:495: error: Item "None" of "datetime | None" has no attribute "tzinfo"  [union-attr]
app/routers/guest/applications.py:679: error: Item "None" of "datetime | None" has no attribute "tzinfo"  [union-attr]
app/routers/guest/applications.py:765: error: Item "None" of "datetime | None" has no attribute "tzinfo"  [union-attr]
app/models.py:524: error: No overload variant of "__sub__" of "datetime" matches argument type "None"  [operator]
app/models.py:524: error: Unsupported left operand type for - ("None")  [operator]
app/models.py:535: error: No overload variant of "__sub__" of "datetime" matches argument type "None"  [operator]
app/models.py:535: error: Unsupported left operand type for - ("None")  [operator]
app/utils/statistics.py:60: error: Value of type variable "_CLE" of "Cast" cannot be "datetime | None"  [type-var]
app/utils/statistics.py:93: error: Value of type variable "_CLE" of "Cast" cannot be "datetime | None"  [type-var]
app/utils/statistics.py:121: error: Value of type variable "_CLE" of "Cast" cannot be "datetime | None"  [type-var]

Miscellaneous None:

app/routers/applications.py:251: error: Invalid index type "str | None" for "dict[str, Any]"; expected type "str"  [index]

python/typing#213

app/routers/lenders.py:122: error: Returning Any from function declared to return "Lender"  [no-any-return]
app/routers/lenders.py:210: error: Returning Any from function declared to return "CreditProduct"  [no-any-return]
app/routers/users.py:335: error: Returning Any from function declared to return "User"  [no-any-return]
app/routers/users.py:412: error: Returning Any from function declared to return "User"  [no-any-return]
app/util.py:161: error: Returning Any from function declared to return "BorrowerDocument"  [no-any-return]

fastapi/sqlmodel#654

I think upgrading to pydantic 2 #238 and adding this to pyproject.toml fixes these:

[tool.mypy]
plugins = ['pydantic.mypy']
app/routers/applications.py:172: error: Missing named argument "legal_name" for "UpdateDataField"  [call-arg]
app/routers/applications.py:172: error: Missing named argument "email" for "UpdateDataField"  [call-arg]
app/routers/applications.py:172: error: Missing named argument "address" for "UpdateDataField"  [call-arg]
app/routers/applications.py:172: error: Missing named argument "legal_identifier" for "UpdateDataField"  [call-arg]
app/routers/applications.py:172: error: Missing named argument "type" for "UpdateDataField"  [call-arg]

fastapi/sqlmodel#348

app/models.py:229: error: Definition of "__config__" in base class "BaseModel" is incompatible with definition in base class "ActiveRecordMixin"  [misc]
app/models.py:285: error: Definition of "__config__" in base class "BaseModel" is incompatible with definition in base class "ActiveRecordMixin"  [misc]
app/models.py:362: error: Definition of "__config__" in base class "BaseModel" is incompatible with definition in base class "ActiveRecordMixin"  [misc]
app/models.py:590: error: Definition of "__config__" in base class "BaseModel" is incompatible with definition in base class "ActiveRecordMixin"  [misc]
app/models.py:608: error: Definition of "__config__" in base class "BaseModel" is incompatible with definition in base class "ActiveRecordMixin"  [misc]
app/models.py:661: error: Definition of "__config__" in base class "BaseModel" is incompatible with definition in base class "ActiveRecordMixin"  [misc]
app/models.py:696: error: Definition of "__config__" in base class "BaseModel" is incompatible with definition in base class "ActiveRecordMixin"  [misc]
app/models.py:755: error: Definition of "__config__" in base class "BaseModel" is incompatible with definition in base class "ActiveRecordMixin"  [misc]
app/models.py:761: error: Definition of "__config__" in base class "BaseModel" is incompatible with definition in base class "ActiveRecordMixin"  [misc]

Missing stub files

app/i18n.py:6: error: Skipping analyzing "transifex.native": module is installed, but missing library stubs or py.typed marker  [import-untyped]
app/i18n.py:6: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
app/i18n.py:17: error: Returning Any from function declared to return "str"  [no-any-return]
reportlab_mods.py:78: error: Call to untyped function "getSampleStyleSheet" in typed context  [no-untyped-call]

Fixed

#216

app/commands.py:89: error: Incompatible types in assignment (expression has type "str", variable has type "dict[str, Any]")  [assignment]

#214

app/routers/users.py:190: error: Missing return statement  [return]

#212

app/commands.py:42: error: Argument 1 to "fetch_new_awards_from_date" has incompatible type "str"; expected "datetime"  [arg-type]
app/commands.py:42: error: Argument 3 to "fetch_new_awards_from_date" has incompatible type "str"; expected "datetime | None"  [arg-type]

#199

app/routers/borrowers.py:15: error: Function is missing a return type annotation  [no-untyped-def]
app/routers/borrowers.py:26: error: Function is missing a return type annotation  [no-untyped-def]
app/routers/borrowers.py:49: error: Function is missing a return type annotation  [no-untyped-def]
app/routers/awards.py:13: error: Function is missing a return type annotation  [no-untyped-def]
app/routers/awards.py:25: error: Function is missing a return type annotation  [no-untyped-def]
app/routers/awards.py:39: error: Function is missing a return type annotation  [no-untyped-def]
app/routers/security.py:12: error: Function is missing a return type annotation  [no-untyped-def]
app/routers/security.py:27: error: Function is missing a return type annotation  [no-untyped-def]

FastAPI: Compatible models

  • I think the only solution is to use cast() for these.
app/routers/guest/applications.py:41: error: Argument "application" to "ApplicationResponse" has incompatible type "Application"; expected "ApplicationRead"  [arg-type]
app/routers/guest/applications.py:86: error: Argument "application" to "ApplicationResponse" has incompatible type "Application"; expected "ApplicationRead"  [arg-type]
app/routers/guest/applications.py:123: error: Argument "application" to "ApplicationResponse" has incompatible type "Application"; expected "ApplicationRead"  [arg-type]
app/routers/guest/applications.py:157: error: Argument "application" to "ApplicationResponse" has incompatible type "Application"; expected "ApplicationRead"  [arg-type]
app/routers/guest/applications.py:199: error: Argument "application" to "ApplicationResponse" has incompatible type "Application"; expected "ApplicationRead"  [arg-type]
app/routers/guest/applications.py:310: error: Argument "application" to "ApplicationResponse" has incompatible type "Application"; expected "ApplicationRead"  [arg-type]
app/routers/guest/applications.py:355: error: Argument "application" to "ApplicationResponse" has incompatible type "Application"; expected "ApplicationRead"  [arg-type]
app/routers/guest/applications.py:448: error: Argument "application" to "ApplicationResponse" has incompatible type "Application"; expected "ApplicationRead"  [arg-type]
app/routers/guest/applications.py:513: error: Argument "application" to "ApplicationResponse" has incompatible type "Application"; expected "ApplicationRead"  [arg-type]
app/routers/guest/applications.py:612: error: Argument "application" to "ApplicationResponse" has incompatible type "Application"; expected "ApplicationRead"  [arg-type]
app/routers/guest/applications.py:704: error: Argument "application" to "ApplicationResponse" has incompatible type "Application"; expected "ApplicationRead"  [arg-type]
app/routers/guest/applications.py:797: error: Argument "application" to "ApplicationResponse" has incompatible type "Application"; expected "ApplicationRead"  [arg-type]
app/routers/guest/applications.py:45: error: Argument "documents" to "ApplicationResponse" has incompatible type "list[BorrowerDocument] | None"; expected "list[BorrowerDocumentBase]"  [arg-type]
app/routers/guest/applications.py:314: error: Argument "documents" to "ApplicationResponse" has incompatible type "list[BorrowerDocument] | None"; expected "list[BorrowerDocumentBase]"  [arg-type]
app/routers/guest/applications.py:452: error: Argument "documents" to "ApplicationResponse" has incompatible type "list[BorrowerDocument] | None"; expected "list[BorrowerDocumentBase]"  [arg-type]
app/routers/guest/applications.py:616: error: Argument "documents" to "ApplicationResponse" has incompatible type "list[BorrowerDocument] | None"; expected "list[BorrowerDocumentBase]"  [arg-type]
app/routers/guest/applications.py:708: error: Argument "documents" to "ApplicationResponse" has incompatible type "list[BorrowerDocument] | None"; expected "list[BorrowerDocumentBase]"  [arg-type]
app/routers/applications.py:435: error: Argument "items" to "ApplicationListResponse" has incompatible type "list[Application]"; expected "list[ApplicationWithRelations]"  [arg-type]
app/routers/applications.py:533: error: Argument "items" to "ApplicationListResponse" has incompatible type "list[Application]"; expected "list[ApplicationWithRelations]"  [arg-type]
@jpmckinney jpmckinney changed the title mypy log mypy error log Nov 28, 2023
@jpmckinney jpmckinney changed the title mypy error log Fix mypy errors Nov 28, 2023
@yolile yolile moved this to 📋 Backlog in Credere optimization backlog May 7, 2024
@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Credere optimization backlog Aug 15, 2024
@jpmckinney
Copy link
Member Author

jpmckinney commented Aug 20, 2024

app/mail.py:183: error: Item "None" of "Lender | None" has no attribute "name"  [union-attr]
app/mail.py:191: error: Item "None" of "Lender | None" has no attribute "default_pre_approval_message"  [union-attr]
app/mail.py:192: error: Item "None" of "Lender | None" has no attribute "default_pre_approval_message"  [union-attr]
app/mail.py:217: error: Item "None" of "Lender | None" has no attribute "name"  [union-attr]
app/mail.py:237: error: Item "None" of "Lender | None" has no attribute "name"  [union-attr]
app/mail.py:239: error: Item "None" of "Lender | None" has no attribute "email_group"  [union-attr]
app/mail.py:285: error: Item "None" of "Lender | None" has no attribute "email_group"  [union-attr]
app/mail.py:495: error: Item "None" of "Lender | None" has no attribute "name"  [union-attr]
app/mail.py:560: error: Item "None" of "Lender | None" has no attribute "name"  [union-attr]
app/mail.py:582: error: Item "None" of "Lender | None" has no attribute "name"  [union-attr]
app/utils/tables.py:46: error: Item "None" of "Lender | None" has no attribute "name"  [union-attr]
app/routers/downloads.py:38: error: Argument 1 to "raise_if_unauthorized" has incompatible type "Application | None"; expected "Application"  [arg-type]
app/routers/downloads.py:48: error: Item "None" of "Application | None" has no attribute "id"  [union-attr]
app/routers/applications.py:284: error: Argument 1 to "raise_if_unauthorized" has incompatible type "Application | None"; expected "Application"  [arg-type]
app/routers/applications.py:296: error: Item "None" of "Application | None" has no attribute "id"  [union-attr]
app/routers/applications.py:597: error: Item "None" of "Lender | None" has no attribute "id"  [union-attr]
app/routers/guest/applications.py:655: error: Item "None" of "Lender | None" has no attribute "email_group"  [union-attr]

Nullable foreign keys cause 17 of the remaining 47 errors. (?<!int)(?<!Decimal)(?<!datetime) \| None(?! = None|:)

app/settings.py:193: error: Argument "before_send" to "init" has incompatible type "Callable[[dict[str, Any], dict[str, Any]], dict[str, Any] | None]"; expected "Callable[[Event, dict[str, Any]], Event | None] | None"  [arg-type]

Sentry's Event is from a private module.

app/models.py:95: error: "type[Self]" has no attribute "model_validate"  [attr-defined]
app/models.py:98: error: Returning Any from function declared to return "Self"  [no-any-return]
app/models.py:111: error: "Self" has no attribute "model_dump"  [attr-defined]
app/models.py:120: error: Returning Any from function declared to return "Self"  [no-any-return]

These from ActiveRecordMixin relate to fastapi/sqlmodel#348

app/i18n.py:6: error: Skipping analyzing "transifex.native": module is installed, but missing library stubs or py.typed marker  [import-untyped]
app/i18n.py:6: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
app/i18n.py:17: error: Returning Any from function declared to return "str"  [no-any-return]

Might be resolved by #356

app/models.py:615: error: No overload variant of "__sub__" of "datetime" matches argument type "None"  [operator]
app/models.py:615: note: Possible overload variants:
app/models.py:615: note:     def __sub__(self, datetime, /) -> timedelta
app/models.py:615: note:     def __sub__(self, timedelta, /) -> datetime
app/models.py:615: note: Right operand is of type "datetime | None"
app/models.py:751: error: Returning Any from function declared to return "datetime | None"  [no-any-return]
reportlab_mods.py:79: error: Call to untyped function "getSampleStyleSheet" in typed context  [no-untyped-call]
app/auth.py:54: error: Value of type "dict[str, dict[str, str]] | None" is not indexable  [index]
app/auth.py:63: error: Item "None" of "Algorithm | None" has no attribute "prepare_key"  [union-attr]
app/auth.py:65: error: Item "None" of "Algorithm | None" has no attribute "verify"  [union-attr]
app/auth.py:67: error: Return type "Coroutine[Any, Any, JWTAuthorizationCredentials | None]" of "__call__" incompatible with return type "Coroutine[Any, Any, HTTPAuthorizationCredentials | None]" in supertype "HTTPBearer"  [override]
app/auth.py:67: error: Return type "Coroutine[Any, Any, JWTAuthorizationCredentials | None]" of "__call__" incompatible with return type "Coroutine[Any, Any, HTTPAuthorizationCredentials | None]" in supertype "HTTPBase"  [override]
app/util.py:57: error: "type[T]" has no attribute "first_by"  [attr-defined]
app/util.py:60: error: Returning Any from function declared to return "T"  [no-any-return]
app/util.py:113: error: Value of type variable "AnyOrLiteralStr" of "splitext" cannot be "str | None"  [type-var]
app/util.py:113: error: Item "None" of "str | None" has no attribute "lower"  [union-attr]
app/util.py:161: error: Argument "borrower_documents" to "ApplicationWithRelations" has incompatible type "list[BorrowerDocument]"; expected "list[BorrowerDocumentBase]"  [arg-type]
app/util.py:161: note: "List" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance
app/util.py:161: note: Consider using "Sequence" instead, which is covariant
app/util.py:250: error: Returning Any from function declared to return "BorrowerDocument"  [no-any-return]
app/dependencies.py:39: error: Returning Any from function declared to return "str"  [no-any-return]
app/routers/users.py:86: error: Argument 2 to "initiate_auth" of "Client" has incompatible type "str | None"; expected "str"  [arg-type]
app/routers/users.py:88: error: Incompatible types in assignment (expression has type "RespondToAuthChallengeResponseTypeDef | dict[str, str]", variable has type "InitiateAuthResponseTypeDef")  [assignment]
app/routers/users.py:92: error: Argument "new_password" to "respond_to_auth_challenge" of "Client" has incompatible type "str | None"; expected "str"  [arg-type]
app/routers/users.py:187: error: Argument 2 to "initiate_auth" of "Client" has incompatible type "str | None"; expected "str"  [arg-type]
app/routers/users.py:194: error: Argument "mfa_code" to "respond_to_auth_challenge" of "Client" has incompatible type "str | None"; expected "str"  [arg-type]
app/routers/users.py:212: error: TypedDict "RespondToAuthChallengeResponseTypeDef" has no key "access_token"  [typeddict-item]
app/routers/users.py:213: error: TypedDict "RespondToAuthChallengeResponseTypeDef" has no key "refresh_token"  [typeddict-item]
app/routers/guest/applications.py:195: error: Argument 2 to "add_task" of "BackgroundTasks" has incompatible type "int | None"; expected "int"  [arg-type]

@jpmckinney
Copy link
Member Author

jpmckinney commented Aug 23, 2024

Down to 15.

Sentry's Event is from a private module: 1

app/settings.py:192: error: Argument "before_send" to "init" has incompatible type "Callable[[dict[str, Any], dict[str, Any]], dict[str, Any] | None]"; expected "Callable[[Event, dict[str, Any]], Event | None] | None"  [arg-type]

These from ActiveRecordMixin relate to fastapi/sqlmodel#348: 3

app/models.py:100: error: "type[Self]" has no attribute "model_validate"  [attr-defined]
app/models.py:116: error: "Self" has no attribute "model_dump"  [attr-defined]

Need an Intersection type from Python python/typing#213: 2

app/util.py:51: error: "type[T]" has no attribute "first_by"  [attr-defined]

Might be resolved by #376: 1

app/util.py:155: error: Argument "borrower_documents" to "ApplicationWithRelations" has incompatible type "list[BorrowerDocument]"; expected "list[BorrowerDocumentBase]"  [arg-type]
app/util.py:155: note: "List" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance
app/util.py:155: note: Consider using "Sequence" instead, which is covariant

And the rest: 8

app/models.py:880: error: No overload variant of "__sub__" of "datetime" matches argument type "None"  [operator]
app/models.py:880: note: Possible overload variants:
app/models.py:880: note:     def __sub__(self, datetime, /) -> timedelta
app/models.py:880: note:     def __sub__(self, timedelta, /) -> datetime
app/models.py:880: note: Right operand is of type "datetime | None"
app/auth.py:88: error: Return type "Coroutine[Any, Any, JWTAuthorizationCredentials]" of "__call__" incompatible with return type "Coroutine[Any, Any, HTTPAuthorizationCredentials | None]" in supertype "HTTPBearer"  [override]
app/auth.py:88: error: Return type "Coroutine[Any, Any, JWTAuthorizationCredentials]" of "__call__" incompatible with return type "Coroutine[Any, Any, HTTPAuthorizationCredentials | None]" in supertype "HTTPBase"  [override]
app/dependencies.py:40: error: Returning Any from function declared to return "str"  [no-any-return]
app/util.py:107: error: Value of type variable "AnyOrLiteralStr" of "splitext" cannot be "str | None"  [type-var]
app/util.py:107: error: Item "None" of "str | None" has no attribute "lower"  [union-attr]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

1 participant