Package obitools :: Package obo :: Module parser :: Class TaggedValue
[hide private]
[frames] | no frames]

Class TaggedValue

source code


A couple 'tag:value' of an OBOEntry.

Instance Methods [hide private]
 
__init__(self, line)
Constructor of the class TaggedValue.
source code
 
__str__(self)
str(x)
source code
 
__repr__(self)
repr(x)
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Class Variables [hide private]
  _match_value = re.compile(r'(("(\\"|[^"])*")|(\\"|[^"]))*?( !|...
  _split_comment = re.compile(r'^!| !')
  _match_quotedString = re.compile(r'(?<=")(\\"|[^"])*(?=")')
  _match_bracket = re.compile(r'\[[^\]]*\]')
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, line)
(Constructor)

source code 

Constructor of the class TaggedValue.

Parameters:
  • line (string) - a line of an OBOEntry composed of a tag and a value.
Overrides: object.__init__

Note: The constructor separates tags from right terms. 'value' is extracted from right terms using a regular expression (value is at the beginning of the string, between quotes or not). Then, 'comment' is extracted from the rest of the string using another regular expression ('comment' is at the end of the string after a '!'. By default, 'comment' is set to None). Finally, 'trailing_modifiers' are extracted from the last string using another regular expression. The tag, the value, the comment and the trailing_modifiers are saved.

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)

Class Variable Details [hide private]

_match_value

Value:
re.compile(r'(("(\\"|[^"])*")|(\\"|[^"]))*?( !| \{|$)')