Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- dependencies: python python3-build twine
task: make -f Makefile package
runs-on: ubuntu-latest
container: fedora:42 # CURRENT DEVELOPMENT ENVIRONMENT
container: fedora:43 # CURRENT DEVELOPMENT ENVIRONMENT
steps:
- uses: actions/checkout@v6
with:
Expand All @@ -62,7 +62,7 @@ jobs:
python3-justbases
task: PYTHONPATH=./src make -f Makefile test
runs-on: ubuntu-latest
container: fedora:42 # CURRENT DEVELOPMENT ENVIRONMENT
container: fedora:43 # CURRENT DEVELOPMENT ENVIRONMENT
steps:
- name: Install python3.12
run: >
Expand Down
122 changes: 61 additions & 61 deletions src/justbytes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,67 +15,67 @@
#
# Red Hat Author(s): Anne Mulhern <amulhern@redhat.com>

""" The public interface of the justbytes package.

Contents:

* Unit constants in SI and binary units
- Universal:
* B

- SI:
* KB
* MB
* GB
* TB
* PB
* EB
* ZB
* YB

- Binary:
* KiB
* MiB
* GiB
* TiB
* PiB
* EiB
* ZiB
* YiB

- UNITS: :func:`._constants.UNITS`

* Rounding constants, with meaning as for the Python decimal module:
- ROUND_DOWN
- ROUND_HALF_DOWN
- ROUND_HALF_UP
- ROUND_UP

- ROUNDING_METHODS

* Configuration classes:
- StrConfig: :class:`._config.StrConfig`

* Exception classes:
- RangeError: :class:`._errors.RangeError`
- RangeValueError: :class:`._errors.RangeValueError`

* Range classes:
- Range: :class:`._size.Range`
- AI: :class:`._sizes.AI`

All parts of the public interface of justbytes must be imported directly
from the top-level justbytes module, as::

from justbytes import Range
from justbytes import KiB
from justbytes import RangeError

s = Range(24, KiB)
try:
s + 32
except RangeError as e:
raise e
"""The public interface of the justbytes package.

Contents:

* Unit constants in SI and binary units
- Universal:
* B

- SI:
* KB
* MB
* GB
* TB
* PB
* EB
* ZB
* YB

- Binary:
* KiB
* MiB
* GiB
* TiB
* PiB
* EiB
* ZiB
* YiB

- UNITS: :func:`._constants.UNITS`

* Rounding constants, with meaning as for the Python decimal module:
- ROUND_DOWN
- ROUND_HALF_DOWN
- ROUND_HALF_UP
- ROUND_UP

- ROUNDING_METHODS

* Configuration classes:
- StrConfig: :class:`._config.StrConfig`

* Exception classes:
- RangeError: :class:`._errors.RangeError`
- RangeValueError: :class:`._errors.RangeValueError`

* Range classes:
- Range: :class:`._size.Range`
- AI: :class:`._sizes.AI`

All parts of the public interface of justbytes must be imported directly
from the top-level justbytes module, as::

from justbytes import Range
from justbytes import KiB
from justbytes import RangeError

s = Range(24, KiB)
try:
s + 32
except RangeError as e:
raise e
"""
# pylint: disable=invalid-name
# pylint: disable=wrong-import-position
Expand Down
2 changes: 1 addition & 1 deletion src/justbytes/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#
# Red Hat Author(s): Anne Mulhern <amulhern@redhat.com>

""" Configuration of the justbytes package. """
"""Configuration of the justbytes package."""

# pylint: disable=invalid-name

Expand Down
8 changes: 4 additions & 4 deletions src/justbytes/_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
#
# Red Hat Author(s): Anne Mulhern <amulhern@redhat.com>

""" Constants used by the justbytes package.
"""Constants used by the justbytes package.

Categories of constants:
* Rounding methods
* Size units, e.g., Ki, Mi
Categories of constants:
* Rounding methods
* Size units, e.g., Ki, Mi
"""

# isort: STDLIB
Expand Down
2 changes: 1 addition & 1 deletion src/justbytes/_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#
# Red Hat Author(s): Anne Mulhern <amulhern@redhat.com>

""" Exception types used by the justbytes class. """
"""Exception types used by the justbytes class."""

# isort: STDLIB
import abc
Expand Down
2 changes: 1 addition & 1 deletion src/justbytes/_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#
# Red Hat Author(s): Anne Mulhern <amulhern@redhat.com>

""" Special purpose generators. """
"""Special purpose generators."""


def takeuntil(pred, seq):
Expand Down
12 changes: 6 additions & 6 deletions src/justbytes/_size.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
#
# Red Hat Author(s): Anne Mulhern <amulhern@redhat.com>

""" Range class, for creating instances of Range objects.
"""Range class, for creating instances of Range objects.

Contains a few documented methods and a number of __*__ methods
implementing arithmetic operations. Precise numeric types
such as int and Fraction may also occur in some arithmetic expressions,
but all occurrences of floating point and Decimal numbers in arithmetic
expressions will cause an exception to be raised.
Contains a few documented methods and a number of __*__ methods
implementing arithmetic operations. Precise numeric types
such as int and Fraction may also occur in some arithmetic expressions,
but all occurrences of floating point and Decimal numbers in arithmetic
expressions will cause an exception to be raised.
"""

# isort: STDLIB
Expand Down
2 changes: 1 addition & 1 deletion src/justbytes/_sizes.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#
# Red Hat Author(s): Anne Mulhern <amulhern@redhat.com>

""" Class for methods that do not properly belong in the Range class. """
"""Class for methods that do not properly belong in the Range class."""
from ._size import Range

AI = Range(0) # pragma: no cover
8 changes: 4 additions & 4 deletions src/justbytes/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
# Red Hat Author(s): Anne Mulhern <amulhern@redhat.com>

"""
justbytes.version
=================
justbytes.version
=================

