Merge "Use hacking checks"
commit
7f05a784fb
|
@ -1,22 +0,0 @@
|
|||
# Copyright (c) 2013, Kevin Greenan (kmgreen2@gmail.com)
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# Redistributions of source code must retain the above copyright notice, this
|
||||
# list of conditions and the following disclaimer.
|
||||
#
|
||||
# Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution. THIS SOFTWARE IS
|
||||
# PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
|
||||
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
# NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@ -122,7 +122,7 @@ class ECPyECLibDriver(object):
|
|||
return required_fragments
|
||||
|
||||
def min_parity_fragments_needed(self):
|
||||
""" FIXME - fix this to return a function of HD """
|
||||
"""FIXME - fix this to return a function of HD"""
|
||||
return 1
|
||||
|
||||
def get_metadata(self, fragment, formatted=0):
|
||||
|
|
|
@ -815,8 +815,10 @@ class IntEnum(int, Enum):
|
|||
|
||||
|
||||
def unique(enumeration):
|
||||
"""Class decorator that ensures only unique members exist
|
||||
in an enumeration."""
|
||||
"""
|
||||
Class decorator that ensures only unique members exist
|
||||
in an enumeration.
|
||||
"""
|
||||
duplicates = []
|
||||
for name, member in enumeration.__members__.items():
|
||||
if name != member.name:
|
||||
|
|
28
setup.py
28
setup.py
|
@ -43,8 +43,8 @@ except ImportError:
|
|||
use_setuptools()
|
||||
from setuptools import setup
|
||||
|
||||
from setuptools import Extension
|
||||
from setuptools.command.install import install as _install
|
||||
from setuptools import Extension
|
||||
|
||||
platform_str = platform.platform()
|
||||
default_python_incdir = get_python_inc()
|
||||
|
@ -233,25 +233,25 @@ setup(name='pyeclib',
|
|||
maintainer_email='kmgreen2@gmail.com, tusharsg@gmail.com',
|
||||
url='https://opendev.org/openstack/pyeclib',
|
||||
project_urls={
|
||||
'Bug Tracker': 'https://bugs.launchpad.net/pyeclib',
|
||||
'Bug Tracker': 'https://bugs.launchpad.net/pyeclib',
|
||||
},
|
||||
description=('This library provides a simple Python interface for '
|
||||
'implementing erasure codes. To obtain the best possible '
|
||||
'performance, the underlying erasure code algorithms are '
|
||||
'written in C.'),
|
||||
classifiers=[
|
||||
"Development Status :: 5 - Production/Stable",
|
||||
"Programming Language :: Python :: 2",
|
||||
"Programming Language :: Python :: 2.7",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.5",
|
||||
"Programming Language :: Python :: 3.6",
|
||||
"Programming Language :: Python :: 3.7",
|
||||
"Programming Language :: Python :: 3.8",
|
||||
"Programming Language :: Python :: 3.9",
|
||||
"Programming Language :: Python :: 3.10",
|
||||
"Intended Audience :: Developers",
|
||||
"License :: OSI Approved :: BSD License",
|
||||
"Development Status :: 5 - Production/Stable",
|
||||
"Programming Language :: Python :: 2",
|
||||
"Programming Language :: Python :: 2.7",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.5",
|
||||
"Programming Language :: Python :: 3.6",
|
||||
"Programming Language :: Python :: 3.7",
|
||||
"Programming Language :: Python :: 3.8",
|
||||
"Programming Language :: Python :: 3.9",
|
||||
"Programming Language :: Python :: 3.10",
|
||||
"Intended Audience :: Developers",
|
||||
"License :: OSI Approved :: BSD License",
|
||||
],
|
||||
long_description=open('README.rst', 'r').read(),
|
||||
long_description_content_type='text/x-rst',
|
||||
|
|
|
@ -23,13 +23,15 @@
|
|||
|
||||
import os
|
||||
import random
|
||||
from string import ascii_letters, ascii_uppercase, digits
|
||||
import resource
|
||||
import string
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
from distutils.version import StrictVersion
|
||||
from itertools import combinations
|
||||
|
||||
import six
|
||||
|
||||
import pyeclib.ec_iface
|
||||
|
@ -40,10 +42,11 @@ from pyeclib.ec_iface import ECInsufficientFragments
|
|||
from pyeclib.ec_iface import ECInvalidFragmentMetadata
|
||||
from pyeclib.ec_iface import ECInvalidParameter
|
||||
from pyeclib.ec_iface import PyECLib_EC_Types
|
||||
|
||||
from pyeclib.ec_iface import ALL_EC_TYPES
|
||||
from pyeclib.ec_iface import VALID_EC_TYPES
|
||||
|
||||
from pyeclib.ec_iface import LIBERASURECODE_VERSION
|
||||
import resource
|
||||
|
||||
|
||||
if sys.version < '3':
|
||||
|
@ -105,7 +108,7 @@ class TestPyECLibDriver(unittest.TestCase):
|
|||
size *= 1000
|
||||
|
||||
# Create the dictionary of files to test with
|
||||
buf = ''.join(random.choice(ascii_letters) for i in range(size))
|
||||
buf = ''.join(random.choice(string.ascii_letters) for i in range(size))
|
||||
if sys.version_info >= (3,):
|
||||
buf = buf.encode('ascii')
|
||||
tmp_file = tempfile.NamedTemporaryFile()
|
||||
|
@ -364,7 +367,7 @@ class TestPyECLibDriver(unittest.TestCase):
|
|||
return
|
||||
|
||||
filesize = 1024 * 1024 * 3
|
||||
file_str = ''.join(random.choice(ascii_letters)
|
||||
file_str = ''.join(random.choice(string.ascii_letters)
|
||||
for i in range(filesize))
|
||||
file_bytes = file_str.encode('utf-8')
|
||||
|
||||
|
@ -423,7 +426,7 @@ class TestPyECLibDriver(unittest.TestCase):
|
|||
def test_verify_fragment_inline_chksum_fail(self):
|
||||
pyeclib_drivers = self.get_pyeclib_testspec("inline_crc32")
|
||||
filesize = 1024 * 1024 * 3
|
||||
file_str = ''.join(random.choice(ascii_letters)
|
||||
file_str = ''.join(random.choice(string.ascii_letters)
|
||||
for i in range(filesize))
|
||||
file_bytes = file_str.encode('utf-8')
|
||||
|
||||
|
@ -463,7 +466,7 @@ class TestPyECLibDriver(unittest.TestCase):
|
|||
pyeclib_drivers = self.get_pyeclib_testspec("inline_crc32")
|
||||
|
||||
filesize = 1024 * 1024 * 3
|
||||
file_str = ''.join(random.choice(ascii_letters)
|
||||
file_str = ''.join(random.choice(string.ascii_letters)
|
||||
for i in range(filesize))
|
||||
file_bytes = file_str.encode('utf-8')
|
||||
|
||||
|
@ -542,7 +545,7 @@ class TestPyECLibDriver(unittest.TestCase):
|
|||
# Use 2 * segment size, because last segment may be
|
||||
# greater than segment_size
|
||||
#
|
||||
char_set = ascii_uppercase + digits
|
||||
char_set = string.ascii_uppercase + string.digits
|
||||
for segment_size in segment_sizes:
|
||||
segment_strings[segment_size] = ''.join(
|
||||
random.choice(char_set) for i in range(segment_size * 2))
|
||||
|
@ -815,8 +818,10 @@ class BackendsEnabledMetaclass(type):
|
|||
|
||||
class TestBackendsEnabled(six.with_metaclass(BackendsEnabledMetaclass,
|
||||
unittest.TestCase)):
|
||||
'''Based on TestPyECLibDriver.test_valid_algo above, but these tests
|
||||
should *always* either pass or skip.'''
|
||||
'''
|
||||
Based on TestPyECLibDriver.test_valid_algo above, but these tests
|
||||
should *always* either pass or skip.
|
||||
'''
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -29,6 +29,7 @@ import time
|
|||
import unittest
|
||||
|
||||
import pyeclib_c
|
||||
|
||||
from pyeclib.ec_iface import PyECLib_EC_Types
|
||||
from pyeclib.ec_iface import VALID_EC_TYPES
|
||||
|
||||
|
|
10
tox.ini
10
tox.ini
|
@ -18,7 +18,7 @@ install_command =
|
|||
[testenv:pep8]
|
||||
skip_install = True
|
||||
deps=
|
||||
flake8
|
||||
hacking
|
||||
commands=
|
||||
flake8 pyeclib/ setup.py test/
|
||||
|
||||
|
@ -29,3 +29,11 @@ commands = {posargs}
|
|||
deps =
|
||||
-r{toxinidir}/doc/requirements.txt
|
||||
commands = python setup.py build_sphinx
|
||||
|
||||
[flake8]
|
||||
# H101: Use TODO(NAME)
|
||||
# H404: multi line docstring should start without a leading new line
|
||||
# H405: multi line docstring summary not separated with an empty line
|
||||
# W504: line break after binary operator
|
||||
ignore = H101,H404,H405,W504
|
||||
max-line-length = 88
|
||||
|
|
Loading…
Reference in New Issue