Skip to content
This repository was archived by the owner on Apr 15, 2025. It is now read-only.

Commit 3f16eba

Browse files
committed
chore(internal/pyright): enable reportImplicitOverride
1 parent 6cf0c17 commit 3f16eba

26 files changed

+177
-8
lines changed

databases/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ def _fromdir(path: str) -> list[str]:
124124
'reportUnknownVariableType': False,
125125
'reportUnknownArgumentType': False,
126126
# very strict errors
127+
'reportImplicitOverride': True,
127128
'reportUnusedCallResult': False,
128129
'reportImplicitStringConcatenation': False,
129130
'reportCallInDefaultInitializer': True,

databases/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import os
44
from typing import Set
55
from pathlib import Path
6-
from typing_extensions import Literal, get_args
6+
from typing_extensions import Literal, get_args, override
77

88
from pydantic import BaseModel
99
from syrupy.extensions.amber import AmberSnapshotExtension
@@ -57,6 +57,7 @@ class AmberSharedExtension(AmberSnapshotExtension):
5757
"""Syrupy extension that stores the snapshots in a parent __shared_snapshots__ dir"""
5858

5959
@property
60+
@override
6061
def _dirname(self) -> str:
6162
test_dir = Path(self.test_location.filepath).parent
6263
if test_dir.is_relative_to(SYNC_TESTS_DIR):

lib/pyright/_pyright.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class PyrightDiagnostics(TypedDict, total=False):
99
reportUnusedImport: bool
1010
reportPrivateUsage: bool
1111
reportImportCycles: bool
12+
reportImplicitOverride: bool
1213
reportUnusedCallResult: bool
1314
reportUnknownMemberType: bool
1415
reportUnknownVariableType: bool

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ typeCheckingMode = "strict"
6969
reportUnusedImport = true
7070
reportPrivateUsage = false
7171

72+
reportImplicitOverride = true
73+
7274
# TODO: pending some major refactoring, enable this
7375
reportImportCycles = false
7476

src/prisma/_async_http.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import json
22
from typing import Any
3+
from typing_extensions import override
34

45
import httpx
56

@@ -12,19 +13,23 @@
1213
class AsyncHTTP(AbstractHTTP[httpx.AsyncClient, httpx.Response]):
1314
session: httpx.AsyncClient
1415

16+
@override
1517
async def download(self, url: str, dest: str) -> None:
1618
async with self.session.stream('GET', url, timeout=None) as resp:
1719
resp.raise_for_status()
1820
with open(dest, 'wb') as fd:
1921
async for chunk in resp.aiter_bytes():
2022
fd.write(chunk)
2123

24+
@override
2225
async def request(self, method: Method, url: str, **kwargs: Any) -> 'Response':
2326
return Response(await self.session.request(method, url, **kwargs))
2427

28+
@override
2529
def open(self) -> None:
2630
self.session = httpx.AsyncClient(**self.session_kwargs)
2731

32+
@override
2833
async def close(self) -> None:
2934
if self.should_close():
3035
await self.session.aclose()
@@ -45,15 +50,19 @@ class Response(AbstractResponse[httpx.Response]):
4550
__slots__ = ()
4651

4752
@property
53+
@override
4854
def status(self) -> int:
4955
return self.original.status_code
5056

5157
@property
58+
@override
5259
def headers(self) -> httpx.Headers:
5360
return self.original.headers
5461

62+
@override
5563
async def json(self, **kwargs: Any) -> Any:
5664
return json.loads(await self.original.aread(), **kwargs)
5765

66+
@override
5867
async def text(self, **kwargs: Any) -> str:
5968
return ''.join([part async for part in self.original.aiter_text(**kwargs)])

src/prisma/_config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
from typing import TYPE_CHECKING, List, Union, ClassVar, Optional
66
from pathlib import Path
7+
from typing_extensions import override
78

89
import tomlkit
910
import pydantic
@@ -119,6 +120,7 @@ def parse(cls, **kwargs: object) -> Config:
119120

120121

121122
class LazyConfigProxy(LazyProxy[Config]):
123+
@override
122124
def __load__(self) -> Config:
123125
return Config.load()
124126

src/prisma/_proxy.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from abc import ABC, abstractmethod
44
from typing import Generic, TypeVar, Iterable, cast
5+
from typing_extensions import override
56

67
T = TypeVar('T')
78

@@ -17,12 +18,15 @@ def __init__(self) -> None:
1718
def __getattr__(self, attr: str) -> object:
1819
return getattr(self.__get_proxied__(), attr)
1920

21+
@override
2022
def __repr__(self) -> str:
2123
return repr(self.__get_proxied__())
2224

