Reviewed-by: Dylan Baker <dy...@pnwbakers.com>
Quoting Mathieu Bridon (2018-07-05 06:17:36) > 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 <boche...@daitauha.fr> > --- > src/mapi/glapi/gen/glX_proto_common.py | 3 +-- > src/mapi/glapi/gen/glX_proto_send.py | 8 ++++---- > src/mapi/glapi/gen/gl_XML.py | 8 ++++---- > src/mapi/glapi/gen/typeexpr.py | 4 ++-- > 4 files changed, 11 insertions(+), 12 deletions(-) > > diff --git a/src/mapi/glapi/gen/glX_proto_common.py > b/src/mapi/glapi/gen/glX_proto_common.py > index adc20dc9f0..0559dd1609 100644 > --- a/src/mapi/glapi/gen/glX_proto_common.py > +++ b/src/mapi/glapi/gen/glX_proto_common.py > @@ -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 > diff --git a/src/mapi/glapi/gen/glX_proto_send.py > b/src/mapi/glapi/gen/glX_proto_send.py > index 7ab1eb4a70..c389872044 100644 > --- a/src/mapi/glapi/gen/glX_proto_send.py > +++ b/src/mapi/glapi/gen/glX_proto_send.py > @@ -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)) > > diff --git a/src/mapi/glapi/gen/gl_XML.py b/src/mapi/glapi/gen/gl_XML.py > index 52e2cab6b9..7cb276ec85 100644 > --- a/src/mapi/glapi/gen/gl_XML.py > +++ b/src/mapi/glapi/gen/gl_XML.py > @@ -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" > diff --git a/src/mapi/glapi/gen/typeexpr.py b/src/mapi/glapi/gen/typeexpr.py > index 5ff9798dad..1f710ea9e7 100644 > --- a/src/mapi/glapi/gen/typeexpr.py > +++ b/src/mapi/glapi/gen/typeexpr.py > @@ -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 > -- > 2.17.1 > > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
signature.asc
Description: signature
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev