urwid 2.6.12__py3-none-any.whl → 2.6.14__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of urwid might be problematic. Click here for more details.

@@ -682,7 +682,7 @@ class Screen(BaseScreen, RealTerminal):
682
682
  if isinstance(inserttext, bytes):
683
683
  inserttext = inserttext.decode(encoding)
684
684
 
685
- output.extend(("\x08" * back, ias))
685
+ output.extend(("\x08" * back, ias)) # pylint: disable=used-before-assignment # defined in `if row`
686
686
 
687
687
  if encoding != "utf-8":
688
688
  if cs is None:
urwid/display/common.py CHANGED
@@ -39,9 +39,6 @@ if typing.TYPE_CHECKING:
39
39
 
40
40
  IS_WINDOWS = sys.platform == "win32"
41
41
 
42
- if not IS_WINDOWS:
43
- import termios
44
-
45
42
  # for replacing unprintable bytes with '?'
46
43
  UNPRINTABLE_TRANS_TABLE = b"?" * 32 + bytes(range(32, 256))
47
44
 
@@ -941,6 +938,8 @@ class RealTerminal:
941
938
  is called.
942
939
  """
943
940
 
941
+ import termios
942
+
944
943
  if fileno is None:
945
944
  fileno = sys.stdin.fileno()
946
945
  if not os.isatty(fileno):
urwid/display/curses.py CHANGED
@@ -62,7 +62,7 @@ if IS_WINDOWS:
62
62
  )
63
63
 
64
64
  def initscr():
65
- import curses # pylint: disable=redefined-outer-name,reimported # special case for monkeypatch
65
+ import curses # noqa: I001 # pylint: disable=redefined-outer-name,reimported # special case for monkeypatch
66
66
 
67
67
  import _curses
68
68
 
@@ -666,7 +666,7 @@ class _test:
666
666
  r.text = ([t.ljust(cols) for t in text] + [""] * rows)[:rows]
667
667
  r.attr = (attr + [[] for _ in range(rows)])[:rows]
668
668
  self.ui.draw_screen((cols, rows), r)
669
- keys, raw = self.ui.get_input(raw_keys=True) # pylint: disable=unpacking-non-sequence
669
+ keys, raw = self.ui.get_input(raw_keys=True)
670
670
  if "window resize" in keys:
671
671
  cols, rows = self.ui.get_cols_rows()
672
672
  if not keys:
@@ -26,13 +26,16 @@ Trio library is required.
26
26
  from __future__ import annotations
27
27
 
28
28
  import logging
29
+ import sys
29
30
  import typing
30
31
 
31
- import exceptiongroup
32
32
  import trio
33
33
 
34
34
  from .abstract_loop import EventLoop, ExitMainLoop
35
35
 
36
+ if sys.version_info < (3, 11):
37
+ from exceptiongroup import BaseExceptionGroup # pylint: disable=redefined-builtin # backport
38
+
36
39
  if typing.TYPE_CHECKING:
37
40
  import io
38
41
  from collections.abc import Awaitable, Callable, Hashable, Mapping
@@ -156,8 +159,10 @@ class TrioEventLoop(EventLoop):
156
159
 
157
160
  emulate_idle_callbacks = _TrioIdleCallbackInstrument(self._idle_callbacks)
158
161
 
159
- with exceptiongroup.catch({BaseException: self._handle_main_loop_exception}):
162
+ try:
160
163
  trio.run(self._main_task, instruments=[emulate_idle_callbacks])
164
+ except BaseException as exc:
165
+ self._handle_main_loop_exception(exc)
161
166
 
162
167
  async def run_async(self) -> None:
163
168
  """Starts the main loop and blocks asynchronously until the main loop exits.
@@ -179,12 +184,14 @@ class TrioEventLoop(EventLoop):
179
184
 
180
185
  emulate_idle_callbacks = _TrioIdleCallbackInstrument(self._idle_callbacks)
181
186
 
182
- with exceptiongroup.catch({BaseException: self._handle_main_loop_exception}):
187
+ try:
183
188
  trio.lowlevel.add_instrument(emulate_idle_callbacks)
184
189
  try:
185
190
  await self._main_task()
186
191
  finally:
187
192
  trio.lowlevel.remove_instrument(emulate_idle_callbacks)
193
+ except BaseException as exc:
194
+ self._handle_main_loop_exception(exc)
188
195
 
