diff options
| author | Yannick CouziniƩ <yannick.couzinie@cognostics.de> | 2018-08-06 21:07:21 +0200 |
|---|---|---|
| committer | Yannick CouziniƩ <yannick.couzinie@cognostics.de> | 2018-08-06 21:07:21 +0200 |
| commit | 2923398f5049a27fa509d5d5c287e9be089514fa (patch) | |
| tree | f4346b8eb7317ad07ebd7f36b55af30c88e3e7d7 | |
| parent | bb277d1eff052e2478fb8c132bc42793ce91b870 (diff) | |
| download | ranger-2923398f5049a27fa509d5d5c287e9be089514fa.tar.gz | |
Replace StopIteration with bare return
A bare return in generators raises StopIteration (this is backwards
compatible). Using StopIteration raised a warning in 3.6.x and raises an
Error in 3.7.0 (and probably upwards).
| -rw-r--r-- | ranger/gui/widgets/pager.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ranger/gui/widgets/pager.py b/ranger/gui/widgets/pager.py index 9afbfd15..d64d4ac1 100644 --- a/ranger/gui/widgets/pager.py +++ b/ranger/gui/widgets/pager.py @@ -234,7 +234,7 @@ class Pager(Widget): # pylint: disable=too-many-instance-attributes def _generate_lines(self, starty, startx): i = starty if not self.source: - raise StopIteration + return while True: try: line = self._get_line(i).expandtabs(4) @@ -244,5 +244,5 @@ class Pager(Widget): # pylint: disable=too-many-instance-attributes line = line[startx:self.wid + startx] yield line.rstrip().replace('\r\n', '\n') except IndexError: - raise StopIteration + return i += 1 |