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>tags/18.2-branchpoint
@@ -27,7 +27,6 @@ | |||
from __future__ import print_function | |||
import gl_XML, glX_XML | |||
import string | |||
class glx_proto_item_factory(glX_XML.glx_item_factory): | |||
@@ -67,7 +66,7 @@ class glx_print_proto(gl_XML.gl_print_base): | |||
return compsize | |||
elif len(param.count_parameter_list): | |||
parameters = string.join( param.count_parameter_list, "," ) | |||
parameters = ",".join( param.count_parameter_list ) | |||
compsize = "__gl%s_size(%s)" % (func.name, parameters) | |||
return compsize |
@@ -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)) | |||
@@ -29,7 +29,7 @@ from __future__ import print_function | |||
from collections import OrderedDict | |||
from decimal import Decimal | |||
import xml.etree.ElementTree as ET | |||
import re, sys, string | |||
import re, sys | |||
import os.path | |||
import typeexpr | |||
import static_data | |||
@@ -320,7 +320,7 @@ def create_parameter_string(parameters, include_names): | |||
if len(list) == 0: list = ["void"] | |||
return string.join(list, ", ") | |||
return ", ".join(list) | |||
class gl_item(object): | |||
@@ -578,9 +578,9 @@ class gl_parameter(object): | |||
list.append( str(s) ) | |||
if len(list) > 1 and use_parens : | |||
return "safe_mul(%s)" % (string.join(list, ", ")) | |||
return "safe_mul(%s)" % ", ".join(list) | |||
else: | |||
return string.join(list, " * ") | |||
return " * ".join(list) | |||
elif self.is_image(): | |||
return "compsize" |
@@ -26,7 +26,7 @@ | |||
from __future__ import print_function | |||
import string, copy | |||
import copy | |||
class type_node(object): | |||
def __init__(self): | |||
@@ -126,7 +126,7 @@ class type_expression(object): | |||
# Replace '*' with ' * ' in type_string. Then, split the string | |||
# into tokens, separated by spaces. | |||
tokens = string.split( string.replace( type_string, "*", " * " ) ) | |||
tokens = type_string.replace("*", " * ").split() | |||
const = 0 | |||
t = None |