sr-robot3 2026.0.1__tar.gz → 2026.0.2__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 (69) hide show
  1. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/PKG-INFO +1 -1
  2. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/sr/robot3/_version.py +3 -3
  3. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/sr/robot3/robot.py +7 -4
  4. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/sr/robot3/utils.py +13 -1
  5. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/sr_robot3.egg-info/PKG-INFO +1 -1
  6. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/tests/test_sr_robot.py +6 -0
  7. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/.flake8 +0 -0
  8. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/.github/dependabot.yml +0 -0
  9. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/.github/workflows/test_build.yml +0 -0
  10. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/.gitignore +0 -0
  11. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/LICENSE +0 -0
  12. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/Makefile +0 -0
  13. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/README.md +0 -0
  14. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/pyproject.toml +0 -0
  15. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/setup.cfg +0 -0
  16. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/sr/__init__.py +0 -0
  17. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/sr/robot3/__init__.py +0 -0
  18. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/sr/robot3/arduino.py +0 -0
  19. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/sr/robot3/astoria.py +0 -0
  20. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/sr/robot3/calibrations/__init__.py +0 -0
  21. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/sr/robot3/camera.py +0 -0
  22. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/sr/robot3/exceptions.py +0 -0
  23. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/sr/robot3/game_specific.py +0 -0
  24. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/sr/robot3/kch.py +0 -0
  25. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/sr/robot3/logging.py +0 -0
  26. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/sr/robot3/marker.py +0 -0
  27. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/sr/robot3/motor_board.py +0 -0
  28. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/sr/robot3/mqtt.py +0 -0
  29. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/sr/robot3/power_board.py +0 -0
  30. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/sr/robot3/py.typed +0 -0
  31. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/sr/robot3/raw_serial.py +0 -0
  32. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/sr/robot3/serial_wrapper.py +0 -0
  33. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/sr/robot3/servo_board.py +0 -0
  34. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/sr/robot3/simulator/__init__.py +0 -0
  35. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/sr/robot3/simulator/camera.py +0 -0
  36. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/sr/robot3/simulator/time_server.py +0 -0
  37. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/sr/robot3/timeout.py +0 -0
  38. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/sr_robot3.egg-info/SOURCES.txt +0 -0
  39. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/sr_robot3.egg-info/dependency_links.txt +0 -0
  40. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/sr_robot3.egg-info/requires.txt +0 -0
  41. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/sr_robot3.egg-info/top_level.txt +0 -0
  42. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/stubs/RPi/GPIO.pyi +0 -0
  43. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/stubs/RPi/__init__.pyi +0 -0
  44. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/tests/__init__.py +0 -0
  45. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/tests/conftest.py +0 -0
  46. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/tests/test_arduino.py +0 -0
  47. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/tests/test_data/bad/metadata.json +0 -0
  48. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/tests/test_data/empty/.gitkeep +0 -0
  49. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/tests/test_data/marker_detections.json +0 -0
  50. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/tests/test_data/marker_locations.csv +0 -0
  51. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/tests/test_data/missing_key/metadata.json +0 -0
  52. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/tests/test_data/nested/valid/metadata.json +0 -0
  53. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/tests/test_data/not_object/metadata.json +0 -0
  54. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/tests/test_data/timeout_scripts/catch-base-exception.py +0 -0
  55. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/tests/test_data/timeout_scripts/catch-exception.py +0 -0
  56. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/tests/test_data/timeout_scripts/hot-loop.py +0 -0
  57. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/tests/test_data/timeout_scripts/sleep.py +0 -0
  58. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/tests/test_data/timeout_scripts/try-finally.py +0 -0
  59. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/tests/test_data/timeout_scripts_extra/early-exit.py +0 -0
  60. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/tests/test_data/timeout_scripts_extra/exception.py +0 -0
  61. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/tests/test_data/valid/metadata.json +0 -0
  62. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/tests/test_logging.py +0 -0
  63. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/tests/test_markers.py +0 -0
  64. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/tests/test_motor_board.py +0 -0
  65. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/tests/test_power_board.py +0 -0
  66. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/tests/test_raw_serial.py +0 -0
  67. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/tests/test_serial_wrapper.py +0 -0
  68. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/tests/test_servo_board.py +0 -0
  69. {sr_robot3-2026.0.1 → sr_robot3-2026.0.2}/tests/test_timeout.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sr-robot3
