Skip to content

Commit 4ac3cca

Browse files
authored
black: enable skip_magic_trailing_comma (#5252)
* black: enable skip_magic_trailing_comma * Remove spurious commas
1 parent b993718 commit 4ac3cca

File tree

25 files changed

+44
-236
lines changed

25 files changed

+44
-236
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
line_length = 130
33
target_version = ["py37"]
44
exclude = ".*_pb2.pyi"
5+
skip_magic_trailing_comma = true
56

67
[tool.isort]
78
profile = "black"

requirements-tests-py3.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# typeshed is released on PyPI.
33
git+https://github.com/python/mypy.git@master
44
typed-ast>=1.0.4
5-
black==21.4b0
5+
black==21.4b1
66
flake8==3.8.4
77
flake8-bugbear==20.1.4
88
flake8-pyi==20.10.0

stdlib/@python2/__builtin__.pyi

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,11 +1007,7 @@ def round(number: SupportsFloat) -> float: ...
10071007
def round(number: SupportsFloat, ndigits: int) -> float: ...
10081008
def setattr(__obj: Any, __name: Text, __value: Any) -> None: ...
10091009
def sorted(
1010-
__iterable: Iterable[_T],
1011-
*,
1012-
cmp: Callable[[_T, _T], int] = ...,
1013-
key: Optional[Callable[[_T], Any]] = ...,
1014-
reverse: bool = ...,
1010+
__iterable: Iterable[_T], *, cmp: Callable[[_T, _T], int] = ..., key: Optional[Callable[[_T], Any]] = ..., reverse: bool = ...
10151011
) -> List[_T]: ...
10161012
@overload
10171013
def sum(__iterable: Iterable[_T]) -> Union[_T, int]: ...

stdlib/@python2/builtins.pyi

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,11 +1007,7 @@ def round(number: SupportsFloat) -> float: ...
10071007
def round(number: SupportsFloat, ndigits: int) -> float: ...
10081008
def setattr(__obj: Any, __name: Text, __value: Any) -> None: ...
10091009
def sorted(
1010-
__iterable: Iterable[_T],
1011-
*,
1012-
cmp: Callable[[_T, _T], int] = ...,
1013-
key: Optional[Callable[[_T], Any]] = ...,
1014-
reverse: bool = ...,
1010+
__iterable: Iterable[_T], *, cmp: Callable[[_T, _T], int] = ..., key: Optional[Callable[[_T], Any]] = ..., reverse: bool = ...
10151011
) -> List[_T]: ...
10161012
@overload
10171013
def sum(__iterable: Iterable[_T]) -> Union[_T, int]: ...

stdlib/@python2/logging/__init__.pyi

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -73,24 +73,13 @@ class Logger(Filterer):
7373
) -> None: ...
7474
fatal = critical
7575
def log(
76-
self,
77-
level: int,
78-
msg: Any,
79-
*args: Any,
80-
exc_info: _ExcInfoType = ...,
81-
extra: Optional[Dict[str, Any]] = ...,
82-
**kwargs: Any,
76+
self, level: int, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Optional[Dict[str, Any]] = ..., **kwargs: Any
8377
) -> None: ...
8478
def exception(
8579
self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Optional[Dict[str, Any]] = ..., **kwargs: Any
8680
) -> None: ...
8781
def _log(
88-
self,
89-
level: int,
90-
msg: Any,
91-
args: _ArgsType,
92-
exc_info: Optional[_ExcInfoType] = ...,
93-
extra: Optional[Dict[str, Any]] = ...,
82+
self, level: int, msg: Any, args: _ArgsType, exc_info: Optional[_ExcInfoType] = ..., extra: Optional[Dict[str, Any]] = ...
9483
) -> None: ... # undocumented
9584
def filter(self, record: LogRecord) -> bool: ...
9685
def addHandler(self, hdlr: Handler) -> None: ...
@@ -210,13 +199,7 @@ class LoggerAdapter:
210199
self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Optional[Dict[str, Any]] = ..., **kwargs: Any
211200
) -> None: ...
212201
def log(
213-
self,
214-
level: int,
215-
msg: Any,
216-
*args: Any,
217-
exc_info: _ExcInfoType = ...,
218-
extra: Optional[Dict[str, Any]] = ...,
219-
**kwargs: Any,
202+
self, level: int, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Optional[Dict[str, Any]] = ..., **kwargs: Any
220203
) -> None: ...
221204
def isEnabledFor(self, level: int) -> bool: ...
222205

