Changeset 1743:9f18a1e0657c in orange-bioinformatics for _bioinformatics/obiOntology.py


Ignore:
Timestamp:
04/12/13 12:35:51 (12 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Extended term name mangling to all python reserved keywords.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • _bioinformatics/obiOntology.py

    r1742 r1743  
    4848import urllib2 
    4949import warnings 
     50import keyword 
    5051from collections import defaultdict 
    5152from StringIO import StringIO 
     
    181182 
    182183        """ 
    183         if tag in ["def", "class", "in", "not"]: 
     184        if keyword.iskeyword(tag): 
    184185            return tag + "_" 
    185186        else: 
     
    190191        Reverse of `name_mangle`. 
    191192        """ 
    192         if tag in ["def_", "class_", "in_", "not_"]: 
     193        if tag.endswith("_") and keyword.iskeyword(tag[:-1]): 
    193194            return tag[:-1] 
    194195        else: 
Note: See TracChangeset for help on using the changeset viewer.