<commit_before># https://pythonhosted.org/setuptools/setuptools.html#namespace-packages
__import__('pkg_resources').declare_namespace(__name__)

import logging
import shapely.geometry

import mapzen.whosonfirst.placetypes
import mapzen.whosonfirst.export
import mapzen.whosonfirst.pip.utils
import mapzen.whosonfirst.mapshaper.utils

class geojson(mapzen.whosonfirst.export.flatfile):

    def __init__(self, root, **kwargs):

        self.root = root

        # TO DO: pip-server args

        self.mapshaper = kwargs.get('mapshaper', False)

        mapzen.whosonfirst.export.flatfile.__init__(self, root, **kwargs)

    def index_feature(self, feature, **kwargs):

        # MAYBE: move all of this in to a separate function or make it
        # part of py-mapzen-whosonfirst-validator (20160129/thisisaaronland)

        geom = feature.get('geometry', None)

        if not geom:
            raise Exception, "Missing geometry"

        try:
            shapely.geometry.asShape(geom)
        except Exception, e:
            raise Exception, "Invalid geometry (%s)" % e

        props = feature.get('properties', None)

        if not props:
            raise Exception, "Missing properties"<commit_msg>add more notes to self<commit_after># https://pythonhosted.org/setuptools/setuptools.html#namespace-packages
__import__('pkg_resources').declare_namespace(__name__)

import logging
import shapely.geometry

import mapzen.whosonfirst.placetypes
import mapzen.whosonfirst.export
import mapzen.whosonfirst.pip.utils
import mapzen.whosonfirst.mapshaper.utils

class geojson(mapzen.whosonfirst.export.flatfile):

    def __init__(self, root, **kwargs):

        self.root = root

        # TO DO: pip-server args

        self.mapshaper = kwargs.get('mapshaper', False)

        mapzen.whosonfirst.export.flatfile.__init__(self, root, **kwargs)

    def index_feature(self, feature, **kwargs):

        # MAYBE: move all of this in to a separate function or make it
        # part of py-mapzen-whosonfirst-validator (20160129/thisisaaronland)

        # MAYBE: use some derivation of https://github.com/whosonfirst/whosonfirst-json-schema
        # https://github.com/whosonfirst/whosonfirst-json-schema

        geom = feature.get('geometry', None)

        if not geom:
            raise Exception, "Missing geometry"

        try:
            shapely.geometry.asShape(geom)
        except Exception, e:
            raise Exception, "Invalid geometry (%s)" % e

        props = feature.get('properties', None)

        if not props:
            raise Exception, "Missing properties"
{'fraction_non_alphanumeric': 0.09938128383604021, 'fraction_numerical': 0.006187161639597835, 'mean_word_length': 3.048513302034429, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, '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': '2871055', 'n_tokens_mistral': 805, 'n_tokens_neox': 761, 'n_words': 180}