Re: [Fuego] [PATCH 5/8] Use actual string name with replace() instead of string.replace()
"Bird, Tim" <[email protected]> Fri, 13 May 2022 19:15:43 +0000
| Newsgroups | dev.linux.lists.fuego |
|---|---|
| Message-ID | <BYAPR13MB25030D53B17405F5B2051403FDCA9@BYAPR13MB2503.namprd13.prod.outlook.com> |
> -----Original Message----- > From: [email protected] <[email protected]= m> >=20 > From: Shivanand Kunijadar <[email protected]> >=20 > string.replace() is deprecated function and it is not supported in > python3. Use actual string name with replace() which is compatible > with python2 and python3. >=20 > Signed-off-by: Shivanand Kunijadar <[email protected]> > --- > scripts/ovgen.py | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) >=20 > diff --git a/scripts/ovgen.py b/scripts/ovgen.py > index a6e0f13..1386ff5 100755 > --- a/scripts/ovgen.py > +++ b/scripts/ovgen.py > @@ -408,15 +408,15 @@ def generateSpec(ts, fout): >=20 > for var in ts.variables: > varname =3D "%s_%s" % (ts.name, var) > - varname =3D string.replace(varname, ".", "_").upper() > + varname =3D varname.replace(".", "_").upper() > value =3D "%s" % (ts.variables[var]) > outStr =3D '%s=3D"%s"' % (varname, value) > debug_print(outStr, 3) > fout.write(outStr + "\n") >=20 > if ts.fail_case: > - tNameUp =3D string.replace(ts.name, ".", "_").upper() > - tNameUp =3D string.replace(tNameUp, "-", "_").upper() > + tNameUp =3D ts.name.replace(".", "_").upper() > + tNameUp =3D tNameUp.replace("-", "_").upper() > fc_num =3D len(ts.fail_case) > outNum =3D "%s_FAIL_CASE_COUNT=3D%s" % (tNameUp, fc_num) > fout.write(outNum + "\n") > -- > 2.20.1 >=20 Looks good. Applied. I also did a followup commit to remove 'import string' from the module, (and I renamed a an argument from 'string' to 'msg' in one function). This should help prevent accidental use of this module in the future. These were the only references to the string module in the code, so the import is no longer needed, and it's good form to remove no-longer-needed imports, to avoid future confusion. Thanks, -- Tim