<commit_before>import os
import time
import threading
import geojson
import vagquery
from flask import Flask, render_template
from flask_bootstrap import Bootstrap
from flask.ext.socketio import SocketIO, emit


app = Flask(__name__)
app.debug = True
app.config['SECRET_KEY'] = os.urandom(24)
Bootstrap(app)
socketio = SocketIO(app)


def get_station_list():
    '''getting station list by bruteforce'''
    with open('station.lst', 'w') as f:
        for i in range(100, 1000):
            try:
                if vagquery.DepartureQuery(i).query():
                    f.write(str(i) + '\n')
            except Exception:
                pass


def is_here(station):
    '''check if there is some departing in 0 minutes'''
    departures = vagquery.DepartureQuery(station).query()

    for i in departures:
        if i.departure_in_min == 0:
            return True, i.trip_id, i.latitude, i.longitude, i.direction, i.product
        else:
            return False, i.trip_id, i.latitude, i.longitude, i.direction, i.product


def create_geojson():
    '''getting everything together and returns a geojson'''
    if not os.path.exists('station.lst'):
        get_station_list()

    station_list = []
    with open('station.lst') as f:
        for i in f.readlines():
            station_list.append(i.strip())

    here_list = []
    for i in station_list:
        station = is_here(i)
        if station[0] == True:
            here_list.append(geojson.Feature(geometry=geojson.Point((station[3],
                station[2])), properties={'id': station[1], 'product':
                    station[5], 'popupContent': '&rarr; ' + station[4]}))<commit_msg>made a if more beautiful<commit_after>import os
import time
import threading
import geojson
import vagquery
from flask import Flask, render_template
from flask_bootstrap import Bootstrap
from flask.ext.socketio import SocketIO, emit


app = Flask(__name__)
app.debug = True
app.config['SECRET_KEY'] = os.urandom(24)
Bootstrap(app)
socketio = SocketIO(app)


def get_station_list():
    '''getting station list by bruteforce'''
    with open('station.lst', 'w') as f:
        for i in range(100, 1000):
            try:
                if vagquery.DepartureQuery(i).query():
                    f.write(str(i) + '\n')
            except Exception:
                pass


def is_here(station):
    '''check if there is some departing in 0 minutes'''
    departures = vagquery.DepartureQuery(station).query()

    for i in departures:
        if i.departure_in_min == 0:
            return True, i.trip_id, i.latitude, i.longitude, i.direction, i.product
        else:
            return False, i.trip_id, i.latitude, i.longitude, i.direction, i.product


def create_geojson():
    '''getting everything together and returns a geojson'''
    if not os.path.exists('station.lst'):
        get_station_list()

    station_list = []
    with open('station.lst') as f:
        for i in f.readlines():
            station_list.append(i.strip())

    here_list = []
    for i in station_list:
        station = is_here(i)
        if station[0] is True:
            here_list.append(geojson.Feature(geometry=geojson.Point((station[3],
                station[2])), properties={'id': station[1], 'product':
                    station[5], 'popupContent': '&rarr; ' + station[4]}))
{'fraction_non_alphanumeric': 0.12022843402464684, 'fraction_numerical': 0.01021941689209498, 'mean_word_length': 2.653128430296378, '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': '4770363', 'n_tokens_mistral': 1067, 'n_tokens_neox': 1004, 'n_words': 274}