mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-09-11 09:05:07 +00:00
all: Format with ruff.
This commit is contained in:
@@ -3,7 +3,6 @@ from docutils.parsers.rst import Directive
|
||||
|
||||
|
||||
class PybricksClasslinkDirective(Directive):
|
||||
|
||||
required_arguments = 1
|
||||
optional_arguments = 1
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ from colorsys import hsv_to_rgb
|
||||
|
||||
|
||||
class PybricksColorDirective(Directive):
|
||||
|
||||
required_arguments = 1
|
||||
|
||||
def run(self):
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
* deprecated
|
||||
when building documentation with the 'ide' tag.
|
||||
"""
|
||||
|
||||
from docutils import nodes
|
||||
from docutils.parsers.rst import Directive
|
||||
|
||||
|
||||
class PybricksVersionDirective(Directive):
|
||||
|
||||
has_content = True
|
||||
|
||||
def run(self):
|
||||
|
||||
@@ -23,7 +23,6 @@ class MySensor(Ev3devSensor):
|
||||
|
||||
# Open the modes file.
|
||||
with open(modes_path, "r") as m:
|
||||
|
||||
# Read the contents.
|
||||
contents = m.read()
|
||||
|
||||
|
||||
@@ -42,13 +42,11 @@ def scale(val, src, dst):
|
||||
|
||||
|
||||
while event:
|
||||
|
||||
# Place event data into variables
|
||||
(tv_sec, tv_usec, ev_type, code, value) = struct.unpack(FORMAT, event)
|
||||
|
||||
# If a button was pressed or released
|
||||
if ev_type == 1:
|
||||
|
||||
# React to the X button
|
||||
if code == 304 and value == 0:
|
||||
print("The X button was released")
|
||||
@@ -98,7 +96,6 @@ while event:
|
||||
print("The R2 button was pressed")
|
||||
|
||||
elif ev_type == 3:
|
||||
|
||||
# The sticks often trigger non-stop events, comment this out if you are
|
||||
# not using the sticks as part of your project, or it becomes hard to
|
||||
# read other data
|
||||
|
||||
@@ -3,7 +3,6 @@ from pybricks.tools import wait
|
||||
print("Started!")
|
||||
|
||||
try:
|
||||
|
||||
# Run your script here as you normally would. In this
|
||||
# example we just wait forever and do nothing.
|
||||
while True:
|
||||
|
||||
@@ -12,7 +12,6 @@ hub.system.set_stop_button(None)
|
||||
# Check the button for 5 seconds.
|
||||
watch = StopWatch()
|
||||
while watch.time() < 5000:
|
||||
|
||||
# Set light to green if pressed, else red.
|
||||
if hub.buttons.pressed():
|
||||
hub.light.on(Color.GREEN)
|
||||
|
||||
@@ -9,7 +9,6 @@ hub = ThisHub()
|
||||
# Get the acceleration or angular_velocity along a single axis.
|
||||
# If you need only one value, this is more memory efficient.
|
||||
while True:
|
||||
|
||||
# Read the forward acceleration.
|
||||
forward_acceleration = hub.imu.acceleration(Axis.X)
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ SIDE_COLORS = {
|
||||
|
||||
# Keep updating the color based on detected up side.
|
||||
while True:
|
||||
|
||||
# Check which side of the hub is up.
|
||||
up_side = hub.imu.up()
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ hub = ThisHub()
|
||||
|
||||
# Turn the light on and off 5 times.
|
||||
for i in range(5):
|
||||
|
||||
hub.light.on(Color.RED)
|
||||
wait(1000)
|
||||
|
||||
|
||||
@@ -13,9 +13,7 @@ file_paths = [f for f in dir_path.glob("*.py") if f.stem != "make_examples"]
|
||||
|
||||
# Go through all template scripts
|
||||
for file_path in file_paths:
|
||||
|
||||
with open(file_path) as template:
|
||||
|
||||
# First line contains hub info
|
||||
hubs = template.readline().strip().split()[3:]
|
||||
|
||||
@@ -31,9 +29,7 @@ for file_path in file_paths:
|
||||
|
||||
# Open destination script:
|
||||
with open(gen_path, "w") as dest_file:
|
||||
|
||||
# Read script line by line.
|
||||
for line in template.readlines():
|
||||
|
||||
# Replace hub name if present.
|
||||
dest_file.writelines(line.replace("ThisHub", hub))
|
||||
|
||||
@@ -10,7 +10,6 @@ hub.system.set_stop_button((Button.CENTER, Button.BLUETOOTH))
|
||||
|
||||
# Now we can use the center button as a normal button.
|
||||
while True:
|
||||
|
||||
# Play a sound if the center button is pressed.
|
||||
if Button.CENTER in hub.buttons.pressed():
|
||||
hub.speaker.beep()
|
||||
|
||||
@@ -9,7 +9,6 @@ hub = PrimeHub()
|
||||
hub.display.orientation(up=Side.RIGHT)
|
||||
|
||||
while True:
|
||||
|
||||
# Start with random left brow: up or down.
|
||||
if randint(0, 100) < 70:
|
||||
brows = Icon.EYE_LEFT_BROW * 0.5
|
||||
|
||||
@@ -6,7 +6,6 @@ from pybricks.tools import wait
|
||||
hub = PrimeHub()
|
||||
|
||||
while True:
|
||||
|
||||
# Check which side of the hub is up.
|
||||
up_side = hub.imu.up()
|
||||
|
||||
|
||||
@@ -53,7 +53,6 @@ except AttributeError:
|
||||
|
||||
# Go through all available ports.
|
||||
for port in ports:
|
||||
|
||||
# Try to get the device, if it is attached.
|
||||
try:
|
||||
device = PUPDevice(port)
|
||||
|
||||
@@ -6,7 +6,6 @@ from pybricks.tools import wait
|
||||
example_motor = Motor(Port.A)
|
||||
|
||||
while True:
|
||||
|
||||
# Get the default angle value.
|
||||
angle = example_motor.angle()
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ example_motor.run(300)
|
||||
|
||||
# Display the angle and speed 50 times.
|
||||
for i in range(100):
|
||||
|
||||
# Read the angle (degrees) and speed (degrees per second).
|
||||
angle = example_motor.angle()
|
||||
speed = example_motor.speed()
|
||||
|
||||
@@ -9,7 +9,6 @@ try:
|
||||
# Here you can write code that uses the remote.
|
||||
|
||||
except OSError:
|
||||
|
||||
print("Could not find the remote.")
|
||||
|
||||
# Here you can make your robot do something
|
||||
|
||||
@@ -7,7 +7,6 @@ sensor = ColorSensor(Port.A)
|
||||
|
||||
# Repeat forever.
|
||||
while True:
|
||||
|
||||
# Get the ambient color values. Instead of scanning the color of a surface,
|
||||
# this lets you scan the color of light sources like lamps or screens.
|
||||
hsv = sensor.hsv(surface=False)
|
||||
|
||||
@@ -7,7 +7,6 @@ sensor = ColorSensor(Port.A)
|
||||
|
||||
# Repeat forever.
|
||||
while True:
|
||||
|
||||
# Turn on one light at a time, at half the brightness.
|
||||
# Do this for all 3 lights and repeat that 5 times.
|
||||
for i in range(5):
|
||||
|
||||
@@ -15,7 +15,6 @@ def wait_for_color(desired_color):
|
||||
|
||||
# Now we use the function we just created above.
|
||||
while True:
|
||||
|
||||
# Here you can make your train/vehicle go forward.
|
||||
|
||||
print("Waiting for red ...")
|
||||
|
||||
@@ -7,10 +7,8 @@ sensor = ColorDistanceSensor(Port.A)
|
||||
|
||||
# Repeat forever.
|
||||
while True:
|
||||
|
||||
# If the sensor sees an object nearby.
|
||||
if sensor.distance() <= 40:
|
||||
|
||||
# Then blink the light red/blue 5 times.
|
||||
for i in range(5):
|
||||
sensor.light.on(Color.RED)
|
||||
|
||||
@@ -15,7 +15,6 @@ def wait_for_color(desired_color):
|
||||
|
||||
# Now we use the function we just created above.
|
||||
while True:
|
||||
|
||||
# Here you can make your train/vehicle go forward.
|
||||
|
||||
print("Waiting for red ...")
|
||||
|
||||
+10
-20
@@ -13,23 +13,19 @@ from typing import Any, overload
|
||||
|
||||
|
||||
@overload
|
||||
def const(value: int) -> int:
|
||||
...
|
||||
def const(value: int) -> int: ...
|
||||
|
||||
|
||||
@overload
|
||||
def const(value: str) -> str:
|
||||
...
|
||||
def const(value: str) -> str: ...
|
||||
|
||||
|
||||
@overload
|
||||
def const(value: float) -> float:
|
||||
...
|
||||
def const(value: float) -> float: ...
|
||||
|
||||
|
||||
@overload
|
||||
def const(value: tuple) -> tuple:
|
||||
...
|
||||
def const(value: tuple) -> tuple: ...
|
||||
|
||||
|
||||
def const(value):
|
||||
@@ -54,13 +50,11 @@ def const(value):
|
||||
|
||||
|
||||
@overload
|
||||
def opt_level() -> int:
|
||||
...
|
||||
def opt_level() -> int: ...
|
||||
|
||||
|
||||
@overload
|
||||
def opt_level(level: int) -> None:
|
||||
...
|
||||
def opt_level(level: int) -> None: ...
|
||||
|
||||
|
||||
def opt_level(*args):
|
||||
@@ -90,13 +84,11 @@ def opt_level(*args):
|
||||
|
||||
|
||||
@overload
|
||||
def mem_info() -> None:
|
||||
...
|
||||
def mem_info() -> None: ...
|
||||
|
||||
|
||||
@overload
|
||||
def mem_info(verbose: Any) -> None:
|
||||
...
|
||||
def mem_info(verbose: Any) -> None: ...
|
||||
|
||||
|
||||
def mem_info(*args):
|
||||
@@ -113,13 +105,11 @@ def mem_info(*args):
|
||||
|
||||
|
||||
@overload
|
||||
def qstr_info() -> None:
|
||||
...
|
||||
def qstr_info() -> None: ...
|
||||
|
||||
|
||||
@overload
|
||||
def qstr_info(verbose: Any) -> None:
|
||||
...
|
||||
def qstr_info(verbose: Any) -> None: ...
|
||||
|
||||
|
||||
def qstr_info(*args):
|
||||
|
||||
@@ -1032,7 +1032,6 @@ class SimpleAccelerometer:
|
||||
|
||||
|
||||
class IMU:
|
||||
|
||||
def up(self, calibrated: bool = True) -> Side:
|
||||
"""up(calibrated=True) -> Side
|
||||
|
||||
|
||||
@@ -20,14 +20,12 @@ class Image:
|
||||
# is generated.
|
||||
|
||||
@overload
|
||||
def __init__(self, /, source: Union[Image, ImageFile, str]):
|
||||
...
|
||||
def __init__(self, /, source: Union[Image, ImageFile, str]): ...
|
||||
|
||||
@overload
|
||||
def __init__(
|
||||
self, /, source: Image, sub: Literal[False], x1: int, y1: int, x2: int, y2: int
|
||||
):
|
||||
...
|
||||
): ...
|
||||
|
||||
def __init__(self, *args):
|
||||
"""Image(source, sub=False)
|
||||
|
||||
@@ -103,7 +103,9 @@ class BLERadio:
|
||||
``int``, ``float``, ``str``, or ``bytes``.
|
||||
"""
|
||||
|
||||
def observe(self, channel: int) -> Optional[
|
||||
def observe(
|
||||
self, channel: int
|
||||
) -> Optional[
|
||||
Union[
|
||||
Tuple[Union[bool, int, float, str, bytes], ...],
|
||||
Union[bool, int, float, str, bytes],
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
"""Use LEGO® MINDSTORMS® NXT motors and sensors with the EV3 brick."""
|
||||
|
||||
|
||||
from .parameters import Port
|
||||
|
||||
from ._common import ColorLight, CommonColorSensor
|
||||
|
||||
+85
-162
@@ -139,12 +139,10 @@ def bin(x: Any) -> _str:
|
||||
|
||||
class bool:
|
||||
@overload
|
||||
def __init__(self) -> None:
|
||||
...
|
||||
def __init__(self) -> None: ...
|
||||
|
||||
@overload
|
||||
def __init__(self, x: Any) -> None:
|
||||
...
|
||||
def __init__(self, x: Any) -> None: ...
|
||||
|
||||
def __init__(self, *args) -> None:
|
||||
"""
|
||||
@@ -166,20 +164,16 @@ class bool:
|
||||
|
||||
class bytes:
|
||||
@overload
|
||||
def __init__(self) -> None:
|
||||
...
|
||||
def __init__(self) -> None: ...
|
||||
|
||||
@overload
|
||||
def __init__(self, source: _int) -> None:
|
||||
...
|
||||
def __init__(self, source: _int) -> None: ...
|
||||
|
||||
@overload
|
||||
def __init__(self, source: Union[_bytes, _bytearray, Iterable[_int]]) -> None:
|
||||
...
|
||||
def __init__(self, source: Union[_bytes, _bytearray, Iterable[_int]]) -> None: ...
|
||||
|
||||
@overload
|
||||
def __init__(self, source: _str, encoding: _str) -> None:
|
||||
...
|
||||
def __init__(self, source: _str, encoding: _str) -> None: ...
|
||||
|
||||
def __init__(self, *args):
|
||||
r"""
|
||||
@@ -209,16 +203,15 @@ class bytes:
|
||||
|
||||
class bytearray:
|
||||
@overload
|
||||
def __init__(self) -> None:
|
||||
...
|
||||
def __init__(self) -> None: ...
|
||||
|
||||
@overload
|
||||
def __init__(self, source: _int) -> None:
|
||||
...
|
||||
def __init__(self, source: _int) -> None: ...
|
||||
|
||||
@overload
|
||||
def __init__(self, source: Union[_bytes, _bytearray, _str, Iterable[_int]]) -> None:
|
||||
...
|
||||
def __init__(
|
||||
self, source: Union[_bytes, _bytearray, _str, Iterable[_int]]
|
||||
) -> None: ...
|
||||
|
||||
def __init__(self, *args):
|
||||
r"""
|
||||
@@ -281,26 +274,22 @@ def classmethod(method: _callable) -> _callable:
|
||||
|
||||
class complex:
|
||||
@overload
|
||||
def __init__(self) -> None:
|
||||
...
|
||||
def __init__(self) -> None: ...
|
||||
|
||||
@overload
|
||||
def __init__(
|
||||
self, real: Union[_float, SupportsFloat, _complex, SupportsComplex]
|
||||
) -> None:
|
||||
...
|
||||
) -> None: ...
|
||||
|
||||
@overload
|
||||
def __init__(
|
||||
self,
|
||||
real: Union[_float, SupportsFloat, _complex, SupportsComplex],
|
||||
imag: Union[_float, SupportsFloat, _complex, SupportsComplex],
|
||||
) -> None:
|
||||
...
|
||||
) -> None: ...
|
||||
|
||||
@overload
|
||||
def __init__(self, value: _str) -> None:
|
||||
...
|
||||
def __init__(self, value: _str) -> None: ...
|
||||
|
||||
def __init__(self, *args) -> None:
|
||||
"""
|
||||
@@ -325,12 +314,10 @@ class complex:
|
||||
|
||||
class dict:
|
||||
@overload
|
||||
def __init(self) -> None:
|
||||
...
|
||||
def __init(self) -> None: ...
|
||||
|
||||
@overload
|
||||
def __init(self, **kwargs) -> None:
|
||||
...
|
||||
def __init(self, **kwargs) -> None: ...
|
||||
|
||||
def __init__(self, *args, **kwargs) -> None:
|
||||
"""
|
||||
@@ -348,13 +335,11 @@ class dict:
|
||||
|
||||
|
||||
@overload
|
||||
def dir() -> List[_str]:
|
||||
...
|
||||
def dir() -> List[_str]: ...
|
||||
|
||||
|
||||
@overload
|
||||
def dir(object: Any) -> List[_str]:
|
||||
...
|
||||
def dir(object: Any) -> List[_str]: ...
|
||||
|
||||
|
||||
def dir(*args) -> List[_str]:
|
||||
@@ -376,13 +361,11 @@ def dir(*args) -> List[_str]:
|
||||
|
||||
|
||||
@overload
|
||||
def divmod(a: _int, b: _int) -> Tuple[_int, _int]:
|
||||
...
|
||||
def divmod(a: _int, b: _int) -> Tuple[_int, _int]: ...
|
||||
|
||||
|
||||
@overload
|
||||
def divmod(a: _float, b: _float) -> Tuple[_float, _float]:
|
||||
...
|
||||
def divmod(a: _float, b: _float) -> Tuple[_float, _float]: ...
|
||||
|
||||
|
||||
def divmod(a, b):
|
||||
@@ -407,12 +390,10 @@ def divmod(a, b):
|
||||
|
||||
class enumerate:
|
||||
@overload
|
||||
def __init__(self, iterable: Iterable) -> None:
|
||||
...
|
||||
def __init__(self, iterable: Iterable) -> None: ...
|
||||
|
||||
@overload
|
||||
def __init__(self, iterable: Iterable, start: _int) -> None:
|
||||
...
|
||||
def __init__(self, iterable: Iterable, start: _int) -> None: ...
|
||||
|
||||
def __init__(self, *args) -> None:
|
||||
"""
|
||||
@@ -431,18 +412,15 @@ class enumerate:
|
||||
|
||||
|
||||
@overload
|
||||
def eval(expression: _str) -> Any:
|
||||
...
|
||||
def eval(expression: _str) -> Any: ...
|
||||
|
||||
|
||||
@overload
|
||||
def eval(expression: _str, globals: _dict) -> Any:
|
||||
...
|
||||
def eval(expression: _str, globals: _dict) -> Any: ...
|
||||
|
||||
|
||||
@overload
|
||||
def eval(expression: _str, globals: _dict, locals: Mapping) -> Any:
|
||||
...
|
||||
def eval(expression: _str, globals: _dict, locals: Mapping) -> Any: ...
|
||||
|
||||
|
||||
def eval(*args):
|
||||
@@ -468,18 +446,15 @@ def eval(*args):
|
||||
|
||||
|
||||
@overload
|
||||
def exec(object: Any) -> None:
|
||||
...
|
||||
def exec(object: Any) -> None: ...
|
||||
|
||||
|
||||
@overload
|
||||
def exec(object: Any, globals: _dict) -> None:
|
||||
...
|
||||
def exec(object: Any, globals: _dict) -> None: ...
|
||||
|
||||
|
||||
@overload
|
||||
def exec(object: Any, globals: _dict, locals: Mapping) -> None:
|
||||
...
|
||||
def exec(object: Any, globals: _dict, locals: Mapping) -> None: ...
|
||||
|
||||
|
||||
def exec(*args):
|
||||
@@ -503,20 +478,16 @@ def exec(*args):
|
||||
|
||||
class float:
|
||||
@overload
|
||||
def __init__(self) -> None:
|
||||
...
|
||||
def __init__(self) -> None: ...
|
||||
|
||||
@overload
|
||||
def __init__(self, x: _int) -> None:
|
||||
...
|
||||
def __init__(self, x: _int) -> None: ...
|
||||
|
||||
@overload
|
||||
def __init__(self, x: SupportsFloat) -> None:
|
||||
...
|
||||
def __init__(self, x: SupportsFloat) -> None: ...
|
||||
|
||||
@overload
|
||||
def __init__(self, x: _str) -> None:
|
||||
...
|
||||
def __init__(self, x: _str) -> None: ...
|
||||
|
||||
def __init__(self, *args) -> None:
|
||||
"""float(x=0.0)
|
||||
@@ -529,13 +500,11 @@ class float:
|
||||
|
||||
|
||||
@overload
|
||||
def getattr(object: Any, name: _str) -> Any:
|
||||
...
|
||||
def getattr(object: Any, name: _str) -> Any: ...
|
||||
|
||||
|
||||
@overload
|
||||
def getattr(object: Any, name: _str, default: Any) -> Any:
|
||||
...
|
||||
def getattr(object: Any, name: _str, default: Any) -> Any: ...
|
||||
|
||||
|
||||
def getattr(*args):
|
||||
@@ -596,13 +565,11 @@ def hash(object: Any) -> _int:
|
||||
|
||||
|
||||
@overload
|
||||
def help() -> None:
|
||||
...
|
||||
def help() -> None: ...
|
||||
|
||||
|
||||
@overload
|
||||
def help(object: Any) -> None:
|
||||
...
|
||||
def help(object: Any) -> None: ...
|
||||
|
||||
|
||||
def help(*args) -> None:
|
||||
@@ -651,13 +618,11 @@ def id(object: Any) -> _int:
|
||||
|
||||
|
||||
@overload
|
||||
def input() -> _str:
|
||||
...
|
||||
def input() -> _str: ...
|
||||
|
||||
|
||||
@overload
|
||||
def input(prompt: _str) -> _str:
|
||||
...
|
||||
def input(prompt: _str) -> _str: ...
|
||||
|
||||
|
||||
def input(*args) -> _str:
|
||||
@@ -678,20 +643,16 @@ def input(*args) -> _str:
|
||||
|
||||
class int:
|
||||
@overload
|
||||
def __init__(self) -> None:
|
||||
...
|
||||
def __init__(self) -> None: ...
|
||||
|
||||
@overload
|
||||
def __init__(self, x: _str) -> None:
|
||||
...
|
||||
def __init__(self, x: _str) -> None: ...
|
||||
|
||||
@overload
|
||||
def __init__(self, x: _str, base: _int) -> None:
|
||||
...
|
||||
def __init__(self, x: _str, base: _int) -> None: ...
|
||||
|
||||
@overload
|
||||
def __init__(self, x: Union[_int, SupportsInt]) -> None:
|
||||
...
|
||||
def __init__(self, x: Union[_int, SupportsInt]) -> None: ...
|
||||
|
||||
def __init__(self, *args) -> None:
|
||||
"""int(x=0)
|
||||
@@ -796,12 +757,10 @@ def len(s: Sequence) -> _int:
|
||||
|
||||
class list:
|
||||
@overload
|
||||
def __init__(self) -> None:
|
||||
...
|
||||
def __init__(self) -> None: ...
|
||||
|
||||
@overload
|
||||
def __init__(self, iterable: Iterable) -> None:
|
||||
...
|
||||
def __init__(self, iterable: Iterable) -> None: ...
|
||||
|
||||
def __init__(self, *args) -> None:
|
||||
"""
|
||||
@@ -852,13 +811,11 @@ def map(function: Callable, iterable: Iterable, *args: Any) -> Iterator:
|
||||
|
||||
|
||||
@overload
|
||||
def max(iterable: Iterable) -> Any:
|
||||
...
|
||||
def max(iterable: Iterable) -> Any: ...
|
||||
|
||||
|
||||
@overload
|
||||
def max(arg1: Any, arg2: Any, *args: Any) -> Any:
|
||||
...
|
||||
def max(arg1: Any, arg2: Any, *args: Any) -> Any: ...
|
||||
|
||||
|
||||
def max(*args):
|
||||
@@ -876,13 +833,11 @@ def max(*args):
|
||||
|
||||
|
||||
@overload
|
||||
def min(iterable: Iterable) -> Any:
|
||||
...
|
||||
def min(iterable: Iterable) -> Any: ...
|
||||
|
||||
|
||||
@overload
|
||||
def min(arg1: Any, arg2: Any, *args: Any) -> Any:
|
||||
...
|
||||
def min(arg1: Any, arg2: Any, *args: Any) -> Any: ...
|
||||
|
||||
|
||||
def min(*args):
|
||||
@@ -971,13 +926,13 @@ def pow(base: Union[_int, _float], exp: Union[_int, _float]) -> Union[_int, _flo
|
||||
|
||||
|
||||
@overload
|
||||
def print(*objects):
|
||||
...
|
||||
def print(*objects): ...
|
||||
|
||||
|
||||
@overload
|
||||
def print(*objects, sep: _str = " ", end: _str = "\n", file: uio.FileIO = usys.stdin):
|
||||
...
|
||||
def print(
|
||||
*objects, sep: _str = " ", end: _str = "\n", file: uio.FileIO = usys.stdin
|
||||
): ...
|
||||
|
||||
|
||||
def print(*args):
|
||||
@@ -999,16 +954,13 @@ def print(*args):
|
||||
|
||||
class range:
|
||||
@overload
|
||||
def __init__(self, stop: _int) -> None:
|
||||
...
|
||||
def __init__(self, stop: _int) -> None: ...
|
||||
|
||||
@overload
|
||||
def __init__(self, start: _int, stop: _int) -> None:
|
||||
...
|
||||
def __init__(self, start: _int, stop: _int) -> None: ...
|
||||
|
||||
@overload
|
||||
def __init__(self, start: _int, stop: _int, step: _int) -> None:
|
||||
...
|
||||
def __init__(self, start: _int, stop: _int, step: _int) -> None: ...
|
||||
|
||||
def __init__(self, *args) -> None:
|
||||
"""
|
||||
@@ -1056,13 +1008,11 @@ def reversed(seq: Sequence) -> Iterator:
|
||||
|
||||
|
||||
@overload
|
||||
def round(number: _float) -> _int:
|
||||
...
|
||||
def round(number: _float) -> _int: ...
|
||||
|
||||
|
||||
@overload
|
||||
def round(number: _float, ndigits: _int) -> _float:
|
||||
...
|
||||
def round(number: _float, ndigits: _int) -> _float: ...
|
||||
|
||||
|
||||
def round(*args):
|
||||
@@ -1090,12 +1040,10 @@ def round(*args):
|
||||
|
||||
class set:
|
||||
@overload
|
||||
def __init__(self) -> None:
|
||||
...
|
||||
def __init__(self) -> None: ...
|
||||
|
||||
@overload
|
||||
def __init__(self, iterable: Iterable[Hashable]) -> None:
|
||||
...
|
||||
def __init__(self, iterable: Iterable[Hashable]) -> None: ...
|
||||
|
||||
def __init__(self, *args) -> None:
|
||||
"""
|
||||
@@ -1249,44 +1197,31 @@ class set:
|
||||
A new set.
|
||||
"""
|
||||
|
||||
def __contains__(self, item: Hashable) -> bool:
|
||||
...
|
||||
def __contains__(self, item: Hashable) -> bool: ...
|
||||
|
||||
def __len__(self) -> int:
|
||||
...
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
def __bool__(self) -> bool:
|
||||
...
|
||||
def __bool__(self) -> bool: ...
|
||||
|
||||
def __gt__(self, other: set) -> bool:
|
||||
...
|
||||
def __gt__(self, other: set) -> bool: ...
|
||||
|
||||
def __lt__(self, other: set) -> bool:
|
||||
...
|
||||
def __lt__(self, other: set) -> bool: ...
|
||||
|
||||
def __ge__(self, other: set) -> bool:
|
||||
...
|
||||
def __ge__(self, other: set) -> bool: ...
|
||||
|
||||
def __le__(self, other: set) -> bool:
|
||||
...
|
||||
def __le__(self, other: set) -> bool: ...
|
||||
|
||||
def __eq__(self, other: set) -> bool:
|
||||
...
|
||||
def __eq__(self, other: set) -> bool: ...
|
||||
|
||||
def __ne__(self, other: set) -> bool:
|
||||
...
|
||||
def __ne__(self, other: set) -> bool: ...
|
||||
|
||||
def __sub__(self: _Self, other: set) -> _Self:
|
||||
...
|
||||
def __sub__(self: _Self, other: set) -> _Self: ...
|
||||
|
||||
def __and__(self: _Self, other: set) -> _Self:
|
||||
...
|
||||
def __and__(self: _Self, other: set) -> _Self: ...
|
||||
|
||||
def __or__(self: _Self, other: set) -> _Self:
|
||||
...
|
||||
def __or__(self: _Self, other: set) -> _Self: ...
|
||||
|
||||
def __xor__(self: _Self, other: set) -> _Self:
|
||||
...
|
||||
def __xor__(self: _Self, other: set) -> _Self: ...
|
||||
|
||||
|
||||
def setattr(object: Any, name: _str, value: Any) -> None:
|
||||
@@ -1306,16 +1241,13 @@ def setattr(object: Any, name: _str, value: Any) -> None:
|
||||
|
||||
class slice:
|
||||
@overload
|
||||
def __init__(self, stop: _int) -> None:
|
||||
...
|
||||
def __init__(self, stop: _int) -> None: ...
|
||||
|
||||
@overload
|
||||
def __init__(self, start: _int, stop: _int) -> None:
|
||||
...
|
||||
def __init__(self, start: _int, stop: _int) -> None: ...
|
||||
|
||||
@overload
|
||||
def __init__(self, start: _int, stop: _int, step: _int) -> None:
|
||||
...
|
||||
def __init__(self, start: _int, stop: _int, step: _int) -> None: ...
|
||||
|
||||
def __init__(self, *args) -> None:
|
||||
"""
|
||||
@@ -1355,14 +1287,12 @@ def staticmethod(method: _callable) -> _callable:
|
||||
|
||||
class str:
|
||||
@overload
|
||||
def __init__(self, object: Any = "") -> None:
|
||||
...
|
||||
def __init__(self, object: Any = "") -> None: ...
|
||||
|
||||
@overload
|
||||
def __init__(
|
||||
self, object: _bytes = b"", encoding: _str = "utf-8", errors: _str = "strict"
|
||||
) -> None:
|
||||
...
|
||||
) -> None: ...
|
||||
|
||||
def __init__(self) -> None:
|
||||
"""
|
||||
@@ -1384,13 +1314,11 @@ class str:
|
||||
|
||||
|
||||
@overload
|
||||
def sum(iterable: Iterable) -> _int:
|
||||
...
|
||||
def sum(iterable: Iterable) -> _int: ...
|
||||
|
||||
|
||||
@overload
|
||||
def sum(iterable: Iterable, start: _int) -> _int:
|
||||
...
|
||||
def sum(iterable: Iterable, start: _int) -> _int: ...
|
||||
|
||||
|
||||
def sum(*args):
|
||||
@@ -1410,18 +1338,15 @@ def sum(*args):
|
||||
|
||||
|
||||
@overload
|
||||
def super() -> _type:
|
||||
...
|
||||
def super() -> _type: ...
|
||||
|
||||
|
||||
@overload
|
||||
def super(type: _type) -> _type:
|
||||
...
|
||||
def super(type: _type) -> _type: ...
|
||||
|
||||
|
||||
@overload
|
||||
def super(type: _type, object_or_type: Any) -> _type:
|
||||
...
|
||||
def super(type: _type, object_or_type: Any) -> _type: ...
|
||||
|
||||
|
||||
def super(*args):
|
||||
@@ -1440,12 +1365,10 @@ def super(*args):
|
||||
|
||||
class tuple:
|
||||
@overload
|
||||
def __init__(self):
|
||||
...
|
||||
def __init__(self): ...
|
||||
|
||||
@overload
|
||||
def __init__(self, iterable: Iterable):
|
||||
...
|
||||
def __init__(self, iterable: Iterable): ...
|
||||
|
||||
def __init__(self, *args) -> None:
|
||||
"""
|
||||
|
||||
+6
-12
@@ -20,16 +20,13 @@ from typing import overload, Union
|
||||
|
||||
class BytesIO:
|
||||
@overload
|
||||
def __init__(self) -> None:
|
||||
...
|
||||
def __init__(self) -> None: ...
|
||||
|
||||
@overload
|
||||
def __init__(self, data: Union[bytes, bytearray]) -> None:
|
||||
...
|
||||
def __init__(self, data: Union[bytes, bytearray]) -> None: ...
|
||||
|
||||
@overload
|
||||
def __init__(self, alloc_size: int) -> None:
|
||||
...
|
||||
def __init__(self, alloc_size: int) -> None: ...
|
||||
|
||||
def __init__(self, *args) -> None:
|
||||
"""
|
||||
@@ -57,16 +54,13 @@ class BytesIO:
|
||||
|
||||
class StringIO:
|
||||
@overload
|
||||
def __init__(self) -> None:
|
||||
...
|
||||
def __init__(self) -> None: ...
|
||||
|
||||
@overload
|
||||
def __init__(self, string: str) -> None:
|
||||
...
|
||||
def __init__(self, string: str) -> None: ...
|
||||
|
||||
@overload
|
||||
def __init__(self, alloc_size: int) -> None:
|
||||
...
|
||||
def __init__(self, alloc_size: int) -> None: ...
|
||||
|
||||
def __init__(self, *args) -> None:
|
||||
"""
|
||||
|
||||
@@ -31,18 +31,15 @@ def seed(a: Optional[int] = None) -> None:
|
||||
|
||||
|
||||
@overload
|
||||
def randrange(stop: int) -> int:
|
||||
...
|
||||
def randrange(stop: int) -> int: ...
|
||||
|
||||
|
||||
@overload
|
||||
def randrange(start: int, stop: int) -> int:
|
||||
...
|
||||
def randrange(start: int, stop: int) -> int: ...
|
||||
|
||||
|
||||
@overload
|
||||
def randrange(start: int, stop: int, step: int) -> int:
|
||||
...
|
||||
def randrange(start: int, stop: int, step: int) -> int: ...
|
||||
|
||||
|
||||
def randrange(start, stop, step):
|
||||
|
||||
+5
-10
@@ -78,12 +78,10 @@ class Poll:
|
||||
"""
|
||||
|
||||
@overload
|
||||
def poll(self) -> List[Tuple[IO, int]]:
|
||||
...
|
||||
def poll(self) -> List[Tuple[IO, int]]: ...
|
||||
|
||||
@overload
|
||||
def poll(self, timeout: int) -> List[Tuple[IO, int]]:
|
||||
...
|
||||
def poll(self, timeout: int) -> List[Tuple[IO, int]]: ...
|
||||
|
||||
def poll(self, timeout: int = -1, /) -> List[Tuple[IO, int]]:
|
||||
"""
|
||||
@@ -105,16 +103,13 @@ class Poll:
|
||||
"""
|
||||
|
||||
@overload
|
||||
def ipoll(self) -> Iterator[Tuple[IO, int]]:
|
||||
...
|
||||
def ipoll(self) -> Iterator[Tuple[IO, int]]: ...
|
||||
|
||||
@overload
|
||||
def ipoll(self, timeout: int) -> Iterator[Tuple[IO, int]]:
|
||||
...
|
||||
def ipoll(self, timeout: int) -> Iterator[Tuple[IO, int]]: ...
|
||||
|
||||
@overload
|
||||
def ipoll(self, timeout: int, flags: int) -> Iterator[Tuple[IO, int]]:
|
||||
...
|
||||
def ipoll(self, timeout: int, flags: int) -> Iterator[Tuple[IO, int]]: ...
|
||||
|
||||
def ipoll(self, timeout: int = -1, flags: int = 0, /) -> Iterator[Tuple[IO, int]]:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user