def fuse_two_stops(real_name, alias):
    real_id = Other.to_id(real_name)
    alias_id = Other.to_id(alias)

    # We first take care of stops.txt
    Other.replace_in_file("gtfs/stops.txt", alias, delete_line=True, escape=True)

    # Now we take care of stop_times.txt
    Other.replace_in_file("gtfs/stop_times.txt", alias_id, real_id, escape=True)
    def update_stops(self, li, comparator):

        # First add the stops
        for i, stop in enumerate(li):
            li[i].name = comparator.look_for_stop(li[i].name)
            char = stop.name[0]

            # Here we check if it's not a false stop or "*" or "/" or "//"
            if char != "*" and char != "/" and char != "$":
                stop_id = Other.to_id(stop.name)

                # Then we go into the list of stops in the agency to see if it was already there
                found = False
                for stop_in_memory in self.stops:
                    if normalize(stop_in_memory.id) == normalize(stop_id):
                        found = True
                        break
                if not found:
                    for stop_in_memory in self.stops:
                        if comparator.compare(stop_in_memory.name, stop.name):
                            li[i].name = stop_in_memory.name
                            found = True
                            break
                    if not found:
                        self.stops.append(Stop.Stop(stop.name))
Пример #3
0
    def __init__(self, name, id=None, description="", latitude="", longitude="",
                 url="", location_type="", parent_station=""):

        self.name = name
        if id is None:
            self.id = Other.to_id(name)
        else:
            self.id = id
        self.description = description
        self.latitude = latitude
        self.longitude = longitude
        self.url = url
        self.locationType = location_type
        self.parent_station = parent_station