pyupgrade: Replace Text with str.

We uses `pyupgrade --py3-plus` to automatically replace all occurence
of `Text`. But manual fix is required to remove the unused imports. Note
that with this configuration pyupgrade also convert string literals to
.format(...) style, which is manually not included in the commit as well.
This commit is contained in:
PIG208 2021-05-28 19:13:13 +08:00 committed by Tim Abbott
parent a54cccc012
commit e27ac0ddbe
11 changed files with 42 additions and 46 deletions

View file

@ -22,7 +22,6 @@ from typing import (
Mapping,
Optional,
Sequence,
Text,
Tuple,
Union,
)
@ -313,7 +312,7 @@ def get_default_config_filename() -> Optional[str]:
return config_file
def validate_boolean_field(field: Optional[Text]) -> Union[bool, None]:
def validate_boolean_field(field: Optional[str]) -> Union[bool, None]:
if not isinstance(field, str):
return None
@ -563,7 +562,7 @@ class Client:
req_files = []
for (key, val) in orig_request.items():
if isinstance(val, str) or isinstance(val, Text):
if isinstance(val, str) or isinstance(val, str):
request[key] = val
else:
request[key] = json.dumps(val)