189
196
  def watch_file(
190
197
  self,
@@ -225,12 +232,11 @@ class TrioEventLoop(EventLoop):
225
232
  """Handles exceptions raised from the main loop, catching ExitMainLoop
226
233
  instead of letting it propagate through.
227
234
 
228
- Note that since Trio may collect multiple exceptions from tasks into a
229
- Trio MultiError, we cannot simply use a try..catch clause, we need a
230
- helper function like this.
235
+ Note that since Trio may collect multiple exceptions from tasks into an ExceptionGroup,
236
+ we cannot simply use a try..catch clause, we need a helper function like this.
231
237
  """
232
238
  self._idle_callbacks.clear()
233
- if isinstance(exc, exceptiongroup.BaseExceptionGroup) and len(exc.exceptions) == 1:
239
+ if isinstance(exc, BaseExceptionGroup) and len(exc.exceptions) == 1:
234
240
  exc = exc.exceptions[0]
235
241
 
236
242
  if isinstance(exc, ExitMainLoop):
@@ -250,17 +250,17 @@ class ZMQEventLoop(EventLoop):
250
250
  """
251
251
  A single iteration of the event loop.
252
252
  """
253
+ state = "wait" # default state not expecting any action
253
254
  if self._alarms or self._did_something:
254
255
  timeout = 0
255
256
  if self._alarms:
256
257
  state = "alarm"
257
- timeout = max(0, self._alarms[0][0] - time.time())
258
+ timeout = max(0.0, self._alarms[0][0] - time.time())
258
259
  if self._did_something and (not self._alarms or (self._alarms and timeout > 0)):
259
260
  state = "idle"
260
261
  timeout = 0
261
262
  ready = dict(self._poller.poll(timeout * 1000))
262
263
  else:
263
- state = "wait"
264
264
  ready = dict(self._poller.poll())
265
265
 
266
266
  if not ready:
urwid/version.py CHANGED
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '2.6.12'
16
- __version_tuple__ = version_tuple = (2, 6, 12)
15
+ __version__ = version = '2.6.14'
16
+ __version_tuple__ = version_tuple = (2, 6, 14)
urwid/widget/grid_flow.py CHANGED
@@ -30,13 +30,18 @@ class GridFlowWarning(WidgetWarning):
30
30
 
31
31
  class GridFlow(WidgetWrap[Pile], WidgetContainerMixin, WidgetContainerListContentsMixin):
32
32
  """
33
- The GridFlow widget is a flow widget that renders all the widgets it
34
- contains the same width and it arranges them from left to right and top to
35
- bottom.
33
+ The GridFlow widget is a flow widget that renders all the widgets it contains the same width,
34
+ and it arranges them from left to right and top to bottom.
36
35
  """
37
36
 
38
37
  def sizing(self) -> frozenset[Sizing]:
39
- return frozenset((Sizing.FLOW, Sizing.FIXED))
38
+ """Widget sizing.
39
+
40
+ ..note:: Empty widget sizing is limited to the FLOW due to no data for width.
41
+ """
42
+ if self:
43
+ return frozenset((Sizing.FLOW, Sizing.FIXED))
44
+ return frozenset((Sizing.FLOW,))
40
45
 
41
46
  def __init__(
42
47
  self,
@@ -422,14 +427,16 @@ class GridFlow(WidgetWrap[Pile], WidgetContainerMixin, WidgetContainerListConten
422
427
  def _get_maxcol(self, size: tuple[int] | tuple[()]) -> int:
423
428
  if size:
424
429
  (maxcol,) = size
425
- if maxcol < self.cell_width:
430
+ if self and maxcol < self.cell_width:
426
431
  warnings.warn(
427
432
  f"Size is smaller than cell width ({maxcol!r} < {self.cell_width!r})",
428
433
  GridFlowWarning,
429
434
  stacklevel=3,
430
435
  )
431
- else:
436
+ elif self:
432
437
  maxcol = len(self) * self.cell_width + (len(self) - 1) * self.h_sep
438
+ else:
439
+ maxcol = 0
433
440
  return maxcol
434
441
 
435
442
  def get_display_widget(self, size: tuple[int] | tuple[()]) -> Divider | Pile:
@@ -525,7 +532,7 @@ class GridFlow(WidgetWrap[Pile], WidgetContainerMixin, WidgetContainerListConten
525
532
 
526
533
  def keypress(
527
534
  self,
528
- size: tuple[int], # type: ignore[override]
535
+ size: tuple[int] | tuple[()], # type: ignore[override]
529
536
  key: str,
530
537
  ) -> str | None:
531
538
  """
@@ -545,7 +552,10 @@ class GridFlow(WidgetWrap[Pile], WidgetContainerMixin, WidgetContainerListConten
545
552
  ) -> tuple[int, int]:
546
553
  if size:
547
554
  return super().pack(size, focus)
548
- cols = len(self) * self.cell_width + (len(self) - 1) * self.h_sep
555
+ if self:
556
+ cols = len(self) * self.cell_width + (len(self) - 1) * self.h_sep
557
+ else:
558
+ cols = 0
549
559
  return cols, self.rows((cols,), focus)
550
560
 
551
561
  def rows(self, size: tuple[int], focus: bool = False) -> int:
@@ -564,10 +564,10 @@ class ScrollBar(WidgetDecoration[WrappedWidget]):
564
564
  thumb_weight = min(1.0, maxrow / max(1, ow_rows_max))
565
565
 
566
566
  # Thumb shrinks/grows according to the ratio of <number of visible lines> / <number of total lines>
567
- thumb_height = max(1, round(thumb_weight * maxrow))
567
+ thumb_height = max(1, round(thumb_weight * maxrow)) # pylint: disable=possibly-used-before-assignment
568
568
 
569
569
  # Thumb may only touch top/bottom if the first/last row is visible
570
- top_weight = float(pos) / max(1, posmax)
570
+ top_weight = float(pos) / max(1, posmax) # pylint: disable=possibly-used-before-assignment
571
571
  top_height = int((maxrow - thumb_height) * top_weight)
572
572
  if top_height == 0 and top_weight > 0:
573
573
  top_height = 1
@@ -591,7 +591,10 @@ class ScrollBar(WidgetDecoration[WrappedWidget]):
591
591
  ),
592
592
  )
593
593
 
594
- combinelist = [(ow_canv, None, True, ow_size[0]), (sb_canv, None, False, sb_width)]
594
+ combinelist = [
595
+ (ow_canv, None, True, ow_size[0]), # pylint: disable=possibly-used-before-assignment
596
+ (sb_canv, None, False, sb_width),
597
+ ]
595
598
 
596
599
  if self._scrollbar_side != SCROLLBAR_LEFT:
597
600
  return canvas.CanvasJoin(combinelist)
@@ -665,4 +668,4 @@ class ScrollBar(WidgetDecoration[WrappedWidget]):
665
668
  ow.set_scrollpos(pos + 1)
666
669
  return True
667
670
 
668
- return False
671
+ return handled
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: urwid
3
- Version: 2.6.12
3
+ Version: 2.6.14
4
4
  Summary: A full-featured console (xterm et al.) user interface library
5
5
  Home-page: https://urwid.org/
6
6
  Author-email: Ian Ward <ian@excess.org>
@@ -11,18 +11,18 @@ urwid/split_repr.py,sha256=pXzuddzQ4RnfIl537Gvoe8PVaBRHCPnxgdYvKK0qm8k,3899
11
11
  urwid/str_util.py,sha256=1ss-LHAhjXTynTVBcoSgYWIpBeN_RirqHYhP7fq7MrA,10844
12
12
  urwid/text_layout.py,sha256=lHiGfo7clmwHt5dMl_AaQSs2ov9IbY9JySTATZBm7h0,22821
13
13
  urwid/util.py,sha256=pGXnma03_IBx3v6_qN9cDWPXPj_YjkhQ9IxLjm_0TpU,15747
14
- urwid/version.py,sha256=Q7bo66dj80WEpDoVmCtISYC3ZL0QcWJqe3SGYxcts9s,413
14
+ urwid/version.py,sha256=3bjm6qWK9StytO6WlKHkLZ7Fya12zQ1QDSiXuzwk8wQ,413
15
15
  urwid/vterm.py,sha256=q9-8dxJpVr_7a0Bj_z_FYDiRgzos3IS17BjhYcy1RDw,58410
16
16
  urwid/wimp.py,sha256=o1YsjL_tBLXba8ZRr1MTHH0poLSlXT_atY3-uD_Ualg,567
17
17
  urwid/display/__init__.py,sha256=y90WbHPNRHlimPrXhzsSfFsBbBHy8QErmB1y4Xza-xo,1732
18
18
  urwid/display/_posix_raw_display.py,sha256=EkywAUNhhqgLquknP4tyicoo6QMdKG6uH6LApRmjoW8,14501
19
- urwid/display/_raw_display_base.py,sha256=B6mBR02J0kyBqWS6To0zdc_2hyl35czVfWnVzAV7wTY,33535
19
+ urwid/display/_raw_display_base.py,sha256=JSkF_HcPsto5YxF7NWm2vYLb6nE72AlS7SOCah8woZw,33600
20
20
  urwid/display/_web.css,sha256=6HarEsIspH2egt51HSrgI8Yl2lGi-DbziWOdS4RHNlk,359
21
21
  urwid/display/_web.js,sha256=aWEOQ4EsADsiNgdw-zHEUMCRD2bnfR8M1mu4dOc2Tqk,12947
22
22
  urwid/display/_win32.py,sha256=hD4hytElpfIv5qxGNTMSa2QeBNByqJDNVpmiiQSj6CM,5401
23
23
  urwid/display/_win32_raw_display.py,sha256=0PuHEhqJRl8uQmaWSOWceM1aEuolPZ-1MbHYN7s9yRY,9248
24
- urwid/display/common.py,sha256=_WiwXtt6KULEVLGeZvRIwmNcSfL92BPFv-uhb0_w2d0,39528
25
- urwid/display/curses.py,sha256=poYvs4iGPzl1jXpi8UUNyrTX2Ap9qxXPVhSu_zE4IuY,22800
24
+ urwid/display/common.py,sha256=iPz9uqPtjSYHo7Thj1G8nTiPdoC8Vbl5mGP0aHFYYE0,39517
25
+ urwid/display/curses.py,sha256=LA8Jglr7HRqQLYhN4wcWuvacoX_1LNjBQUbm8x0_GVo,22772
26
26
  urwid/display/escape.py,sha256=rG7x82_S91SRdfKXOEzkawDFtmVk5_KiKIY4Bh2mf7s,17826
27
27
  urwid/display/html_fragment.py,sha256=lQRqr-hTrknQyZTtzPDp9zr-TWOT4NcuSsusS-LXIOU,8547
28
28
  urwid/display/lcd.py,sha256=qXfuyZcicarrZM-O-ccPFBPjflD3_bLMv3IQzmYI43E,17607
@@ -35,9 +35,9 @@ urwid/event_loop/glib_loop.py,sha256=GFoLAenoWKm-13rTBKzCF2JdCEryJKpMo25aidZ7BWs
35
35
  urwid/event_loop/main_loop.py,sha256=gR2jGmqg1-CXFdNDlt-NizdS5AA7EZfmp6sW-nXwa18,26000
36
36
  urwid/event_loop/select_loop.py,sha256=5ZkIPqyIVJdWRTC89Ca5h8ub_-jpqXjFZaKqiWhdkDg,7534
37
37
  urwid/event_loop/tornado_loop.py,sha256=VNgXW2gO4edcYDjyEGb86yOHrE0NNXQUPXIOfJyZnAk,7100
38
- urwid/event_loop/trio_loop.py,sha256=46uFQ1O-AM8EaJETCsXzECDNviYMyzOsDKQoJgMHQSk,10468
38
+ urwid/event_loop/trio_loop.py,sha256=RicEe56BDFmIE5dbMvuqrGhUFIGSx4RliIryNF_62XQ,10593
39
39
  urwid/event_loop/twisted_loop.py,sha256=CtpWBzxNp_y7LHejnXIS67B-iboM3irb_MuI_FtXzc0,9219
40
- urwid/event_loop/zmq_loop.py,sha256=wt4lE0hnDODTVaAMuB5wCSAD5yQ6D9pj8_G_7iNGBUI,9074
40
+ urwid/event_loop/zmq_loop.py,sha256=YK_AkfLf8tayWrpCgQtKwWYuj-F1uMBluUJxPQLagNs,9114
41
41
  urwid/widget/__init__.py,sha256=lEFAuQKYnGKS9-dhUggItnnm9Bvbbuk7RAKvzrs8xkI,4683
42
42
  urwid/widget/attr_map.py,sha256=L6svBcabtXeSaU2cNrgDv4Nne6QYk-nvVbr88sA4WnY,6205
43
43
  urwid/widget/attr_wrap.py,sha256=pJQHVNlwcX5IgpdSmTqYOt63EX-p5hA0mJfXtWXJ6wg,4830
@@ -51,7 +51,7 @@ urwid/widget/divider.py,sha256=cM0gWHAqBz7E8l52CGEWWDMSVQkPNDjwy-t3ptbmh2s,3251
51
51
  urwid/widget/edit.py,sha256=qgVYeg_hX6tqRUiuLQkYwYKmWcfVLrLzAG1a5Au6S-w,23732
52
52
  urwid/widget/filler.py,sha256=EEnyAawdKXuwf79pErfNuvqsU1SVTutcMUrwWkU4wfo,14665
53
53
  urwid/widget/frame.py,sha256=AOe4FwjvwcIwrpXqyZkCwSZWwAALNl1XRMAKx6ZXYWs,21834
54
- urwid/widget/grid_flow.py,sha256=otujeOTWYDr4gwuDikBm9zZd8SUgma9yvQ1hDWI-dGk,21514
54
+ urwid/widget/grid_flow.py,sha256=PNgs6YN3-cE5ZLlPns_5rwxrSMynB7T5BZvKohSjiPA,21817
55
55
  urwid/widget/line_box.py,sha256=V750xiZtkw6_uRXLhNY91ER3pXwwrZstVv_IJUZd_YY,6884
56
56
  urwid/widget/listbox.py,sha256=EaGo13fpt4Oy9V00n27U-2PhOWa7-nmsTgnddKv9GII,74392
57
57
  urwid/widget/monitored_list.py,sha256=mZUPYB1yhuKN6su6_VjmoiE0LlTXsYxkH14pbif0tbc,19264
@@ -60,15 +60,15 @@ urwid/widget/padding.py,sha256=pBXQsnkySV1GXgveg2Ivm6SCqHiGa2YkYSjXaoCUIHk,21334
60
60
  urwid/widget/pile.py,sha256=aIzKYNrSQtbHVk_bn2PElHUiSdsO_NKnL4mTu-sXm4I,38628
61
61
  urwid/widget/popup.py,sha256=vw9_S1UC6UMy5Roc4qK8NXgH5_dDGxoHmpDAi_u9wsI,5974
62
62
  urwid/widget/progress_bar.py,sha256=HRnIu2V2_4wgsnAdrhK-GVVToyLaXRH0gtlkWllA4Mo,4767
63
- urwid/widget/scrollable.py,sha256=5L7axfY0Nn63H-NGIgJEyogl8e09ZdyKL5YxGHcmP1M,24352
63
+ urwid/widget/scrollable.py,sha256=Smn5X1wvxm3juqFZGOOKREZS4eD4PIyZLeqWAVuAlos,24542
64
64
  urwid/widget/solid_fill.py,sha256=NZRDSRK0lP4r7gXcKDgVaKEoeOcWvtrY5k2aueQEEL4,1260
65
65
  urwid/widget/text.py,sha256=jy15hL6rCBoJdZviq2jJ-i9eO6vEcxvzCIVAZs12AUw,12187
66
66
  urwid/widget/treetools.py,sha256=5s3Dnp2PCz4wQccutmdvsTTbAROJMLehXe4moB5POY0,17387
67
67
  urwid/widget/widget.py,sha256=A0ZjvDjLqhdzelPFC96Ozo1voIoGkxftNmJh8X1IyNI,29557
68
68
  urwid/widget/widget_decoration.py,sha256=6eEPvtF7wk2n1csIBWrnXAosprFl2pZiQ7SoCpwKnJM,5736
69
69
  urwid/widget/wimp.py,sha256=4wfzTQBLMbhicSlL64hBPb-1W5FAFrIKfb43i10MKSY,27305
70
- urwid-2.6.12.dist-info/COPYING,sha256=NrbT-keRaUP9X-wxPFhHhJRgR-wTN6eLRA5ZkstZX4k,26434
71
- urwid-2.6.12.dist-info/METADATA,sha256=vu73SUW1PsgXOQBYsO0xEawmoT0WNQcMYbmW-ROhWDg,11043
72
- urwid-2.6.12.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
73
- urwid-2.6.12.dist-info/top_level.txt,sha256=AwxQA43kNkjHbhYELXHBKrQ01X5CR2KnDzU07cVqilY,6
74
- urwid-2.6.12.dist-info/RECORD,,
70
+ urwid-2.6.14.dist-info/COPYING,sha256=NrbT-keRaUP9X-wxPFhHhJRgR-wTN6eLRA5ZkstZX4k,26434
71
+ urwid-2.6.14.dist-info/METADATA,sha256=11Ld6T3rIMn15o5mQmpnTBP9_5Oj31gVeRZ4nv-_Hz4,11043
72
+ urwid-2.6.14.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
73
+ urwid-2.6.14.dist-info/top_level.txt,sha256=AwxQA43kNkjHbhYELXHBKrQ01X5CR2KnDzU07cVqilY,6
74
+ urwid-2.6.14.dist-info/RECORD,,
File without changes