pybricks 3.4.1__tar.gz → 3.5.0b2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. {pybricks-3.4.1 → pybricks-3.5.0b2}/PKG-INFO +1 -1
  2. {pybricks-3.4.1 → pybricks-3.5.0b2}/pyproject.toml +1 -1
  3. {pybricks-3.4.1 → pybricks-3.5.0b2}/src/pybricks/_common.py +2 -1
  4. {pybricks-3.4.1 → pybricks-3.5.0b2}/src/pybricks/iodevices.py +48 -5
  5. {pybricks-3.4.1 → pybricks-3.5.0b2}/src/pybricks/pupdevices.py +6 -0
  6. {pybricks-3.4.1 → pybricks-3.5.0b2}/src/pybricks/tools.py +13 -4
  7. {pybricks-3.4.1 → pybricks-3.5.0b2}/AUTHORS.md +0 -0
  8. {pybricks-3.4.1 → pybricks-3.5.0b2}/LICENSE +0 -0
  9. {pybricks-3.4.1 → pybricks-3.5.0b2}/README.rst +0 -0
  10. {pybricks-3.4.1 → pybricks-3.5.0b2}/src/micropython/__init__.py +0 -0
  11. {pybricks-3.4.1 → pybricks-3.5.0b2}/src/micropython/py.typed +0 -0
  12. {pybricks-3.4.1 → pybricks-3.5.0b2}/src/pybricks/__init__.py +0 -0
  13. {pybricks-3.4.1 → pybricks-3.5.0b2}/src/pybricks/ev3dev/_speaker.py +0 -0
  14. {pybricks-3.4.1 → pybricks-3.5.0b2}/src/pybricks/ev3devices.py +0 -0
  15. {pybricks-3.4.1 → pybricks-3.5.0b2}/src/pybricks/hubs.py +0 -0
  16. {pybricks-3.4.1 → pybricks-3.5.0b2}/src/pybricks/media/__init__.py +0 -0
  17. {pybricks-3.4.1 → pybricks-3.5.0b2}/src/pybricks/media/ev3dev.py +0 -0
  18. {pybricks-3.4.1 → pybricks-3.5.0b2}/src/pybricks/media/py.typed +0 -0
  19. {pybricks-3.4.1 → pybricks-3.5.0b2}/src/pybricks/messaging.py +0 -0
  20. {pybricks-3.4.1 → pybricks-3.5.0b2}/src/pybricks/nxtdevices.py +0 -0
  21. {pybricks-3.4.1 → pybricks-3.5.0b2}/src/pybricks/parameters.py +0 -0
  22. {pybricks-3.4.1 → pybricks-3.5.0b2}/src/pybricks/py.typed +0 -0
  23. {pybricks-3.4.1 → pybricks-3.5.0b2}/src/pybricks/robotics.py +0 -0
  24. {pybricks-3.4.1 → pybricks-3.5.0b2}/src/uerrno/__init__.py +0 -0
  25. {pybricks-3.4.1 → pybricks-3.5.0b2}/src/uerrno/py.typed +0 -0
  26. {pybricks-3.4.1 → pybricks-3.5.0b2}/src/uio/__init__.py +0 -0
  27. {pybricks-3.4.1 → pybricks-3.5.0b2}/src/uio/py.typed +0 -0
  28. {pybricks-3.4.1 → pybricks-3.5.0b2}/src/ujson/__init__.py +0 -0
  29. {pybricks-3.4.1 → pybricks-3.5.0b2}/src/umath/__init__.py +0 -0
  30. {pybricks-3.4.1 → pybricks-3.5.0b2}/src/umath/py.typed +0 -0
  31. {pybricks-3.4.1 → pybricks-3.5.0b2}/src/urandom/__init__.py +0 -0
  32. {pybricks-3.4.1 → pybricks-3.5.0b2}/src/urandom/py.typed +0 -0
  33. {pybricks-3.4.1 → pybricks-3.5.0b2}/src/uselect/__init__.py +0 -0
  34. {pybricks-3.4.1 → pybricks-3.5.0b2}/src/uselect/py.typed +0 -0
  35. {pybricks-3.4.1 → pybricks-3.5.0b2}/src/ustruct/__init__.py +0 -0
  36. {pybricks-3.4.1 → pybricks-3.5.0b2}/src/usys/__init__.py +0 -0
  37. {pybricks-3.4.1 → pybricks-3.5.0b2}/src/usys/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pybricks
3
- Version: 3.4.1
3
+ Version: 3.5.0b2
4
4
  Summary: Documentation and user-API stubs for Pybricks MicroPython
5
5
  Home-page: https://pybricks.com
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "pybricks"
3
- version = "3.4.1"
3
+ version = "3.5.0b2"
4
4
  description = "Documentation and user-API stubs for Pybricks MicroPython"
5
5
  authors = ["The Pybricks Authors <team@pybricks.com>"]
6
6
  maintainers = ["Laurens Valk <laurens@pybricks.com>", "David Lechner <david@pybricks.com>" ]
@@ -60,7 +60,8 @@ class System:
60
60
  button (Button): A button such
61
61
  as :attr:`Button.CENTER <pybricks.parameters.Button.CENTER>`,
62
62
  or a tuple of multiple buttons. Choose ``None`` to disable the