stdlib/_typeshed/__init__.pyi

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -104,17 +104,7 @@ OpenTextModeUpdating = Literal[
104104
"t+x",
105105
"+tx",
106106
]
107-
OpenTextModeWriting = Literal[
108-
"w",
109-
"wt",
110-
"tw",
111-
"a",
112-
"at",
113-
"ta",
114-
"x",
115-
"xt",
116-
"tx",
117-
]
107+
OpenTextModeWriting = Literal["w", "wt", "tw", "a", "at", "ta", "x", "xt", "tx"]
118108
OpenTextModeReading = Literal["r", "rt", "tr", "U", "rU", "Ur", "rtU", "rUt", "Urt", "trU", "tUr", "Utr"]
119109
OpenTextMode = Union[OpenTextModeUpdating, OpenTextModeWriting, OpenTextModeReading]
120110
OpenBinaryModeUpdating = Literal[

stdlib/asyncio/base_events.pyi

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,7 @@ class Server(AbstractServer):
3333
ssl_handshake_timeout: Optional[float],
3434
) -> None: ...
3535
else:
36-
def __init__(
37-
self,
38-
loop: AbstractEventLoop,
39-
sockets: List[socket],
40-
) -> None: ...
36+
def __init__(self, loop: AbstractEventLoop, sockets: List[socket]) -> None: ...
4137

4238
class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
4339
def run_forever(self) -> None: ...

stdlib/builtins.pyi

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -334,10 +334,7 @@ class str(Sequence[str]):
334334
def count(self, x: str, __start: Optional[SupportsIndex] = ..., __end: Optional[SupportsIndex] = ...) -> int: ...
335335
def encode(self, encoding: str = ..., errors: str = ...) -> bytes: ...
336336
def endswith(
337-
self,
338-
__suffix: Union[str, Tuple[str, ...]],
339-
__start: Optional[SupportsIndex] = ...,
340-
__end: Optional[SupportsIndex] = ...,
337+
self, __suffix: Union[str, Tuple[str, ...]], __start: Optional[SupportsIndex] = ..., __end: Optional[SupportsIndex] = ...
341338
) -> bool: ...
342339
def expandtabs(self, tabsize: int = ...) -> str: ...
343340
def find(self, __sub: str, __start: Optional[SupportsIndex] = ..., __end: Optional[SupportsIndex] = ...) -> int: ...
@@ -375,10 +372,7 @@ class str(Sequence[str]):
375372
def split(self, sep: Optional[str] = ..., maxsplit: int = ...) -> List[str]: ...
376373
def splitlines(self, keepends: bool = ...) -> List[str]: ...
377374
def startswith(
378-
self,
379-
__prefix: Union[str, Tuple[str, ...]],
380-
__start: Optional[SupportsIndex] = ...,
381-
__end: Optional[SupportsIndex] = ...,
375+
self, __prefix: Union[str, Tuple[str, ...]], __start: Optional[SupportsIndex] = ..., __end: Optional[SupportsIndex] = ...
382376
) -> bool: ...
383377
def strip(self, __chars: Optional[str] = ...) -> str: ...
384378
def swapcase(self) -> str: ...
@@ -999,9 +993,7 @@ def eval(
999993
__source: Union[str, bytes, CodeType], __globals: Optional[Dict[str, Any]] = ..., __locals: Optional[Mapping[str, Any]] = ...
1000994
) -> Any: ...
1001995
def exec(
1002-
__source: Union[str, bytes, CodeType],
1003-
__globals: Optional[Dict[str, Any]] = ...,
1004-
__locals: Optional[Mapping[str, Any]] = ...,
996+
__source: Union[str, bytes, CodeType], __globals: Optional[Dict[str, Any]] = ..., __locals: Optional[Mapping[str, Any]] = ...
1005997
) -> Any: ...
1006998
def exit(code: object = ...) -> NoReturn: ...
1007999

