Skip to content

Commit a7438f6

Browse files
committed
Handle width as optional argument
1 parent 6b3833c commit a7438f6

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

curtsies/formatstringarray.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
from typing import (
3333
Any,
34+
Optional,
3435
Union,
3536
List,
3637
Sequence,
@@ -249,7 +250,10 @@ def blink(x: str) -> str:
249250

250251

251252
def fsarray(
252-
strings: Sequence[Union[FmtStr, str]], *args: Any, **kwargs: Any
253+
strings: Sequence[Union[FmtStr, str]],
254+
width: Optional[int] = None,
255+
*args: Any,
256+
**kwargs: Any,
253257
) -> FSArray:
254258
"""fsarray(list_of_FmtStrs_or_strings, width=None) -> FSArray
255259
@@ -259,9 +263,7 @@ def fsarray(
259263
are of length greater than this width"""
260264

261265
strings = list(strings)
262-
if "width" in kwargs:
263-
width = kwargs["width"]
264-
del kwargs["width"]
266+
if width is not None:
265267
if strings and any(len(s) > width for s in strings):
266268
raise ValueError(f"Those strings won't fit for width {width}")
267269
else:

0 commit comments

Comments
 (0)