<commit_before>from __future__ import division

import itertools
import math

import mapbox_vector_tile


class QATileParser(object):
    def __init__(self,
                 nodes_callback=None, ways_callback=None,
                 relations_callback=None, coords_callback=None,
                 nodes_tag_filter=None, ways_tag_filter=None,
                 relations_tag_filter=None, marshal_elem_data=False):
        self.nodes_callback = nodes_callback
        self.ways_callback = ways_callback
        self.coords_callback = coords_callback
        self.nodes_tag_filter = nodes_tag_filter
        self.ways_tag_filter = ways_tag_filter

        self.x = None
        self.y = None
        self.zoom = None
        self.extent = None

        self.node_id_seq = itertools.count()
        self.node_id_map = {}  # Map (lon, lat) to node ID
        self.way_id_seq = itertools.count()

    def parse_data(self, data, x, y, zoom):
        self.x = x
        self.y = y
        self.zoom = zoom

        tile = mapbox_vector_tile.decode(data)
        self.extent = tile['osm']['extent']
        for feature in tile['osm']['features']:
            self._handle_feature(feature)

    def _handle_feature(self, feature):
        if feature['properties'].get('_osm_node_id'):
            self._handle_node(feature)
        elif feature['properties'].get('_osm_way_id'):<commit_msg>Change arg order in parse function<commit_after>from __future__ import division

import itertools
import math

import mapbox_vector_tile


class QATileParser(object):
    def __init__(self,
                 nodes_callback=None, ways_callback=None,
                 relations_callback=None, coords_callback=None,
                 nodes_tag_filter=None, ways_tag_filter=None,
                 relations_tag_filter=None, marshal_elem_data=False):
        self.nodes_callback = nodes_callback
        self.ways_callback = ways_callback
        self.coords_callback = coords_callback
        self.nodes_tag_filter = nodes_tag_filter
        self.ways_tag_filter = ways_tag_filter

        self.x = None
        self.y = None
        self.zoom = None
        self.extent = None

        self.node_id_seq = itertools.count()
        self.node_id_map = {}  # Map (lon, lat) to node ID
        self.way_id_seq = itertools.count()

    def parse_data(self, x, y, zoom, data):
        self.x = x
        self.y = y
        self.zoom = zoom

        tile = mapbox_vector_tile.decode(data)
        self.extent = tile['osm']['extent']
        for feature in tile['osm']['features']:
            self._handle_feature(feature)

    def _handle_feature(self, feature):
        if feature['properties'].get('_osm_node_id'):
            self._handle_node(feature)
        elif feature['properties'].get('_osm_way_id'):
{'fraction_non_alphanumeric': 0.09146561037090385, 'fraction_numerical': 0.0, 'mean_word_length': 2.4899497487437188, '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': '6461929', 'n_tokens_mistral': 834, 'n_tokens_neox': 827, 'n_words': 164}