ndarray-listener


Namendarray-listener JSON
Version 2.0.2 PyPI version JSON
download
home_pageNone
SummaryImplementation of the Observer pattern for NumPy arrays
upload_time2025-01-03 15:43:01
maintainerNone
docs_urlNone
authorDanilo Horta
requires_python<4.0,>=3.10
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ndarray-listener

Implementation of the [Observer pattern](https://en.wikipedia.org/wiki/Observer_pattern) for NumPy arrays.

## Example

```python
from numpy import array
from ndarray_listener import ndl

a = ndl(array([-0.5, 0.1, 1.1]))

class Observer(object):
  def __init__(self):
    self.called_me = False

  def __call__(self, _):
    self.called_me = True

o = Observer()
a.talk_to(o)
print(o.called_me)
a[0] = 1.2
print(o.called_me)
```

The output should be

```
False
True
```

## Install

From command line, enter

```bash
pip install ndarray-listener
```

## Running the tests

Install dependencies

```bash
pip install pytest
```

then run

```python
python -c "import ndarray_listener; ndarray_listener.test()"
```

## Documentation

[Documentation](https://ndarray-listener.readthedocs.io/en/latest/)

## Authors

* [Danilo Horta](https://github.com/horta)


## License

This project is licensed under the [MIT License](https://raw.githubusercontent.com/limix/ndarray-listener/master/LICENSE.md).


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "ndarray-listener",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": null,
    "author": "Danilo Horta",
    "author_email": "danilo.horta@pm.me",
    "download_url": "https://files.pythonhosted.org/packages/34/5f/246873b4d6d92453fe949e9914a5a0ad85cf72ecd50e9d11ad13956d7146/ndarray_listener-2.0.2.tar.gz",
    "platform": null,
    "description": "# ndarray-listener\n\nImplementation of the [Observer pattern](https://en.wikipedia.org/wiki/Observer_pattern) for NumPy arrays.\n\n## Example\n\n```python\nfrom numpy import array\nfrom ndarray_listener import ndl\n\na = ndl(array([-0.5, 0.1, 1.1]))\n\nclass Observer(object):\n  def __init__(self):\n    self.called_me = False\n\n  def __call__(self, _):\n    self.called_me = True\n\no = Observer()\na.talk_to(o)\nprint(o.called_me)\na[0] = 1.2\nprint(o.called_me)\n```\n\nThe output should be\n\n```\nFalse\nTrue\n```\n\n## Install\n\nFrom command line, enter\n\n```bash\npip install ndarray-listener\n```\n\n## Running the tests\n\nInstall dependencies\n\n```bash\npip install pytest\n```\n\nthen run\n\n```python\npython -c \"import ndarray_listener; ndarray_listener.test()\"\n```\n\n## Documentation\n\n[Documentation](https://ndarray-listener.readthedocs.io/en/latest/)\n\n## Authors\n\n* [Danilo Horta](https://github.com/horta)\n\n\n## License\n\nThis project is licensed under the [MIT License](https://raw.githubusercontent.com/limix/ndarray-listener/master/LICENSE.md).\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Implementation of the Observer pattern for NumPy arrays",
    "version": "2.0.2",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "91cf70e70b7d5deab6bfbc8d667d316fb6b757d9fd38739f96b475b728858b80",
                "md5": "09c31d3242272773f02784c74d4679b7",
                "sha256": "6f963fdb36abd87334cf7eff299c10396064ac82e4f2ff41d8b23bc0e1ce2805"
            },
            "downloads": -1,
            "filename": "ndarray_listener-2.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "09c31d3242272773f02784c74d4679b7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 4281,
            "upload_time": "2025-01-03T15:42:59",
            "upload_time_iso_8601": "2025-01-03T15:42:59.575304Z",
            "url": "https://files.pythonhosted.org/packages/91/cf/70e70b7d5deab6bfbc8d667d316fb6b757d9fd38739f96b475b728858b80/ndarray_listener-2.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "345f246873b4d6d92453fe949e9914a5a0ad85cf72ecd50e9d11ad13956d7146",
                "md5": "de83dbb9219b37890d711e40aed974f3",
                "sha256": "46fefc573b1b8f681502649beb349771de67a114a17f4b9c48836d8fba18a936"
            },
            "downloads": -1,
            "filename": "ndarray_listener-2.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "de83dbb9219b37890d711e40aed974f3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 3294,
            "upload_time": "2025-01-03T15:43:01",
            "upload_time_iso_8601": "2025-01-03T15:43:01.233947Z",
            "url": "https://files.pythonhosted.org/packages/34/5f/246873b4d6d92453fe949e9914a5a0ad85cf72ecd50e9d11ad13956d7146/ndarray_listener-2.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-03 15:43:01",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "ndarray-listener"
}
        
Elapsed time: 0.87022s