Skip to content

Commit

Permalink
Upgrade black version (#7089)
Browse files Browse the repository at this point in the history
  • Loading branch information
hauntsaninja committed Jan 31, 2022
1 parent 9854926 commit b88a6f1
Show file tree
Hide file tree
Showing 173 changed files with 496 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/psf/black
rev: 21.12b0 # must match requirements-tests.txt
rev: 22.1.0 # must match requirements-tests.txt
hooks:
- id: black
language_version: python3.9
Expand Down
2 changes: 1 addition & 1 deletion requirements-tests.txt
@@ -1,7 +1,7 @@
mypy==0.931
pytype==2022.01.05; platform_system != "Windows" and python_version < "3.10"
# must match .pre-commit-config.yaml
black==21.12b0
black==22.1.0
flake8==4.0.1
flake8-bugbear==21.11.29
flake8-pyi==22.1.0
Expand Down
1 change: 1 addition & 0 deletions stdlib/@python2/SocketServer.pyi
Expand Up @@ -50,6 +50,7 @@ if sys.platform != "win32":
RequestHandlerClass: Callable[..., BaseRequestHandler],
bind_and_activate: bool = ...,
) -> None: ...

class UnixDatagramServer(BaseServer):
def __init__(
self,
Expand Down
1 change: 1 addition & 0 deletions stdlib/@python2/asyncore.pyi
Expand Up @@ -113,6 +113,7 @@ if sys.platform != "win32":
def write(self, data: bytes, flags: int = ...) -> int: ...
def close(self) -> None: ...
def fileno(self) -> int: ...

class file_dispatcher(dispatcher):
def __init__(self, fd: FileDescriptorLike, map: _maptype | None = ...) -> None: ...
def set_file(self, fd: int) -> None: ...
1 change: 1 addition & 0 deletions stdlib/@python2/distutils/command/bdist_msi.pyi
Expand Up @@ -2,6 +2,7 @@ import sys

if sys.platform == "win32":
from distutils.cmd import Command

class bdist_msi(Command):
def initialize_options(self) -> None: ...
def finalize_options(self) -> None: ...
Expand Down
1 change: 1 addition & 0 deletions stdlib/@python2/mmap.pyi
Expand Up @@ -30,6 +30,7 @@ class mmap(Sequence[bytes]):
def __init__(
self, fileno: int, length: int, flags: int = ..., prot: int = ..., access: int = ..., offset: int = ...
) -> None: ...

def close(self) -> None: ...
def flush(self, offset: int = ..., size: int = ...) -> int: ...
def move(self, dest: int, src: int, count: int) -> None: ...
Expand Down
10 changes: 10 additions & 0 deletions stdlib/@python2/msilib/__init__.pyi
Expand Up @@ -21,6 +21,7 @@ if sys.platform == "win32":
type_nullable: Literal[0x1000]
type_key: Literal[0x2000]
knownbits: Literal[0x3FFF]

class Table:

name: str
Expand All @@ -29,7 +30,9 @@ if sys.platform == "win32":
def add_field(self, index: int, name: str, type: int) -> None: ...
def sql(self) -> str: ...
def create(self, db: _Database) -> None: ...

class _Unspecified: ...

def change_sequence(
seq: Sequence[tuple[str, str | None, int]],
action: str,
Expand All @@ -44,6 +47,7 @@ if sys.platform == "win32":
def add_tables(db: _Database, module: ModuleType) -> None: ...
def make_id(str: str) -> str: ...
def gen_uuid() -> str: ...

class CAB:

name: str
Expand All @@ -55,6 +59,7 @@ if sys.platform == "win32":
def append(self, full: str, file: str, logical: str) -> tuple[int, str]: ...
def commit(self, db: _Database) -> None: ...
_directories: set[str]

class Directory:

db: _Database
Expand Down Expand Up @@ -90,10 +95,12 @@ if sys.platform == "win32":
def add_file(self, file: str, src: str | None = ..., version: str | None = ..., language: str | None = ...) -> str: ...
def glob(self, pattern: str, exclude: Container[str] | None = ...) -> list[str]: ...
def remove_pyc(self) -> None: ...

class Binary:

name: str
def __init__(self, fname: str) -> None: ...

class Feature:

id: str
Expand All @@ -110,6 +117,7 @@ if sys.platform == "win32":
attributes: int = ...,
) -> None: ...
def set_current(self) -> None: ...

class Control:

dlg: Dialog
Expand All @@ -118,12 +126,14 @@ if sys.platform == "win32":
def event(self, event: str, argument: str, condition: str = ..., ordering: int | None = ...) -> None: ...
def mapping(self, event: str, attribute: str) -> None: ...
def condition(self, action: str, condition: str) -> None: ...

class RadioButtonGroup(Control):

property: str
index: int
def __init__(self, dlg: Dialog, name: str, property: str) -> None: ...
def add(self, name: str, x: int, y: int, w: int, h: int, text: str, value: str | None = ...) -> None: ...

class Dialog:

db: _Database
Expand Down
1 change: 1 addition & 0 deletions stdlib/@python2/nis.pyi
Expand Up @@ -5,4 +5,5 @@ if sys.platform != "win32":
def get_default_domain() -> str: ...
def maps(domain: str = ...) -> list[str]: ...
def match(key: str, map: str, domain: str = ...) -> str: ...

class error(Exception): ...
1 change: 1 addition & 0 deletions stdlib/@python2/os/__init__.pyi
Expand Up @@ -235,6 +235,7 @@ if sys.platform != "win32":
def fchown(fd: int, uid: int, gid: int) -> None: ...
if sys.platform != "darwin":
def fdatasync(fd: FileDescriptorLike) -> None: ... # Unix only, not Mac

def fpathconf(fd: int, name: str | int) -> int: ...
def fstatvfs(fd: int) -> _StatVFS: ...
def ftruncate(fd: int, length: int) -> None: ...
Expand Down
1 change: 1 addition & 0 deletions stdlib/@python2/resource.pyi
Expand Up @@ -18,6 +18,7 @@ if sys.platform != "win32":
RLIMIT_MEMLOCK: int
RLIMIT_VMEM: int
RLIMIT_AS: int

class _RUsage(NamedTuple):
ru_utime: float
ru_stime: float
Expand Down
2 changes: 2 additions & 0 deletions stdlib/@python2/socket.pyi
Expand Up @@ -404,6 +404,7 @@ class socket:
def gettimeout(self) -> float | None: ...
if sys.platform == "win32":
def ioctl(self, control: int, option: int | tuple[int, int, int]) -> None: ...

def listen(self, __backlog: int) -> None: ...
# Note that the makefile's documented windows-specific behavior is not represented
def makefile(self, mode: unicode = ..., buffering: int = ...) -> BinaryIO: ...
Expand All @@ -422,6 +423,7 @@ class socket:
def setsockopt(self, level: int, optname: int, value: int | bytes) -> None: ...
if sys.platform == "win32":
def share(self, process_id: int) -> bytes: ...

def shutdown(self, how: int) -> None: ...

# ----- Functions -----
Expand Down
1 change: 1 addition & 0 deletions stdlib/@python2/termios.pyi
Expand Up @@ -243,4 +243,5 @@ if sys.platform != "win32":
def tcdrain(__fd: FileDescriptorLike) -> None: ...
def tcflush(__fd: FileDescriptorLike, __queue: int) -> None: ...
def tcflow(__fd: FileDescriptorLike, __action: int) -> None: ...

class error(Exception): ...
1 change: 1 addition & 0 deletions stdlib/@python2/webbrowser.pyi
Expand Up @@ -91,6 +91,7 @@ if sys.platform == "darwin":
name: str
def __init__(self, name: Text) -> None: ...
def open(self, url: Text, new: int = ..., autoraise: bool = ...) -> bool: ...

class MacOSXOSAScript(BaseBrowser):
def __init__(self, name: Text) -> None: ...
def open(self, url: Text, new: int = ..., autoraise: bool = ...) -> bool: ...
18 changes: 18 additions & 0 deletions stdlib/_ast.pyi
Expand Up @@ -25,8 +25,10 @@ class mod(AST): ...

if sys.version_info >= (3, 8):
class type_ignore(AST): ...

class TypeIgnore(type_ignore):
tag: str

class FunctionType(mod):
argtypes: list[expr]
returns: expr
Expand Down Expand Up @@ -228,12 +230,16 @@ class JoinedStr(expr):
if sys.version_info < (3, 8):
class Num(expr): # Deprecated in 3.8; use Constant
n: complex

class Str(expr): # Deprecated in 3.8; use Constant
s: str

class Bytes(expr): # Deprecated in 3.8; use Constant
s: bytes

class NameConstant(expr): # Deprecated in 3.8; use Constant
value: Any

class Ellipsis(expr): ... # Deprecated in 3.8; use Constant

class Constant(expr):
Expand Down Expand Up @@ -267,6 +273,7 @@ class Slice(_SliceT):
if sys.version_info < (3, 9):
class ExtSlice(slice):
dims: list[slice]

class Index(slice):
value: expr

Expand Down Expand Up @@ -297,6 +304,7 @@ if sys.version_info < (3, 9):
class AugLoad(expr_context): ...
class AugStore(expr_context): ...
class Param(expr_context): ...

class Suite(mod):
body: list[stmt]

Expand Down Expand Up @@ -380,32 +388,42 @@ if sys.version_info >= (3, 10):
class Match(stmt):
subject: expr
cases: list[match_case]

class pattern(AST): ...
# Without the alias, Pyright complains variables named pattern are recursively defined
_pattern = pattern

class match_case(AST):
pattern: _pattern
guard: expr | None
body: list[stmt]

class MatchValue(pattern):
value: expr

class MatchSingleton(pattern):
value: Literal[True, False, None]

class MatchSequence(pattern):
patterns: list[pattern]

class MatchStar(pattern):
name: _identifier | None

class MatchMapping(pattern):
keys: list[expr]
patterns: list[pattern]
rest: _identifier | None

class MatchClass(pattern):
cls: expr
patterns: list[pattern]
kwd_attrs: list[_identifier]
kwd_patterns: list[pattern]

class MatchAs(pattern):
pattern: _pattern | None
name: _identifier | None

class MatchOr(pattern):
patterns: list[pattern]
6 changes: 6 additions & 0 deletions stdlib/_curses.pyi
Expand Up @@ -280,6 +280,7 @@ if sys.platform != "win32":
def color_pair(pair_number: int) -> int: ...
else:
def color_pair(__color_number: int) -> int: ...

def curs_set(__visibility: int) -> int: ...
def def_prog_mode() -> None: ...
def def_shell_mode() -> None: ...
Expand All @@ -294,13 +295,15 @@ if sys.platform != "win32":
if sys.version_info >= (3, 9):
def get_escdelay() -> int: ...
def get_tabsize() -> int: ...

def getmouse() -> tuple[int, int, int, int, int]: ...
def getsyx() -> tuple[int, int]: ...
def getwin(__file: SupportsRead[bytes]) -> _CursesWindow: ...
def halfdelay(__tenths: int) -> None: ...
def has_colors() -> bool: ...
if sys.version_info >= (3, 10):
def has_extended_color_support() -> bool: ...

def has_ic() -> bool: ...
def has_il() -> bool: ...
def has_key(__key: int) -> bool: ...
Expand Down Expand Up @@ -339,6 +342,7 @@ if sys.platform != "win32":
if sys.version_info >= (3, 9):
def set_escdelay(__ms: int) -> None: ...
def set_tabsize(__size: int) -> None: ...

def setsyx(__y: int, __x: int) -> None: ...
def setupterm(term: str | None = ..., fd: int = ...) -> None: ...
def start_color() -> None: ...
Expand Down Expand Up @@ -367,7 +371,9 @@ if sys.platform != "win32":
def update_lines_cols() -> None: ...
def use_default_colors() -> None: ...
def use_env(__flag: bool) -> None: ...

class error(Exception): ...

class _CursesWindow:
encoding: str
@overload
Expand Down
2 changes: 2 additions & 0 deletions stdlib/_dummy_threading.pyi
Expand Up @@ -55,9 +55,11 @@ class Thread:
if sys.version_info >= (3, 8):
@property
def native_id(self) -> int | None: ... # only available on some platforms

def is_alive(self) -> bool: ...
if sys.version_info < (3, 9):
def isAlive(self) -> bool: ...

def isDaemon(self) -> bool: ...
def setDaemon(self, daemonic: bool) -> None: ...

Expand Down
5 changes: 5 additions & 0 deletions stdlib/_socket.pyi
Expand Up @@ -547,9 +547,11 @@ class socket:
def getsockopt(self, __level: int, __optname: int, __buflen: int) -> bytes: ...
if sys.version_info >= (3, 7):
def getblocking(self) -> bool: ...

def gettimeout(self) -> float | None: ...
if sys.platform == "win32":
def ioctl(self, __control: int, __option: int | tuple[int, int, int] | bool) -> None: ...

def listen(self, __backlog: int = ...) -> None: ...
def recv(self, __bufsize: int, __flags: int = ...) -> bytes: ...
def recvfrom(self, __bufsize: int, __flags: int = ...) -> tuple[bytes, _RetAddress]: ...
Expand All @@ -558,6 +560,7 @@ class socket:
def recvmsg_into(
self, __buffers: Iterable[WriteableBuffer], __ancbufsize: int = ..., __flags: int = ...
) -> tuple[int, list[_CMSG], int, Any]: ...

def recvfrom_into(self, buffer: WriteableBuffer, nbytes: int = ..., flags: int = ...) -> tuple[int, _RetAddress]: ...
def recv_into(self, buffer: WriteableBuffer, nbytes: int = ..., flags: int = ...) -> int: ...
def send(self, __data: ReadableBuffer, __flags: int = ...) -> int: ...
Expand All @@ -578,6 +581,7 @@ class socket:
def sendmsg_afalg(
self, msg: Iterable[ReadableBuffer] = ..., *, op: int, iv: Any = ..., assoclen: int = ..., flags: int = ...
) -> int: ...

def setblocking(self, __flag: bool) -> None: ...
def settimeout(self, __value: float | None) -> None: ...
@overload
Expand All @@ -586,6 +590,7 @@ class socket:
def setsockopt(self, __level: int, __optname: int, __value: None, __optlen: int) -> None: ...
if sys.platform == "win32":
def share(self, __process_id: int) -> bytes: ...

def shutdown(self, __how: int) -> None: ...

SocketType = socket
Expand Down
2 changes: 2 additions & 0 deletions stdlib/_tkinter.pyi
Expand Up @@ -55,6 +55,7 @@ class TkappType:
if sys.platform != "win32":
def createfilehandler(self, __file, __mask, __func): ...
def deletefilehandler(self, __file): ...

def createtimerhandler(self, __milliseconds, __func): ...
def deletecommand(self, __name): ...
def dooneevent(self, __flags: int = ...): ...
Expand All @@ -79,6 +80,7 @@ class TkappType:
def setvar(self, *ags, **kwargs): ...
if sys.version_info < (3, 11):
def split(self, __arg): ...

def splitlist(self, __arg): ...
def unsetvar(self, *args, **kwargs): ...
def wantobjects(self, *args, **kwargs): ...
Expand Down
1 change: 1 addition & 0 deletions stdlib/_winapi.pyi
Expand Up @@ -160,6 +160,7 @@ if sys.platform == "win32":
if sys.version_info >= (3, 7):
def GetACP() -> int: ...
def GetFileType(handle: int) -> int: ...

def GetCurrentProcess() -> int: ...
def GetExitCodeProcess(__process: int) -> int: ...
def GetLastError() -> int: ...
Expand Down
1 change: 1 addition & 0 deletions stdlib/argparse.pyi
Expand Up @@ -193,6 +193,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
help: str | None = ...,
metavar: str | None = ...,
) -> _SubParsersAction[_ArgumentParserT]: ...

def print_usage(self, file: IO[str] | None = ...) -> None: ...
def print_help(self, file: IO[str] | None = ...) -> None: ...
def format_usage(self) -> str: ...
Expand Down
2 changes: 2 additions & 0 deletions stdlib/array.pyi
Expand Up @@ -35,6 +35,7 @@ class array(MutableSequence[_T], Generic[_T]):
def index(self, __v: _T, __start: int = ..., __stop: int = ...) -> int: ...
else:
def index(self, __v: _T) -> int: ... # type: ignore # Overrides Sequence

def insert(self, __i: int, __v: _T) -> None: ...
def pop(self, __i: int = ...) -> _T: ...
def remove(self, __v: _T) -> None: ...
Expand All @@ -46,6 +47,7 @@ class array(MutableSequence[_T], Generic[_T]):
if sys.version_info < (3, 9):
def fromstring(self, __buffer: bytes) -> None: ...
def tostring(self) -> bytes: ...

def __len__(self) -> int: ...
@overload
def __getitem__(self, __i: SupportsIndex) -> _T: ...
Expand Down

0 comments on commit b88a6f1

Please sign in to comment.