Skip to content

Commit 0f26a98

Browse files
Matt Bogosianposita
authored andcommitted
Formatting cleanup
1 parent f7bd292 commit 0f26a98

File tree

17 files changed

+71
-67
lines changed

17 files changed

+71
-67
lines changed

example/generator/unstone/unstone.stoneg.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ def generate_data_type(self, data_type):
5252
self.emit('%s %s' % (field.name, type_repr))
5353
else:
5454
self.emit('%s %s = %s' %
55-
(field.name, type_repr,
56-
self.format_value(field.default)))
55+
(field.name, type_repr, self.format_value(field.default)))
5756
if field.doc is not None:
5857
with self.indent():
5958
self.emit(self.format_value(field.doc))
@@ -86,11 +85,12 @@ def generate_data_type(self, data_type):
8685
def generate_route(self, route):
8786
"""Output a route definition."""
8887
self.emit('')
89-
self.emit('route %s (%s, %s, %s)' %
90-
(route.name,
91-
self.format_data_type(route.arg_data_type),
92-
self.format_data_type(route.result_data_type),
93-
self.format_data_type(route.error_data_type)))
88+
self.emit('route %s (%s, %s, %s)' % (
89+
route.name,
90+
self.format_data_type(route.arg_data_type),
91+
self.format_data_type(route.result_data_type),
92+
self.format_data_type(route.error_data_type)
93+
))
9494
# Output the docstring.
9595
with self.indent():
9696
if route.doc is not None:

stone/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def main():
137137

138138
if '--' in sys.argv:
139139
cli_args = sys.argv[1:sys.argv.index('--')]
140-
generator_args = sys.argv[sys.argv.index('--')+1:]
140+
generator_args = sys.argv[sys.argv.index('--') + 1:]
141141
else:
142142
cli_args = sys.argv[1:]
143143
generator_args = []

stone/cli_helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def t_error(self, token):
9696
token.lexer.skip(1)
9797

9898
# Test output
99-
def test(self,data):
99+
def test(self, data):
100100
self.lexer.input(data)
101101
while True:
102102
tok = self.lexer.token()

stone/data_type.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ def make_compact(d):
757757

758758
for example in examples.values():
759759
if (isinstance(example.value, dict) and
760-
len(example.value) == 1 and '.tag' in example.value):
760+
len(example.value) == 1 and '.tag' in example.value):
761761
# Handle the case where the top-level of the example can be
762762
# made compact.
763763
example.value = example.value['.tag']

