[Utilities] Upgrade gyb to Python 3

This commit is contained in:
Karoly Lorentey committed 2021-09-22 19:25:08 -07:00
1 parent 6edab31515
commit fef04c75ae
4 files changed
+7 -20

No files matched your search

@@ -228,12 +228,12 @@ extension ${swiftType}.AtomicRepresentation: AtomicStorage {
}
}
% if swiftType <> "DoubleWord":
% if swiftType != "DoubleWord":
extension ${swiftType}: AtomicInteger {}
extension ${swiftType}.AtomicRepresentation: AtomicIntegerStorage {
% for (name, cname, op, label, doc) in integerOperations:
% defaultValue = " = 1" if label <> "" else ""
% defaultValue = " = 1" if label != "" else ""
@_semantics("atomics.requires_constant_orderings")
@_transparent @_alwaysEmitIntoClient
@discardableResult
+1 -1
View File
@@ -1,3 +1,3 @@
#!/usr/bin/env python2.7
#!/usr/bin/env python3
import gyb
gyb.main()
+3 -16
View File
@@ -2,26 +2,13 @@
# GYB: Generate Your Boilerplate (improved names welcome; at least
# this one's short). See -h output for instructions
from __future__ import print_function
import os
import re
import sys
import textwrap
import tokenize
from bisect import bisect
try:
from cStringIO import StringIO
except ImportError:
from io import StringIO
try:
basestring
except NameError:
basestring = str
from io import StringIO
def get_line_starts(s):
@@ -243,7 +230,7 @@ def tokenize_template(template_text):
# pull out the one matched key (ignoring internal patterns starting
# with _)
((kind, text), ) = (
(kind, text) for (kind, text) in m.groupdict().items()
(kind, text) for (kind, text) in list(m.groupdict().items())
if text is not None and kind[0] != '_')
if kind in ('literal', 'symbol'):
@@ -731,7 +718,7 @@ class Code(ASTNode):
# If we got a result, the code was an expression, so append
# its value
if result is not None \
or (isinstance(result, basestring) and result != ''):
or (isinstance(result, str) and result != ''):
from numbers import Number, Integral
result_string = None
if isinstance(result, Number) and not isinstance(result, Integral):
+1 -1
View File
@@ -81,5 +81,5 @@ def lowerFirst(str):
return str[:1].lower() + str[1:] if str else ""
def argLabel(label):
return label + ": " if label <> "_" else ""
return label + ": " if label != "_" else ""