<commit_before>from abc import ABCMeta

class Graph:
    __metaclass__ = ABCMeta

    def __init__( self ):
        self.graph = {}
        self.lastVertex = None

    def addVertex( self, vertexName ):
        if self.graph.get( vertexName ) != None:
            return False
        self.graph[vertexName]  = {}
        self.lastVertex         = vertexName
        return True

    def removeVertex( self, vertexName ):
        if self.graph.get( vertexName ) == None:
            return False
        del self.graph[vertexName]
        for vertex in self.graph:
            for relatedVertex in self.related( vertex ):
                if relatedVertex == vertexName:
                    del self.graph[vertex][vertexName]
                    break
        if self.lastVertex == vertexName:
            setOfVertex = tuple( self.graph )
            self.lastVertex = setOfVertex[len(setOfVertex)-1]

    def desconnect( self, vertexA, vertexB ):
        if self.__existVertex( {vertexA,vertexB} ) == False:
            return False
        del self.graph[vertexA][vertexB]
        return True

    def connect( self, vertexA,vertexB ):
        if self.__existVertex( {vertexA,vertexB} ) == False:
            return False
        self.graph[vertexA][vertexB] = {}

    def order( self ):
        return len( self.graph )

    def degree( self,vertex ):
        if self.__existVertex( {vertex} ) == False:
            return False
        return len(self.graph[vertex])

    def getRelationVertex( self ):
        return self.graph

    def anyVertex( self ):
        return self.lastVertex

    def related( self,vertex ):
        if self.__existVertex( { vertex } ) == False:
            return False
        return self.graph[vertex]

    def __existVertex( self, dictVertex = {} ):
        for v in dictVertex:
            if self.graph.get( v, None ) == None:
                return False
        return True<commit_msg>Refactore pontual no nome de um metodo<commit_after>from abc import ABCMeta

class Graph:
    __metaclass__ = ABCMeta

    def __init__( self ):
        self.graph = {}
        self.lastVertex = None

    def addVertex( self, vertexName ):
        if self.graph.get( vertexName ) != None:
            return False
        self.graph[vertexName]  = {}
        self.lastVertex         = vertexName
        return True

    def removeVertex( self, vertexName ):
        if self.graph.get( vertexName ) == None:
            return False
        del self.graph[vertexName]
        for vertex in self.graph:
            for relatedVertex in self.related( vertex ):
                if relatedVertex == vertexName:
                    del self.graph[vertex][vertexName]
                    break
        if self.lastVertex == vertexName:
            setOfVertex = tuple( self.graph )
            self.lastVertex = setOfVertex[len(setOfVertex)-1]

    def desconnect( self, vertexA, vertexB ):
        if self._existVertex( {vertexA,vertexB} ) == False:
            return False
        del self.graph[vertexA][vertexB]
        return True

    def connect( self, vertexA,vertexB ):
        if self._existVertex( {vertexA,vertexB} ) == False:
            return False
        self.graph[vertexA][vertexB] = {}

    def order( self ):
        return len( self.graph )

    def degree( self,vertex ):
        if self._existVertex( {vertex} ) == False:
            return False
        return len(self.graph[vertex])

    def getRelationVertex( self ):
        return self.graph

    def anyVertex( self ):
        return self.lastVertex

    def related( self,vertex ):
        if self._existVertex( { vertex } ) == False:
            return False
        return self.graph[vertex]

    def _existVertex( self, dictVertex = {} ):
        for v in dictVertex:
            if self.graph.get( v, None ) == None:
                return False
        return True
{'fraction_non_alphanumeric': 0.09245867768595041, 'fraction_numerical': 0.0005165289256198347, 'mean_word_length': 1.871015567086731, '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': '5019496', 'n_tokens_mistral': 1055, 'n_tokens_neox': 1026, 'n_words': 295}