stdlib/distutils/filelist.pyi

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,7 @@ class FileList:
1616
def process_template_line(self, line: str) -> None: ...
1717
@overload
1818
def include_pattern(
19-
self,
20-
pattern: str,
21-
anchor: Union[int, bool] = ...,
22-
prefix: Optional[str] = ...,
23-
is_regex: Literal[0, False] = ...,
19+
self, pattern: str, anchor: Union[int, bool] = ..., prefix: Optional[str] = ..., is_regex: Literal[0, False] = ...
2420
) -> bool: ...
2521
@overload
2622
def include_pattern(self, pattern: Union[str, Pattern[str]], *, is_regex: Literal[True, 1] = ...) -> bool: ...
@@ -34,11 +30,7 @@ class FileList:
3430
) -> bool: ...
3531
@overload
3632
def exclude_pattern(
37-
self,
38-
pattern: str,
39-
anchor: Union[int, bool] = ...,
40-
prefix: Optional[str] = ...,
41-
is_regex: Literal[0, False] = ...,
33+
self, pattern: str, anchor: Union[int, bool] = ..., prefix: Optional[str] = ..., is_regex: Literal[0, False] = ...
4234
) -> bool: ...
4335
@overload
4436
def exclude_pattern(self, pattern: Union[str, Pattern[str]], *, is_regex: Literal[True, 1] = ...) -> bool: ...

stdlib/ftplib.pyi

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,5 @@ def parse227(resp: str) -> Tuple[str, int]: ... # undocumented
157157
def parse229(resp: str, peer: Any) -> Tuple[str, int]: ... # undocumented
158158
def parse257(resp: str) -> str: ... # undocumented
159159
def ftpcp(
160-
source: FTP,
161-
sourcename: str,
162-
target: FTP,
163-
targetname: str = ...,
164-
type: Literal["A", "I"] = ...,
160+
source: FTP, sourcename: str, target: FTP, targetname: str = ..., type: Literal["A", "I"] = ...
165161
) -> None: ... # undocumented

