Checks whether `chars` is a whitespace character.
(char)
| 45 | |
| 46 | |
| 47 | def _is_whitespace(char): |
| 48 | """Checks whether `chars` is a whitespace character.""" |
| 49 | # \t, \n, and \r are technically contorl characters but we treat them |
| 50 | # as whitespace since they are generally considered as such. |
| 51 | if char == " " or char == "\t" or char == "\n" or char == "\r": |
| 52 | return True |
| 53 | cat = unicodedata.category(char) |
| 54 | if cat == "Zs": |
| 55 | return True |
| 56 | return False |
| 57 | |
| 58 | |
| 59 | def _is_control(char): |
no outgoing calls
no test coverage detected