Convtools

Latest version: v1.14.3

Safety actively analyzes 682404 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 9 of 18

0.26.0

**Experimental - contrib.models**

- reworked errors, returned by ``build`` and ``build_or_raise`` to allow for
automated errors processing (now it's clear where path ends and error info
starts)
- now ``cast`` not only supports casters, but complex types too:
``cast(t.List[t.Tuple[int]])``
- now it's possible to force all-field casting on a model level via ``Meta.cast
= True`` class field
- ``build`` and ``build_or_raise`` can also force children casting via
``cast=True`` parameter (doesn't affect inner models as they have their own
controls)
- now casting supports type-to-caster(s) overrides like:
``cast(overrides={date: casters.DateFromStr("%m/%d/%Y")})``,
``Meta.cast_overrides`` and ``build(..., cast_overrides={date: [...]})``
- added ``validators.Decimal(max_digits, decimal_places)``
- extended str caster to decode bytes and supported custom encodings like
``casters.Str("utf-16")``
- added quantization support to ``casters.DecimalLossy(quantize_exp, rounding)``
- added ``typing.Tuple`` support (both validation and casting)

**Misc:**

- updated `c.or_` and `c.and_` to better flatten nested constructions

0.25.2

**Bugfix**

- fixed ``.gen_converter(class_method=True)``, broken in v0.25.0 where callable
wrapper was eliminated. Now it returns a converter, wrapped with
``classmethod``

0.25.1

**Bugfix**

- fixed label bug in case of nested pipes, introduced in 0.24.1: was leading to
label key errors since labels were skipping initialization

0.25.0

**Experimental features:**

- introduced data validation models: ``convtools.contrib.models.DictModel``
(accesses keys and indexes) and ``convtools.contrib.models.ObjectModel``
(accesses attributes and indexes)

**Misc**

- reworked converter generation to store generated code inside the main context
- eliminated converter wrapper, which was a callable, taking care of dumping
generated source code to tmpdir in cases of exceptions. Now converters take
care of this themselves.
- now long list/dict/tuple/set literal definition code includes newlines, so
it's easier to debug in case of exception

0.24.1

**Misc**

- forced pipes to inline if labels of "what" conversion cannot affect "where"
label usage

0.24.0

**Clean-up**

When you use ``c.item(c.item("key"))``, it generates ``data_[data_["key"]]``
under the hood. However reducers (``c.ReduceFuncs`` objects) used to replace
the input data for subsequent conversions with the reducer result, which was an
inconsistency (so that "key" was taken off of the reducer result, not its
input).

Now, the following is impossible: ``c.aggregate(reducer.item(c.item("key")))``
because ``c.item("key")`` is neither a group by field, nor a reducer.

Page 9 of 18

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.