<commit_before>import psycopg2
import operator
from math import sqrt,fabs,floor

def distance_between (x1,y1,x2,y2):
    return fabs(sqrt( (x2 - x1)**2 + (y2 - y1)**2 ))

def getlocation(cur,version,userstopcode):
    cur = conn.cursor()
    cur.execute("""SELECT locationx_ew::integer,locationy_ns::integer FROM point WHERE version = %s and pointcode = %s""",[version,userstopcode])
    return cur.fetchone()

def set_beginend(conn,pool,userstopcodebegin,userstopcodeend,distance):
    version = pool[0][0]
    daow = pool[0][1]
    linkvalidfrom = pool[0][9]
    if pool[0][4] != userstopcodebegin:
        found = False
        for row in pool:
            if row[4] == userstopcodebegin:
                pool.remove(row)
                pool.insert(0,row)
                found = True
                break
        if found is False:
            x,y = getlocation(conn,version,userstopcodebegin)
            first = [version,daow,userstopcodebegin,userstopcodeend,userstopcodebegin,0,x,y,0]
            pool.insert(0,first)
            cur = conn.cursor()
            cur.execute("""INSERT INTO POOL VALUES ('POOL',%s,'I','VTN',%s,%s,%s,'VTN',%s,0,NULL,NULL,NULL)""",
                           [version,userstopcodebegin,userstopcodeend,linkvalidfrom,userstopcodebegin])
    if pool[-1][4] != userstopcodeend:
        found = False
        for row in pool:
            if row[4] == userstopcodeend:
                pool.remove(row)
                pool.append(row)
                found = True<commit_msg>Veolia shape fixer: don't commit<commit_after>import psycopg2
import operator
from math import sqrt,fabs,floor

def distance_between (x1,y1,x2,y2):
    return fabs(sqrt( (x2 - x1)**2 + (y2 - y1)**2 ))

def getlocation(conn,version,userstopcode):
    cur = conn.cursor()
    cur.execute("""SELECT locationx_ew::integer,locationy_ns::integer FROM point WHERE version = %s and pointcode = %s""",[version,userstopcode])
    return cur.fetchone()

def set_beginend(conn,pool,userstopcodebegin,userstopcodeend,distance):
    version = pool[0][0]
    daow = pool[0][1]
    linkvalidfrom = pool[0][9]
    if pool[0][4] != userstopcodebegin:
        found = False
        for row in pool:
            if row[4] == userstopcodebegin:
                pool.remove(row)
                pool.insert(0,row)
                found = True
                break
        if found is False:
            x,y = getlocation(conn,version,userstopcodebegin)
            first = [version,daow,userstopcodebegin,userstopcodeend,userstopcodebegin,0,x,y,0]
            pool.insert(0,first)
            cur = conn.cursor()
            cur.execute("""INSERT INTO POOL VALUES ('POOL',%s,'I','VTN',%s,%s,%s,'VTN',%s,0,NULL,NULL,NULL)""",
                           [version,userstopcodebegin,userstopcodeend,linkvalidfrom,userstopcodebegin])
    if pool[-1][4] != userstopcodeend:
        found = False
        for row in pool:
            if row[4] == userstopcodeend:
                pool.remove(row)
                pool.append(row)
                found = True
{'fraction_non_alphanumeric': 0.12894736842105264, 'fraction_numerical': 0.018421052631578946, 'mean_word_length': 2.5484247374562425, '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': '2249282', 'n_tokens_mistral': 987, 'n_tokens_neox': 960, 'n_words': 185}