Hello community,
here is the log from the commit of package python-humanreadable for
openSUSE:Factory checked in at 2020-04-07 10:29:09
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-humanreadable (Old)
and /work/SRC/openSUSE:Factory/.python-humanreadable.new.3248 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-humanreadable"
Tue Apr 7 10:29:09 2020 rev:2 rq:791642 version:0.1.0
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-humanreadable/python-humanreadable.changes
2020-02-11 22:24:18.871531715 +0100
+++
/work/SRC/openSUSE:Factory/.python-humanreadable.new.3248/python-humanreadable.changes
2020-04-07 10:30:56.070470458 +0200
@@ -1,0 +2,8 @@
+Sat Apr 4 11:17:46 UTC 2020 - Martin Hauke <[email protected]>
+
+- Update to version 0.1.0
+ * Upstream does not provide a changelog
+- Drop support for python2
+- Adjust requirements
+
+-------------------------------------------------------------------
Old:
----
humanreadable-0.0.8.tar.gz
New:
----
humanreadable-0.1.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-humanreadable.spec ++++++
--- /var/tmp/diff_new_pack.3yDObY/_old 2020-04-07 10:30:56.754471218 +0200
+++ /var/tmp/diff_new_pack.3yDObY/_new 2020-04-07 10:30:56.754471218 +0200
@@ -1,7 +1,7 @@
#
# spec file for package python-humanreadable
#
-# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -12,28 +12,28 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
+#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
+%define skip_python2 1
Name: python-humanreadable
-Version: 0.0.8
+Version: 0.1.0
Release: 0
-License: MIT
Summary: A Python library to convert from human-readable values to
Python values
-Url: https://github.com/thombashi/humanreadable
+License: MIT
Group: Development/Languages/Python
+URL: https://github.com/thombashi/humanreadable
Source:
https://files.pythonhosted.org/packages/source/h/humanreadable/humanreadable-%{version}.tar.gz
-BuildRequires: python-rpm-macros
BuildRequires: %{python_module setuptools >= 38.3.0}
+BuildRequires: python-rpm-macros
# SECTION test requirements
-BuildRequires: %{python_module six >= 1.10.0}
-BuildRequires: %{python_module typepy >= 0.6.4}
BuildRequires: %{python_module pytest}
+BuildRequires: %{python_module typepy >= 0.6.4}
# /SECTION
BuildRequires: fdupes
Requires: python-setuptools >= 38.3.0
-Requires: python-six >= 1.10.0
Requires: python-typepy >= 0.6.4
BuildArch: noarch
%python_subpackages
++++++ humanreadable-0.0.8.tar.gz -> humanreadable-0.1.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/humanreadable-0.0.8/PKG-INFO
new/humanreadable-0.1.0/PKG-INFO
--- old/humanreadable-0.0.8/PKG-INFO 2020-01-19 03:47:46.000000000 +0100
+++ new/humanreadable-0.1.0/PKG-INFO 2020-02-23 03:42:50.887905400 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: humanreadable
-Version: 0.0.8
+Version: 0.1.0
Summary: humanreadable is a Python library to convert from human-readable
values to Python values.
Home-page: https://github.com/thombashi/humanreadable
Author: Tsuyoshi Hombashi
@@ -84,7 +84,8 @@
Set default unit
-------------------------------------------
Unit for an instance is determined by input value.
- If a valid unit not found, ``default_unit`` will be used for the
instance.
+ If a valid unit not found, ``default_unit``
+ will be used for the instance (defaults to ``None``).
:Sample Code:
.. code-block:: python
@@ -163,32 +164,29 @@
Dependencies
============================================
- Python 2.7+ or 3.5+
+ Python 3.5+
- - `six <https://pypi.org/project/six/>`__
- `typepy <https://github.com/thombashi/typepy>`__
Keywords: human-readable,converter
Platform: UNKNOWN
-Classifier: Development Status :: 3 - Alpha
+Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
-Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
+Classifier: Programming Language :: Python :: 3.9
+Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Text Processing
-Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*
+Requires-Python: >=3.5
Description-Content-Type: text/x-rst
-Provides-Extra: release
-Provides-Extra: build
Provides-Extra: test
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/humanreadable-0.0.8/README.rst
new/humanreadable-0.1.0/README.rst
--- old/humanreadable-0.0.8/README.rst 2020-01-19 03:42:24.000000000 +0100
+++ new/humanreadable-0.1.0/README.rst 2020-02-23 03:24:43.000000000 +0100
@@ -74,7 +74,8 @@
Set default unit
-------------------------------------------
Unit for an instance is determined by input value.
-If a valid unit not found, ``default_unit`` will be used for the instance.
+If a valid unit not found, ``default_unit``
+will be used for the instance (defaults to ``None``).
:Sample Code:
.. code-block:: python
@@ -153,7 +154,6 @@
Dependencies
============================================
-Python 2.7+ or 3.5+
+Python 3.5+
-- `six <https://pypi.org/project/six/>`__
- `typepy <https://github.com/thombashi/typepy>`__
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/humanreadable-0.0.8/humanreadable/__init__.py
new/humanreadable-0.1.0/humanreadable/__init__.py
--- old/humanreadable-0.0.8/humanreadable/__init__.py 2020-01-15
12:44:28.000000000 +0100
+++ new/humanreadable-0.1.0/humanreadable/__init__.py 2020-02-23
03:23:48.000000000 +0100
@@ -1,5 +1,3 @@
-# encoding: utf-8
-
from .__version__ import __author__, __copyright__, __email__, __license__,
__version__
from ._persec import BitPerSecond
from ._time import Time
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/humanreadable-0.0.8/humanreadable/__version__.py
new/humanreadable-0.1.0/humanreadable/__version__.py
--- old/humanreadable-0.0.8/humanreadable/__version__.py 2020-01-19
03:47:38.000000000 +0100
+++ new/humanreadable-0.1.0/humanreadable/__version__.py 2020-02-23
03:34:01.000000000 +0100
@@ -1,11 +1,6 @@
-# encoding: utf-8
-
-from datetime import datetime
-
-
__author__ = "Tsuyoshi Hombashi"
-__copyright__ = "Copyright {}, {}".format(datetime.now().year, __author__)
+__copyright__ = "Copyright 2019, {}".format(__author__)
__license__ = "MIT License"
-__version__ = "0.0.8"
+__version__ = "0.1.0"
__maintainer__ = __author__
__email__ = "[email protected]"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/humanreadable-0.0.8/humanreadable/_base.py
new/humanreadable-0.1.0/humanreadable/_base.py
--- old/humanreadable-0.0.8/humanreadable/_base.py 2020-01-15
12:44:29.000000000 +0100
+++ new/humanreadable-0.1.0/humanreadable/_base.py 2020-02-23
03:31:23.000000000 +0100
@@ -1,17 +1,12 @@
-# encoding: utf-8
-
"""
.. codeauthor:: Tsuyoshi Hombashi <[email protected]>
"""
-from __future__ import absolute_import, division, unicode_literals
-
import abc
import re
from decimal import Decimal
-import six
-from typepy import RealNumber
+from typepy import RealNumber, String
from .error import ParameterError, UnitNotFoundError
@@ -24,8 +19,7 @@
return ", ".join([", ".join(values) for values in text_units.values()])
[email protected]_metaclass(abc.ABCMeta)
-class HumanReadableValue(object):
+class HumanReadableValue(metaclass=abc.ABCMeta):
@abc.abstractproperty
def _text_units(self): # pragma: no cover
pass
@@ -39,34 +33,44 @@
pass
def __init__(self, readable_value, default_unit=None):
- self._readable_value = readable_value
- self._number = None
- self._from_unit = None
- self._default_unit = default_unit
- self.__preprocess()
+ self._default_unit = self._normalize_unit(default_unit)
+ self._number, self._from_unit = self.__preprocess(readable_value)
def __repr__(self):
- items = [six.text_type(self._number)]
+ items = [str(self._number)]
if self._from_unit.name:
items.append(self._from_unit.name)
return " ".join(items)
- def __split_unit(self):
- if RealNumber(self._readable_value).is_type():
+ def _normalize_unit(self, unit):
+ if unit is None:
+ return None
+
+ for u in self._text_units:
+ if u.regexp.search(unit):
+ return u
+
+ raise ValueError("unit not found: {}".format(unit))
+
+ def __split_unit(self, readable_value):
+ if RealNumber(readable_value).is_type():
if self._default_unit is None:
raise UnitNotFoundError(
"unit not found",
- value=self._readable_value,
+ value=readable_value,
available_units=_get_unit_msg(self._text_units),
)
- return (self._readable_value, self._default_unit)
+ return (readable_value, self._default_unit)
+
+ if not String(readable_value).is_type():
+ raise TypeError("readable_value must be a string")
for unit in self._units:
try:
- if unit.regexp.search(self._readable_value):
- number = unit.regexp.split(self._readable_value)[0]
+ if unit.regexp.search(readable_value):
+ number = unit.regexp.split(readable_value)[0]
if not RealNumber(number).is_type():
continue
@@ -74,23 +78,27 @@
except TypeError:
continue
- return (self._readable_value, self._default_unit)
+ raise UnitNotFoundError(
+ "unit not found", value=readable_value,
available_units=_get_unit_msg(self._text_units),
+ )
- def __preprocess(self):
- if self._readable_value is None:
+ def __preprocess(self, readable_value):
+ if readable_value is None:
raise TypeError("readable_value must be a string")
- readable_num, self._from_unit = self.__split_unit()
- if readable_num is not None:
- self._number = self.__to_number(readable_num)
+ number, from_unit = self.__split_unit(readable_value)
+ if number is not None:
+ number = self.__to_number(number)
- if self._from_unit is None:
+ if from_unit is None:
raise UnitNotFoundError(
"unit not found",
- value=self._readable_value,
+ value=readable_value,
available_units=_get_unit_msg(self._text_units),
)
+ return (number, from_unit)
+
def __to_number(self, readable_num):
match = _RE_NUMBER.search(readable_num)
if not match:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/humanreadable-0.0.8/humanreadable/_persec.py
new/humanreadable-0.1.0/humanreadable/_persec.py
--- old/humanreadable-0.0.8/humanreadable/_persec.py 2020-01-15
12:44:29.000000000 +0100
+++ new/humanreadable-0.1.0/humanreadable/_persec.py 2020-02-23
03:29:07.000000000 +0100
@@ -1,11 +1,7 @@
-# encoding: utf-8
-
"""
.. codeauthor:: Tsuyoshi Hombashi <[email protected]>
"""
-from __future__ import absolute_import, division, unicode_literals
-
import re
from collections import OrderedDict, namedtuple
from decimal import Decimal
@@ -38,7 +34,7 @@
Human readable size (bit per second). e.g. 256 Mbps
"""
- class Unit(object):
+ class Unit:
BPS = ByteUnit(
name="bps",
regexp=re.compile(
@@ -114,7 +110,6 @@
_TEXT_UNITS = OrderedDict(
{
- Unit.BPS: _BPS_STR_UNITS,
Unit.KBPS: _KBPS_STR_UNITS,
Unit.KIBPS: _KIBPS_STR_UNITS,
Unit.MBPS: _MBPS_STR_UNITS,
@@ -123,6 +118,7 @@
Unit.GIBPS: _GIBPS_STR_UNITS,
Unit.TBPS: _TBPS_STR_UNITS,
Unit.TIBPS: _TIBPS_STR_UNITS,
+ Unit.BPS: _BPS_STR_UNITS,
}
)
@@ -250,9 +246,16 @@
self.Unit.TBPS: "tera_bps",
self.Unit.TIBPS: "tebi_bps",
}
+ unit = self._normalize_unit(unit)
return getattr(self, unit_maps[unit])
+ def _normalize_unit(self, unit):
+ if isinstance(unit, ByteUnit):
+ return unit
+
+ return super()._normalize_unit(unit)
+
def __calc_coef(self, from_unit, to_unit):
if from_unit.kilo_size == to_unit.kilo_size:
return Decimal(from_unit.kilo_size ** (from_unit.factor -
to_unit.factor))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/humanreadable-0.0.8/humanreadable/_time.py
new/humanreadable-0.1.0/humanreadable/_time.py
--- old/humanreadable-0.0.8/humanreadable/_time.py 2020-01-15
12:44:29.000000000 +0100
+++ new/humanreadable-0.1.0/humanreadable/_time.py 2020-02-23
03:29:17.000000000 +0100
@@ -1,11 +1,7 @@
-# encoding: utf-8
-
"""
.. codeauthor:: Tsuyoshi Hombashi <[email protected]>
"""
-from __future__ import absolute_import, division, unicode_literals
-
import re
from collections import OrderedDict, namedtuple
from decimal import Decimal
@@ -30,7 +26,7 @@
class Time(HumanReadableValue):
- class Unit(object):
+ class Unit:
DAY = TimeUnit(
name="days",
regexp=re.compile(
@@ -194,9 +190,16 @@
self.Unit.MILLISECOND: "milliseconds",
self.Unit.MICROSECOND: "microseconds",
}
+ unit = self._normalize_unit(unit)
return getattr(self, unit_maps[unit])
+ def _normalize_unit(self, unit):
+ if isinstance(unit, TimeUnit):
+ return unit
+
+ return super()._normalize_unit(unit)
+
def __calc_coef(self, from_unit, to_unit):
thousand_coef = Decimal(1000 ** (to_unit.thousand_factor -
from_unit.thousand_factor))
sixty_coef = Decimal(60 ** (to_unit.sixty_factor -
from_unit.sixty_factor))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/humanreadable-0.0.8/humanreadable/error.py
new/humanreadable-0.1.0/humanreadable/error.py
--- old/humanreadable-0.0.8/humanreadable/error.py 2019-10-13
10:11:51.000000000 +0200
+++ new/humanreadable-0.1.0/humanreadable/error.py 2020-02-23
03:31:57.000000000 +0100
@@ -1,11 +1,7 @@
-# encoding: utf-8
-
"""
.. codeauthor:: Tsuyoshi Hombashi <[email protected]>
"""
-from __future__ import absolute_import, unicode_literals
-
class ParameterError(ValueError):
"""
@@ -16,10 +12,10 @@
self.__value = kwargs.pop("value", None)
self.__expected = kwargs.pop("expected", None)
- super(ParameterError, self).__init__(*args, **kwargs)
+ super().__init__(*args, **kwargs)
def __str__(self, *args, **kwargs):
- item_list = [ValueError.__str__(self, *args, **kwargs)]
+ item_list = [ValueError.__str__(self)]
extra_msg_list = self._get_extra_msgs()
if extra_msg_list:
@@ -46,7 +42,7 @@
def __init__(self, *args, **kwargs):
self.__available_units = kwargs.pop("available_units", None)
- super(UnitNotFoundError, self).__init__(*args, **kwargs)
+ super().__init__(*args, **kwargs)
def _get_extra_msgs(self):
extra_msg_list = []
@@ -54,4 +50,4 @@
if self.__available_units:
extra_msg_list.append("available-units={}".format(self.__available_units))
- return super(UnitNotFoundError, self)._get_extra_msgs() +
extra_msg_list
+ return super()._get_extra_msgs() + extra_msg_list
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/humanreadable-0.0.8/humanreadable.egg-info/PKG-INFO
new/humanreadable-0.1.0/humanreadable.egg-info/PKG-INFO
--- old/humanreadable-0.0.8/humanreadable.egg-info/PKG-INFO 2020-01-19
03:47:46.000000000 +0100
+++ new/humanreadable-0.1.0/humanreadable.egg-info/PKG-INFO 2020-02-23
03:42:50.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: humanreadable
-Version: 0.0.8
+Version: 0.1.0
Summary: humanreadable is a Python library to convert from human-readable
values to Python values.
Home-page: https://github.com/thombashi/humanreadable
Author: Tsuyoshi Hombashi
@@ -84,7 +84,8 @@
Set default unit
-------------------------------------------
Unit for an instance is determined by input value.
- If a valid unit not found, ``default_unit`` will be used for the
instance.
+ If a valid unit not found, ``default_unit``
+ will be used for the instance (defaults to ``None``).
:Sample Code:
.. code-block:: python
@@ -163,32 +164,29 @@
Dependencies
============================================
- Python 2.7+ or 3.5+
+ Python 3.5+
- - `six <https://pypi.org/project/six/>`__
- `typepy <https://github.com/thombashi/typepy>`__
Keywords: human-readable,converter
Platform: UNKNOWN
-Classifier: Development Status :: 3 - Alpha
+Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
-Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
+Classifier: Programming Language :: Python :: 3.9
+Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Text Processing
-Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*
+Requires-Python: >=3.5
Description-Content-Type: text/x-rst
-Provides-Extra: release
-Provides-Extra: build
Provides-Extra: test
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/humanreadable-0.0.8/humanreadable.egg-info/SOURCES.txt
new/humanreadable-0.1.0/humanreadable.egg-info/SOURCES.txt
--- old/humanreadable-0.0.8/humanreadable.egg-info/SOURCES.txt 2020-01-19
03:47:46.000000000 +0100
+++ new/humanreadable-0.1.0/humanreadable.egg-info/SOURCES.txt 2020-02-23
03:42:50.000000000 +0100
@@ -2,7 +2,6 @@
MANIFEST.in
README.rst
pyproject.toml
-setup.cfg
setup.py
tox.ini
humanreadable/__init__.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/humanreadable-0.0.8/humanreadable.egg-info/requires.txt
new/humanreadable-0.1.0/humanreadable.egg-info/requires.txt
--- old/humanreadable-0.0.8/humanreadable.egg-info/requires.txt 2020-01-19
03:47:46.000000000 +0100
+++ new/humanreadable-0.1.0/humanreadable.egg-info/requires.txt 2020-02-23
03:42:50.000000000 +0100
@@ -1,13 +1,4 @@
-setuptools>=38.3.0
-six<2,>=1.10.0
typepy<2,>=0.6.4
-[build]
-twine
-wheel
-
-[release]
-releasecmd<1,>=0.2.0
-
[test]
pytest
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/humanreadable-0.0.8/requirements/requirements.txt
new/humanreadable-0.1.0/requirements/requirements.txt
--- old/humanreadable-0.0.8/requirements/requirements.txt 2020-01-15
12:45:03.000000000 +0100
+++ new/humanreadable-0.1.0/requirements/requirements.txt 2020-02-23
03:24:35.000000000 +0100
@@ -1,2 +1 @@
-six>=1.10.0,<2
typepy>=0.6.4,<2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/humanreadable-0.0.8/setup.cfg
new/humanreadable-0.1.0/setup.cfg
--- old/humanreadable-0.0.8/setup.cfg 2020-01-19 03:47:46.000000000 +0100
+++ new/humanreadable-0.1.0/setup.cfg 2020-02-23 03:42:50.887905400 +0100
@@ -1,9 +1,3 @@
-[aliases]
-test = pytest
-
-[bdist_wheel]
-universal = 1
-
[egg_info]
tag_build =
tag_date = 0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/humanreadable-0.0.8/setup.py
new/humanreadable-0.1.0/setup.py
--- old/humanreadable-0.0.8/setup.py 2020-01-19 03:41:47.000000000 +0100
+++ new/humanreadable-0.1.0/setup.py 2020-02-23 03:39:00.000000000 +0100
@@ -1,10 +1,4 @@
-# encoding: utf-8
-
-from __future__ import unicode_literals
-
-import io
import os.path
-import sys
import setuptools
@@ -17,10 +11,6 @@
pkg_info = {}
-def need_pytest():
- return set(["pytest", "test", "ptr"]).intersection(sys.argv)
-
-
def get_release_command_class():
try:
from releasecmd import ReleaseCommand
@@ -33,7 +23,7 @@
with open(os.path.join(MODULE_NAME, "__version__.py")) as f:
exec(f.read(), pkg_info)
-with io.open("README.rst", encoding=ENCODING) as f:
+with open("README.rst", encoding=ENCODING) as f:
LONG_DESCRIPTION = f.read()
with open(os.path.join(REQUIREMENT_DIR, "requirements.txt")) as f:
@@ -42,10 +32,6 @@
with open(os.path.join(REQUIREMENT_DIR, "test_requirements.txt")) as f:
TESTS_REQUIRES = [line.strip() for line in f if line.strip()]
-SETUPTOOLS_REQUIRES = ["setuptools>=38.3.0"]
-PYTEST_RUNNER_REQUIRES = ["pytest-runner"] if need_pytest() else []
-
-cmdclass = get_release_command_class()
setuptools.setup(
name=MODULE_NAME,
@@ -63,33 +49,27 @@
long_description_content_type="text/x-rst",
packages=setuptools.find_packages(exclude=["test*"]),
project_urls={"Source": REPOSITORY_URL, "Tracker":
"{:s}/issues".format(REPOSITORY_URL),},
- python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*",
- install_requires=SETUPTOOLS_REQUIRES + INSTALL_REQUIRES,
- setup_requires=SETUPTOOLS_REQUIRES + PYTEST_RUNNER_REQUIRES,
- tests_require=TESTS_REQUIRES,
- extras_require={
- "build": ["twine", "wheel"],
- "release": ["releasecmd>=0.2.0,<1"],
- "test": TESTS_REQUIRES,
- },
+ python_requires=">=3.5",
+ install_requires=INSTALL_REQUIRES,
+ extras_require={"test": TESTS_REQUIRES},
classifiers=[
- "Development Status :: 3 - Alpha",
+ "Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
- "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 :: Only",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Text Processing",
],
- cmdclass=cmdclass,
+ cmdclass=get_release_command_class(),
)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/humanreadable-0.0.8/test/test_persec.py
new/humanreadable-0.1.0/test/test_persec.py
--- old/humanreadable-0.0.8/test/test_persec.py 2020-01-19 03:27:56.000000000
+0100
+++ new/humanreadable-0.1.0/test/test_persec.py 2020-02-23 03:31:45.000000000
+0100
@@ -1,16 +1,11 @@
-# encoding: utf-8
-
"""
.. codeauthor:: Tsuyoshi Hombashi <[email protected]>
"""
-from __future__ import division, print_function, unicode_literals
-
import sys
from decimal import Decimal
import pytest
-from six import text_type
from humanreadable import BitPerSecond, ParameterError, UnitNotFoundError
@@ -25,7 +20,7 @@
TEBI = Decimal(1024 ** 4)
-class Test_BitPerSecond_constructor(object):
+class Test_BitPerSecond_constructor:
@pytest.mark.parametrize(
["value", "exception"],
[
@@ -40,6 +35,7 @@
["-2m", ParameterError],
["2m", ParameterError],
["2ms", ParameterError],
+ ["two Gbps", ParameterError],
],
)
def test_exception(self, value, exception):
@@ -47,13 +43,13 @@
BitPerSecond(value).bps
-class Test_BitPerSecond_repr(object):
+class Test_BitPerSecond_repr:
@pytest.mark.parametrize(["value", "expected"], [["2 Kbps", "2 Kbps"]])
def test_exception(self, value, expected):
- assert text_type(BitPerSecond(value)) == expected
+ assert str(BitPerSecond(value)) == expected
-class Test_eq(object):
+class Test_eq:
@pytest.mark.parametrize(
["lhs", "rhs", "expected"],
[["5 bps", "5.0 bit/s", True], ["60000bps", "60 Kbps", True], ["1
bps", "2 bps", False]],
@@ -62,7 +58,7 @@
assert (BitPerSecond(lhs) == BitPerSecond(rhs)) is expected
-class Test_less_than(object):
+class Test_less_than:
@pytest.mark.parametrize(
["lhs", "rhs", "expected"],
[["20 Gbps", "32Gbps", True], ["20 Gibps", "32Gbps", True], ["40
Gibps", "32Gbps", False]],
@@ -77,7 +73,7 @@
assert (lhs <= rhs) is expected
-class Test_BitPerSecond_bps(object):
+class Test_BitPerSecond_bps:
@pytest.mark.parametrize(
["value", "expected"],
[
@@ -104,7 +100,7 @@
assert value.byte_per_sec == value.bps / 8
-class Test_BitPerSecond_kbps(object):
+class Test_BitPerSecond_kbps:
@pytest.mark.parametrize(
["value", "expected"],
[
@@ -142,8 +138,23 @@
assert value.kibi_bps == expected
assert value.kibi_byte_per_sec == value.kibi_bps / 8
+ @pytest.mark.parametrize(
+ ["value", "default_unit", "expected"],
+ [
+ ["2", BitPerSecond.Unit.KBPS, 2],
+ ["2", "kbps", 2],
+ ["2", BitPerSecond.Unit.MBPS, 2000],
+ ["2", "mbps", 2000],
+ ],
+ )
+ def test_normal_default_unit(self, value, default_unit, expected):
+ bps = BitPerSecond(value, default_unit=default_unit)
+ print(bps, file=sys.stderr)
+
+ assert bps.kilo_bps == expected
-class Test_BitPerSecond_mbps(object):
+
+class Test_BitPerSecond_mbps:
@pytest.mark.parametrize(
["value", "expected"],
[
@@ -182,7 +193,7 @@
assert value.mebi_byte_per_sec == value.mebi_bps / 8
-class Test_BitPerSecond_gbps(object):
+class Test_BitPerSecond_gbps:
@pytest.mark.parametrize(
["value", "expected"],
[
@@ -221,7 +232,7 @@
assert value.gibi_byte_per_sec == value.gibi_bps / 8
-class Test_BitPerSecond_tbps(object):
+class Test_BitPerSecond_tbps:
@pytest.mark.parametrize(
["value", "expected"],
[
@@ -260,7 +271,7 @@
assert value.tebi_byte_per_sec == value.tebi_bps / 8
-class Test_Time_get_as(object):
+class Test_Time_get_as:
@pytest.mark.parametrize(
["value", "default_unit", "expected"],
[
@@ -270,10 +281,15 @@
["2Mbps", BitPerSecond.Unit.MBPS, 2],
["2Mibps", BitPerSecond.Unit.MIBPS, 2],
["2Gbps", BitPerSecond.Unit.GBPS, 2],
+ ["2Gbps", "gbps", 2],
["2Gibps", BitPerSecond.Unit.GIBPS, 2],
["2Tbps", BitPerSecond.Unit.TBPS, 2],
+ ["2Tbps", "tbps", 2],
["2Tibps", BitPerSecond.Unit.TIBPS, 2],
],
)
def test_normal_default_unit(self, value, default_unit, expected):
- assert BitPerSecond(value,
default_unit=default_unit).get_as(default_unit) == expected
+ bps = BitPerSecond(value, default_unit=default_unit)
+ print(bps, file=sys.stderr)
+
+ assert bps.get_as(default_unit) == expected
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/humanreadable-0.0.8/test/test_time.py
new/humanreadable-0.1.0/test/test_time.py
--- old/humanreadable-0.0.8/test/test_time.py 2020-01-19 03:27:56.000000000
+0100
+++ new/humanreadable-0.1.0/test/test_time.py 2020-02-23 03:31:52.000000000
+0100
@@ -1,18 +1,13 @@
-# encoding: utf-8
-
"""
.. codeauthor:: Tsuyoshi Hombashi <[email protected]>
"""
-from __future__ import division
-
import pytest
-from six import text_type
from humanreadable import ParameterError, Time
-class Test_constructor(object):
+class Test_constructor:
@pytest.mark.parametrize(
["value", "exception"],
[
@@ -24,6 +19,7 @@
["1k0 ", ParameterError],
["10kb", ParameterError],
["2micro", ParameterError],
+ ["two secs", ParameterError],
],
)
def test_exception(self, value, exception):
@@ -31,13 +27,13 @@
Time(value)
-class Test_repr(object):
+class Test_repr:
@pytest.mark.parametrize(["value", "expected"], [["5seconds", "5
seconds"]])
def test_exception(self, value, expected):
- assert text_type(Time(value)) == expected
+ assert str(Time(value)) == expected
-class Test_eq(object):
+class Test_eq:
@pytest.mark.parametrize(
["lhs", "rhs", "expected"],
[["5seconds", "5.0 sec", True], ["60000ms", "1min", True], ["1 sec",
"2 sec", False]],
@@ -46,13 +42,13 @@
assert (Time(lhs) == Time(rhs)) is expected
-class Test_Time_days(object):
+class Test_Time_days:
@pytest.mark.parametrize(["value", "expected"], [["12hours", 0.5],
["1day", 1], ["3 days", 3]])
def test_normal(self, value, expected):
assert Time(value).days == expected
-class Test_Time_hours(object):
+class Test_Time_hours:
@pytest.mark.parametrize(
["value", "expected"],
[["3600 seconds", 1], ["30minutes", 0.5], ["2hours", 2], ["1day", 24],
["3 days", 72]],
@@ -61,7 +57,7 @@
assert Time(value).hours == expected
-class Test_Time_minutes(object):
+class Test_Time_minutes:
@pytest.mark.parametrize(
["value", "expected"], [["30 seconds", 0.5], ["60000ms", 1], ["1m",
1], ["2hour", 120]]
)
@@ -69,7 +65,7 @@
assert Time(value).minutes == expected
-class Test_Time_seconds(object):
+class Test_Time_seconds:
@pytest.mark.parametrize(
["value", "expected"],
[
@@ -85,8 +81,20 @@
def test_normal(self, value, expected):
assert Time(value).seconds == expected
+ @pytest.mark.parametrize(
+ ["value", "default_unit", "expected"],
+ [
+ ["2", Time.Unit.SECOND, 2],
+ ["2", "seconds", 2],
+ ["2", Time.Unit.MINUTE, 120],
+ ["2", "minutes", 120],
+ ],
+ )
+ def test_normal_default_unit(self, value, default_unit, expected):
+ assert Time(value, default_unit=default_unit).seconds == expected
+
-class Test_Time_milliseconds(object):
+class Test_Time_milliseconds:
@pytest.mark.parametrize(
["value", "expected"],
[
@@ -109,7 +117,7 @@
assert Time(value).milliseconds == expected
-class Test_Time_microseconds(object):
+class Test_Time_microseconds:
@pytest.mark.parametrize(
["value", "expected"],
[
@@ -124,7 +132,7 @@
assert Time(value).microseconds == expected
-class Test_Time_validate(object):
+class Test_Time_validate:
@pytest.mark.parametrize(
["value", "min_value", "max_value"],
[
@@ -154,11 +162,12 @@
Time(value).validate(min_value=min_value, max_value=max_value)
-class Test_Time_get_as(object):
+class Test_Time_get_as:
@pytest.mark.parametrize(
["value", "default_unit", "expected"],
[
["2", Time.Unit.DAY, 2],
+ ["2", "day", 2],
["2", Time.Unit.HOUR, 2],
["2", Time.Unit.MINUTE, 2],
["2", Time.Unit.SECOND, 2],
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/humanreadable-0.0.8/tox.ini
new/humanreadable-0.1.0/tox.ini
--- old/humanreadable-0.0.8/tox.ini 2020-01-19 03:39:02.000000000 +0100
+++ new/humanreadable-0.1.0/tox.ini 2020-02-23 03:27:28.000000000 +0100
@@ -1,45 +1,71 @@
[tox]
envlist =
- py{27,35,36,37,38}
+ py{35,36,37,38,39}
pypy3
+ build
+ clean
cov
fmt
lint
+ release
[testenv]
deps =
.[test]
commands =
- python setup.py test
+ pytest {posargs}
+
+[testenv:build]
+basepython = python3.8
+deps =
+ twine
+ wheel
+commands =
+ python setup.py sdist bdist_wheel
+ twine check dist/*
+ python setup.py clean --all
+
+[testenv:clean]
+basepython = python3.8
+deps =
+ cleanpy
+commands =
+ cleanpy --all .
[testenv:cov]
-basepython = python3.7
deps =
.[test]
coverage[toml]
pytest-cov
commands =
- python setup.py test --addopts "-vv --cov"
+ pytest --cov {posargs:-vv}
[testenv:fmt]
basepython = python3.8
deps =
autoflake
black
- isort
+ isort[pyproject]
commands =
black setup.py examples test humanreadable
autoflake --in-place --recursive --remove-all-unused-imports
--ignore-init-module-imports .
isort --apply --recursive
[testenv:lint]
-basepython = python3.5
+basepython = python3.7
deps =
codespell
pylama
pytype
commands =
python setup.py check
- pytype humanreadable
+ pytype --keep-going --jobs 2 --disable import-error humanreadable
codespell humanreadable examples test -q2 --check-filenames
pylama
+
+[testenv:release]
+basepython = python3.8
+deps =
+ releasecmd>=0.2.0
+commands =
+ python setup.py release --sign {posargs}