mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
remove unneeded uses of str()
This commit is contained in:
parent
d481e3d791
commit
cf7925dfc6
4 changed files with 4 additions and 4 deletions
|
@ -123,7 +123,7 @@ class FixImports(fixer_base.BaseFix):
|
||||||
import_mod = results.get("module_name")
|
import_mod = results.get("module_name")
|
||||||
if import_mod:
|
if import_mod:
|
||||||
mod_name = import_mod.value
|
mod_name = import_mod.value
|
||||||
new_name = str(self.mapping[mod_name])
|
new_name = self.mapping[mod_name]
|
||||||
import_mod.replace(Name(new_name, prefix=import_mod.get_prefix()))
|
import_mod.replace(Name(new_name, prefix=import_mod.get_prefix()))
|
||||||
if "name_import" in results:
|
if "name_import" in results:
|
||||||
# If it's not a "from x import x, y" or "import x as y" import,
|
# If it's not a "from x import x, y" or "import x as y" import,
|
||||||
|
|
|
@ -19,5 +19,5 @@ class FixMethodattrs(fixer_base.BaseFix):
|
||||||
|
|
||||||
def transform(self, node, results):
|
def transform(self, node, results):
|
||||||
attr = results["attr"][0]
|
attr = results["attr"][0]
|
||||||
new = str(MAP[attr.value])
|
new = MAP[attr.value]
|
||||||
attr.replace(Name(new, prefix=attr.get_prefix()))
|
attr.replace(Name(new, prefix=attr.get_prefix()))
|
||||||
|
|
|
@ -65,5 +65,5 @@ class FixRenames(fixer_base.BaseFix):
|
||||||
#import_mod = results.get("module")
|
#import_mod = results.get("module")
|
||||||
|
|
||||||
if mod_name and attr_name:
|
if mod_name and attr_name:
|
||||||
new_attr = str(LOOKUP[(mod_name.value, attr_name.value)])
|
new_attr = LOOKUP[(mod_name.value, attr_name.value)]
|
||||||
attr_name.replace(Name(new_attr, prefix=attr_name.get_prefix()))
|
attr_name.replace(Name(new_attr, prefix=attr_name.get_prefix()))
|
||||||
|
|
|
@ -56,7 +56,7 @@ class FixTypes(fixer_base.BaseFix):
|
||||||
PATTERN = '|'.join(_pats)
|
PATTERN = '|'.join(_pats)
|
||||||
|
|
||||||
def transform(self, node, results):
|
def transform(self, node, results):
|
||||||
new_value = str(_TYPE_MAPPING.get(results["name"].value))
|
new_value = _TYPE_MAPPING.get(results["name"].value)
|
||||||
if new_value:
|
if new_value:
|
||||||
return Name(new_value, prefix=node.get_prefix())
|
return Name(new_value, prefix=node.get_prefix())
|
||||||
return None
|
return None
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue