<commit_before># -*- coding: utf-8 -*-
##############################################################################
#
#    Author: <NAME>
#    Copyright 2011-2012 Camptocamp SA
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU Affero General Public License as
#    published by the Free Software Foundation, either version 3 of the
#    License, or (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import json
import logging

from shapely.wkb import loads as  wkbloads
from shapely.geometry import asShape
import geojson

from osv import fields, osv, orm
from tools.translate import _
import pooler
from geo_helper import geo_convertion_helper as convert
import geo_operators

logger = logging.getLogger('geoengine.database.structure')
exp_logger = logging.getLogger('geoengine.expression')

class Geom(fields._column):
    """New type of column in the  ORM for POSTGIS geometry type"""


    def load_geo(self, wkb):
        """Load geometry into browse record after read was done"""
        return wkb and wkbloads(wkb.decode('hex')) or False


    def set_geo(self, value):
        """Transform data to a format compatible with the create function.

        It is also use in expression.py in order to represent value."""
        if not value:
            return None
        res = self.entry_to_shape(value, same_type=True)
        if res.is_empty:
            return None<commit_msg>Fix non protected import of python dependences<commit_after># -*- coding: utf-8 -*-
##############################################################################
#
#    Author: <NAME>
#    Copyright 2011-2012 Camptocamp SA
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU Affero General Public License as
#    published by the Free Software Foundation, either version 3 of the
#    License, or (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import json
import logging


try:
    from shapely.wkb import loads as  wkbloads
    from shapely.geometry import asShape
    import geojson
except ImportError:
    logger = logging.getLogger(__name__)
    logger.warning('Shapely or geojson are not available in the sys path')

from osv import fields, osv, orm
from tools.translate import _
import pooler
from geo_helper import geo_convertion_helper as convert
import geo_operators

logger = logging.getLogger('geoengine.database.structure')
exp_logger = logging.getLogger('geoengine.expression')

class Geom(fields._column):
    """New type of column in the  ORM for POSTGIS geometry type"""


    def load_geo(self, wkb):
        """Load geometry into browse record after read was done"""
        return wkb and wkbloads(wkb.decode('hex')) or False


    def set_geo(self, value):
        """Transform data to a format compatible with the create function.

        It is also use in expression.py in order to represent value."""
        if not value:
            return None
        res = self.entry_to_shape(value, same_type=True)
        if res.is_empty:
            return None
{'fraction_non_alphanumeric': 0.14109825166215217, 'fraction_numerical': 0.004924895345973898, 'mean_word_length': 3.636986301369863, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '6689368', 'n_tokens_mistral': 1074, 'n_tokens_neox': 1019, 'n_words': 454}