2 `adafruit_blinka` - Runtime utility objects for re-implementation of CircuitPython API
 
   3 ======================================================================================
 
  11     Object supporting CircuitPython-style of static symbols
 
  12     as seen with Direction.OUTPUT, Pull.UP
 
  17         Assumes instance will be found as attribute of own class.
 
  18         Returns dot-subscripted path to instance
 
  19         (assuming absolute import of containing package)
 
  23             if getattr(cls, key) is self:
 
  24                 return "{}.{}.{}".format(cls.__module__, cls.__qualname__, key)
 
  30         Inspects attributes of the class for instances of the class
 
  31         and returns as key,value pairs mirroring dict#iteritems
 
  34             val = getattr(cls, key)
 
  35             if isinstance(cls, val):
 
  40     """An object that automatically deinitializes hardware with a context manager."""
 
  45     def __exit__(self, exc_type, exc_value, traceback):
 
  48     # pylint: disable=no-self-use
 
  50         """Free any hardware used by the object."""
 
  53     # pylint: enable=no-self-use
 
  56 class Lockable(ContextManaged):
 
  57     """An object that must be locked to prevent collisions on a microcontroller resource."""
 
  62         """Attempt to grab the lock. Return True on success, False if the lock is already taken."""
 
  69         """Release the lock so others may use the resource."""
 
  73             raise ValueError("Not locked")
 
  77     """Patch modules that may be different due to the platform."""
 
  78     # pylint: disable=import-outside-toplevel
 
  80     from adafruit_blinka.agnostic import time
 
  82     # pylint: enable=import-outside-toplevel
 
  84     sys.modules["time"] = time