Skip to content

Commit

Permalink
Warn about moved sensors classes
Browse files Browse the repository at this point in the history
  • Loading branch information
auscompgeek committed Feb 11, 2023
1 parent 24cf66c commit b813e3e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion ctre/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,17 @@

from .version import version as __version__


# backwards compat
# TODO: remove in 2024
from .sensors import *
def __getattr__(name):
from . import sensors

if name in sensors.__all__:
import warnings

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 b813e3e

Please sign in to comment.