3
- Version: 2026.0.1
3
+ Version: 2026.0.2
4
4
  Summary: Student Robotics API for Python 3
5
5
  Author-email: Student Robotics <kit-team@studentrobotics.org>
6
6
  License: MIT License
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
28
28
  commit_id: COMMIT_ID
29
29
  __commit_id__: COMMIT_ID
30
30
 
31
- __version__ = version = '2026.0.1'
32
- __version_tuple__ = version_tuple = (2026, 0, 1)
31
+ __version__ = version = '2026.0.2'
32
+ __version_tuple__ = version_tuple = (2026, 0, 2)
33
33
 
34
- __commit_id__ = commit_id = 'g21d493108'
34
+ __commit_id__ = commit_id = 'ge8189a502'
@@ -8,7 +8,7 @@ import time
8
8
  from pathlib import Path
9
9
  from socket import socket
10
10
  from types import MappingProxyType
11
- from typing import Mapping, Optional
11
+ from typing import Mapping, Optional, final
12
12
 
13
13
  from . import game_specific, timeout
14
14
  from ._version import __version__
@@ -23,12 +23,15 @@ from .power_board import Note, PowerBoard
23
23
  from .raw_serial import RawSerial
24
24
  from .servo_board import ServoBoard
25
25
  from .simulator.time_server import TimeServer
26
- from .utils import IN_SIMULATOR, ensure_atexit_on_term, obtain_lock, singular
26
+ from .utils import (
27
+ IN_SIMULATOR, FinalMeta, ensure_atexit_on_term, obtain_lock, singular,
28
+ )
27
29
 
28
30
  logger = logging.getLogger(__name__)
29
31
 
30
32
 
31
- class Robot:
33
+ @final
34
+ class Robot(metaclass=FinalMeta):
32
35
  """
33
36
  The main robot class that provides access to all the boards.
34
37
 
@@ -444,7 +447,7 @@ class Robot:
444
447
  self.power_board._run_led.flash()
445
448
  self.kch._flash_start()
446
449
 
447
- while not start_button_pressed() or remote_start_pressed():
450
+ while not (start_button_pressed() or remote_start_pressed()):
448
451
  self.sleep(0.1)
449
452
  logger.info("Start signal received; continuing.")
450
453
  if not self._no_powerboard:
@@ -7,7 +7,7 @@ import signal
7
7
  import socket
8
8
  from abc import ABC, abstractmethod
9
9
  from types import FrameType
10
- from typing import Any, Mapping, NamedTuple, Optional, TypeVar
10
+ from typing import Any, Mapping, NamedTuple, Optional, Type, TypeVar
11
11
 
12
12
  from serial.tools.list_ports import comports
13
13
  from serial.tools.list_ports_common import ListPortInfo
@@ -77,6 +77,18 @@ class Board(ABC):
77
77
  pass # pragma: no cover
78
78
 
79
79
 
80
+ class FinalMeta(type):
81
+ """
82
+ A meta class which ensures a given class cannot be subclassed.
83
+
84
+ It's recommended to additionally use typing.final.
85
+ """
86
+ def __new__(cls, name: str, bases: tuple, classdict: dict) -> Type:
87
+ if bases:
88
+ raise TypeError(f"{name} cannot be sub-classed.")
89
+ return super().__new__(cls, name, bases, dict(classdict))
90
+
91
+
80
92
  def map_to_int(
81
93
  x: float,
82
94
  in_min: float,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sr-robot3
3
- Version: 2026.0.1
3
+ Version: 2026.0.2
4
4
  Summary: Student Robotics API for Python 3
5
5
  Author-email: Student Robotics <kit-team@studentrobotics.org>
6
6
  License: MIT License
@@ -139,3 +139,9 @@ def test_robot_discovery() -> None:
139
139
  assert robot.power_board == robot.boards[power_asset_tag]
140
140
  assert robot.servo_board == robot.boards[servo_asset_tag]
141
141
  assert robot.motor_board == robot.boards[motor_asset_tag]
142
+
143
+
144
+ def test_cannot_subclass() -> None:
145
+ with pytest.raises(TypeError, match="Robot cannot be sub-classed"):
146
+ class MyRobot(Robot):
147
+ pass
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes