|
1 | | -from __future__ import division |
2 | 1 |
|
3 | 2 | import pycparser.c_ast as c_ast |
4 | 3 | import pycparser.c_parser |
@@ -51,8 +50,7 @@ def children(self): |
51 | 50 | return tuple(nodelist) |
52 | 51 |
|
53 | 52 | def __iter__(self): |
54 | | - for child in (self.types or []): |
55 | | - yield child |
| 53 | + yield from (self.types or []) |
56 | 54 |
|
57 | 55 | attr_names = () |
58 | 56 |
|
@@ -260,7 +258,7 @@ def __iter__(self): |
260 | 258 |
|
261 | 259 | # {{{ attributes |
262 | 260 |
|
263 | | -class _AttributesMixin(object): |
| 261 | +class _AttributesMixin: |
264 | 262 | def p_attributes_opt_1(self, p): |
265 | 263 | """ attributes_opt : attribute_decl attributes_opt |
266 | 264 | """ |
@@ -309,7 +307,7 @@ def p_function_specifier_attr(self, p): |
309 | 307 |
|
310 | 308 | # {{{ asm |
311 | 309 |
|
312 | | -class _AsmMixin(object): |
| 310 | +class _AsmMixin: |
313 | 311 | def p_asm_opt_1(self, p): |
314 | 312 | """ asm_opt : empty |
315 | 313 | """ |
@@ -494,7 +492,7 @@ class GnuCParser(_AsmAndAttributesMixin, CParserBase): |
494 | 492 |
|
495 | 493 | from pycparserext.ext_c_lexer import GnuCLexer as lexer_class # noqa |
496 | 494 |
|
497 | | - initial_type_symbols = {"__builtin_va_list"} |
| 495 | + initial_type_symbols = frozenset({"__builtin_va_list"}) |
498 | 496 |
|
499 | 497 | def p_function_specifier_gnu(self, p): |
500 | 498 | """ function_specifier : __INLINE |
@@ -600,7 +598,7 @@ def p_unified_volatile_gnu(self, p): |
600 | 598 | class OpenCLCParser(_AsmAndAttributesMixin, CParserBase): |
601 | 599 | from pycparserext.ext_c_lexer import OpenCLCLexer as lexer_class # noqa |
602 | 600 |
|
603 | | - INT_BIT_COUNTS = [8, 16, 32, 64] |
| 601 | + INT_BIT_COUNTS = (8, 16, 32, 64) |
604 | 602 | initial_type_symbols = ( |
605 | 603 | { |
606 | 604 | "%s%d" % (base_name, count) |
|
0 commit comments