stdlib/importlib/util.pyi

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,7 @@ def source_from_cache(path: str) -> str: ...
1616
def decode_source(source_bytes: bytes) -> str: ...
1717
def find_spec(name: str, package: Optional[str] = ...) -> Optional[importlib.machinery.ModuleSpec]: ...
1818
def spec_from_loader(
19-
name: str,
20-
loader: Optional[importlib.abc.Loader],
21-
*,
22-
origin: Optional[str] = ...,
23-
is_package: Optional[bool] = ...,
19+
name: str, loader: Optional[importlib.abc.Loader], *, origin: Optional[str] = ..., is_package: Optional[bool] = ...
2420
) -> Optional[importlib.machinery.ModuleSpec]: ...
2521
def spec_from_file_location(
2622
name: str,

stdlib/logging/config.pyi

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ else:
1212

1313
def dictConfig(config: dict[str, Any]) -> None: ...
1414
def fileConfig(
15-
fname: Union[_Path, IO[str], RawConfigParser],
16-
defaults: Optional[dict[str, str]] = ...,
17-
disable_existing_loggers: bool = ...,
15+
fname: Union[_Path, IO[str], RawConfigParser], defaults: Optional[dict[str, str]] = ..., disable_existing_loggers: bool = ...
1816
) -> None: ...
1917
def listen(port: int = ..., verify: Optional[Callable[[bytes], Optional[bytes]]] = ...) -> Thread: ...
2018
def stopListening() -> None: ...

stdlib/smtpd.pyi

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,18 +87,10 @@ class DebuggingServer(SMTPServer): ...
8787

8888
class PureProxy(SMTPServer):
8989
def process_message( # type: ignore
90-
self,
91-
peer: _Address,
92-
mailfrom: str,
93-
rcpttos: List[Text],
94-
data: Union[bytes, str],
90+
self, peer: _Address, mailfrom: str, rcpttos: List[Text], data: Union[bytes, str]
9591
) -> Optional[str]: ...
9692

9793
class MailmanProxy(PureProxy):
9894
def process_message( # type: ignore
99-
self,
100-
peer: _Address,
101-
mailfrom: str,
102-
rcpttos: List[Text],
103-
data: Union[bytes, str],
95+
self, peer: _Address, mailfrom: str, rcpttos: List[Text], data: Union[bytes, str]
10496
) -> Optional[str]: ...

stdlib/tkinter/__init__.pyi

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -348,10 +348,7 @@ class Misc:
348348
# binds do. The default value of func is not str.
349349
@overload
350350
def bind(
351-
self,
352-
sequence: Optional[str] = ...,
353-
func: Optional[Callable[[Event[Misc]], Any]] = ...,
354-
add: Optional[bool] = ...,
351+
self, sequence: Optional[str] = ..., func: Optional[Callable[[Event[Misc]], Any]] = ..., add: Optional[bool] = ...
355352
) -> str: ...
356353
@overload
357354
def bind(self, sequence: Optional[str], func: str, add: Optional[bool] = ...) -> None: ...
@@ -361,10 +358,7 @@ class Misc:
361358
# callbacks will get, so those are Misc.
362359
@overload
363360
def bind_all(
364-
self,
365-
sequence: Optional[str] = ...,
366-
func: Optional[Callable[[Event[Misc]], Any]] = ...,
367-
add: Optional[bool] = ...,
361+
self, sequence: Optional[str] = ..., func: Optional[Callable[[Event[Misc]], Any]] = ..., add: Optional[bool] = ...
368362
) -> str: ...
369363
@overload
370364
def bind_all(self, sequence: Optional[str], func: str, add: Optional[bool] = ...) -> None: ...
@@ -840,10 +834,7 @@ class Widget(BaseWidget, Pack, Place, Grid):
840834
# widgets don't.
841835
@overload
842836
def bind(
843-
self: _W,
844-
sequence: Optional[str] = ...,
845-
func: Optional[Callable[[Event[_W]], Any]] = ...,
846-
add: Optional[bool] = ...,
837+
self: _W, sequence: Optional[str] = ..., func: Optional[Callable[[Event[_W]], Any]] = ..., add: Optional[bool] = ...
847838
) -> str: ...
848839
@overload
849840
def bind(self, sequence: Optional[str], func: str, add: Optional[bool] = ...) -> None: ...
@@ -2682,11 +2673,7 @@ class Text(Widget, XView, YView):
26822673
# tag_bind stuff is very similar to Canvas
26832674
@overload
26842675
def tag_bind(
2685-
self,
2686-
tagName: str,
2687-
sequence: Optional[str],
2688-
func: Optional[Callable[[Event[Text]], Any]],
2689-
add: Optional[bool] = ...,
2676+
self, tagName: str, sequence: Optional[str], func: Optional[Callable[[Event[Text]], Any]], add: Optional[bool] = ...
26902677
) -> str: ...
26912678
@overload
26922679
def tag_bind(self, tagName: str, sequence: Optional[str], func: str, add: Optional[bool] = ...) -> None: ...

stdlib/tkinter/ttk.pyi

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -950,10 +950,7 @@ class Treeview(Widget, tkinter.XView, tkinter.YView):
950950
# Also, it's 'callback' instead of 'func' here.
951951
@overload
952952
def tag_bind(
953-
self,
954-
tagname: str,
955-
sequence: Optional[str] = ...,
956-
callback: Optional[Callable[[tkinter.Event[Treeview]], Any]] = ...,
953+
self, tagname: str, sequence: Optional[str] = ..., callback: Optional[Callable[[tkinter.Event[Treeview]], Any]] = ...
957954
) -> str: ...
958955
@overload
959956
def tag_bind(self, tagname: str, sequence: Optional[str], callback: str) -> None: ...

stdlib/typing.pyi

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -603,12 +603,7 @@ if sys.version_info >= (3, 7):
603603
]
604604
else:
605605
_get_type_hints_obj_allowed_types = Union[
606-
object,
607-
Callable[..., Any],
608-
FunctionType,
609-
BuiltinFunctionType,
610-
MethodType,
611-
ModuleType,
606+
object, Callable[..., Any], FunctionType, BuiltinFunctionType, MethodType, ModuleType,
612607
]
613608

614609
if sys.version_info >= (3, 9):
@@ -621,9 +616,7 @@ if sys.version_info >= (3, 9):
621616

