<commit_before>import Ontology

class OntologyTerm(object):

    def __init__(self, ontology, oboStanza = None, *args, **keywordArgs):
        object.__init__(self, *args, **keywordArgs)
        
        if not isinstance(ontology, Ontology.Ontology):
            raise ValueError, gettext('The first argument must be an Ontology instance')
        
        self.ontology = ontology
        self.oboStanza = oboStanza
        self.identifier = None
        self.name = None
        self.abbreviation = None
        self.partOf = None
        self.parts = []
        self.obsolete = False
        
        if self.oboStanza is not None:
            self.identifier = self.oboStanza.id.value
            self.name = self.oboStanza.name.value
            
            # If this term has 'part-of' relationship then try to set the parent term.
            for relationship in self.oboStanza.relationship or []:
                if relationship.relationship == 'part_of':
                    parentId = relationship.value
                    if parentId in self.ontology:
                        parentTerm = self.ontology[parentId]
                        self.partOf = parentTerm
                        parentTerm.parts.append(self)
                    else:
                        # The parent of this term has not been loaded yet.  Store its ID and look it up later.
                        self.partOf = parentId
            
            # Grab any abbreviation.
            for synonym in self.oboStanza.synonyms or []:
                if 'ABBREVIATION' in synonym.types:
                    self.abbreviation = synonym.value
                # TODO: grab other synonyms?
            
            if self.oboStanza.definition is not None and self.oboStanza.definition.value == 'Obsolete.':
               self.obsolete = True
    
    
    
    def browse(self):
        # Make sure the ontology is open
        self.ontology.browse()
        
        self.ontology.frame.selectTerm(self)<commit_msg>Fixed indentation.<commit_after>import Ontology

class OntologyTerm(object):

    def __init__(self, ontology, oboStanza = None, *args, **keywordArgs):
        object.__init__(self, *args, **keywordArgs)
        
        if not isinstance(ontology, Ontology.Ontology):
            raise ValueError, gettext('The first argument must be an Ontology instance')
        
        self.ontology = ontology
        self.oboStanza = oboStanza
        self.identifier = None
        self.name = None
        self.abbreviation = None
        self.partOf = None
        self.parts = []
        self.obsolete = False
        
        if self.oboStanza is not None:
            self.identifier = self.oboStanza.id.value
            self.name = self.oboStanza.name.value
            
            # If this term has 'part-of' relationship then try to set the parent term.
            for relationship in self.oboStanza.relationship or []:
                if relationship.relationship == 'part_of':
                    parentId = relationship.value
                    if parentId in self.ontology:
                        parentTerm = self.ontology[parentId]
                        self.partOf = parentTerm
                        parentTerm.parts.append(self)
                    else:
                        # The parent of this term has not been loaded yet.  Store its ID and look it up later.
                        self.partOf = parentId
            
            # Grab any abbreviation.
            for synonym in self.oboStanza.synonyms or []:
                if 'ABBREVIATION' in synonym.types:
                    self.abbreviation = synonym.value
                # TODO: grab other synonyms?
            
            if self.oboStanza.definition is not None and self.oboStanza.definition.value == 'Obsolete.':
                self.obsolete = True
    
    
    
    def browse(self):
        # Make sure the ontology is open
        self.ontology.browse()
        
        self.ontology.frame.selectTerm(self)
{'fraction_non_alphanumeric': 0.0721057884231537, 'fraction_numerical': 0.0, 'mean_word_length': 1.5245591939546599, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3284546', 'n_tokens_mistral': 1068, 'n_tokens_neox': 1001, 'n_words': 286}