<commit_before># Note: This class is imported from the procedural city generator repo so
# we can de-serialize the file contents. This class will likely change in
# the future as we move forward, especially to provide conversion messages
# to our domain models.

from geometry.point import Point


class Vertex(object):
    def __init__(self, coords):
        self.coords = coords
        self.neighbours = []
        self.minor_road = True
        self.seed = False

    def __repr__(self):
        return "Vertex: " + str(self.coords)


class GraphNode(object):
    def __init__(self, location, is_minor_road=True):
        self.location = location
        self.neighbours = []
        self.is_minor_road = is_minor_road

    @classmethod
    def from_vertex(cls, vertex, ratio):
        location = Point(vertex.coords[0] * ratio, vertex.coords[1] * ratio, 0)
        return cls(location, vertex.minor_road)

    def set_neighbours(self, neighbours):
        self.neighbours = neighbours

    def add_neighbour(self, neighbour):
        self.neighbours.append(neighbour)

    def neighbours_count(self):
        return len(self.neighbours)

    def prepare_traversal(self):
        self.neighbours_to_traverse = list(self.neighbours)

    def neighbours_to_traverse_count(self):
        return len(self.neighbours_to_traverse)

    def get_neighbours_to_traverse(self):
        return self.neighbours_to_traverse

    def pop_neighbours_to_traverse(self):
        return self.neighbours_to_traverse.pop()

    def remove_neighbour_to_traverse(self, node):
        return self.neighbours_to_traverse.remove(node)
<commit_msg>Round floats before creating the city road nodes<commit_after># Note: This class is imported from the procedural city generator repo so
# we can de-serialize the file contents. This class will likely change in
# the future as we move forward, especially to provide conversion messages
# to our domain models.

from geometry.point import Point


class Vertex(object):
    def __init__(self, coords):
        self.coords = coords
        self.neighbours = []
        self.minor_road = True
        self.seed = False

    def __repr__(self):
        return "Vertex: " + str(self.coords)


class GraphNode(object):
    def __init__(self, location, is_minor_road=True):
        self.location = location
        self.neighbours = []
        self.is_minor_road = is_minor_road

    @classmethod
    def from_vertex(cls, vertex, ratio):
        '''
        Shapely has issues with too-detailed floating points, so we round them
        to 7 decimals (which is just a 0.0000001 meter precision lost)
        '''
        location = Point(vertex.coords[0] * ratio, vertex.coords[1] * ratio, 0).rounded_to(7)
        return cls(location, vertex.minor_road)

    def set_neighbours(self, neighbours):
        self.neighbours = neighbours

    def add_neighbour(self, neighbour):
        self.neighbours.append(neighbour)

    def neighbours_count(self):
        return len(self.neighbours)

    def prepare_traversal(self):
        self.neighbours_to_traverse = list(self.neighbours)

    def neighbours_to_traverse_count(self):
        return len(self.neighbours_to_traverse)

    def get_neighbours_to_traverse(self):
        return self.neighbours_to_traverse

    def pop_neighbours_to_traverse(self):
        return self.neighbours_to_traverse.pop()

    def remove_neighbour_to_traverse(self, node):
        return self.neighbours_to_traverse.remove(node)

{'fraction_non_alphanumeric': 0.08057553956834532, 'fraction_numerical': 0.00460431654676259, 'mean_word_length': 3.233861144945189, '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': '4430622', 'n_tokens_mistral': 1122, 'n_tokens_neox': 1037, 'n_words': 269}