Version information.
Version information.

.. moduleauthor:: mulhern <amulhern@redhat.com>
.. moduleauthor:: mulhern <amulhern@redhat.com>
"""

__version__ = "0.15.2"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_deterministic/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#
# Red Hat Author(s): Anne Mulhern <amulhern@redhat.com>

""" Test for configuration classes. """
"""Test for configuration classes."""
# isort: STDLIB
import unittest

Expand Down
2 changes: 1 addition & 1 deletion tests/test_deterministic/test_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#
# Red Hat Author(s): Anne Mulhern <amulhern@redhat.com>

""" Test for constants classes. """
"""Test for constants classes."""
# isort: STDLIB
import unittest

Expand Down
2 changes: 1 addition & 1 deletion tests/test_deterministic/test_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#
# Red Hat Author(s): Anne Mulhern <amulhern@redhat.com>

""" Test for error classes. """
"""Test for error classes."""
# isort: STDLIB
import unittest

Expand Down
2 changes: 1 addition & 1 deletion tests/test_deterministic/test_size/test_conversions.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#
# Red Hat Author(s): Anne Mulhern <amulhern@redhat.com>

""" Tests for operations on Range objects. """
"""Tests for operations on Range objects."""

# isort: STDLIB
import copy
Expand Down
2 changes: 1 addition & 1 deletion tests/test_deterministic/test_size/test_initializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#
# Red Hat Author(s): Anne Mulhern <amulhern@redhat.com>

""" Tests for Range initialization. """
"""Tests for Range initialization."""

# isort: STDLIB
import unittest
Expand Down
2 changes: 1 addition & 1 deletion tests/test_deterministic/test_size/test_named.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#
# Red Hat Author(s): Anne Mulhern <amulhern@redhat.com>

""" Tests for named methods of Range objects. """
"""Tests for named methods of Range objects."""

# isort: STDLIB
import unittest
Expand Down
2 changes: 1 addition & 1 deletion tests/test_deterministic/test_size/test_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#
# Red Hat Author(s): Anne Mulhern <amulhern@redhat.com>

""" Tests for operations on Range objects. """
"""Tests for operations on Range objects."""

# isort: STDLIB
import unittest
Expand Down
2 changes: 1 addition & 1 deletion tests/test_deterministic/test_size/test_size.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#
# Red Hat Author(s): Anne Mulhern <amulhern@redhat.com>

""" Tests for behavior of Range objects. """
"""Tests for behavior of Range objects."""

# isort: STDLIB
import unittest
Expand Down
2 changes: 1 addition & 1 deletion tests/test_deterministic/test_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#
# Red Hat Author(s): Anne Mulhern <amulhern@redhat.com>

""" Test for version information. """
"""Test for version information."""
# isort: STDLIB
import unittest

Expand Down
2 changes: 1 addition & 1 deletion tests/test_hypothesis/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#
# Red Hat Author(s): Anne Mulhern <amulhern@redhat.com>

""" Test for configuration classes. """
"""Test for configuration classes."""
# isort: STDLIB
import unittest

Expand Down
2 changes: 1 addition & 1 deletion tests/test_hypothesis/test_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#
# Red Hat Author(s): Anne Mulhern <amulhern@redhat.com>

""" Test for constants classes. """
"""Test for constants classes."""
# isort: STDLIB
import unittest

Expand Down
2 changes: 1 addition & 1 deletion tests/test_hypothesis/test_size/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
""" Tests on the _size module. """
"""Tests on the _size module."""
2 changes: 1 addition & 1 deletion tests/test_hypothesis/test_size/test_conversions.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#
# Red Hat Author(s): Anne Mulhern <amulhern@redhat.com>

""" Tests for operations on Range objects. """
"""Tests for operations on Range objects."""

# isort: STDLIB
import unittest
Expand Down
2 changes: 1 addition & 1 deletion tests/test_hypothesis/test_size/test_initializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#
# Red Hat Author(s): Anne Mulhern <amulhern@redhat.com>

""" Tests for Range initialization. """
"""Tests for Range initialization."""

# isort: STDLIB
import unittest
Expand Down
4 changes: 2 additions & 2 deletions tests/test_hypothesis/test_size/test_named.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#
# Red Hat Author(s): Anne Mulhern <amulhern@redhat.com>

""" Tests for named methods of Range objects. """
"""Tests for named methods of Range objects."""

# isort: STDLIB
import string
Expand Down Expand Up @@ -185,7 +185,7 @@ def test_bounds(self, size, unit, rounding, bounds):
"""
(lower, upper) = bounds
assume(lower is None or upper is None or lower <= upper)
rounded = size.roundTo(unit, rounding, bounds)
rounded = size.roundTo(unit, rounding, bounds) # pylint: disable=unreachable
self.assertTrue(lower is None or lower <= rounded)
self.assertTrue(upper is None or upper >= rounded)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_hypothesis/test_size/test_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#
# Red Hat Author(s): Anne Mulhern <amulhern@redhat.com>

""" Tests for operations on Range objects. """
"""Tests for operations on Range objects."""

# isort: STDLIB
import copy
Expand Down
2 changes: 1 addition & 1 deletion tests/test_hypothesis/test_size/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#
# Red Hat Author(s): Anne Mulhern <amulhern@redhat.com>

""" Utilities for testing. """
"""Utilities for testing."""
# isort: THIRDPARTY
from hypothesis import strategies

Expand Down
Loading