Be more careful looking up keys when the fastqname is uninitialized.
authorDiane Trout <diane@ghic.org>
Mon, 6 Apr 2015 20:50:36 +0000 (13:50 -0700)
committerDiane Trout <diane@ghic.org>
Mon, 6 Apr 2015 20:50:36 +0000 (13:50 -0700)
By removing the default return of None from getitem, the is_valid test
failed when the object was uninitialized.

htsworkflow/submission/fastqname.py

index 7f74f2215c87b87de54ad4db2ad23b0b7cda34b6..b3d232b64125a1e5a35f965f7202c852dc64cfb1 100644 (file)
@@ -61,7 +61,7 @@ class FastqName(collections.Mapping):
             elif k == 'compression_extension':
                 if self[k] not in (None, '', '.gz', '.bz2'):
                     return False
-            elif self[k] is None:
+            elif getattr(self, k, None) is None:
                 return False
         return True
     is_valid = property(_is_valid)