Use _typeshed.FileDescriptorOrPath in stubs (#9695)

This commit is contained in:
Avasam
2023-02-09 02:30:19 -05:00
committed by GitHub
parent 6d535bf0a3
commit 372073d35b
13 changed files with 39 additions and 53 deletions

View File

@@ -1,17 +1,14 @@
from _typeshed import Incomplete, StrOrBytesPath, StrPath
from _typeshed import FileDescriptorOrPath, Incomplete, StrPath
from collections.abc import Iterator
from typing import Any
from typing_extensions import TypeAlias
from pygments.lexer import Lexer, LexerMeta
_OpenFile: TypeAlias = StrOrBytesPath | int # copy/pasted from builtins.pyi
def get_all_lexers(plugins: bool = ...) -> Iterator[tuple[str, tuple[str, ...], tuple[str, ...], tuple[str, ...]]]: ...
def find_lexer_class(name: str) -> LexerMeta | None: ...
def find_lexer_class_by_name(_alias: str) -> LexerMeta: ...
def get_lexer_by_name(_alias: str, **options: Any) -> Lexer: ...
def load_lexer_from_file(filename: _OpenFile, lexername: str = ..., **options: Any) -> Lexer: ...
def load_lexer_from_file(filename: FileDescriptorOrPath, lexername: str = ..., **options: Any) -> Lexer: ...
def find_lexer_class_for_filename(_fn: StrPath, code: str | bytes | None = ...) -> LexerMeta | None: ...
def get_lexer_for_filename(_fn: StrPath, code: str | bytes | None = ..., **options: Any) -> Lexer: ...
def get_lexer_for_mimetype(_mime: str, **options: Any) -> Lexer: ...