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