python: Stop using the string module

Most functions in the builtin string module also exist as methods of
string objects.

Since the functions were removed from the string module in Python 3,
using the instance methods directly makes the code compatible with both
Python 2 and Python 3.

Signed-off-by: Mathieu Bridon <bochecha@daitauha.fr>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
This commit is contained in:
Mathieu Bridon
2018-07-05 15:17:36 +02:00
committed by Dylan Baker
parent 1d209275c2
commit fdf946ffbf
4 changed files with 11 additions and 12 deletions

View File

@@ -31,7 +31,7 @@ from __future__ import print_function
import argparse
import gl_XML, glX_XML, glX_proto_common, license
import copy, string
import copy
def convertStringForXCB(str):
tmp = ""
@@ -39,10 +39,10 @@ def convertStringForXCB(str):
i = 0
while i < len(str):
if str[i:i+3] in special:
tmp = '%s_%s' % (tmp, string.lower(str[i:i+3]))
tmp = '%s_%s' % (tmp, str[i:i+3].lower())
i = i + 2;
elif str[i].isupper():
tmp = '%s_%s' % (tmp, string.lower(str[i]))
tmp = '%s_%s' % (tmp, str[i].lower())
else:
tmp = '%s%s' % (tmp, str[i])
i += 1
@@ -662,7 +662,7 @@ generic_%u_byte( GLint rop, const void * ptr )
if len( condition_list ) > 0:
if len( condition_list ) > 1:
skip_condition = "(%s)" % (string.join( condition_list, ") && (" ))
skip_condition = "(%s)" % ") && (".join( condition_list )
else:
skip_condition = "%s" % (condition_list.pop(0))