25+
@override
2326
def __str__(self) -> str:
2427
return str(self.__get_proxied__())
2528

29+
@override
2630
def __dir__(self) -> Iterable[str]:
2731
return self.__get_proxied__().__dir__()
2832

src/prisma/_sync_http.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from typing import Any
2+
from typing_extensions import override
23

34
import httpx
45

@@ -11,19 +12,23 @@
1112
class SyncHTTP(AbstractHTTP[httpx.Client, httpx.Response]):
1213
session: httpx.Client
1314

15+
@override
1416
def download(self, url: str, dest: str) -> None:
1517
with self.session.stream('GET', url, timeout=None) as resp:
1618
resp.raise_for_status()
1719
with open(dest, 'wb') as fd:
1820
for chunk in resp.iter_bytes():
1921
fd.write(chunk)
2022

23+
@override
2124
def request(self, method: Method, url: str, **kwargs: Any) -> 'Response':
2225
return Response(self.session.request(method, url, **kwargs))
2326

27+
@override
2428
def open(self) -> None:
2529
self.session = httpx.Client(**self.session_kwargs)
2630

31+
@override
2732
def close(self) -> None:
2833
if self.should_close():
2934
self.session.close()
@@ -42,15 +47,19 @@ class Response(AbstractResponse[httpx.Response]):
4247
__slots__ = ()
4348

4449
@property
50+
@override
4551
def status(self) -> int:
4652
return self.original.status_code
4753

4854
@property
55+
@override
4956
def headers(self) -> httpx.Headers:
5057
return self.original.headers
5158

59+
@override
5260
def json(self, **kwargs: Any) -> Any:
5361
return self.original.json(**kwargs)
5462

63+
@override
5564
def text(self, **kwargs: Any) -> str:
5665
return self.original.content.decode(**kwargs)

src/prisma/cli/_node.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from abc import ABC, abstractmethod
1010
from typing import IO, Any, Union, Mapping, cast
1111
from pathlib import Path
12-
from typing_extensions import Literal
12+
from typing_extensions import Literal, override
1313

1414
from .. import config
1515
from .._proxy import LazyProxy
@@ -117,9 +117,11 @@ def __init__(
117117
self.resolver = resolver
118118

119119
@property
120+
@override
120121
def target_bin(self) -> Path:
121122
return self.path.parent
122123

124+
@override
123125
def __run__(
124126
self,
125127
*args: str,
@@ -216,6 +218,7 @@ def __init__(self, *, target: Target) -> None:
216218
self.target = target
217219
self.resolver = 'nodejs-bin'
218220

221+
@override
219222
def __run__(
220223
self,
221224
*args: str,
@@ -257,6 +260,7 @@ def node_path(self) -> Path:
257260
return Path(nodejs.node.path)
258261

259262
@property
263+
@override
260264
def target_bin(self) -> Path:
261265
return Path(self.node_path).parent
262266

@@ -397,6 +401,7 @@ def __init__(self, target: Target) -> None:
397401
super().__init__()
398402
self.target = target
399403

404+
@override
400405
def __load__(self) -> Node:
401406
return resolve(self.target)
402407

src/prisma/cli/utils.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
overload,
1717
)
1818
from pathlib import Path
19+
from typing_extensions import override
1920

2021
import click
2122

@@ -30,6 +31,7 @@ class PrismaCLI(click.MultiCommand):
3031
base_package: str = 'prisma.cli.commands'
3132
folder: Path = Path(__file__).parent / 'commands'
3233

34+
@override
3335
def list_commands(self, ctx: click.Context) -> List[str]: # noqa: ARG002
3436
commands: List[str] = []
3537

@@ -46,6 +48,7 @@ def list_commands(self, ctx: click.Context) -> List[str]: # noqa: ARG002
4648
commands.sort()
4749
return commands
4850

51+
@override
4952
def get_command(self, ctx: click.Context, cmd_name: str) -> Optional[click.Command]: # noqa: ARG002
5053
name = f'{self.base_package}.{cmd_name}'
5154
if not module_exists(name):
@@ -66,6 +69,7 @@ def get_command(self, ctx: click.Context, cmd_name: str) -> Optional[click.Comma
6669
class PathlibPath(click.Path):
6770
"""A Click path argument that returns a pathlib Path, not a string"""
6871

72+
@override
6973
def convert(
7074
self,
7175
value: str | os.PathLike[str],
@@ -93,6 +97,7 @@ def __init__(self, enum: Type[Enum]) -> None:
9397
self.__enum = enum
9498
super().__init__([item.value for item in enum.__members__.values()])
9599

100+
@override
96101
def convert(
97102
self,
98103
value: str,

0 commit comments

Comments
 (0)