1. biolab
  2. Untitled project
  3. orange-bioinformatics

Commits

Aleš Erjavec  committed 1241665

Fixing errors in get and batch_get.

  • Participants
  • Parent commits 3a5221c
  • Branches default

Comments (0)

Files changed (1)

File obiKEGG2/databases.py

View file
  • Ignore whitespace
 #        return (self.__getitem__(key) for key in self.iterkeys())
     
     def get(self, key, default=None):
-        if key in self:
+        try:
             return self.__getitem__(key)
-        else:
+        except KeyError:
             return default
         
     def has_key(self, key):
             if batch_entries is not None:
                 batch_entries = batch_entries.split("///\n")
                 # Remove possible empty last line  
-                batch_entries = [e for e in batch_entries if e.strip()] 
+                batch_entries = [e for e in batch_entries if e.strip()]
                 entries.extend(map(self.ENTRY_TYPE, batch_entries))
             start += batch_size