Skip to content

Commit

Permalink
Merge pull request #4 from jawah/add-has-update
Browse files Browse the repository at this point in the history
❇️ add method has update in Settings
  • Loading branch information
Ousret authored May 2, 2024
2 parents 5aceee7 + d536310 commit ffb8771
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
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

0 comments on commit ffb8771

Please sign in to comment.