<commit_before># -*- coding: utf-8 -*-
# ###
# Copyright (c) 2013, Rice University
# This software is subject to the provisions of the GNU Affero General
# Public License version 3 (AGPLv3).
# See LICENCE.txt for details.
# ###
"""Conversion callables"""
import os
import io
import logging
import subprocess


here = os.path.abspath(os.path.dirname(__file__))
OOCONVERT = os.path.join(here, 'helper-scripts', 'ooconvert.py')
logger = logging.getLogger('cnxtransforms')


class File(io.FileIO):
    """file stream"""
    filename = None
    basepath = None

    def __init__(self, *args, **kwargs):
        super(File, self).__init__(*args, **kwargs)
        self.filename = os.path.basename(self.name)
        self.basepath = os.path.abspath(os.path.dirname(self.name))

    @classmethod
    def from_io(cls, open_input):
        open_input.seek(0)
        filepointer, filepath = tempfile.mkstemp()  ##suffix=extension)
        with open(filepath, 'wb') as f:
            f.write(open_input.read())
        return cls(filepath)

    def __repr__(self):
        return "<{} instance of '{}'>".format(self.__class__.__name__,
                                              self.filepath)

    @property
    def filepath(self):<commit_msg>Missing imports, due to a faulting hunking commit by me.<commit_after># -*- coding: utf-8 -*-
# ###
# Copyright (c) 2013, Rice University
# This software is subject to the provisions of the GNU Affero General
# Public License version 3 (AGPLv3).
# See LICENCE.txt for details.
# ###
"""Conversion callables"""
import os
import io
import logging
import subprocess
import tempfile

import lxml.etree
from rhaptos.cnxmlutils import odt2cnxml


here = os.path.abspath(os.path.dirname(__file__))
OOCONVERT = os.path.join(here, 'helper-scripts', 'ooconvert.py')
logger = logging.getLogger('cnxtransforms')


class File(io.FileIO):
    """File buffer"""
    filename = None
    basepath = None

    def __init__(self, *args, **kwargs):
        super(File, self).__init__(*args, **kwargs)
        self.filename = os.path.basename(self.name)
        self.basepath = os.path.abspath(os.path.dirname(self.name))

    @classmethod
    def from_io(cls, open_input):
        open_input.seek(0)
        filepointer, filepath = tempfile.mkstemp()  ##suffix=extension)
        with open(filepath, 'wb') as f:
            f.write(open_input.read())
        return cls(filepath)

    def __repr__(self):
        return "<{} instance of '{}'>".format(self.__class__.__name__,
                                              self.filepath)

    @property
    def filepath(self):
{'fraction_non_alphanumeric': 0.13199536858355848, 'fraction_numerical': 0.006561173292165187, 'mean_word_length': 2.9754601226993866, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 3}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1971314', 'n_tokens_mistral': 823, 'n_tokens_neox': 806, 'n_words': 202}