Skip to content
Snippets Groups Projects
Commit feaa82b4 authored by Adam Paquette's avatar Adam Paquette
Browse files

Updated some python documentation

parent 24887420
No related branches found
No related tags found
No related merge requests found
......@@ -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:
......
......@@ -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):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment