Просмотр исходного кода

ref: have black format .pyi files too (#68793)

<!-- Describe your PR here. -->
anthony sottile 11 месяцев назад
Родитель
Сommit
dc1443e40a

+ 1 - 1
.pre-commit-config.yaml

@@ -31,7 +31,7 @@ repos:
         name: black
         entry: black
         language: system
-        types: [python]
+        types_or: [python, pyi]
         require_serial: true
       # Configuration for isort exists in pyproject.toml,
       # but we let pre-commit take care of the file filtering.

+ 1 - 1
fixtures/stubs-for-mypy/amqp/__init__.pyi

@@ -1,4 +1,4 @@
 from amqp.channel import Channel
 from amqp.connection import Connection
 
-__all__ = ('Channel', 'Connection')
+__all__ = ("Channel", "Connection")

+ 3 - 3
fixtures/stubs-for-mypy/brotli.pyi

@@ -12,11 +12,11 @@ MODE_TEXT = _Mode._MODE_TEXT
 MODE_FONT = _Mode._MODE_FONT
 
 class Compressor: ...
-
 class Decompressor: ...
 
-def compress(string: bytes, mode: _Mode = ..., quality: int = ..., lgwin: int = ..., lgblock: int = ...) -> bytes: ...
-
+def compress(
+    string: bytes, mode: _Mode = ..., quality: int = ..., lgwin: int = ..., lgblock: int = ...
+) -> bytes: ...
 def decompress(string: bytes) -> bytes: ...
 
 class error(Exception): ...

+ 3 - 1
fixtures/stubs-for-mypy/csp/middleware.pyi

@@ -4,5 +4,7 @@ from django.utils.deprecation import MiddlewareMixin
 
 class CSPMiddleware(MiddlewareMixin):
     def process_request(self, request: HttpRequest) -> None: ...
-    def process_response(self, request: HttpRequest, response: HttpResponseBase) -> HttpResponseBase: ...
+    def process_response(
+        self, request: HttpRequest, response: HttpResponseBase
+    ) -> HttpResponseBase: ...
     def build_policy(self, request: HttpRequest, response: HttpResponseBase) -> str: ...

+ 11 - 13
fixtures/stubs-for-mypy/isodate/duration.pyi

@@ -8,19 +8,17 @@ class Duration:
     tdelta: datetime.timedelta
 
     def __init__(
-            self,
-            days: int,
-            seconds: int,
-            microseconds: int,
-            milliseconds: int,
-            minutes: int,
-            hours: int,
-            weeks: int,
-            months: int | decimal.Decimal,
-            years: int | decimal.Decimal,
-    ) -> None:
-        ...
-
+        self,
+        days: int,
+        seconds: int,
+        microseconds: int,
+        milliseconds: int,
+        minutes: int,
+        hours: int,
+        weeks: int,
+        months: int | decimal.Decimal,
+        years: int | decimal.Decimal,
+    ) -> None: ...
     @overload
     def __add__(self, other: datetime.datetime) -> datetime.datetime: ...
     @overload

+ 1 - 0
fixtures/stubs-for-mypy/rapidjson.pyi

@@ -1,5 +1,6 @@
 from typing import Any
 
 class JSONDecodeError(ValueError): ...
+
 def dumps(o: object) -> str: ...
 def loads(s: str | bytes) -> Any: ...

+ 1 - 1
fixtures/stubs-for-mypy/rediscluster/__init__.pyi

@@ -1,3 +1,3 @@
 from .client import RedisCluster
 
-__all__ = ('RedisCluster',)
+__all__ = ("RedisCluster",)