63
- stop button altogether.
63
+ stop button altogether. If you do, you can still turn the hub
64
+ off by holding the center button for three seconds.
64
65
  """
65
66
 
66
67
  def shutdown(self) -> None:
@@ -12,6 +12,7 @@ from .parameters import Port as _Port
12
12
 
13
13
  if TYPE_CHECKING:
14
14
  from ._common import MaybeAwaitable, MaybeAwaitableTuple
15
+ from .parameters import Number
15
16
 
16
17
 
17
18
  class PUPDevice:
@@ -298,7 +299,7 @@ class LWP3Device:
298
299
  """
299
300
 
300
301
  @overload
301
- def name(self, name: str) -> None: ...
302
+ def name(self, name: str) -> MaybeAwaitable: ...
302
303
 
303
304
  @overload
304
305
  def name(self) -> str: ...
@@ -335,6 +336,12 @@ class LWP3Device:
335
336
  The raw binary message.
336
337
  """
337
338
 
339
+ def disconnect(self) -> MaybeAwaitable:
340
+ """disconnect()
341
+
342
+ Disconnects the remote LWP3Device from the hub.
343
+ """
344
+
338
345
 
339
346
  class XboxController:
340
347
  """Use the Microsoft® Xbox® controller as a sensor in your projects to
@@ -384,12 +391,17 @@ class XboxController:
384
391
  def dpad(self) -> int:
385
392
  """dpad() -> int
386
393
 
387
- Gets the direction-pad position. ``1`` is up, ``2`` is up-right,
388
- ``3`` is right, ``4`` is down-right, ``5`` is down, ``6`` is
389
- down-left, ``7`` is left, ``8`` is up-left, and ``0`` is not pressed.
394
+ Gets the direction-pad value. ``1`` is up, ``2`` is up-right, ``3``
395
+ is right, ``4`` is down-right, ``5`` is down, ``6`` is down-left,
396
+ ``7`` is left, ``8`` is up-left, and ``0`` is not pressed.
397
+
398
+ This is essentially the same as reading the state of the
399
+ ``Button.UP``, ``Button.RIGHT``, ``Button.DOWN``, and ``Button.LEFT``
400
+ buttons, but this method conveniently returns a number that indicates
401
+ a direction.
390
402
 
391
403
  Returns:
392
- Direction-pad position.
404
+ Direction-pad position, indicating a direction.
393
405
  """
394
406
 
395
407
  def profile(self) -> int:
@@ -402,8 +414,39 @@ class XboxController:
402
414
  Profile number.
403
415
  """
404
416
 
417
+ def rumble(
418
+ self,
419
+ power: Number | Tuple[Number, Number, Number, Number] = 100,
420
+ duration: int = 200,
421
+ count: int = 1,
422
+ delay: int = 100,
423
+ ) -> MaybeAwaitable:
424
+ """rumble(power=100, duration=200, count=1, delay=100)
425
+
426
+ Makes the builtin actuators rumble, creating force feedback.
427
+
428
+ If you give a single ``power`` value, the left and right main actuators
429
+ will both rumble with that power. For more fine-grained control, set
430
+ ``power`` as a tuple of four values, which control the left main
431
+ actuator, right main actuator, left trigger actuator, and the right
432
+ trigger actuator, respectively. For example, ``power=(0, 0, 100, 0)``
433
+ makes the left trigger rumble at full power.
434
+
435
+ The rumble runs in the background while your program continues. To
436
+ make your program wait, just pause the program for a matching duration.
437
+ For one rumble, this equals ``duration``. For multiple rumbles, this
438
+ equals ``count * (duration + delay)``.
439
+
440
+ Arguments:
441
+ power (Number, % or tuple): Rumble power.
442
+ duration (Number, ms): Rumble duration.
443
+ count (int): Rumble count.
444
+ delay (Number, ms): Delay before each rumble. Only if ``count > 1``.
445
+ """
446
+
405
447
 
406
448
  # hide from jedi
407
449
  if TYPE_CHECKING:
408
450
  del MaybeAwaitable
409
451
  del MaybeAwaitableTuple
452
+ del Number
@@ -143,6 +143,12 @@ class Remote:
143
143
  this method returns the current name.
144
144
  """
145
145
 
146
+ def disconnect(self) -> MaybeAwaitable:
147
+ """disconnect()
148
+
149
+ Disconnects the remote from the hub.
150
+ """
151
+
146
152
 
147
153
  class TiltSensor:
148
154
  """LEGO® Powered Up Tilt Sensor."""
@@ -211,14 +211,23 @@ def cross(a: Matrix, b: Matrix) -> Matrix:
211
211
  """
212
212
 
213
213
 
214
- def read_input_byte() -> Optional[int]:
214
+ def read_input_byte(last: bool = False, chr: bool = False) -> Optional[int | str]:
215
215
  """
216
- read_input_byte() -> int | None
216
+ read_input_byte() -> int | str | None
217
217
 
218
- Reads one byte from standard input without blocking.
218
+ Reads one byte from standard input without blocking and removes it from the
219
+ input buffer.
220
+
221
+ Arguments:
222
+ last (bool): Choose ``True`` to read the last (most recent) byte in the buffer and discard the rest.
223
+ Choose ``False`` to read only the first (oldest) byte.
224
+ chr (bool): Choose ``True`` to convert the result to a one-character string.
219
225
 
220
226
  Returns:
221
- The numeric value of the byte read or ``None`` if no data is available.
227
+ The byte that was read, as a numeric value (``0`` to ``255``) or
228
+ string (e.g. ``"B"``). Returns ``None`` if no data is available. If
229
+ ``chr=True``, it also return ``None`` if the byte that was read is not
230
+ printable as a character.
222
231
  """
223
232
 
224
233
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes