Skip to content

Commit 945145e

Browse files
Per feedback, make the change and avoid the overloads (_frozen_importlib_external.pyi).
1 parent 1efb36b commit 945145e

File tree

1 file changed

+10
-25
lines changed

1 file changed

+10
-25
lines changed

stdlib/_frozen_importlib_external.pyi

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,9 @@ class SourceLoader(_LoaderBasics):
9999
def set_data(self, path: str, data: bytes) -> None: ...
100100
def get_source(self, fullname: str) -> str | None: ...
101101
def path_stats(self, path: str) -> Mapping[str, Any]: ...
102-
if sys.version_info >= (3, 12):
103-
def source_to_code(
104-
self, data: ReadableBuffer | str | _ast.Module | _ast.Expression | _ast.Interactive, path: bytes | StrPath
105-
) -> types.CodeType: ...
106-
else:
107-
def source_to_code(
108-
self, data: ReadableBuffer | str | _ast.Module | _ast.Expression | _ast.Interactive, path: ReadableBuffer | StrPath
109-
) -> types.CodeType: ...
110-
102+
def source_to_code(
103+
self, data: ReadableBuffer | str | _ast.Module | _ast.Expression | _ast.Interactive, path: bytes | StrPath
104+
) -> types.CodeType: ...
111105
def get_code(self, fullname: str) -> types.CodeType | None: ...
112106

113107
class FileLoader:
@@ -129,22 +123,13 @@ class FileLoader:
129123
class SourceFileLoader(importlib.abc.FileLoader, FileLoader, importlib.abc.SourceLoader, SourceLoader): # type: ignore[misc] # incompatible method arguments in base classes
130124
def set_data(self, path: str, data: ReadableBuffer, *, _mode: int = 0o666) -> None: ...
131125
def path_stats(self, path: str) -> Mapping[str, Any]: ...
132-
if sys.version_info >= (3, 12):
133-
def source_to_code( # type: ignore[override] # incompatible with InspectLoader.source_to_code
134-
self,
135-
data: ReadableBuffer | str | _ast.Module | _ast.Expression | _ast.Interactive,
136-
path: bytes | StrPath,
137-
*,
138-
_optimize: int = -1,
139-
) -> types.CodeType: ...
140-
else:
141-
def source_to_code( # type: ignore[override] # incompatible with InspectLoader.source_to_code
142-
self,
143-
data: ReadableBuffer | str | _ast.Module | _ast.Expression | _ast.Interactive,
144-
path: ReadableBuffer | StrPath,
145-
*,
146-
_optimize: int = -1,
147-
) -> types.CodeType: ...
126+
def source_to_code( # type: ignore[override] # incompatible with InspectLoader.source_to_code
127+
self,
128+
data: ReadableBuffer | str | _ast.Module | _ast.Expression | _ast.Interactive,
129+
path: bytes | StrPath,
130+
*,
131+
_optimize: int = -1,
132+
) -> types.CodeType: ...
148133

149134
class SourcelessFileLoader(importlib.abc.FileLoader, FileLoader, _LoaderBasics):
150135
def get_code(self, fullname: str) -> types.CodeType | None: ...

0 commit comments

Comments
 (0)