Changeset 1682:2e2c671e4300 in orange-bioinformatics for _bioinformatics/obiKEGG.py


Ignore:
Timestamp:
06/12/12 11:15:18 (22 months ago)
Author:
Lan Zagar <lan.zagar@…>
Branch:
default
Message:

Replaced split(\n) with splitlines (closes #1160).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • _bioinformatics/obiKEGG.py

    r1636 r1682  
    228228    def to_dict(cls, text, field): 
    229229        text = cls.deindent(text, field).replace("\n ", " ") 
    230         lines = [t.split(": ",1) for t in text.split("\n")] 
     230        lines = [t.split(": ",1) for t in text.splitlines()] 
    231231        return dict([(key, [t.strip() for t in value.split(" ") if t]) for key, value in lines]) 
    232232     
    233233    @classmethod 
    234234    def to_ids(cls, text, field): 
    235         lines = [line.split(" ", 2)[:2] for line in cls.deindent(text, field).split("\n") if ":" in line.split(" ", 1)[0]] 
     235        lines = [line.split(" ", 2)[:2] for line in cls.deindent(text, field).splitlines() if ":" in line.split(" ", 1)[0]] 
    236236        return [db.lower() + id for db, id in lines]  
    237 #        ids = reduce(lambda col, line:1, text.split("\n"), []) 
     237#        ids = reduce(lambda col, line:1, text.splitlines(), []) 
    238238        return ids 
    239239    default = deindent 
     
    305305        self.entrytext = entrytext 
    306306        if not self.FIELDS: 
    307             self.FIELDS = set([line.split()[0] for line in entrytext.split("\n") if line.strip() and not line.startswith(" ")]) 
     307            self.FIELDS = set([line.split()[0] for line in entrytext.splitlines() if line.strip() and not line.startswith(" ")]) 
    308308        self._index(index) 
    309309         
Note: See TracChangeset for help on using the changeset viewer.