diff options
Diffstat (limited to 'buildscripts/idl/idl/common.py')
-rw-r--r-- | buildscripts/idl/idl/common.py | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/buildscripts/idl/idl/common.py b/buildscripts/idl/idl/common.py index 8a029b0ca97..39f5f032183 100644 --- a/buildscripts/idl/idl/common.py +++ b/buildscripts/idl/idl/common.py @@ -31,8 +31,6 @@ IDL Common classes. Classes which are shared among both the IDL idl.syntax and idl.AST trees. """ -from __future__ import absolute_import, print_function, unicode_literals - import os import string from typing import Mapping @@ -44,7 +42,7 @@ COMMAND_NAMESPACE_TYPE = "type" def title_case(name): - # type: (unicode) -> unicode + # type: (str) -> str """Return a CapitalCased version of a string.""" # Only capitalize the last part of a fully-qualified name @@ -56,13 +54,13 @@ def title_case(name): def camel_case(name): - # type: (unicode) -> unicode + # type: (str) -> str """Return a camelCased version of a string.""" return name[0:1].lower() + name[1:] def qualify_cpp_name(cpp_namespace, cpp_type_name): - # type: (unicode, unicode) -> unicode + # type: (str, str) -> str """Preprend a type name with a C++ namespace if cpp_namespace is not None.""" if cpp_namespace: return cpp_namespace + "::" + cpp_type_name @@ -71,7 +69,7 @@ def qualify_cpp_name(cpp_namespace, cpp_type_name): def _escape_template_string(template): - # type: (unicode) -> unicode + # type: (str) -> str """Escape the '$' in template strings unless followed by '{'.""" # See https://docs.python.org/2/library/string.html#template-strings template = template.replace('${', '#{') @@ -80,20 +78,20 @@ def _escape_template_string(template): def template_format(template, template_params=None): - # type: (unicode, Mapping[unicode,unicode]) -> unicode + # type: (str, Mapping[str,str]) -> str """Write a template to the stream.""" - # Ignore the types since we use unicode literals and this expects str but works fine with - # unicode. + # Ignore the types since we use str literals and this expects str but works fine with + # str. # See https://docs.python.org/2/library/string.html#template-strings template = _escape_template_string(template) return string.Template(template).substitute(template_params) # type: ignore def template_args(template, **kwargs): - # type: (unicode, **unicode) -> unicode + # type: (str, **str) -> str """Write a template to the stream.""" - # Ignore the types since we use unicode literals and this expects str but works fine with - # unicode. + # Ignore the types since we use str literals and this expects str but works fine with + # str. # See https://docs.python.org/2/library/string.html#template-strings template = _escape_template_string(template) return string.Template(template).substitute(kwargs) # type: ignore @@ -103,7 +101,7 @@ class SourceLocation(object): """Source location information about an idl.syntax or idl.AST object.""" def __init__(self, file_name, line, column): - # type: (unicode, int, int) -> None + # type: (str, int, int) -> None """Construct a source location.""" self.file_name = file_name self.line = line |