<commit_before>﻿# Copyright 2014-2017 The ODL contributors
#
# This file is part of ODL.
#
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at https://mozilla.org/MPL/2.0/.

"""Base classes for implementations of n-tuples."""

# Imports for common Python 2/3 codebase
from __future__ import print_function, division, absolute_import
from builtins import int

import numpy as np

from odl.set import (
    RealNumbers, ComplexNumbers, LinearSpace, LinearSpaceElement)
from odl.util.ufuncs import FnBaseUfuncs
from odl.util import (
    array_str, dtype_repr, indent,
    is_real_dtype, is_complex_floating_dtype, is_floating_dtype,
    complex_dtype, real_dtype,
    NumpyRandomSeed)


__all__ = ('FnBase', 'FnBaseVector')


class FnBase(LinearSpace):

    """Base class for n-tuples over a field independent of implementation."""

    def __init__(self, size, dtype):
        """Initialize a new instance.

        Parameters
        ----------
        size : non-negative int
            Number of entries in a tuple.
        dtype :
            Data type for each tuple entry. Can be provided in any
            way the `numpy.dtype` function understands, most notably
            as built-in type, as one of NumPy's internal datatype
            objects or as string.
        """
        self.__size = int(size)
        if self.size < 0:
            raise ValueError('`size` must be non-negative, got {}'
                             ''.format(size))
        self.__dtype = np.dtype(dtype)<commit_msg>BUG: stop importing int from future on module level<commit_after>﻿# Copyright 2014-2017 The ODL contributors
#
# This file is part of ODL.
#
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at https://mozilla.org/MPL/2.0/.

"""Base classes for implementations of n-tuples."""

# Imports for common Python 2/3 codebase
from __future__ import print_function, division, absolute_import

import numpy as np

from odl.set import (
    RealNumbers, ComplexNumbers, LinearSpace, LinearSpaceElement)
from odl.util.ufuncs import FnBaseUfuncs
from odl.util import (
    array_str, dtype_repr, indent,
    is_real_dtype, is_complex_floating_dtype, is_floating_dtype,
    complex_dtype, real_dtype,
    NumpyRandomSeed)


__all__ = ('FnBase', 'FnBaseVector')


class FnBase(LinearSpace):

    """Base class for n-tuples over a field independent of implementation."""

    def __init__(self, size, dtype):
        """Initialize a new instance.

        Parameters
        ----------
        size : non-negative int
            Number of entries in a tuple.
        dtype :
            Data type for each tuple entry. Can be provided in any
            way the `numpy.dtype` function understands, most notably
            as built-in type, as one of NumPy's internal datatype
            objects or as string.
        """
        # Make sure that huge sizes don't overflow in Py2
        from builtins import int
        self.__size = int(size)
        if self.size < 0:
            raise ValueError('`size` must be non-negative, got {}'
                             ''.format(size))
        self.__dtype = np.dtype(dtype)
{'fraction_non_alphanumeric': 0.08393070489844684, 'fraction_numerical': 0.009259259259259259, 'mean_word_length': 2.5972073039742214, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '7287984', 'n_tokens_mistral': 977, 'n_tokens_neox': 945, 'n_words': 364}