Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

❇️ add method has update in Settings #4

Merged
merged 1 commit into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Release History
===============

5.0.3 (2024-05-02)
------------------

- Added method ``has_update`` into ``Settings`` class.

5.0.2 (2024-04-29)
------------------

Expand Down
2 changes: 1 addition & 1 deletion jh2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@

from __future__ import annotations

__version__ = "5.0.2"
__version__ = "5.0.3"
9 changes: 9 additions & 0 deletions jh2/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,14 @@ def __init__(self, client=True, initial_values=None):
error_code=invalid,
)
self._settings[key] = collections.deque([value])
self._any_update = True

@property
def has_update(self):
try:
return self._any_update
finally:
self._any_update = False

def acknowledge(self):
"""
Expand Down Expand Up @@ -282,6 +290,7 @@ def __setitem__(self, key, value):
self._settings[key] = items

items.append(value)
self._any_update = True

def __delitem__(self, key):
del self._settings[key]
Expand Down
Loading