An error message that didn't make much sense contextually would be raised:
Traceback (most recent call last):
File ".../site-packages/wpilib/_impl/start.py", line 75, in start
return self._start(robot_cls)
File ".../site-packages/wpilib/_impl/start.py", line 163, in _start
self.robot.startCompetition()
File ".../site-packages/magicbot/magicrobot.py", line 361, in startCompetition
self.robotInit()
File ".../site-packages/magicbot/magicrobot.py", line 110, in robotInit
self._create_components()
File ".../site-packages/magicbot/magicrobot.py", line 616, in _create_components
component = self._create_component(m, ctyp, injectables)
File ".../site-packages/magicbot/magicrobot.py", line 683, in _create_component
requests = get_injection_requests(type_hints, name)
File ".../site-packages/magicbot/inject.py", line 42, in get_injection_requests
raise TypeError(
TypeError: Component component1 has a non-type annotation foo: 1
Lone non-injection variable annotations are disallowed, did you want to assign a static variable?
This removes the bit about static variables when injecting into the __init__ method.
Whilst we're here, also split that bit into two sentences to make it easier to read.
Given the following component class:
An error message that didn't make much sense contextually would be raised:
This removes the bit about static variables when injecting into the
__init__
method.Whilst we're here, also split that bit into two sentences to make it easier to read.