Re-write a few un-Pythonic lines
Closed this issue · 2 comments
-
self.__dict__.get(attr)
sample-sheet/sample_sheet/_sample_sheet.py
Line 259 in 87deb18
- There must be a better way to change a class name without needing useless inheritance
sample-sheet/sample_sheet/_sample_sheet.py
Lines 320 to 325 in 87deb18
-
return None if len(self.Reads) == 0 else len(self.Reads) == 1
sample-sheet/sample_sheet/_sample_sheet.py
Lines 437 to 439 in 87deb18
-
VALID_ASCII = {string.ascii_letters + string.digits + '-_'}
sample-sheet/sample_sheet/_sample_sheet.py
Lines 31 to 36 in 87deb18
A few suggestions/remarks:
self.__dict__.get(attr)
you can use collections.defaultdict(lambda: None)
to achieve the same behavior as self.get(attr, None)
. But after looking to the code, I'm not sure why you need to overload __dict__
.
change a class name
seems that you don't need that at all, just use
self.header = SampleSheetSection()
in SampleSheet
's __init__
None if len(self.Reads) == 0
return None if not self.Reads else len(self.Reads) == 1
will do, as bool(iterable)
will return False
only if the iterable is empty.