Skip to content

Commit

Permalink
0.10.5 (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
dargueta committed Nov 20, 2021
1 parent 00d9185 commit d2d8ce2
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.10.4
current_version = 0.10.5
commit = True
tag = False
tag_name = {new_version}
Expand Down
2 changes: 1 addition & 1 deletion binobj/__init__.py
Expand Up @@ -14,5 +14,5 @@ def __to_version_info():


# Do not modify directly; use ``bumpversion`` command instead.
__version__ = "0.10.4"
__version__ = "0.10.5"
__version_info__ = __to_version_info()
11 changes: 10 additions & 1 deletion binobj/fields/base.py
Expand Up @@ -349,17 +349,26 @@ def compute_value_for_dump(
# FIXME (dargueta): Don't pass None for the context variable.
if not self.present(all_values, None, None):
return NOT_PRESENT

if self.name in all_values:
# The value is already set in the struct so we don't need to do anything.
return typing.cast(Optional[T], all_values[self.name])

# The value is *not* set in the struct. Either this field must have a default
# value, or it must be a computed field.
if self._default is not UNDEFINED:
# Theoretically if self._default is a callable that returns UNDEFINED we
# could run into trouble here. Get the return value.
to_return = self.default
if to_return is not UNDEFINED:
return to_return

# If we get here then _default is UNDEFINED or the callable it's set to returned
# UNDEFINED.
if self._compute_fn is not None:
return self._compute_fn(self, all_values)

# No default value and this isn't a computed field either.
raise errors.MissingRequiredValueError(field=self)

def computes(self, method: Callable[["Field[T]", StrDict], Optional[T]]) -> None:
Expand Down Expand Up @@ -471,7 +480,7 @@ def _size_for_value(self, value: Optional[T]) -> Optional[int]:
return typing.cast(int, self._size)
return None

def _get_expected_size(self, field_values: StrDict) -> int:
def _get_expected_size(self, field_values: StrDict) -> int: # pragma: no cover
"""Compatibility shim -- this function was made public in 0.9.0."""
warnings.warn(
"_get_expected_size was made public in 0.9.0. The private form has been"
Expand Down
27 changes: 27 additions & 0 deletions docs/source/CHANGELOG.rst
@@ -1,6 +1,33 @@
Changelog
=========

0.10.5
------

Released 2021-11-20

Bugfixes
~~~~~~~~

Installation breaks on Python 3.5 due to `this bug`_ in more-itertools. I've
put a new upper bound on that dependency (only on 3.5) to fix this.

Other Changes
~~~~~~~~~~~~~

Loosened upper bound on the ``typing-inspect`` dependency to allow the latest
versions.

Internal Changes
~~~~~~~~~~~~~~~~

* Bumped test dependencies.
* Fixed Tox envs for linting and type checking, which were silently broken.
* Added some more code comments.


.. _this bug: https://github.com/more-itertools/more-itertools/issues/578

0.10.4
------

Expand Down
4 changes: 2 additions & 2 deletions docs/source/conf.py
Expand Up @@ -66,9 +66,9 @@
# built documents.
#
# The short X.Y version.
version = "0.10.4"
version = "0.10.5"
# The full version, including alpha/beta/rc tags.
release = "0.10.4"
release = "0.10.5"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
20 changes: 12 additions & 8 deletions lint-requirements.txt
@@ -1,25 +1,29 @@
# For reproducibility please pin all direct dependencies as tightly as possible,
# down to the patch version.
black==21.8b0
flake8==3.9.2
black==21.11b1
flake8==4.0.1
flake8-black==0.2.3
flake8-blind-except==0.2.0
flake8-bugbear==21.4.3
flake8-comprehensions==3.6.1
flake8-bugbear==21.9.2
flake8-builtins==1.5.3
flake8-comprehensions==3.7.0
flake8-debugger==4.0.0
flake8-deprecated==1.3
flake8-docstrings==1.6.0
flake8-implicit-str-concat==0.2.0
flake8-isort==4.0.0
flake8-isort==4.1.1
flake8-loopy==1.1.0
flake8-logging-format==0.6.0
# flake8-unused-arguments==0.0.9
# Uncomment this later
# flake8-simplify==0.14.0
isort==5.9.3
# flake8-simplify==0.14.2
isort==5.10.1
mccabe==0.6.1
mypy==0.910


# Indirect dependencies go below this line. Avoid pinning them any tighter than
# necessary. You should only add dependencies here that require pinning to ensure
# certain features or bugfixes are present.
pydocstyle>=5.1.0
pydocstyle>=6
types-setuptools
7 changes: 4 additions & 3 deletions setup.cfg
Expand Up @@ -26,13 +26,14 @@ project_urls:
Source=https://www.github.com/dargueta/binobj
Tracker=https://www.github.com/dargueta/binobj/issues
; Do not modify the version manually -- use the bumpversion CLI tool
version: 0.10.4
version: 0.10.5

[options]
install_requires:
attrs>=18.2.0
more-itertools>=4.0, <9
typing-inspect>=0.4.0, <0.7 ; python_version<="3.7"
more-itertools>=4.0, <8.11 ; python_version<"3.6"
more-itertools>=4.0, <9 ; python_version>="3.6"
typing-inspect>=0.4.0, <0.8 ; python_version<="3.7"
python_requires: >=3.5

[options.package_data]
Expand Down
8 changes: 5 additions & 3 deletions test-requirements.txt
@@ -1,12 +1,14 @@
pytest==6.2.5 ; python_version>="3.6"
pytest==6.1.2 ; python_version<"3.6"
pytest-cov==2.12.1
pytest-randomly==3.10.1 ; python_version>="3.6"
pytest-cov==3.0.0 ; python_version>="3.6"
pytest-cov==2.12.1 ; python_version<"3.6"
pytest-randomly==3.10.2 ; python_version>="3.6"
pytest-randomly==3.5.0 ; python_version<"3.6"
coverage-pyver-pragma==0.3.0 ; python_version>="3.6"


# Indirect dependencies go below this line. Avoid pinning them any tighter than necessary.
# You should only add dependencies here that require pinning to ensure certain features or
# bugfixes are present.
coverage>=5.5
coverage>=5.5 ; python_version <"3.6"
coverage>=6 ; python_version>="3.6"
21 changes: 16 additions & 5 deletions tox.ini
Expand Up @@ -12,12 +12,15 @@ passenv =
COV_PLATFORM
COV_PYTHON_IMPLEMENTATION

[testenv:lint,mypy]
[testenv:lint]
basepython = python3.8
deps = -rlint-requirements.txt
commands =
lint: flake8 --max-complexity 9
mypy: mypy --show-error-codes binobj
commands = flake8 --max-complexity 9

[testenv:mypy]
basepython = python3.8
deps = -rlint-requirements.txt
commands = mypy --show-error-codes binobj

[pytest]
addopts =
Expand Down Expand Up @@ -74,15 +77,23 @@ multi_line_output = 3
include_trailing_comma = true

[mypy]
strict_optional = true
allow_untyped_globals = false
allow_redefinition = false
check_untyped_defs = true
disallow_any_decorated = true
disallow_any_generics = true
disallow_any_unimported = true
disallow_incomplete_defs = true
disallow_subclassing_any = true
disallow_untyped_calls = true
disallow_untyped_decorators = true
disallow_untyped_defs = true
ignore_missing_imports = false
implicit_reexport = false
no_implicit_optional = true
show_error_codes = true
strict_optional = true
warn_no_return = true
warn_unreachable = true
warn_unused_ignores = true
warn_redundant_casts = true
Expand Down

0 comments on commit d2d8ce2

Please sign in to comment.