<commit_before># -*- test-case-name: axiomatic.test.test_axiomatic -*-
from __future__ import print_function
from zope.interface import alsoProvides, noLongerProvides

import os
import sys
import glob
import errno
import signal
import six

from twisted.plugin import IPlugin, getPlugins
from twisted.python import usage
from twisted.python.runtime import platform
from twisted.scripts import twistd

from axiom.iaxiom import IAxiomaticCommand
from six.moves import input
import six

class AxiomaticSubCommandMixin(object):
    store = property(lambda self: self.parent.getStore())

    def decodeCommandLine(self, cmdline):
        """Turn a byte string from the command line into a unicode string.
        """
        codec = getattr(sys.stdin, 'encoding', None) or sys.getdefaultencoding()
        return str(cmdline, codec)



class _AxiomaticCommandMeta(type):
    """
    Metaclass for L{AxiomaticCommand}.

    This serves to make subclasses provide L{IPlugin} and L{IAxiomaticCommand}.
    """
    def __new__(cls, name, bases, attrs):
        newcls = type.__new__(cls, name, bases, attrs)
        alsoProvides(newcls, IPlugin, IAxiomaticCommand)
        return newcls



class AxiomaticSubCommand(usage.Options, AxiomaticSubCommandMixin):
    """
    L{twisted.python.usage.Options} subclass for Axiomatic sub commands.
    """
<commit_msg>cmdlines are text on py3<commit_after># -*- test-case-name: axiomatic.test.test_axiomatic -*-
from __future__ import print_function
from zope.interface import alsoProvides, noLongerProvides

import os
import sys
import glob
import errno
import signal
import six

from twisted.plugin import IPlugin, getPlugins
from twisted.python import usage
from twisted.python.runtime import platform
from twisted.scripts import twistd

from axiom.iaxiom import IAxiomaticCommand
from six.moves import input
import six

class AxiomaticSubCommandMixin(object):
    store = property(lambda self: self.parent.getStore())

    def decodeCommandLine(self, cmdline):
        """
        Turn whatever type the command line was (possibly text in py3, possibly
        bytes in py2) into a text string.
        """
        if isinstance(cmdline, six.text_type):
            return cmdline
        codec = getattr(sys.stdin, 'encoding', None) or sys.getdefaultencoding()
        return six.text_type(cmdline, codec)



class _AxiomaticCommandMeta(type):
    """
    Metaclass for L{AxiomaticCommand}.

    This serves to make subclasses provide L{IPlugin} and L{IAxiomaticCommand}.
    """
    def __new__(cls, name, bases, attrs):
        newcls = type.__new__(cls, name, bases, attrs)
        alsoProvides(newcls, IPlugin, IAxiomaticCommand)
        return newcls



class AxiomaticSubCommand(usage.Options, AxiomaticSubCommandMixin):
    """
    L{twisted.python.usage.Options} subclass for Axiomatic sub commands.
    """

{'fraction_non_alphanumeric': 0.08169705469845723, 'fraction_numerical': 0.0010518934081346423, 'mean_word_length': 3.8520408163265305, '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': '7217495', 'n_tokens_mistral': 860, 'n_tokens_neox': 815, 'n_words': 254}