Oop-ext

Latest version: v2.1.0

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

Scan your dependencies

Page 1 of 3

2.1.0

------------------

* 48: New type-checker friendly ``proxy = GetProxy(I, obj)`` function as an alternative to ``proxy = I(obj)``. The
latter is not accepted by type checkers in general because interfaces are protocols, which can't be instantiated.

Also fixed a type-checking error with ``AsssertImplements``::

Only concrete class can be given where "Type[Interface]" is expected

This happens due to `python/mypy5374 <https://github.com/python/mypy/issues/5374>`__.

2.0.0

------------------

* 47: Interfaces no longer check type annotations at all.

It was supported initially, but in practice
this feature has shown up to be an impediment to adopting type annotations incrementally, as it
discourages adding type annotations to improve existing interfaces, or annotating
existing implementations without having to update the interface (and all other implementations
by consequence).

It was decided to let the static type checker correctly deal with matching type annotations, as
it can do so more accurately than ``oop-ext`` did before.

1.2.0

------------------

* 43: Fix support for type annotated ``Attribute`` and ``ReadOnlyAttribute``:

.. code-block:: python

class IFoo(Interface):
value: int = Attribute(int)

1.1.2

------------------

* 41: Fix regression introduced in ``1.1.0`` where installing a callback using
``callback.After`` or ``callback.Before`` would make a method no longer compliant with
the signature required by its interface.

1.1.1

------------------

* 38: Reintroduce ``extra_args`` argument to ``Callback._GetKey``, so subclasses can make use
of it.

* 36: Fix regression introduced in ``1.1.0`` where ``Abstract`` and ``Implements`` decorators
could no longer be used in interfaces implementations.

1.1.0

------------------

* 25: ``oop-ext`` now includes inline type annotations and exposes them to user programs.

If you are running a type checker such as mypy on your tests, you may start noticing type errors indicating incorrect usage.
If you run into an error that you believe to be incorrect, please let us know in an issue.

The types were developed against ``mypy`` version 0.800.

* 26: New type-checked ``Callback`` variants, ``Callback0``, ``Callback1``, ``Callback2``, etc, providing
type checking for all operations(calling, ``Register``, etc) at nearly zero runtime cost.

Example:

.. code-block:: python

from oop_ext.foundation.callback import Callback2


def changed(x: int, v: float) -> None:
...


on_changed = Callback2[int, float]()
on_changed(10, 5.25)


* Fixed ``Callbacks.Before`` and ``Callbacks.After`` signatures: previously their signature conveyed
that they supported multiple callbacks, but it was a mistake which would break callers because
every parameter after the 2nd would be considered the ``sender_as_parameter`` parameter, which
was forwarded to ``After`` and ``Before`` functions of the ``_shortcuts.py``
module.

Page 1 of 3

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.