Compare commits

...
Sign in to create a new pull request.

2 commits

Author SHA1 Message Date
Alexander Borsuk
06fc8bc13c Force IPv4 usage 2022-10-07 23:21:08 +02:00
Alexander Borsuk
15d3fcc149 Alexey's hotfix for validator 2022-10-07 23:20:44 +02:00
2 changed files with 12 additions and 16 deletions

View file

@ -25,6 +25,17 @@ from subway_structure import (
MODES_RAPID,
)
# Hack to always use IPv4.
import socket
old_getaddrinfo = socket.getaddrinfo
def new_getaddrinfo(*args, **kwargs):
responses = old_getaddrinfo(*args, **kwargs)
return [response
for response in responses
if response[0] == socket.AF_INET]
socket.getaddrinfo = new_getaddrinfo
def overpass_request(overground, overpass_api, bboxes):
query = '[out:json][timeout:1000];('

View file

@ -1,5 +1,4 @@
import csv
import itertools
import logging
import math
import urllib.parse
@ -1379,7 +1378,7 @@ class City:
self.elements = {} # Dict el_id → el
self.stations = defaultdict(list) # Dict el_id → list of StopAreas
self.routes = {} # Dict route_master_ref → RouteMaster
self.routes = {} # Dict route_ref → route
self.masters = {} # Dict el_id of route → route_master
self.stop_areas = defaultdict(
list
@ -1716,18 +1715,6 @@ class City:
if t not in have_return:
self.notice('Route does not have a return direction', rel)
def validate_route_refs(self):
master_refs = sorted(m.ref for m in self.routes.values())
for ref, group in itertools.groupby(master_refs):
if len(list(group)) > 1:
# This can occur if some routes with some ref belong to
# a route_master, but other with the same ref doesn't.
self.error("Route masters {} have the same ref".format(
', '.join(
m.id for m in self.routes.values() if m.ref == ref
)
))
def validate_lines(self):
self.found_light_lines = len(
[x for x in self.routes.values() if x.mode != 'subway']
@ -1794,8 +1781,6 @@ class City:
self.count_unused_entrances()
self.found_interchanges = len(self.transfers)
self.validate_route_refs()
if self.overground:
self.validate_overground_lines()
else: