Skip to content

Commit

Permalink
Try to fix recursion
Browse files Browse the repository at this point in the history
  • Loading branch information
auscompgeek committed Feb 11, 2023
1 parent b813e3e commit 7d62845
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions ctre/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,15 @@
# backwards compat
# TODO: remove in 2024
def __getattr__(name):
from . import sensors
if name != "sensors":
from .sensors import __all__

if name in sensors.__all__:
import warnings
if name in __all__:
import warnings
from . import sensors

message = f"{__name__}.{name} has moved to {__name__}.sensors"
warnings.warn(message, FutureWarning, stacklevel=2)
return getattr(sensors, name)
message = f"{__name__}.{name} has moved to {__name__}.sensors"
warnings.warn(message, FutureWarning, stacklevel=2)
return getattr(sensors, name)

raise AttributeError(f"module {__name__!r} has no attribute {name!r}")

0 comments on commit 7d62845

Please sign in to comment.