{"id":19657716,"url":"https://github.com/esss/oop-ext","last_synced_at":"2025-04-28T19:32:22.915Z","repository":{"id":34294254,"uuid":"174530574","full_name":"ESSS/oop-ext","owner":"ESSS","description":"OOP Extensions is a set of utilities for object oriented programming which is missing on Python core libraries.","archived":false,"fork":false,"pushed_at":"2024-11-11T11:17:52.000Z","size":410,"stargazers_count":14,"open_issues_count":5,"forks_count":2,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-11-11T12:24:46.698Z","etag":null,"topics":["hacktoberfest","object-oriented-programming"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ESSS.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-03-08T12:02:00.000Z","updated_at":"2024-11-11T11:17:54.000Z","dependencies_parsed_at":"2023-12-07T12:24:03.944Z","dependency_job_id":"6f9bdb3d-c3ea-4dc5-bfca-c992b09c82b8","html_url":"https://github.com/ESSS/oop-ext","commit_stats":{"total_commits":154,"total_committers":7,"mean_commits":22.0,"dds":0.6688311688311688,"last_synced_commit":"8ae9e768102ce5b9912ea1ee259c52392275b175"},"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ESSS%2Foop-ext","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ESSS%2Foop-ext/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ESSS%2Foop-ext/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ESSS%2Foop-ext/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ESSS","download_url":"https://codeload.github.com/ESSS/oop-ext/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224129243,"owners_count":17260586,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","object-oriented-programming"],"created_at":"2024-11-11T15:33:21.824Z","updated_at":"2024-11-11T15:33:22.515Z","avatar_url":"https://github.com/ESSS.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"======================================================================\nOOP Extensions\n======================================================================\n\n.. image:: https://img.shields.io/pypi/v/oop-ext.svg\n    :target: https://pypi.python.org/pypi/oop-ext\n\n.. image:: https://img.shields.io/pypi/pyversions/oop-ext.svg\n    :target: https://pypi.org/project/oop-ext\n\n.. image:: https://github.com/ESSS/oop-ext/workflows/build/badge.svg\n    :target: https://github.com/ESSS/oop-ext/actions\n\n.. image:: https://codecov.io/gh/ESSS/oop-ext/branch/master/graph/badge.svg\n    :target: https://codecov.io/gh/ESSS/oop-ext\n\n.. image:: https://img.shields.io/readthedocs/oop-extensions.svg\n    :target: https://oop-extensions.readthedocs.io/en/latest/\n\n.. image:: https://results.pre-commit.ci/badge/github/ESSS/oop-ext/master.svg\n    :target: https://results.pre-commit.ci/latest/github/ESSS/oop-ext/master\n\n.. image:: https://sonarcloud.io/api/project_badges/measure?project=ESSS_oop-ext\u0026metric=alert_status\n    :target: https://sonarcloud.io/project/overview?id=ESSS_oop-ext\n\n\nWhat is OOP Extensions ?\n================================================================================\n\nOOP Extensions is a set of utilities for object oriented programming which is missing on Python core libraries.\n\nUsage\n================================================================================\n``oop_ext`` brings a set of object oriented utilities, it supports the concept of interfaces,\nabstract/overridable methods and more. ``oop_ext`` carefully checks that implementations\nhave the same method signatures as the interface it implements and raises exceptions otherwise.\n\nHere's a simple example showing some nice features:\n\n.. code-block:: python\n\n    from oop_ext.interface import Interface, ImplementsInterface\n\n\n    class IDisposable(Interface):\n        def dispose(self):\n            \"\"\"\n            Clears this object\n            \"\"\"\n\n        def is_disposed(self) -\u003e bool:\n            \"\"\"\n            Returns True if the object has been cleared\n            \"\"\"\n\n\n    @ImplementsInterface(IDisposable)\n    class MyObject(Disposable):\n        def __init__(self):\n            super().__init__()\n            self._data = [0] * 100\n            self._is_disposed = False\n\n        def is_disposed(self) -\u003e bool:\n            return self._is_disposed\n\n        def dispose(self):\n            self._is_disposed = True\n            self._data = []\n\n\nIf any of the two methods in ``MyObject`` are not implemented or have differ signatures than\nthe ones declared in ``IDisposable``, the ``ImplementsInterface`` decorator will raise an\nerror during import.\n\nArbitrary objects can be verified if they implement a certain interface by using ``IsImplementation``:\n\n.. code-block:: python\n\n    from oop_ext.interface import IsImplementation\n\n    my_object = MyObject()\n    if IsImplementation(my_object, IDisposable):\n        # my_object is guaranteed to implement IDisposable completely\n        my_object.dispose()\n\nAlternatively you can assert that an object implements the desired interface with ``AssertImplements``:\n\n.. code-block:: python\n\n    from oop_ext.interface import AssertImplements\n\n    my_object = MyObject()\n    AssertImplements(my_object, IDisposable)\n    my_object.dispose()\n\n\nType Checking\n-------------\n\nAs of ``1.1.0``, ``oop-ext`` includes inline type annotations and exposes them to user programs.\n\nIf you are running a type checker such as mypy on your tests, you may start noticing type errors indicating incorrect usage.\nIf you run into an error that you believe to be incorrect, please let us know in an issue.\n\nThe types were developed against ``mypy`` version 0.800.\n\nSee `the docs \u003chttps://oop-extensions.readthedocs.io/en/latest/interfaces.html#static-type-checking\u003e`__\nfor more information.\n\nContributing\n------------\n\nFor guidance on setting up a development environment and how to make a\ncontribution to oop_ext, see the `contributing guidelines`_.\n\n.. _contributing guidelines: https://github.com/ESSS/oop-ext/blob/master/CONTRIBUTING.rst\n\n\nRelease\n-------\nA reminder for the maintainers on how to make a new release.\n\nNote that the VERSION should follow the semantic versioning as ``X.Y.Z`` (e.g. ``v1.0.5``).\n\n1. Create a ``release-VERSION`` branch from ``upstream/master``.\n2. Update ``CHANGELOG.rst``.\n3. Push a branch with the changes.\n4. Once all builds pass, push a ``VERSION`` tag to ``upstream``.\n5. Merge the PR.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fesss%2Foop-ext","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fesss%2Foop-ext","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fesss%2Foop-ext/lists"}