<commit_before># Implements antimeridian cutting

import itertools

from .types import (LineString, MultiLineString,
                    Polygon, MultiPolygon,
                    GeometryCollection,
                    Feature, FeatureCollection)

PRECISION = 1e-8

def _seg_crosses(x0, x1):
    return abs(x0-x1) > 180

def _split(pt0, pt1):
    # compute offset from antimeridian
    dx0 = abs((pt0[0] + 360) % 360 - 180)
    dx1 = abs((pt1[0] + 360) % 360 - 180)
    return round((dx0*pt0[1] + dx1*pt1[1])/(dx0+dx1), 8)

def _split_coordinate_string(coordinates):
    parts = []
    coords = [coordinates[0]]
    for i in range(len(coordinates)-1):
        pt0 = coordinates[i]
        pt1 = coordinates[i+1]
        if _seg_crosses(pt0[0], pt1[0]):
            ymerid = _split(pt0, pt1)
            if pt0[0]>0:
                # moving east
                coords.append((180, ymerid))
            else:
                coords.append((-180+PRECISION, ymerid))<commit_msg>convert to float (Python2 fix)<commit_after># Implements antimeridian cutting
# problems:
# - splitting polygon holes on the antimeridian
# - splitting multipolygons where not all parts cross antimeridian

import itertools

from .types import (LineString, MultiLineString,
                    Polygon, MultiPolygon,
                    GeometryCollection,
                    Feature, FeatureCollection)

PRECISION = 1e-8

def _seg_crosses(x0, x1):
    return abs(x0-x1) > 180

def _split(pt0, pt1):
    # compute offset from antimeridian
    dx0 = float(abs((pt0[0] + 360) % 360 - 180))
    dx1 = float(abs((pt1[0] + 360) % 360 - 180))
    return round((dx0*pt0[1] + dx1*pt1[1])/(dx0+dx1), 8)

def _split_coordinate_string(coordinates):
    parts = []
    coords = [coordinates[0]]
    for i in range(len(coordinates)-1):
        pt0 = coordinates[i]
        pt1 = coordinates[i+1]
        if _seg_crosses(pt0[0], pt1[0]):
            ymerid = _split(pt0, pt1)
            if pt0[0]>0:
                # moving east
                coords.append((180, ymerid))
            else:
                coords.append((-180+PRECISION, ymerid))
{'fraction_non_alphanumeric': 0.11931818181818182, 'fraction_numerical': 0.061079545454545456, 'mean_word_length': 2.296411856474259, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '4010326', 'n_tokens_mistral': 793, 'n_tokens_neox': 707, 'n_words': 164}