Checks whether `chars` is a whitespace character.
(char)
| 356 | |
| 357 | |
| 358 | def _is_whitespace(char): |
| 359 | """Checks whether `chars` is a whitespace character.""" |
| 360 | # \t, \n, and \r are technically contorl characters but we treat them |
| 361 | # as whitespace since they are generally considered as such. |
| 362 | if char == " " or char == "\t" or char == "\n" or char == "\r": |
| 363 | return True |
| 364 | cat = unicodedata.category(char) |
| 365 | if cat == "Zs": |
| 366 | return True |
| 367 | return False |
| 368 | |
| 369 | |
| 370 | def _is_control(char): |