diff options
author | Christophe Vu-Brugier <cvubrugier@fastmail.fm> | 2015-06-07 19:25:40 +0200 |
---|---|---|
committer | Christophe Vu-Brugier <cvubrugier@fastmail.fm> | 2015-06-08 11:15:49 +0200 |
commit | 8bfc7ed72c4ccfd43fc285b10ef90d7280dd8cd1 (patch) | |
tree | dda07c9c52050dc01966ab0c032c36ee151b15d0 | |
parent | 33975c4857aaf397447c30351410d857775963fa (diff) | |
download | configshell-fb-8bfc7ed72c4ccfd43fc285b10ef90d7280dd8cd1.tar.gz |
Fix integer divisions that are broken with Python 3
Replace '/' with '//' which the floor division operation on both
Python 2 and Python 3.
For more details, see PEP 238 "changing the division operator"
http://www.python.org/dev/peps/pep-0238
Signed-off-by: Christophe Vu-Brugier <cvubrugier@fastmail.fm>
-rw-r--r-- | configshell/shell.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/configshell/shell.py b/configshell/shell.py index de0ad1e..c6100e7 100644 --- a/configshell/shell.py +++ b/configshell/shell.py @@ -247,9 +247,8 @@ class ConfigShell(object): # Display the possible completions if num_matches: - if max_length < width: - num_per_line = width / max_length + num_per_line = width // max_length if num_per_line * max_length == width: num_per_line -= 1 else: @@ -267,7 +266,7 @@ class ConfigShell(object): break self.con.raw_write('\n') else: - count = (num_matches + num_per_line - 1) / num_per_line + count = (num_matches + num_per_line - 1) // num_per_line if len > 0 and len <= num_per_line: count = 1 for i in range(1, count+1): |