diff --git a/ale/drivers/__init__.py b/ale/drivers/__init__.py index 7f0056e8760e28b403b24646a3031f790bc94bed..d5f94b12912d999f4424cf0bce68f301f138cad9 100644 --- a/ale/drivers/__init__.py +++ b/ale/drivers/__init__.py @@ -21,7 +21,12 @@ drivers = dict(chain.from_iterable(inspect.getmembers(dmod, lambda x: inspect.is def load(label): """ - Load label from + Attempt to load a given label from all possible drivers + + Parameters + ---------- + label : str + String path to the given label file """ for name, driver in drivers.items(): try: diff --git a/ale/drivers/base.py b/ale/drivers/base.py index 57e8d3758dde10b0ad6e1598fba943b019b3fd09..3b8eb592a462f96be5a2c675552dc987cb281706 100644 --- a/ale/drivers/base.py +++ b/ale/drivers/base.py @@ -22,9 +22,25 @@ class Driver(): self._file = file def __str__(self): + """ + Returns a string representation of the class + + Returns + ------- + str + String representation of all attributes and methods of the class + """ return str(self.to_dict()) def is_valid(self): + """ + Checks if the driver has an intrument id associated with it + + Returns + ------- + bool + True if an instrument_id is defined, False otherwise + """ try: iid = self.instrument_id return True @@ -32,10 +48,18 @@ class Driver(): return False def to_dict(self): + """ + Generates a dictionary of keys based on the attributes and methods assocated with + the driver and the required keys for the driver + + Returns + ------- + dict + Dictionary of key, attribute pairs + """ keys = set(dir(self)) & self.required_keys return {p:getattr(self, p) for p in keys} - class LineScanner(Driver): @property def name_model(self):