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

Fix broken APIs #97

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions kitty/core/threading_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def run(self):
'''
run the the function in a loop until stoped
'''
while not self._stop_event.isSet():
while not self._stop_event.is_set():
self._func(*self._args)

def stop(self):
Expand All @@ -80,5 +80,5 @@ def stop(self):
if self._func_stop_event is not None:
self._func_stop_event.set()
self.join(timeout=1)
if self.isAlive():
if self.is_alive():
print('Failed to stop thread')
2 changes: 1 addition & 1 deletion kitty/interfaces/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def is_paused(self):
:return: whether current state is paused
'''
assert(self._continue_event)
return not self._continue_event.isSet()
return not self._continue_event.is_set()

def resume(self):
'''
Expand Down
20 changes: 7 additions & 13 deletions tests/test_model_low_level_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,10 @@ def _test_fields(self, init_fields=[], push_fields=[]):
for f in all_fields:
field_default_values.append(f.render())
fields_mutations = []
joiner = Bits(0)
for i, field in enumerate(all_fields):
prefix = sum(field_default_values[:i])
postfix = sum(field_default_values[i + 1:])
if prefix == 0:
prefix = Bits()
if postfix == 0:
postfix = Bits()
prefix = joiner.join(field_default_values[:i])
postfix = joiner.join(field_default_values[i + 1:])
while field.mutate():
fields_mutations.append(prefix + field.render() + postfix)
field.reset()
Expand Down Expand Up @@ -554,15 +551,12 @@ def _test_mutations(self, repeater, fields, min_times=1, max_times=1, step=1):

field_default_values = [field.render() for field in fields]
fields_mutations = []
joiner = Bits(0)
for i in range(min_times, max_times, step):
fields_mutations.append(sum(field_default_values) * i)
fields_mutations.append(joiner.join(field_default_values) * i)
for j, field in enumerate(fields):
prefix = sum(field_default_values[:j])
postfix = sum(field_default_values[j + 1:])
if prefix == 0:
prefix = Bits()
if postfix == 0:
postfix = Bits()
prefix = joiner.join(field_default_values[:j])
postfix = joiner.join(field_default_values[j + 1:])
while field.mutate():
fields_mutations.append((prefix + field.render() + postfix) * min_times)
field.reset()
Expand Down