diff options
author | Lars Wirzenius <liw@liw.fi> | 2015-04-18 18:58:56 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2015-04-18 18:58:56 +0300 |
commit | ce31ea6dc01898bf03a1ba7e86b263c12802fbde (patch) | |
tree | 51320d0da40033882f215eedfbe5315d9dd90c4d | |
parent | 81dcb7bdb96a95962b66671dc4a918c41e7a8aec (diff) | |
download | ttystatus-ce31ea6dc01898bf03a1ba7e86b263c12802fbde.tar.gz |
Fixes from pylint
-rw-r--r-- | pylint.conf | 1 | ||||
-rw-r--r-- | ttystatus/__init__.py | 32 | ||||
-rw-r--r-- | ttystatus/bytespeed.py | 8 | ||||
-rw-r--r-- | ttystatus/bytespeed_tests.py | 4 | ||||
-rw-r--r-- | ttystatus/fmt.py | 4 | ||||
-rw-r--r-- | ttystatus/messager.py | 1 | ||||
-rw-r--r-- | ttystatus/status.py | 2 | ||||
-rw-r--r-- | ttystatus/widget.py | 3 |
8 files changed, 26 insertions, 29 deletions
diff --git a/pylint.conf b/pylint.conf index b36b2aa..09b034d 100644 --- a/pylint.conf +++ b/pylint.conf @@ -6,6 +6,7 @@ disable= attribute-defined-outside-init, bad-builtin, blacklisted-name, + cell-var-from-loop, cyclic-import, invalid-name, missing-docstring, diff --git a/ttystatus/__init__.py b/ttystatus/__init__.py index 307e7a9..2477e08 100644 --- a/ttystatus/__init__.py +++ b/ttystatus/__init__.py @@ -16,23 +16,23 @@ __version__ = '0.23' -from messager import Messager -from status import TerminalStatus -from widget import Widget +from .messager import Messager +from .status import TerminalStatus +from .widget import Widget -from literal import Literal -from string import String -from integer import Integer -from pathname import Pathname -from bytesize import ByteSize -from counter import Counter -from index import Index -from percent import PercentDone -from progressbar import ProgressBar -from remtime import RemainingTime -from elapsed import ElapsedTime -from bytespeed import ByteSpeed +from .literal import Literal +from .string import String +from .integer import Integer +from .pathname import Pathname +from .bytesize import ByteSize +from .counter import Counter +from .index import Index +from .percent import PercentDone +from .progressbar import ProgressBar +from .remtime import RemainingTime +from .elapsed import ElapsedTime +from .bytespeed import ByteSpeed -import fmt +from .fmt import parse __all__ = locals() diff --git a/ttystatus/bytespeed.py b/ttystatus/bytespeed.py index 784cdcf..098dd4a 100644 --- a/ttystatus/bytespeed.py +++ b/ttystatus/bytespeed.py @@ -47,9 +47,9 @@ class ByteSpeed(ttystatus.Widget): oldest_bytes, started = self._data_points[0] latest_bytes, dummy = self._data_points[-1] - bytes = latest_bytes - oldest_bytes + num_bytes = latest_bytes - oldest_bytes duration = self.now() - started - speed = bytes / duration + speed = num_bytes / duration for factor, decimals, unit in units: if speed >= factor: @@ -59,9 +59,9 @@ class ByteSpeed(ttystatus.Widget): return '%.0f B/s' % speed def update(self, master): - bytes = master[self.name] + num_bytes = master[self.name] now = self.now() - self._data_points.append((bytes, now)) + self._data_points.append((num_bytes, now)) if self._duration is None: if len(self._data_points) > 2: del self._data_points[1:-1] diff --git a/ttystatus/bytespeed_tests.py b/ttystatus/bytespeed_tests.py index 4ac58d5..2070e47 100644 --- a/ttystatus/bytespeed_tests.py +++ b/ttystatus/bytespeed_tests.py @@ -73,7 +73,7 @@ class ByteSpeedTests(unittest.TestCase): ] w = ttystatus.ByteSpeed('foo', duration=5) - for when, bytes in items: + for when, num_bytes in items: w.now = lambda: when - w.update({'foo': bytes}) + w.update({'foo': num_bytes}) self.assertEqual(w.render(0), '0 B/s') diff --git a/ttystatus/fmt.py b/ttystatus/fmt.py index 5f21646..5ad7994 100644 --- a/ttystatus/fmt.py +++ b/ttystatus/fmt.py @@ -24,8 +24,8 @@ def _find_widgets(): names = dir(ttystatus) objs = [getattr(ttystatus, x) for x in names] classes = [o for o in objs if inspect.isclass(o)] - widgets = [c for c in classes if issubclass(c, ttystatus.Widget)] - subclasses = [w for w in widgets if w != ttystatus.Widget] + widget_classes = [c for c in classes if issubclass(c, ttystatus.Widget)] + subclasses = [w for w in widget_classes if w != ttystatus.Widget] return subclasses widgets = _find_widgets() diff --git a/ttystatus/messager.py b/ttystatus/messager.py index d1f3312..108c3e8 100644 --- a/ttystatus/messager.py +++ b/ttystatus/messager.py @@ -16,7 +16,6 @@ import fcntl import struct -import sys import termios import time diff --git a/ttystatus/status.py b/ttystatus/status.py index 085e91f..11676cb 100644 --- a/ttystatus/status.py +++ b/ttystatus/status.py @@ -49,7 +49,7 @@ class TerminalStatus(object): ``format("hello, %String(name)")``. ''' - for widget in ttystatus.fmt.parse(format_string): + for widget in ttystatus.parse(format_string): self.add(widget) def clear(self): diff --git a/ttystatus/widget.py b/ttystatus/widget.py index e0fc536..850716d 100644 --- a/ttystatus/widget.py +++ b/ttystatus/widget.py @@ -41,9 +41,6 @@ class Widget(object): static_width = True - def __str__(self): - raise NotImplementedError() - def render(self, width): '''Format the current value. |