622617
else:
623618
def get_type_hints(
624-
obj: _get_type_hints_obj_allowed_types,
625-
globalns: Optional[Dict[str, Any]] = ...,
626-
localns: Optional[Dict[str, Any]] = ...,
619+
obj: _get_type_hints_obj_allowed_types, globalns: Optional[Dict[str, Any]] = ..., localns: Optional[Dict[str, Any]] = ...
627620
) -> Dict[str, Any]: ...
628621

629622
if sys.version_info >= (3, 8):

stubs/JACK-Client/jack/__init__.pyi

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,7 @@ class Client:
137137
can_monitor: bool = ...,
138138
is_terminal: bool = ...,
139139
) -> List[Port]: ...
140-
def set_property(
141-
self,
142-
subject: Union[int, str],
143-
key: str,
144-
value: Union[str, bytes],
145-
type: str = ...,
146-
) -> None: ...
140+
def set_property(self, subject: Union[int, str], key: str, value: Union[str, bytes], type: str = ...) -> None: ...
147141
def remove_property(self, subject: Union[int, str], key: str) -> None: ...
148142
def remove_properties(self, subject: Union[int, str]) -> int: ...
149143
def remove_all_properties(self) -> None: ...
@@ -202,9 +196,7 @@ class OwnMidiPort(MidiPort, OwnPort):
202196
def max_event_size(self) -> int: ...
203197
@property
204198
def lost_midi_events(self) -> int: ...
205-
def incoming_midi_events(
206-
self,
207-
) -> Generator[Tuple[int, _CBufferType], None, None]: ...
199+
def incoming_midi_events(self) -> Generator[Tuple[int, _CBufferType], None, None]: ...
208200
def clear_buffer(self) -> None: ...
209201
def write_midi_event(self, time: int, event: Union[bytes, Sequence[int], _CBufferType]) -> None: ...
210202
def reserve_midi_event(self, time: int, size: int) -> _CBufferType: ...

stubs/click-spinner/click_spinner/__init__.pyi

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,13 @@ class Spinner(object):
1818
stream: _Stream
1919
stop_running: Optional[threading.Event]
2020
spin_thread: Optional[threading.Thread]
21-
def __init__(
22-
self,
23-
beep: bool,
24-
disable: bool,
25-
force: bool,
26-
stream: _Stream,
27-
) -> None: ...
21+
def __init__(self, beep: bool, disable: bool, force: bool, stream: _Stream) -> None: ...
2822
def start(self) -> None: ...
2923
def stop(self) -> None: ...
3024
def init_spin(self) -> None: ...
3125
def __enter__(self) -> Spinner: ...
3226
def __exit__(
33-
self,
34-
exc_type: Optional[Type[BaseException]],
35-
exc_val: Optional[BaseException],
36-
exc_tb: Optional[TracebackType],
27+
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
3728
) -> Literal[False]: ...
3829

3930
def spinner(beep: bool, disable: bool, force: bool, stream: _Stream) -> Spinner: ...

stubs/click/click/formatting.pyi

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,7 @@ class HelpFormatter:
1717
def write(self, string: str) -> None: ...
1818
def indent(self) -> None: ...
1919
def dedent(self) -> None: ...
20-
def write_usage(
21-
self,
22-
prog: str,
23-
args: str = ...,
24-
prefix: str = ...,
25-
) -> None: ...
20+
def write_usage(self, prog: str, args: str = ..., prefix: str = ...) -> None: ...
2621
def write_heading(self, heading: str) -> None: ...
2722
def write_paragraph(self) -> None: ...
2823
def write_text(self, text: str) -> None: ...

stubs/docopt/docopt.pyi

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,5 @@ __version__: str
55
_Argv = Union[Iterable[str], str]
66

77
def docopt(
8-
doc: str,
9-
argv: Optional[_Argv] = ...,
10-
help: bool = ...,
11-
version: Optional[Any] = ...,
12-
options_first: bool = ...,
8+
doc: str, argv: Optional[_Argv] = ..., help: bool = ..., version: Optional[Any] = ..., options_first: bool = ...
139
) -> dict[str, Any]: ... # Really should be dict[str, Union[str, bool]]

0 commit comments

Comments
 (0)