stone/generator.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,8 @@ def emit_wrapped_text(
283283
prefix = indent + prefix
284284

285285
self.emit_raw(textwrap.fill(s,
286-
initial_indent=prefix+initial_prefix,
287-
subsequent_indent=prefix+subsequent_prefix,
286+
initial_indent=prefix + initial_prefix,
287+
subsequent_indent=prefix + subsequent_prefix,
288288
width=width,
289289
break_long_words=break_long_words,
290290
break_on_hyphens=break_on_hyphens,
@@ -416,11 +416,11 @@ def emit_list(items):
416416
@contextmanager
417417
def block(
418418
self,
419-
before='', # type: typing.Text
420-
after='', # type: typing.Text
421-
delim=('{','}'), # type: DelimTuple
422-
dent=None, # type: typing.Optional[int]
423-
allman=False # type: bool
419+
before='', # type: typing.Text
420+
after='', # type: typing.Text
421+
delim=('{', '}'), # type: DelimTuple
422+
dent=None, # type: typing.Optional[int]
423+
allman=False # type: bool
424424
):
425425
# type: (...) -> typing.Iterator[None]
426426
"""

stone/target/js_types.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@ def die(m, extra_arg_raw):
113113
if 'match' not in extra_arg:
114114
die('No match key', extra_arg_raw)
115115
elif (not isinstance(extra_arg['match'], list) or
116-
len(extra_arg['match']) != 2):
116+
len(extra_arg['match']) != 2):
117117
die('match key is not a list of two strings', extra_arg_raw)
118118
elif (not isinstance(extra_arg['match'][0], six.text_type) or
119-
not isinstance(extra_arg['match'][1], six.text_type)):
119+
not isinstance(extra_arg['match'][1], six.text_type)):
120120
print(type(extra_arg['match'][0]))
121121
die('match values are not strings', extra_arg_raw)
122122
elif 'arg_name' not in extra_arg:
@@ -128,7 +128,7 @@ def die(m, extra_arg_raw):
128128
elif not isinstance(extra_arg['arg_type'], six.text_type):
129129
die('arg_type is not a string', extra_arg_raw)
130130
elif ('arg_docstring' in extra_arg and
131-
not isinstance(extra_arg['arg_docstring'], six.text_type)):
131+
not isinstance(extra_arg['arg_docstring'], six.text_type)):
132132
die('arg_docstring is not a string', extra_arg_raw)
133133

134134
attr_key, attr_val = extra_arg['match'][0], extra_arg['match'][1]

stone/target/obj_c_types.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,7 @@ def _generate_union_deserializer(self, union):
958958
caller=fmt_alloc_call(union_name), callee=callee)))
959959
else:
960960
reason = ('[NSString stringWithFormat:@"Tag has an '
961-
'invalid value: \\\"%@\\\".", valueDict[@".tag"]]')
961+
'invalid value: \\\"%@\\\".", valueDict[@".tag"]]')
962962
self._generate_throw_error('InvalidTag', reason)
963963
self.emit()
964964

@@ -1129,8 +1129,8 @@ def _generate_union_tag_access_signatures(self, union):
11291129
self.emit(comment_prefix)
11301130
if not is_void_type(field.data_type):
11311131
warning_str = ('@note Call this method and ensure it returns true before '
1132-
'accessing the `{}` property, otherwise a runtime exception '
1133-
'will be thrown.')
1132+
'accessing the `{}` property, otherwise a runtime exception '
1133+
'will be thrown.')
11341134
self.emit_wrapped_text(warning_str.format(
11351135
fmt_var(field.name)), prefix=comment_prefix)
11361136
self.emit(comment_prefix)

stone/target/python_rsrc/stone_serializers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ def encode_primitive(self, validator, value):
242242
else:
243243
return base64.b64encode(value).decode('ascii')
244244
elif isinstance(validator, bv.Integer) \
245-
and isinstance(value, bool):
245+
and isinstance(value, bool):
246246
# bool is sub-class of int so it passes Integer validation,
247247
# but we want the bool to be encoded as ``0`` or ``1``, rather
248248
# than ``False`` or ``True``, respectively
@@ -302,8 +302,8 @@ def encode_union(self, validator, value):
302302

303303
field_validator = validator.definition._tagmap[value._tag]
304304
is_none = isinstance(field_validator, bv.Void) \
305-
or (isinstance(field_validator, bv.Nullable)
306-
and value._value is None)
305+
or (isinstance(field_validator, bv.Nullable)
306+
and value._value is None)
307307

308308
def encode_sub(sub_validator, sub_value, parent_tag):
309309
try:

stone/target/python_rsrc/stone_validators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ def validate(self, val):
363363
raise ValidationError('expected timestamp, got %s'
364364
% generic_type_name(val))
365365
elif val.tzinfo is not None and \
366-
val.tzinfo.utcoffset(val).total_seconds() != 0:
366+
val.tzinfo.utcoffset(val).total_seconds() != 0:
367367
raise ValidationError('timestamp should have either a UTC '
368368
'timezone or none set at all')
369369
return val

stone/target/swift.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def fmt_serial_type(data_type):
161161
if is_user_defined_type(data_type):
162162
result = '{}.{}Serializer'
163163
result = result.format(fmt_class(data_type.namespace.name),
164-
fmt_class(data_type.name))
164+
fmt_class(data_type.name))
165165
else:
166166
result = _serial_type_table.get(data_type.__class__, fmt_class(data_type.name))
167167

@@ -177,7 +177,7 @@ def fmt_serial_obj(data_type):
177177
if is_user_defined_type(data_type):
178178
result = '{}.{}Serializer()'
179179
result = result.format(fmt_class(data_type.namespace.name),
180-
fmt_class(data_type.name))
180+
fmt_class(data_type.name))
181181
else:
182182
result = _serial_type_table.get(data_type.__class__, fmt_class(data_type.name))
183183

0 commit comments

Comments
 (0)