# ntt-command-service
Library for implementing Command Pattern
## Examples
```python
from ntt_command_service import *
from typing import List
fScores: List[float] = []
class AppendDataCommand(ICommand):
def __init__(self, fScores: List[float], fScore: float):
self._fScores = fScores
self._fScore = fScore
def Execute(self) -> None:
self._fScores.append(self._fScore)
def CanExecute(self) -> bool:
return True
def Undo(self) -> None:
self._fScore.pop()
serCommandService = CommandService()
serCommandService.AddCommand(AppendDataCommand(fScores, 3))
# ----> fScores = [3]
serCommandService.AddCommand(AppendDataCommand(fScores, 5))
# ----> fScores = [3, 5]
serCommandService.AddCommand(AppendDataCommand(fScores, 1))
# ----> fScores = [3, 5, 1]
serCommandService.Undo()
# ----> fScores = [3, 5]
serCommandService.Clear()
serCommandService.CanUndo()
# ----> False
```
Raw data
{
"_id": null,
"home_page": "https://github.com/threezinedine/ntt-command-service",
"name": "ntt-command-service",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "command,mvvm,signal,ntt",
"author": "threezinedine",
"author_email": "threezinedine@email.com",
"download_url": "https://files.pythonhosted.org/packages/e6/be/485b938b2f24bccfedaf83c573fd1d53df5fd92d057f891ec97263e10198/ntt-command-service-1.0.4.tar.gz",
"platform": null,
"description": "# ntt-command-service\r\nLibrary for implementing Command Pattern\r\n\r\n## Examples\r\n\r\n```python\r\nfrom ntt_command_service import *\r\nfrom typing import List\r\n\r\nfScores: List[float] = []\r\n\r\nclass AppendDataCommand(ICommand):\r\n def __init__(self, fScores: List[float], fScore: float):\r\n self._fScores = fScores\r\n self._fScore = fScore\r\n\r\n def Execute(self) -> None:\r\n self._fScores.append(self._fScore)\r\n\r\n def CanExecute(self) -> bool:\r\n return True\r\n\r\n def Undo(self) -> None:\r\n self._fScore.pop()\r\n\r\nserCommandService = CommandService()\r\nserCommandService.AddCommand(AppendDataCommand(fScores, 3))\r\n# ----> fScores = [3]\r\nserCommandService.AddCommand(AppendDataCommand(fScores, 5))\r\n# ----> fScores = [3, 5]\r\nserCommandService.AddCommand(AppendDataCommand(fScores, 1))\r\n# ----> fScores = [3, 5, 1]\r\nserCommandService.Undo()\r\n# ----> fScores = [3, 5]\r\nserCommandService.Clear()\r\nserCommandService.CanUndo()\r\n# ----> False\r\n```\r\n\r\n",
"bugtrack_url": null,
"license": "",
"summary": "Small library for observation mechanism",
"version": "1.0.4",
"project_urls": {
"Homepage": "https://github.com/threezinedine/ntt-command-service",
"Source": "https://github.com/threezinedine/ntt-command-service",
"Tracker": "https://github.com/threezinedine/ntt-command-service/issues"
},
"split_keywords": [
"command",
"mvvm",
"signal",
"ntt"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c92a47e0442aa6950c0e63c0cae2296c74e23a402f9a90eef5c3e55a16d4ec1e",
"md5": "dc857477b26821e2f04b09571ec70931",
"sha256": "c35f26a84f7c8f32907ed096677fa46170a1f9f6ce296d3baf2294108f603392"
},
"downloads": -1,
"filename": "ntt_command_service-1.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "dc857477b26821e2f04b09571ec70931",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 5699,
"upload_time": "2023-12-23T19:35:37",
"upload_time_iso_8601": "2023-12-23T19:35:37.136632Z",
"url": "https://files.pythonhosted.org/packages/c9/2a/47e0442aa6950c0e63c0cae2296c74e23a402f9a90eef5c3e55a16d4ec1e/ntt_command_service-1.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e6be485b938b2f24bccfedaf83c573fd1d53df5fd92d057f891ec97263e10198",
"md5": "4f5467e24c6ecdd9dc99b84a7f985353",
"sha256": "a2c6fed89cdfb84c44fd6c2dd3aca9eabe412a6823c676137df27bc01c827d92"
},
"downloads": -1,
"filename": "ntt-command-service-1.0.4.tar.gz",
"has_sig": false,
"md5_digest": "4f5467e24c6ecdd9dc99b84a7f985353",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3958,
"upload_time": "2023-12-23T19:35:40",
"upload_time_iso_8601": "2023-12-23T19:35:40.776967Z",
"url": "https://files.pythonhosted.org/packages/e6/be/485b938b2f24bccfedaf83c573fd1d53df5fd92d057f891ec97263e10198/ntt-command-service-1.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-23 19:35:40",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "threezinedine",
"github_project": "ntt-command-service",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "ntt-command-service"
}