Skip to content

Commit

Permalink
Don't special-case an isascii implementation for Python 3.6
Browse files Browse the repository at this point in the history
Python 3.7 is now our minimum-supported Python, and so we don't need to add
our own version of isascii any more.

See Textualize#2566.
  • Loading branch information
davep committed Oct 10, 2022
1 parent df76397 commit 419265b
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions rich/rule.py
Expand Up @@ -51,13 +51,9 @@ def __rich_console__(
) -> RenderResult:
width = options.max_width

# Python3.6 doesn't have an isascii method on str
isascii = getattr(str, "isascii", None) or (
lambda s: all(ord(c) < 128 for c in s)
)
characters = (
"-"
if (options.ascii_only and not isascii(self.characters))
if (options.ascii_only and not self.characters.isascii())
else self.characters
)

Expand Down

0 comments on commit 419265b

Please sign in to comment.