<commit_before>from servable import Servable
from graphserver.graphdb import GraphDatabase
import time
from graphserver import core
from graphserver.core import State, WalkOptions
from graphserver.ext.osm.osmdb import OSMDB
from graphserver.ext.gtfs.gtfsdb import GTFSDatabase
from graphserver.util import TimeHelpers
from contour import travel_time_contour, travel_time_surface, points_to_surface_grid
import json
from rtree import Rtree
from glineenc import encode_pairs
from urllib import urlopen
import yaml

def cons(ary):
    for i in range(len(ary)-1):
        yield ary[i],ary[i+1]
        
def frange(low,high,step):
    curs = low
    while curs<=high:
        yield curs
        curs += step

class ContourServer(Servable):
    def __init__(self, settings_filename):
        settings = yaml.load( open( settings_filename ) )
        
        self.home_point = settings['center']
        
        # create cache of osm-node positions
        self.osmdb = OSMDB( settings['osmdb_filename'] )
        self.gtfsdb = GTFSDatabase( settings['gtfsdb_filename'] )
        self.port = settings['port']
        self.node_positions = {}
        self.index = Rtree()
        for node_id, tags, lat, lon in self.osmdb.nodes():<commit_msg>smarter json importing<commit_after>from servable import Servable
from graphserver.graphdb import GraphDatabase
import time
from graphserver import core
from graphserver.core import State, WalkOptions
from graphserver.ext.osm.osmdb import OSMDB
from graphserver.ext.gtfs.gtfsdb import GTFSDatabase
from graphserver.util import TimeHelpers
from contour import travel_time_contour, travel_time_surface, points_to_surface_grid
try:
    import json
except ImportError:
    import simplejson as json
from rtree import Rtree
from glineenc import encode_pairs
from urllib import urlopen
import yaml

def cons(ary):
    for i in range(len(ary)-1):
        yield ary[i],ary[i+1]
        
def frange(low,high,step):
    curs = low
    while curs<=high:
        yield curs
        curs += step

class ContourServer(Servable):
    def __init__(self, settings_filename):
        settings = yaml.load( open( settings_filename ) )
        
        self.home_point = settings['center']
        
        # create cache of osm-node positions
        self.osmdb = OSMDB( settings['osmdb_filename'] )
        self.gtfsdb = GTFSDatabase( settings['gtfsdb_filename'] )
        self.port = settings['port']
        self.node_positions = {}
        self.index = Rtree()
        for node_id, tags, lat, lon in self.osmdb.nodes():
{'fraction_non_alphanumeric': 0.07952755905511812, 'fraction_numerical': 0.0015748031496062992, 'mean_word_length': 3.3961937716262978, 'pattern_counts': {'":': 0, '<': 5, '<?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': '7576787', 'n_tokens_mistral': 775, 'n_tokens_neox': 757, 'n_words': 218}