<commit_before>from __future__ import print_function, division

import sys
import functools
import warnings

import numpy as np

__all__ = ['array_fill_repeat']
__all__ += ['isndarray', 'isiterable', 'voigt_matrix']
__all__ += ['get_dtype']
__all__ += ['dtype_complex_to_real', 'dtype_real_to_complex']
__all__ += ['wrap_filterwarnings']

# Wrappers typically used
__all__ += ['_str', '_range', '_zip', '_map']
__all__ += ['is_python2', 'is_python3']
__all__ += ['xml_parse']


# Base-class for string object checks
is_python3 = sys.version_info >= (3, 0)
is_python2 = not is_python3
if is_python3:
    import collections.abc as collections_abc
    _str = str
    _range = range
    _zip = zip
    _map = map
else:
    import collections as collections_abc
    from itertools import izip as _zip
    from itertools import imap as _map
    _str = basestring
    _range = xrange


# Load the correct xml-parser
try:
    from defusedxml.ElementTree import parse as xml_parse
    if sys.version_info > (3, 6):
        from defusedxml import __version__ as defusedxml_version
        try:
            defusedxml_version = list(map(int, defusedxml_version.split('.')))
            if defusedxml_version[0] == 0 and defusedxml_version[1] <= 5:
                raise ImportError
        except:
            raise ImportError
except ImportError:
    from xml.etree.ElementTree import parse as xml_parse


def array_fill_repeat(array, size, cls=None):
    """
    This repeats an array along the zeroth axis until it
    has size `size`. Note that initial size of `array` has
    to be an integer part of `size`.
    """
    try:
        reps = size // len(array)
    except:
        array = [array]
        reps = size // len(array)
    if size % len(array) != 0:
        # We do not have it correctly formatted (either an integer
        # repeatable part, full, or a single)
        raise ValueError('Repetition of or array is not divisible with actual length. '
                         'Hence we cannot create a repeated size.')
    if cls is None:
        if reps > 1:
            return np.tile(array, reps)
        return array
    else:
        if reps > 1:
            return np.tile(np.array(array, dtype=cls), reps)
        return np.array(array, dtype=cls)

def voigt_matrix(M, to_voigt):<commit_msg>maint: pep8 fixes<commit_after>from __future__ import print_function, division

import sys
import functools
import warnings

import numpy as np

__all__ = ['array_fill_repeat']
__all__ += ['isndarray', 'isiterable', 'voigt_matrix']
__all__ += ['get_dtype']
__all__ += ['dtype_complex_to_real', 'dtype_real_to_complex']
__all__ += ['wrap_filterwarnings']

# Wrappers typically used
__all__ += ['_str', '_range', '_zip', '_map']
__all__ += ['is_python2', 'is_python3']
__all__ += ['xml_parse']


# Base-class for string object checks
is_python3 = sys.version_info >= (3, 0)
is_python2 = not is_python3
if is_python3:
    import collections.abc as collections_abc
    _str = str
    _range = range
    _zip = zip
    _map = map
else:
    import collections as collections_abc
    from itertools import izip as _zip
    from itertools import imap as _map
    _str = basestring
    _range = xrange


# Load the correct xml-parser
try:
    from defusedxml.ElementTree import parse as xml_parse
    if sys.version_info > (3, 6):
        from defusedxml import __version__ as defusedxml_version
        try:
            defusedxml_version = list(map(int, defusedxml_version.split('.')))
            if defusedxml_version[0] == 0 and defusedxml_version[1] <= 5:
                raise ImportError
        except:
            raise ImportError
except ImportError:
    from xml.etree.ElementTree import parse as xml_parse


def array_fill_repeat(array, size, cls=None):
    """
    This repeats an array along the zeroth axis until it
    has size `size`. Note that initial size of `array` has
    to be an integer part of `size`.
    """
    try:
        reps = size // len(array)
    except:
        array = [array]
        reps = size // len(array)
    if size % len(array) != 0:
        # We do not have it correctly formatted (either an integer
        # repeatable part, full, or a single)
        raise ValueError('Repetition of or array is not divisible with actual length. '
                         'Hence we cannot create a repeated size.')
    if cls is None:
        if reps > 1:
            return np.tile(array, reps)
        return array
    else:
        if reps > 1:
            return np.tile(np.array(array, dtype=cls), reps)
        return np.array(array, dtype=cls)


def voigt_matrix(M, to_voigt):
{'fraction_non_alphanumeric': 0.09173715029277814, 'fraction_numerical': 0.007590544350466276, 'mean_word_length': 2.8052805280528053, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 24}, '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': '2677862', 'n_tokens_mistral': 1445, 'n_tokens_neox': 1417, 'n_words': 477}