Skip to content
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
6 changes: 3 additions & 3 deletions dice/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def run_tests(self):
Iteratively run tests.
"""
while not self.exiting:
item = random.choice(self.providers.values()).generate()
item = random.choice(list(self.providers.values())).generate()
item.run()
self.last_item = item

Expand Down Expand Up @@ -323,7 +323,7 @@ def update_window(self):
panel.clear()
cat_name, item_idx = self.cur_class
if cat_name is not None and item_idx is not None:
item_name, stat = self.stats[cat_name].items()[item_idx]
item_name, stat = list(self.stats[cat_name].items())[item_idx]
try:
for item in self.stats[cat_name][item_name].queue:
bundle = {'item': item.cmdline}
Expand All @@ -336,7 +336,7 @@ def update_window(self):
panel.clear()
cat_name, item_idx = self.cur_class
if cat_name is not None and item_idx is not None:
item_name, stat = self.stats[cat_name].items()[item_idx]
item_name, stat = list(self.stats[cat_name].items())[item_idx]
items = self.stats[cat_name][item_name].queue

item_name, item_idx = self.cur_item
Expand Down
26 changes: 13 additions & 13 deletions dice/client/panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ def add_item(self, bundle):

class _Pad(object):
def __init__(self, height, width):
self.width = width
self.height = height
self.pad = curses.newpad(height, width)
self.width = int(width)
self.height = int(height)
self.pad = curses.newpad(self.height, self.width)
self.cur_y = 1

def box(self):
Expand All @@ -30,9 +30,9 @@ def reset(self):
self.cur_y = 1

def resize(self, height, width):
self.width = width
self.height = height
self.pad.resize(height, width)
self.width = int(width)
self.height = int(height)
self.pad.resize(self.height, self.width)

def println(self, text, align='left', style=curses.A_NORMAL):
if self.cur_y > self.height - 2:
Expand All @@ -55,17 +55,17 @@ class _PanelBase(object):

def __init__(self, screen, height, width, x=0, y=0):
self.screen = screen
self.height = height
self.width = width
self.height = int(height)
self.width = int(width)
self.pad = _Pad(self.height, self.width)
self.resize(self.height, self.width)
self.x, self.y = x, y
self.x, self.y = int(x), int(y)
self.keypress_listeners = {}

def resize(self, height, width):
self.height = height
self.width = width
self.pad.resize(height, width)
self.height = int(height)
self.width = int(width)
self.pad.resize(self.height, self.width)

def add_keypress_listener(self, name, key, callback):
if name not in self.keypress_listeners:
Expand Down Expand Up @@ -199,7 +199,7 @@ def draw(self, active=False):
item_idx = None
if self.catalogs:
# pylint: disable=unsubscriptable-object
cat_name = self.catalogs.keys()[0]
cat_name = list(self.catalogs.keys())[0]
items = self.catalogs[cat_name].items
if items:
item_idx = 0
Expand Down
4 changes: 2 additions & 2 deletions dice/client/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ def __init__(self, app):

self.stat_panel = panel.ListPanel(
self.screen,
self.height, self.width / 6,
self.height, int(self.width / 6),
format_str='{count} {key}'
)

self.items_panel = panel.ListPanel(
self.screen,
self.height, self.width / 2,
self.height, int(self.width / 2),
x=self.width / 6, y=0,
format_str='{item}'
)
Expand Down
4 changes: 2 additions & 2 deletions dice/core/symbol.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def generate(self):
Generate a random bytes string.
"""
cnt = int(random.weibullvariate(65535, 1))
return ''.join(bt for bt in os.urandom(cnt) if bt != b'\x00')
return ''.join(str(bt) for bt in os.urandom(cnt) if bt != b'\x00')


class NonEmptyBytes(Bytes):
Expand All @@ -66,7 +66,7 @@ def generate(self):
Generate a random non-empty bytes string.
"""
cnt = int(random.weibullvariate(65535, 1)) + 1
return ''.join(bt for bt in os.urandom(cnt) if bt != b'\x00')
return ''.join(str(bt) for bt in os.urandom(cnt) if bt != b'\x00')


class String(Bytes):
Expand Down
4 changes: 2 additions & 2 deletions dice/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ def run(cmdline, timeout=10):

select.select([process.stdout, process.stderr], [], [], 0.1)
try:
out_lines = process.stdout.read()
out_lines = str(process.stdout.read())
if out_lines:
result.stdout += out_lines
err_lines = process.stderr.read()
err_lines = str(process.stderr.read())
if err_lines:
result.stderr += err_lines
except IOError as detail:
Expand Down