コード例 #1
0
    def render(__stream, econtext, rcontext, __i18n_domain=None, __i18n_context=None):
        __append = __stream.append
        __re_amp = g_re_amp
        __token = None
        __re_needs_escape = g_re_needs_escape

        def __convert(target):
            if (target is None):
                return
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except AttributeError:
                            __converted = convert(target)
                            target = (str(target) if (target is __converted) else __converted)
                        else:
                            target = target()
            return target

        def __quote(target, quote, quote_entity, default, default_marker):
            if (target is None):
                return
            if (target is default_marker):
                return default
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except:
                            __converted = convert(target)
                            target = (str(target) if (target is __converted) else __converted)
                        else:
                            return target()
                if (target is not None):
                    try:
                        escape = (__re_needs_escape(target) is not None)
                    except TypeError:
                        pass
                    else:
                        if escape:
                            if ('&' in target):
                                target = target.replace('&', '&')
                            if ('<' in target):
                                target = target.replace('<', '&lt;')
                            if ('>' in target):
                                target = target.replace('>', '&gt;')
                            if ((quote is not None) and (quote in target)):
                                target = target.replace(quote, quote_entity)
            return target
        translate = econtext['__translate']
        decode = econtext['__decode']
        convert = econtext['__convert']
        on_error_handler = econtext['__on_error_handler']
        try:
            getitem = econtext.__getitem__
            get = econtext.get

            # <Interpolation value=<Substitution 'grf {\n\tgrfid: "\\4A\\44\\88\\07";\n\tname: string(STR_GRF_NAME);\n\tdesc: string(STR_GRF_DESC);\n\turl: string(STR_GRF_URL);\n\tversion: ${repo_vars.repo_revision};\n\tmin_compatible_version: 9030;\n\tparam 0 {\n\t    ' (1:0)> braces_required=True translation=False at 7fe5c69922b0> -> __content_140624874349824
            __token = 0
            __token = 127
            __content_140624874349824 = _lookup_attr(getitem('repo_vars'), 'repo_revision')
            __content_140624874349824 = __quote(__content_140624874349824, '\x00', '&#0;', None, False)
            __content_140624874349824 = ('%s%s%s' % ('grf {\n\tgrfid: "\\4A\\44\\88\\07";\n\tname: string(STR_GRF_NAME);\n\tdesc: string(STR_GRF_DESC);\n\turl: string(STR_GRF_URL);\n\tversion: ', (__content_140624874349824 if (__content_140624874349824 is not None) else ''), ';\n\tmin_compatible_version: 9030;\n\tparam 0 {\n\t    ', ))
            if (__content_140624874349824 is None):
                pass
            else:
                if (__content_140624874349824 is False):
                    __content_140624874349824 = None
                else:
                    __tt = type(__content_140624874349824)
                    if ((__tt is int) or (__tt is float) or (__tt is int)):
                        __content_140624874349824 = str(__content_140624874349824)
                    else:
                        if (__tt is bytes):
                            __content_140624874349824 = decode(__content_140624874349824)
                        else:
                            if (__tt is not str):
                                try:
                                    __content_140624874349824 = __content_140624874349824.__html__
                                except get('AttributeError', AttributeError):
                                    __converted = convert(__content_140624874349824)
                                    __content_140624874349824 = (str(__content_140624874349824) if (__content_140624874349824 is __converted) else __converted)
                                else:
                                    __content_140624874349824 = __content_140624874349824()
            if (__content_140624874349824 is not None):
                __append(__content_140624874349824)

            # <Interpolation value=<Substitution '\n\t\teconomy_selection {\n\t\t\tname: string(STR_PARAM_NAME_ECONOMIES);\n\t\t\tdesc: string(STR_PARAM_DESC_ECONOMIES);\n\t\t\tmin_value: 0;\n\t\t\tmax_value: ${len(economies)-1};\n\t\t\tnames: {\n\t\t\t    ' (9:122)> braces_required=True translation=False at 7fe5c6992390> -> __content_140624874349824
            __token = 320
            __token = 459
            __content_140624874349824 = (len(getitem('economies')) - 1)
            __content_140624874349824 = __quote(__content_140624874349824, '\x00', '&#0;', None, False)
            __content_140624874349824 = ('%s%s%s' % ('\n\t\teconomy_selection {\n\t\t\tname: string(STR_PARAM_NAME_ECONOMIES);\n\t\t\tdesc: string(STR_PARAM_DESC_ECONOMIES);\n\t\t\tmin_value: 0;\n\t\t\tmax_value: ', (__content_140624874349824 if (__content_140624874349824 is not None) else ''), ';\n\t\t\tnames: {\n\t\t\t    ', ))
            if (__content_140624874349824 is None):
                pass
            else:
                if (__content_140624874349824 is False):
                    __content_140624874349824 = None
                else:
                    __tt = type(__content_140624874349824)
                    if ((__tt is int) or (__tt is float) or (__tt is int)):
                        __content_140624874349824 = str(__content_140624874349824)
                    else:
                        if (__tt is bytes):
                            __content_140624874349824 = decode(__content_140624874349824)
                        else:
                            if (__tt is not str):
                                try:
                                    __content_140624874349824 = __content_140624874349824.__html__
                                except get('AttributeError', AttributeError):
                                    __converted = convert(__content_140624874349824)
                                    __content_140624874349824 = (str(__content_140624874349824) if (__content_140624874349824 is __converted) else __converted)
                                else:
                                    __content_140624874349824 = __content_140624874349824()
            if (__content_140624874349824 is not None):
                __append(__content_140624874349824)
            __backup_economy_140624881796208 = get('economy', __marker)

            # <Value 'economies' (16:44)> -> __iterator
            __token = 534
            __iterator = getitem('economies')
            (__iterator, ____index_140624856163664, ) = getitem('repeat')('economy', __iterator)
            econtext['economy'] = None
            for __item in __iterator:
                econtext['economy'] = __item

                # <Interpolation value=<Substitution '\n                    ${repeat.economy.index}: string(STR_PARAM_VALUE_ECONOMIES_${economy.id});\n\t\t\t    ' (16:55)> braces_required=True translation=False at 7fe5c6992588> -> __content_140624874349824
                __token = 566
                __token = 568
                __content_140624874349824 = _lookup_attr(_lookup_attr(getitem('repeat'), 'economy'), 'index')
                __content_140624874349824 = __quote(__content_140624874349824, '\x00', '&#0;', None, False)
                __token = 626
                __content_140624874349824_624 = _lookup_attr(getitem('economy'), 'id')
                __content_140624874349824_624 = __quote(__content_140624874349824_624, '\x00', '&#0;', None, False)
                __content_140624874349824 = ('%s%s%s%s%s' % ('\n                    ', (__content_140624874349824 if (__content_140624874349824 is not None) else ''), ': string(STR_PARAM_VALUE_ECONOMIES_', (__content_140624874349824_624 if (__content_140624874349824_624 is not None) else ''), ');\n\t\t\t    ', ))
                if (__content_140624874349824 is None):
                    pass
                else:
                    if (__content_140624874349824 is False):
                        __content_140624874349824 = None
                    else:
                        __tt = type(__content_140624874349824)
                        if ((__tt is int) or (__tt is float) or (__tt is int)):
                            __content_140624874349824 = str(__content_140624874349824)
                        else:
                            if (__tt is bytes):
                                __content_140624874349824 = decode(__content_140624874349824)
                            else:
                                if (__tt is not str):
                                    try:
                                        __content_140624874349824 = __content_140624874349824.__html__
                                    except get('AttributeError', AttributeError):
                                        __converted = convert(__content_140624874349824)
                                        __content_140624874349824 = (str(__content_140624874349824) if (__content_140624874349824 is __converted) else __converted)
                                    else:
                                        __content_140624874349824 = __content_140624874349824()
                if (__content_140624874349824 is not None):
                    __append(__content_140624874349824)
                ____index_140624856163664 -= 1
                if (____index_140624856163664 > 0):
                    __append('')
            if (__backup_economy_140624881796208 is __marker):
                del econtext['economy']
            else:
                econtext['economy'] = __backup_economy_140624881796208
            __append('\n\t\t\t};\n\t\t}\n\t}\n\tparam 2 {\n\t\t')
            __append('\n\t\t')
            __append('\n\t\tallow_close_secondary {\n\t\t\tname: string(STR_PARAM_NAME_SECONDARY_NEVER_CLOSE);\n\t\t\tdesc: string(STR_PARAM_DESC_SECONDARY_NEVER_CLOSE);\n\t\t\ttype: bool;\n\t\t\tbit: 1;\n\t\t}\n\t\trestrict_open_during_gameplay {\n\t\t\tname: string(STR_PARAM_NAME_NO_OPENINGS);\n\t\t\tdesc: string(STR_PARAM_DESC_NO_OPENINGS);\n\t\t\ttype: bool;\n\t\t\tbit: 2;\n\t\t}\n\t}\n\t')
            __append('\n\t')

            # <Interpolation value=<Substitution '\n\tparam 7 {\n\t\tprimary_level1_produced_percent {\n\t\t\tname: string(STR_PARAM_NAME_PRIMARY_LEVEL1_BONUS);\n\t\t\tdesc: string(STR_PARAM_DESC_PRIMARY_LEVEL_BONUS);\n\t\t\tdef_value: 150;\n\t\t\tmin_value: 100;\n\t\t\tmax_value: 1000;\n\t\t}\n\t}\n\tparam 9 {\n\t\tprimary_level2_produced_percent {\n\t\t\tname: string(STR_PARAM_NAME_PRIMARY_LEVEL2_BONUS);\n\t\t\tdesc: string(STR_PARAM_DESC_PRIMARY_LEVEL_BONUS);\n\t\t\tdef_value: 300;\n\t\t\tmin_value: 100;\n\t\t\tmax_value: 1000;\n\t\t}\n\t}\n\tparam 6 {\n\t\tprimary_level1_requirement {\n\t\t\tname: string(STR_PARAM_NAME_PRIMARY_LEVEL1_REQUIREMENT);\n\t\t\tdesc: string(STR_PARAM_DESC_PRIMARY_LEVEL_REQUIREMENT);\n\t\t\tdef_value: ${global_constants.FARM_MINE_SUPPLY_REQUIREMENT};\n\t\t\tmin_value: 1;\n\t\t\tmax_value: 10000;\n\t\t}\n\t}\n\tparam 8 {\n\t\tprimary_level2_requirement {\n\t\t\tname: string(STR_PARAM_NAME_PRIMARY_LEVEL2_REQUIREMENT);\n\t\t\tdesc: string(STR_PARAM_DESC_PRIMARY_LEVEL_REQUIREMENT);\n\t\t\tdef_value: ${5 * global_constants.FARM_MINE_SUPPLY_REQUIREMENT};\n\t\t\tmin_value: 1;\n\t\t\tmax_value: 10000;\n\t\t}\n\t}\n\tparam 4 {\n\t\tmarine_industry_max_coastal_distance {\n\t\t\tname: string(STR_PARAM_NAME_COAST_DISTANCE_MARINE_INDUSTRY);\n\t\t\tdesc: string(STR_PARAM_DESC_COAST_DISTANCE_MARINE_INDUSTRY);\n\t\t\ttype: int;\n\t\t\tdef_value: 0;\n\t\t\tmin_value: 0;\n\t\t\tmax_value: 255;\n\t\t\tnames: {\n\t\t\t\t0: string(STR_PARAM_VALUE_SECONDARY_NEVER_CLOSE_0);\n\t\t\t};\n\t\t}\n\t}\n}\n\nbasecost {\n\tPR_BUILD_INDUSTRY: 2;       // Industries are more expensive\n\tPR_BUILD_INDUSTRY_RAW : 2;  // Building primary industries is also expensive\n\tPR_CLEAR_INDUSTRY : 2;      // Deleting industries must also be expensive\n}\n\n' (51:6)> braces_required=True translation=False at 7fe5c69925f8> -> __content_140624874349824
            __token = 1449
            __token = 2063
            __content_140624874349824 = _lookup_attr(getitem('global_constants'), 'FARM_MINE_SUPPLY_REQUIREMENT')
            __content_140624874349824 = __quote(__content_140624874349824, '\x00', '&#0;', None, False)
            __token = 2333
            __content_140624874349824_2331 = (5 * _lookup_attr(getitem('global_constants'), 'FARM_MINE_SUPPLY_REQUIREMENT'))
            __content_140624874349824_2331 = __quote(__content_140624874349824_2331, '\x00', '&#0;', None, False)
            __content_140624874349824 = ('%s%s%s%s%s' % ('\n\tparam 7 {\n\t\tprimary_level1_produced_percent {\n\t\t\tname: string(STR_PARAM_NAME_PRIMARY_LEVEL1_BONUS);\n\t\t\tdesc: string(STR_PARAM_DESC_PRIMARY_LEVEL_BONUS);\n\t\t\tdef_value: 150;\n\t\t\tmin_value: 100;\n\t\t\tmax_value: 1000;\n\t\t}\n\t}\n\tparam 9 {\n\t\tprimary_level2_produced_percent {\n\t\t\tname: string(STR_PARAM_NAME_PRIMARY_LEVEL2_BONUS);\n\t\t\tdesc: string(STR_PARAM_DESC_PRIMARY_LEVEL_BONUS);\n\t\t\tdef_value: 300;\n\t\t\tmin_value: 100;\n\t\t\tmax_value: 1000;\n\t\t}\n\t}\n\tparam 6 {\n\t\tprimary_level1_requirement {\n\t\t\tname: string(STR_PARAM_NAME_PRIMARY_LEVEL1_REQUIREMENT);\n\t\t\tdesc: string(STR_PARAM_DESC_PRIMARY_LEVEL_REQUIREMENT);\n\t\t\tdef_value: ', (__content_140624874349824 if (__content_140624874349824 is not None) else ''), ';\n\t\t\tmin_value: 1;\n\t\t\tmax_value: 10000;\n\t\t}\n\t}\n\tparam 8 {\n\t\tprimary_level2_requirement {\n\t\t\tname: string(STR_PARAM_NAME_PRIMARY_LEVEL2_REQUIREMENT);\n\t\t\tdesc: string(STR_PARAM_DESC_PRIMARY_LEVEL_REQUIREMENT);\n\t\t\tdef_value: ', (__content_140624874349824_2331 if (__content_140624874349824_2331 is not None) else ''), ';\n\t\t\tmin_value: 1;\n\t\t\tmax_value: 10000;\n\t\t}\n\t}\n\tparam 4 {\n\t\tmarine_industry_max_coastal_distance {\n\t\t\tname: string(STR_PARAM_NAME_COAST_DISTANCE_MARINE_INDUSTRY);\n\t\t\tdesc: string(STR_PARAM_DESC_COAST_DISTANCE_MARINE_INDUSTRY);\n\t\t\ttype: int;\n\t\t\tdef_value: 0;\n\t\t\tmin_value: 0;\n\t\t\tmax_value: 255;\n\t\t\tnames: {\n\t\t\t\t0: string(STR_PARAM_VALUE_SECONDARY_NEVER_CLOSE_0);\n\t\t\t};\n\t\t}\n\t}\n}\n\nbasecost {\n\tPR_BUILD_INDUSTRY: 2;       // Industries are more expensive\n\tPR_BUILD_INDUSTRY_RAW : 2;  // Building primary industries is also expensive\n\tPR_CLEAR_INDUSTRY : 2;      // Deleting industries must also be expensive\n}\n\n', ))
            if (__content_140624874349824 is None):
                pass
            else:
                if (__content_140624874349824 is False):
                    __content_140624874349824 = None
                else:
                    __tt = type(__content_140624874349824)
                    if ((__tt is int) or (__tt is float) or (__tt is int)):
                        __content_140624874349824 = str(__content_140624874349824)
                    else:
                        if (__tt is bytes):
                            __content_140624874349824 = decode(__content_140624874349824)
                        else:
                            if (__tt is not str):
                                try:
                                    __content_140624874349824 = __content_140624874349824.__html__
                                except get('AttributeError', AttributeError):
                                    __converted = convert(__content_140624874349824)
                                    __content_140624874349824 = (str(__content_140624874349824) if (__content_140624874349824 is __converted) else __converted)
                                else:
                                    __content_140624874349824 = __content_140624874349824()
            if (__content_140624874349824 is not None):
                __append(__content_140624874349824)
            __append('\nif (param[6] == 0) { param[6] = 100; }\nif (param[7] == 0) { param[7] = 100; }\nif (param[8] == 0) { param[8] = 400; }\nif (param[9] == 0) { param[9] = 300; }\n\n')
            __append('\ndisable_item(FEAT_INDUSTRIES, 0, 36);\n\n')
        except:
            if (__token is not None):
                rcontext.setdefault('__error__', []).append((__tokens[__token] + (__filename, _exc_info()[1], )))
            raise
コード例 #2
0
    def render(__stream, econtext, rcontext, __i18n_domain=None, __i18n_context=None):
        __append = __stream.append
        __re_amp = g_re_amp
        __token = None
        __re_needs_escape = g_re_needs_escape

        def __convert(target):
            if (target is None):
                return
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except AttributeError:
                            __converted = convert(target)
                            target = (str(target) if (target is __converted) else __converted)
                        else:
                            target = target()
            return target

        def __quote(target, quote, quote_entity, default, default_marker):
            if (target is None):
                return
            if (target is default_marker):
                return default
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except:
                            __converted = convert(target)
                            target = (str(target) if (target is __converted) else __converted)
                        else:
                            return target()
                if (target is not None):
                    try:
                        escape = (__re_needs_escape(target) is not None)
                    except TypeError:
                        pass
                    else:
                        if escape:
                            if ('&' in target):
                                target = target.replace('&', '&amp;')
                            if ('<' in target):
                                target = target.replace('<', '&lt;')
                            if ('>' in target):
                                target = target.replace('>', '&gt;')
                            if ((quote is not None) and (quote in target)):
                                target = target.replace(quote, quote_entity)
            return target
        translate = econtext['__translate']
        decode = econtext['__decode']
        convert = econtext['__convert']
        on_error_handler = econtext['__on_error_handler']
        try:
            getitem = econtext.__getitem__
            get = econtext.get
            __append('/* ******************************************************************\n * Definition of the industry tile, its callbacks, and graphics chain\n * ******************************************************************/\n\n')
            __backup_macroname_140183230166856 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f7ef3a2a438> name=None at 7f7ef3a2a198> -> __value
            __value = _static_140183230129208
            econtext['macroname'] = __value

            # <Value 'load: spritesets.pynml' (5:30)> -> __macro
            __token = 242
            __macro = ' spritesets.pynml'
            __macro = __loader(__macro)
            __token = 242
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140183230166856 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140183230166856
            __append('\n\n')
            __backup_macroname_140183230165128 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f7ef3a2a9e8> name=None at 7f7ef3a2acf8> -> __value
            __value = _static_140183230130664
            econtext['macroname'] = __value

            # <Value 'load: spritelayouts.pynml' (7:30)> -> __macro
            __token = 300
            __macro = ' spritelayouts.pynml'
            __macro = __loader(__macro)
            __token = 300
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140183230165128 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140183230165128
            __append('\n\n')
            __backup_macroname_140183229536776 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f7ef3a2a278> name=None at 7f7ef3a2ac88> -> __value
            __value = _static_140183230128760
            econtext['macroname'] = __value

            # <Value 'load: graphics_switches.pynml' (9:30)> -> __macro
            __token = 361
            __macro = ' graphics_switches.pynml'
            __macro = __loader(__macro)
            __token = 361
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140183229536776 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140183229536776
            __append('\n\n')
            __backup_location_checks_tile_140183230859416 = get('location_checks_tile', __marker)

            # <Value 'load: location_check_macros_tile.pynml' (11:42)> -> __value
            __token = 438
            __value = ' location_check_macros_tile.pynml'
            __value = __loader(__value)
            econtext['location_checks_tile'] = __value
            __backup_macroname_140183229536456 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f7ef3a68080> name=None at 7f7ef3a68748> -> __value
            __value = _static_140183230382208
            econtext['macroname'] = __value

            # <Value "location_checks_tile.macros['render_tree']" (12:30)> -> __macro
            __token = 508
            __macro = _lookup_attr(getitem('location_checks_tile'), 'macros')['render_tree']
            __token = 508
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140183229536456 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140183229536456
            if (__backup_location_checks_tile_140183230859416 is __marker):
                del econtext['location_checks_tile']
            else:
                econtext['location_checks_tile'] = __backup_location_checks_tile_140183230859416
            __append('\n\n')
            __backup_animation_macros_140183229332672 = get('animation_macros', __marker)

            # <Value 'load: animation_macros.pynml' (14:38)> -> __value
            __token = 594
            __value = ' animation_macros.pynml'
            __value = __loader(__value)
            econtext['animation_macros'] = __value
            __backup_macroname_140183230866568 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f7ef3a685c0> name=None at 7f7ef3a680f0> -> __value
            __value = _static_140183230383552
            econtext['macroname'] = __value

            # <Value "animation_macros.macros['tile_animation']" (15:30)> -> __macro
            __token = 654
            __macro = _lookup_attr(getitem('animation_macros'), 'macros')['tile_animation']
            __token = 654
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140183230866568 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140183230866568
            if (__backup_animation_macros_140183229332672 is __marker):
                del econtext['animation_macros']
            else:
                econtext['animation_macros'] = __backup_animation_macros_140183229332672
            __append('\n\n')
            __backup_macroname_140183229534856 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f7ef3a68e48> name=None at 7f7ef3a68518> -> __value
            __value = _static_140183230385736
            econtext['macroname'] = __value

            # <Value 'load: properties_tile.pynml' (17:30)> -> __macro
            __token = 731
            __macro = ' properties_tile.pynml'
            __macro = __loader(__macro)
            __token = 731
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140183229534856 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140183229534856
            __append('\n\n/* *************************************************\n * Definition of the industry layouts\n * *************************************************/\n\n')
            __backup_macroname_140183230964104 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f7ef3a36e48> name=None at 7f7ef3a36c18> -> __value
            __value = _static_140183230180936
            econtext['macroname'] = __value

            # <Value 'load: layouts.pynml' (23:30)> -> __macro
            __token = 940
            __macro = ' layouts.pynml'
            __macro = __loader(__macro)
            __token = 940
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140183230964104 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140183230964104
            __append('\n\n/* *************************************************\n * Definition of the industry\n * *************************************************/\n\n')
            __backup_location_checks_industry_140183231121056 = get('location_checks_industry', __marker)

            # <Value 'load: location_check_macros_industry.pynml' (29:46)> -> __value
            __token = 1149
            __value = ' location_check_macros_industry.pynml'
            __value = __loader(__value)
            econtext['location_checks_industry'] = __value
            __backup_macroname_140183229890056 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f7ef3a36978> name=None at 7f7ef3a366a0> -> __value
            __value = _static_140183230179704
            econtext['macroname'] = __value

            # <Value "location_checks_industry.macros['render_tree']" (30:30)> -> __macro
            __token = 1223
            __macro = _lookup_attr(getitem('location_checks_industry'), 'macros')['render_tree']
            __token = 1223
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140183229890056 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140183229890056
            if (__backup_location_checks_industry_140183231121056 is __marker):
                del econtext['location_checks_industry']
            else:
                econtext['location_checks_industry'] = __backup_location_checks_industry_140183231121056
            __append('\n\n')
            __backup_macroname_140183229195528 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f7ef3a36908> name=None at 7f7ef3a36780> -> __value
            __value = _static_140183230179592
            econtext['macroname'] = __value

            # <Value 'load: availability.pynml' (32:30)> -> __macro
            __token = 1305
            __macro = ' availability.pynml'
            __macro = __loader(__macro)
            __token = 1305
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140183229195528 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140183229195528
            __append('\n\n')

            # <Interpolation value=<Substitution "\nproduce(${industry.id}_production,\n\t\twaiting_cargo_1, // should be 0\n\t\twaiting_cargo_2, // should be 0\n\t\twaiting_cargo_3, // should be 0\n\t\tLOAD_TEMP(1),    // we stored output here\n\t\t0,               // no 2nd output\n\t\t0                // don't repeat\n\t\t);\n\n\nswitch(FEAT_INDUSTRIES, PARENT, ${industry.id}_produce, [STORE_TEMP(((population + 11) / (12 * 7)), 1)]) {\n\t0: ${industry.id}_production;\n\t${industry.id}_production;\n}\n\n\n" (37:4)> braces_required=True translation=False at 7f7ef3a36860> -> __content_140183249773656
            __token = 1463
            __token = 1473
            __content_140183249773656 = _lookup_attr(getitem('industry'), 'id')
            __content_140183249773656 = __quote(__content_140183249773656, '\x00', '&#0;', None, False)
            __token = 1756
            __content_140183249773656_1754 = _lookup_attr(getitem('industry'), 'id')
            __content_140183249773656_1754 = __quote(__content_140183249773656_1754, '\x00', '&#0;', None, False)
            __token = 1835
            __content_140183249773656_1833 = _lookup_attr(getitem('industry'), 'id')
            __content_140183249773656_1833 = __quote(__content_140183249773656_1833, '\x00', '&#0;', None, False)
            __token = 1863
            __content_140183249773656_1861 = _lookup_attr(getitem('industry'), 'id')
            __content_140183249773656_1861 = __quote(__content_140183249773656_1861, '\x00', '&#0;', None, False)
            __content_140183249773656 = ('%s%s%s%s%s%s%s%s%s' % ('\nproduce(', (__content_140183249773656 if (__content_140183249773656 is not None) else ''), "_production,\n\t\twaiting_cargo_1, // should be 0\n\t\twaiting_cargo_2, // should be 0\n\t\twaiting_cargo_3, // should be 0\n\t\tLOAD_TEMP(1),    // we stored output here\n\t\t0,               // no 2nd output\n\t\t0                // don't repeat\n\t\t);\n\n\nswitch(FEAT_INDUSTRIES, PARENT, ", (__content_140183249773656_1754 if (__content_140183249773656_1754 is not None) else ''), '_produce, [STORE_TEMP(((population + 11) / (12 * 7)), 1)]) {\n\t0: ', (__content_140183249773656_1833 if (__content_140183249773656_1833 is not None) else ''), '_production;\n\t', (__content_140183249773656_1861 if (__content_140183249773656_1861 is not None) else ''), '_production;\n}\n\n\n', ))
            if (__content_140183249773656 is None):
                pass
            else:
                if (__content_140183249773656 is False):
                    __content_140183249773656 = None
                else:
                    __tt = type(__content_140183249773656)
                    if ((__tt is int) or (__tt is float) or (__tt is int)):
                        __content_140183249773656 = str(__content_140183249773656)
                    else:
                        if (__tt is bytes):
                            __content_140183249773656 = decode(__content_140183249773656)
                        else:
                            if (__tt is not str):
                                try:
                                    __content_140183249773656 = __content_140183249773656.__html__
                                except get('AttributeError', AttributeError):
                                    __converted = convert(__content_140183249773656)
                                    __content_140183249773656 = (str(__content_140183249773656) if (__content_140183249773656 is __converted) else __converted)
                                else:
                                    __content_140183249773656 = __content_140183249773656()
            if (__content_140183249773656 is not None):
                __append(__content_140183249773656)
            __backup_macroname_140183230651784 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f7ef3a36710> name=None at 7f7ef3a36e10> -> __value
            __value = _static_140183230179088
            econtext['macroname'] = __value

            # <Value 'load: properties_industry.pynml' (54:30)> -> __macro
            __token = 1922
            __macro = ' properties_industry.pynml'
            __macro = __loader(__macro)
            __token = 1922
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140183230651784 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140183230651784
            __append('\n\n')
            __append('\n')
            __backup_economy_140183229455328 = get('economy', __marker)

            # <Value 'economies' (57:37)> -> __iterator
            __token = 2106
            __iterator = getitem('economies')
            (__iterator, ____index_140183230180824, ) = getitem('repeat')('economy', __iterator)
            econtext['economy'] = None
            for __item in __iterator:
                econtext['economy'] = __item
                __append('\n    ')

                # <Value "industry.get_property('enabled', economy) == True" (58:39)> -> __condition
                __token = 2157
                __condition = (_lookup_attr(getitem('industry'), 'get_property')('enabled', getitem('economy')) == True)
                if __condition:

                    # <Interpolation value=<Substitution '\n        if (economy==${economy.numeric_id}) {\n            item(FEAT_INDUSTRIES, ${industry.id}, ${industry.numeric_id}) {\n                graphics {\n                    produce_256_ticks:       ${industry.id}_produce;\n                    construction_probability:${industry.id}_check_availability;\n                    location_check:          ${industry.id}_check_location;\n                    monthly_prod_change:     CB_RESULT_IND_PROD_NO_CHANGE;\n                    random_prod_change:      CB_RESULT_IND_PROD_NO_CHANGE;\n                    extra_text_fund:         ${industry.get_extra_text_fund(economy)};\n                    extra_text_industry:     return string(STR_EXTRA_RECYCLING_DEPOT);\n                    colour:                  switch_colour;\n                }\n            }\n        }\n    ' (58:90)> braces_required=True translation=False at 7f7ef3955748> -> __content_140183249773656
                    __token = 2217
                    __token = 2232
                    __content_140183249773656 = _lookup_attr(getitem('economy'), 'numeric_id')
                    __content_140183249773656 = __quote(__content_140183249773656, '\x00', '&#0;', None, False)
                    __token = 2291
                    __content_140183249773656_2289 = _lookup_attr(getitem('industry'), 'id')
                    __content_140183249773656_2289 = __quote(__content_140183249773656_2289, '\x00', '&#0;', None, False)
                    __token = 2307
                    __content_140183249773656_2305 = _lookup_attr(getitem('industry'), 'numeric_id')
                    __content_140183249773656_2305 = __quote(__content_140183249773656_2305, '\x00', '&#0;', None, False)
                    __token = 2405
                    __content_140183249773656_2403 = _lookup_attr(getitem('industry'), 'id')
                    __content_140183249773656_2403 = __quote(__content_140183249773656_2403, '\x00', '&#0;', None, False)
                    __token = 2474
                    __content_140183249773656_2472 = _lookup_attr(getitem('industry'), 'id')
                    __content_140183249773656_2472 = __quote(__content_140183249773656_2472, '\x00', '&#0;', None, False)
                    __token = 2554
                    __content_140183249773656_2552 = _lookup_attr(getitem('industry'), 'id')
                    __content_140183249773656_2552 = __quote(__content_140183249773656_2552, '\x00', '&#0;', None, False)
                    __token = 2780
                    __content_140183249773656_2778 = _lookup_attr(getitem('industry'), 'get_extra_text_fund')(getitem('economy'))
                    __content_140183249773656_2778 = __quote(__content_140183249773656_2778, '\x00', '&#0;', None, False)
                    __content_140183249773656 = ('%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s' % ('\n        if (economy==', (__content_140183249773656 if (__content_140183249773656 is not None) else ''), ') {\n            item(FEAT_INDUSTRIES, ', (__content_140183249773656_2289 if (__content_140183249773656_2289 is not None) else ''), ', ', (__content_140183249773656_2305 if (__content_140183249773656_2305 is not None) else ''), ') {\n                graphics {\n                    produce_256_ticks:       ', (__content_140183249773656_2403 if (__content_140183249773656_2403 is not None) else ''), '_produce;\n                    construction_probability:', (__content_140183249773656_2472 if (__content_140183249773656_2472 is not None) else ''), '_check_availability;\n                    location_check:          ', (__content_140183249773656_2552 if (__content_140183249773656_2552 is not None) else ''), '_check_location;\n                    monthly_prod_change:     CB_RESULT_IND_PROD_NO_CHANGE;\n                    random_prod_change:      CB_RESULT_IND_PROD_NO_CHANGE;\n                    extra_text_fund:         ', (__content_140183249773656_2778 if (__content_140183249773656_2778 is not None) else ''), ';\n                    extra_text_industry:     return string(STR_EXTRA_RECYCLING_DEPOT);\n                    colour:                  switch_colour;\n                }\n            }\n        }\n    ', ))
                    if (__content_140183249773656 is None):
                        pass
                    else:
                        if (__content_140183249773656 is False):
                            __content_140183249773656 = None
                        else:
                            __tt = type(__content_140183249773656)
                            if ((__tt is int) or (__tt is float) or (__tt is int)):
                                __content_140183249773656 = str(__content_140183249773656)
                            else:
                                if (__tt is bytes):
                                    __content_140183249773656 = decode(__content_140183249773656)
                                else:
                                    if (__tt is not str):
                                        try:
                                            __content_140183249773656 = __content_140183249773656.__html__
                                        except get('AttributeError', AttributeError):
                                            __converted = convert(__content_140183249773656)
                                            __content_140183249773656 = (str(__content_140183249773656) if (__content_140183249773656 is __converted) else __converted)
                                        else:
                                            __content_140183249773656 = __content_140183249773656()
                    if (__content_140183249773656 is not None):
                        __append(__content_140183249773656)
                __append('\n')
                ____index_140183230180824 -= 1
                if (____index_140183230180824 > 0):
                    __append('')
            if (__backup_economy_140183229455328 is __marker):
                del econtext['economy']
            else:
                econtext['economy'] = __backup_economy_140183229455328
            __append('\n')
        except:
            if (__token is not None):
                rcontext.setdefault('__error__', []).append((__tokens[__token] + (__filename, _exc_info()[1], )))
            raise
コード例 #3
0
    def render(__stream,
               econtext,
               rcontext,
               __i18n_domain=None,
               __i18n_context=None):
        __append = __stream.append
        __re_amp = g_re_amp
        __token = None
        __re_needs_escape = g_re_needs_escape

        def __convert(target):
            if (target is None):
                return
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except AttributeError:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            target = target()
            return target

        def __quote(target, quote, quote_entity, default, default_marker):
            if (target is None):
                return
            if (target is default_marker):
                return default
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            return target()
                if (target is not None):
                    try:
                        escape = (__re_needs_escape(target) is not None)
                    except TypeError:
                        pass
                    else:
                        if escape:
                            if ('&' in target):
                                target = target.replace('&', '&amp;')
                            if ('<' in target):
                                target = target.replace('<', '&lt;')
                            if ('>' in target):
                                target = target.replace('>', '&gt;')
                            if ((quote is not None) and (quote in target)):
                                target = target.replace(quote, quote_entity)
            return target

        translate = econtext['__translate']
        decode = econtext['__decode']
        convert = econtext['__convert']
        on_error_handler = econtext['__on_error_handler']
        try:
            getitem = econtext.__getitem__
            get = econtext.get
            __append('\n\n')

            # <Interpolation value=<Substitution '\nswitch(FEAT_INDUSTRIES, SELF, ${industry.id}_check_availability_param, restrict_open_during_gameplay) {\n\t1..255: return CB_RESULT_IND_NO_CONSTRUCTION;         // disallow when restrictions in place\n\treturn CB_RESULT_IND_PROBABILITY_FROM_PROPERTY;       // we may build\n}\n\n' (9:45)> braces_required=True translation=False at 7fad9cb5a160> -> __content_140383655711776
            __token = 282
            __token = 314
            __content_140383655711776 = _lookup_attr(getitem('industry'), 'id')
            __content_140383655711776 = __quote(__content_140383655711776,
                                                '\x00', '&#0;', None, False)
            __content_140383655711776 = ('%s%s%s' % (
                '\nswitch(FEAT_INDUSTRIES, SELF, ',
                (__content_140383655711776 if
                 (__content_140383655711776 is not None) else ''),
                '_check_availability_param, restrict_open_during_gameplay) {\n\t1..255: return CB_RESULT_IND_NO_CONSTRUCTION;         // disallow when restrictions in place\n\treturn CB_RESULT_IND_PROBABILITY_FROM_PROPERTY;       // we may build\n}\n\n',
            ))
            if (__content_140383655711776 is None):
                pass
            else:
                if (__content_140383655711776 is False):
                    __content_140383655711776 = None
                else:
                    __tt = type(__content_140383655711776)
                    if ((__tt is int) or (__tt is float) or (__tt is int)):
                        __content_140383655711776 = str(
                            __content_140383655711776)
                    else:
                        if (__tt is bytes):
                            __content_140383655711776 = decode(
                                __content_140383655711776)
                        else:
                            if (__tt is not str):
                                try:
                                    __content_140383655711776 = __content_140383655711776.__html__
                                except get('AttributeError', AttributeError):
                                    __converted = convert(
                                        __content_140383655711776)
                                    __content_140383655711776 = (
                                        str(__content_140383655711776) if
                                        (__content_140383655711776 is
                                         __converted) else __converted)
                                else:
                                    __content_140383655711776 = __content_140383655711776(
                                    )
            if (__content_140383655711776 is not None):
                __append(__content_140383655711776)

            # <Interpolation value=<Substitution '\nswitch (FEAT_INDUSTRIES, SELF, ${industry.id}_check_map_gen, extra_callback_info2 == IND_CREATION_GENERATION) {\n\t1: return CB_RESULT_IND_PROBABILITY_FROM_PROPERTY;\n\t${industry.id}_check_availability_param;\n}\n' (15:37)> braces_required=True translation=False at 7fad9cb5a3c8> -> __content_140383655711776
            __token = 592
            __token = 625
            __content_140383655711776 = _lookup_attr(getitem('industry'), 'id')
            __content_140383655711776 = __quote(__content_140383655711776,
                                                '\x00', '&#0;', None, False)
            __token = 759
            __content_140383655711776_757 = _lookup_attr(
                getitem('industry'), 'id')
            __content_140383655711776_757 = __quote(
                __content_140383655711776_757, '\x00', '&#0;', None, False)
            __content_140383655711776 = ('%s%s%s%s%s' % (
                '\nswitch (FEAT_INDUSTRIES, SELF, ',
                (__content_140383655711776 if
                 (__content_140383655711776 is not None) else ''),
                '_check_map_gen, extra_callback_info2 == IND_CREATION_GENERATION) {\n\t1: return CB_RESULT_IND_PROBABILITY_FROM_PROPERTY;\n\t',
                (__content_140383655711776_757 if
                 (__content_140383655711776_757 is not None) else ''),
                '_check_availability_param;\n}\n',
            ))
            if (__content_140383655711776 is None):
                pass
            else:
                if (__content_140383655711776 is False):
                    __content_140383655711776 = None
                else:
                    __tt = type(__content_140383655711776)
                    if ((__tt is int) or (__tt is float) or (__tt is int)):
                        __content_140383655711776 = str(
                            __content_140383655711776)
                    else:
                        if (__tt is bytes):
                            __content_140383655711776 = decode(
                                __content_140383655711776)
                        else:
                            if (__tt is not str):
                                try:
                                    __content_140383655711776 = __content_140383655711776.__html__
                                except get('AttributeError', AttributeError):
                                    __converted = convert(
                                        __content_140383655711776)
                                    __content_140383655711776 = (
                                        str(__content_140383655711776) if
                                        (__content_140383655711776 is
                                         __converted) else __converted)
                                else:
                                    __content_140383655711776 = __content_140383655711776(
                                    )
            if (__content_140383655711776 is not None):
                __append(__content_140383655711776)

            # <Interpolation value=<Substitution '\nswitch (FEAT_INDUSTRIES, SELF, ${industry.id}_available_game_mode, game_mode == GAMEMODE_GAME) {\n\t1: ${industry.id}_check_map_gen;\n\treturn CB_RESULT_IND_PROBABILITY_FROM_PROPERTY;\n}\n\n' (20:45)> braces_required=True translation=False at 7fad9cb5a4a8> -> __content_140383655711776
            __token = 846
            __token = 879
            __content_140383655711776 = _lookup_attr(getitem('industry'), 'id')
            __content_140383655711776 = __quote(__content_140383655711776,
                                                '\x00', '&#0;', None, False)
            __token = 949
            __content_140383655711776_947 = _lookup_attr(
                getitem('industry'), 'id')
            __content_140383655711776_947 = __quote(
                __content_140383655711776_947, '\x00', '&#0;', None, False)
            __content_140383655711776 = ('%s%s%s%s%s' % (
                '\nswitch (FEAT_INDUSTRIES, SELF, ',
                (__content_140383655711776 if
                 (__content_140383655711776 is not None) else ''),
                '_available_game_mode, game_mode == GAMEMODE_GAME) {\n\t1: ',
                (__content_140383655711776_947 if
                 (__content_140383655711776_947 is not None) else ''),
                '_check_map_gen;\n\treturn CB_RESULT_IND_PROBABILITY_FROM_PROPERTY;\n}\n\n',
            ))
            if (__content_140383655711776 is None):
                pass
            else:
                if (__content_140383655711776 is False):
                    __content_140383655711776 = None
                else:
                    __tt = type(__content_140383655711776)
                    if ((__tt is int) or (__tt is float) or (__tt is int)):
                        __content_140383655711776 = str(
                            __content_140383655711776)
                    else:
                        if (__tt is bytes):
                            __content_140383655711776 = decode(
                                __content_140383655711776)
                        else:
                            if (__tt is not str):
                                try:
                                    __content_140383655711776 = __content_140383655711776.__html__
                                except get('AttributeError', AttributeError):
                                    __converted = convert(
                                        __content_140383655711776)
                                    __content_140383655711776 = (
                                        str(__content_140383655711776) if
                                        (__content_140383655711776 is
                                         __converted) else __converted)
                                else:
                                    __content_140383655711776 = __content_140383655711776(
                                    )
            if (__content_140383655711776 is not None):
                __append(__content_140383655711776)
            __append('\n')
            __backup_economy_140383637130376 = get('economy', __marker)

            # <Value 'economies' (27:35)> -> __iterator
            __token = 1137
            __iterator = getitem('economies')
            (
                __iterator,
                ____index_140383635785936,
            ) = getitem('repeat')('economy', __iterator)
            econtext['economy'] = None
            for __item in __iterator:
                econtext['economy'] = __item

                # <Interpolation value=<Substitution '\n    /* ${industry.get_intro_year(economy)} */\n    switch (FEAT_INDUSTRIES, SELF, ${industry.id}_check_availability_${economy.numeric_id}, current_date) {\n        date(${industry.get_intro_year(economy)},1,1) .. date(${industry.get_expiry_year(economy)},12,31): ${industry.id}_available_game_mode;\n        return CB_RESULT_IND_NO_CONSTRUCTION;\n    }\n' (27:46)> braces_required=True translation=False at 7fad9cbe44a8> -> __content_140383655711776
                __token = 1153
                __token = 1158
                __content_140383655711776 = _lookup_attr(
                    getitem('industry'), 'get_intro_year')(getitem('economy'))
                __content_140383655711776 = __quote(__content_140383655711776,
                                                    '\x00', '&#0;', None,
                                                    False)
                __token = 1232
                __content_140383655711776_1230 = _lookup_attr(
                    getitem('industry'), 'id')
                __content_140383655711776_1230 = __quote(
                    __content_140383655711776_1230, '\x00', '&#0;', None,
                    False)
                __token = 1266
                __content_140383655711776_1264 = _lookup_attr(
                    getitem('economy'), 'numeric_id')
                __content_140383655711776_1264 = __quote(
                    __content_140383655711776_1264, '\x00', '&#0;', None,
                    False)
                __token = 1318
                __content_140383655711776_1316 = _lookup_attr(
                    getitem('industry'), 'get_intro_year')(getitem('economy'))
                __content_140383655711776_1316 = __quote(
                    __content_140383655711776_1316, '\x00', '&#0;', None,
                    False)
                __token = 1367
                __content_140383655711776_1365 = _lookup_attr(
                    getitem('industry'), 'get_expiry_year')(getitem('economy'))
                __content_140383655711776_1365 = __quote(
                    __content_140383655711776_1365, '\x00', '&#0;', None,
                    False)
                __token = 1412
                __content_140383655711776_1410 = _lookup_attr(
                    getitem('industry'), 'id')
                __content_140383655711776_1410 = __quote(
                    __content_140383655711776_1410, '\x00', '&#0;', None,
                    False)
                __content_140383655711776 = ('%s%s%s%s%s%s%s%s%s%s%s%s%s' % (
                    '\n    /* ',
                    (__content_140383655711776 if
                     (__content_140383655711776 is not None) else ''),
                    ' */\n    switch (FEAT_INDUSTRIES, SELF, ',
                    (__content_140383655711776_1230 if
                     (__content_140383655711776_1230 is not None) else ''),
                    '_check_availability_',
                    (__content_140383655711776_1264 if
                     (__content_140383655711776_1264 is not None) else ''),
                    ', current_date) {\n        date(',
                    (__content_140383655711776_1316 if
                     (__content_140383655711776_1316 is not None) else ''),
                    ',1,1) .. date(',
                    (__content_140383655711776_1365 if
                     (__content_140383655711776_1365 is not None) else ''),
                    ',12,31): ',
                    (__content_140383655711776_1410 if
                     (__content_140383655711776_1410 is not None) else ''),
                    '_available_game_mode;\n        return CB_RESULT_IND_NO_CONSTRUCTION;\n    }\n',
                ))
                if (__content_140383655711776 is None):
                    pass
                else:
                    if (__content_140383655711776 is False):
                        __content_140383655711776 = None
                    else:
                        __tt = type(__content_140383655711776)
                        if ((__tt is int) or (__tt is float) or (__tt is int)):
                            __content_140383655711776 = str(
                                __content_140383655711776)
                        else:
                            if (__tt is bytes):
                                __content_140383655711776 = decode(
                                    __content_140383655711776)
                            else:
                                if (__tt is not str):
                                    try:
                                        __content_140383655711776 = __content_140383655711776.__html__
                                    except get('AttributeError',
                                               AttributeError):
                                        __converted = convert(
                                            __content_140383655711776)
                                        __content_140383655711776 = (
                                            str(__content_140383655711776) if
                                            (__content_140383655711776 is
                                             __converted) else __converted)
                                    else:
                                        __content_140383655711776 = __content_140383655711776(
                                        )
                if (__content_140383655711776 is not None):
                    __append(__content_140383655711776)
                ____index_140383635785936 -= 1
                if (____index_140383635785936 > 0):
                    __append('')
            if (__backup_economy_140383637130376 is __marker):
                del econtext['economy']
            else:
                econtext['economy'] = __backup_economy_140383637130376

            # <Interpolation value=<Substitution '\n\nswitch (FEAT_INDUSTRIES, SELF, ${industry.id}_check_availability, economy) {\n    ' (33:20)> braces_required=True translation=False at 7fad9ccea630> -> __content_140383655711776
            __token = 1520
            __token = 1553
            __content_140383655711776 = _lookup_attr(getitem('industry'), 'id')
            __content_140383655711776 = __quote(__content_140383655711776,
                                                '\x00', '&#0;', None, False)
            __content_140383655711776 = ('%s%s%s' % (
                '\n\nswitch (FEAT_INDUSTRIES, SELF, ',
                (__content_140383655711776 if
                 (__content_140383655711776 is not None) else ''),
                '_check_availability, economy) {\n    ',
            ))
            if (__content_140383655711776 is None):
                pass
            else:
                if (__content_140383655711776 is False):
                    __content_140383655711776 = None
                else:
                    __tt = type(__content_140383655711776)
                    if ((__tt is int) or (__tt is float) or (__tt is int)):
                        __content_140383655711776 = str(
                            __content_140383655711776)
                    else:
                        if (__tt is bytes):
                            __content_140383655711776 = decode(
                                __content_140383655711776)
                        else:
                            if (__tt is not str):
                                try:
                                    __content_140383655711776 = __content_140383655711776.__html__
                                except get('AttributeError', AttributeError):
                                    __converted = convert(
                                        __content_140383655711776)
                                    __content_140383655711776 = (
                                        str(__content_140383655711776) if
                                        (__content_140383655711776 is
                                         __converted) else __converted)
                                else:
                                    __content_140383655711776 = __content_140383655711776(
                                    )
            if (__content_140383655711776 is not None):
                __append(__content_140383655711776)
            __backup_economy_140383637092448 = get('economy', __marker)

            # <Value 'economies' (36:42)> -> __iterator
            __token = 1639
            __iterator = getitem('economies')
            (
                __iterator,
                ____index_140383635784480,
            ) = getitem('repeat')('economy', __iterator)
            econtext['economy'] = None
            for __item in __iterator:
                econtext['economy'] = __item

                # <Interpolation value=<Substitution '\n        ${economy.numeric_id}: ${industry.id}_check_availability_${economy.numeric_id};\n    ' (36:53)> braces_required=True translation=False at 7fad9cbe47b8> -> __content_140383655711776
                __token = 1659
                __token = 1661
                __content_140383655711776 = _lookup_attr(
                    getitem('economy'), 'numeric_id')
                __content_140383655711776 = __quote(__content_140383655711776,
                                                    '\x00', '&#0;', None,
                                                    False)
                __token = 1684
                __content_140383655711776_1682 = _lookup_attr(
                    getitem('industry'), 'id')
                __content_140383655711776_1682 = __quote(
                    __content_140383655711776_1682, '\x00', '&#0;', None,
                    False)
                __token = 1718
                __content_140383655711776_1716 = _lookup_attr(
                    getitem('economy'), 'numeric_id')
                __content_140383655711776_1716 = __quote(
                    __content_140383655711776_1716, '\x00', '&#0;', None,
                    False)
                __content_140383655711776 = ('%s%s%s%s%s%s%s' % (
                    '\n        ',
                    (__content_140383655711776 if
                     (__content_140383655711776 is not None) else ''),
                    ': ',
                    (__content_140383655711776_1682 if
                     (__content_140383655711776_1682 is not None) else ''),
                    '_check_availability_',
                    (__content_140383655711776_1716 if
                     (__content_140383655711776_1716 is not None) else ''),
                    ';\n    ',
                ))
                if (__content_140383655711776 is None):
                    pass
                else:
                    if (__content_140383655711776 is False):
                        __content_140383655711776 = None
                    else:
                        __tt = type(__content_140383655711776)
                        if ((__tt is int) or (__tt is float) or (__tt is int)):
                            __content_140383655711776 = str(
                                __content_140383655711776)
                        else:
                            if (__tt is bytes):
                                __content_140383655711776 = decode(
                                    __content_140383655711776)
                            else:
                                if (__tt is not str):
                                    try:
                                        __content_140383655711776 = __content_140383655711776.__html__
                                    except get('AttributeError',
                                               AttributeError):
                                        __converted = convert(
                                            __content_140383655711776)
                                        __content_140383655711776 = (
                                            str(__content_140383655711776) if
                                            (__content_140383655711776 is
                                             __converted) else __converted)
                                    else:
                                        __content_140383655711776 = __content_140383655711776(
                                        )
                if (__content_140383655711776 is not None):
                    __append(__content_140383655711776)
                ____index_140383635784480 -= 1
                if (____index_140383635784480 > 0):
                    __append('')
            if (__backup_economy_140383637092448 is __marker):
                del econtext['economy']
            else:
                econtext['economy'] = __backup_economy_140383637092448
            __append('\n}\n\n\n')
        except:
            if (__token is not None):
                rcontext.setdefault('__error__', []).append(
                    (__tokens[__token] + (
                        __filename,
                        _exc_info()[1],
                    )))
            raise
コード例 #4
0
    def render(__stream,
               econtext,
               rcontext,
               __i18n_domain=None,
               __i18n_context=None):
        __append = __stream.append
        __re_amp = g_re_amp
        __token = None
        __re_needs_escape = g_re_needs_escape

        def __convert(target):
            if (target is None):
                return
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except AttributeError:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            target = target()
            return target

        def __quote(target, quote, quote_entity, default, default_marker):
            if (target is None):
                return
            if (target is default_marker):
                return default
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            return target()
                if (target is not None):
                    try:
                        escape = (__re_needs_escape(target) is not None)
                    except TypeError:
                        pass
                    else:
                        if escape:
                            if ('&' in target):
                                target = target.replace('&', '&amp;')
                            if ('<' in target):
                                target = target.replace('<', '&lt;')
                            if ('>' in target):
                                target = target.replace('>', '&gt;')
                            if ((quote is not None) and (quote in target)):
                                target = target.replace(quote, quote_entity)
            return target

        translate = econtext['__translate']
        decode = econtext['__decode']
        convert = econtext['__convert']
        try:
            getitem = econtext.__getitem__
            get = econtext.get

            # <Interpolation value=<Substitution '\nitem(FEAT_CARGOS, ${cargo.id}_${economy.id}, ${cargo.get_numeric_id(economy)}) {\n    property {\n        ' (1:53)> braces_required=True translation=False at 1e3258b89b0> -> __content_2075086945112
            __token = 54
            __token = 74
            __content_2075086945112 = _lookup_attr(getitem('cargo'), 'id')
            __content_2075086945112 = __quote(__content_2075086945112, '\x00',
                                              '&#0;', None, False)
            __token = 86
            __content_2075086945112_84 = _lookup_attr(getitem('economy'), 'id')
            __content_2075086945112_84 = __quote(__content_2075086945112_84,
                                                 '\x00', '&#0;', None, False)
            __token = 101
            __content_2075086945112_99 = _lookup_attr(
                getitem('cargo'), 'get_numeric_id')(getitem('economy'))
            __content_2075086945112_99 = __quote(__content_2075086945112_99,
                                                 '\x00', '&#0;', None, False)
            __content_2075086945112 = ('%s%s%s%s%s%s%s' % (
                '\nitem(FEAT_CARGOS, ',
                (__content_2075086945112 if
                 (__content_2075086945112 is not None) else ''),
                '_',
                (__content_2075086945112_84 if
                 (__content_2075086945112_84 is not None) else ''),
                ', ',
                (__content_2075086945112_99 if
                 (__content_2075086945112_99 is not None) else ''),
                ') {\n    property {\n        ',
            ))
            if (__content_2075086945112 is None):
                pass
            else:
                if (__content_2075086945112 is False):
                    __content_2075086945112 = None
                else:
                    __tt = type(__content_2075086945112)
                    if ((__tt is int) or (__tt is float) or (__tt is int)):
                        __content_2075086945112 = str(__content_2075086945112)
                    else:
                        if (__tt is bytes):
                            __content_2075086945112 = decode(
                                __content_2075086945112)
                        else:
                            if (__tt is not str):
                                try:
                                    __content_2075086945112 = __content_2075086945112.__html__
                                except get('AttributeError', AttributeError):
                                    __converted = convert(
                                        __content_2075086945112)
                                    __content_2075086945112 = (
                                        str(__content_2075086945112) if
                                        (__content_2075086945112 is __converted
                                         ) else __converted)
                                else:
                                    __content_2075086945112 = __content_2075086945112(
                                    )
            if (__content_2075086945112 is not None):
                __append(__content_2075086945112)

            # <Interpolation value=<Substitution "\n        ${cargo.get_property_declaration('type_name')}\n        ${cargo.get_property_declaration('unit_name')}\n        ${cargo.get_property_declaration('type_abbreviation')}\n        ${cargo.get_property_declaration('sprite')}\n        ${cargo.get_property_declaration('weight')}\n        ${cargo.get_property_declaration('station_list_colour')}\n        ${cargo.get_property_declaration('cargo_payment_list_colour')}\n        ${cargo.get_property_declaration('is_freight')}\n        ${cargo.get_property_declaration('cargo_classes')}\n        ${cargo.get_property_declaration('town_growth_effect', economy)}\n        ${cargo.get_property_declaration('town_growth_multiplier', economy)}\n        ${cargo.get_property_declaration('units_of_cargo')}\n        ${cargo.get_property_declaration('items_of_cargo')}\n        ${cargo.get_property_declaration('penalty_lowerbound', economy)}\n        ${cargo.get_property_declaration('single_penalty_length', economy)}\n        ${cargo.get_property_declaration('price_factor', economy)}\n        ${cargo.get_property_declaration('capacity_multiplier')}\n        " (4:32)> braces_required=True translation=False at 1e3258b8da0> -> __content_2075086945112
            __token = 191
            __token = 193
            __content_2075086945112 = _lookup_attr(
                getitem('cargo'), 'get_property_declaration')('type_name')
            __content_2075086945112 = __quote(__content_2075086945112, '\x00',
                                              '&#0;', None, False)
            __token = 248
            __content_2075086945112_246 = _lookup_attr(
                getitem('cargo'), 'get_property_declaration')('unit_name')
            __content_2075086945112_246 = __quote(__content_2075086945112_246,
                                                  '\x00', '&#0;', None, False)
            __token = 303
            __content_2075086945112_301 = _lookup_attr(
                getitem('cargo'),
                'get_property_declaration')('type_abbreviation')
            __content_2075086945112_301 = __quote(__content_2075086945112_301,
                                                  '\x00', '&#0;', None, False)
            __token = 366
            __content_2075086945112_364 = _lookup_attr(
                getitem('cargo'), 'get_property_declaration')('sprite')
            __content_2075086945112_364 = __quote(__content_2075086945112_364,
                                                  '\x00', '&#0;', None, False)
            __token = 418
            __content_2075086945112_416 = _lookup_attr(
                getitem('cargo'), 'get_property_declaration')('weight')
            __content_2075086945112_416 = __quote(__content_2075086945112_416,
                                                  '\x00', '&#0;', None, False)
            __token = 470
            __content_2075086945112_468 = _lookup_attr(
                getitem('cargo'),
                'get_property_declaration')('station_list_colour')
            __content_2075086945112_468 = __quote(__content_2075086945112_468,
                                                  '\x00', '&#0;', None, False)
            __token = 535
            __content_2075086945112_533 = _lookup_attr(
                getitem('cargo'),
                'get_property_declaration')('cargo_payment_list_colour')
            __content_2075086945112_533 = __quote(__content_2075086945112_533,
                                                  '\x00', '&#0;', None, False)
            __token = 606
            __content_2075086945112_604 = _lookup_attr(
                getitem('cargo'), 'get_property_declaration')('is_freight')
            __content_2075086945112_604 = __quote(__content_2075086945112_604,
                                                  '\x00', '&#0;', None, False)
            __token = 662
            __content_2075086945112_660 = _lookup_attr(
                getitem('cargo'), 'get_property_declaration')('cargo_classes')
            __content_2075086945112_660 = __quote(__content_2075086945112_660,
                                                  '\x00', '&#0;', None, False)
            __token = 721
            __content_2075086945112_719 = _lookup_attr(
                getitem('cargo'),
                'get_property_declaration')('town_growth_effect',
                                            getitem('economy'))
            __content_2075086945112_719 = __quote(__content_2075086945112_719,
                                                  '\x00', '&#0;', None, False)
            __token = 794
            __content_2075086945112_792 = _lookup_attr(
                getitem('cargo'),
                'get_property_declaration')('town_growth_multiplier',
                                            getitem('economy'))
            __content_2075086945112_792 = __quote(__content_2075086945112_792,
                                                  '\x00', '&#0;', None, False)
            __token = 871
            __content_2075086945112_869 = _lookup_attr(
                getitem('cargo'), 'get_property_declaration')('units_of_cargo')
            __content_2075086945112_869 = __quote(__content_2075086945112_869,
                                                  '\x00', '&#0;', None, False)
            __token = 931
            __content_2075086945112_929 = _lookup_attr(
                getitem('cargo'), 'get_property_declaration')('items_of_cargo')
            __content_2075086945112_929 = __quote(__content_2075086945112_929,
                                                  '\x00', '&#0;', None, False)
            __token = 991
            __content_2075086945112_989 = _lookup_attr(
                getitem('cargo'),
                'get_property_declaration')('penalty_lowerbound',
                                            getitem('economy'))
            __content_2075086945112_989 = __quote(__content_2075086945112_989,
                                                  '\x00', '&#0;', None, False)
            __token = 1064
            __content_2075086945112_1062 = _lookup_attr(
                getitem('cargo'),
                'get_property_declaration')('single_penalty_length',
                                            getitem('economy'))
            __content_2075086945112_1062 = __quote(
                __content_2075086945112_1062, '\x00', '&#0;', None, False)
            __token = 1140
            __content_2075086945112_1138 = _lookup_attr(
                getitem('cargo'),
                'get_property_declaration')('price_factor', getitem('economy'))
            __content_2075086945112_1138 = __quote(
                __content_2075086945112_1138, '\x00', '&#0;', None, False)
            __token = 1207
            __content_2075086945112_1205 = _lookup_attr(
                getitem('cargo'),
                'get_property_declaration')('capacity_multiplier')
            __content_2075086945112_1205 = __quote(
                __content_2075086945112_1205, '\x00', '&#0;', None, False)
            __content_2075086945112 = (
                '%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s'
                % (
                    '\n        ',
                    (__content_2075086945112 if
                     (__content_2075086945112 is not None) else ''),
                    '\n        ',
                    (__content_2075086945112_246 if
                     (__content_2075086945112_246 is not None) else ''),
                    '\n        ',
                    (__content_2075086945112_301 if
                     (__content_2075086945112_301 is not None) else ''),
                    '\n        ',
                    (__content_2075086945112_364 if
                     (__content_2075086945112_364 is not None) else ''),
                    '\n        ',
                    (__content_2075086945112_416 if
                     (__content_2075086945112_416 is not None) else ''),
                    '\n        ',
                    (__content_2075086945112_468 if
                     (__content_2075086945112_468 is not None) else ''),
                    '\n        ',
                    (__content_2075086945112_533 if
                     (__content_2075086945112_533 is not None) else ''),
                    '\n        ',
                    (__content_2075086945112_604 if
                     (__content_2075086945112_604 is not None) else ''),
                    '\n        ',
                    (__content_2075086945112_660 if
                     (__content_2075086945112_660 is not None) else ''),
                    '\n        ',
                    (__content_2075086945112_719 if
                     (__content_2075086945112_719 is not None) else ''),
                    '\n        ',
                    (__content_2075086945112_792 if
                     (__content_2075086945112_792 is not None) else ''),
                    '\n        ',
                    (__content_2075086945112_869 if
                     (__content_2075086945112_869 is not None) else ''),
                    '\n        ',
                    (__content_2075086945112_929 if
                     (__content_2075086945112_929 is not None) else ''),
                    '\n        ',
                    (__content_2075086945112_989 if
                     (__content_2075086945112_989 is not None) else ''),
                    '\n        ',
                    (__content_2075086945112_1062 if
                     (__content_2075086945112_1062 is not None) else ''),
                    '\n        ',
                    (__content_2075086945112_1138 if
                     (__content_2075086945112_1138 is not None) else ''),
                    '\n        ',
                    (__content_2075086945112_1205 if
                     (__content_2075086945112_1205 is not None) else ''),
                    '\n        ',
                ))
            if (__content_2075086945112 is None):
                pass
            else:
                if (__content_2075086945112 is False):
                    __content_2075086945112 = None
                else:
                    __tt = type(__content_2075086945112)
                    if ((__tt is int) or (__tt is float) or (__tt is int)):
                        __content_2075086945112 = str(__content_2075086945112)
                    else:
                        if (__tt is bytes):
                            __content_2075086945112 = decode(
                                __content_2075086945112)
                        else:
                            if (__tt is not str):
                                try:
                                    __content_2075086945112 = __content_2075086945112.__html__
                                except get('AttributeError', AttributeError):
                                    __converted = convert(
                                        __content_2075086945112)
                                    __content_2075086945112 = (
                                        str(__content_2075086945112) if
                                        (__content_2075086945112 is __converted
                                         ) else __converted)
                                else:
                                    __content_2075086945112 = __content_2075086945112(
                                    )
            if (__content_2075086945112 is not None):
                __append(__content_2075086945112)

            # <Interpolation value=<Substitution '\n        cargo_label: ${cargo.get_cargo_label()};\n        number: ${cargo.get_numeric_id(economy)};\n    }\n    graphics {\n        cargoicon_${cargo.id};\n    }\n}\n' (22:67)> braces_required=True translation=False at 1e3258b80f0> -> __content_2075086945112
            __token = 1338
            __token = 1353
            __content_2075086945112 = _lookup_attr(getitem('cargo'),
                                                   'get_cargo_label')()
            __content_2075086945112 = __quote(__content_2075086945112, '\x00',
                                              '&#0;', None, False)
            __token = 1397
            __content_2075086945112_1395 = _lookup_attr(
                getitem('cargo'), 'get_numeric_id')(getitem('economy'))
            __content_2075086945112_1395 = __quote(
                __content_2075086945112_1395, '\x00', '&#0;', None, False)
            __token = 1470
            __content_2075086945112_1468 = _lookup_attr(getitem('cargo'), 'id')
            __content_2075086945112_1468 = __quote(
                __content_2075086945112_1468, '\x00', '&#0;', None, False)
            __content_2075086945112 = ('%s%s%s%s%s%s%s' % (
                '\n        cargo_label: ',
                (__content_2075086945112 if
                 (__content_2075086945112 is not None) else ''),
                ';\n        number: ',
                (__content_2075086945112_1395 if
                 (__content_2075086945112_1395 is not None) else ''),
                ';\n    }\n    graphics {\n        cargoicon_',
                (__content_2075086945112_1468 if
                 (__content_2075086945112_1468 is not None) else ''),
                ';\n    }\n}\n',
            ))
            if (__content_2075086945112 is None):
                pass
            else:
                if (__content_2075086945112 is False):
                    __content_2075086945112 = None
                else:
                    __tt = type(__content_2075086945112)
                    if ((__tt is int) or (__tt is float) or (__tt is int)):
                        __content_2075086945112 = str(__content_2075086945112)
                    else:
                        if (__tt is bytes):
                            __content_2075086945112 = decode(
                                __content_2075086945112)
                        else:
                            if (__tt is not str):
                                try:
                                    __content_2075086945112 = __content_2075086945112.__html__
                                except get('AttributeError', AttributeError):
                                    __converted = convert(
                                        __content_2075086945112)
                                    __content_2075086945112 = (
                                        str(__content_2075086945112) if
                                        (__content_2075086945112 is __converted
                                         ) else __converted)
                                else:
                                    __content_2075086945112 = __content_2075086945112(
                                    )
            if (__content_2075086945112 is not None):
                __append(__content_2075086945112)
        except:
            if (__token is not None):
                rcontext.setdefault('__error__', []).append(
                    (__tokens[__token] + (
                        __filename,
                        _exc_info()[1],
                    )))
            raise
コード例 #5
0
    def render_tile_animation(__stream,
                              econtext,
                              rcontext,
                              __i18n_domain=None,
                              __i18n_context=None):
        __append = __stream.append
        __re_amp = g_re_amp
        __token = None
        __re_needs_escape = g_re_needs_escape

        def __convert(target):
            if (target is None):
                return
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except AttributeError:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            target = target()
            return target

        def __quote(target, quote, quote_entity, default, default_marker):
            if (target is None):
                return
            if (target is default_marker):
                return default
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            return target()
                if (target is not None):
                    try:
                        escape = (__re_needs_escape(target) is not None)
                    except TypeError:
                        pass
                    else:
                        if escape:
                            if ('&' in target):
                                target = target.replace('&', '&amp;')
                            if ('<' in target):
                                target = target.replace('<', '&lt;')
                            if ('>' in target):
                                target = target.replace('>', '&gt;')
                            if ((quote is not None) and (quote in target)):
                                target = target.replace(quote, quote_entity)
            return target

        translate = econtext['__translate']
        decode = econtext['__decode']
        convert = econtext['__convert']
        on_error_handler = econtext['__on_error_handler']
        try:
            getitem = econtext.__getitem__
            get = econtext.get
            __append('\n    ')
            __backup_tile_139875069127424 = get('tile', __marker)

            # <Value 'industry.tiles' (4:28)> -> __iterator
            __token = 157
            __iterator = _lookup_attr(getitem('industry'), 'tiles')
            (
                __iterator,
                ____index_139875070089200,
            ) = getitem('repeat')('tile', __iterator)
            econtext['tile'] = None
            for __item in __iterator:
                econtext['tile'] = __item
                __append('\n        ')

                # <Value 'tile.custom_animation_control is not None' (5:47)> -> __condition
                __token = 221
                __condition = (_lookup_attr(getitem('tile'),
                                            'custom_animation_control')
                               is not None)
                if __condition:
                    __backup_macroname_139875068827080 = get(
                        'macroname', __marker)

                    # <Static value=<_ast.Str object at 0x7f3733dd9908> name=None at 7f3733dd90b8> -> __value
                    __value = _static_139875070089480
                    econtext['macroname'] = __value

                    # <Value "tile.animation_macros()[tile.custom_animation_control['macro']]" (6:53)> -> __macro
                    __token = 317
                    __macro = _lookup_attr(
                        getitem('tile'), 'animation_macros')()[_lookup_attr(
                            getitem('tile'),
                            'custom_animation_control')['macro']]
                    __token = 317
                    __m = __macro.include
                    __m(__stream, econtext.copy(), rcontext, __i18n_domain)
                    econtext.update(rcontext)
                    if (__backup_macroname_139875068827080 is __marker):
                        del econtext['macroname']
                    else:
                        econtext[
                            'macroname'] = __backup_macroname_139875068827080
                __append('\n    ')
                ____index_139875070089200 -= 1
                if (____index_139875070089200 > 0):
                    __append('')
            if (__backup_tile_139875069127424 is __marker):
                del econtext['tile']
            else:
                econtext['tile'] = __backup_tile_139875069127424
            __append('\n')
        except:
            if (__token is not None):
                rcontext.setdefault('__error__', []).append(
                    (__tokens[__token] + (
                        __filename,
                        _exc_info()[1],
                    )))
            raise
コード例 #6
0
    def render(__stream,
               econtext,
               rcontext,
               __i18n_domain=None,
               __i18n_context=None):
        __append = __stream.append
        __re_amp = g_re_amp
        __token = None
        __re_needs_escape = g_re_needs_escape

        def __convert(target):
            if (target is None):
                return
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except AttributeError:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            target = target()
            return target

        def __quote(target, quote, quote_entity, default, default_marker):
            if (target is None):
                return
            if (target is default_marker):
                return default
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            return target()
                if (target is not None):
                    try:
                        escape = (__re_needs_escape(target) is not None)
                    except TypeError:
                        pass
                    else:
                        if escape:
                            if ('&' in target):
                                target = target.replace('&', '&amp;')
                            if ('<' in target):
                                target = target.replace('<', '&lt;')
                            if ('>' in target):
                                target = target.replace('>', '&gt;')
                            if ((quote is not None) and (quote in target)):
                                target = target.replace(quote, quote_entity)
            return target

        translate = econtext['__translate']
        decode = econtext['__decode']
        convert = econtext['__convert']
        on_error_handler = econtext['__on_error_handler']
        try:
            getitem = econtext.__getitem__
            get = econtext.get
            __append(
                '/* ******************************************************************\n * Definition of the industry tile, its callbacks, and graphics chain\n * ******************************************************************/\n\n'
            )
            __backup_macroname_140302362974856 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f9ab095abe0> name=None at 7f9ab095ae10> -> __value
            __value = _static_140302364290016
            econtext['macroname'] = __value

            # <Value 'load: spritesets.pynml' (5:30)> -> __macro
            __token = 242
            __macro = ' spritesets.pynml'
            __macro = __loader(__macro)
            __token = 242
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140302362974856 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140302362974856
            __append('\n\n')
            __backup_macroname_140302363975496 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f9ab099eba8> name=None at 7f9ab099e390> -> __value
            __value = _static_140302364568488
            econtext['macroname'] = __value

            # <Value 'load: spritelayouts.pynml' (7:30)> -> __macro
            __token = 300
            __macro = ' spritelayouts.pynml'
            __macro = __loader(__macro)
            __token = 300
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140302363975496 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140302363975496
            __append('\n\n')
            __backup_macroname_140302364660104 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f9ab098cda0> name=None at 7f9ab098ce48> -> __value
            __value = _static_140302364495264
            econtext['macroname'] = __value

            # <Value 'load: graphics_switches.pynml' (9:30)> -> __macro
            __token = 361
            __macro = ' graphics_switches.pynml'
            __macro = __loader(__macro)
            __token = 361
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140302364660104 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140302364660104
            __append('\n\n')
            __backup_location_checks_tile_140302364569216 = get(
                'location_checks_tile', __marker)

            # <Value 'load: location_check_macros_tile.pynml' (11:42)> -> __value
            __token = 438
            __value = ' location_check_macros_tile.pynml'
            __value = __loader(__value)
            econtext['location_checks_tile'] = __value
            __backup_macroname_140302364662728 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f9ab098c710> name=None at 7f9ab098cdd8> -> __value
            __value = _static_140302364493584
            econtext['macroname'] = __value

            # <Value "location_checks_tile.macros['render_tree']" (12:30)> -> __macro
            __token = 508
            __macro = _lookup_attr(getitem('location_checks_tile'),
                                   'macros')['render_tree']
            __token = 508
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140302364662728 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140302364662728
            if (__backup_location_checks_tile_140302364569216 is __marker):
                del econtext['location_checks_tile']
            else:
                econtext[
                    'location_checks_tile'] = __backup_location_checks_tile_140302364569216
            __append('\n\n')
            __backup_animation_macros_140302364568152 = get(
                'animation_macros', __marker)

            # <Value 'load: animation_macros.pynml' (14:38)> -> __value
            __token = 594
            __value = ' animation_macros.pynml'
            __value = __loader(__value)
            econtext['animation_macros'] = __value
            __backup_macroname_140302364661640 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f9ab098c128> name=None at 7f9ab098cf60> -> __value
            __value = _static_140302364492072
            econtext['macroname'] = __value

            # <Value "animation_macros.macros['tile_animation']" (15:30)> -> __macro
            __token = 654
            __macro = _lookup_attr(getitem('animation_macros'),
                                   'macros')['tile_animation']
            __token = 654
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140302364661640 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140302364661640
            if (__backup_animation_macros_140302364568152 is __marker):
                del econtext['animation_macros']
            else:
                econtext[
                    'animation_macros'] = __backup_animation_macros_140302364568152
            __append('\n\n')
            __backup_macroname_140302364662984 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f9ab098cb00> name=None at 7f9ab098c2b0> -> __value
            __value = _static_140302364494592
            econtext['macroname'] = __value

            # <Value 'load: properties_tile.pynml' (17:30)> -> __macro
            __token = 731
            __macro = ' properties_tile.pynml'
            __macro = __loader(__macro)
            __token = 731
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140302364662984 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140302364662984
            __append(
                '\n\n\n/* *************************************************\n * Definition of the industry\n * *************************************************/\n\n'
            )
            __backup_macroname_140302364095752 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f9ab098cef0> name=None at 7f9ab098c278> -> __value
            __value = _static_140302364495600
            econtext['macroname'] = __value

            # <Value 'load: layouts.pynml' (24:30)> -> __macro
            __token = 933
            __macro = ' layouts.pynml'
            __macro = __loader(__macro)
            __token = 933
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140302364095752 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140302364095752
            __append('\n\n')
            __backup_macroname_140302364098248 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f9ab098cba8> name=None at 7f9ab22a4048> -> __value
            __value = _static_140302364494760
            econtext['macroname'] = __value

            # <Value 'load: extra_text_primary.pynml' (26:30)> -> __macro
            __token = 988
            __macro = ' extra_text_primary.pynml'
            __macro = __loader(__macro)
            __token = 988
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140302364098248 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140302364098248
            __append('\n\n')
            __backup_macroname_140302364133384 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f9ab22a4588> name=None at 7f9ab22a41d0> -> __value
            __value = _static_140302390805896
            econtext['macroname'] = __value

            # <Value 'load: produce_primary.pynml' (28:30)> -> __macro
            __token = 1054
            __macro = ' produce_primary.pynml'
            __macro = __loader(__macro)
            __token = 1054
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140302364133384 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140302364133384
            __append('\n\n')
            __backup_macroname_140302364663176 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f9ab07eae10> name=None at 7f9ab07ea0b8> -> __value
            __value = _static_140302362783248
            econtext['macroname'] = __value

            # <Value 'load: check_primary_supplies_delivered.pynml' (30:30)> -> __macro
            __token = 1117
            __macro = ' check_primary_supplies_delivered.pynml'
            __macro = __loader(__macro)
            __token = 1117
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140302364663176 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140302364663176
            __append('\n\n')
            __backup_macroname_140302363299528 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f9ab07ea240> name=None at 7f9ab07ea860> -> __value
            __value = _static_140302362780224
            econtext['macroname'] = __value

            # <Value 'load: availability.pynml' (32:30)> -> __macro
            __token = 1197
            __macro = ' availability.pynml'
            __macro = __loader(__macro)
            __token = 1197
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140302363299528 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140302363299528
            __append('\n\n')
            __backup_location_checks_industry_140302364566752 = get(
                'location_checks_industry', __marker)

            # <Value 'load: location_check_macros_industry.pynml' (34:46)> -> __value
            __token = 1273
            __value = ' location_check_macros_industry.pynml'
            __value = __loader(__value)
            econtext['location_checks_industry'] = __value
            __backup_macroname_140302362690248 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f9ab07eaf28> name=None at 7f9ab07ea898> -> __value
            __value = _static_140302362783528
            econtext['macroname'] = __value

            # <Value "location_checks_industry.macros['render_tree']" (35:30)> -> __macro
            __token = 1347
            __macro = _lookup_attr(getitem('location_checks_industry'),
                                   'macros')['render_tree']
            __token = 1347
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140302362690248 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140302362690248
            if (__backup_location_checks_industry_140302364566752 is __marker):
                del econtext['location_checks_industry']
            else:
                econtext[
                    'location_checks_industry'] = __backup_location_checks_industry_140302364566752
            __append('\n\n')
            __backup_macroname_140302364459720 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f9ab07eaf60> name=None at 7f9ab07ea080> -> __value
            __value = _static_140302362783584
            econtext['macroname'] = __value

            # <Value 'load: properties_industry.pynml' (37:30)> -> __macro
            __token = 1429
            __macro = ' properties_industry.pynml'
            __macro = __loader(__macro)
            __token = 1429
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140302364459720 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140302364459720
            __append('\n\n')
            __append('\n')
            __backup_economy_140302364565744 = get('economy', __marker)

            # <Value 'economies' (40:37)> -> __iterator
            __token = 1613
            __iterator = getitem('economies')
            (
                __iterator,
                ____index_140302362783416,
            ) = getitem('repeat')('economy', __iterator)
            econtext['economy'] = None
            for __item in __iterator:
                econtext['economy'] = __item
                __append('\n    ')

                # <Value "industry.get_property('enabled', economy) == True" (41:39)> -> __condition
                __token = 1664
                __condition = (_lookup_attr(
                    getitem('industry'),
                    'get_property')('enabled', getitem('economy')) == True)
                if __condition:

                    # <Interpolation value=<Substitution '\n        if (economy==${economy.numeric_id}) {\n            item(FEAT_INDUSTRIES, ${industry.id}, ${industry.numeric_id}) {\n                graphics {\n                    construction_probability: ${industry.id}_check_availability;\n                    build_prod_change:        randomise_primary_production_on_build;\n                    produce_cargo_arrival:    ${industry.id}_produce;\n                    produce_256_ticks:        ${industry.id}_produce_256_ticks;\n                    monthly_prod_change:      ${industry.id}_monthly_update;\n                    random_prod_change:       return CB_RESULT_IND_PROD_NO_CHANGE;\n                    location_check:           ${industry.id}_check_location;\n                    extra_text_fund:          ${industry.get_extra_text_fund(economy)};\n                    extra_text_industry:      ${industry.id}_extra_text;\n                    cargo_subtype_display:    ${industry.id}_cargo_subtype_display;\n                    colour:                   switch_colour;\n                }\n            }\n        }\n    ' (41:90)> braces_required=True translation=False at 7f9ab07eacc0> -> __content_140302383355024
                    __token = 1724
                    __token = 1739
                    __content_140302383355024 = _lookup_attr(
                        getitem('economy'), 'numeric_id')
                    __content_140302383355024 = __quote(
                        __content_140302383355024, '\x00', '&#0;', None, False)
                    __token = 1798
                    __content_140302383355024_1796 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_140302383355024_1796 = __quote(
                        __content_140302383355024_1796, '\x00', '&#0;', None,
                        False)
                    __token = 1814
                    __content_140302383355024_1812 = _lookup_attr(
                        getitem('industry'), 'numeric_id')
                    __content_140302383355024_1812 = __quote(
                        __content_140302383355024_1812, '\x00', '&#0;', None,
                        False)
                    __token = 1913
                    __content_140302383355024_1911 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_140302383355024_1911 = __quote(
                        __content_140302383355024_1911, '\x00', '&#0;', None,
                        False)
                    __token = 2079
                    __content_140302383355024_2077 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_140302383355024_2077 = __quote(
                        __content_140302383355024_2077, '\x00', '&#0;', None,
                        False)
                    __token = 2149
                    __content_140302383355024_2147 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_140302383355024_2147 = __quote(
                        __content_140302383355024_2147, '\x00', '&#0;', None,
                        False)
                    __token = 2229
                    __content_140302383355024_2227 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_140302383355024_2227 = __quote(
                        __content_140302383355024_2227, '\x00', '&#0;', None,
                        False)
                    __token = 2389
                    __content_140302383355024_2387 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_140302383355024_2387 = __quote(
                        __content_140302383355024_2387, '\x00', '&#0;', None,
                        False)
                    __token = 2466
                    __content_140302383355024_2464 = _lookup_attr(
                        getitem('industry'),
                        'get_extra_text_fund')(getitem('economy'))
                    __content_140302383355024_2464 = __quote(
                        __content_140302383355024_2464, '\x00', '&#0;', None,
                        False)
                    __token = 2554
                    __content_140302383355024_2552 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_140302383355024_2552 = __quote(
                        __content_140302383355024_2552, '\x00', '&#0;', None,
                        False)
                    __token = 2627
                    __content_140302383355024_2625 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_140302383355024_2625 = __quote(
                        __content_140302383355024_2625, '\x00', '&#0;', None,
                        False)
                    __content_140302383355024 = ('%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s' % (
                        '\n        if (economy==',
                        (__content_140302383355024 if
                         (__content_140302383355024 is not None) else ''),
                        ') {\n            item(FEAT_INDUSTRIES, ',
                        (__content_140302383355024_1796 if
                         (__content_140302383355024_1796 is not None) else ''),
                        ', ',
                        (__content_140302383355024_1812 if
                         (__content_140302383355024_1812 is not None) else ''),
                        ') {\n                graphics {\n                    construction_probability: ',
                        (__content_140302383355024_1911 if
                         (__content_140302383355024_1911 is not None) else ''),
                        '_check_availability;\n                    build_prod_change:        randomise_primary_production_on_build;\n                    produce_cargo_arrival:    ',
                        (__content_140302383355024_2077 if
                         (__content_140302383355024_2077 is not None) else ''),
                        '_produce;\n                    produce_256_ticks:        ',
                        (__content_140302383355024_2147 if
                         (__content_140302383355024_2147 is not None) else ''),
                        '_produce_256_ticks;\n                    monthly_prod_change:      ',
                        (__content_140302383355024_2227 if
                         (__content_140302383355024_2227 is not None) else ''),
                        '_monthly_update;\n                    random_prod_change:       return CB_RESULT_IND_PROD_NO_CHANGE;\n                    location_check:           ',
                        (__content_140302383355024_2387 if
                         (__content_140302383355024_2387 is not None) else ''),
                        '_check_location;\n                    extra_text_fund:          ',
                        (__content_140302383355024_2464 if
                         (__content_140302383355024_2464 is not None) else ''),
                        ';\n                    extra_text_industry:      ',
                        (__content_140302383355024_2552 if
                         (__content_140302383355024_2552 is not None) else ''),
                        '_extra_text;\n                    cargo_subtype_display:    ',
                        (__content_140302383355024_2625 if
                         (__content_140302383355024_2625 is not None) else ''),
                        '_cargo_subtype_display;\n                    colour:                   switch_colour;\n                }\n            }\n        }\n    ',
                    ))
                    if (__content_140302383355024 is None):
                        pass
                    else:
                        if (__content_140302383355024 is False):
                            __content_140302383355024 = None
                        else:
                            __tt = type(__content_140302383355024)
                            if ((__tt is int) or (__tt is float)
                                    or (__tt is int)):
                                __content_140302383355024 = str(
                                    __content_140302383355024)
                            else:
                                if (__tt is bytes):
                                    __content_140302383355024 = decode(
                                        __content_140302383355024)
                                else:
                                    if (__tt is not str):
                                        try:
                                            __content_140302383355024 = __content_140302383355024.__html__
                                        except get('AttributeError',
                                                   AttributeError):
                                            __converted = convert(
                                                __content_140302383355024)
                                            __content_140302383355024 = (
                                                str(__content_140302383355024)
                                                if
                                                (__content_140302383355024 is
                                                 __converted) else __converted)
                                        else:
                                            __content_140302383355024 = __content_140302383355024(
                                            )
                    if (__content_140302383355024 is not None):
                        __append(__content_140302383355024)
                __append('\n')
                ____index_140302362783416 -= 1
                if (____index_140302362783416 > 0):
                    __append('')
            if (__backup_economy_140302364565744 is __marker):
                del econtext['economy']
            else:
                econtext['economy'] = __backup_economy_140302364565744
            __append('\n')
        except:
            if (__token is not None):
                rcontext.setdefault('__error__', []).append(
                    (__tokens[__token] + (
                        __filename,
                        _exc_info()[1],
                    )))
            raise
コード例 #7
0
    def render(__stream,
               econtext,
               rcontext,
               __i18n_domain=None,
               __i18n_context=None):
        __append = __stream.append
        __re_amp = g_re_amp
        __token = None
        __re_needs_escape = g_re_needs_escape

        def __convert(target):
            if (target is None):
                return
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except AttributeError:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            target = target()
            return target

        def __quote(target, quote, quote_entity, default, default_marker):
            if (target is None):
                return
            if (target is default_marker):
                return default
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            return target()
                if (target is not None):
                    try:
                        escape = (__re_needs_escape(target) is not None)
                    except TypeError:
                        pass
                    else:
                        if escape:
                            if ('&' in target):
                                target = target.replace('&', '&amp;')
                            if ('<' in target):
                                target = target.replace('<', '&lt;')
                            if ('>' in target):
                                target = target.replace('>', '&gt;')
                            if ((quote is not None) and (quote in target)):
                                target = target.replace(quote, quote_entity)
            return target

        translate = econtext['__translate']
        decode = econtext['__decode']
        convert = econtext['__convert']
        on_error_handler = econtext['__on_error_handler']
        try:
            getitem = econtext.__getitem__
            get = econtext.get
            __append(
                '/* ******************************************************************\n * Definition of the industry tile, its callbacks, and graphics chain\n * ******************************************************************/\n\n'
            )
            __backup_macroname_140302362202312 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f9ab0887fd0> name=None at 7f9ab0887a58> -> __value
            __value = _static_140302363426768
            econtext['macroname'] = __value

            # <Value 'load: spritesets.pynml' (5:30)> -> __macro
            __token = 242
            __macro = ' spritesets.pynml'
            __macro = __loader(__macro)
            __token = 242
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140302362202312 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140302362202312
            __append('\n\n')
            __backup_macroname_140302364367304 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f9ab0887c88> name=None at 7f9ab0887908> -> __value
            __value = _static_140302363425928
            econtext['macroname'] = __value

            # <Value 'load: spritelayouts.pynml' (7:30)> -> __macro
            __token = 300
            __macro = ' spritelayouts.pynml'
            __macro = __loader(__macro)
            __token = 300
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140302364367304 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140302364367304
            __append('\n\n')
            __backup_macroname_140302362205960 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f9ab0887f60> name=None at 7f9ab0887978> -> __value
            __value = _static_140302363426656
            econtext['macroname'] = __value

            # <Value 'load: graphics_switches.pynml' (9:30)> -> __macro
            __token = 361
            __macro = ' graphics_switches.pynml'
            __macro = __loader(__macro)
            __token = 361
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140302362205960 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140302362205960
            __append('\n\n')
            __backup_location_checks_tile_140302363433448 = get(
                'location_checks_tile', __marker)

            # <Value 'load: location_check_macros_tile.pynml' (11:42)> -> __value
            __token = 438
            __value = ' location_check_macros_tile.pynml'
            __value = __loader(__value)
            econtext['location_checks_tile'] = __value
            __backup_macroname_140302362202760 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f9ab0887320> name=None at 7f9ab08870b8> -> __value
            __value = _static_140302363423520
            econtext['macroname'] = __value

            # <Value "location_checks_tile.macros['render_tree']" (12:30)> -> __macro
            __token = 508
            __macro = _lookup_attr(getitem('location_checks_tile'),
                                   'macros')['render_tree']
            __token = 508
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140302362202760 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140302362202760
            if (__backup_location_checks_tile_140302363433448 is __marker):
                del econtext['location_checks_tile']
            else:
                econtext[
                    'location_checks_tile'] = __backup_location_checks_tile_140302363433448
            __append('\n\n')
            __backup_animation_macros_140302362850584 = get(
                'animation_macros', __marker)

            # <Value 'load: animation_macros.pynml' (14:38)> -> __value
            __token = 594
            __value = ' animation_macros.pynml'
            __value = __loader(__value)
            econtext['animation_macros'] = __value
            __backup_macroname_140302363315656 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f9ab0887438> name=None at 7f9ab0887dd8> -> __value
            __value = _static_140302363423800
            econtext['macroname'] = __value

            # <Value "animation_macros.macros['tile_animation']" (15:30)> -> __macro
            __token = 654
            __macro = _lookup_attr(getitem('animation_macros'),
                                   'macros')['tile_animation']
            __token = 654
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140302363315656 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140302363315656
            if (__backup_animation_macros_140302362850584 is __marker):
                del econtext['animation_macros']
            else:
                econtext[
                    'animation_macros'] = __backup_animation_macros_140302362850584
            __append('\n\n')
            __backup_macroname_140302363225224 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f9ab08878d0> name=None at 7f9ab0887128> -> __value
            __value = _static_140302363424976
            econtext['macroname'] = __value

            # <Value 'load: properties_tile.pynml' (17:30)> -> __macro
            __token = 731
            __macro = ' properties_tile.pynml'
            __macro = __loader(__macro)
            __token = 731
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140302363225224 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140302363225224
            __append(
                '\n\n\n/* *************************************************\n * Definition of the industry\n * *************************************************/\n\n'
            )
            __backup_macroname_140302363225096 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f9ab07eab70> name=None at 7f9ab07ea2b0> -> __value
            __value = _static_140302362782576
            econtext['macroname'] = __value

            # <Value 'load: layouts.pynml' (24:30)> -> __macro
            __token = 933
            __macro = ' layouts.pynml'
            __macro = __loader(__macro)
            __token = 933
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140302363225096 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140302363225096
            __append('\n\n')
            __backup_macroname_140302363222536 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f9ab07ea9e8> name=None at 7f9ab07eaef0> -> __value
            __value = _static_140302362782184
            econtext['macroname'] = __value

            # <Value 'load: availability.pynml' (26:30)> -> __macro
            __token = 988
            __macro = ' availability.pynml'
            __macro = __loader(__macro)
            __token = 988
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140302363222536 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140302363222536
            __append('\n\n')
            __backup_location_checks_industry_140302363432272 = get(
                'location_checks_industry', __marker)

            # <Value 'load: location_check_macros_industry.pynml' (28:46)> -> __value
            __token = 1064
            __value = ' location_check_macros_industry.pynml'
            __value = __loader(__value)
            econtext['location_checks_industry'] = __value
            __backup_macroname_140302362204424 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f9ab07ea828> name=None at 7f9ab07eab00> -> __value
            __value = _static_140302362781736
            econtext['macroname'] = __value

            # <Value "location_checks_industry.macros['render_tree']" (29:30)> -> __macro
            __token = 1138
            __macro = _lookup_attr(getitem('location_checks_industry'),
                                   'macros')['render_tree']
            __token = 1138
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140302362204424 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140302362204424
            if (__backup_location_checks_industry_140302363432272 is __marker):
                del econtext['location_checks_industry']
            else:
                econtext[
                    'location_checks_industry'] = __backup_location_checks_industry_140302363432272
            __append('\n\n')
            __backup_macroname_140302363222728 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f9ab07eac50> name=None at 7f9ab07eaf28> -> __value
            __value = _static_140302362782800
            econtext['macroname'] = __value

            # <Value 'load: properties_industry.pynml' (31:30)> -> __macro
            __token = 1220
            __macro = ' properties_industry.pynml'
            __macro = __loader(__macro)
            __token = 1220
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140302363222728 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140302363222728
            __append('\n\n')
            __append('\n')
            __backup_economy_140302363431264 = get('economy', __marker)

            # <Value 'economies' (34:37)> -> __iterator
            __token = 1404
            __iterator = getitem('economies')
            (
                __iterator,
                ____index_140302362781400,
            ) = getitem('repeat')('economy', __iterator)
            econtext['economy'] = None
            for __item in __iterator:
                econtext['economy'] = __item
                __append('\n    ')

                # <Value "industry.get_property('enabled', economy) == True" (35:39)> -> __condition
                __token = 1455
                __condition = (_lookup_attr(
                    getitem('industry'),
                    'get_property')('enabled', getitem('economy')) == True)
                if __condition:

                    # <Interpolation value=<Substitution '\n        if (economy==${economy.numeric_id}) {\n            item(FEAT_INDUSTRIES, ${industry.id}, ${industry.numeric_id}) {\n                graphics {\n                    construction_probability: ${industry.id}_check_availability;\n                    build_prod_change:        randomise_primary_production_on_build;\n                    location_check:           ${industry.id}_check_location;\n                    extra_text_fund:          ${industry.get_extra_text_fund(economy)};\n                    colour:                   switch_colour;\n                }\n            }\n        }\n    ' (35:90)> braces_required=True translation=False at 7f9ab07eaa58> -> __content_140302383355024
                    __token = 1515
                    __token = 1530
                    __content_140302383355024 = _lookup_attr(
                        getitem('economy'), 'numeric_id')
                    __content_140302383355024 = __quote(
                        __content_140302383355024, '\x00', '&#0;', None, False)
                    __token = 1589
                    __content_140302383355024_1587 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_140302383355024_1587 = __quote(
                        __content_140302383355024_1587, '\x00', '&#0;', None,
                        False)
                    __token = 1605
                    __content_140302383355024_1603 = _lookup_attr(
                        getitem('industry'), 'numeric_id')
                    __content_140302383355024_1603 = __quote(
                        __content_140302383355024_1603, '\x00', '&#0;', None,
                        False)
                    __token = 1704
                    __content_140302383355024_1702 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_140302383355024_1702 = __quote(
                        __content_140302383355024_1702, '\x00', '&#0;', None,
                        False)
                    __token = 1870
                    __content_140302383355024_1868 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_140302383355024_1868 = __quote(
                        __content_140302383355024_1868, '\x00', '&#0;', None,
                        False)
                    __token = 1947
                    __content_140302383355024_1945 = _lookup_attr(
                        getitem('industry'),
                        'get_extra_text_fund')(getitem('economy'))
                    __content_140302383355024_1945 = __quote(
                        __content_140302383355024_1945, '\x00', '&#0;', None,
                        False)
                    __content_140302383355024 = ('%s%s%s%s%s%s%s%s%s%s%s%s%s' % (
                        '\n        if (economy==',
                        (__content_140302383355024 if
                         (__content_140302383355024 is not None) else ''),
                        ') {\n            item(FEAT_INDUSTRIES, ',
                        (__content_140302383355024_1587 if
                         (__content_140302383355024_1587 is not None) else ''),
                        ', ',
                        (__content_140302383355024_1603 if
                         (__content_140302383355024_1603 is not None) else ''),
                        ') {\n                graphics {\n                    construction_probability: ',
                        (__content_140302383355024_1702 if
                         (__content_140302383355024_1702 is not None) else ''),
                        '_check_availability;\n                    build_prod_change:        randomise_primary_production_on_build;\n                    location_check:           ',
                        (__content_140302383355024_1868 if
                         (__content_140302383355024_1868 is not None) else ''),
                        '_check_location;\n                    extra_text_fund:          ',
                        (__content_140302383355024_1945 if
                         (__content_140302383355024_1945 is not None) else ''),
                        ';\n                    colour:                   switch_colour;\n                }\n            }\n        }\n    ',
                    ))
                    if (__content_140302383355024 is None):
                        pass
                    else:
                        if (__content_140302383355024 is False):
                            __content_140302383355024 = None
                        else:
                            __tt = type(__content_140302383355024)
                            if ((__tt is int) or (__tt is float)
                                    or (__tt is int)):
                                __content_140302383355024 = str(
                                    __content_140302383355024)
                            else:
                                if (__tt is bytes):
                                    __content_140302383355024 = decode(
                                        __content_140302383355024)
                                else:
                                    if (__tt is not str):
                                        try:
                                            __content_140302383355024 = __content_140302383355024.__html__
                                        except get('AttributeError',
                                                   AttributeError):
                                            __converted = convert(
                                                __content_140302383355024)
                                            __content_140302383355024 = (
                                                str(__content_140302383355024)
                                                if
                                                (__content_140302383355024 is
                                                 __converted) else __converted)
                                        else:
                                            __content_140302383355024 = __content_140302383355024(
                                            )
                    if (__content_140302383355024 is not None):
                        __append(__content_140302383355024)
                __append('\n')
                ____index_140302362781400 -= 1
                if (____index_140302362781400 > 0):
                    __append('')
            if (__backup_economy_140302363431264 is __marker):
                del econtext['economy']
            else:
                econtext['economy'] = __backup_economy_140302363431264
            __append('\n')
        except:
            if (__token is not None):
                rcontext.setdefault('__error__', []).append(
                    (__tokens[__token] + (
                        __filename,
                        _exc_info()[1],
                    )))
            raise
コード例 #8
0
    def render_random_first_frame(__stream,
                                  econtext,
                                  rcontext,
                                  __i18n_domain=None,
                                  __i18n_context=None):
        __append = __stream.append
        __re_amp = g_re_amp
        __token = None
        __re_needs_escape = g_re_needs_escape

        def __convert(target):
            if (target is None):
                return
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except AttributeError:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            target = target()
            return target

        def __quote(target, quote, quote_entity, default, default_marker):
            if (target is None):
                return
            if (target is default_marker):
                return default
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            return target()
                if (target is not None):
                    try:
                        escape = (__re_needs_escape(target) is not None)
                    except TypeError:
                        pass
                    else:
                        if escape:
                            if ('&' in target):
                                target = target.replace('&', '&amp;')
                            if ('<' in target):
                                target = target.replace('<', '&lt;')
                            if ('>' in target):
                                target = target.replace('>', '&gt;')
                            if ((quote is not None) and (quote in target)):
                                target = target.replace(quote, quote_entity)
            return target

        translate = econtext['__translate']
        decode = econtext['__decode']
        convert = econtext['__convert']
        on_error_handler = econtext['__on_error_handler']
        try:
            getitem = econtext.__getitem__
            get = econtext.get
            __append('\n    ')
            __append('\n    ')

            # <Interpolation value=<Substitution '\n    switch(FEAT_INDUSTRYTILES, SELF, ${tile.id}_anim_control, (extra_callback_info1 % ${tile.animation_length})) {\n        ' (30:7)> braces_required=True translation=False at 7f3733dd9278> -> __content_139875089167952
            __token = 1547
            __token = 1582
            __content_139875089167952 = _lookup_attr(getitem('tile'), 'id')
            __content_139875089167952 = __quote(__content_139875089167952,
                                                '\x00', '&#0;', None, False)
            __token = 1631
            __content_139875089167952_1629 = _lookup_attr(
                getitem('tile'), 'animation_length')
            __content_139875089167952_1629 = __quote(
                __content_139875089167952_1629, '\x00', '&#0;', None, False)
            __content_139875089167952 = ('%s%s%s%s%s' % (
                '\n    switch(FEAT_INDUSTRYTILES, SELF, ',
                (__content_139875089167952 if
                 (__content_139875089167952 is not None) else ''),
                '_anim_control, (extra_callback_info1 % ',
                (__content_139875089167952_1629 if
                 (__content_139875089167952_1629 is not None) else ''),
                ')) {\n        ',
            ))
            if (__content_139875089167952 is None):
                pass
            else:
                if (__content_139875089167952 is False):
                    __content_139875089167952 = None
                else:
                    __tt = type(__content_139875089167952)
                    if ((__tt is int) or (__tt is float) or (__tt is int)):
                        __content_139875089167952 = str(
                            __content_139875089167952)
                    else:
                        if (__tt is bytes):
                            __content_139875089167952 = decode(
                                __content_139875089167952)
                        else:
                            if (__tt is not str):
                                try:
                                    __content_139875089167952 = __content_139875089167952.__html__
                                except get('AttributeError', AttributeError):
                                    __converted = convert(
                                        __content_139875089167952)
                                    __content_139875089167952 = (
                                        str(__content_139875089167952) if
                                        (__content_139875089167952 is
                                         __converted) else __converted)
                                else:
                                    __content_139875089167952 = __content_139875089167952(
                                    )
            if (__content_139875089167952 is not None):
                __append(__content_139875089167952)
            __backup_frame_139875068663400 = get('frame', __marker)

            # <Value 'range(tile.animation_length)' (32:34)> -> __iterator
            __token = 1692
            __iterator = get('range',
                             range)(_lookup_attr(getitem('tile'),
                                                 'animation_length'))
            (
                __iterator,
                ____index_139875070087632,
            ) = getitem('repeat')('frame', __iterator)
            econtext['frame'] = None
            for __item in __iterator:
                econtext['frame'] = __item

                # <Interpolation value=<Substitution '\n            ${repeat.frame.index}: return ${repeat.frame.index};\n        ' (32:64)> braces_required=True translation=False at 7f3733dd90f0> -> __content_139875089167952
                __token = 1735
                __token = 1737
                __content_139875089167952 = _lookup_attr(
                    _lookup_attr(getitem('repeat'), 'frame'), 'index')
                __content_139875089167952 = __quote(__content_139875089167952,
                                                    '\x00', '&#0;', None,
                                                    False)
                __token = 1767
                __content_139875089167952_1765 = _lookup_attr(
                    _lookup_attr(getitem('repeat'), 'frame'), 'index')
                __content_139875089167952_1765 = __quote(
                    __content_139875089167952_1765, '\x00', '&#0;', None,
                    False)
                __content_139875089167952 = ('%s%s%s%s%s' % (
                    '\n            ',
                    (__content_139875089167952 if
                     (__content_139875089167952 is not None) else ''),
                    ': return ',
                    (__content_139875089167952_1765 if
                     (__content_139875089167952_1765 is not None) else ''),
                    ';\n        ',
                ))
                if (__content_139875089167952 is None):
                    pass
                else:
                    if (__content_139875089167952 is False):
                        __content_139875089167952 = None
                    else:
                        __tt = type(__content_139875089167952)
                        if ((__tt is int) or (__tt is float) or (__tt is int)):
                            __content_139875089167952 = str(
                                __content_139875089167952)
                        else:
                            if (__tt is bytes):
                                __content_139875089167952 = decode(
                                    __content_139875089167952)
                            else:
                                if (__tt is not str):
                                    try:
                                        __content_139875089167952 = __content_139875089167952.__html__
                                    except get('AttributeError',
                                               AttributeError):
                                        __converted = convert(
                                            __content_139875089167952)
                                        __content_139875089167952 = (
                                            str(__content_139875089167952) if
                                            (__content_139875089167952 is
                                             __converted) else __converted)
                                    else:
                                        __content_139875089167952 = __content_139875089167952(
                                        )
                if (__content_139875089167952 is not None):
                    __append(__content_139875089167952)
                ____index_139875070087632 -= 1
                if (____index_139875070087632 > 0):
                    __append('')
            if (__backup_frame_139875068663400 is __marker):
                del econtext['frame']
            else:
                econtext['frame'] = __backup_frame_139875068663400
            __append('\n        return CB_RESULT_NEXT_FRAME;\n    }\n')
        except:
            if (__token is not None):
                rcontext.setdefault('__error__', []).append(
                    (__tokens[__token] + (
                        __filename,
                        _exc_info()[1],
                    )))
            raise
コード例 #9
0
    def render(__stream,
               econtext,
               rcontext,
               __i18n_domain=None,
               __i18n_context=None):
        __append = __stream.append
        __re_amp = g_re_amp
        __token = None
        __re_needs_escape = g_re_needs_escape

        def __convert(target):
            if (target is None):
                return
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except AttributeError:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            target = target()
            return target

        def __quote(target, quote, quote_entity, default, default_marker):
            if (target is None):
                return
            if (target is default_marker):
                return default
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            return target()
                if (target is not None):
                    try:
                        escape = (__re_needs_escape(target) is not None)
                    except TypeError:
                        pass
                    else:
                        if escape:
                            if ('&' in target):
                                target = target.replace('&', '&amp;')
                            if ('<' in target):
                                target = target.replace('<', '&lt;')
                            if ('>' in target):
                                target = target.replace('>', '&gt;')
                            if ((quote is not None) and (quote in target)):
                                target = target.replace(quote, quote_entity)
            return target

        translate = econtext['__translate']
        decode = econtext['__decode']
        convert = econtext['__convert']
        on_error_handler = econtext['__on_error_handler']
        try:
            getitem = econtext.__getitem__
            get = econtext.get
            __append(
                '/* ******************************************************************\n * Definition of the industry tile, its callbacks, and graphics chain\n * ******************************************************************/\n\n'
            )
            __backup_macroname_139875068097608 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f3733d99550> name=None at 7f3733d99d30> -> __value
            __value = _static_139875069826384
            econtext['macroname'] = __value

            # <Value 'load: spritesets.pynml' (5:30)> -> __macro
            __token = 242
            __macro = ' spritesets.pynml'
            __macro = __loader(__macro)
            __token = 242
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_139875068097608 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_139875068097608
            __append('\n\n')
            __backup_macroname_139875067950856 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f3733d99390> name=None at 7f3733d994a8> -> __value
            __value = _static_139875069825936
            econtext['macroname'] = __value

            # <Value 'load: spritelayouts.pynml' (7:30)> -> __macro
            __token = 300
            __macro = ' spritelayouts.pynml'
            __macro = __loader(__macro)
            __token = 300
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_139875067950856 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_139875067950856
            __append('\n\n')
            __backup_macroname_139875067950600 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f3733d99630> name=None at 7f3733d99940> -> __value
            __value = _static_139875069826608
            econtext['macroname'] = __value

            # <Value 'load: graphics_switches.pynml' (9:30)> -> __macro
            __token = 361
            __macro = ' graphics_switches.pynml'
            __macro = __loader(__macro)
            __token = 361
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_139875067950600 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_139875067950600
            __append('\n\n')
            __backup_location_checks_tile_139875070224368 = get(
                'location_checks_tile', __marker)

            # <Value 'load: location_check_macros_tile.pynml' (11:42)> -> __value
            __token = 438
            __value = ' location_check_macros_tile.pynml'
            __value = __loader(__value)
            econtext['location_checks_tile'] = __value
            __backup_macroname_139875068126152 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f3733d99c18> name=None at 7f3733d99198> -> __value
            __value = _static_139875069828120
            econtext['macroname'] = __value

            # <Value "location_checks_tile.macros['render_tree']" (12:30)> -> __macro
            __token = 508
            __macro = _lookup_attr(getitem('location_checks_tile'),
                                   'macros')['render_tree']
            __token = 508
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_139875068126152 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_139875068126152
            if (__backup_location_checks_tile_139875070224368 is __marker):
                del econtext['location_checks_tile']
            else:
                econtext[
                    'location_checks_tile'] = __backup_location_checks_tile_139875070224368
            __append('\n\n')
            __backup_animation_macros_139875068920944 = get(
                'animation_macros', __marker)

            # <Value 'load: animation_macros.pynml' (14:38)> -> __value
            __token = 594
            __value = ' animation_macros.pynml'
            __value = __loader(__value)
            econtext['animation_macros'] = __value
            __backup_macroname_139875068126792 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f3733d99160> name=None at 7f3733d990b8> -> __value
            __value = _static_139875069825376
            econtext['macroname'] = __value

            # <Value "animation_macros.macros['tile_animation']" (15:30)> -> __macro
            __token = 654
            __macro = _lookup_attr(getitem('animation_macros'),
                                   'macros')['tile_animation']
            __token = 654
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_139875068126792 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_139875068126792
            if (__backup_animation_macros_139875068920944 is __marker):
                del econtext['animation_macros']
            else:
                econtext[
                    'animation_macros'] = __backup_animation_macros_139875068920944
            __append('\n\n')
            __backup_macroname_139875068159944 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f3733d99dd8> name=None at 7f3733d99128> -> __value
            __value = _static_139875069828568
            econtext['macroname'] = __value

            # <Value 'load: properties_tile.pynml' (17:30)> -> __macro
            __token = 731
            __macro = ' properties_tile.pynml'
            __macro = __loader(__macro)
            __token = 731
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_139875068159944 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_139875068159944
            __append(
                '\n\n\n/* *************************************************\n * Definition of the industry\n * *************************************************/\n\n'
            )
            __backup_macroname_139875068122184 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f3733cc1390> name=None at 7f3733cc19b0> -> __value
            __value = _static_139875068941200
            econtext['macroname'] = __value

            # <Value 'load: layouts.pynml' (24:30)> -> __macro
            __token = 933
            __macro = ' layouts.pynml'
            __macro = __loader(__macro)
            __token = 933
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_139875068122184 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_139875068122184
            __append('\n\n')
            __backup_macroname_139875068113928 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f3733cc1b38> name=None at 7f3733cc1128> -> __value
            __value = _static_139875068943160
            econtext['macroname'] = __value

            # <Value 'load: availability.pynml' (26:30)> -> __macro
            __token = 988
            __macro = ' availability.pynml'
            __macro = __loader(__macro)
            __token = 988
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_139875068113928 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_139875068113928
            __append('\n\n')
            __backup_location_checks_industry_139875070396232 = get(
                'location_checks_industry', __marker)

            # <Value 'load: location_check_macros_industry.pynml' (28:46)> -> __value
            __token = 1064
            __value = ' location_check_macros_industry.pynml'
            __value = __loader(__value)
            econtext['location_checks_industry'] = __value
            __backup_macroname_139875068099976 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f3733cc1da0> name=None at 7f3733cc1b00> -> __value
            __value = _static_139875068943776
            econtext['macroname'] = __value

            # <Value "location_checks_industry.macros['render_tree']" (29:30)> -> __macro
            __token = 1138
            __macro = _lookup_attr(getitem('location_checks_industry'),
                                   'macros')['render_tree']
            __token = 1138
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_139875068099976 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_139875068099976
            if (__backup_location_checks_industry_139875070396232 is __marker):
                del econtext['location_checks_industry']
            else:
                econtext[
                    'location_checks_industry'] = __backup_location_checks_industry_139875070396232
            __append('\n\n')
            __backup_macroname_139875068985288 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f3733c6ca90> name=None at 7f3733c6c4e0> -> __value
            __value = _static_139875068594832
            econtext['macroname'] = __value

            # <Value 'load: properties_industry.pynml' (31:30)> -> __macro
            __token = 1220
            __macro = ' properties_industry.pynml'
            __macro = __loader(__macro)
            __token = 1220
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_139875068985288 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_139875068985288
            __append('\n\n')
            __append('\n')
            __backup_economy_139875070223976 = get('economy', __marker)

            # <Value 'economies' (34:37)> -> __iterator
            __token = 1404
            __iterator = getitem('economies')
            (
                __iterator,
                ____index_139875068594104,
            ) = getitem('repeat')('economy', __iterator)
            econtext['economy'] = None
            for __item in __iterator:
                econtext['economy'] = __item
                __append('\n    ')

                # <Value "industry.get_property('enabled', economy) == True" (35:39)> -> __condition
                __token = 1455
                __condition = (_lookup_attr(
                    getitem('industry'),
                    'get_property')('enabled', getitem('economy')) == True)
                if __condition:

                    # <Interpolation value=<Substitution '\n        if (economy==${economy.numeric_id}) {\n            item(FEAT_INDUSTRIES, ${industry.id}, ${industry.numeric_id}) {\n                graphics {\n                    construction_probability: ${industry.id}_check_availability;\n                    build_prod_change:        randomise_primary_production_on_build;\n                    location_check:           ${industry.id}_check_location;\n                    extra_text_fund:          ${industry.get_extra_text_fund(economy)};\n                    colour:                   switch_colour;\n                }\n            }\n        }\n    ' (35:90)> braces_required=True translation=False at 7f3733c6c400> -> __content_139875089167952
                    __token = 1515
                    __token = 1530
                    __content_139875089167952 = _lookup_attr(
                        getitem('economy'), 'numeric_id')
                    __content_139875089167952 = __quote(
                        __content_139875089167952, '\x00', '&#0;', None, False)
                    __token = 1589
                    __content_139875089167952_1587 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_139875089167952_1587 = __quote(
                        __content_139875089167952_1587, '\x00', '&#0;', None,
                        False)
                    __token = 1605
                    __content_139875089167952_1603 = _lookup_attr(
                        getitem('industry'), 'numeric_id')
                    __content_139875089167952_1603 = __quote(
                        __content_139875089167952_1603, '\x00', '&#0;', None,
                        False)
                    __token = 1704
                    __content_139875089167952_1702 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_139875089167952_1702 = __quote(
                        __content_139875089167952_1702, '\x00', '&#0;', None,
                        False)
                    __token = 1870
                    __content_139875089167952_1868 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_139875089167952_1868 = __quote(
                        __content_139875089167952_1868, '\x00', '&#0;', None,
                        False)
                    __token = 1947
                    __content_139875089167952_1945 = _lookup_attr(
                        getitem('industry'),
                        'get_extra_text_fund')(getitem('economy'))
                    __content_139875089167952_1945 = __quote(
                        __content_139875089167952_1945, '\x00', '&#0;', None,
                        False)
                    __content_139875089167952 = ('%s%s%s%s%s%s%s%s%s%s%s%s%s' % (
                        '\n        if (economy==',
                        (__content_139875089167952 if
                         (__content_139875089167952 is not None) else ''),
                        ') {\n            item(FEAT_INDUSTRIES, ',
                        (__content_139875089167952_1587 if
                         (__content_139875089167952_1587 is not None) else ''),
                        ', ',
                        (__content_139875089167952_1603 if
                         (__content_139875089167952_1603 is not None) else ''),
                        ') {\n                graphics {\n                    construction_probability: ',
                        (__content_139875089167952_1702 if
                         (__content_139875089167952_1702 is not None) else ''),
                        '_check_availability;\n                    build_prod_change:        randomise_primary_production_on_build;\n                    location_check:           ',
                        (__content_139875089167952_1868 if
                         (__content_139875089167952_1868 is not None) else ''),
                        '_check_location;\n                    extra_text_fund:          ',
                        (__content_139875089167952_1945 if
                         (__content_139875089167952_1945 is not None) else ''),
                        ';\n                    colour:                   switch_colour;\n                }\n            }\n        }\n    ',
                    ))
                    if (__content_139875089167952 is None):
                        pass
                    else:
                        if (__content_139875089167952 is False):
                            __content_139875089167952 = None
                        else:
                            __tt = type(__content_139875089167952)
                            if ((__tt is int) or (__tt is float)
                                    or (__tt is int)):
                                __content_139875089167952 = str(
                                    __content_139875089167952)
                            else:
                                if (__tt is bytes):
                                    __content_139875089167952 = decode(
                                        __content_139875089167952)
                                else:
                                    if (__tt is not str):
                                        try:
                                            __content_139875089167952 = __content_139875089167952.__html__
                                        except get('AttributeError',
                                                   AttributeError):
                                            __converted = convert(
                                                __content_139875089167952)
                                            __content_139875089167952 = (
                                                str(__content_139875089167952)
                                                if
                                                (__content_139875089167952 is
                                                 __converted) else __converted)
                                        else:
                                            __content_139875089167952 = __content_139875089167952(
                                            )
                    if (__content_139875089167952 is not None):
                        __append(__content_139875089167952)
                __append('\n')
                ____index_139875068594104 -= 1
                if (____index_139875068594104 > 0):
                    __append('')
            if (__backup_economy_139875070223976 is __marker):
                del econtext['economy']
            else:
                econtext['economy'] = __backup_economy_139875070223976
            __append('\n')
        except:
            if (__token is not None):
                rcontext.setdefault('__error__', []).append(
                    (__tokens[__token] + (
                        __filename,
                        _exc_info()[1],
                    )))
            raise
コード例 #10
0
    def render(__stream,
               econtext,
               rcontext,
               __i18n_domain=None,
               __i18n_context=None):
        __append = __stream.append
        __re_amp = g_re_amp
        __token = None
        __re_needs_escape = g_re_needs_escape

        def __convert(target):
            if (target is None):
                return
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except AttributeError:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            target = target()
            return target

        def __quote(target, quote, quote_entity, default, default_marker):
            if (target is None):
                return
            if (target is default_marker):
                return default
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            return target()
                if (target is not None):
                    try:
                        escape = (__re_needs_escape(target) is not None)
                    except TypeError:
                        pass
                    else:
                        if escape:
                            if ('&' in target):
                                target = target.replace('&', '&amp;')
                            if ('<' in target):
                                target = target.replace('<', '&lt;')
                            if ('>' in target):
                                target = target.replace('>', '&gt;')
                            if ((quote is not None) and (quote in target)):
                                target = target.replace(quote, quote_entity)
            return target

        translate = econtext['__translate']
        decode = econtext['__decode']
        convert = econtext['__convert']
        on_error_handler = econtext['__on_error_handler']
        try:
            getitem = econtext.__getitem__
            get = econtext.get
            __append(
                '// parameters also referenced by action 14 stuff - likely to be found in header.pynml, unless it got moved\n\n// map_size is total number of tiles on the map\n// compute relative size of the map, compared to 256*256\nrelative_map_size = map_size / (256 * 256);\n// number of industry closures is proportional to map size (maps '
            )
            __append('<')
            __append(
                "= 256x256 will have 1 cluster)\nindustry_clusters = (relative_map_size / 2) + 1;\n\nparam_max_coastal_distance = marine_industry_max_coastal_distance;\nif (marine_industry_max_coastal_distance == 0) {\n\tparam_max_coastal_distance = 255;\n}\n\n// I want to specify the order of the economies in parameter menu without worrying about breaking savegames etc\n// but action 14 can't separate parameter value and position in menu for economies\n// so here we remap selected economy to actual numeric value\n// !! having tested, this doesn't actually prevent savegame breaking\n// !! as the selected value in the action 14 UI remains constant (thereby changing which economy is active)\n// !! there is zero chance of it being worthwhile to write a migration for existing savegames\n// !! therefore rethink this - whether it's worthwhile, or whether to just reset economy order every time when adding new economies\n"
            )
            __backup_economy_140183257339776 = get('economy', __marker)

            # <Value 'economies' (21:35)> -> __iterator
            __token = 1252
            __iterator = getitem('economies')
            (
                __iterator,
                ____index_140183231303632,
            ) = getitem('repeat')('economy', __iterator)
            econtext['economy'] = None
            for __item in __iterator:
                econtext['economy'] = __item

                # <Interpolation value=<Substitution '\n    if (economy_selection == ${repeat.economy.index}) {\n        economy = ${economy.numeric_id};\n    }\n' (21:46)> braces_required=True translation=False at 7f7ef3b48f98> -> __content_140183249773656
                __token = 1268
                __token = 1295
                __content_140183249773656 = _lookup_attr(
                    _lookup_attr(getitem('repeat'), 'economy'), 'index')
                __content_140183249773656 = __quote(__content_140183249773656,
                                                    '\x00', '&#0;', None,
                                                    False)
                __token = 1340
                __content_140183249773656_1338 = _lookup_attr(
                    getitem('economy'), 'numeric_id')
                __content_140183249773656_1338 = __quote(
                    __content_140183249773656_1338, '\x00', '&#0;', None,
                    False)
                __content_140183249773656 = ('%s%s%s%s%s' % (
                    '\n    if (economy_selection == ',
                    (__content_140183249773656 if
                     (__content_140183249773656 is not None) else ''),
                    ') {\n        economy = ',
                    (__content_140183249773656_1338 if
                     (__content_140183249773656_1338 is not None) else ''),
                    ';\n    }\n',
                ))
                if (__content_140183249773656 is None):
                    pass
                else:
                    if (__content_140183249773656 is False):
                        __content_140183249773656 = None
                    else:
                        __tt = type(__content_140183249773656)
                        if ((__tt is int) or (__tt is float) or (__tt is int)):
                            __content_140183249773656 = str(
                                __content_140183249773656)
                        else:
                            if (__tt is bytes):
                                __content_140183249773656 = decode(
                                    __content_140183249773656)
                            else:
                                if (__tt is not str):
                                    try:
                                        __content_140183249773656 = __content_140183249773656.__html__
                                    except get('AttributeError',
                                               AttributeError):
                                        __converted = convert(
                                            __content_140183249773656)
                                        __content_140183249773656 = (
                                            str(__content_140183249773656) if
                                            (__content_140183249773656 is
                                             __converted) else __converted)
                                    else:
                                        __content_140183249773656 = __content_140183249773656(
                                        )
                if (__content_140183249773656 is not None):
                    __append(__content_140183249773656)
                ____index_140183231303632 -= 1
                if (____index_140183231303632 > 0):
                    __append('')
            if (__backup_economy_140183257339776 is __marker):
                del econtext['economy']
            else:
                econtext['economy'] = __backup_economy_140183257339776
            __append(
                '\n\n// production bonuses are expressed as absolute % of base production in parameters menu,\n// but we need them as bonus amounts, to be added on top of base production, so net off 100\nprimary_level1_bonus = primary_level1_produced_percent - 100;\nprimary_level2_bonus = primary_level2_produced_percent - 100;\n\n// the tree for the food market is a climate-dependent special case, re-using base set sprites\n// it has to be handled here as a parameter, no elegant way to include it in the industry\nmarket_tree = 1639;\nif (climate == CLIMATE_ARCTIC) { market_tree = 1737; }\nif (climate == CLIMATE_TROPICAL) { market_tree = 1891; }\nmarket_tree_snow = 1793;\n'
            )
        except:
            if (__token is not None):
                rcontext.setdefault('__error__', []).append(
                    (__tokens[__token] + (
                        __filename,
                        _exc_info()[1],
                    )))
            raise
コード例 #11
0
    def render(__stream,
               econtext,
               rcontext,
               __i18n_domain=None,
               __i18n_context=None):
        __append = __stream.append
        __re_amp = g_re_amp
        __token = None
        __re_needs_escape = g_re_needs_escape

        def __convert(target):
            if (target is None):
                return
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except AttributeError:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            target = target()
            return target

        def __quote(target, quote, quote_entity, default, default_marker):
            if (target is None):
                return
            if (target is default_marker):
                return default
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            return target()
                if (target is not None):
                    try:
                        escape = (__re_needs_escape(target) is not None)
                    except TypeError:
                        pass
                    else:
                        if escape:
                            if ('&' in target):
                                target = target.replace('&', '&amp;')
                            if ('<' in target):
                                target = target.replace('<', '&lt;')
                            if ('>' in target):
                                target = target.replace('>', '&gt;')
                            if ((quote is not None) and (quote in target)):
                                target = target.replace(quote, quote_entity)
            return target

        translate = econtext['__translate']
        decode = econtext['__decode']
        convert = econtext['__convert']
        try:
            getitem = econtext.__getitem__
            get = econtext.get
            __append(
                '/* ******************************************************************\n * Definition of the industry tile, its callbacks, and graphics chain\n * ******************************************************************/\n\n'
            )
            __backup_macroname_2075100620296 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x000001E3258B1438> name=None at 1e3258b1208> -> __value
            __value = _static_2075099075640
            econtext['macroname'] = __value

            # <Value 'load: spritesets.pynml' (5:30)> -> __macro
            __token = 242
            __macro = ' spritesets.pynml'
            __macro = __loader(__macro)
            __token = 242
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_2075100620296 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_2075100620296
            __append('\n\n')
            __backup_macroname_2075100620936 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x000001E3258B1F60> name=None at 1e3258b14a8> -> __value
            __value = _static_2075099078496
            econtext['macroname'] = __value

            # <Value 'load: spritelayouts.pynml' (7:30)> -> __macro
            __token = 300
            __macro = ' spritelayouts.pynml'
            __macro = __loader(__macro)
            __token = 300
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_2075100620936 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_2075100620936
            __append('\n\n')
            __backup_macroname_2075100619784 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x000001E3258B1630> name=None at 1e3258b1c88> -> __value
            __value = _static_2075099076144
            econtext['macroname'] = __value

            # <Value 'load: graphics_switches.pynml' (9:30)> -> __macro
            __token = 361
            __macro = ' graphics_switches.pynml'
            __macro = __loader(__macro)
            __token = 361
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_2075100619784 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_2075100619784
            __append('\n\n')
            __backup_location_checks_tile_2075101627056 = get(
                'location_checks_tile', __marker)

            # <Value 'load: location_check_macros_tile.pynml' (11:42)> -> __value
            __token = 438
            __value = ' location_check_macros_tile.pynml'
            __value = __loader(__value)
            econtext['location_checks_tile'] = __value
            __backup_macroname_2075100621512 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x000001E3258B1828> name=None at 1e3258b1908> -> __value
            __value = _static_2075099076648
            econtext['macroname'] = __value

            # <Value "location_checks_tile.macros['render_tree']" (12:30)> -> __macro
            __token = 508
            __macro = _lookup_attr(getitem('location_checks_tile'),
                                   'macros')['render_tree']
            __token = 508
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_2075100621512 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_2075100621512
            if (__backup_location_checks_tile_2075101627056 is __marker):
                del econtext['location_checks_tile']
            else:
                econtext[
                    'location_checks_tile'] = __backup_location_checks_tile_2075101627056
            __append('\n\n')
            __backup_animation_macros_2075101627224 = get(
                'animation_macros', __marker)

            # <Value 'load: animation_macros.pynml' (14:38)> -> __value
            __token = 594
            __value = ' animation_macros.pynml'
            __value = __loader(__value)
            econtext['animation_macros'] = __value
            __backup_macroname_2075100622472 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x000001E3258B1FD0> name=None at 1e3258b17f0> -> __value
            __value = _static_2075099078608
            econtext['macroname'] = __value

            # <Value "animation_macros.macros['tile_animation']" (15:30)> -> __macro
            __token = 654
            __macro = _lookup_attr(getitem('animation_macros'),
                                   'macros')['tile_animation']
            __token = 654
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_2075100622472 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_2075100622472
            if (__backup_animation_macros_2075101627224 is __marker):
                del econtext['animation_macros']
            else:
                econtext[
                    'animation_macros'] = __backup_animation_macros_2075101627224
            __append('\n\n')
            __backup_macroname_2075100620488 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x000001E3258B1240> name=None at 1e3258b17b8> -> __value
            __value = _static_2075099075136
            econtext['macroname'] = __value

            # <Value 'load: properties_tile.pynml' (17:30)> -> __macro
            __token = 731
            __macro = ' properties_tile.pynml'
            __macro = __loader(__macro)
            __token = 731
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_2075100620488 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_2075100620488
            __append(
                '\n\n\n/* *************************************************\n * Definition of the industry\n * *************************************************/\n\n'
            )
            __backup_macroname_2075100619976 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x000001E3258B13C8> name=None at 1e3258b1f98> -> __value
            __value = _static_2075099075528
            econtext['macroname'] = __value

            # <Value 'load: layouts.pynml' (24:30)> -> __macro
            __token = 933
            __macro = ' layouts.pynml'
            __macro = __loader(__macro)
            __token = 933
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_2075100619976 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_2075100619976
            __append('\n\n')
            __backup_macroname_2075100618952 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x000001E325AA5F98> name=None at 1e325aa5c88> -> __value
            __value = _static_2075101126552
            econtext['macroname'] = __value

            # <Value 'load: extra_text_primary.pynml' (26:30)> -> __macro
            __token = 988
            __macro = ' extra_text_primary.pynml'
            __macro = __loader(__macro)
            __token = 988
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_2075100618952 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_2075100618952
            __append('\n\n')
            __backup_macroname_2075099218696 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x000001E325AA5A58> name=None at 1e325aa57f0> -> __value
            __value = _static_2075101125208
            econtext['macroname'] = __value

            # <Value 'load: produce_primary.pynml' (28:30)> -> __macro
            __token = 1054
            __macro = ' produce_primary.pynml'
            __macro = __loader(__macro)
            __token = 1054
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_2075099218696 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_2075099218696
            __append('\n\n')
            __backup_macroname_2075099218568 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x000001E325AA5D30> name=None at 1e325aa5630> -> __value
            __value = _static_2075101125936
            econtext['macroname'] = __value

            # <Value 'load: check_primary_supplies_delivered.pynml' (30:30)> -> __macro
            __token = 1117
            __macro = ' check_primary_supplies_delivered.pynml'
            __macro = __loader(__macro)
            __token = 1117
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_2075099218568 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_2075099218568
            __append('\n\n')
            __backup_macroname_2075101990408 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x000001E325AA5C50> name=None at 1e325aa5d68> -> __value
            __value = _static_2075101125712
            econtext['macroname'] = __value

            # <Value 'load: availability.pynml' (32:30)> -> __macro
            __token = 1197
            __macro = ' availability.pynml'
            __macro = __loader(__macro)
            __token = 1197
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_2075101990408 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_2075101990408
            __append('\n\n')
            __backup_location_checks_industry_2075101629968 = get(
                'location_checks_industry', __marker)

            # <Value 'load: location_check_macros_industry.pynml' (34:46)> -> __value
            __token = 1273
            __value = ' location_check_macros_industry.pynml'
            __value = __loader(__value)
            econtext['location_checks_industry'] = __value
            __backup_macroname_2075099490312 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x000001E325AA5B38> name=None at 1e325aa5b00> -> __value
            __value = _static_2075101125432
            econtext['macroname'] = __value

            # <Value "location_checks_industry.macros['render_tree']" (35:30)> -> __macro
            __token = 1347
            __macro = _lookup_attr(getitem('location_checks_industry'),
                                   'macros')['render_tree']
            __token = 1347
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_2075099490312 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_2075099490312
            if (__backup_location_checks_industry_2075101629968 is __marker):
                del econtext['location_checks_industry']
            else:
                econtext[
                    'location_checks_industry'] = __backup_location_checks_industry_2075101629968
            __append('\n\n')
            __backup_macroname_2075100054984 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x000001E325AA5860> name=None at 1e325aa5b70> -> __value
            __value = _static_2075101124704
            econtext['macroname'] = __value

            # <Value 'load: properties_industry.pynml' (37:30)> -> __macro
            __token = 1429
            __macro = ' properties_industry.pynml'
            __macro = __loader(__macro)
            __token = 1429
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_2075100054984 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_2075100054984
            __append('\n\n')
            __append('\n')
            __backup_economy_2075101630024 = get('economy', __marker)

            # <Value 'economies' (40:37)> -> __iterator
            __token = 1613
            __iterator = getitem('economies')
            (
                __iterator,
                ____index_2075101124984,
            ) = getitem('repeat')('economy', __iterator)
            econtext['economy'] = None
            for __item in __iterator:
                econtext['economy'] = __item
                __append('\n    ')

                # <Value "industry.get_property('enabled', economy) == True" (41:39)> -> __condition
                __token = 1664
                __condition = (_lookup_attr(
                    getitem('industry'),
                    'get_property')('enabled', getitem('economy')) == True)
                if __condition:

                    # <Interpolation value=<Substitution '\n        if (economy==${economy.numeric_id}) {\n            item(FEAT_INDUSTRIES, ${industry.id}, ${industry.numeric_id}) {\n                graphics {\n                    construction_probability: ${industry.id}_check_availability;\n                    build_prod_change:        randomise_primary_production_on_build;\n                    produce_cargo_arrival:    ${industry.id}_produce;\n                    produce_256_ticks:        ${industry.id}_produce_256_ticks;\n                    monthly_prod_change:      ${industry.id}_monthly_update;\n                    random_prod_change:       return CB_RESULT_IND_PROD_NO_CHANGE;\n                    location_check:           ${industry.id}_check_location;\n                    extra_text_fund:          ${industry.get_extra_text_fund(economy)};\n                    extra_text_industry:      ${industry.id}_extra_text;\n                    cargo_subtype_display:    ${industry.id}_cargo_subtype_display;\n                    colour:                   switch_colour;\n                }\n            }\n        }\n    ' (41:90)> braces_required=True translation=False at 1e3258e70f0> -> __content_2075086945112
                    __token = 1724
                    __token = 1739
                    __content_2075086945112 = _lookup_attr(
                        getitem('economy'), 'numeric_id')
                    __content_2075086945112 = __quote(__content_2075086945112,
                                                      '\x00', '&#0;', None,
                                                      False)
                    __token = 1798
                    __content_2075086945112_1796 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_2075086945112_1796 = __quote(
                        __content_2075086945112_1796, '\x00', '&#0;', None,
                        False)
                    __token = 1814
                    __content_2075086945112_1812 = _lookup_attr(
                        getitem('industry'), 'numeric_id')
                    __content_2075086945112_1812 = __quote(
                        __content_2075086945112_1812, '\x00', '&#0;', None,
                        False)
                    __token = 1913
                    __content_2075086945112_1911 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_2075086945112_1911 = __quote(
                        __content_2075086945112_1911, '\x00', '&#0;', None,
                        False)
                    __token = 2079
                    __content_2075086945112_2077 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_2075086945112_2077 = __quote(
                        __content_2075086945112_2077, '\x00', '&#0;', None,
                        False)
                    __token = 2149
                    __content_2075086945112_2147 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_2075086945112_2147 = __quote(
                        __content_2075086945112_2147, '\x00', '&#0;', None,
                        False)
                    __token = 2229
                    __content_2075086945112_2227 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_2075086945112_2227 = __quote(
                        __content_2075086945112_2227, '\x00', '&#0;', None,
                        False)
                    __token = 2389
                    __content_2075086945112_2387 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_2075086945112_2387 = __quote(
                        __content_2075086945112_2387, '\x00', '&#0;', None,
                        False)
                    __token = 2466
                    __content_2075086945112_2464 = _lookup_attr(
                        getitem('industry'),
                        'get_extra_text_fund')(getitem('economy'))
                    __content_2075086945112_2464 = __quote(
                        __content_2075086945112_2464, '\x00', '&#0;', None,
                        False)
                    __token = 2554
                    __content_2075086945112_2552 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_2075086945112_2552 = __quote(
                        __content_2075086945112_2552, '\x00', '&#0;', None,
                        False)
                    __token = 2627
                    __content_2075086945112_2625 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_2075086945112_2625 = __quote(
                        __content_2075086945112_2625, '\x00', '&#0;', None,
                        False)
                    __content_2075086945112 = ('%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s' % (
                        '\n        if (economy==',
                        (__content_2075086945112 if
                         (__content_2075086945112 is not None) else ''),
                        ') {\n            item(FEAT_INDUSTRIES, ',
                        (__content_2075086945112_1796 if
                         (__content_2075086945112_1796 is not None) else ''),
                        ', ',
                        (__content_2075086945112_1812 if
                         (__content_2075086945112_1812 is not None) else ''),
                        ') {\n                graphics {\n                    construction_probability: ',
                        (__content_2075086945112_1911 if
                         (__content_2075086945112_1911 is not None) else ''),
                        '_check_availability;\n                    build_prod_change:        randomise_primary_production_on_build;\n                    produce_cargo_arrival:    ',
                        (__content_2075086945112_2077 if
                         (__content_2075086945112_2077 is not None) else ''),
                        '_produce;\n                    produce_256_ticks:        ',
                        (__content_2075086945112_2147 if
                         (__content_2075086945112_2147 is not None) else ''),
                        '_produce_256_ticks;\n                    monthly_prod_change:      ',
                        (__content_2075086945112_2227 if
                         (__content_2075086945112_2227 is not None) else ''),
                        '_monthly_update;\n                    random_prod_change:       return CB_RESULT_IND_PROD_NO_CHANGE;\n                    location_check:           ',
                        (__content_2075086945112_2387 if
                         (__content_2075086945112_2387 is not None) else ''),
                        '_check_location;\n                    extra_text_fund:          ',
                        (__content_2075086945112_2464 if
                         (__content_2075086945112_2464 is not None) else ''),
                        ';\n                    extra_text_industry:      ',
                        (__content_2075086945112_2552 if
                         (__content_2075086945112_2552 is not None) else ''),
                        '_extra_text;\n                    cargo_subtype_display:    ',
                        (__content_2075086945112_2625 if
                         (__content_2075086945112_2625 is not None) else ''),
                        '_cargo_subtype_display;\n                    colour:                   switch_colour;\n                }\n            }\n        }\n    ',
                    ))
                    if (__content_2075086945112 is None):
                        pass
                    else:
                        if (__content_2075086945112 is False):
                            __content_2075086945112 = None
                        else:
                            __tt = type(__content_2075086945112)
                            if ((__tt is int) or (__tt is float)
                                    or (__tt is int)):
                                __content_2075086945112 = str(
                                    __content_2075086945112)
                            else:
                                if (__tt is bytes):
                                    __content_2075086945112 = decode(
                                        __content_2075086945112)
                                else:
                                    if (__tt is not str):
                                        try:
                                            __content_2075086945112 = __content_2075086945112.__html__
                                        except get('AttributeError',
                                                   AttributeError):
                                            __converted = convert(
                                                __content_2075086945112)
                                            __content_2075086945112 = (
                                                str(__content_2075086945112) if
                                                (__content_2075086945112 is
                                                 __converted) else __converted)
                                        else:
                                            __content_2075086945112 = __content_2075086945112(
                                            )
                    if (__content_2075086945112 is not None):
                        __append(__content_2075086945112)
                __append('\n')
                ____index_2075101124984 -= 1
                if (____index_2075101124984 > 0):
                    __append('')
            if (__backup_economy_2075101630024 is __marker):
                del econtext['economy']
            else:
                econtext['economy'] = __backup_economy_2075101630024
            __append('\n')
        except:
            if (__token is not None):
                rcontext.setdefault('__error__', []).append(
                    (__tokens[__token] + (
                        __filename,
                        _exc_info()[1],
                    )))
            raise
コード例 #12
0
    def render(__stream,
               econtext,
               rcontext,
               __i18n_domain=None,
               __i18n_context=None):
        __append = __stream.append
        __re_amp = g_re_amp
        __token = None
        __re_needs_escape = g_re_needs_escape

        def __convert(target):
            if (target is None):
                return
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except AttributeError:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            target = target()
            return target

        def __quote(target, quote, quote_entity, default, default_marker):
            if (target is None):
                return
            if (target is default_marker):
                return default
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            return target()
                if (target is not None):
                    try:
                        escape = (__re_needs_escape(target) is not None)
                    except TypeError:
                        pass
                    else:
                        if escape:
                            if ('&' in target):
                                target = target.replace('&', '&amp;')
                            if ('<' in target):
                                target = target.replace('<', '&lt;')
                            if ('>' in target):
                                target = target.replace('>', '&gt;')
                            if ((quote is not None) and (quote in target)):
                                target = target.replace(quote, quote_entity)
            return target

        translate = econtext['__translate']
        decode = econtext['__decode']
        convert = econtext['__convert']
        on_error_handler = econtext['__on_error_handler']
        try:
            getitem = econtext.__getitem__
            get = econtext.get
            __append(
                '/* ******************************************************************\n * Definition of the industry tile, its callbacks, and graphics chain\n * ******************************************************************/\n\n'
            )
            __backup_macroname_139703105800840 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f0f29e54fd0> name=None at 7f0f29e54908> -> __value
            __value = _static_139703104131024
            econtext['macroname'] = __value

            # <Value 'load: spritesets.pynml' (5:30)> -> __macro
            __token = 242
            __macro = ' spritesets.pynml'
            __macro = __loader(__macro)
            __token = 242
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_139703105800840 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_139703105800840
            __append('\n\n')
            __backup_macroname_139703105799496 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f0f29e542b0> name=None at 7f0f29e54be0> -> __value
            __value = _static_139703104127664
            econtext['macroname'] = __value

            # <Value 'load: spritelayouts.pynml' (7:30)> -> __macro
            __token = 300
            __macro = ' spritelayouts.pynml'
            __macro = __loader(__macro)
            __token = 300
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_139703105799496 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_139703105799496
            __append('\n\n')
            __backup_macroname_139703103531656 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f0f29e54c18> name=None at 7f0f29e546a0> -> __value
            __value = _static_139703104130072
            econtext['macroname'] = __value

            # <Value 'load: graphics_switches.pynml' (9:30)> -> __macro
            __token = 361
            __macro = ' graphics_switches.pynml'
            __macro = __loader(__macro)
            __token = 361
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_139703103531656 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_139703103531656
            __append('\n\n')
            __backup_location_checks_tile_139703104331672 = get(
                'location_checks_tile', __marker)

            # <Value 'load: location_check_macros_tile.pynml' (11:42)> -> __value
            __token = 438
            __value = ' location_check_macros_tile.pynml'
            __value = __loader(__value)
            econtext['location_checks_tile'] = __value
            __backup_macroname_139703104289160 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f0f29e544a8> name=None at 7f0f29e54160> -> __value
            __value = _static_139703104128168
            econtext['macroname'] = __value

            # <Value "location_checks_tile.macros['render_tree']" (12:30)> -> __macro
            __token = 508
            __macro = _lookup_attr(getitem('location_checks_tile'),
                                   'macros')['render_tree']
            __token = 508
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_139703104289160 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_139703104289160
            if (__backup_location_checks_tile_139703104331672 is __marker):
                del econtext['location_checks_tile']
            else:
                econtext[
                    'location_checks_tile'] = __backup_location_checks_tile_139703104331672
            __append('\n\n')
            __backup_animation_macros_139703103358120 = get(
                'animation_macros', __marker)

            # <Value 'load: animation_macros.pynml' (14:38)> -> __value
            __token = 594
            __value = ' animation_macros.pynml'
            __value = __loader(__value)
            econtext['animation_macros'] = __value
            __backup_macroname_139703105801288 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f0f29e54940> name=None at 7f0f29e54550> -> __value
            __value = _static_139703104129344
            econtext['macroname'] = __value

            # <Value "animation_macros.macros['tile_animation']" (15:30)> -> __macro
            __token = 654
            __macro = _lookup_attr(getitem('animation_macros'),
                                   'macros')['tile_animation']
            __token = 654
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_139703105801288 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_139703105801288
            if (__backup_animation_macros_139703103358120 is __marker):
                del econtext['animation_macros']
            else:
                econtext[
                    'animation_macros'] = __backup_animation_macros_139703103358120
            __append('\n\n')
            __backup_macroname_139703104289032 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f0f29e54eb8> name=None at 7f0f29e54278> -> __value
            __value = _static_139703104130744
            econtext['macroname'] = __value

            # <Value 'load: properties_tile.pynml' (17:30)> -> __macro
            __token = 731
            __macro = ' properties_tile.pynml'
            __macro = __loader(__macro)
            __token = 731
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_139703104289032 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_139703104289032
            __append(
                '\n\n\n/* *************************************************\n * Definition of the industry\n * *************************************************/\n\n'
            )
            __backup_macroname_139703104288520 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f0f29e137b8> name=None at 7f0f29e13e10> -> __value
            __value = _static_139703103862712
            econtext['macroname'] = __value

            # <Value 'load: layouts.pynml' (24:30)> -> __macro
            __token = 933
            __macro = ' layouts.pynml'
            __macro = __loader(__macro)
            __token = 933
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_139703104288520 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_139703104288520
            __append('\n\n')
            __backup_macroname_139703103304328 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f0f29e13748> name=None at 7f0f29e13668> -> __value
            __value = _static_139703103862600
            econtext['macroname'] = __value

            # <Value 'load: availability.pynml' (26:30)> -> __macro
            __token = 988
            __macro = ' availability.pynml'
            __macro = __loader(__macro)
            __token = 988
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_139703103304328 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_139703103304328
            __append('\n\n')
            __backup_location_checks_industry_139703105755904 = get(
                'location_checks_industry', __marker)

            # <Value 'load: location_check_macros_industry.pynml' (28:46)> -> __value
            __token = 1064
            __value = ' location_check_macros_industry.pynml'
            __value = __loader(__value)
            econtext['location_checks_industry'] = __value
            __backup_macroname_139703104287432 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f0f29e13be0> name=None at 7f0f29e13358> -> __value
            __value = _static_139703103863776
            econtext['macroname'] = __value

            # <Value "location_checks_industry.macros['render_tree']" (29:30)> -> __macro
            __token = 1138
            __macro = _lookup_attr(getitem('location_checks_industry'),
                                   'macros')['render_tree']
            __token = 1138
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_139703104287432 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_139703104287432
            if (__backup_location_checks_industry_139703105755904 is __marker):
                del econtext['location_checks_industry']
            else:
                econtext[
                    'location_checks_industry'] = __backup_location_checks_industry_139703105755904
            __append('\n\n')
            __backup_macroname_139703103305096 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f0f29e13eb8> name=None at 7f0f29e13080> -> __value
            __value = _static_139703103864504
            econtext['macroname'] = __value

            # <Value 'load: properties_industry.pynml' (31:30)> -> __macro
            __token = 1220
            __macro = ' properties_industry.pynml'
            __macro = __loader(__macro)
            __token = 1220
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_139703103305096 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_139703103305096
            __append('\n\n')
            __append('\n')
            __backup_economy_139703105755232 = get('economy', __marker)

            # <Value 'economies' (34:37)> -> __iterator
            __token = 1404
            __iterator = getitem('economies')
            (
                __iterator,
                ____index_139703103864672,
            ) = getitem('repeat')('economy', __iterator)
            econtext['economy'] = None
            for __item in __iterator:
                econtext['economy'] = __item
                __append('\n    ')

                # <Value "industry.get_property('enabled', economy) == True" (35:39)> -> __condition
                __token = 1455
                __condition = (_lookup_attr(
                    getitem('industry'),
                    'get_property')('enabled', getitem('economy')) == True)
                if __condition:

                    # <Interpolation value=<Substitution '\n        if (economy==${economy.numeric_id}) {\n            item(FEAT_INDUSTRIES, ${industry.id}, ${industry.numeric_id}) {\n                graphics {\n                    construction_probability: ${industry.id}_check_availability;\n                    build_prod_change:        randomise_primary_production_on_build;\n                    location_check:           ${industry.id}_check_location;\n                    extra_text_fund:          ${industry.get_extra_text_fund(economy)};\n                    colour:                   switch_colour;\n                }\n            }\n        }\n    ' (35:90)> braces_required=True translation=False at 7f0f29e13d68> -> __content_139703124559104
                    __token = 1515
                    __token = 1530
                    __content_139703124559104 = _lookup_attr(
                        getitem('economy'), 'numeric_id')
                    __content_139703124559104 = __quote(
                        __content_139703124559104, '\x00', '&#0;', None, False)
                    __token = 1589
                    __content_139703124559104_1587 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_139703124559104_1587 = __quote(
                        __content_139703124559104_1587, '\x00', '&#0;', None,
                        False)
                    __token = 1605
                    __content_139703124559104_1603 = _lookup_attr(
                        getitem('industry'), 'numeric_id')
                    __content_139703124559104_1603 = __quote(
                        __content_139703124559104_1603, '\x00', '&#0;', None,
                        False)
                    __token = 1704
                    __content_139703124559104_1702 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_139703124559104_1702 = __quote(
                        __content_139703124559104_1702, '\x00', '&#0;', None,
                        False)
                    __token = 1870
                    __content_139703124559104_1868 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_139703124559104_1868 = __quote(
                        __content_139703124559104_1868, '\x00', '&#0;', None,
                        False)
                    __token = 1947
                    __content_139703124559104_1945 = _lookup_attr(
                        getitem('industry'),
                        'get_extra_text_fund')(getitem('economy'))
                    __content_139703124559104_1945 = __quote(
                        __content_139703124559104_1945, '\x00', '&#0;', None,
                        False)
                    __content_139703124559104 = ('%s%s%s%s%s%s%s%s%s%s%s%s%s' % (
                        '\n        if (economy==',
                        (__content_139703124559104 if
                         (__content_139703124559104 is not None) else ''),
                        ') {\n            item(FEAT_INDUSTRIES, ',
                        (__content_139703124559104_1587 if
                         (__content_139703124559104_1587 is not None) else ''),
                        ', ',
                        (__content_139703124559104_1603 if
                         (__content_139703124559104_1603 is not None) else ''),
                        ') {\n                graphics {\n                    construction_probability: ',
                        (__content_139703124559104_1702 if
                         (__content_139703124559104_1702 is not None) else ''),
                        '_check_availability;\n                    build_prod_change:        randomise_primary_production_on_build;\n                    location_check:           ',
                        (__content_139703124559104_1868 if
                         (__content_139703124559104_1868 is not None) else ''),
                        '_check_location;\n                    extra_text_fund:          ',
                        (__content_139703124559104_1945 if
                         (__content_139703124559104_1945 is not None) else ''),
                        ';\n                    colour:                   switch_colour;\n                }\n            }\n        }\n    ',
                    ))
                    if (__content_139703124559104 is None):
                        pass
                    else:
                        if (__content_139703124559104 is False):
                            __content_139703124559104 = None
                        else:
                            __tt = type(__content_139703124559104)
                            if ((__tt is int) or (__tt is float)
                                    or (__tt is int)):
                                __content_139703124559104 = str(
                                    __content_139703124559104)
                            else:
                                if (__tt is bytes):
                                    __content_139703124559104 = decode(
                                        __content_139703124559104)
                                else:
                                    if (__tt is not str):
                                        try:
                                            __content_139703124559104 = __content_139703124559104.__html__
                                        except get('AttributeError',
                                                   AttributeError):
                                            __converted = convert(
                                                __content_139703124559104)
                                            __content_139703124559104 = (
                                                str(__content_139703124559104)
                                                if
                                                (__content_139703124559104 is
                                                 __converted) else __converted)
                                        else:
                                            __content_139703124559104 = __content_139703124559104(
                                            )
                    if (__content_139703124559104 is not None):
                        __append(__content_139703124559104)
                __append('\n')
                ____index_139703103864672 -= 1
                if (____index_139703103864672 > 0):
                    __append('')
            if (__backup_economy_139703105755232 is __marker):
                del econtext['economy']
            else:
                econtext['economy'] = __backup_economy_139703105755232
            __append('\n')
        except:
            if (__token is not None):
                rcontext.setdefault('__error__', []).append(
                    (__tokens[__token] + (
                        __filename,
                        _exc_info()[1],
                    )))
            raise
コード例 #13
0
    def render(__stream,
               econtext,
               rcontext,
               __i18n_domain=None,
               __i18n_context=None):
        __append = __stream.append
        __re_amp = g_re_amp
        __token = None
        __re_needs_escape = g_re_needs_escape

        def __convert(target):
            if (target is None):
                return
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except AttributeError:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            target = target()
            return target

        def __quote(target, quote, quote_entity, default, default_marker):
            if (target is None):
                return
            if (target is default_marker):
                return default
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            return target()
                if (target is not None):
                    try:
                        escape = (__re_needs_escape(target) is not None)
                    except TypeError:
                        pass
                    else:
                        if escape:
                            if ('&' in target):
                                target = target.replace('&', '&amp;')
                            if ('<' in target):
                                target = target.replace('<', '&lt;')
                            if ('>' in target):
                                target = target.replace('>', '&gt;')
                            if ((quote is not None) and (quote in target)):
                                target = target.replace(quote, quote_entity)
            return target

        translate = econtext['__translate']
        decode = econtext['__decode']
        convert = econtext['__convert']
        on_error_handler = econtext['__on_error_handler']
        try:
            getitem = econtext.__getitem__
            get = econtext.get
            __append(
                '/* ******************************************************************\n * Definition of the industry tile, its callbacks, and graphics chain\n * ******************************************************************/\n\n'
            )
            __backup_macroname_140383637141960 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7fad9cd2aa20> name=None at 7fad9cd2ab38> -> __value
            __value = _static_140383637121568
            econtext['macroname'] = __value

            # <Value 'load: spritesets.pynml' (5:30)> -> __macro
            __token = 242
            __macro = ' spritesets.pynml'
            __macro = __loader(__macro)
            __token = 242
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140383637141960 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140383637141960
            __append('\n\n')
            __backup_macroname_140383636995976 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7fad9cd34be0> name=None at 7fad9cd34a20> -> __value
            __value = _static_140383637162976
            econtext['macroname'] = __value

            # <Value 'load: spritelayouts.pynml' (7:30)> -> __macro
            __token = 300
            __macro = ' spritelayouts.pynml'
            __macro = __loader(__macro)
            __token = 300
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140383636995976 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140383636995976
            __append('\n\n')
            __backup_macroname_140383637139720 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7fad9cd34160> name=None at 7fad9cd34780> -> __value
            __value = _static_140383637160288
            econtext['macroname'] = __value

            # <Value 'load: graphics_switches.pynml' (9:30)> -> __macro
            __token = 361
            __macro = ' graphics_switches.pynml'
            __macro = __loader(__macro)
            __token = 361
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140383637139720 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140383637139720
            __append('\n\n')
            __backup_location_checks_tile_140383663170336 = get(
                'location_checks_tile', __marker)

            # <Value 'load: location_check_macros_tile.pynml' (11:42)> -> __value
            __token = 438
            __value = ' location_check_macros_tile.pynml'
            __value = __loader(__value)
            econtext['location_checks_tile'] = __value
            __backup_macroname_140383637140104 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7fad9cd34400> name=None at 7fad9cd34a90> -> __value
            __value = _static_140383637160960
            econtext['macroname'] = __value

            # <Value "location_checks_tile.macros['render_tree']" (12:30)> -> __macro
            __token = 508
            __macro = _lookup_attr(getitem('location_checks_tile'),
                                   'macros')['render_tree']
            __token = 508
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140383637140104 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140383637140104
            if (__backup_location_checks_tile_140383663170336 is __marker):
                del econtext['location_checks_tile']
            else:
                econtext[
                    'location_checks_tile'] = __backup_location_checks_tile_140383663170336
            __append('\n\n')
            __backup_animation_macros_140383663150136 = get(
                'animation_macros', __marker)

            # <Value 'load: animation_macros.pynml' (14:38)> -> __value
            __token = 594
            __value = ' animation_macros.pynml'
            __value = __loader(__value)
            econtext['animation_macros'] = __value
            __backup_macroname_140383636854472 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7fad9cd346d8> name=None at 7fad9cd34dd8> -> __value
            __value = _static_140383637161688
            econtext['macroname'] = __value

            # <Value "animation_macros.macros['tile_animation']" (15:30)> -> __macro
            __token = 654
            __macro = _lookup_attr(getitem('animation_macros'),
                                   'macros')['tile_animation']
            __token = 654
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140383636854472 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140383636854472
            if (__backup_animation_macros_140383663150136 is __marker):
                del econtext['animation_macros']
            else:
                econtext[
                    'animation_macros'] = __backup_animation_macros_140383663150136
            __append('\n\n')
            __backup_macroname_140383636910280 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7fad9cd34e48> name=None at 7fad9cd34b70> -> __value
            __value = _static_140383637163592
            econtext['macroname'] = __value

            # <Value 'load: properties_tile.pynml' (17:30)> -> __macro
            __token = 731
            __macro = ' properties_tile.pynml'
            __macro = __loader(__macro)
            __token = 731
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140383636910280 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140383636910280
            __append(
                '\n\n\n/* *************************************************\n * Definition of the industry\n * *************************************************/\n\n'
            )
            __backup_macroname_140383637327432 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7fad9cd340f0> name=None at 7fad9cd34630> -> __value
            __value = _static_140383637160176
            econtext['macroname'] = __value

            # <Value 'load: layouts.pynml' (24:30)> -> __macro
            __token = 933
            __macro = ' layouts.pynml'
            __macro = __loader(__macro)
            __token = 933
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140383637327432 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140383637327432
            __append('\n\n')
            __backup_macroname_140383637327496 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7fad9cd34550> name=None at 7fad9cd34518> -> __value
            __value = _static_140383637161296
            econtext['macroname'] = __value

            # <Value 'load: produce_secondary.pynml' (26:30)> -> __macro
            __token = 988
            __macro = ' produce_secondary.pynml'
            __macro = __loader(__macro)
            __token = 988
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140383637327496 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140383637327496
            __append('\n\n')
            __backup_macroname_140383636970760 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7fad9cd346a0> name=None at 7fad9cd345f8> -> __value
            __value = _static_140383637161632
            econtext['macroname'] = __value

            # <Value 'load: closure_secondary.pynml' (28:30)> -> __macro
            __token = 1053
            __macro = ' closure_secondary.pynml'
            __macro = __loader(__macro)
            __token = 1053
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140383636970760 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140383636970760
            __append('\n\n')
            __backup_macroname_140383636913224 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7fad9cd34438> name=None at 7fad9cd34668> -> __value
            __value = _static_140383637161016
            econtext['macroname'] = __value

            # <Value 'load: extra_text_secondary.pynml' (30:30)> -> __macro
            __token = 1118
            __macro = ' extra_text_secondary.pynml'
            __macro = __loader(__macro)
            __token = 1118
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140383636913224 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140383636913224
            __append('\n\n')
            __backup_macroname_140383636715592 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7fad9cd43ba8> name=None at 7fad9cd43b00> -> __value
            __value = _static_140383637224360
            econtext['macroname'] = __value

            # <Value 'load: availability.pynml' (32:30)> -> __macro
            __token = 1186
            __macro = ' availability.pynml'
            __macro = __loader(__macro)
            __token = 1186
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140383636715592 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140383636715592
            __append('\n\n')
            __backup_location_checks_industry_140383663170952 = get(
                'location_checks_industry', __marker)

            # <Value 'load: location_check_macros_industry.pynml' (34:46)> -> __value
            __token = 1262
            __value = ' location_check_macros_industry.pynml'
            __value = __loader(__value)
            econtext['location_checks_industry'] = __value
            __backup_macroname_140383636565576 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7fad9cd43908> name=None at 7fad9cd43828> -> __value
            __value = _static_140383637223688
            econtext['macroname'] = __value

            # <Value "location_checks_industry.macros['render_tree']" (35:30)> -> __macro
            __token = 1336
            __macro = _lookup_attr(getitem('location_checks_industry'),
                                   'macros')['render_tree']
            __token = 1336
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140383636565576 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140383636565576
            if (__backup_location_checks_industry_140383663170952 is __marker):
                del econtext['location_checks_industry']
            else:
                econtext[
                    'location_checks_industry'] = __backup_location_checks_industry_140383663170952
            __append('\n\n')
            __backup_macroname_140383636563080 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7fad9cd43780> name=None at 7fad9cd437f0> -> __value
            __value = _static_140383637223296
            econtext['macroname'] = __value

            # <Value 'load: properties_industry.pynml' (37:30)> -> __macro
            __token = 1418
            __macro = ' properties_industry.pynml'
            __macro = __loader(__macro)
            __token = 1418
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140383636563080 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140383636563080
            __append('\n\n')
            __append('\n')
            __backup_economy_140383663170728 = get('economy', __marker)

            # <Value 'economies' (40:37)> -> __iterator
            __token = 1602
            __iterator = getitem('economies')
            (
                __iterator,
                ____index_140383637222568,
            ) = getitem('repeat')('economy', __iterator)
            econtext['economy'] = None
            for __item in __iterator:
                econtext['economy'] = __item
                __append('\n    ')

                # <Value "industry.get_property('enabled', economy) == True" (41:39)> -> __condition
                __token = 1653
                __condition = (_lookup_attr(
                    getitem('industry'),
                    'get_property')('enabled', getitem('economy')) == True)
                if __condition:

                    # <Interpolation value=<Substitution '\n        if (economy==${economy.numeric_id}) {\n            item(FEAT_INDUSTRIES, ${industry.id}, ${industry.numeric_id}) {\n                graphics {\n                    construction_probability: ${industry.id}_check_availability;\n                    produce_cargo_arrival:    ${industry.id}_produce;\n                    monthly_prod_change:      ${industry.id}_check_secondary_production_level;\n                    random_prod_change:       ${industry.id}_check_secondary_closure;\n                    location_check:           ${industry.id}_check_location;\n                    extra_text_fund:          ${industry.get_extra_text_fund(economy)};\n                    extra_text_industry:      ${industry.id}_extra_text;\n                    cargo_subtype_display:    ${industry.id}_cargo_subtype_display;\n                    colour:                   switch_colour;\n                }\n            }\n        }\n    ' (41:90)> braces_required=True translation=False at 7fad9cd43be0> -> __content_140383655711776
                    __token = 1713
                    __token = 1728
                    __content_140383655711776 = _lookup_attr(
                        getitem('economy'), 'numeric_id')
                    __content_140383655711776 = __quote(
                        __content_140383655711776, '\x00', '&#0;', None, False)
                    __token = 1787
                    __content_140383655711776_1785 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_140383655711776_1785 = __quote(
                        __content_140383655711776_1785, '\x00', '&#0;', None,
                        False)
                    __token = 1803
                    __content_140383655711776_1801 = _lookup_attr(
                        getitem('industry'), 'numeric_id')
                    __content_140383655711776_1801 = __quote(
                        __content_140383655711776_1801, '\x00', '&#0;', None,
                        False)
                    __token = 1902
                    __content_140383655711776_1900 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_140383655711776_1900 = __quote(
                        __content_140383655711776_1900, '\x00', '&#0;', None,
                        False)
                    __token = 1983
                    __content_140383655711776_1981 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_140383655711776_1981 = __quote(
                        __content_140383655711776_1981, '\x00', '&#0;', None,
                        False)
                    __token = 2053
                    __content_140383655711776_2051 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_140383655711776_2051 = __quote(
                        __content_140383655711776_2051, '\x00', '&#0;', None,
                        False)
                    __token = 2148
                    __content_140383655711776_2146 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_140383655711776_2146 = __quote(
                        __content_140383655711776_2146, '\x00', '&#0;', None,
                        False)
                    __token = 2234
                    __content_140383655711776_2232 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_140383655711776_2232 = __quote(
                        __content_140383655711776_2232, '\x00', '&#0;', None,
                        False)
                    __token = 2311
                    __content_140383655711776_2309 = _lookup_attr(
                        getitem('industry'),
                        'get_extra_text_fund')(getitem('economy'))
                    __content_140383655711776_2309 = __quote(
                        __content_140383655711776_2309, '\x00', '&#0;', None,
                        False)
                    __token = 2399
                    __content_140383655711776_2397 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_140383655711776_2397 = __quote(
                        __content_140383655711776_2397, '\x00', '&#0;', None,
                        False)
                    __token = 2472
                    __content_140383655711776_2470 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_140383655711776_2470 = __quote(
                        __content_140383655711776_2470, '\x00', '&#0;', None,
                        False)
                    __content_140383655711776 = ('%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s' % (
                        '\n        if (economy==',
                        (__content_140383655711776 if
                         (__content_140383655711776 is not None) else ''),
                        ') {\n            item(FEAT_INDUSTRIES, ',
                        (__content_140383655711776_1785 if
                         (__content_140383655711776_1785 is not None) else ''),
                        ', ',
                        (__content_140383655711776_1801 if
                         (__content_140383655711776_1801 is not None) else ''),
                        ') {\n                graphics {\n                    construction_probability: ',
                        (__content_140383655711776_1900 if
                         (__content_140383655711776_1900 is not None) else ''),
                        '_check_availability;\n                    produce_cargo_arrival:    ',
                        (__content_140383655711776_1981 if
                         (__content_140383655711776_1981 is not None) else ''),
                        '_produce;\n                    monthly_prod_change:      ',
                        (__content_140383655711776_2051 if
                         (__content_140383655711776_2051 is not None) else ''),
                        '_check_secondary_production_level;\n                    random_prod_change:       ',
                        (__content_140383655711776_2146 if
                         (__content_140383655711776_2146 is not None) else ''),
                        '_check_secondary_closure;\n                    location_check:           ',
                        (__content_140383655711776_2232 if
                         (__content_140383655711776_2232 is not None) else ''),
                        '_check_location;\n                    extra_text_fund:          ',
                        (__content_140383655711776_2309 if
                         (__content_140383655711776_2309 is not None) else ''),
                        ';\n                    extra_text_industry:      ',
                        (__content_140383655711776_2397 if
                         (__content_140383655711776_2397 is not None) else ''),
                        '_extra_text;\n                    cargo_subtype_display:    ',
                        (__content_140383655711776_2470 if
                         (__content_140383655711776_2470 is not None) else ''),
                        '_cargo_subtype_display;\n                    colour:                   switch_colour;\n                }\n            }\n        }\n    ',
                    ))
                    if (__content_140383655711776 is None):
                        pass
                    else:
                        if (__content_140383655711776 is False):
                            __content_140383655711776 = None
                        else:
                            __tt = type(__content_140383655711776)
                            if ((__tt is int) or (__tt is float)
                                    or (__tt is int)):
                                __content_140383655711776 = str(
                                    __content_140383655711776)
                            else:
                                if (__tt is bytes):
                                    __content_140383655711776 = decode(
                                        __content_140383655711776)
                                else:
                                    if (__tt is not str):
                                        try:
                                            __content_140383655711776 = __content_140383655711776.__html__
                                        except get('AttributeError',
                                                   AttributeError):
                                            __converted = convert(
                                                __content_140383655711776)
                                            __content_140383655711776 = (
                                                str(__content_140383655711776)
                                                if
                                                (__content_140383655711776 is
                                                 __converted) else __converted)
                                        else:
                                            __content_140383655711776 = __content_140383655711776(
                                            )
                    if (__content_140383655711776 is not None):
                        __append(__content_140383655711776)
                __append('\n')
                ____index_140383637222568 -= 1
                if (____index_140383637222568 > 0):
                    __append('')
            if (__backup_economy_140383663170728 is __marker):
                del econtext['economy']
            else:
                econtext['economy'] = __backup_economy_140383663170728
            __append('\n')
        except:
            if (__token is not None):
                rcontext.setdefault('__error__', []).append(
                    (__tokens[__token] + (
                        __filename,
                        _exc_info()[1],
                    )))
            raise
コード例 #14
0
    def render(__stream,
               econtext,
               rcontext,
               __i18n_domain=None,
               __i18n_context=None):
        __append = __stream.append
        __re_amp = g_re_amp
        __token = None
        __re_needs_escape = g_re_needs_escape

        def __convert(target):
            if (target is None):
                return
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except AttributeError:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            target = target()
            return target

        def __quote(target, quote, quote_entity, default, default_marker):
            if (target is None):
                return
            if (target is default_marker):
                return default
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            return target()
                if (target is not None):
                    try:
                        escape = (__re_needs_escape(target) is not None)
                    except TypeError:
                        pass
                    else:
                        if escape:
                            if ('&' in target):
                                target = target.replace('&', '&amp;')
                            if ('<' in target):
                                target = target.replace('<', '&lt;')
                            if ('>' in target):
                                target = target.replace('>', '&gt;')
                            if ((quote is not None) and (quote in target)):
                                target = target.replace(quote, quote_entity)
            return target

        translate = econtext['__translate']
        decode = econtext['__decode']
        convert = econtext['__convert']
        on_error_handler = econtext['__on_error_handler']
        try:
            getitem = econtext.__getitem__
            get = econtext.get
            __append('\n\n')
            __backup_perm_storage_139875068693976 = get(
                'perm_storage', __marker)

            # <Value 'industry.perm_storage' (3:32)> -> __value
            __token = 106
            __value = _lookup_attr(getitem('industry'), 'perm_storage')
            econtext['perm_storage'] = __value
            __append('\n    ')
            __append('\n\n    ')

            # <Interpolation value=<Substitution '\n    switch(FEAT_INDUSTRIES, SELF, ${industry.id}_secondary_increase_closure_counter,\n           STORE_PERM((1 + LOAD_PERM(${perm_storage.closure_counter})), ${perm_storage.closure_counter})) {\n        return 0;\n    }\n    switch(FEAT_INDUSTRIES, SELF, ${industry.id}_secondary_reset_closure_counter, [STORE_PERM(0, ${perm_storage.closure_counter}), 1]) {\n        return 0;\n    }\n    ' (6:111)> braces_required=True translation=False at 7f3733e24f28> -> __content_139875089167952
            __token = 330
            __token = 362
            __content_139875089167952 = _lookup_attr(getitem('industry'), 'id')
            __content_139875089167952 = __quote(__content_139875089167952,
                                                '\x00', '&#0;', None, False)
            __token = 450
            __content_139875089167952_448 = _lookup_attr(
                getitem('perm_storage'), 'closure_counter')
            __content_139875089167952_448 = __quote(
                __content_139875089167952_448, '\x00', '&#0;', None, False)
            __token = 485
            __content_139875089167952_483 = _lookup_attr(
                getitem('perm_storage'), 'closure_counter')
            __content_139875089167952_483 = __quote(
                __content_139875089167952_483, '\x00', '&#0;', None, False)
            __token = 579
            __content_139875089167952_577 = _lookup_attr(
                getitem('industry'), 'id')
            __content_139875089167952_577 = __quote(
                __content_139875089167952_577, '\x00', '&#0;', None, False)
            __token = 642
            __content_139875089167952_640 = _lookup_attr(
                getitem('perm_storage'), 'closure_counter')
            __content_139875089167952_640 = __quote(
                __content_139875089167952_640, '\x00', '&#0;', None, False)
            __content_139875089167952 = ('%s%s%s%s%s%s%s%s%s%s%s' % (
                '\n    switch(FEAT_INDUSTRIES, SELF, ',
                (__content_139875089167952 if
                 (__content_139875089167952 is not None) else ''),
                '_secondary_increase_closure_counter,\n           STORE_PERM((1 + LOAD_PERM(',
                (__content_139875089167952_448 if
                 (__content_139875089167952_448 is not None) else ''),
                ')), ',
                (__content_139875089167952_483 if
                 (__content_139875089167952_483 is not None) else ''),
                ')) {\n        return 0;\n    }\n    switch(FEAT_INDUSTRIES, SELF, ',
                (__content_139875089167952_577 if
                 (__content_139875089167952_577 is not None) else ''),
                '_secondary_reset_closure_counter, [STORE_PERM(0, ',
                (__content_139875089167952_640 if
                 (__content_139875089167952_640 is not None) else ''),
                '), 1]) {\n        return 0;\n    }\n    ',
            ))
            if (__content_139875089167952 is None):
                pass
            else:
                if (__content_139875089167952 is False):
                    __content_139875089167952 = None
                else:
                    __tt = type(__content_139875089167952)
                    if ((__tt is int) or (__tt is float) or (__tt is int)):
                        __content_139875089167952 = str(
                            __content_139875089167952)
                    else:
                        if (__tt is bytes):
                            __content_139875089167952 = decode(
                                __content_139875089167952)
                        else:
                            if (__tt is not str):
                                try:
                                    __content_139875089167952 = __content_139875089167952.__html__
                                except get('AttributeError', AttributeError):
                                    __converted = convert(
                                        __content_139875089167952)
                                    __content_139875089167952 = (
                                        str(__content_139875089167952) if
                                        (__content_139875089167952 is
                                         __converted) else __converted)
                                else:
                                    __content_139875089167952 = __content_139875089167952(
                                    )
            if (__content_139875089167952 is not None):
                __append(__content_139875089167952)

            # <Interpolation value=<Substitution '\n    switch(FEAT_INDUSTRIES, SELF, ${industry.id}_check_secondary_production_level, [\n                transported_last_month_1 > 0 ||\n                transported_last_month_2 > 0 ||\n                (current_date - LOAD_PERM(${perm_storage.date_received_1})) ' (14:128)> braces_required=True translation=False at 7f3733e240f0> -> __content_139875089167952
            __token = 837
            __token = 869
            __content_139875089167952 = _lookup_attr(getitem('industry'), 'id')
            __content_139875089167952 = __quote(__content_139875089167952,
                                                '\x00', '&#0;', None, False)
            __token = 1058
            __content_139875089167952_1056 = _lookup_attr(
                getitem('perm_storage'), 'date_received_1')
            __content_139875089167952_1056 = __quote(
                __content_139875089167952_1056, '\x00', '&#0;', None, False)
            __content_139875089167952 = ('%s%s%s%s%s' % (
                '\n    switch(FEAT_INDUSTRIES, SELF, ',
                (__content_139875089167952 if
                 (__content_139875089167952 is not None) else ''),
                '_check_secondary_production_level, [\n                transported_last_month_1 > 0 ||\n                transported_last_month_2 > 0 ||\n                (current_date - LOAD_PERM(',
                (__content_139875089167952_1056 if
                 (__content_139875089167952_1056 is not None) else ''),
                ')) ',
            ))
            if (__content_139875089167952 is None):
                pass
            else:
                if (__content_139875089167952 is False):
                    __content_139875089167952 = None
                else:
                    __tt = type(__content_139875089167952)
                    if ((__tt is int) or (__tt is float) or (__tt is int)):
                        __content_139875089167952 = str(
                            __content_139875089167952)
                    else:
                        if (__tt is bytes):
                            __content_139875089167952 = decode(
                                __content_139875089167952)
                        else:
                            if (__tt is not str):
                                try:
                                    __content_139875089167952 = __content_139875089167952.__html__
                                except get('AttributeError', AttributeError):
                                    __converted = convert(
                                        __content_139875089167952)
                                    __content_139875089167952 = (
                                        str(__content_139875089167952) if
                                        (__content_139875089167952 is
                                         __converted) else __converted)
                                else:
                                    __content_139875089167952 = __content_139875089167952(
                                    )
            if (__content_139875089167952 is not None):
                __append(__content_139875089167952)
            __append('<')

            # <Interpolation value=<Substitution ' 30 ||\n                (current_date - LOAD_PERM(${perm_storage.date_received_2})) ' (18:77)> braces_required=True translation=False at 7f3733e24ac8> -> __content_139875089167952
            __token = 1092
            __token = 1142
            __content_139875089167952 = _lookup_attr(getitem('perm_storage'),
                                                     'date_received_2')
            __content_139875089167952 = __quote(__content_139875089167952,
                                                '\x00', '&#0;', None, False)
            __content_139875089167952 = ('%s%s%s' % (
                ' 30 ||\n                (current_date - LOAD_PERM(',
                (__content_139875089167952 if
                 (__content_139875089167952 is not None) else ''),
                ')) ',
            ))
            if (__content_139875089167952 is None):
                pass
            else:
                if (__content_139875089167952 is False):
                    __content_139875089167952 = None
                else:
                    __tt = type(__content_139875089167952)
                    if ((__tt is int) or (__tt is float) or (__tt is int)):
                        __content_139875089167952 = str(
                            __content_139875089167952)
                    else:
                        if (__tt is bytes):
                            __content_139875089167952 = decode(
                                __content_139875089167952)
                        else:
                            if (__tt is not str):
                                try:
                                    __content_139875089167952 = __content_139875089167952.__html__
                                except get('AttributeError', AttributeError):
                                    __converted = convert(
                                        __content_139875089167952)
                                    __content_139875089167952 = (
                                        str(__content_139875089167952) if
                                        (__content_139875089167952 is
                                         __converted) else __converted)
                                else:
                                    __content_139875089167952 = __content_139875089167952(
                                    )
            if (__content_139875089167952 is not None):
                __append(__content_139875089167952)
            __append('<')

            # <Interpolation value=<Substitution ' 30 ||\n                (current_date - LOAD_PERM(${perm_storage.date_received_3})) ' (19:77)> braces_required=True translation=False at 7f3733e24470> -> __content_139875089167952
            __token = 1176
            __token = 1226
            __content_139875089167952 = _lookup_attr(getitem('perm_storage'),
                                                     'date_received_3')
            __content_139875089167952 = __quote(__content_139875089167952,
                                                '\x00', '&#0;', None, False)
            __content_139875089167952 = ('%s%s%s' % (
                ' 30 ||\n                (current_date - LOAD_PERM(',
                (__content_139875089167952 if
                 (__content_139875089167952 is not None) else ''),
                ')) ',
            ))
            if (__content_139875089167952 is None):
                pass
            else:
                if (__content_139875089167952 is False):
                    __content_139875089167952 = None
                else:
                    __tt = type(__content_139875089167952)
                    if ((__tt is int) or (__tt is float) or (__tt is int)):
                        __content_139875089167952 = str(
                            __content_139875089167952)
                    else:
                        if (__tt is bytes):
                            __content_139875089167952 = decode(
                                __content_139875089167952)
                        else:
                            if (__tt is not str):
                                try:
                                    __content_139875089167952 = __content_139875089167952.__html__
                                except get('AttributeError', AttributeError):
                                    __converted = convert(
                                        __content_139875089167952)
                                    __content_139875089167952 = (
                                        str(__content_139875089167952) if
                                        (__content_139875089167952 is
                                         __converted) else __converted)
                                else:
                                    __content_139875089167952 = __content_139875089167952(
                                    )
            if (__content_139875089167952 is not None):
                __append(__content_139875089167952)
            __append('<')

            # <Interpolation value=<Substitution ' 30\n                ]\n            ) {\n        0: ${industry.id}_secondary_increase_closure_counter;\n        ${industry.id}_secondary_reset_closure_counter;\n    }\n' (20:77)> braces_required=True translation=False at 7f3733e24438> -> __content_139875089167952
            __token = 1260
            __token = 1310
            __content_139875089167952 = _lookup_attr(getitem('industry'), 'id')
            __content_139875089167952 = __quote(__content_139875089167952,
                                                '\x00', '&#0;', None, False)
            __token = 1369
            __content_139875089167952_1367 = _lookup_attr(
                getitem('industry'), 'id')
            __content_139875089167952_1367 = __quote(
                __content_139875089167952_1367, '\x00', '&#0;', None, False)
            __content_139875089167952 = ('%s%s%s%s%s' % (
                ' 30\n                ]\n            ) {\n        0: ',
                (__content_139875089167952 if
                 (__content_139875089167952 is not None) else ''),
                '_secondary_increase_closure_counter;\n        ',
                (__content_139875089167952_1367 if
                 (__content_139875089167952_1367 is not None) else ''),
                '_secondary_reset_closure_counter;\n    }\n',
            ))
            if (__content_139875089167952 is None):
                pass
            else:
                if (__content_139875089167952 is False):
                    __content_139875089167952 = None
                else:
                    __tt = type(__content_139875089167952)
                    if ((__tt is int) or (__tt is float) or (__tt is int)):
                        __content_139875089167952 = str(
                            __content_139875089167952)
                    else:
                        if (__tt is bytes):
                            __content_139875089167952 = decode(
                                __content_139875089167952)
                        else:
                            if (__tt is not str):
                                try:
                                    __content_139875089167952 = __content_139875089167952.__html__
                                except get('AttributeError', AttributeError):
                                    __converted = convert(
                                        __content_139875089167952)
                                    __content_139875089167952 = (
                                        str(__content_139875089167952) if
                                        (__content_139875089167952 is
                                         __converted) else __converted)
                                else:
                                    __content_139875089167952 = __content_139875089167952(
                                    )
            if (__content_139875089167952 is not None):
                __append(__content_139875089167952)
            if (__backup_perm_storage_139875068693976 is __marker):
                del econtext['perm_storage']
            else:
                econtext[
                    'perm_storage'] = __backup_perm_storage_139875068693976
            __append('\n\n\n')
            __append('\n\n')

            # <Interpolation value=<Substitution '\nswitch(FEAT_INDUSTRIES, SELF, ${industry.id}_secondary_close_random, (extra_callback_info2 & 32)) {\n\t0: return CB_RESULT_IND_PROD_CLOSE;\n\treturn CB_RESULT_IND_PROD_NO_CHANGE;\n}\n\n' (31:96)> braces_required=True translation=False at 7f3733dd91d0> -> __content_139875089167952
            __token = 1623
            __token = 1655
            __content_139875089167952 = _lookup_attr(getitem('industry'), 'id')
            __content_139875089167952 = __quote(__content_139875089167952,
                                                '\x00', '&#0;', None, False)
            __content_139875089167952 = ('%s%s%s' % (
                '\nswitch(FEAT_INDUSTRIES, SELF, ',
                (__content_139875089167952 if
                 (__content_139875089167952 is not None) else ''),
                '_secondary_close_random, (extra_callback_info2 & 32)) {\n\t0: return CB_RESULT_IND_PROD_CLOSE;\n\treturn CB_RESULT_IND_PROD_NO_CHANGE;\n}\n\n',
            ))
            if (__content_139875089167952 is None):
                pass
            else:
                if (__content_139875089167952 is False):
                    __content_139875089167952 = None
                else:
                    __tt = type(__content_139875089167952)
                    if ((__tt is int) or (__tt is float) or (__tt is int)):
                        __content_139875089167952 = str(
                            __content_139875089167952)
                    else:
                        if (__tt is bytes):
                            __content_139875089167952 = decode(
                                __content_139875089167952)
                        else:
                            if (__tt is not str):
                                try:
                                    __content_139875089167952 = __content_139875089167952.__html__
                                except get('AttributeError', AttributeError):
                                    __converted = convert(
                                        __content_139875089167952)
                                    __content_139875089167952 = (
                                        str(__content_139875089167952) if
                                        (__content_139875089167952 is
                                         __converted) else __converted)
                                else:
                                    __content_139875089167952 = __content_139875089167952(
                                    )
            if (__content_139875089167952 is not None):
                __append(__content_139875089167952)

            # <Interpolation value=<Substitution '\nswitch(FEAT_INDUSTRIES, SELF, ${industry.id}_secondary_had_produced_check, LOAD_PERM(${industry.perm_storage.closure_counter})) {\n\t0..60: return CB_RESULT_IND_PROD_NO_CHANGE;\n\t${industry.id}_secondary_close_random;\n}\n\n' (37:57)> braces_required=True translation=False at 7f3733e24358> -> __content_139875089167952
            __token = 1859
            __token = 1891
            __content_139875089167952 = _lookup_attr(getitem('industry'), 'id')
            __content_139875089167952 = __quote(__content_139875089167952,
                                                '\x00', '&#0;', None, False)
            __token = 1946
            __content_139875089167952_1944 = _lookup_attr(
                _lookup_attr(getitem('industry'), 'perm_storage'),
                'closure_counter')
            __content_139875089167952_1944 = __quote(
                __content_139875089167952_1944, '\x00', '&#0;', None, False)
            __token = 2037
            __content_139875089167952_2035 = _lookup_attr(
                getitem('industry'), 'id')
            __content_139875089167952_2035 = __quote(
                __content_139875089167952_2035, '\x00', '&#0;', None, False)
            __content_139875089167952 = ('%s%s%s%s%s%s%s' % (
                '\nswitch(FEAT_INDUSTRIES, SELF, ',
                (__content_139875089167952 if
                 (__content_139875089167952 is not None) else ''),
                '_secondary_had_produced_check, LOAD_PERM(',
                (__content_139875089167952_1944 if
                 (__content_139875089167952_1944 is not None) else ''),
                ')) {\n\t0..60: return CB_RESULT_IND_PROD_NO_CHANGE;\n\t',
                (__content_139875089167952_2035 if
                 (__content_139875089167952_2035 is not None) else ''),
                '_secondary_close_random;\n}\n\n',
            ))
            if (__content_139875089167952 is None):
                pass
            else:
                if (__content_139875089167952 is False):
                    __content_139875089167952 = None
                else:
                    __tt = type(__content_139875089167952)
                    if ((__tt is int) or (__tt is float) or (__tt is int)):
                        __content_139875089167952 = str(
                            __content_139875089167952)
                    else:
                        if (__tt is bytes):
                            __content_139875089167952 = decode(
                                __content_139875089167952)
                        else:
                            if (__tt is not str):
                                try:
                                    __content_139875089167952 = __content_139875089167952.__html__
                                except get('AttributeError', AttributeError):
                                    __converted = convert(
                                        __content_139875089167952)
                                    __content_139875089167952 = (
                                        str(__content_139875089167952) if
                                        (__content_139875089167952 is
                                         __converted) else __converted)
                                else:
                                    __content_139875089167952 = __content_139875089167952(
                                    )
            if (__content_139875089167952 is not None):
                __append(__content_139875089167952)

            # <Interpolation value=<Substitution '\nswitch(FEAT_INDUSTRIES, SELF, ${industry.id}_check_secondary_closure, allow_close_secondary) {\n\t1..255: ${industry.id}_secondary_had_produced_check;\n\treturn CB_RESULT_IND_PROD_NO_CHANGE;\n}\n\n\n' (43:80)> braces_required=True translation=False at 7f3733e24390> -> __content_139875089167952
            __token = 2158
            __token = 2190
            __content_139875089167952 = _lookup_attr(getitem('industry'), 'id')
            __content_139875089167952 = __quote(__content_139875089167952,
                                                '\x00', '&#0;', None, False)
            __token = 2264
            __content_139875089167952_2262 = _lookup_attr(
                getitem('industry'), 'id')
            __content_139875089167952_2262 = __quote(
                __content_139875089167952_2262, '\x00', '&#0;', None, False)
            __content_139875089167952 = ('%s%s%s%s%s' % (
                '\nswitch(FEAT_INDUSTRIES, SELF, ',
                (__content_139875089167952 if
                 (__content_139875089167952 is not None) else ''),
                '_check_secondary_closure, allow_close_secondary) {\n\t1..255: ',
                (__content_139875089167952_2262 if
                 (__content_139875089167952_2262 is not None) else ''),
                '_secondary_had_produced_check;\n\treturn CB_RESULT_IND_PROD_NO_CHANGE;\n}\n\n\n',
            ))
            if (__content_139875089167952 is None):
                pass
            else:
                if (__content_139875089167952 is False):
                    __content_139875089167952 = None
                else:
                    __tt = type(__content_139875089167952)
                    if ((__tt is int) or (__tt is float) or (__tt is int)):
                        __content_139875089167952 = str(
                            __content_139875089167952)
                    else:
                        if (__tt is bytes):
                            __content_139875089167952 = decode(
                                __content_139875089167952)
                        else:
                            if (__tt is not str):
                                try:
                                    __content_139875089167952 = __content_139875089167952.__html__
                                except get('AttributeError', AttributeError):
                                    __converted = convert(
                                        __content_139875089167952)
                                    __content_139875089167952 = (
                                        str(__content_139875089167952) if
                                        (__content_139875089167952 is
                                         __converted) else __converted)
                                else:
                                    __content_139875089167952 = __content_139875089167952(
                                    )
            if (__content_139875089167952 is not None):
                __append(__content_139875089167952)
        except:
            if (__token is not None):
                rcontext.setdefault('__error__', []).append(
                    (__tokens[__token] + (
                        __filename,
                        _exc_info()[1],
                    )))
            raise
コード例 #15
0
    def render(__stream, econtext, rcontext, __i18n_domain=None, __i18n_context=None):
        __append = __stream.append
        __re_amp = g_re_amp
        __token = None
        __re_needs_escape = g_re_needs_escape

        def __convert(target):
            if (target is None):
                return
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except AttributeError:
                            __converted = convert(target)
                            target = (str(target) if (target is __converted) else __converted)
                        else:
                            target = target()
            return target

        def __quote(target, quote, quote_entity, default, default_marker):
            if (target is None):
                return
            if (target is default_marker):
                return default
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except:
                            __converted = convert(target)
                            target = (str(target) if (target is __converted) else __converted)
                        else:
                            return target()
                if (target is not None):
                    try:
                        escape = (__re_needs_escape(target) is not None)
                    except TypeError:
                        pass
                    else:
                        if escape:
                            if ('&' in target):
                                target = target.replace('&', '&amp;')
                            if ('<' in target):
                                target = target.replace('<', '&lt;')
                            if ('>' in target):
                                target = target.replace('>', '&gt;')
                            if ((quote is not None) and (quote in target)):
                                target = target.replace(quote, quote_entity)
            return target
        translate = econtext['__translate']
        decode = econtext['__decode']
        convert = econtext['__convert']
        on_error_handler = econtext['__on_error_handler']
        try:
            getitem = econtext.__getitem__
            get = econtext.get
            __append('/* ******************************************************************\n * Definition of the industry tile, its callbacks, and graphics chain\n * ******************************************************************/\n\n')
            __backup_macroname_140183230669192 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f7ef3b59c88> name=None at 7f7ef3b592b0> -> __value
            __value = _static_140183231372424
            econtext['macroname'] = __value

            # <Value 'load: spritesets.pynml' (5:30)> -> __macro
            __token = 242
            __macro = ' spritesets.pynml'
            __macro = __loader(__macro)
            __token = 242
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140183230669192 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140183230669192
            __append('\n\n')
            __backup_macroname_140183230737416 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f7ef3b4a828> name=None at 7f7ef3b4a908> -> __value
            __value = _static_140183231309864
            econtext['macroname'] = __value

            # <Value 'load: spritelayouts.pynml' (7:30)> -> __macro
            __token = 300
            __macro = ' spritelayouts.pynml'
            __macro = __loader(__macro)
            __token = 300
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140183230737416 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140183230737416
            __append('\n\n')
            __backup_macroname_140183230738376 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f7ef3b4afd0> name=None at 7f7ef3b4a780> -> __value
            __value = _static_140183231311824
            econtext['macroname'] = __value

            # <Value 'load: graphics_switches.pynml' (9:30)> -> __macro
            __token = 361
            __macro = ' graphics_switches.pynml'
            __macro = __loader(__macro)
            __token = 361
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140183230738376 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140183230738376
            __append('\n\n')
            __backup_location_checks_tile_140183257338880 = get('location_checks_tile', __marker)

            # <Value 'load: location_check_macros_tile.pynml' (11:42)> -> __value
            __token = 438
            __value = ' location_check_macros_tile.pynml'
            __value = __loader(__value)
            econtext['location_checks_tile'] = __value
            __backup_macroname_140183230736392 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f7ef3b4a128> name=None at 7f7ef3b4a550> -> __value
            __value = _static_140183231308072
            econtext['macroname'] = __value

            # <Value "location_checks_tile.macros['render_tree']" (12:30)> -> __macro
            __token = 508
            __macro = _lookup_attr(getitem('location_checks_tile'), 'macros')['render_tree']
            __token = 508
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140183230736392 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140183230736392
            if (__backup_location_checks_tile_140183257338880 is __marker):
                del econtext['location_checks_tile']
            else:
                econtext['location_checks_tile'] = __backup_location_checks_tile_140183257338880
            __append('\n\n')
            __backup_animation_macros_140183257338040 = get('animation_macros', __marker)

            # <Value 'load: animation_macros.pynml' (14:38)> -> __value
            __token = 594
            __value = ' animation_macros.pynml'
            __value = __loader(__value)
            econtext['animation_macros'] = __value
            __backup_macroname_140183230681416 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f7ef3b4a6a0> name=None at 7f7ef3b4a2b0> -> __value
            __value = _static_140183231309472
            econtext['macroname'] = __value

            # <Value "animation_macros.macros['tile_animation']" (15:30)> -> __macro
            __token = 654
            __macro = _lookup_attr(getitem('animation_macros'), 'macros')['tile_animation']
            __token = 654
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140183230681416 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140183230681416
            if (__backup_animation_macros_140183257338040 is __marker):
                del econtext['animation_macros']
            else:
                econtext['animation_macros'] = __backup_animation_macros_140183257338040
            __append('\n\n')
            __backup_macroname_140183230758664 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f7ef3b4a080> name=None at 7f7ef3b4af60> -> __value
            __value = _static_140183231307904
            econtext['macroname'] = __value

            # <Value 'load: properties_tile.pynml' (17:30)> -> __macro
            __token = 731
            __macro = ' properties_tile.pynml'
            __macro = __loader(__macro)
            __token = 731
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140183230758664 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140183230758664
            __append('\n\n\n/* *************************************************\n * Definition of the industry\n * *************************************************/\n\n')
            __backup_macroname_140183230395336 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f7ef3b4a710> name=None at 7f7ef3b4aa90> -> __value
            __value = _static_140183231309584
            econtext['macroname'] = __value

            # <Value 'load: layouts.pynml' (24:30)> -> __macro
            __token = 933
            __macro = ' layouts.pynml'
            __macro = __loader(__macro)
            __token = 933
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140183230395336 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140183230395336
            __append('\n\n')
            __backup_macroname_140183230395272 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f7ef3b4a470> name=None at 7f7ef3b4a400> -> __value
            __value = _static_140183231308912
            econtext['macroname'] = __value

            # <Value 'load: produce_secondary.pynml' (26:30)> -> __macro
            __token = 988
            __macro = ' produce_secondary.pynml'
            __macro = __loader(__macro)
            __token = 988
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140183230395272 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140183230395272
            __append('\n\n')
            __backup_macroname_140183230395848 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f7ef3b4ab70> name=None at 7f7ef3b4a7b8> -> __value
            __value = _static_140183231310704
            econtext['macroname'] = __value

            # <Value 'load: closure_secondary.pynml' (28:30)> -> __macro
            __token = 1053
            __macro = ' closure_secondary.pynml'
            __macro = __loader(__macro)
            __token = 1053
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140183230395848 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140183230395848
            __append('\n\n')
            __backup_macroname_140183230738312 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f7ef3b4a390> name=None at 7f7ef3b4a3c8> -> __value
            __value = _static_140183231308688
            econtext['macroname'] = __value

            # <Value 'load: extra_text_secondary.pynml' (30:30)> -> __macro
            __token = 1118
            __macro = ' extra_text_secondary.pynml'
            __macro = __loader(__macro)
            __token = 1118
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140183230738312 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140183230738312
            __append('\n\n')
            __backup_macroname_140183230990152 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f7ef3b06b70> name=None at 7f7ef3b06438> -> __value
            __value = _static_140183231032176
            econtext['macroname'] = __value

            # <Value 'load: availability.pynml' (32:30)> -> __macro
            __token = 1186
            __macro = ' availability.pynml'
            __macro = __loader(__macro)
            __token = 1186
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140183230990152 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140183230990152
            __append('\n\n')
            __backup_location_checks_industry_140183230857736 = get('location_checks_industry', __marker)

            # <Value 'load: location_check_macros_industry.pynml' (34:46)> -> __value
            __token = 1262
            __value = ' location_check_macros_industry.pynml'
            __value = __loader(__value)
            econtext['location_checks_industry'] = __value
            __backup_macroname_140183230693192 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f7ef3b06d30> name=None at 7f7ef3b06ac8> -> __value
            __value = _static_140183231032624
            econtext['macroname'] = __value

            # <Value "location_checks_industry.macros['render_tree']" (35:30)> -> __macro
            __token = 1336
            __macro = _lookup_attr(getitem('location_checks_industry'), 'macros')['render_tree']
            __token = 1336
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140183230693192 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140183230693192
            if (__backup_location_checks_industry_140183230857736 is __marker):
                del econtext['location_checks_industry']
            else:
                econtext['location_checks_industry'] = __backup_location_checks_industry_140183230857736
            __append('\n\n')
            __backup_macroname_140183230691976 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f7ef3b06240> name=None at 7f7ef3b06400> -> __value
            __value = _static_140183231029824
            econtext['macroname'] = __value

            # <Value 'load: properties_industry.pynml' (37:30)> -> __macro
            __token = 1418
            __macro = ' properties_industry.pynml'
            __macro = __loader(__macro)
            __token = 1418
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140183230691976 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140183230691976
            __append('\n\n')
            __append('\n')
            __backup_economy_140183231029712 = get('economy', __marker)

            # <Value 'economies' (40:37)> -> __iterator
            __token = 1602
            __iterator = getitem('economies')
            (__iterator, ____index_140183231029320, ) = getitem('repeat')('economy', __iterator)
            econtext['economy'] = None
            for __item in __iterator:
                econtext['economy'] = __item
                __append('\n    ')

                # <Value "industry.get_property('enabled', economy) == True" (41:39)> -> __condition
                __token = 1653
                __condition = (_lookup_attr(getitem('industry'), 'get_property')('enabled', getitem('economy')) == True)
                if __condition:

                    # <Interpolation value=<Substitution '\n        if (economy==${economy.numeric_id}) {\n            item(FEAT_INDUSTRIES, ${industry.id}, ${industry.numeric_id}) {\n                graphics {\n                    construction_probability: ${industry.id}_check_availability;\n                    produce_cargo_arrival:    ${industry.id}_produce;\n                    monthly_prod_change:      ${industry.id}_check_secondary_production_level;\n                    random_prod_change:       ${industry.id}_check_secondary_closure;\n                    location_check:           ${industry.id}_check_location;\n                    extra_text_fund:          ${industry.get_extra_text_fund(economy)};\n                    extra_text_industry:      ${industry.id}_extra_text;\n                    cargo_subtype_display:    ${industry.id}_cargo_subtype_display;\n                    colour:                   switch_colour;\n                }\n            }\n        }\n    ' (41:90)> braces_required=True translation=False at 7f7ef3b062b0> -> __content_140183249773656
                    __token = 1713
                    __token = 1728
                    __content_140183249773656 = _lookup_attr(getitem('economy'), 'numeric_id')
                    __content_140183249773656 = __quote(__content_140183249773656, '\x00', '&#0;', None, False)
                    __token = 1787
                    __content_140183249773656_1785 = _lookup_attr(getitem('industry'), 'id')
                    __content_140183249773656_1785 = __quote(__content_140183249773656_1785, '\x00', '&#0;', None, False)
                    __token = 1803
                    __content_140183249773656_1801 = _lookup_attr(getitem('industry'), 'numeric_id')
                    __content_140183249773656_1801 = __quote(__content_140183249773656_1801, '\x00', '&#0;', None, False)
                    __token = 1902
                    __content_140183249773656_1900 = _lookup_attr(getitem('industry'), 'id')
                    __content_140183249773656_1900 = __quote(__content_140183249773656_1900, '\x00', '&#0;', None, False)
                    __token = 1983
                    __content_140183249773656_1981 = _lookup_attr(getitem('industry'), 'id')
                    __content_140183249773656_1981 = __quote(__content_140183249773656_1981, '\x00', '&#0;', None, False)
                    __token = 2053
                    __content_140183249773656_2051 = _lookup_attr(getitem('industry'), 'id')
                    __content_140183249773656_2051 = __quote(__content_140183249773656_2051, '\x00', '&#0;', None, False)
                    __token = 2148
                    __content_140183249773656_2146 = _lookup_attr(getitem('industry'), 'id')
                    __content_140183249773656_2146 = __quote(__content_140183249773656_2146, '\x00', '&#0;', None, False)
                    __token = 2234
                    __content_140183249773656_2232 = _lookup_attr(getitem('industry'), 'id')
                    __content_140183249773656_2232 = __quote(__content_140183249773656_2232, '\x00', '&#0;', None, False)
                    __token = 2311
                    __content_140183249773656_2309 = _lookup_attr(getitem('industry'), 'get_extra_text_fund')(getitem('economy'))
                    __content_140183249773656_2309 = __quote(__content_140183249773656_2309, '\x00', '&#0;', None, False)
                    __token = 2399
                    __content_140183249773656_2397 = _lookup_attr(getitem('industry'), 'id')
                    __content_140183249773656_2397 = __quote(__content_140183249773656_2397, '\x00', '&#0;', None, False)
                    __token = 2472
                    __content_140183249773656_2470 = _lookup_attr(getitem('industry'), 'id')
                    __content_140183249773656_2470 = __quote(__content_140183249773656_2470, '\x00', '&#0;', None, False)
                    __content_140183249773656 = ('%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s' % ('\n        if (economy==', (__content_140183249773656 if (__content_140183249773656 is not None) else ''), ') {\n            item(FEAT_INDUSTRIES, ', (__content_140183249773656_1785 if (__content_140183249773656_1785 is not None) else ''), ', ', (__content_140183249773656_1801 if (__content_140183249773656_1801 is not None) else ''), ') {\n                graphics {\n                    construction_probability: ', (__content_140183249773656_1900 if (__content_140183249773656_1900 is not None) else ''), '_check_availability;\n                    produce_cargo_arrival:    ', (__content_140183249773656_1981 if (__content_140183249773656_1981 is not None) else ''), '_produce;\n                    monthly_prod_change:      ', (__content_140183249773656_2051 if (__content_140183249773656_2051 is not None) else ''), '_check_secondary_production_level;\n                    random_prod_change:       ', (__content_140183249773656_2146 if (__content_140183249773656_2146 is not None) else ''), '_check_secondary_closure;\n                    location_check:           ', (__content_140183249773656_2232 if (__content_140183249773656_2232 is not None) else ''), '_check_location;\n                    extra_text_fund:          ', (__content_140183249773656_2309 if (__content_140183249773656_2309 is not None) else ''), ';\n                    extra_text_industry:      ', (__content_140183249773656_2397 if (__content_140183249773656_2397 is not None) else ''), '_extra_text;\n                    cargo_subtype_display:    ', (__content_140183249773656_2470 if (__content_140183249773656_2470 is not None) else ''), '_cargo_subtype_display;\n                    colour:                   switch_colour;\n                }\n            }\n        }\n    ', ))
                    if (__content_140183249773656 is None):
                        pass
                    else:
                        if (__content_140183249773656 is False):
                            __content_140183249773656 = None
                        else:
                            __tt = type(__content_140183249773656)
                            if ((__tt is int) or (__tt is float) or (__tt is int)):
                                __content_140183249773656 = str(__content_140183249773656)
                            else:
                                if (__tt is bytes):
                                    __content_140183249773656 = decode(__content_140183249773656)
                                else:
                                    if (__tt is not str):
                                        try:
                                            __content_140183249773656 = __content_140183249773656.__html__
                                        except get('AttributeError', AttributeError):
                                            __converted = convert(__content_140183249773656)
                                            __content_140183249773656 = (str(__content_140183249773656) if (__content_140183249773656 is __converted) else __converted)
                                        else:
                                            __content_140183249773656 = __content_140183249773656()
                    if (__content_140183249773656 is not None):
                        __append(__content_140183249773656)
                __append('\n')
                ____index_140183231029320 -= 1
                if (____index_140183231029320 > 0):
                    __append('')
            if (__backup_economy_140183231029712 is __marker):
                del econtext['economy']
            else:
                econtext['economy'] = __backup_economy_140183231029712
            __append('\n')
        except:
            if (__token is not None):
                rcontext.setdefault('__error__', []).append((__tokens[__token] + (__filename, _exc_info()[1], )))
            raise
    def render(__stream, econtext, rcontext, __i18n_domain=None, __i18n_context=None):
        __append = __stream.append
        __re_amp = g_re_amp
        __token = None
        __re_needs_escape = g_re_needs_escape

        def __convert(target):
            if (target is None):
                return
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except AttributeError:
                            __converted = convert(target)
                            target = (str(target) if (target is __converted) else __converted)
                        else:
                            target = target()
            return target

        def __quote(target, quote, quote_entity, default, default_marker):
            if (target is None):
                return
            if (target is default_marker):
                return default
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except:
                            __converted = convert(target)
                            target = (str(target) if (target is __converted) else __converted)
                        else:
                            return target()
                if (target is not None):
                    try:
                        escape = (__re_needs_escape(target) is not None)
                    except TypeError:
                        pass
                    else:
                        if escape:
                            if ('&' in target):
                                target = target.replace('&', '&amp;')
                            if ('<' in target):
                                target = target.replace('<', '&lt;')
                            if ('>' in target):
                                target = target.replace('>', '&gt;')
                            if ((quote is not None) and (quote in target)):
                                target = target.replace(quote, quote_entity)
            return target
        translate = econtext['__translate']
        decode = econtext['__decode']
        convert = econtext['__convert']
        try:
            getitem = econtext.__getitem__
            get = econtext.get

            # <Interpolation value=<Substitution '\n\nswitch(FEAT_INDUSTRIES, SELF, ${industry.id}_extra_text, [\n\tSTORE_TEMP((primary_level1_requirement * ${industry.supply_requirements[2]}) |\n\t(primary_level2_requirement * ${industry.supply_requirements[2]}) ' (1:57)> braces_required=True translation=False at 1e325982208> -> __content_2075086945112
            __token = 59
            __token = 91
            __content_2075086945112 = _lookup_attr(getitem('industry'), 'id')
            __content_2075086945112 = __quote(__content_2075086945112, '\x00', '&#0;', None, False)
            __token = 162
            __content_2075086945112_160 = _lookup_attr(getitem('industry'), 'supply_requirements')[2]
            __content_2075086945112_160 = __quote(__content_2075086945112_160, '\x00', '&#0;', None, False)
            __token = 231
            __content_2075086945112_229 = _lookup_attr(getitem('industry'), 'supply_requirements')[2]
            __content_2075086945112_229 = __quote(__content_2075086945112_229, '\x00', '&#0;', None, False)
            __content_2075086945112 = ('%s%s%s%s%s%s%s' % ('\n\nswitch(FEAT_INDUSTRIES, SELF, ', (__content_2075086945112 if (__content_2075086945112 is not None) else ''), '_extra_text, [\n\tSTORE_TEMP((primary_level1_requirement * ', (__content_2075086945112_160 if (__content_2075086945112_160 is not None) else ''), ') |\n\t(primary_level2_requirement * ', (__content_2075086945112_229 if (__content_2075086945112_229 is not None) else ''), ') ', ))
            if (__content_2075086945112 is None):
                pass
            else:
                if (__content_2075086945112 is False):
                    __content_2075086945112 = None
                else:
                    __tt = type(__content_2075086945112)
                    if ((__tt is int) or (__tt is float) or (__tt is int)):
                        __content_2075086945112 = str(__content_2075086945112)
                    else:
                        if (__tt is bytes):
                            __content_2075086945112 = decode(__content_2075086945112)
                        else:
                            if (__tt is not str):
                                try:
                                    __content_2075086945112 = __content_2075086945112.__html__
                                except get('AttributeError', AttributeError):
                                    __converted = convert(__content_2075086945112)
                                    __content_2075086945112 = (str(__content_2075086945112) if (__content_2075086945112 is __converted) else __converted)
                                else:
                                    __content_2075086945112 = __content_2075086945112()
            if (__content_2075086945112 is not None):
                __append(__content_2075086945112)
            __append('<')
            __append('<')

            # <Interpolation value=<Substitution ' 16, 0x100),\n\tLOAD_PERM(${industry.perm_storage.var_current_supplies_prod_factor})\n]) {\n\tprimary_level2_bonus: return string(STR_${industry.supply_requirements[1]}_PRODUCTION_4X);\n\tprimary_level1_bonus: return string(STR_${industry.supply_requirements[1]}_PRODUCTION_2X);\n\treturn string(STR_${industry.supply_requirements[1]}_PRODUCTION_1X);\n}\n\n' (5:69)> braces_required=True translation=False at 1e3259b1518> -> __content_2075086945112
            __token = 268
            __token = 293
            __content_2075086945112 = _lookup_attr(_lookup_attr(getitem('industry'), 'perm_storage'), 'var_current_supplies_prod_factor')
            __content_2075086945112 = __quote(__content_2075086945112, '\x00', '&#0;', None, False)
            __token = 398
            __content_2075086945112_396 = _lookup_attr(getitem('industry'), 'supply_requirements')[1]
            __content_2075086945112_396 = __quote(__content_2075086945112_396, '\x00', '&#0;', None, False)
            __token = 490
            __content_2075086945112_488 = _lookup_attr(getitem('industry'), 'supply_requirements')[1]
            __content_2075086945112_488 = __quote(__content_2075086945112_488, '\x00', '&#0;', None, False)
            __token = 560
            __content_2075086945112_558 = _lookup_attr(getitem('industry'), 'supply_requirements')[1]
            __content_2075086945112_558 = __quote(__content_2075086945112_558, '\x00', '&#0;', None, False)
            __content_2075086945112 = ('%s%s%s%s%s%s%s%s%s' % (' 16, 0x100),\n\tLOAD_PERM(', (__content_2075086945112 if (__content_2075086945112 is not None) else ''), ')\n]) {\n\tprimary_level2_bonus: return string(STR_', (__content_2075086945112_396 if (__content_2075086945112_396 is not None) else ''), '_PRODUCTION_4X);\n\tprimary_level1_bonus: return string(STR_', (__content_2075086945112_488 if (__content_2075086945112_488 is not None) else ''), '_PRODUCTION_2X);\n\treturn string(STR_', (__content_2075086945112_558 if (__content_2075086945112_558 is not None) else ''), '_PRODUCTION_1X);\n}\n\n', ))
            if (__content_2075086945112 is None):
                pass
            else:
                if (__content_2075086945112 is False):
                    __content_2075086945112 = None
                else:
                    __tt = type(__content_2075086945112)
                    if ((__tt is int) or (__tt is float) or (__tt is int)):
                        __content_2075086945112 = str(__content_2075086945112)
                    else:
                        if (__tt is bytes):
                            __content_2075086945112 = decode(__content_2075086945112)
                        else:
                            if (__tt is not str):
                                try:
                                    __content_2075086945112 = __content_2075086945112.__html__
                                except get('AttributeError', AttributeError):
                                    __converted = convert(__content_2075086945112)
                                    __content_2075086945112 = (str(__content_2075086945112) if (__content_2075086945112 is __converted) else __converted)
                                else:
                                    __content_2075086945112 = __content_2075086945112()
            if (__content_2075086945112 is not None):
                __append(__content_2075086945112)

            # <Interpolation value=<Substitution '\n\nswitch (FEAT_INDUSTRIES, SELF, ${industry.id}_cargo_subtype_display, 1) {\n    return 0x3800 + string(STR_EMPTY);\n}\n' (16:3)> braces_required=True translation=False at 1e3259b1160> -> __content_2075086945112
            __token = 834
            __token = 867
            __content_2075086945112 = _lookup_attr(getitem('industry'), 'id')
            __content_2075086945112 = __quote(__content_2075086945112, '\x00', '&#0;', None, False)
            __content_2075086945112 = ('%s%s%s' % ('\n\nswitch (FEAT_INDUSTRIES, SELF, ', (__content_2075086945112 if (__content_2075086945112 is not None) else ''), '_cargo_subtype_display, 1) {\n    return 0x3800 + string(STR_EMPTY);\n}\n', ))
            if (__content_2075086945112 is None):
                pass
            else:
                if (__content_2075086945112 is False):
                    __content_2075086945112 = None
                else:
                    __tt = type(__content_2075086945112)
                    if ((__tt is int) or (__tt is float) or (__tt is int)):
                        __content_2075086945112 = str(__content_2075086945112)
                    else:
                        if (__tt is bytes):
                            __content_2075086945112 = decode(__content_2075086945112)
                        else:
                            if (__tt is not str):
                                try:
                                    __content_2075086945112 = __content_2075086945112.__html__
                                except get('AttributeError', AttributeError):
                                    __converted = convert(__content_2075086945112)
                                    __content_2075086945112 = (str(__content_2075086945112) if (__content_2075086945112 is __converted) else __converted)
                                else:
                                    __content_2075086945112 = __content_2075086945112()
            if (__content_2075086945112 is not None):
                __append(__content_2075086945112)
        except:
            if (__token is not None):
                rcontext.setdefault('__error__', []).append((__tokens[__token] + (__filename, _exc_info()[1], )))
            raise
コード例 #17
0
    def render(__stream,
               econtext,
               rcontext,
               __i18n_domain=None,
               __i18n_context=None):
        __append = __stream.append
        __re_amp = g_re_amp
        __token = None
        __re_needs_escape = g_re_needs_escape

        def __convert(target):
            if (target is None):
                return
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except AttributeError:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            target = target()
            return target

        def __quote(target, quote, quote_entity, default, default_marker):
            if (target is None):
                return
            if (target is default_marker):
                return default
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            return target()
                if (target is not None):
                    try:
                        escape = (__re_needs_escape(target) is not None)
                    except TypeError:
                        pass
                    else:
                        if escape:
                            if ('&' in target):
                                target = target.replace('&', '&amp;')
                            if ('<' in target):
                                target = target.replace('<', '&lt;')
                            if ('>' in target):
                                target = target.replace('>', '&gt;')
                            if ((quote is not None) and (quote in target)):
                                target = target.replace(quote, quote_entity)
            return target

        translate = econtext['__translate']
        decode = econtext['__decode']
        convert = econtext['__convert']
        on_error_handler = econtext['__on_error_handler']
        try:
            getitem = econtext.__getitem__
            get = econtext.get
            __append(
                '/* ******************************************************************\n * Definition of the industry tile, its callbacks, and graphics chain\n * ******************************************************************/\n\n'
            )
            __backup_macroname_140166499581512 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f7b0e4c2748> name=None at 7f7b0e4c2e10> -> __value
            __value = _static_140166497576776
            econtext['macroname'] = __value

            # <Value 'load: spritesets.pynml' (5:30)> -> __macro
            __token = 242
            __macro = ' spritesets.pynml'
            __macro = __loader(__macro)
            __token = 242
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140166499581512 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140166499581512
            __append('\n\n')
            __backup_macroname_140166497044488 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f7b0e4c2208> name=None at 7f7b0e4c2710> -> __value
            __value = _static_140166497575432
            econtext['macroname'] = __value

            # <Value 'load: spritelayouts.pynml' (7:30)> -> __macro
            __token = 300
            __macro = ' spritelayouts.pynml'
            __macro = __loader(__macro)
            __token = 300
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140166497044488 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140166497044488
            __append('\n\n')
            __backup_macroname_140166498029064 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f7b0e4c2668> name=None at 7f7b0e4c2048> -> __value
            __value = _static_140166497576552
            econtext['macroname'] = __value

            # <Value 'load: graphics_switches.pynml' (9:30)> -> __macro
            __token = 361
            __macro = ' graphics_switches.pynml'
            __macro = __loader(__macro)
            __token = 361
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140166498029064 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140166498029064
            __append('\n\n')
            __backup_location_checks_tile_140166498397880 = get(
                'location_checks_tile', __marker)

            # <Value 'load: location_check_macros_tile.pynml' (11:42)> -> __value
            __token = 438
            __value = ' location_check_macros_tile.pynml'
            __value = __loader(__value)
            econtext['location_checks_tile'] = __value
            __backup_macroname_140166499336968 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f7b0e4c26d8> name=None at 7f7b0e4c2a20> -> __value
            __value = _static_140166497576664
            econtext['macroname'] = __value

            # <Value "location_checks_tile.macros['render_tree']" (12:30)> -> __macro
            __token = 508
            __macro = _lookup_attr(getitem('location_checks_tile'),
                                   'macros')['render_tree']
            __token = 508
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140166499336968 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140166499336968
            if (__backup_location_checks_tile_140166498397880 is __marker):
                del econtext['location_checks_tile']
            else:
                econtext[
                    'location_checks_tile'] = __backup_location_checks_tile_140166498397880
            __append('\n\n')
            __backup_animation_macros_140166497576048 = get(
                'animation_macros', __marker)

            # <Value 'load: animation_macros.pynml' (14:38)> -> __value
            __token = 594
            __value = ' animation_macros.pynml'
            __value = __loader(__value)
            econtext['animation_macros'] = __value
            __backup_macroname_140166498204104 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f7b0e4c22e8> name=None at 7f7b0e4c28d0> -> __value
            __value = _static_140166497575656
            econtext['macroname'] = __value

            # <Value "animation_macros.macros['tile_animation']" (15:30)> -> __macro
            __token = 654
            __macro = _lookup_attr(getitem('animation_macros'),
                                   'macros')['tile_animation']
            __token = 654
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140166498204104 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140166498204104
            if (__backup_animation_macros_140166497576048 is __marker):
                del econtext['animation_macros']
            else:
                econtext[
                    'animation_macros'] = __backup_animation_macros_140166497576048
            __append('\n\n')
            __backup_macroname_140166498123336 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f7b0e4a77b8> name=None at 7f7b0e4a7cc0> -> __value
            __value = _static_140166497466296
            econtext['macroname'] = __value

            # <Value 'load: properties_tile.pynml' (17:30)> -> __macro
            __token = 731
            __macro = ' properties_tile.pynml'
            __macro = __loader(__macro)
            __token = 731
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140166498123336 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140166498123336
            __append(
                '\n\n\n/* *************************************************\n * Definition of the industry\n * *************************************************/\n\n'
            )
            __backup_macroname_140166498120840 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f7b0e4a71d0> name=None at 7f7b0e4a7d30> -> __value
            __value = _static_140166497464784
            econtext['macroname'] = __value

            # <Value 'load: layouts.pynml' (24:30)> -> __macro
            __token = 933
            __macro = ' layouts.pynml'
            __macro = __loader(__macro)
            __token = 933
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140166498120840 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140166498120840
            __append('\n\n')
            __backup_macroname_140166498041224 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f7b0e4a7278> name=None at 7f7b0e4a70f0> -> __value
            __value = _static_140166497464952
            econtext['macroname'] = __value

            # <Value 'load: availability.pynml' (26:30)> -> __macro
            __token = 988
            __macro = ' availability.pynml'
            __macro = __loader(__macro)
            __token = 988
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140166498041224 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140166498041224
            __append('\n\n')
            __backup_location_checks_industry_140166499219160 = get(
                'location_checks_industry', __marker)

            # <Value 'load: location_check_macros_industry.pynml' (28:46)> -> __value
            __token = 1064
            __value = ' location_check_macros_industry.pynml'
            __value = __loader(__value)
            econtext['location_checks_industry'] = __value
            __backup_macroname_140166499338952 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f7b0e4a7630> name=None at 7f7b0e4a7208> -> __value
            __value = _static_140166497465904
            econtext['macroname'] = __value

            # <Value "location_checks_industry.macros['render_tree']" (29:30)> -> __macro
            __token = 1138
            __macro = _lookup_attr(getitem('location_checks_industry'),
                                   'macros')['render_tree']
            __token = 1138
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140166499338952 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140166499338952
            if (__backup_location_checks_industry_140166499219160 is __marker):
                del econtext['location_checks_industry']
            else:
                econtext[
                    'location_checks_industry'] = __backup_location_checks_industry_140166499219160
            __append('\n\n')
            __backup_macroname_140166499339144 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f7b0e4a77f0> name=None at 7f7b0e4a7d68> -> __value
            __value = _static_140166497466352
            econtext['macroname'] = __value

            # <Value 'load: properties_industry.pynml' (31:30)> -> __macro
            __token = 1220
            __macro = ' properties_industry.pynml'
            __macro = __loader(__macro)
            __token = 1220
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140166499339144 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140166499339144
            __append('\n\n')
            __append('\n')
            __backup_economy_140166499217984 = get('economy', __marker)

            # <Value 'economies' (34:37)> -> __iterator
            __token = 1404
            __iterator = getitem('economies')
            (
                __iterator,
                ____index_140166497468032,
            ) = getitem('repeat')('economy', __iterator)
            econtext['economy'] = None
            for __item in __iterator:
                econtext['economy'] = __item
                __append('\n    ')

                # <Value "industry.get_property('enabled', economy) == True" (35:39)> -> __condition
                __token = 1455
                __condition = (_lookup_attr(
                    getitem('industry'),
                    'get_property')('enabled', getitem('economy')) == True)
                if __condition:

                    # <Interpolation value=<Substitution '\n        if (economy==${economy.numeric_id}) {\n            item(FEAT_INDUSTRIES, ${industry.id}, ${industry.numeric_id}) {\n                graphics {\n                    construction_probability: ${industry.id}_check_availability;\n                    build_prod_change:        randomise_primary_production_on_build;\n                    location_check:           ${industry.id}_check_location;\n                    extra_text_fund:          ${industry.get_extra_text_fund(economy)};\n                    colour:                   switch_colour;\n                }\n            }\n        }\n    ' (35:90)> braces_required=True translation=False at 7f7b0e4a7470> -> __content_140166518101192
                    __token = 1515
                    __token = 1530
                    __content_140166518101192 = _lookup_attr(
                        getitem('economy'), 'numeric_id')
                    __content_140166518101192 = __quote(
                        __content_140166518101192, '\x00', '&#0;', None, False)
                    __token = 1589
                    __content_140166518101192_1587 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_140166518101192_1587 = __quote(
                        __content_140166518101192_1587, '\x00', '&#0;', None,
                        False)
                    __token = 1605
                    __content_140166518101192_1603 = _lookup_attr(
                        getitem('industry'), 'numeric_id')
                    __content_140166518101192_1603 = __quote(
                        __content_140166518101192_1603, '\x00', '&#0;', None,
                        False)
                    __token = 1704
                    __content_140166518101192_1702 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_140166518101192_1702 = __quote(
                        __content_140166518101192_1702, '\x00', '&#0;', None,
                        False)
                    __token = 1870
                    __content_140166518101192_1868 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_140166518101192_1868 = __quote(
                        __content_140166518101192_1868, '\x00', '&#0;', None,
                        False)
                    __token = 1947
                    __content_140166518101192_1945 = _lookup_attr(
                        getitem('industry'),
                        'get_extra_text_fund')(getitem('economy'))
                    __content_140166518101192_1945 = __quote(
                        __content_140166518101192_1945, '\x00', '&#0;', None,
                        False)
                    __content_140166518101192 = ('%s%s%s%s%s%s%s%s%s%s%s%s%s' % (
                        '\n        if (economy==',
                        (__content_140166518101192 if
                         (__content_140166518101192 is not None) else ''),
                        ') {\n            item(FEAT_INDUSTRIES, ',
                        (__content_140166518101192_1587 if
                         (__content_140166518101192_1587 is not None) else ''),
                        ', ',
                        (__content_140166518101192_1603 if
                         (__content_140166518101192_1603 is not None) else ''),
                        ') {\n                graphics {\n                    construction_probability: ',
                        (__content_140166518101192_1702 if
                         (__content_140166518101192_1702 is not None) else ''),
                        '_check_availability;\n                    build_prod_change:        randomise_primary_production_on_build;\n                    location_check:           ',
                        (__content_140166518101192_1868 if
                         (__content_140166518101192_1868 is not None) else ''),
                        '_check_location;\n                    extra_text_fund:          ',
                        (__content_140166518101192_1945 if
                         (__content_140166518101192_1945 is not None) else ''),
                        ';\n                    colour:                   switch_colour;\n                }\n            }\n        }\n    ',
                    ))
                    if (__content_140166518101192 is None):
                        pass
                    else:
                        if (__content_140166518101192 is False):
                            __content_140166518101192 = None
                        else:
                            __tt = type(__content_140166518101192)
                            if ((__tt is int) or (__tt is float)
                                    or (__tt is int)):
                                __content_140166518101192 = str(
                                    __content_140166518101192)
                            else:
                                if (__tt is bytes):
                                    __content_140166518101192 = decode(
                                        __content_140166518101192)
                                else:
                                    if (__tt is not str):
                                        try:
                                            __content_140166518101192 = __content_140166518101192.__html__
                                        except get('AttributeError',
                                                   AttributeError):
                                            __converted = convert(
                                                __content_140166518101192)
                                            __content_140166518101192 = (
                                                str(__content_140166518101192)
                                                if
                                                (__content_140166518101192 is
                                                 __converted) else __converted)
                                        else:
                                            __content_140166518101192 = __content_140166518101192(
                                            )
                    if (__content_140166518101192 is not None):
                        __append(__content_140166518101192)
                __append('\n')
                ____index_140166497468032 -= 1
                if (____index_140166497468032 > 0):
                    __append('')
            if (__backup_economy_140166499217984 is __marker):
                del econtext['economy']
            else:
                econtext['economy'] = __backup_economy_140166499217984
            __append('\n')
        except:
            if (__token is not None):
                rcontext.setdefault('__error__', []).append(
                    (__tokens[__token] + (
                        __filename,
                        _exc_info()[1],
                    )))
            raise
コード例 #18
0
    def render_first_frame_is_0(__stream,
                                econtext,
                                rcontext,
                                __i18n_domain=None,
                                __i18n_context=None):
        __append = __stream.append
        __re_amp = g_re_amp
        __token = None
        __re_needs_escape = g_re_needs_escape

        def __convert(target):
            if (target is None):
                return
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except AttributeError:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            target = target()
            return target

        def __quote(target, quote, quote_entity, default, default_marker):
            if (target is None):
                return
            if (target is default_marker):
                return default
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            return target()
                if (target is not None):
                    try:
                        escape = (__re_needs_escape(target) is not None)
                    except TypeError:
                        pass
                    else:
                        if escape:
                            if ('&' in target):
                                target = target.replace('&', '&amp;')
                            if ('<' in target):
                                target = target.replace('<', '&lt;')
                            if ('>' in target):
                                target = target.replace('>', '&gt;')
                            if ((quote is not None) and (quote in target)):
                                target = target.replace(quote, quote_entity)
            return target

        translate = econtext['__translate']
        decode = econtext['__decode']
        convert = econtext['__convert']
        on_error_handler = econtext['__on_error_handler']
        try:
            getitem = econtext.__getitem__
            get = econtext.get
            __append('\n    ')

            # <Interpolation value=<Substitution '\n    switch(FEAT_INDUSTRYTILES, SELF, ${tile.id}_anim_control, 0) {\n        return 0;\n    }\n' (41:90)> braces_required=True translation=False at 7f3733dd9048> -> __content_139875089167952
            __token = 2041
            __token = 2076
            __content_139875089167952 = _lookup_attr(getitem('tile'), 'id')
            __content_139875089167952 = __quote(__content_139875089167952,
                                                '\x00', '&#0;', None, False)
            __content_139875089167952 = ('%s%s%s' % (
                '\n    switch(FEAT_INDUSTRYTILES, SELF, ',
                (__content_139875089167952 if
                 (__content_139875089167952 is not None) else ''),
                '_anim_control, 0) {\n        return 0;\n    }\n',
            ))
            if (__content_139875089167952 is None):
                pass
            else:
                if (__content_139875089167952 is False):
                    __content_139875089167952 = None
                else:
                    __tt = type(__content_139875089167952)
                    if ((__tt is int) or (__tt is float) or (__tt is int)):
                        __content_139875089167952 = str(
                            __content_139875089167952)
                    else:
                        if (__tt is bytes):
                            __content_139875089167952 = decode(
                                __content_139875089167952)
                        else:
                            if (__tt is not str):
                                try:
                                    __content_139875089167952 = __content_139875089167952.__html__
                                except get('AttributeError', AttributeError):
                                    __converted = convert(
                                        __content_139875089167952)
                                    __content_139875089167952 = (
                                        str(__content_139875089167952) if
                                        (__content_139875089167952 is
                                         __converted) else __converted)
                                else:
                                    __content_139875089167952 = __content_139875089167952(
                                    )
            if (__content_139875089167952 is not None):
                __append(__content_139875089167952)
        except:
            if (__token is not None):
                rcontext.setdefault('__error__', []).append(
                    (__tokens[__token] + (
                        __filename,
                        _exc_info()[1],
                    )))
            raise
コード例 #19
0
def render(stream, econtext, rcontext):
    append = stream.append
    getitem = econtext.__getitem__
    get = econtext.get
    _i18n_domain = None
    re_amp = g_re_amp
    re_needs_escape = g_re_needs_escape
    decode = getitem('decode')
    convert = getitem('convert')
    translate = getitem('translate')
    _backup_attrs_38631760 = get('attrs', _marker)

    # <Static value=<_ast.Dict object at 0x251b2d0> name=None at 251b610> -> _value
    _value = _static_38908624
    econtext['attrs'] = _value

    # <div ... (1:0)
    # --------------------------------------------------------
    append(u'<div')
    _attr_xmlns = u'http://www.w3.org/1999/xhtml'
    if (_attr_xmlns is not None):
        append((u' xmlns="%s"' % _attr_xmlns))
    append(u'>')
    _content_139955154988272 = u'\n  '
    if (_content_139955154988272 is not None):
        append(_content_139955154988272)
    _backup_attrs_39790784 = get('attrs', _marker)

    # <Static value=<_ast.Dict object at 0x236b990> name=None at 236b890> -> _value
    _value = _static_37140880
    econtext['attrs'] = _value

    # <ul ... (3:2)
    # --------------------------------------------------------
    append(u'<ul>')
    _content_139955154988272 = u'\n    '
    if (_content_139955154988272 is not None):
        append(_content_139955154988272)
    _backup_i_35883472 = get('i', _marker)

    # <Expression u'range(3)' (4:112)> -> _iterator
    try:
        _iterator = get('range', range)(3)
    except:
        rcontext.setdefault('__error__', []).append((u'range(3)', 4, 112, '<string>', _sys.exc_info()[1], ))
        raise

    (_iterator, __index_39101072, ) = getitem('repeat')(u'i', _iterator)
    econtext['i'] = None
    for _item in _iterator:
        econtext['i'] = _item
        _backup_attrs_35757664 = get('attrs', _marker)

        # <Static value=<_ast.Dict object at 0x236b690> name=None at 236b490> -> _value
        _value = _static_37140112
        econtext['attrs'] = _value

        # <li ... (4:4)
        # --------------------------------------------------------
        append(u'<li')
        _backup_default_35754928 = get('default', _marker)
        _value = u'${i}-${repeat.i.index}'
        econtext['default'] = _value

        # <Interpolation value=u'${i}-${repeat.i.index}' escape=True at 236b2d0> -> _attr_name

        # <Expression u'i' (4:76)> -> _attr_name
        try:
            _attr_name = getitem('i')
        except:
            rcontext.setdefault('__error__', []).append((u'i', 4, 76, '<string>', _sys.exc_info()[1], ))
            raise


        # <Expression u'repeat.i.index' (4:81)> -> _attr_name_181
        try:
            _attr_name_181 = _lookup_attr(getitem('repeat'), 'i').index
        except:
            rcontext.setdefault('__error__', []).append((u'repeat.i.index', 4, 81, '<string>', _sys.exc_info()[1], ))
            raise

        _attr_name = ('%s%s%s' % ((_attr_name if (_attr_name is not None) else ''), (u'-' if (u'-' is not None) else ''), (_attr_name_181 if (_attr_name_181 is not None) else ''), ))
        if (_attr_name is None):
            pass
        else:
            if (_attr_name is False):
                _attr_name = None
            else:
                _tt = type(_attr_name)
                if ((_tt is int) or (_tt is float) or (_tt is long)):
                    _attr_name = unicode(_attr_name)
                else:
                    try:
                        if (_tt is str):
                            _attr_name = decode(_attr_name)
                        else:
                            if (_tt is not unicode):
                                try:
                                    _attr_name = _attr_name.__html__
                                except:
                                    _attr_name = convert(_attr_name)
                                else:
                                    raise RuntimeError
                    except RuntimeError:
                        _attr_name = _attr_name()
                    else:
                        if ((_attr_name is not None) and (re_needs_escape(_attr_name) is not None)):
                            if ('&' in _attr_name):
                                if (';' in _attr_name):
                                    _attr_name = re_amp.sub('&amp;', _attr_name)
                                else:
                                    _attr_name = _attr_name.replace('&', '&amp;')
                            if ('<' in _attr_name):
                                _attr_name = _attr_name.replace('<', '&lt;')
                            if ('>' in _attr_name):
                                _attr_name = _attr_name.replace('>', '&gt;')
                            if (u'"' in _attr_name):
                                _attr_name = _attr_name.replace(u'"', '&#34;')
        if (_attr_name is not None):
            append((u' name="%s"' % _attr_name))
        if (_backup_default_35754928 is _marker):
            del econtext['default']
        else:
            econtext['default'] = _backup_default_35754928
        _backup_default_35754064 = get('default', _marker)
        _value = None
        econtext['default'] = _value

        # <Expression u"repeat['i'].even()+repeat['i'].odd()" (4:30)> -> _attr_class
        try:
            _attr_class = (getitem('repeat')['i'].even() + getitem('repeat')['i'].odd())
        except:
            rcontext.setdefault('__error__', []).append((u"repeat['i'].even()+repeat['i'].odd()", 4, 30, '<string>', _sys.exc_info()[1], ))
            raise

        if (_attr_class is None):
            pass
        else:
            if (_attr_class is False):
                _attr_class = None
            else:
                _tt = type(_attr_class)
                if ((_tt is int) or (_tt is float) or (_tt is long)):
                    _attr_class = unicode(_attr_class)
                else:
                    try:
                        if (_tt is str):
                            _attr_class = decode(_attr_class)
                        else:
                            if (_tt is not unicode):
                                try:
                                    _attr_class = _attr_class.__html__
                                except:
                                    _attr_class = convert(_attr_class)
                                else:
                                    raise RuntimeError
                    except RuntimeError:
                        _attr_class = _attr_class()
                    else:
                        if ((_attr_class is not None) and (re_needs_escape(_attr_class) is not None)):
                            if ('&' in _attr_class):
                                if (';' in _attr_class):
                                    _attr_class = re_amp.sub('&amp;', _attr_class)
                                else:
                                    _attr_class = _attr_class.replace('&', '&amp;')
                            if ('<' in _attr_class):
                                _attr_class = _attr_class.replace('<', '&lt;')
                            if ('>' in _attr_class):
                                _attr_class = _attr_class.replace('>', '&gt;')
                            if ('"' in _attr_class):
                                _attr_class = _attr_class.replace('"', '&#34;')
        if (_attr_class is not None):
            append((u' class="%s"' % _attr_class))
        if (_backup_default_35754064 is _marker):
            del econtext['default']
        else:
            econtext['default'] = _backup_default_35754064
        append(u'>')
        _backup_default_35756584 = get('default', _marker)

        # <Marker name='default' at 254aed0> -> _value
        _value = _marker_default
        econtext['default'] = _value

        # <Expression u'i' (4:141)> -> _cache_39102928
        try:
            _cache_39102928 = getitem('i')
        except:
            rcontext.setdefault('__error__', []).append((u'i', 4, 141, '<string>', _sys.exc_info()[1], ))
            raise


        # <Identity expression=<Expression u'i' (4:141)> value=<Marker name='default' at 254ab90> at 254aa50> -> _condition
        _expression = _cache_39102928

        # <Marker name='default' at 254ab90> -> _value
        _value = _marker_default
        _condition = (_expression is _value)
        if _condition:
            _backup_attrs_35754712 = get('attrs', _marker)

            # <Static value=<_ast.Dict object at 0x254a8d0> name=None at 254a110> -> _value
            _value = _static_39102672
            econtext['attrs'] = _value

            # <span ... (4:122)
            # --------------------------------------------------------
            append(u'<span />')
            if (_backup_attrs_35754712 is _marker):
                del econtext['attrs']
            else:
                econtext['attrs'] = _backup_attrs_35754712
        else:
            _content = _cache_39102928
            if (_content is None):
                pass
            else:
                if (_content is False):
                    _content = None
                else:
                    _tt = type(_content)
                    if ((_tt is int) or (_tt is float) or (_tt is long)):
                        _content = unicode(_content)
                    else:
                        try:
                            if (_tt is str):
                                _content = decode(_content)
                            else:
                                if (_tt is not unicode):
                                    try:
                                        _content = _content.__html__
                                    except:
                                        _content = convert(_content)
                                    else:
                                        raise RuntimeError
                        except RuntimeError:
                            _content = _content()
                        else:
                            if ((_content is not None) and (re_needs_escape(_content) is not None)):
                                if ('&' in _content):
                                    if (';' in _content):
                                        _content = re_amp.sub('&amp;', _content)
                                    else:
                                        _content = _content.replace('&', '&amp;')
                                if ('<' in _content):
                                    _content = _content.replace('<', '&lt;')
                                if ('>' in _content):
                                    _content = _content.replace('>', '&gt;')
                                if ('\x00' in _content):
                                    _content = _content.replace('\x00', '&#34;')
            if (_content is not None):
                append(_content)
        if (_backup_default_35756584 is _marker):
            del econtext['default']
        else:
            econtext['default'] = _backup_default_35756584
        append(u'</li>')
        if (_backup_attrs_35757664 is _marker):
            del econtext['attrs']
        else:
            econtext['attrs'] = _backup_attrs_35757664
        __index_39101072 -= 1
        if (__index_39101072 > 0):
            append('\n    ')
    if (_backup_i_35883472 is _marker):
        del econtext['i']
    else:
        econtext['i'] = _backup_i_35883472
    _content_139955154988272 = u'\n  '
    if (_content_139955154988272 is not None):
        append(_content_139955154988272)
    append(u'</ul>')
    if (_backup_attrs_39790784 is _marker):
        del econtext['attrs']
    else:
        econtext['attrs'] = _backup_attrs_39790784
    _content_139955154988272 = u'\n  '
    if (_content_139955154988272 is not None):
        append(_content_139955154988272)
    _backup_attrs_35754496 = get('attrs', _marker)

    # <Static value=<_ast.Dict object at 0x254aa10> name=None at 254ac90> -> _value
    _value = _static_39102992
    econtext['attrs'] = _value

    # <ul ... (6:2)
    # --------------------------------------------------------
    append(u'<ul>')
    _content_139955154988272 = u'\n    '
    if (_content_139955154988272 is not None):
        append(_content_139955154988272)
    _backup_i_40028112 = get('i', _marker)

    # <Expression u'range(3)' (8:22)> -> _iterator
    try:
        _iterator = get('range', range)(3)
    except:
        rcontext.setdefault('__error__', []).append((u'range(3)', 8, 22, '<string>', _sys.exc_info()[1], ))
        raise

    (_iterator, __index_38403088, ) = getitem('repeat')(u'i', _iterator)
    econtext['i'] = None
    for _item in _iterator:
        econtext['i'] = _item
        _backup_attrs_35756368 = get('attrs', _marker)

        # <Static value=<_ast.Dict object at 0x254add0> name=None at 254aad0> -> _value
        _value = _static_39103952
        econtext['attrs'] = _value

        # <li ... (7:4)
        # --------------------------------------------------------
        append(u'<li')
        _backup_default_35757088 = get('default', _marker)
        _value = None
        econtext['default'] = _value

        # <Expression u"repeat['i'].even+repeat['i'].odd" (7:30)> -> _attr_class
        try:
            _attr_class = (getitem('repeat')['i'].even + getitem('repeat')['i'].odd)
        except:
            rcontext.setdefault('__error__', []).append((u"repeat['i'].even+repeat['i'].odd", 7, 30, '<string>', _sys.exc_info()[1], ))
            raise

        if (_attr_class is None):
            pass
        else:
            if (_attr_class is False):
                _attr_class = None
            else:
                _tt = type(_attr_class)
                if ((_tt is int) or (_tt is float) or (_tt is long)):
                    _attr_class = unicode(_attr_class)
                else:
                    try:
                        if (_tt is str):
                            _attr_class = decode(_attr_class)
                        else:
                            if (_tt is not unicode):
                                try:
                                    _attr_class = _attr_class.__html__
                                except:
                                    _attr_class = convert(_attr_class)
                                else:
                                    raise RuntimeError
                    except RuntimeError:
                        _attr_class = _attr_class()
                    else:
                        if ((_attr_class is not None) and (re_needs_escape(_attr_class) is not None)):
                            if ('&' in _attr_class):
                                if (';' in _attr_class):
                                    _attr_class = re_amp.sub('&amp;', _attr_class)
                                else:
                                    _attr_class = _attr_class.replace('&', '&amp;')
                            if ('<' in _attr_class):
                                _attr_class = _attr_class.replace('<', '&lt;')
                            if ('>' in _attr_class):
                                _attr_class = _attr_class.replace('>', '&gt;')
                            if ('"' in _attr_class):
                                _attr_class = _attr_class.replace('"', '&#34;')
        if (_attr_class is not None):
            append((u' class="%s"' % _attr_class))
        if (_backup_default_35757088 is _marker):
            del econtext['default']
        else:
            econtext['default'] = _backup_default_35757088
        append(u'>')
        _backup_default_36681632 = get('default', _marker)

        # <Marker name='default' at 2521fd0> -> _value
        _value = _marker_default
        econtext['default'] = _value

        # <Expression u'i' (8:51)> -> _cache_38935952
        try:
            _cache_38935952 = getitem('i')
        except:
            rcontext.setdefault('__error__', []).append((u'i', 8, 51, '<string>', _sys.exc_info()[1], ))
            raise


        # <Identity expression=<Expression u'i' (8:51)> value=<Marker name='default' at 2521950> at 2521d10> -> _condition
        _expression = _cache_38935952

        # <Marker name='default' at 2521950> -> _value
        _value = _marker_default
        _condition = (_expression is _value)
        if _condition:
            _backup_attrs_36679832 = get('attrs', _marker)

            # <Static value=<_ast.Dict object at 0x2521e90> name=None at 249f050> -> _value
            _value = _static_38936208
            econtext['attrs'] = _value

            # <span ... (8:32)
            # --------------------------------------------------------
            append(u'<span />')
            if (_backup_attrs_36679832 is _marker):
                del econtext['attrs']
            else:
                econtext['attrs'] = _backup_attrs_36679832
        else:
            _content = _cache_38935952
            if (_content is None):
                pass
            else:
                if (_content is False):
                    _content = None
                else:
                    _tt = type(_content)
                    if ((_tt is int) or (_tt is float) or (_tt is long)):
                        _content = unicode(_content)
                    else:
                        try:
                            if (_tt is str):
                                _content = decode(_content)
                            else:
                                if (_tt is not unicode):
                                    try:
                                        _content = _content.__html__
                                    except:
                                        _content = convert(_content)
                                    else:
                                        raise RuntimeError
                        except RuntimeError:
                            _content = _content()
                        else:
                            if ((_content is not None) and (re_needs_escape(_content) is not None)):
                                if ('&' in _content):
                                    if (';' in _content):
                                        _content = re_amp.sub('&amp;', _content)
                                    else:
                                        _content = _content.replace('&', '&amp;')
                                if ('<' in _content):
                                    _content = _content.replace('<', '&lt;')
                                if ('>' in _content):
                                    _content = _content.replace('>', '&gt;')
                                if ('\x00' in _content):
                                    _content = _content.replace('\x00', '&#34;')
            if (_content is not None):
                append(_content)
        if (_backup_default_36681632 is _marker):
            del econtext['default']
        else:
            econtext['default'] = _backup_default_36681632
        append(u'</li>')
        if (_backup_attrs_35756368 is _marker):
            del econtext['attrs']
        else:
            econtext['attrs'] = _backup_attrs_35756368
        __index_38403088 -= 1
        if (__index_38403088 > 0):
            append('\n    ')
    if (_backup_i_40028112 is _marker):
        del econtext['i']
    else:
        econtext['i'] = _backup_i_40028112
    _content_139955154988272 = u'\n  '
    if (_content_139955154988272 is not None):
        append(_content_139955154988272)
    append(u'</ul>')
    if (_backup_attrs_35754496 is _marker):
        del econtext['attrs']
    else:
        econtext['attrs'] = _backup_attrs_35754496
    _content_139955154988272 = u'\n  '
    if (_content_139955154988272 is not None):
        append(_content_139955154988272)
    _backup_attrs_36680552 = get('attrs', _marker)

    # <Static value=<_ast.Dict object at 0x2521b10> name=None at 2521f90> -> _value
    _value = _static_38935312
    econtext['attrs'] = _value

    # <ul ... (10:2)
    # --------------------------------------------------------
    append(u'<ul>')
    _content_139955154988272 = u'\n    '
    if (_content_139955154988272 is not None):
        append(_content_139955154988272)
    _backup_i_35203664 = get('i', _marker)

    # <Expression u'range(3)' (11:22)> -> _iterator
    try:
        _iterator = get('range', range)(3)
    except:
        rcontext.setdefault('__error__', []).append((u'range(3)', 11, 22, '<string>', _sys.exc_info()[1], ))
        raise

    (_iterator, __index_38934352, ) = getitem('repeat')(u'i', _iterator)
    econtext['i'] = None
    for _item in _iterator:
        econtext['i'] = _item
        _backup_attrs_36746592 = get('attrs', _marker)

        # <Static value=<_ast.Dict object at 0x2521a10> name=None at 2521550> -> _value
        _value = _static_38935056
        econtext['attrs'] = _value

        # <li ... (11:4)
        # --------------------------------------------------------
        append(u'<li>')

        # <Expression u"repeat['i'].even" (11:53)> -> _condition
        try:
            _condition = getitem('repeat')['i'].even
        except:
            rcontext.setdefault('__error__', []).append((u"repeat['i'].even", 11, 53, '<string>', _sys.exc_info()[1], ))
            raise

        if _condition:
            _backup_default_39092096 = get('default', _marker)

            # <Marker name='default' at 2521150> -> _value
            _value = _marker_default
            econtext['default'] = _value

            # <Expression u"repeat['i'].even" (11:84)> -> _cache_38932752
            try:
                _cache_38932752 = getitem('repeat')['i'].even
            except:
                rcontext.setdefault('__error__', []).append((u"repeat['i'].even", 11, 84, '<string>', _sys.exc_info()[1], ))
                raise


            # <Identity expression=<Expression u"repeat['i'].even" (11:84)> value=<Marker name='default' at 2521390> at 25214d0> -> _condition
            _expression = _cache_38932752

            # <Marker name='default' at 2521390> -> _value
            _value = _marker_default
            _condition = (_expression is _value)
            if _condition:
                _backup_attrs_39088424 = get('attrs', _marker)

                # <Static value=<_ast.Dict object at 0x2521790> name=None at 25217d0> -> _value
                _value = _static_38934416
                econtext['attrs'] = _value

                # <span ... (11:32)
                # --------------------------------------------------------
                append(u'<span />')
                if (_backup_attrs_39088424 is _marker):
                    del econtext['attrs']
                else:
                    econtext['attrs'] = _backup_attrs_39088424
            else:
                _content = _cache_38932752
                if (_content is None):
                    pass
                else:
                    if (_content is False):
                        _content = None
                    else:
                        _tt = type(_content)
                        if ((_tt is int) or (_tt is float) or (_tt is long)):
                            _content = unicode(_content)
                        else:
                            try:
                                if (_tt is str):
                                    _content = decode(_content)
                                else:
                                    if (_tt is not unicode):
                                        try:
                                            _content = _content.__html__
                                        except:
                                            _content = convert(_content)
                                        else:
                                            raise RuntimeError
                            except RuntimeError:
                                _content = _content()
                            else:
                                if ((_content is not None) and (re_needs_escape(_content) is not None)):
                                    if ('&' in _content):
                                        if (';' in _content):
                                            _content = re_amp.sub('&amp;', _content)
                                        else:
                                            _content = _content.replace('&', '&amp;')
                                    if ('<' in _content):
                                        _content = _content.replace('<', '&lt;')
                                    if ('>' in _content):
                                        _content = _content.replace('>', '&gt;')
                                    if ('\x00' in _content):
                                        _content = _content.replace('\x00', '&#34;')
                if (_content is not None):
                    append(_content)
            if (_backup_default_39092096 is _marker):
                del econtext['default']
            else:
                econtext['default'] = _backup_default_39092096

        # <Expression u"repeat['i'].odd" (11:125)> -> _condition
        try:
            _condition = getitem('repeat')['i'].odd
        except:
            rcontext.setdefault('__error__', []).append((u"repeat['i'].odd", 11, 125, '<string>', _sys.exc_info()[1], ))
            raise

        if _condition:
            _backup_default_39089000 = get('default', _marker)

            # <Marker name='default' at 262c590> -> _value
            _value = _marker_default
            econtext['default'] = _value

            # <Expression u"repeat['i'].odd" (11:155)> -> _cache_38936400
            try:
                _cache_38936400 = getitem('repeat')['i'].odd
            except:
                rcontext.setdefault('__error__', []).append((u"repeat['i'].odd", 11, 155, '<string>', _sys.exc_info()[1], ))
                raise


            # <Identity expression=<Expression u"repeat['i'].odd" (11:155)> value=<Marker name='default' at 262c0d0> at 262c850> -> _condition
            _expression = _cache_38936400

            # <Marker name='default' at 262c0d0> -> _value
            _value = _marker_default
            _condition = (_expression is _value)
            if _condition:
                _backup_attrs_39091592 = get('attrs', _marker)

                # <Static value=<_ast.Dict object at 0x25213d0> name=None at 2521050> -> _value
                _value = _static_38933456
                econtext['attrs'] = _value

                # <span ... (11:104)
                # --------------------------------------------------------
                append(u'<span />')
                if (_backup_attrs_39091592 is _marker):
                    del econtext['attrs']
                else:
                    econtext['attrs'] = _backup_attrs_39091592
            else:
                _content = _cache_38936400
                if (_content is None):
                    pass
                else:
                    if (_content is False):
                        _content = None
                    else:
                        _tt = type(_content)
                        if ((_tt is int) or (_tt is float) or (_tt is long)):
                            _content = unicode(_content)
                        else:
                            try:
                                if (_tt is str):
                                    _content = decode(_content)
                                else:
                                    if (_tt is not unicode):
                                        try:
                                            _content = _content.__html__
                                        except:
                                            _content = convert(_content)
                                        else:
                                            raise RuntimeError
                            except RuntimeError:
                                _content = _content()
                            else:
                                if ((_content is not None) and (re_needs_escape(_content) is not None)):
                                    if ('&' in _content):
                                        if (';' in _content):
                                            _content = re_amp.sub('&amp;', _content)
                                        else:
                                            _content = _content.replace('&', '&amp;')
                                    if ('<' in _content):
                                        _content = _content.replace('<', '&lt;')
                                    if ('>' in _content):
                                        _content = _content.replace('>', '&gt;')
                                    if ('\x00' in _content):
                                        _content = _content.replace('\x00', '&#34;')
                if (_content is not None):
                    append(_content)
            if (_backup_default_39089000 is _marker):
                del econtext['default']
            else:
                econtext['default'] = _backup_default_39089000
        append(u'</li>')
        if (_backup_attrs_36746592 is _marker):
            del econtext['attrs']
        else:
            econtext['attrs'] = _backup_attrs_36746592
        __index_38934352 -= 1
        if (__index_38934352 > 0):
            append('\n    ')
    if (_backup_i_35203664 is _marker):
        del econtext['i']
    else:
        econtext['i'] = _backup_i_35203664
    _content_139955154988272 = u'\n  '
    if (_content_139955154988272 is not None):
        append(_content_139955154988272)
    append(u'</ul>')
    if (_backup_attrs_36680552 is _marker):
        del econtext['attrs']
    else:
        econtext['attrs'] = _backup_attrs_36680552
    _content_139955154988272 = u'\n'
    if (_content_139955154988272 is not None):
        append(_content_139955154988272)
    append(u'</div>')
    if (_backup_attrs_38631760 is _marker):
        del econtext['attrs']
    else:
        econtext['attrs'] = _backup_attrs_38631760
    _content_139955154988272 = u'\n'
    if (_content_139955154988272 is not None):
        append(_content_139955154988272)
コード例 #20
0
    def render_oil_wells(__stream,
                         econtext,
                         rcontext,
                         __i18n_domain=None,
                         __i18n_context=None):
        __append = __stream.append
        __re_amp = g_re_amp
        __token = None
        __re_needs_escape = g_re_needs_escape

        def __convert(target):
            if (target is None):
                return
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except AttributeError:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            target = target()
            return target

        def __quote(target, quote, quote_entity, default, default_marker):
            if (target is None):
                return
            if (target is default_marker):
                return default
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            return target()
                if (target is not None):
                    try:
                        escape = (__re_needs_escape(target) is not None)
                    except TypeError:
                        pass
                    else:
                        if escape:
                            if ('&' in target):
                                target = target.replace('&', '&amp;')
                            if ('<' in target):
                                target = target.replace('<', '&lt;')
                            if ('>' in target):
                                target = target.replace('>', '&gt;')
                            if ((quote is not None) and (quote in target)):
                                target = target.replace(quote, quote_entity)
            return target

        translate = econtext['__translate']
        decode = econtext['__decode']
        convert = econtext['__convert']
        on_error_handler = econtext['__on_error_handler']
        try:
            getitem = econtext.__getitem__
            get = econtext.get
            __append('\n    ')

            # <Interpolation value=<Substitution "\n    switch (FEAT_INDUSTRYTILES, SELF, ${tile.id}_stop_anim, animation_frame) {\n        1: return 11; // jump to the 'stop animation cycle' when triggered and currently animated\n        2: return 12;\n        3: return 13;\n        4: return 14;\n        5: return 15;\n        6: return 16;\n        7: return 17;\n        8: return 18;\n        9: return 19;\n        10: return 20;\n        return CB_RESULT_DO_NOTHING;\n    }\n\n    switch (FEAT_INDUSTRYTILES, SELF, ${tile.id}_start_anim, animation_frame) {\n        11: return 1;\n        12: return 2;\n        13: return 3;\n        14: return 4;\n        15: return 5;\n        16: return 6;\n        17: return 7;\n        18: return 8;\n        19: return 9;\n        20: return 10;\n        return CB_RESULT_START_ANIMATION;\n    }\n\n    random_switch (FEAT_INDUSTRYTILES, SELF, ${tile.id}_anim_control, bitmask(TRIGGER_INDUSTRYTILE_TILELOOP)) {\n        1: return ${tile.id}_stop_anim;\n        1: return ${tile.id}_start_anim;\n    }\n\n    switch (FEAT_INDUSTRYTILES, SELF, ${tile.custom_animation_next_frame}, animation_frame) {\n        10: return 1;\n        11: return CB_RESULT_STOP_ANIMATION; // Don't actually stop animation, just keep looping the same frame over and over.\n        20: return 11;\n        return CB_RESULT_NEXT_FRAME;\n    }\n" (48:74)> braces_required=True translation=False at 7f3733dd99e8> -> __content_139875089167952
            __token = 2283
            __token = 2319
            __content_139875089167952 = _lookup_attr(getitem('tile'), 'id')
            __content_139875089167952 = __quote(__content_139875089167952,
                                                '\x00', '&#0;', None, False)
            __token = 2739
            __content_139875089167952_2737 = _lookup_attr(
                getitem('tile'), 'id')
            __content_139875089167952_2737 = __quote(
                __content_139875089167952_2737, '\x00', '&#0;', None, False)
            __token = 3096
            __content_139875089167952_3094 = _lookup_attr(
                getitem('tile'), 'id')
            __content_139875089167952_3094 = __quote(
                __content_139875089167952_3094, '\x00', '&#0;', None, False)
            __token = 3181
            __content_139875089167952_3179 = _lookup_attr(
                getitem('tile'), 'id')
            __content_139875089167952_3179 = __quote(
                __content_139875089167952_3179, '\x00', '&#0;', None, False)
            __token = 3221
            __content_139875089167952_3219 = _lookup_attr(
                getitem('tile'), 'id')
            __content_139875089167952_3219 = __quote(
                __content_139875089167952_3219, '\x00', '&#0;', None, False)
            __token = 3289
            __content_139875089167952_3287 = _lookup_attr(
                getitem('tile'), 'custom_animation_next_frame')
            __content_139875089167952_3287 = __quote(
                __content_139875089167952_3287, '\x00', '&#0;', None, False)
            __content_139875089167952 = ('%s%s%s%s%s%s%s%s%s%s%s%s%s' % (
                '\n    switch (FEAT_INDUSTRYTILES, SELF, ',
                (__content_139875089167952 if
                 (__content_139875089167952 is not None) else ''),
                "_stop_anim, animation_frame) {\n        1: return 11; // jump to the 'stop animation cycle' when triggered and currently animated\n        2: return 12;\n        3: return 13;\n        4: return 14;\n        5: return 15;\n        6: return 16;\n        7: return 17;\n        8: return 18;\n        9: return 19;\n        10: return 20;\n        return CB_RESULT_DO_NOTHING;\n    }\n\n    switch (FEAT_INDUSTRYTILES, SELF, ",
                (__content_139875089167952_2737 if
                 (__content_139875089167952_2737 is not None) else ''),
                '_start_anim, animation_frame) {\n        11: return 1;\n        12: return 2;\n        13: return 3;\n        14: return 4;\n        15: return 5;\n        16: return 6;\n        17: return 7;\n        18: return 8;\n        19: return 9;\n        20: return 10;\n        return CB_RESULT_START_ANIMATION;\n    }\n\n    random_switch (FEAT_INDUSTRYTILES, SELF, ',
                (__content_139875089167952_3094 if
                 (__content_139875089167952_3094 is not None) else ''),
                '_anim_control, bitmask(TRIGGER_INDUSTRYTILE_TILELOOP)) {\n        1: return ',
                (__content_139875089167952_3179 if
                 (__content_139875089167952_3179 is not None) else ''),
                '_stop_anim;\n        1: return ',
                (__content_139875089167952_3219 if
                 (__content_139875089167952_3219 is not None) else ''),
                '_start_anim;\n    }\n\n    switch (FEAT_INDUSTRYTILES, SELF, ',
                (__content_139875089167952_3287 if
                 (__content_139875089167952_3287 is not None) else ''),
                ", animation_frame) {\n        10: return 1;\n        11: return CB_RESULT_STOP_ANIMATION; // Don't actually stop animation, just keep looping the same frame over and over.\n        20: return 11;\n        return CB_RESULT_NEXT_FRAME;\n    }\n",
            ))
            if (__content_139875089167952 is None):
                pass
            else:
                if (__content_139875089167952 is False):
                    __content_139875089167952 = None
                else:
                    __tt = type(__content_139875089167952)
                    if ((__tt is int) or (__tt is float) or (__tt is int)):
                        __content_139875089167952 = str(
                            __content_139875089167952)
                    else:
                        if (__tt is bytes):
                            __content_139875089167952 = decode(
                                __content_139875089167952)
                        else:
                            if (__tt is not str):
                                try:
                                    __content_139875089167952 = __content_139875089167952.__html__
                                except get('AttributeError', AttributeError):
                                    __converted = convert(
                                        __content_139875089167952)
                                    __content_139875089167952 = (
                                        str(__content_139875089167952) if
                                        (__content_139875089167952 is
                                         __converted) else __converted)
                                else:
                                    __content_139875089167952 = __content_139875089167952(
                                    )
            if (__content_139875089167952 is not None):
                __append(__content_139875089167952)
        except:
            if (__token is not None):
                rcontext.setdefault('__error__', []).append(
                    (__tokens[__token] + (
                        __filename,
                        _exc_info()[1],
                    )))
            raise
コード例 #21
0
    def render(__stream,
               econtext,
               rcontext,
               __i18n_domain=None,
               __i18n_context=None):
        __append = __stream.append
        __re_amp = g_re_amp
        __token = None
        __re_needs_escape = g_re_needs_escape

        def __convert(target):
            if (target is None):
                return
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except AttributeError:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            target = target()
            return target

        def __quote(target, quote, quote_entity, default, default_marker):
            if (target is None):
                return
            if (target is default_marker):
                return default
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            return target()
                if (target is not None):
                    try:
                        escape = (__re_needs_escape(target) is not None)
                    except TypeError:
                        pass
                    else:
                        if escape:
                            if ('&' in target):
                                target = target.replace('&', '&amp;')
                            if ('<' in target):
                                target = target.replace('<', '&lt;')
                            if ('>' in target):
                                target = target.replace('>', '&gt;')
                            if ((quote is not None) and (quote in target)):
                                target = target.replace(quote, quote_entity)
            return target

        translate = econtext['__translate']
        decode = econtext['__decode']
        convert = econtext['__convert']
        on_error_handler = econtext['__on_error_handler']
        try:
            getitem = econtext.__getitem__
            get = econtext.get
            __append(
                '/* Primary production which is boosted by supplies */\n\n')
            __backup_perm_storage_139703105636280 = get(
                'perm_storage', __marker)

            # <Value 'industry.perm_storage' (3:32)> -> __value
            __token = 87
            __value = _lookup_attr(getitem('industry'), 'perm_storage')
            econtext['perm_storage'] = __value

            # <Interpolation value=<Substitution '\n    produce(${industry.id}_production, 9999, 9999, 9999, 0, 0, 0);\n\n    switch(FEAT_INDUSTRIES, SELF, ${industry.id}_produce, STORE_PERM(waiting_cargo_1 + waiting_cargo_2 + waiting_cargo_3 + LOAD_PERM(${perm_storage.var_num_supplies_delivered}), ${perm_storage.var_num_supplies_delivered})) {\n        ${industry.id}_production;\n    }\n\n    produce(${industry.id}_production_256, 0, 0, 0, LOAD_TEMP(9) * production_rate_1 / 100, LOAD_TEMP(9) * production_rate_2 / 100, 0);\n\n    switch(FEAT_INDUSTRIES, SELF, ${industry.id}_produce_256_ticks,\n            [STORE_TEMP(\n                LOAD_PERM(${perm_storage.var_num_supplies_delivered}) +\n                LOAD_PERM(${perm_storage.var_num_supplies_delivered_last}) +\n                LOAD_PERM(${perm_storage.var_num_supplies_delivered_bef_last}),\n            8),\n            STORE_TEMP((LOAD_TEMP(8) >= (${industry.supply_requirements[2]} * primary_level2_requirement)) ? primary_level2_bonus :\n                       (LOAD_TEMP(8) >= (${industry.supply_requirements[2]} * primary_level1_requirement)) ? primary_level1_bonus : 0, 9),\n            STORE_PERM(LOAD_TEMP(9), ${perm_storage.var_current_supplies_prod_factor})\n            ]) {\n        ${industry.id}_production_256;\n    }\n' (3:55)> braces_required=True translation=False at 7f0f29f9c6d8> -> __content_139703124559104
            __token = 115
            __token = 125
            __content_139703124559104 = _lookup_attr(getitem('industry'), 'id')
            __content_139703124559104 = __quote(__content_139703124559104,
                                                '\x00', '&#0;', None, False)
            __token = 215
            __content_139703124559104_213 = _lookup_attr(
                getitem('industry'), 'id')
            __content_139703124559104_213 = __quote(
                __content_139703124559104_213, '\x00', '&#0;', None, False)
            __token = 314
            __content_139703124559104_312 = _lookup_attr(
                getitem('perm_storage'), 'var_num_supplies_delivered')
            __content_139703124559104_312 = __quote(
                __content_139703124559104_312, '\x00', '&#0;', None, False)
            __token = 359
            __content_139703124559104_357 = _lookup_attr(
                getitem('perm_storage'), 'var_num_supplies_delivered')
            __content_139703124559104_357 = __quote(
                __content_139703124559104_357, '\x00', '&#0;', None, False)
            __token = 414
            __content_139703124559104_412 = _lookup_attr(
                getitem('industry'), 'id')
            __content_139703124559104_412 = __quote(
                __content_139703124559104_412, '\x00', '&#0;', None, False)
            __token = 460
            __content_139703124559104_458 = _lookup_attr(
                getitem('industry'), 'id')
            __content_139703124559104_458 = __quote(
                __content_139703124559104_458, '\x00', '&#0;', None, False)
            __token = 619
            __content_139703124559104_617 = _lookup_attr(
                getitem('industry'), 'id')
            __content_139703124559104_617 = __quote(
                __content_139703124559104_617, '\x00', '&#0;', None, False)
            __token = 704
            __content_139703124559104_702 = _lookup_attr(
                getitem('perm_storage'), 'var_num_supplies_delivered')
            __content_139703124559104_702 = __quote(
                __content_139703124559104_702, '\x00', '&#0;', None, False)
            __token = 776
            __content_139703124559104_774 = _lookup_attr(
                getitem('perm_storage'), 'var_num_supplies_delivered_last')
            __content_139703124559104_774 = __quote(
                __content_139703124559104_774, '\x00', '&#0;', None, False)
            __token = 853
            __content_139703124559104_851 = _lookup_attr(
                getitem('perm_storage'), 'var_num_supplies_delivered_bef_last')
            __content_139703124559104_851 = __quote(
                __content_139703124559104_851, '\x00', '&#0;', None, False)
            __token = 964
            __content_139703124559104_962 = _lookup_attr(
                getitem('industry'), 'supply_requirements')[2]
            __content_139703124559104_962 = __quote(
                __content_139703124559104_962, '\x00', '&#0;', None, False)
            __token = 1096
            __content_139703124559104_1094 = _lookup_attr(
                getitem('industry'), 'supply_requirements')[2]
            __content_139703124559104_1094 = __quote(
                __content_139703124559104_1094, '\x00', '&#0;', None, False)
            __token = 1231
            __content_139703124559104_1229 = _lookup_attr(
                getitem('perm_storage'), 'var_current_supplies_prod_factor')
            __content_139703124559104_1229 = __quote(
                __content_139703124559104_1229, '\x00', '&#0;', None, False)
            __token = 1306
            __content_139703124559104_1304 = _lookup_attr(
                getitem('industry'), 'id')
            __content_139703124559104_1304 = __quote(
                __content_139703124559104_1304, '\x00', '&#0;', None, False)
            __content_139703124559104 = (
                '%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s' %
                (
                    '\n    produce(',
                    (__content_139703124559104 if
                     (__content_139703124559104 is not None) else ''),
                    '_production, 9999, 9999, 9999, 0, 0, 0);\n\n    switch(FEAT_INDUSTRIES, SELF, ',
                    (__content_139703124559104_213 if
                     (__content_139703124559104_213 is not None) else ''),
                    '_produce, STORE_PERM(waiting_cargo_1 + waiting_cargo_2 + waiting_cargo_3 + LOAD_PERM(',
                    (__content_139703124559104_312 if
                     (__content_139703124559104_312 is not None) else ''),
                    '), ',
                    (__content_139703124559104_357 if
                     (__content_139703124559104_357 is not None) else ''),
                    ')) {\n        ',
                    (__content_139703124559104_412 if
                     (__content_139703124559104_412 is not None) else ''),
                    '_production;\n    }\n\n    produce(',
                    (__content_139703124559104_458 if
                     (__content_139703124559104_458 is not None) else ''),
                    '_production_256, 0, 0, 0, LOAD_TEMP(9) * production_rate_1 / 100, LOAD_TEMP(9) * production_rate_2 / 100, 0);\n\n    switch(FEAT_INDUSTRIES, SELF, ',
                    (__content_139703124559104_617 if
                     (__content_139703124559104_617 is not None) else ''),
                    '_produce_256_ticks,\n            [STORE_TEMP(\n                LOAD_PERM(',
                    (__content_139703124559104_702 if
                     (__content_139703124559104_702 is not None) else ''),
                    ') +\n                LOAD_PERM(',
                    (__content_139703124559104_774 if
                     (__content_139703124559104_774 is not None) else ''),
                    ') +\n                LOAD_PERM(',
                    (__content_139703124559104_851 if
                     (__content_139703124559104_851 is not None) else ''),
                    '),\n            8),\n            STORE_TEMP((LOAD_TEMP(8) >= (',
                    (__content_139703124559104_962 if
                     (__content_139703124559104_962 is not None) else ''),
                    ' * primary_level2_requirement)) ? primary_level2_bonus :\n                       (LOAD_TEMP(8) >= (',
                    (__content_139703124559104_1094 if
                     (__content_139703124559104_1094 is not None) else ''),
                    ' * primary_level1_requirement)) ? primary_level1_bonus : 0, 9),\n            STORE_PERM(LOAD_TEMP(9), ',
                    (__content_139703124559104_1229 if
                     (__content_139703124559104_1229 is not None) else ''),
                    ')\n            ]) {\n        ',
                    (__content_139703124559104_1304 if
                     (__content_139703124559104_1304 is not None) else ''),
                    '_production_256;\n    }\n',
                ))
            if (__content_139703124559104 is None):
                pass
            else:
                if (__content_139703124559104 is False):
                    __content_139703124559104 = None
                else:
                    __tt = type(__content_139703124559104)
                    if ((__tt is int) or (__tt is float) or (__tt is int)):
                        __content_139703124559104 = str(
                            __content_139703124559104)
                    else:
                        if (__tt is bytes):
                            __content_139703124559104 = decode(
                                __content_139703124559104)
                        else:
                            if (__tt is not str):
                                try:
                                    __content_139703124559104 = __content_139703124559104.__html__
                                except get('AttributeError', AttributeError):
                                    __converted = convert(
                                        __content_139703124559104)
                                    __content_139703124559104 = (
                                        str(__content_139703124559104) if
                                        (__content_139703124559104 is
                                         __converted) else __converted)
                                else:
                                    __content_139703124559104 = __content_139703124559104(
                                    )
            if (__content_139703124559104 is not None):
                __append(__content_139703124559104)
            if (__backup_perm_storage_139703105636280 is __marker):
                del econtext['perm_storage']
            else:
                econtext[
                    'perm_storage'] = __backup_perm_storage_139703105636280
            __append('\n')
        except:
            if (__token is not None):
                rcontext.setdefault('__error__', []).append(
                    (__tokens[__token] + (
                        __filename,
                        _exc_info()[1],
                    )))
            raise
コード例 #22
0
    def render(__stream, econtext, rcontext, __i18n_domain=None, __i18n_context=None):
        __append = __stream.append
        __re_amp = g_re_amp
        __token = None
        __re_needs_escape = g_re_needs_escape

        def __convert(target):
            if (target is None):
                return
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except AttributeError:
                            __converted = convert(target)
                            target = (str(target) if (target is __converted) else __converted)
                        else:
                            target = target()
            return target

        def __quote(target, quote, quote_entity, default, default_marker):
            if (target is None):
                return
            if (target is default_marker):
                return default
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except:
                            __converted = convert(target)
                            target = (str(target) if (target is __converted) else __converted)
                        else:
                            return target()
                if (target is not None):
                    try:
                        escape = (__re_needs_escape(target) is not None)
                    except TypeError:
                        pass
                    else:
                        if escape:
                            if ('&' in target):
                                target = target.replace('&', '&amp;')
                            if ('<' in target):
                                target = target.replace('<', '&lt;')
                            if ('>' in target):
                                target = target.replace('>', '&gt;')
                            if ((quote is not None) and (quote in target)):
                                target = target.replace(quote, quote_entity)
            return target
        translate = econtext['__translate']
        decode = econtext['__decode']
        convert = econtext['__convert']
        on_error_handler = econtext['__on_error_handler']
        try:
            getitem = econtext.__getitem__
            get = econtext.get
            __append('cargotable {\n    ')
            __backup_cargo_140183257305040 = get('cargo', __marker)

            # <Value 'registered_cargos' (2:41)> -> __iterator
            __token = 54
            __iterator = getitem('registered_cargos')
            (__iterator, ____index_140183231372872, ) = getitem('repeat')('cargo', __iterator)
            econtext['cargo'] = None
            for __item in __iterator:
                econtext['cargo'] = __item

                # <Interpolation value=<Substitution '\n        ${cargo.cargo_label},\n    ' (2:60)> braces_required=True translation=False at 7f7ef3b59c50> -> __content_140183249773656
                __token = 82
                __token = 84
                __content_140183249773656 = _lookup_attr(getitem('cargo'), 'cargo_label')
                __content_140183249773656 = __quote(__content_140183249773656, '\x00', '&#0;', None, False)
                __content_140183249773656 = ('%s%s%s' % ('\n        ', (__content_140183249773656 if (__content_140183249773656 is not None) else ''), ',\n    ', ))
                if (__content_140183249773656 is None):
                    pass
                else:
                    if (__content_140183249773656 is False):
                        __content_140183249773656 = None
                    else:
                        __tt = type(__content_140183249773656)
                        if ((__tt is int) or (__tt is float) or (__tt is int)):
                            __content_140183249773656 = str(__content_140183249773656)
                        else:
                            if (__tt is bytes):
                                __content_140183249773656 = decode(__content_140183249773656)
                            else:
                                if (__tt is not str):
                                    try:
                                        __content_140183249773656 = __content_140183249773656.__html__
                                    except get('AttributeError', AttributeError):
                                        __converted = convert(__content_140183249773656)
                                        __content_140183249773656 = (str(__content_140183249773656) if (__content_140183249773656 is __converted) else __converted)
                                    else:
                                        __content_140183249773656 = __content_140183249773656()
                if (__content_140183249773656 is not None):
                    __append(__content_140183249773656)
                ____index_140183231372872 -= 1
                if (____index_140183231372872 > 0):
                    __append('')
            if (__backup_cargo_140183257305040 is __marker):
                del econtext['cargo']
            else:
                econtext['cargo'] = __backup_cargo_140183257305040
            __append('\n}\n\n')
            __append('\ndisable_item(FEAT_CARGOS, 0, 29);\n')
            __append('\ndisable_item(FEAT_CARGOS, 31, 31);\n\n')
            __backup_cargo_140183257335176 = get('cargo', __marker)

            # <Value 'registered_cargos' (12:26)> -> __iterator
            __token = 411
            __iterator = getitem('registered_cargos')
            (__iterator, ____index_140183231370016, ) = getitem('repeat')('cargo', __iterator)
            econtext['cargo'] = None
            for __item in __iterator:
                econtext['cargo'] = __item

                # <Interpolation value=<Substitution '\n    spriteset(cargoicon_${cargo.id}) {\n        [10 + 20 * ${cargo.icon_indices[0]}, 10 + 20 * ${cargo.icon_indices[1]}, 10, 10, 0, 0, ${"ANIM," if cargo.allow_animated_pixels else None} "src/graphics/other/cargoicons.png"]\n    }\n\n\n    ' (12:45)> braces_required=True translation=False at 7f7ef3b59550> -> __content_140183249773656
                __token = 435
                __token = 457
                __content_140183249773656 = _lookup_attr(getitem('cargo'), 'id')
                __content_140183249773656 = __quote(__content_140183249773656, '\x00', '&#0;', None, False)
                __token = 491
                __content_140183249773656_489 = _lookup_attr(getitem('cargo'), 'icon_indices')[0]
                __content_140183249773656_489 = __quote(__content_140183249773656_489, '\x00', '&#0;', None, False)
                __token = 527
                __content_140183249773656_525 = _lookup_attr(getitem('cargo'), 'icon_indices')[1]
                __content_140183249773656_525 = __quote(__content_140183249773656_525, '\x00', '&#0;', None, False)
                __token = 567
                __content_140183249773656_565 = ('ANIM,' if _lookup_attr(getitem('cargo'), 'allow_animated_pixels') else None)
                __content_140183249773656_565 = __quote(__content_140183249773656_565, '\x00', '&#0;', None, False)
                __content_140183249773656 = ('%s%s%s%s%s%s%s%s%s' % ('\n    spriteset(cargoicon_', (__content_140183249773656 if (__content_140183249773656 is not None) else ''), ') {\n        [10 + 20 * ', (__content_140183249773656_489 if (__content_140183249773656_489 is not None) else ''), ', 10 + 20 * ', (__content_140183249773656_525 if (__content_140183249773656_525 is not None) else ''), ', 10, 10, 0, 0, ', (__content_140183249773656_565 if (__content_140183249773656_565 is not None) else ''), ' "src/graphics/other/cargoicons.png"]\n    }\n\n\n    ', ))
                if (__content_140183249773656 is None):
                    pass
                else:
                    if (__content_140183249773656 is False):
                        __content_140183249773656 = None
                    else:
                        __tt = type(__content_140183249773656)
                        if ((__tt is int) or (__tt is float) or (__tt is int)):
                            __content_140183249773656 = str(__content_140183249773656)
                        else:
                            if (__tt is bytes):
                                __content_140183249773656 = decode(__content_140183249773656)
                            else:
                                if (__tt is not str):
                                    try:
                                        __content_140183249773656 = __content_140183249773656.__html__
                                    except get('AttributeError', AttributeError):
                                        __converted = convert(__content_140183249773656)
                                        __content_140183249773656 = (str(__content_140183249773656) if (__content_140183249773656 is __converted) else __converted)
                                    else:
                                        __content_140183249773656 = __content_140183249773656()
                if (__content_140183249773656 is not None):
                    __append(__content_140183249773656)
                __backup_economy_140183257338376 = get('economy', __marker)

                # <Value 'economies' (18:35)> -> __iterator
                __token = 697
                __iterator = getitem('economies')
                (__iterator, ____index_140183231372592, ) = getitem('repeat')('economy', __iterator)
                econtext['economy'] = None
                for __item in __iterator:
                    econtext['economy'] = __item
                    __append('\n        ')

                    # <Value 'cargo.id in economy.cargos' (19:36)> -> __condition
                    __token = 745
                    __condition = (_lookup_attr(getitem('cargo'), 'id') in _lookup_attr(getitem('economy'), 'cargos'))
                    if __condition:

                        # <Interpolation value=<Substitution '\n            if (economy==${economy.numeric_id}) {\n                ' (19:64)> braces_required=True translation=False at 7f7ef3b59d68> -> __content_140183249773656
                        __token = 786
                        __token = 801
                        __content_140183249773656 = _lookup_attr(getitem('economy'), 'numeric_id')
                        __content_140183249773656 = __quote(__content_140183249773656, '\x00', '&#0;', None, False)
                        __content_140183249773656 = ('%s%s%s' % ('\n            if (economy==', (__content_140183249773656 if (__content_140183249773656 is not None) else ''), ') {\n                ', ))
                        if (__content_140183249773656 is None):
                            pass
                        else:
                            if (__content_140183249773656 is False):
                                __content_140183249773656 = None
                            else:
                                __tt = type(__content_140183249773656)
                                if ((__tt is int) or (__tt is float) or (__tt is int)):
                                    __content_140183249773656 = str(__content_140183249773656)
                                else:
                                    if (__tt is bytes):
                                        __content_140183249773656 = decode(__content_140183249773656)
                                    else:
                                        if (__tt is not str):
                                            try:
                                                __content_140183249773656 = __content_140183249773656.__html__
                                            except get('AttributeError', AttributeError):
                                                __converted = convert(__content_140183249773656)
                                                __content_140183249773656 = (str(__content_140183249773656) if (__content_140183249773656 is __converted) else __converted)
                                            else:
                                                __content_140183249773656 = __content_140183249773656()
                        if (__content_140183249773656 is not None):
                            __append(__content_140183249773656)
                        __backup_macroname_140183230642312 = get('macroname', __marker)

                        # <Static value=<_ast.Str object at 0x7f7ef3b59f60> name=None at 7f7ef3b59c88> -> __value
                        __value = _static_140183231373152
                        econtext['macroname'] = __value

                        # <Value 'load: cargo_props.pynml' (21:46)> -> __macro
                        __token = 870
                        __macro = ' cargo_props.pynml'
                        __macro = __loader(__macro)
                        __token = 870
                        __m = __macro.include
                        __m(__stream, econtext.copy(), rcontext, __i18n_domain)
                        econtext.update(rcontext)
                        if (__backup_macroname_140183230642312 is __marker):
                            del econtext['macroname']
                        else:
                            econtext['macroname'] = __backup_macroname_140183230642312
                        __append('\n            }\n        ')
                    __append('\n    ')
                    ____index_140183231372592 -= 1
                    if (____index_140183231372592 > 0):
                        __append('')
                if (__backup_economy_140183257338376 is __marker):
                    del econtext['economy']
                else:
                    econtext['economy'] = __backup_economy_140183257338376
                __append('\n')
                ____index_140183231370016 -= 1
                if (____index_140183231370016 > 0):
                    __append('')
            if (__backup_cargo_140183257335176 is __marker):
                del econtext['cargo']
            else:
                econtext['cargo'] = __backup_cargo_140183257335176
            __append('\n')
        except:
            if (__token is not None):
                rcontext.setdefault('__error__', []).append((__tokens[__token] + (__filename, _exc_info()[1], )))
            raise
コード例 #23
0
    def render(__stream,
               econtext,
               rcontext,
               __i18n_domain=None,
               __i18n_context=None):
        __append = __stream.append
        __re_amp = g_re_amp
        __token = None
        __re_needs_escape = g_re_needs_escape

        def __convert(target):
            if (target is None):
                return
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except AttributeError:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            target = target()
            return target

        def __quote(target, quote, quote_entity, default, default_marker):
            if (target is None):
                return
            if (target is default_marker):
                return default
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            return target()
                if (target is not None):
                    try:
                        escape = (__re_needs_escape(target) is not None)
                    except TypeError:
                        pass
                    else:
                        if escape:
                            if ('&' in target):
                                target = target.replace('&', '&amp;')
                            if ('<' in target):
                                target = target.replace('<', '&lt;')
                            if ('>' in target):
                                target = target.replace('>', '&gt;')
                            if ((quote is not None) and (quote in target)):
                                target = target.replace(quote, quote_entity)
            return target

        translate = econtext['__translate']
        decode = econtext['__decode']
        convert = econtext['__convert']
        on_error_handler = econtext['__on_error_handler']
        try:
            getitem = econtext.__getitem__
            get = econtext.get
            __append(
                '/* ******************************************************************\n * Definition of the industry tile, its callbacks, and graphics chain\n * ******************************************************************/\n\n'
            )
            __backup_macroname_140383636976776 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7fad9cb5a908> name=None at 7fad9cb5a470> -> __value
            __value = _static_140383635220744
            econtext['macroname'] = __value

            # <Value 'load: spritesets.pynml' (5:30)> -> __macro
            __token = 242
            __macro = ' spritesets.pynml'
            __macro = __loader(__macro)
            __token = 242
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140383636976776 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140383636976776
            __append('\n\n')
            __backup_macroname_140383636979592 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7fad9cb5af28> name=None at 7fad9cb5a208> -> __value
            __value = _static_140383635222312
            econtext['macroname'] = __value

            # <Value 'load: spritelayouts.pynml' (7:30)> -> __macro
            __token = 300
            __macro = ' spritelayouts.pynml'
            __macro = __loader(__macro)
            __token = 300
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140383636979592 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140383636979592
            __append('\n\n')
            __backup_macroname_140383636975688 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7fad9cb5a780> name=None at 7fad9cb5add8> -> __value
            __value = _static_140383635220352
            econtext['macroname'] = __value

            # <Value 'load: graphics_switches.pynml' (9:30)> -> __macro
            __token = 361
            __macro = ' graphics_switches.pynml'
            __macro = __loader(__macro)
            __token = 361
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140383636975688 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140383636975688
            __append('\n\n')
            __backup_location_checks_tile_140383635304576 = get(
                'location_checks_tile', __marker)

            # <Value 'load: location_check_macros_tile.pynml' (11:42)> -> __value
            __token = 438
            __value = ' location_check_macros_tile.pynml'
            __value = __loader(__value)
            econtext['location_checks_tile'] = __value
            __backup_macroname_140383636976392 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7fad9cb5a9b0> name=None at 7fad9cb5a668> -> __value
            __value = _static_140383635220912
            econtext['macroname'] = __value

            # <Value "location_checks_tile.macros['render_tree']" (12:30)> -> __macro
            __token = 508
            __macro = _lookup_attr(getitem('location_checks_tile'),
                                   'macros')['render_tree']
            __token = 508
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140383636976392 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140383636976392
            if (__backup_location_checks_tile_140383635304576 is __marker):
                del econtext['location_checks_tile']
            else:
                econtext[
                    'location_checks_tile'] = __backup_location_checks_tile_140383635304576
            __append('\n\n')
            __backup_animation_macros_140383636916712 = get(
                'animation_macros', __marker)

            # <Value 'load: animation_macros.pynml' (14:38)> -> __value
            __token = 594
            __value = ' animation_macros.pynml'
            __value = __loader(__value)
            econtext['animation_macros'] = __value
            __backup_macroname_140383636021640 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7fad9cb5ada0> name=None at 7fad9cb5a240> -> __value
            __value = _static_140383635221920
            econtext['macroname'] = __value

            # <Value "animation_macros.macros['tile_animation']" (15:30)> -> __macro
            __token = 654
            __macro = _lookup_attr(getitem('animation_macros'),
                                   'macros')['tile_animation']
            __token = 654
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140383636021640 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140383636021640
            if (__backup_animation_macros_140383636916712 is __marker):
                del econtext['animation_macros']
            else:
                econtext[
                    'animation_macros'] = __backup_animation_macros_140383636916712
            __append('\n\n')
            __backup_macroname_140383636025096 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7fad9caddf60> name=None at 7fad9cadd6a0> -> __value
            __value = _static_140383634710368
            econtext['macroname'] = __value

            # <Value 'load: properties_tile.pynml' (17:30)> -> __macro
            __token = 731
            __macro = ' properties_tile.pynml'
            __macro = __loader(__macro)
            __token = 731
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140383636025096 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140383636025096
            __append(
                '\n\n\n/* *************************************************\n * Definition of the industry\n * *************************************************/\n\n'
            )
            __backup_macroname_140383636025032 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7fad9caddc18> name=None at 7fad9cadd6d8> -> __value
            __value = _static_140383634709528
            econtext['macroname'] = __value

            # <Value 'load: layouts.pynml' (24:30)> -> __macro
            __token = 933
            __macro = ' layouts.pynml'
            __macro = __loader(__macro)
            __token = 933
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140383636025032 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140383636025032
            __append('\n\n')
            __backup_macroname_140383636024136 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7fad9caddbe0> name=None at 7fad9cadd748> -> __value
            __value = _static_140383634709472
            econtext['macroname'] = __value

            # <Value 'load: extra_text_primary.pynml' (26:30)> -> __macro
            __token = 988
            __macro = ' extra_text_primary.pynml'
            __macro = __loader(__macro)
            __token = 988
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140383636024136 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140383636024136
            __append('\n\n')
            __backup_macroname_140383640021832 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7fad9cadd358> name=None at 7fad9cadd898> -> __value
            __value = _static_140383634707288
            econtext['macroname'] = __value

            # <Value 'load: produce_primary.pynml' (28:30)> -> __macro
            __token = 1054
            __macro = ' produce_primary.pynml'
            __macro = __loader(__macro)
            __token = 1054
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140383640021832 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140383640021832
            __append('\n\n')
            __backup_macroname_140383636023816 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7fad9cadd7f0> name=None at 7fad9cadda90> -> __value
            __value = _static_140383634708464
            econtext['macroname'] = __value

            # <Value 'load: check_primary_supplies_delivered.pynml' (30:30)> -> __macro
            __token = 1117
            __macro = ' check_primary_supplies_delivered.pynml'
            __macro = __loader(__macro)
            __token = 1117
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140383636023816 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140383636023816
            __append('\n\n')
            __backup_macroname_140383634541960 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7fad9cadd5c0> name=None at 7fad9caddd30> -> __value
            __value = _static_140383634707904
            econtext['macroname'] = __value

            # <Value 'load: availability.pynml' (32:30)> -> __macro
            __token = 1197
            __macro = ' availability.pynml'
            __macro = __loader(__macro)
            __token = 1197
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140383634541960 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140383634541960
            __append('\n\n')
            __backup_location_checks_industry_140383636914416 = get(
                'location_checks_industry', __marker)

            # <Value 'load: location_check_macros_industry.pynml' (34:46)> -> __value
            __token = 1273
            __value = ' location_check_macros_industry.pynml'
            __value = __loader(__value)
            econtext['location_checks_industry'] = __value
            __backup_macroname_140383635892872 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7fad9cadde10> name=None at 7fad9cadd320> -> __value
            __value = _static_140383634710032
            econtext['macroname'] = __value

            # <Value "location_checks_industry.macros['render_tree']" (35:30)> -> __macro
            __token = 1347
            __macro = _lookup_attr(getitem('location_checks_industry'),
                                   'macros')['render_tree']
            __token = 1347
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140383635892872 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140383635892872
            if (__backup_location_checks_industry_140383636914416 is __marker):
                del econtext['location_checks_industry']
            else:
                econtext[
                    'location_checks_industry'] = __backup_location_checks_industry_140383636914416
            __append('\n\n')
            __backup_macroname_140383636342216 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7fad9cadd588> name=None at 7fad9cadd4a8> -> __value
            __value = _static_140383634707848
            econtext['macroname'] = __value

            # <Value 'load: properties_industry.pynml' (37:30)> -> __macro
            __token = 1429
            __macro = ' properties_industry.pynml'
            __macro = __loader(__macro)
            __token = 1429
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140383636342216 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140383636342216
            __append('\n\n')
            __append('\n')
            __backup_economy_140383636914640 = get('economy', __marker)

            # <Value 'economies' (40:37)> -> __iterator
            __token = 1613
            __iterator = getitem('economies')
            (
                __iterator,
                ____index_140383637128920,
            ) = getitem('repeat')('economy', __iterator)
            econtext['economy'] = None
            for __item in __iterator:
                econtext['economy'] = __item
                __append('\n    ')

                # <Value "industry.get_property('enabled', economy) == True" (41:39)> -> __condition
                __token = 1664
                __condition = (_lookup_attr(
                    getitem('industry'),
                    'get_property')('enabled', getitem('economy')) == True)
                if __condition:

                    # <Interpolation value=<Substitution '\n        if (economy==${economy.numeric_id}) {\n            item(FEAT_INDUSTRIES, ${industry.id}, ${industry.numeric_id}) {\n                graphics {\n                    construction_probability: ${industry.id}_check_availability;\n                    build_prod_change:        randomise_primary_production_on_build;\n                    produce_cargo_arrival:    ${industry.id}_produce;\n                    produce_256_ticks:        ${industry.id}_produce_256_ticks;\n                    monthly_prod_change:      ${industry.id}_monthly_update;\n                    random_prod_change:       return CB_RESULT_IND_PROD_NO_CHANGE;\n                    location_check:           ${industry.id}_check_location;\n                    extra_text_fund:          ${industry.get_extra_text_fund(economy)};\n                    extra_text_industry:      ${industry.id}_extra_text;\n                    cargo_subtype_display:    ${industry.id}_cargo_subtype_display;\n                    colour:                   switch_colour;\n                }\n            }\n        }\n    ' (41:90)> braces_required=True translation=False at 7fad9cd2c470> -> __content_140383655711776
                    __token = 1724
                    __token = 1739
                    __content_140383655711776 = _lookup_attr(
                        getitem('economy'), 'numeric_id')
                    __content_140383655711776 = __quote(
                        __content_140383655711776, '\x00', '&#0;', None, False)
                    __token = 1798
                    __content_140383655711776_1796 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_140383655711776_1796 = __quote(
                        __content_140383655711776_1796, '\x00', '&#0;', None,
                        False)
                    __token = 1814
                    __content_140383655711776_1812 = _lookup_attr(
                        getitem('industry'), 'numeric_id')
                    __content_140383655711776_1812 = __quote(
                        __content_140383655711776_1812, '\x00', '&#0;', None,
                        False)
                    __token = 1913
                    __content_140383655711776_1911 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_140383655711776_1911 = __quote(
                        __content_140383655711776_1911, '\x00', '&#0;', None,
                        False)
                    __token = 2079
                    __content_140383655711776_2077 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_140383655711776_2077 = __quote(
                        __content_140383655711776_2077, '\x00', '&#0;', None,
                        False)
                    __token = 2149
                    __content_140383655711776_2147 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_140383655711776_2147 = __quote(
                        __content_140383655711776_2147, '\x00', '&#0;', None,
                        False)
                    __token = 2229
                    __content_140383655711776_2227 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_140383655711776_2227 = __quote(
                        __content_140383655711776_2227, '\x00', '&#0;', None,
                        False)
                    __token = 2389
                    __content_140383655711776_2387 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_140383655711776_2387 = __quote(
                        __content_140383655711776_2387, '\x00', '&#0;', None,
                        False)
                    __token = 2466
                    __content_140383655711776_2464 = _lookup_attr(
                        getitem('industry'),
                        'get_extra_text_fund')(getitem('economy'))
                    __content_140383655711776_2464 = __quote(
                        __content_140383655711776_2464, '\x00', '&#0;', None,
                        False)
                    __token = 2554
                    __content_140383655711776_2552 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_140383655711776_2552 = __quote(
                        __content_140383655711776_2552, '\x00', '&#0;', None,
                        False)
                    __token = 2627
                    __content_140383655711776_2625 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_140383655711776_2625 = __quote(
                        __content_140383655711776_2625, '\x00', '&#0;', None,
                        False)
                    __content_140383655711776 = ('%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s' % (
                        '\n        if (economy==',
                        (__content_140383655711776 if
                         (__content_140383655711776 is not None) else ''),
                        ') {\n            item(FEAT_INDUSTRIES, ',
                        (__content_140383655711776_1796 if
                         (__content_140383655711776_1796 is not None) else ''),
                        ', ',
                        (__content_140383655711776_1812 if
                         (__content_140383655711776_1812 is not None) else ''),
                        ') {\n                graphics {\n                    construction_probability: ',
                        (__content_140383655711776_1911 if
                         (__content_140383655711776_1911 is not None) else ''),
                        '_check_availability;\n                    build_prod_change:        randomise_primary_production_on_build;\n                    produce_cargo_arrival:    ',
                        (__content_140383655711776_2077 if
                         (__content_140383655711776_2077 is not None) else ''),
                        '_produce;\n                    produce_256_ticks:        ',
                        (__content_140383655711776_2147 if
                         (__content_140383655711776_2147 is not None) else ''),
                        '_produce_256_ticks;\n                    monthly_prod_change:      ',
                        (__content_140383655711776_2227 if
                         (__content_140383655711776_2227 is not None) else ''),
                        '_monthly_update;\n                    random_prod_change:       return CB_RESULT_IND_PROD_NO_CHANGE;\n                    location_check:           ',
                        (__content_140383655711776_2387 if
                         (__content_140383655711776_2387 is not None) else ''),
                        '_check_location;\n                    extra_text_fund:          ',
                        (__content_140383655711776_2464 if
                         (__content_140383655711776_2464 is not None) else ''),
                        ';\n                    extra_text_industry:      ',
                        (__content_140383655711776_2552 if
                         (__content_140383655711776_2552 is not None) else ''),
                        '_extra_text;\n                    cargo_subtype_display:    ',
                        (__content_140383655711776_2625 if
                         (__content_140383655711776_2625 is not None) else ''),
                        '_cargo_subtype_display;\n                    colour:                   switch_colour;\n                }\n            }\n        }\n    ',
                    ))
                    if (__content_140383655711776 is None):
                        pass
                    else:
                        if (__content_140383655711776 is False):
                            __content_140383655711776 = None
                        else:
                            __tt = type(__content_140383655711776)
                            if ((__tt is int) or (__tt is float)
                                    or (__tt is int)):
                                __content_140383655711776 = str(
                                    __content_140383655711776)
                            else:
                                if (__tt is bytes):
                                    __content_140383655711776 = decode(
                                        __content_140383655711776)
                                else:
                                    if (__tt is not str):
                                        try:
                                            __content_140383655711776 = __content_140383655711776.__html__
                                        except get('AttributeError',
                                                   AttributeError):
                                            __converted = convert(
                                                __content_140383655711776)
                                            __content_140383655711776 = (
                                                str(__content_140383655711776)
                                                if
                                                (__content_140383655711776 is
                                                 __converted) else __converted)
                                        else:
                                            __content_140383655711776 = __content_140383655711776(
                                            )
                    if (__content_140383655711776 is not None):
                        __append(__content_140383655711776)
                __append('\n')
                ____index_140383637128920 -= 1
                if (____index_140383637128920 > 0):
                    __append('')
            if (__backup_economy_140383636914640 is __marker):
                del econtext['economy']
            else:
                econtext['economy'] = __backup_economy_140383636914640
            __append('\n')
        except:
            if (__token is not None):
                rcontext.setdefault('__error__', []).append(
                    (__tokens[__token] + (
                        __filename,
                        _exc_info()[1],
                    )))
            raise
コード例 #24
0
    def render(__stream,
               econtext,
               rcontext,
               __i18n_domain=None,
               __i18n_context=None):
        __append = __stream.append
        __re_amp = g_re_amp
        __token = None
        __re_needs_escape = g_re_needs_escape

        def __convert(target):
            if (target is None):
                return
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except AttributeError:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            target = target()
            return target

        def __quote(target, quote, quote_entity, default, default_marker):
            if (target is None):
                return
            if (target is default_marker):
                return default
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            return target()
                if (target is not None):
                    try:
                        escape = (__re_needs_escape(target) is not None)
                    except TypeError:
                        pass
                    else:
                        if escape:
                            if ('&' in target):
                                target = target.replace('&', '&amp;')
                            if ('<' in target):
                                target = target.replace('<', '&lt;')
                            if ('>' in target):
                                target = target.replace('>', '&gt;')
                            if ((quote is not None) and (quote in target)):
                                target = target.replace(quote, quote_entity)
            return target

        translate = econtext['__translate']
        decode = econtext['__decode']
        convert = econtext['__convert']
        on_error_handler = econtext['__on_error_handler']
        try:
            getitem = econtext.__getitem__
            get = econtext.get

            # <Interpolation value=<Substitution 'STR_GRF_NAME                                                    :HIS Heavy Industry Set ${makefile_args.repo_version}\n' (1:0)> braces_required=True translation=False at 7f6b196572b0> -> __content_140097982888960
            __token = 0
            __token = 90
            __content_140097982888960 = _lookup_attr(getitem('makefile_args'),
                                                     'repo_version')
            __content_140097982888960 = __quote(__content_140097982888960,
                                                '\x00', '&#0;', None, False)
            __content_140097982888960 = ('%s%s%s' % (
                'STR_GRF_NAME                                                    :HIS Heavy Industry Set ',
                (__content_140097982888960 if
                 (__content_140097982888960 is not None) else ''),
                '\n',
            ))
            if (__content_140097982888960 is None):
                pass
            else:
                if (__content_140097982888960 is False):
                    __content_140097982888960 = None
                else:
                    __tt = type(__content_140097982888960)
                    if ((__tt is int) or (__tt is float) or (__tt is int)):
                        __content_140097982888960 = str(
                            __content_140097982888960)
                    else:
                        if (__tt is bytes):
                            __content_140097982888960 = decode(
                                __content_140097982888960)
                        else:
                            if (__tt is not str):
                                try:
                                    __content_140097982888960 = __content_140097982888960.__html__
                                except get('AttributeError', AttributeError):
                                    __converted = convert(
                                        __content_140097982888960)
                                    __content_140097982888960 = (
                                        str(__content_140097982888960) if
                                        (__content_140097982888960 is
                                         __converted) else __converted)
                                else:
                                    __content_140097982888960 = __content_140097982888960(
                                    )
            if (__content_140097982888960 is not None):
                __append(__content_140097982888960)
            __append(
                '\nSTR_EMPTY                                                       :\n'
            )
        except:
            if (__token is not None):
                rcontext.setdefault('__error__', []).append(
                    (__tokens[__token] + (
                        __filename,
                        _exc_info()[1],
                    )))
            raise
コード例 #25
0
    def render(__stream,
               econtext,
               rcontext,
               __i18n_domain=None,
               __i18n_context=None):
        __append = __stream.append
        __re_amp = g_re_amp
        __token = None
        __re_needs_escape = g_re_needs_escape

        def __convert(target):
            if (target is None):
                return
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except AttributeError:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            target = target()
            return target

        def __quote(target, quote, quote_entity, default, default_marker):
            if (target is None):
                return
            if (target is default_marker):
                return default
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            return target()
                if (target is not None):
                    try:
                        escape = (__re_needs_escape(target) is not None)
                    except TypeError:
                        pass
                    else:
                        if escape:
                            if ('&' in target):
                                target = target.replace('&', '&amp;')
                            if ('<' in target):
                                target = target.replace('<', '&lt;')
                            if ('>' in target):
                                target = target.replace('>', '&gt;')
                            if ((quote is not None) and (quote in target)):
                                target = target.replace(quote, quote_entity)
            return target

        translate = econtext['__translate']
        decode = econtext['__decode']
        convert = econtext['__convert']
        on_error_handler = econtext['__on_error_handler']
        try:
            getitem = econtext.__getitem__
            get = econtext.get
            __append(
                '\n\n/* =================================== */\n/* Production change evaluated monthly */\n/* =================================== */\n'
            )
            __backup_perm_storage_139703105753664 = get(
                'perm_storage', __marker)

            # <Value 'industry.perm_storage' (6:32)> -> __value
            __token = 245
            __value = _lookup_attr(getitem('industry'), 'perm_storage')
            econtext['perm_storage'] = __value

            # <Interpolation value=<Substitution '\n    switch(FEAT_INDUSTRIES, SELF, ${industry.id}_monthly_update, [\n        STORE_PERM(LOAD_PERM(${perm_storage.var_num_supplies_delivered_last}), ${perm_storage.var_num_supplies_delivered_bef_last}),\n        STORE_PERM(LOAD_PERM(${perm_storage.var_num_supplies_delivered}), ${perm_storage.var_num_supplies_delivered_last}),\n        STORE_PERM(0, ${perm_storage.var_num_supplies_delivered})\n    ]) {\n        return CB_RESULT_IND_PROD_NO_CHANGE;\n    }\n' (6:55)> braces_required=True translation=False at 7f0f29f9cdd8> -> __content_139703124559104
            __token = 273
            __token = 305
            __content_139703124559104 = _lookup_attr(getitem('industry'), 'id')
            __content_139703124559104 = __quote(__content_139703124559104,
                                                '\x00', '&#0;', None, False)
            __token = 367
            __content_139703124559104_365 = _lookup_attr(
                getitem('perm_storage'), 'var_num_supplies_delivered_last')
            __content_139703124559104_365 = __quote(
                __content_139703124559104_365, '\x00', '&#0;', None, False)
            __token = 417
            __content_139703124559104_415 = _lookup_attr(
                getitem('perm_storage'), 'var_num_supplies_delivered_bef_last')
            __content_139703124559104_415 = __quote(
                __content_139703124559104_415, '\x00', '&#0;', None, False)
            __token = 500
            __content_139703124559104_498 = _lookup_attr(
                getitem('perm_storage'), 'var_num_supplies_delivered')
            __content_139703124559104_498 = __quote(
                __content_139703124559104_498, '\x00', '&#0;', None, False)
            __token = 545
            __content_139703124559104_543 = _lookup_attr(
                getitem('perm_storage'), 'var_num_supplies_delivered_last')
            __content_139703124559104_543 = __quote(
                __content_139703124559104_543, '\x00', '&#0;', None, False)
            __token = 617
            __content_139703124559104_615 = _lookup_attr(
                getitem('perm_storage'), 'var_num_supplies_delivered')
            __content_139703124559104_615 = __quote(
                __content_139703124559104_615, '\x00', '&#0;', None, False)
            __content_139703124559104 = ('%s%s%s%s%s%s%s%s%s%s%s%s%s' % (
                '\n    switch(FEAT_INDUSTRIES, SELF, ',
                (__content_139703124559104 if
                 (__content_139703124559104 is not None) else ''),
                '_monthly_update, [\n        STORE_PERM(LOAD_PERM(',
                (__content_139703124559104_365 if
                 (__content_139703124559104_365 is not None) else ''),
                '), ',
                (__content_139703124559104_415 if
                 (__content_139703124559104_415 is not None) else ''),
                '),\n        STORE_PERM(LOAD_PERM(',
                (__content_139703124559104_498 if
                 (__content_139703124559104_498 is not None) else ''),
                '), ',
                (__content_139703124559104_543 if
                 (__content_139703124559104_543 is not None) else ''),
                '),\n        STORE_PERM(0, ',
                (__content_139703124559104_615 if
                 (__content_139703124559104_615 is not None) else ''),
                ')\n    ]) {\n        return CB_RESULT_IND_PROD_NO_CHANGE;\n    }\n',
            ))
            if (__content_139703124559104 is None):
                pass
            else:
                if (__content_139703124559104 is False):
                    __content_139703124559104 = None
                else:
                    __tt = type(__content_139703124559104)
                    if ((__tt is int) or (__tt is float) or (__tt is int)):
                        __content_139703124559104 = str(
                            __content_139703124559104)
                    else:
                        if (__tt is bytes):
                            __content_139703124559104 = decode(
                                __content_139703124559104)
                        else:
                            if (__tt is not str):
                                try:
                                    __content_139703124559104 = __content_139703124559104.__html__
                                except get('AttributeError', AttributeError):
                                    __converted = convert(
                                        __content_139703124559104)
                                    __content_139703124559104 = (
                                        str(__content_139703124559104) if
                                        (__content_139703124559104 is
                                         __converted) else __converted)
                                else:
                                    __content_139703124559104 = __content_139703124559104(
                                    )
            if (__content_139703124559104 is not None):
                __append(__content_139703124559104)
            if (__backup_perm_storage_139703105753664 is __marker):
                del econtext['perm_storage']
            else:
                econtext[
                    'perm_storage'] = __backup_perm_storage_139703105753664
            __append('\n')
        except:
            if (__token is not None):
                rcontext.setdefault('__error__', []).append(
                    (__tokens[__token] + (
                        __filename,
                        _exc_info()[1],
                    )))
            raise
    def render(__stream,
               econtext,
               rcontext,
               __i18n_domain=None,
               __i18n_context=None):
        __append = __stream.append
        __re_amp = g_re_amp
        __token = None
        __re_needs_escape = g_re_needs_escape

        def __convert(target):
            if (target is None):
                return
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except AttributeError:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            target = target()
            return target

        def __quote(target, quote, quote_entity, default, default_marker):
            if (target is None):
                return
            if (target is default_marker):
                return default
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            return target()
                if (target is not None):
                    try:
                        escape = (__re_needs_escape(target) is not None)
                    except TypeError:
                        pass
                    else:
                        if escape:
                            if ('&' in target):
                                target = target.replace('&', '&amp;')
                            if ('<' in target):
                                target = target.replace('<', '&lt;')
                            if ('>' in target):
                                target = target.replace('>', '&gt;')
                            if ((quote is not None) and (quote in target)):
                                target = target.replace(quote, quote_entity)
            return target

        translate = econtext['__translate']
        decode = econtext['__decode']
        convert = econtext['__convert']
        on_error_handler = econtext['__on_error_handler']
        try:
            getitem = econtext.__getitem__
            get = econtext.get

            # <Interpolation value=<Substitution '\n\nswitch (FEAT_INDUSTRIES, SELF, ${industry.id}_extra_text, economy) {\n    ' (1:57)> braces_required=True translation=False at 7f9ab095a6a0> -> __content_140302383355024
            __token = 59
            __token = 92
            __content_140302383355024 = _lookup_attr(getitem('industry'), 'id')
            __content_140302383355024 = __quote(__content_140302383355024,
                                                '\x00', '&#0;', None, False)
            __content_140302383355024 = ('%s%s%s' % (
                '\n\nswitch (FEAT_INDUSTRIES, SELF, ',
                (__content_140302383355024 if
                 (__content_140302383355024 is not None) else ''),
                '_extra_text, economy) {\n    ',
            ))
            if (__content_140302383355024 is None):
                pass
            else:
                if (__content_140302383355024 is False):
                    __content_140302383355024 = None
                else:
                    __tt = type(__content_140302383355024)
                    if ((__tt is int) or (__tt is float) or (__tt is int)):
                        __content_140302383355024 = str(
                            __content_140302383355024)
                    else:
                        if (__tt is bytes):
                            __content_140302383355024 = decode(
                                __content_140302383355024)
                        else:
                            if (__tt is not str):
                                try:
                                    __content_140302383355024 = __content_140302383355024.__html__
                                except get('AttributeError', AttributeError):
                                    __converted = convert(
                                        __content_140302383355024)
                                    __content_140302383355024 = (
                                        str(__content_140302383355024) if
                                        (__content_140302383355024 is
                                         __converted) else __converted)
                                else:
                                    __content_140302383355024 = __content_140302383355024(
                                    )
            if (__content_140302383355024 is not None):
                __append(__content_140302383355024)
            __backup_economy_140302363472056 = get('economy', __marker)

            # <Value 'economies' (4:35)> -> __iterator
            __token = 163
            __iterator = getitem('economies')
            (
                __iterator,
                ____index_140302364158944,
            ) = getitem('repeat')('economy', __iterator)
            econtext['economy'] = None
            for __item in __iterator:
                econtext['economy'] = __item
                __append('\n        ')

                # <Value "industry.get_property('enabled', economy) == True" (5:43)> -> __condition
                __token = 218
                __condition = (_lookup_attr(
                    getitem('industry'),
                    'get_property')('enabled', getitem('economy')) == True)
                if __condition:

                    # <Interpolation value=<Substitution '\n            ${economy.numeric_id}: return ${industry.get_extra_text_string(economy)};\n        ' (5:94)> braces_required=True translation=False at 7f9ab093aa58> -> __content_140302383355024
                    __token = 282
                    __token = 284
                    __content_140302383355024 = _lookup_attr(
                        getitem('economy'), 'numeric_id')
                    __content_140302383355024 = __quote(
                        __content_140302383355024, '\x00', '&#0;', None, False)
                    __token = 314
                    __content_140302383355024_312 = _lookup_attr(
                        getitem('industry'),
                        'get_extra_text_string')(getitem('economy'))
                    __content_140302383355024_312 = __quote(
                        __content_140302383355024_312, '\x00', '&#0;', None,
                        False)
                    __content_140302383355024 = ('%s%s%s%s%s' % (
                        '\n            ',
                        (__content_140302383355024 if
                         (__content_140302383355024 is not None) else ''),
                        ': return ',
                        (__content_140302383355024_312 if
                         (__content_140302383355024_312 is not None) else ''),
                        ';\n        ',
                    ))
                    if (__content_140302383355024 is None):
                        pass
                    else:
                        if (__content_140302383355024 is False):
                            __content_140302383355024 = None
                        else:
                            __tt = type(__content_140302383355024)
                            if ((__tt is int) or (__tt is float)
                                    or (__tt is int)):
                                __content_140302383355024 = str(
                                    __content_140302383355024)
                            else:
                                if (__tt is bytes):
                                    __content_140302383355024 = decode(
                                        __content_140302383355024)
                                else:
                                    if (__tt is not str):
                                        try:
                                            __content_140302383355024 = __content_140302383355024.__html__
                                        except get('AttributeError',
                                                   AttributeError):
                                            __converted = convert(
                                                __content_140302383355024)
                                            __content_140302383355024 = (
                                                str(__content_140302383355024)
                                                if
                                                (__content_140302383355024 is
                                                 __converted) else __converted)
                                        else:
                                            __content_140302383355024 = __content_140302383355024(
                                            )
                    if (__content_140302383355024 is not None):
                        __append(__content_140302383355024)
                __append('\n    ')
                ____index_140302364158944 -= 1
                if (____index_140302364158944 > 0):
                    __append('')
            if (__backup_economy_140302363472056 is __marker):
                del econtext['economy']
            else:
                econtext['economy'] = __backup_economy_140302363472056
            __append('\n}\n\n\n')

            # <Interpolation value=<Substitution '\n\nswitch (FEAT_INDUSTRIES, SELF, ${industry.id}_cargo_subtype_display_cargo_1, [current_date - LOAD_PERM(${industry.perm_storage.date_received_1}) > 90]) {\n    0: return 0x3800 + string(STR_CARGO_SUBTYPE_DISPLAY_SECONDARY_CARGO_DELIVERED);\n    1: return 0x3800 + string(STR_EMPTY);\n}\n\nswitch (FEAT_INDUSTRIES, SELF, ${industry.id}_cargo_subtype_display_cargo_2, [current_date - LOAD_PERM(${industry.perm_storage.date_received_2}) > 90]) {\n    0: return 0x3800 + string(STR_CARGO_SUBTYPE_DISPLAY_SECONDARY_CARGO_DELIVERED);\n    1: return 0x3800 + string(STR_EMPTY);\n}\n\nswitch (FEAT_INDUSTRIES, SELF, ${industry.id}_cargo_subtype_display_cargo_3, [current_date - LOAD_PERM(${industry.perm_storage.date_received_3}) > 90]) {\n    0: return 0x3800 + string(STR_CARGO_SUBTYPE_DISPLAY_SECONDARY_CARGO_DELIVERED);\n    1: return 0x3800 + string(STR_EMPTY);\n}\n\nswitch (FEAT_INDUSTRIES, SELF, ${industry.id}_cargo_subtype_display_switch_cargo, getbits(extra_callback_info2, 0, 8)) {\n    0: ${industry.id}_cargo_subtype_display_cargo_1;\n    1: ${industry.id}_cargo_subtype_display_cargo_2;\n    2: ${industry.id}_cargo_subtype_display_cargo_3;\n    return CB_RESULT_NO_TEXT;\n}\n' (15:3)> braces_required=True translation=False at 7f9ab095aa58> -> __content_140302383355024
            __token = 637
            __token = 670
            __content_140302383355024 = _lookup_attr(getitem('industry'), 'id')
            __content_140302383355024 = __quote(__content_140302383355024,
                                                '\x00', '&#0;', None, False)
            __token = 742
            __content_140302383355024_740 = _lookup_attr(
                _lookup_attr(getitem('industry'), 'perm_storage'),
                'date_received_1')
            __content_140302383355024_740 = __quote(
                __content_140302383355024_740, '\x00', '&#0;', None, False)
            __token = 953
            __content_140302383355024_951 = _lookup_attr(
                getitem('industry'), 'id')
            __content_140302383355024_951 = __quote(
                __content_140302383355024_951, '\x00', '&#0;', None, False)
            __token = 1025
            __content_140302383355024_1023 = _lookup_attr(
                _lookup_attr(getitem('industry'), 'perm_storage'),
                'date_received_2')
            __content_140302383355024_1023 = __quote(
                __content_140302383355024_1023, '\x00', '&#0;', None, False)
            __token = 1236
            __content_140302383355024_1234 = _lookup_attr(
                getitem('industry'), 'id')
            __content_140302383355024_1234 = __quote(
                __content_140302383355024_1234, '\x00', '&#0;', None, False)
            __token = 1308
            __content_140302383355024_1306 = _lookup_attr(
                _lookup_attr(getitem('industry'), 'perm_storage'),
                'date_received_3')
            __content_140302383355024_1306 = __quote(
                __content_140302383355024_1306, '\x00', '&#0;', None, False)
            __token = 1519
            __content_140302383355024_1517 = _lookup_attr(
                getitem('industry'), 'id')
            __content_140302383355024_1517 = __quote(
                __content_140302383355024_1517, '\x00', '&#0;', None, False)
            __token = 1616
            __content_140302383355024_1614 = _lookup_attr(
                getitem('industry'), 'id')
            __content_140302383355024_1614 = __quote(
                __content_140302383355024_1614, '\x00', '&#0;', None, False)
            __token = 1669
            __content_140302383355024_1667 = _lookup_attr(
                getitem('industry'), 'id')
            __content_140302383355024_1667 = __quote(
                __content_140302383355024_1667, '\x00', '&#0;', None, False)
            __token = 1722
            __content_140302383355024_1720 = _lookup_attr(
                getitem('industry'), 'id')
            __content_140302383355024_1720 = __quote(
                __content_140302383355024_1720, '\x00', '&#0;', None, False)
            __content_140302383355024 = ('%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s' % (
                '\n\nswitch (FEAT_INDUSTRIES, SELF, ',
                (__content_140302383355024 if
                 (__content_140302383355024 is not None) else ''),
                '_cargo_subtype_display_cargo_1, [current_date - LOAD_PERM(',
                (__content_140302383355024_740 if
                 (__content_140302383355024_740 is not None) else ''),
                ') > 90]) {\n    0: return 0x3800 + string(STR_CARGO_SUBTYPE_DISPLAY_SECONDARY_CARGO_DELIVERED);\n    1: return 0x3800 + string(STR_EMPTY);\n}\n\nswitch (FEAT_INDUSTRIES, SELF, ',
                (__content_140302383355024_951 if
                 (__content_140302383355024_951 is not None) else ''),
                '_cargo_subtype_display_cargo_2, [current_date - LOAD_PERM(',
                (__content_140302383355024_1023 if
                 (__content_140302383355024_1023 is not None) else ''),
                ') > 90]) {\n    0: return 0x3800 + string(STR_CARGO_SUBTYPE_DISPLAY_SECONDARY_CARGO_DELIVERED);\n    1: return 0x3800 + string(STR_EMPTY);\n}\n\nswitch (FEAT_INDUSTRIES, SELF, ',
                (__content_140302383355024_1234 if
                 (__content_140302383355024_1234 is not None) else ''),
                '_cargo_subtype_display_cargo_3, [current_date - LOAD_PERM(',
                (__content_140302383355024_1306 if
                 (__content_140302383355024_1306 is not None) else ''),
                ') > 90]) {\n    0: return 0x3800 + string(STR_CARGO_SUBTYPE_DISPLAY_SECONDARY_CARGO_DELIVERED);\n    1: return 0x3800 + string(STR_EMPTY);\n}\n\nswitch (FEAT_INDUSTRIES, SELF, ',
                (__content_140302383355024_1517 if
                 (__content_140302383355024_1517 is not None) else ''),
                '_cargo_subtype_display_switch_cargo, getbits(extra_callback_info2, 0, 8)) {\n    0: ',
                (__content_140302383355024_1614 if
                 (__content_140302383355024_1614 is not None) else ''),
                '_cargo_subtype_display_cargo_1;\n    1: ',
                (__content_140302383355024_1667 if
                 (__content_140302383355024_1667 is not None) else ''),
                '_cargo_subtype_display_cargo_2;\n    2: ',
                (__content_140302383355024_1720 if
                 (__content_140302383355024_1720 is not None) else ''),
                '_cargo_subtype_display_cargo_3;\n    return CB_RESULT_NO_TEXT;\n}\n',
            ))
            if (__content_140302383355024 is None):
                pass
            else:
                if (__content_140302383355024 is False):
                    __content_140302383355024 = None
                else:
                    __tt = type(__content_140302383355024)
                    if ((__tt is int) or (__tt is float) or (__tt is int)):
                        __content_140302383355024 = str(
                            __content_140302383355024)
                    else:
                        if (__tt is bytes):
                            __content_140302383355024 = decode(
                                __content_140302383355024)
                        else:
                            if (__tt is not str):
                                try:
                                    __content_140302383355024 = __content_140302383355024.__html__
                                except get('AttributeError', AttributeError):
                                    __converted = convert(
                                        __content_140302383355024)
                                    __content_140302383355024 = (
                                        str(__content_140302383355024) if
                                        (__content_140302383355024 is
                                         __converted) else __converted)
                                else:
                                    __content_140302383355024 = __content_140302383355024(
                                    )
            if (__content_140302383355024 is not None):
                __append(__content_140302383355024)

            # <Interpolation value=<Substitution '\nswitch (FEAT_INDUSTRIES, SELF, ${industry.id}_cargo_subtype_display, getbits(extra_callback_info2, 8, 8)) {\n    1: ${industry.id}_cargo_subtype_display_switch_cargo;\n    return CB_RESULT_NO_TEXT;\n}\n' (38:66)> braces_required=True translation=False at 7f9ab093a128> -> __content_140302383355024
            __token = 1865
            __token = 1898
            __content_140302383355024 = _lookup_attr(getitem('industry'), 'id')
            __content_140302383355024 = __quote(__content_140302383355024,
                                                '\x00', '&#0;', None, False)
            __token = 1982
            __content_140302383355024_1980 = _lookup_attr(
                getitem('industry'), 'id')
            __content_140302383355024_1980 = __quote(
                __content_140302383355024_1980, '\x00', '&#0;', None, False)
            __content_140302383355024 = ('%s%s%s%s%s' % (
                '\nswitch (FEAT_INDUSTRIES, SELF, ',
                (__content_140302383355024 if
                 (__content_140302383355024 is not None) else ''),
                '_cargo_subtype_display, getbits(extra_callback_info2, 8, 8)) {\n    1: ',
                (__content_140302383355024_1980 if
                 (__content_140302383355024_1980 is not None) else ''),
                '_cargo_subtype_display_switch_cargo;\n    return CB_RESULT_NO_TEXT;\n}\n',
            ))
            if (__content_140302383355024 is None):
                pass
            else:
                if (__content_140302383355024 is False):
                    __content_140302383355024 = None
                else:
                    __tt = type(__content_140302383355024)
                    if ((__tt is int) or (__tt is float) or (__tt is int)):
                        __content_140302383355024 = str(
                            __content_140302383355024)
                    else:
                        if (__tt is bytes):
                            __content_140302383355024 = decode(
                                __content_140302383355024)
                        else:
                            if (__tt is not str):
                                try:
                                    __content_140302383355024 = __content_140302383355024.__html__
                                except get('AttributeError', AttributeError):
                                    __converted = convert(
                                        __content_140302383355024)
                                    __content_140302383355024 = (
                                        str(__content_140302383355024) if
                                        (__content_140302383355024 is
                                         __converted) else __converted)
                                else:
                                    __content_140302383355024 = __content_140302383355024(
                                    )
            if (__content_140302383355024 is not None):
                __append(__content_140302383355024)
        except:
            if (__token is not None):
                rcontext.setdefault('__error__', []).append(
                    (__tokens[__token] + (
                        __filename,
                        _exc_info()[1],
                    )))
            raise
コード例 #27
0
    def render(__stream, econtext, rcontext, __i18n_domain=None, __i18n_context=None):
        __append = __stream.append
        __re_amp = g_re_amp
        __token = None
        __re_needs_escape = g_re_needs_escape

        def __convert(target):
            if (target is None):
                return
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except AttributeError:
                            __converted = convert(target)
                            target = (str(target) if (target is __converted) else __converted)
                        else:
                            target = target()
            return target

        def __quote(target, quote, quote_entity, default, default_marker):
            if (target is None):
                return
            if (target is default_marker):
                return default
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except:
                            __converted = convert(target)
                            target = (str(target) if (target is __converted) else __converted)
                        else:
                            return target()
                if (target is not None):
                    try:
                        escape = (__re_needs_escape(target) is not None)
                    except TypeError:
                        pass
                    else:
                        if escape:
                            if ('&' in target):
                                target = target.replace('&', '&amp;')
                            if ('<' in target):
                                target = target.replace('<', '&lt;')
                            if ('>' in target):
                                target = target.replace('>', '&gt;')
                            if ((quote is not None) and (quote in target)):
                                target = target.replace(quote, quote_entity)
            return target
        translate = econtext['__translate']
        decode = econtext['__decode']
        convert = econtext['__convert']
        on_error_handler = econtext['__on_error_handler']
        try:
            getitem = econtext.__getitem__
            get = econtext.get
            __append('\n\n')
            __append('\n\n')
            __append('\nif (ttd_platform != PLATFORM_OPENTTD || openttd_version ')
            __append('<')
            __append(' version_openttd(1, 7, 0, 27769)) {\n\terror(FATAL, REQUIRES_OPENTTD, string(STR_ERR_OPENTTD_VERSION));\n\texit;\n}\n\n')
            __backup_incompatible_grf_140166525546392 = get('incompatible_grf', __marker)

            # <Value 'incompatible_grfs' (14:48)> -> __iterator
            __token = 503
            __iterator = getitem('incompatible_grfs')
            (__iterator, ____index_140166499866832, ) = getitem('repeat')('incompatible_grf', __iterator)
            econtext['incompatible_grf'] = None
            for __item in __iterator:
                econtext['incompatible_grf'] = __item

                # <Interpolation value=<Substitution '\n    if (grf_future_status("${incompatible_grf.grfid}")) {\n        error(FATAL, string(STR_ERR_INCOMPATIBLE_SET, "${incompatible_grf.grfname}"));\n    }\n' (14:67)> braces_required=True translation=False at 7f7b0e6f1d68> -> __content_140166518101192
                __token = 527
                __token = 552
                __content_140166518101192 = _lookup_attr(getitem('incompatible_grf'), 'grfid')
                __content_140166518101192 = __quote(__content_140166518101192, '\x00', '&#0;', None, False)
                __token = 638
                __content_140166518101192_636 = _lookup_attr(getitem('incompatible_grf'), 'grfname')
                __content_140166518101192_636 = __quote(__content_140166518101192_636, '\x00', '&#0;', None, False)
                __content_140166518101192 = ('%s%s%s%s%s' % ('\n    if (grf_future_status("', (__content_140166518101192 if (__content_140166518101192 is not None) else ''), '")) {\n        error(FATAL, string(STR_ERR_INCOMPATIBLE_SET, "', (__content_140166518101192_636 if (__content_140166518101192_636 is not None) else ''), '"));\n    }\n', ))
                if (__content_140166518101192 is None):
                    pass
                else:
                    if (__content_140166518101192 is False):
                        __content_140166518101192 = None
                    else:
                        __tt = type(__content_140166518101192)
                        if ((__tt is int) or (__tt is float) or (__tt is int)):
                            __content_140166518101192 = str(__content_140166518101192)
                        else:
                            if (__tt is bytes):
                                __content_140166518101192 = decode(__content_140166518101192)
                            else:
                                if (__tt is not str):
                                    try:
                                        __content_140166518101192 = __content_140166518101192.__html__
                                    except get('AttributeError', AttributeError):
                                        __converted = convert(__content_140166518101192)
                                        __content_140166518101192 = (str(__content_140166518101192) if (__content_140166518101192 is __converted) else __converted)
                                    else:
                                        __content_140166518101192 = __content_140166518101192()
                if (__content_140166518101192 is not None):
                    __append(__content_140166518101192)
                ____index_140166499866832 -= 1
                if (____index_140166499866832 > 0):
                    __append('')
            if (__backup_incompatible_grf_140166525546392 is __marker):
                del econtext['incompatible_grf']
            else:
                econtext['incompatible_grf'] = __backup_incompatible_grf_140166525546392
            __append('\n\n\n')
            __append('\n/* this one might not survive as artic-only\nif (climate == CLIMATE_ARCTIC) {\n\tINCOMPATIBLE_GRF("mb\\07\\00", "Alpine Climate");\n}\n*/\n\nif (grf_future_status("MG\\08\\00", "\\FF\\FF\\FF\\00")) {\n\terror(FATAL, string(STR_ERR_INCOMPATIBLE_SET, "Lumber Mill"));\n}\n\nif (grf_future_status("CACa")) {\n\tif (param["CACa", 1] != 0) {\n\t\terror(FATAL, string(STR_ERR_INCOMPATIBLE_PARAM_CITYSET));\n\t}\n}\nif (grf_future_status("CASa")) {\n\tif (param["CASa", 1] != 0) {\n\t\terror(FATAL, string(STR_ERR_INCOMPATIBLE_PARAM_CANSET));\n\t}\n}\nif (grf_future_status("VC\\00\\01")) {\n\tif (param["VC\\00\\01", 254] ')
            __append('<')
            __append('= 17) {\n\t\terror(FATAL, string(STR_ERR_INCOMPATIBLE_SET_TTRS_VERSION));\n\t}\n}\n')
        except:
            if (__token is not None):
                rcontext.setdefault('__error__', []).append((__tokens[__token] + (__filename, _exc_info()[1], )))
            raise
コード例 #28
0
    def render(__stream,
               econtext,
               rcontext,
               __i18n_domain=None,
               __i18n_context=None):
        __append = __stream.append
        __re_amp = g_re_amp
        __token = None
        __re_needs_escape = g_re_needs_escape

        def __convert(target):
            if (target is None):
                return
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except AttributeError:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            target = target()
            return target

        def __quote(target, quote, quote_entity, default, default_marker):
            if (target is None):
                return
            if (target is default_marker):
                return default
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            return target()
                if (target is not None):
                    try:
                        escape = (__re_needs_escape(target) is not None)
                    except TypeError:
                        pass
                    else:
                        if escape:
                            if ('&' in target):
                                target = target.replace('&', '&amp;')
                            if ('<' in target):
                                target = target.replace('<', '&lt;')
                            if ('>' in target):
                                target = target.replace('>', '&gt;')
                            if ((quote is not None) and (quote in target)):
                                target = target.replace(quote, quote_entity)
            return target

        translate = econtext['__translate']
        decode = econtext['__decode']
        convert = econtext['__convert']
        on_error_handler = econtext['__on_error_handler']
        try:
            getitem = econtext.__getitem__
            get = econtext.get
            __append('\n\n')
            __backup_industry_layout_139703104062520 = get(
                'industry_layout', __marker)

            # <Value 'python:industry.industry_layouts' (8:64)> -> __iterator
            __token = 658
            __iterator = _lookup_attr(getitem('industry'), 'industry_layouts')
            (
                __iterator,
                ____index_139703106016816,
            ) = getitem('repeat')('industry_layout', __iterator)
            econtext['industry_layout'] = None
            for __item in __iterator:
                econtext['industry_layout'] = __item

                # <Interpolation value=<Substitution '\n    tilelayout ${industry_layout.id}_tilelayout {\n        ' (8:98)> braces_required=True translation=False at 7f0f2a021ba8> -> __content_139703124559104
                __token = 697
                __token = 710
                __content_139703124559104 = _lookup_attr(
                    getitem('industry_layout'), 'id')
                __content_139703124559104 = __quote(__content_139703124559104,
                                                    '\x00', '&#0;', None,
                                                    False)
                __content_139703124559104 = ('%s%s%s' % (
                    '\n    tilelayout ',
                    (__content_139703124559104 if
                     (__content_139703124559104 is not None) else ''),
                    '_tilelayout {\n        ',
                ))
                if (__content_139703124559104 is None):
                    pass
                else:
                    if (__content_139703124559104 is False):
                        __content_139703124559104 = None
                    else:
                        __tt = type(__content_139703124559104)
                        if ((__tt is int) or (__tt is float) or (__tt is int)):
                            __content_139703124559104 = str(
                                __content_139703124559104)
                        else:
                            if (__tt is bytes):
                                __content_139703124559104 = decode(
                                    __content_139703124559104)
                            else:
                                if (__tt is not str):
                                    try:
                                        __content_139703124559104 = __content_139703124559104.__html__
                                    except get('AttributeError',
                                               AttributeError):
                                        __converted = convert(
                                            __content_139703124559104)
                                        __content_139703124559104 = (
                                            str(__content_139703124559104) if
                                            (__content_139703124559104 is
                                             __converted) else __converted)
                                    else:
                                        __content_139703124559104 = __content_139703124559104(
                                        )
                if (__content_139703124559104 is not None):
                    __append(__content_139703124559104)
                __backup_layout_139703104048040 = get('layout', __marker)

                # <Value 'industry_layout.layout' (10:50)> -> __iterator
                __token = 793
                __iterator = _lookup_attr(getitem('industry_layout'), 'layout')
                (
                    __iterator,
                    ____index_139703106019168,
                ) = getitem('repeat')('layout', __iterator)
                econtext['layout'] = None
                for __item in __iterator:
                    econtext['layout'] = __item

                    # <Interpolation value=<Substitution '\n            ${layout[0]}, ${layout[1]}: ${layout[2]};\n        ' (10:74)> braces_required=True translation=False at 7f0f2a021358> -> __content_139703124559104
                    __token = 830
                    __token = 832
                    __content_139703124559104 = getitem('layout')[0]
                    __content_139703124559104 = __quote(
                        __content_139703124559104, '\x00', '&#0;', None, False)
                    __token = 846
                    __content_139703124559104_844 = getitem('layout')[1]
                    __content_139703124559104_844 = __quote(
                        __content_139703124559104_844, '\x00', '&#0;', None,
                        False)
                    __token = 860
                    __content_139703124559104_858 = getitem('layout')[2]
                    __content_139703124559104_858 = __quote(
                        __content_139703124559104_858, '\x00', '&#0;', None,
                        False)
                    __content_139703124559104 = ('%s%s%s%s%s%s%s' % (
                        '\n            ',
                        (__content_139703124559104 if
                         (__content_139703124559104 is not None) else ''),
                        ', ',
                        (__content_139703124559104_844 if
                         (__content_139703124559104_844 is not None) else ''),
                        ': ',
                        (__content_139703124559104_858 if
                         (__content_139703124559104_858 is not None) else ''),
                        ';\n        ',
                    ))
                    if (__content_139703124559104 is None):
                        pass
                    else:
                        if (__content_139703124559104 is False):
                            __content_139703124559104 = None
                        else:
                            __tt = type(__content_139703124559104)
                            if ((__tt is int) or (__tt is float)
                                    or (__tt is int)):
                                __content_139703124559104 = str(
                                    __content_139703124559104)
                            else:
                                if (__tt is bytes):
                                    __content_139703124559104 = decode(
                                        __content_139703124559104)
                                else:
                                    if (__tt is not str):
                                        try:
                                            __content_139703124559104 = __content_139703124559104.__html__
                                        except get('AttributeError',
                                                   AttributeError):
                                            __converted = convert(
                                                __content_139703124559104)
                                            __content_139703124559104 = (
                                                str(__content_139703124559104)
                                                if
                                                (__content_139703124559104 is
                                                 __converted) else __converted)
                                        else:
                                            __content_139703124559104 = __content_139703124559104(
                                            )
                    if (__content_139703124559104 is not None):
                        __append(__content_139703124559104)
                    ____index_139703106019168 -= 1
                    if (____index_139703106019168 > 0):
                        __append('')
                if (__backup_layout_139703104048040 is __marker):
                    del econtext['layout']
                else:
                    econtext['layout'] = __backup_layout_139703104048040
                __append('\n    }\n')
                ____index_139703106016816 -= 1
                if (____index_139703106016816 > 0):
                    __append('')
            if (__backup_industry_layout_139703104062520 is __marker):
                del econtext['industry_layout']
            else:
                econtext[
                    'industry_layout'] = __backup_industry_layout_139703104062520
            __append('\n')
        except:
            if (__token is not None):
                rcontext.setdefault('__error__', []).append(
                    (__tokens[__token] + (
                        __filename,
                        _exc_info()[1],
                    )))
            raise
コード例 #29
0
    def render(__stream,
               econtext,
               rcontext,
               __i18n_domain=None,
               __i18n_context=None):
        __append = __stream.append
        __re_amp = g_re_amp
        __token = None
        __re_needs_escape = g_re_needs_escape

        def __convert(target):
            if (target is None):
                return
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except AttributeError:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            target = target()
            return target

        def __quote(target, quote, quote_entity, default, default_marker):
            if (target is None):
                return
            if (target is default_marker):
                return default
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            return target()
                if (target is not None):
                    try:
                        escape = (__re_needs_escape(target) is not None)
                    except TypeError:
                        pass
                    else:
                        if escape:
                            if ('&' in target):
                                target = target.replace('&', '&amp;')
                            if ('<' in target):
                                target = target.replace('<', '&lt;')
                            if ('>' in target):
                                target = target.replace('>', '&gt;')
                            if ((quote is not None) and (quote in target)):
                                target = target.replace(quote, quote_entity)
            return target

        translate = econtext['__translate']
        decode = econtext['__decode']
        convert = econtext['__convert']
        on_error_handler = econtext['__on_error_handler']
        try:
            getitem = econtext.__getitem__
            get = econtext.get
            __backup_economy_140383637162696 = get('economy', __marker)

            # <Value 'economies' (1:37)> -> __iterator
            __token = 37
            __iterator = getitem('economies')
            (
                __iterator,
                ____index_140383634707008,
            ) = getitem('repeat')('economy', __iterator)
            econtext['economy'] = None
            for __item in __iterator:
                econtext['economy'] = __item
                __append('\n    ')

                # <Value "industry.get_property('enabled', economy) == True" (2:39)> -> __condition
                __token = 88
                __condition = (_lookup_attr(
                    getitem('industry'),
                    'get_property')('enabled', getitem('economy')) == True)
                if __condition:

                    # <Interpolation value=<Substitution '\n        if (economy==${economy.numeric_id}) {\n            item(FEAT_INDUSTRIES, ${industry.id}, ${industry.numeric_id}) {\n                property {\n                    ' (2:90)> braces_required=True translation=False at 7fad9cadd518> -> __content_140383655711776
                    __token = 148
                    __token = 163
                    __content_140383655711776 = _lookup_attr(
                        getitem('economy'), 'numeric_id')
                    __content_140383655711776 = __quote(
                        __content_140383655711776, '\x00', '&#0;', None, False)
                    __token = 222
                    __content_140383655711776_220 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_140383655711776_220 = __quote(
                        __content_140383655711776_220, '\x00', '&#0;', None,
                        False)
                    __token = 238
                    __content_140383655711776_236 = _lookup_attr(
                        getitem('industry'), 'numeric_id')
                    __content_140383655711776_236 = __quote(
                        __content_140383655711776_236, '\x00', '&#0;', None,
                        False)
                    __content_140383655711776 = ('%s%s%s%s%s%s%s' % (
                        '\n        if (economy==',
                        (__content_140383655711776 if
                         (__content_140383655711776 is not None) else ''),
                        ') {\n            item(FEAT_INDUSTRIES, ',
                        (__content_140383655711776_220 if
                         (__content_140383655711776_220 is not None) else ''),
                        ', ',
                        (__content_140383655711776_236 if
                         (__content_140383655711776_236 is not None) else ''),
                        ') {\n                property {\n                    ',
                    ))
                    if (__content_140383655711776 is None):
                        pass
                    else:
                        if (__content_140383655711776 is False):
                            __content_140383655711776 = None
                        else:
                            __tt = type(__content_140383655711776)
                            if ((__tt is int) or (__tt is float)
                                    or (__tt is int)):
                                __content_140383655711776 = str(
                                    __content_140383655711776)
                            else:
                                if (__tt is bytes):
                                    __content_140383655711776 = decode(
                                        __content_140383655711776)
                                else:
                                    if (__tt is not str):
                                        try:
                                            __content_140383655711776 = __content_140383655711776.__html__
                                        except get('AttributeError',
                                                   AttributeError):
                                            __converted = convert(
                                                __content_140383655711776)
                                            __content_140383655711776 = (
                                                str(__content_140383655711776)
                                                if
                                                (__content_140383655711776 is
                                                 __converted) else __converted)
                                        else:
                                            __content_140383655711776 = __content_140383655711776(
                                            )
                    if (__content_140383655711776 is not None):
                        __append(__content_140383655711776)

                    # <Interpolation value=<Substitution "\n                    ${industry.get_property_declaration('substitute')}\n                    ${industry.get_property_declaration('override')}\n                    ${industry.get_property_declaration('map_colour')}\n                    ${industry.get_property_declaration('life_type')}\n                    ${industry.get_property_declaration('closure_msg')}\n                    ${industry.get_property_declaration('prod_increase_msg')}\n                    ${industry.get_property_declaration('prod_decrease_msg')}\n                    ${industry.get_property_declaration('new_ind_msg')}\n                    ${industry.get_property_declaration('min_cargo_distr')}\n                    ${industry.get_property_declaration('spec_flags')}\n                    ${industry.get_industry_layouts_as_property()}\n                    conflicting_ind_types: []; // set this prop empty, FIRS has it's own better checks for this\n                    random_sound_effects: []; // set this empty to avoid spurious default industry sounds (as of May 2017 FIRS does not yet use sound effects)\n                    " (6:79)> braces_required=True translation=False at 7fad9cadddd8> -> __content_140383655711776
                    __token = 389
                    __token = 391
                    __content_140383655711776 = _lookup_attr(
                        getitem('industry'),
                        'get_property_declaration')('substitute')
                    __content_140383655711776 = __quote(
                        __content_140383655711776, '\x00', '&#0;', None, False)
                    __token = 462
                    __content_140383655711776_460 = _lookup_attr(
                        getitem('industry'),
                        'get_property_declaration')('override')
                    __content_140383655711776_460 = __quote(
                        __content_140383655711776_460, '\x00', '&#0;', None,
                        False)
                    __token = 531
                    __content_140383655711776_529 = _lookup_attr(
                        getitem('industry'),
                        'get_property_declaration')('map_colour')
                    __content_140383655711776_529 = __quote(
                        __content_140383655711776_529, '\x00', '&#0;', None,
                        False)
                    __token = 602
                    __content_140383655711776_600 = _lookup_attr(
                        getitem('industry'),
                        'get_property_declaration')('life_type')
                    __content_140383655711776_600 = __quote(
                        __content_140383655711776_600, '\x00', '&#0;', None,
                        False)
                    __token = 672
                    __content_140383655711776_670 = _lookup_attr(
                        getitem('industry'),
                        'get_property_declaration')('closure_msg')
                    __content_140383655711776_670 = __quote(
                        __content_140383655711776_670, '\x00', '&#0;', None,
                        False)
                    __token = 744
                    __content_140383655711776_742 = _lookup_attr(
                        getitem('industry'),
                        'get_property_declaration')('prod_increase_msg')
                    __content_140383655711776_742 = __quote(
                        __content_140383655711776_742, '\x00', '&#0;', None,
                        False)
                    __token = 822
                    __content_140383655711776_820 = _lookup_attr(
                        getitem('industry'),
                        'get_property_declaration')('prod_decrease_msg')
                    __content_140383655711776_820 = __quote(
                        __content_140383655711776_820, '\x00', '&#0;', None,
                        False)
                    __token = 900
                    __content_140383655711776_898 = _lookup_attr(
                        getitem('industry'),
                        'get_property_declaration')('new_ind_msg')
                    __content_140383655711776_898 = __quote(
                        __content_140383655711776_898, '\x00', '&#0;', None,
                        False)
                    __token = 972
                    __content_140383655711776_970 = _lookup_attr(
                        getitem('industry'),
                        'get_property_declaration')('min_cargo_distr')
                    __content_140383655711776_970 = __quote(
                        __content_140383655711776_970, '\x00', '&#0;', None,
                        False)
                    __token = 1048
                    __content_140383655711776_1046 = _lookup_attr(
                        getitem('industry'),
                        'get_property_declaration')('spec_flags')
                    __content_140383655711776_1046 = __quote(
                        __content_140383655711776_1046, '\x00', '&#0;', None,
                        False)
                    __token = 1119
                    __content_140383655711776_1117 = _lookup_attr(
                        getitem('industry'),
                        'get_industry_layouts_as_property')()
                    __content_140383655711776_1117 = __quote(
                        __content_140383655711776_1117, '\x00', '&#0;', None,
                        False)
                    __content_140383655711776 = (
                        '%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s' % (
                            '\n                    ',
                            (__content_140383655711776 if
                             (__content_140383655711776 is not None) else ''),
                            '\n                    ',
                            (__content_140383655711776_460 if
                             (__content_140383655711776_460
                              is not None) else ''),
                            '\n                    ',
                            (__content_140383655711776_529 if
                             (__content_140383655711776_529
                              is not None) else ''),
                            '\n                    ',
                            (__content_140383655711776_600 if
                             (__content_140383655711776_600
                              is not None) else ''),
                            '\n                    ',
                            (__content_140383655711776_670 if
                             (__content_140383655711776_670
                              is not None) else ''),
                            '\n                    ',
                            (__content_140383655711776_742 if
                             (__content_140383655711776_742
                              is not None) else ''),
                            '\n                    ',
                            (__content_140383655711776_820 if
                             (__content_140383655711776_820
                              is not None) else ''),
                            '\n                    ',
                            (__content_140383655711776_898 if
                             (__content_140383655711776_898
                              is not None) else ''),
                            '\n                    ',
                            (__content_140383655711776_970 if
                             (__content_140383655711776_970
                              is not None) else ''),
                            '\n                    ',
                            (__content_140383655711776_1046 if
                             (__content_140383655711776_1046
                              is not None) else ''),
                            '\n                    ',
                            (__content_140383655711776_1117 if
                             (__content_140383655711776_1117
                              is not None) else ''),
                            "\n                    conflicting_ind_types: []; // set this prop empty, FIRS has it's own better checks for this\n                    random_sound_effects: []; // set this empty to avoid spurious default industry sounds (as of May 2017 FIRS does not yet use sound effects)\n                    ",
                        ))
                    if (__content_140383655711776 is None):
                        pass
                    else:
                        if (__content_140383655711776 is False):
                            __content_140383655711776 = None
                        else:
                            __tt = type(__content_140383655711776)
                            if ((__tt is int) or (__tt is float)
                                    or (__tt is int)):
                                __content_140383655711776 = str(
                                    __content_140383655711776)
                            else:
                                if (__tt is bytes):
                                    __content_140383655711776 = decode(
                                        __content_140383655711776)
                                else:
                                    if (__tt is not str):
                                        try:
                                            __content_140383655711776 = __content_140383655711776.__html__
                                        except get('AttributeError',
                                                   AttributeError):
                                            __converted = convert(
                                                __content_140383655711776)
                                            __content_140383655711776 = (
                                                str(__content_140383655711776)
                                                if
                                                (__content_140383655711776 is
                                                 __converted) else __converted)
                                        else:
                                            __content_140383655711776 = __content_140383655711776(
                                            )
                    if (__content_140383655711776 is not None):
                        __append(__content_140383655711776)

                    # <Interpolation value=<Substitution "\n                    ${industry.get_property_declaration('name', economy)}\n                    ${industry.get_property_declaration('prod_multiplier', economy)}\n                    ${industry.get_property_declaration('input_multiplier_1', economy)}\n                    ${industry.get_property_declaration('input_multiplier_2', economy)}\n                    ${industry.get_property_declaration('input_multiplier_3', economy)}\n                    ${industry.get_property_declaration('prob_random', economy)}\n                    ${industry.get_property_declaration('prob_in_game', economy)}\n                    ${industry.get_property_declaration('prospect_chance', economy)}\n                    ${industry.get_property_declaration('fund_cost_multiplier', economy)}\n                    ${industry.get_property_declaration('remove_cost_multiplier', economy)}\n                    ${industry.get_property_declaration('remove_cost_multiplier', economy)}\n                    " (20:102)> braces_required=True translation=False at 7fad9cadd198> -> __content_140383655711776
                    __token = 1558
                    __token = 1560
                    __content_140383655711776 = _lookup_attr(
                        getitem('industry'),
                        'get_property_declaration')('name', getitem('economy'))
                    __content_140383655711776 = __quote(
                        __content_140383655711776, '\x00', '&#0;', None, False)
                    __token = 1634
                    __content_140383655711776_1632 = _lookup_attr(
                        getitem('industry'),
                        'get_property_declaration')('prod_multiplier',
                                                    getitem('economy'))
                    __content_140383655711776_1632 = __quote(
                        __content_140383655711776_1632, '\x00', '&#0;', None,
                        False)
                    __token = 1719
                    __content_140383655711776_1717 = _lookup_attr(
                        getitem('industry'),
                        'get_property_declaration')('input_multiplier_1',
                                                    getitem('economy'))
                    __content_140383655711776_1717 = __quote(
                        __content_140383655711776_1717, '\x00', '&#0;', None,
                        False)
                    __token = 1807
                    __content_140383655711776_1805 = _lookup_attr(
                        getitem('industry'),
                        'get_property_declaration')('input_multiplier_2',
                                                    getitem('economy'))
                    __content_140383655711776_1805 = __quote(
                        __content_140383655711776_1805, '\x00', '&#0;', None,
                        False)
                    __token = 1895
                    __content_140383655711776_1893 = _lookup_attr(
                        getitem('industry'),
                        'get_property_declaration')('input_multiplier_3',
                                                    getitem('economy'))
                    __content_140383655711776_1893 = __quote(
                        __content_140383655711776_1893, '\x00', '&#0;', None,
                        False)
                    __token = 1983
                    __content_140383655711776_1981 = _lookup_attr(
                        getitem('industry'),
                        'get_property_declaration')('prob_random',
                                                    getitem('economy'))
                    __content_140383655711776_1981 = __quote(
                        __content_140383655711776_1981, '\x00', '&#0;', None,
                        False)
                    __token = 2064
                    __content_140383655711776_2062 = _lookup_attr(
                        getitem('industry'),
                        'get_property_declaration')('prob_in_game',
                                                    getitem('economy'))
                    __content_140383655711776_2062 = __quote(
                        __content_140383655711776_2062, '\x00', '&#0;', None,
                        False)
                    __token = 2146
                    __content_140383655711776_2144 = _lookup_attr(
                        getitem('industry'),
                        'get_property_declaration')('prospect_chance',
                                                    getitem('economy'))
                    __content_140383655711776_2144 = __quote(
                        __content_140383655711776_2144, '\x00', '&#0;', None,
                        False)
                    __token = 2231
                    __content_140383655711776_2229 = _lookup_attr(
                        getitem('industry'),
                        'get_property_declaration')('fund_cost_multiplier',
                                                    getitem('economy'))
                    __content_140383655711776_2229 = __quote(
                        __content_140383655711776_2229, '\x00', '&#0;', None,
                        False)
                    __token = 2321
                    __content_140383655711776_2319 = _lookup_attr(
                        getitem('industry'),
                        'get_property_declaration')('remove_cost_multiplier',
                                                    getitem('economy'))
                    __content_140383655711776_2319 = __quote(
                        __content_140383655711776_2319, '\x00', '&#0;', None,
                        False)
                    __token = 2413
                    __content_140383655711776_2411 = _lookup_attr(
                        getitem('industry'),
                        'get_property_declaration')('remove_cost_multiplier',
                                                    getitem('economy'))
                    __content_140383655711776_2411 = __quote(
                        __content_140383655711776_2411, '\x00', '&#0;', None,
                        False)
                    __content_140383655711776 = (
                        '%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s' % (
                            '\n                    ',
                            (__content_140383655711776 if
                             (__content_140383655711776 is not None) else ''),
                            '\n                    ',
                            (__content_140383655711776_1632 if
                             (__content_140383655711776_1632
                              is not None) else ''),
                            '\n                    ',
                            (__content_140383655711776_1717 if
                             (__content_140383655711776_1717
                              is not None) else ''),
                            '\n                    ',
                            (__content_140383655711776_1805 if
                             (__content_140383655711776_1805
                              is not None) else ''),
                            '\n                    ',
                            (__content_140383655711776_1893 if
                             (__content_140383655711776_1893
                              is not None) else ''),
                            '\n                    ',
                            (__content_140383655711776_1981 if
                             (__content_140383655711776_1981
                              is not None) else ''),
                            '\n                    ',
                            (__content_140383655711776_2062 if
                             (__content_140383655711776_2062
                              is not None) else ''),
                            '\n                    ',
                            (__content_140383655711776_2144 if
                             (__content_140383655711776_2144
                              is not None) else ''),
                            '\n                    ',
                            (__content_140383655711776_2229 if
                             (__content_140383655711776_2229
                              is not None) else ''),
                            '\n                    ',
                            (__content_140383655711776_2319 if
                             (__content_140383655711776_2319
                              is not None) else ''),
                            '\n                    ',
                            (__content_140383655711776_2411 if
                             (__content_140383655711776_2411
                              is not None) else ''),
                            '\n                    ',
                        ))
                    if (__content_140383655711776 is None):
                        pass
                    else:
                        if (__content_140383655711776 is False):
                            __content_140383655711776 = None
                        else:
                            __tt = type(__content_140383655711776)
                            if ((__tt is int) or (__tt is float)
                                    or (__tt is int)):
                                __content_140383655711776 = str(
                                    __content_140383655711776)
                            else:
                                if (__tt is bytes):
                                    __content_140383655711776 = decode(
                                        __content_140383655711776)
                                else:
                                    if (__tt is not str):
                                        try:
                                            __content_140383655711776 = __content_140383655711776.__html__
                                        except get('AttributeError',
                                                   AttributeError):
                                            __converted = convert(
                                                __content_140383655711776)
                                            __content_140383655711776 = (
                                                str(__content_140383655711776)
                                                if
                                                (__content_140383655711776 is
                                                 __converted) else __converted)
                                        else:
                                            __content_140383655711776 = __content_140383655711776(
                                            )
                    if (__content_140383655711776 is not None):
                        __append(__content_140383655711776)

                    # <Interpolation value=<Substitution '\n                    ${industry.get_accept_cargo_types_declaration(economy)}\n                    ${industry.get_prod_cargo_types_declaration(economy)}\n                    ${industry.get_nearby_station_name_declaration()}\n                }\n            }\n        }\n    ' (32:46)> braces_required=True translation=False at 7fad9cadd828> -> __content_140383655711776
                    __token = 2550
                    __token = 2552
                    __content_140383655711776 = _lookup_attr(
                        getitem('industry'),
                        'get_accept_cargo_types_declaration')(
                            getitem('economy'))
                    __content_140383655711776 = __quote(
                        __content_140383655711776, '\x00', '&#0;', None, False)
                    __token = 2628
                    __content_140383655711776_2626 = _lookup_attr(
                        getitem('industry'),
                        'get_prod_cargo_types_declaration')(getitem('economy'))
                    __content_140383655711776_2626 = __quote(
                        __content_140383655711776_2626, '\x00', '&#0;', None,
                        False)
                    __token = 2702
                    __content_140383655711776_2700 = _lookup_attr(
                        getitem('industry'),
                        'get_nearby_station_name_declaration')()
                    __content_140383655711776_2700 = __quote(
                        __content_140383655711776_2700, '\x00', '&#0;', None,
                        False)
                    __content_140383655711776 = ('%s%s%s%s%s%s%s' % (
                        '\n                    ',
                        (__content_140383655711776 if
                         (__content_140383655711776 is not None) else ''),
                        '\n                    ',
                        (__content_140383655711776_2626 if
                         (__content_140383655711776_2626 is not None) else ''),
                        '\n                    ',
                        (__content_140383655711776_2700 if
                         (__content_140383655711776_2700 is not None) else ''),
                        '\n                }\n            }\n        }\n    ',
                    ))
                    if (__content_140383655711776 is None):
                        pass
                    else:
                        if (__content_140383655711776 is False):
                            __content_140383655711776 = None
                        else:
                            __tt = type(__content_140383655711776)
                            if ((__tt is int) or (__tt is float)
                                    or (__tt is int)):
                                __content_140383655711776 = str(
                                    __content_140383655711776)
                            else:
                                if (__tt is bytes):
                                    __content_140383655711776 = decode(
                                        __content_140383655711776)
                                else:
                                    if (__tt is not str):
                                        try:
                                            __content_140383655711776 = __content_140383655711776.__html__
                                        except get('AttributeError',
                                                   AttributeError):
                                            __converted = convert(
                                                __content_140383655711776)
                                            __content_140383655711776 = (
                                                str(__content_140383655711776)
                                                if
                                                (__content_140383655711776 is
                                                 __converted) else __converted)
                                        else:
                                            __content_140383655711776 = __content_140383655711776(
                                            )
                    if (__content_140383655711776 is not None):
                        __append(__content_140383655711776)
                __append('\n')
                ____index_140383634707008 -= 1
                if (____index_140383634707008 > 0):
                    __append('')
            if (__backup_economy_140383637162696 is __marker):
                del econtext['economy']
            else:
                econtext['economy'] = __backup_economy_140383637162696
        except:
            if (__token is not None):
                rcontext.setdefault('__error__', []).append(
                    (__tokens[__token] + (
                        __filename,
                        _exc_info()[1],
                    )))
            raise
    def render(__stream,
               econtext,
               rcontext,
               __i18n_domain=None,
               __i18n_context=None):
        __append = __stream.append
        __re_amp = g_re_amp
        __token = None
        __re_needs_escape = g_re_needs_escape

        def __convert(target):
            if (target is None):
                return
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except AttributeError:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            target = target()
            return target

        def __quote(target, quote, quote_entity, default, default_marker):
            if (target is None):
                return
            if (target is default_marker):
                return default
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            return target()
                if (target is not None):
                    try:
                        escape = (__re_needs_escape(target) is not None)
                    except TypeError:
                        pass
                    else:
                        if escape:
                            if ('&' in target):
                                target = target.replace('&', '&amp;')
                            if ('<' in target):
                                target = target.replace('<', '&lt;')
                            if ('>' in target):
                                target = target.replace('>', '&gt;')
                            if ((quote is not None) and (quote in target)):
                                target = target.replace(quote, quote_entity)
            return target

        translate = econtext['__translate']
        decode = econtext['__decode']
        convert = econtext['__convert']
        on_error_handler = econtext['__on_error_handler']
        try:
            getitem = econtext.__getitem__
            get = econtext.get
            __append(
                '/* ******************************************************************\n * Definition of the industry tile, its callbacks, and graphics chain\n * ******************************************************************/\n\n'
            )
            __backup_macroname_140383635816328 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7fad9cd43c50> name=None at 7fad9cd43ba8> -> __value
            __value = _static_140383637224528
            econtext['macroname'] = __value

            # <Value 'load: spritesets.pynml' (5:30)> -> __macro
            __token = 242
            __macro = ' spritesets.pynml'
            __macro = __loader(__macro)
            __token = 242
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140383635816328 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140383635816328
            __append('\n\n')
            __backup_macroname_140383636694536 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7fad9cb53668> name=None at 7fad9cb533c8> -> __value
            __value = _static_140383635191400
            econtext['macroname'] = __value

            # <Value 'load: spritelayouts.pynml' (7:30)> -> __macro
            __token = 300
            __macro = ' spritelayouts.pynml'
            __macro = __loader(__macro)
            __token = 300
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140383636694536 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140383636694536
            __append('\n\n')
            __backup_macroname_140383636696520 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7fad9cb534e0> name=None at 7fad9cb53320> -> __value
            __value = _static_140383635191008
            econtext['macroname'] = __value

            # <Value 'load: graphics_switches.pynml' (9:30)> -> __macro
            __token = 361
            __macro = ' graphics_switches.pynml'
            __macro = __loader(__macro)
            __token = 361
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140383636696520 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140383636696520
            __append('\n\n')
            __backup_location_checks_tile_140383635887664 = get(
                'location_checks_tile', __marker)

            # <Value 'load: location_check_macros_tile.pynml' (11:42)> -> __value
            __token = 438
            __value = ' location_check_macros_tile.pynml'
            __value = __loader(__value)
            econtext['location_checks_tile'] = __value
            __backup_macroname_140383635671624 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7fad9cb53630> name=None at 7fad9cb53c50> -> __value
            __value = _static_140383635191344
            econtext['macroname'] = __value

            # <Value "location_checks_tile.macros['render_tree']" (12:30)> -> __macro
            __token = 508
            __macro = _lookup_attr(getitem('location_checks_tile'),
                                   'macros')['render_tree']
            __token = 508
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140383635671624 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140383635671624
            if (__backup_location_checks_tile_140383635887664 is __marker):
                del econtext['location_checks_tile']
            else:
                econtext[
                    'location_checks_tile'] = __backup_location_checks_tile_140383635887664
            __append('\n\n')
            __backup_animation_macros_140383635886992 = get(
                'animation_macros', __marker)

            # <Value 'load: animation_macros.pynml' (14:38)> -> __value
            __token = 594
            __value = ' animation_macros.pynml'
            __value = __loader(__value)
            econtext['animation_macros'] = __value
            __backup_macroname_140383635672520 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7fad9cb53588> name=None at 7fad9cb53ac8> -> __value
            __value = _static_140383635191176
            econtext['macroname'] = __value

            # <Value "animation_macros.macros['tile_animation']" (15:30)> -> __macro
            __token = 654
            __macro = _lookup_attr(getitem('animation_macros'),
                                   'macros')['tile_animation']
            __token = 654
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140383635672520 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140383635672520
            if (__backup_animation_macros_140383635886992 is __marker):
                del econtext['animation_macros']
            else:
                econtext[
                    'animation_macros'] = __backup_animation_macros_140383635886992
            __append('\n\n')
            __backup_macroname_140383637568904 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7fad9cb6ff28> name=None at 7fad9cb6ff60> -> __value
            __value = _static_140383635308328
            econtext['macroname'] = __value

            # <Value 'load: properties_tile.pynml' (17:30)> -> __macro
            __token = 731
            __macro = ' properties_tile.pynml'
            __macro = __loader(__macro)
            __token = 731
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140383637568904 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140383637568904
            __append(
                '\n\n\n/* *************************************************\n * Definition of the industry\n * *************************************************/\n\n'
            )
            __backup_macroname_140383634449800 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7fad9cca15c0> name=None at 7fad9cca12e8> -> __value
            __value = _static_140383636559296
            econtext['macroname'] = __value

            # <Value 'load: layouts.pynml' (24:30)> -> __macro
            __token = 933
            __macro = ' layouts.pynml'
            __macro = __loader(__macro)
            __token = 933
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140383634449800 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140383634449800
            __append('\n\n')
            __backup_macroname_140383634451656 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7fad9cca19e8> name=None at 7fad9cca1390> -> __value
            __value = _static_140383636560360
            econtext['macroname'] = __value

            # <Value 'load: availability.pynml' (26:30)> -> __macro
            __token = 988
            __macro = ' availability.pynml'
            __macro = __loader(__macro)
            __token = 988
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140383634451656 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140383634451656
            __append('\n\n')
            __backup_location_checks_industry_140383635889344 = get(
                'location_checks_industry', __marker)

            # <Value 'load: location_check_macros_industry.pynml' (28:46)> -> __value
            __token = 1064
            __value = ' location_check_macros_industry.pynml'
            __value = __loader(__value)
            econtext['location_checks_industry'] = __value
            __backup_macroname_140383634449928 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7fad9cca13c8> name=None at 7fad9cca1b70> -> __value
            __value = _static_140383636558792
            econtext['macroname'] = __value

            # <Value "location_checks_industry.macros['render_tree']" (29:30)> -> __macro
            __token = 1138
            __macro = _lookup_attr(getitem('location_checks_industry'),
                                   'macros')['render_tree']
            __token = 1138
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140383634449928 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140383634449928
            if (__backup_location_checks_industry_140383635889344 is __marker):
                del econtext['location_checks_industry']
            else:
                econtext[
                    'location_checks_industry'] = __backup_location_checks_industry_140383635889344
            __append('\n\n')
            __backup_macroname_140383636959432 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7fad9caddf60> name=None at 7fad9caddb38> -> __value
            __value = _static_140383634710368
            econtext['macroname'] = __value

            # <Value 'load: properties_industry.pynml' (31:30)> -> __macro
            __token = 1220
            __macro = ' properties_industry.pynml'
            __macro = __loader(__macro)
            __token = 1220
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140383636959432 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140383636959432
            __append('\n\n')
            __append('\n')

            # <Interpolation value=<Substitution '\nitem(FEAT_INDUSTRIES, ${industry.id}, ${industry.numeric_id}) {\n\tgraphics {\n\t\tconstruction_probability:${industry.id}_check_availability;\n        build_prod_change:       randomise_primary_production_on_build;\n\t\tlocation_check:          ${industry.id}_check_location;\n\t\tmonthly_prod_change:     return CB_RESULT_IND_PROD_NO_CHANGE;\n\t\trandom_prod_change:      return CB_RESULT_IND_PROD_NO_CHANGE;\n//\t\textra_text_industry:     // no extra text. No production increase by means of FMSP\n\t\tcolour:                  switch_colour;\n\t}\n}\n' (34:38)> braces_required=True translation=False at 7fad9ccbd7b8> -> __content_140383655711776
            __token = 1406
            __token = 1430
            __content_140383655711776 = _lookup_attr(getitem('industry'), 'id')
            __content_140383655711776 = __quote(__content_140383655711776,
                                                '\x00', '&#0;', None, False)
            __token = 1446
            __content_140383655711776_1444 = _lookup_attr(
                getitem('industry'), 'numeric_id')
            __content_140383655711776_1444 = __quote(
                __content_140383655711776_1444, '\x00', '&#0;', None, False)
            __token = 1511
            __content_140383655711776_1509 = _lookup_attr(
                getitem('industry'), 'id')
            __content_140383655711776_1509 = __quote(
                __content_140383655711776_1509, '\x00', '&#0;', None, False)
            __token = 1645
            __content_140383655711776_1643 = _lookup_attr(
                getitem('industry'), 'id')
            __content_140383655711776_1643 = __quote(
                __content_140383655711776_1643, '\x00', '&#0;', None, False)
            __content_140383655711776 = ('%s%s%s%s%s%s%s%s%s' % (
                '\nitem(FEAT_INDUSTRIES, ',
                (__content_140383655711776 if
                 (__content_140383655711776 is not None) else ''),
                ', ',
                (__content_140383655711776_1444 if
                 (__content_140383655711776_1444 is not None) else ''),
                ') {\n\tgraphics {\n\t\tconstruction_probability:',
                (__content_140383655711776_1509 if
                 (__content_140383655711776_1509 is not None) else ''),
                '_check_availability;\n        build_prod_change:       randomise_primary_production_on_build;\n\t\tlocation_check:          ',
                (__content_140383655711776_1643 if
                 (__content_140383655711776_1643 is not None) else ''),
                '_check_location;\n\t\tmonthly_prod_change:     return CB_RESULT_IND_PROD_NO_CHANGE;\n\t\trandom_prod_change:      return CB_RESULT_IND_PROD_NO_CHANGE;\n//\t\textra_text_industry:     // no extra text. No production increase by means of FMSP\n\t\tcolour:                  switch_colour;\n\t}\n}\n',
            ))
            if (__content_140383655711776 is None):
                pass
            else:
                if (__content_140383655711776 is False):
                    __content_140383655711776 = None
                else:
                    __tt = type(__content_140383655711776)
                    if ((__tt is int) or (__tt is float) or (__tt is int)):
                        __content_140383655711776 = str(
                            __content_140383655711776)
                    else:
                        if (__tt is bytes):
                            __content_140383655711776 = decode(
                                __content_140383655711776)
                        else:
                            if (__tt is not str):
                                try:
                                    __content_140383655711776 = __content_140383655711776.__html__
                                except get('AttributeError', AttributeError):
                                    __converted = convert(
                                        __content_140383655711776)
                                    __content_140383655711776 = (
                                        str(__content_140383655711776) if
                                        (__content_140383655711776 is
                                         __converted) else __converted)
                                else:
                                    __content_140383655711776 = __content_140383655711776(
                                    )
            if (__content_140383655711776 is not None):
                __append(__content_140383655711776)
        except:
            if (__token is not None):
                rcontext.setdefault('__error__', []).append(
                    (__tokens[__token] + (
                        __filename,
                        _exc_info()[1],
                    )))
            raise
コード例 #31
0
    def render(__stream,
               econtext,
               rcontext,
               __i18n_domain=None,
               __i18n_context=None):
        __append = __stream.append
        __re_amp = g_re_amp
        __token = None
        __re_needs_escape = g_re_needs_escape

        def __convert(target):
            if (target is None):
                return
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except AttributeError:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            target = target()
            return target

        def __quote(target, quote, quote_entity, default, default_marker):
            if (target is None):
                return
            if (target is default_marker):
                return default
            __tt = type(target)
            if ((__tt is int) or (__tt is float) or (__tt is int)):
                target = str(target)
            else:
                if (__tt is bytes):
                    target = decode(target)
                else:
                    if (__tt is not str):
                        try:
                            target = target.__html__
                        except:
                            __converted = convert(target)
                            target = (str(target) if
                                      (target is __converted) else __converted)
                        else:
                            return target()
                if (target is not None):
                    try:
                        escape = (__re_needs_escape(target) is not None)
                    except TypeError:
                        pass
                    else:
                        if escape:
                            if ('&' in target):
                                target = target.replace('&', '&amp;')
                            if ('<' in target):
                                target = target.replace('<', '&lt;')
                            if ('>' in target):
                                target = target.replace('>', '&gt;')
                            if ((quote is not None) and (quote in target)):
                                target = target.replace(quote, quote_entity)
            return target

        translate = econtext['__translate']
        decode = econtext['__decode']
        convert = econtext['__convert']
        on_error_handler = econtext['__on_error_handler']
        try:
            getitem = econtext.__getitem__
            get = econtext.get
            __append(
                '/* ******************************************************************\n * Definition of the industry tile, its callbacks, and graphics chain\n * ******************************************************************/\n\n'
            )
            __backup_macroname_140302364938952 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f9ab09862b0> name=None at 7f9ab0986e80> -> __value
            __value = _static_140302364467888
            econtext['macroname'] = __value

            # <Value 'load: spritesets.pynml' (5:30)> -> __macro
            __token = 242
            __macro = ' spritesets.pynml'
            __macro = __loader(__macro)
            __token = 242
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140302364938952 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140302364938952
            __append('\n\n')
            __backup_macroname_140302364369160 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f9ab09db2e8> name=None at 7f9ab09db940> -> __value
            __value = _static_140302364816104
            econtext['macroname'] = __value

            # <Value 'load: spritelayouts.pynml' (7:30)> -> __macro
            __token = 300
            __macro = ' spritelayouts.pynml'
            __macro = __loader(__macro)
            __token = 300
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140302364369160 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140302364369160
            __append('\n\n')
            __backup_macroname_140302364371336 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f9ab09dbac8> name=None at 7f9ab09db8d0> -> __value
            __value = _static_140302364818120
            econtext['macroname'] = __value

            # <Value 'load: graphics_switches.pynml' (9:30)> -> __macro
            __token = 361
            __macro = ' graphics_switches.pynml'
            __macro = __loader(__macro)
            __token = 361
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140302364371336 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140302364371336
            __append('\n\n')
            __backup_location_checks_tile_140302390806288 = get(
                'location_checks_tile', __marker)

            # <Value 'load: location_check_macros_tile.pynml' (11:42)> -> __value
            __token = 438
            __value = ' location_check_macros_tile.pynml'
            __value = __loader(__value)
            econtext['location_checks_tile'] = __value
            __backup_macroname_140302364369992 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f9ab09db4e0> name=None at 7f9ab09db470> -> __value
            __value = _static_140302364816608
            econtext['macroname'] = __value

            # <Value "location_checks_tile.macros['render_tree']" (12:30)> -> __macro
            __token = 508
            __macro = _lookup_attr(getitem('location_checks_tile'),
                                   'macros')['render_tree']
            __token = 508
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140302364369992 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140302364369992
            if (__backup_location_checks_tile_140302390806288 is __marker):
                del econtext['location_checks_tile']
            else:
                econtext[
                    'location_checks_tile'] = __backup_location_checks_tile_140302390806288
            __append('\n\n')
            __backup_animation_macros_140302390818296 = get(
                'animation_macros', __marker)

            # <Value 'load: animation_macros.pynml' (14:38)> -> __value
            __token = 594
            __value = ' animation_macros.pynml'
            __value = __loader(__value)
            econtext['animation_macros'] = __value
            __backup_macroname_140302364812296 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f9ab09db9e8> name=None at 7f9ab09db278> -> __value
            __value = _static_140302364817896
            econtext['macroname'] = __value

            # <Value "animation_macros.macros['tile_animation']" (15:30)> -> __macro
            __token = 654
            __macro = _lookup_attr(getitem('animation_macros'),
                                   'macros')['tile_animation']
            __token = 654
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140302364812296 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140302364812296
            if (__backup_animation_macros_140302390818296 is __marker):
                del econtext['animation_macros']
            else:
                econtext[
                    'animation_macros'] = __backup_animation_macros_140302390818296
            __append('\n\n')
            __backup_macroname_140302364623304 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f9ab09dbf28> name=None at 7f9ab09dbc18> -> __value
            __value = _static_140302364819240
            econtext['macroname'] = __value

            # <Value 'load: properties_tile.pynml' (17:30)> -> __macro
            __token = 731
            __macro = ' properties_tile.pynml'
            __macro = __loader(__macro)
            __token = 731
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140302364623304 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140302364623304
            __append(
                '\n\n\n/* *************************************************\n * Definition of the industry\n * *************************************************/\n\n'
            )
            __backup_macroname_140302364197064 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f9ab09db978> name=None at 7f9ab09dbef0> -> __value
            __value = _static_140302364817784
            econtext['macroname'] = __value

            # <Value 'load: layouts.pynml' (24:30)> -> __macro
            __token = 933
            __macro = ' layouts.pynml'
            __macro = __loader(__macro)
            __token = 933
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140302364197064 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140302364197064
            __append('\n\n')
            __backup_macroname_140302364198344 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f9ab09db7f0> name=None at 7f9ab09db860> -> __value
            __value = _static_140302364817392
            econtext['macroname'] = __value

            # <Value 'load: produce_secondary.pynml' (26:30)> -> __macro
            __token = 988
            __macro = ' produce_secondary.pynml'
            __macro = __loader(__macro)
            __token = 988
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140302364198344 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140302364198344
            __append('\n\n')
            __backup_macroname_140302364811848 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f9ab09dbb70> name=None at 7f9ab09dbd30> -> __value
            __value = _static_140302364818288
            econtext['macroname'] = __value

            # <Value 'load: closure_secondary.pynml' (28:30)> -> __macro
            __token = 1053
            __macro = ' closure_secondary.pynml'
            __macro = __loader(__macro)
            __token = 1053
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140302364811848 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140302364811848
            __append('\n\n')
            __backup_macroname_140302364200776 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f9ab09ca048> name=None at 7f9ab09cab38> -> __value
            __value = _static_140302364745800
            econtext['macroname'] = __value

            # <Value 'load: extra_text_secondary.pynml' (30:30)> -> __macro
            __token = 1118
            __macro = ' extra_text_secondary.pynml'
            __macro = __loader(__macro)
            __token = 1118
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140302364200776 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140302364200776
            __append('\n\n')
            __backup_macroname_140302364952584 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f9ab09ca588> name=None at 7f9ab09ca860> -> __value
            __value = _static_140302364747144
            econtext['macroname'] = __value

            # <Value 'load: availability.pynml' (32:30)> -> __macro
            __token = 1186
            __macro = ' availability.pynml'
            __macro = __loader(__macro)
            __token = 1186
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140302364952584 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140302364952584
            __append('\n\n')
            __backup_location_checks_industry_140302390808416 = get(
                'location_checks_industry', __marker)

            # <Value 'load: location_check_macros_industry.pynml' (34:46)> -> __value
            __token = 1262
            __value = ' location_check_macros_industry.pynml'
            __value = __loader(__value)
            econtext['location_checks_industry'] = __value
            __backup_macroname_140302364511304 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f9ab09cae10> name=None at 7f9ab09ca6a0> -> __value
            __value = _static_140302364749328
            econtext['macroname'] = __value

            # <Value "location_checks_industry.macros['render_tree']" (35:30)> -> __macro
            __token = 1336
            __macro = _lookup_attr(getitem('location_checks_industry'),
                                   'macros')['render_tree']
            __token = 1336
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140302364511304 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140302364511304
            if (__backup_location_checks_industry_140302390808416 is __marker):
                del econtext['location_checks_industry']
            else:
                econtext[
                    'location_checks_industry'] = __backup_location_checks_industry_140302390808416
            __append('\n\n')
            __backup_macroname_140302364511112 = get('macroname', __marker)

            # <Static value=<_ast.Str object at 0x7f9ab09ca550> name=None at 7f9ab09ca3c8> -> __value
            __value = _static_140302364747088
            econtext['macroname'] = __value

            # <Value 'load: properties_industry.pynml' (37:30)> -> __macro
            __token = 1418
            __macro = ' properties_industry.pynml'
            __macro = __loader(__macro)
            __token = 1418
            __m = __macro.include
            __m(__stream, econtext.copy(), rcontext, __i18n_domain)
            econtext.update(rcontext)
            if (__backup_macroname_140302364511112 is __marker):
                del econtext['macroname']
            else:
                econtext['macroname'] = __backup_macroname_140302364511112
            __append('\n\n')
            __append('\n')
            __backup_economy_140302364495376 = get('economy', __marker)

            # <Value 'economies' (40:37)> -> __iterator
            __token = 1602
            __iterator = getitem('economies')
            (
                __iterator,
                ____index_140302364748320,
            ) = getitem('repeat')('economy', __iterator)
            econtext['economy'] = None
            for __item in __iterator:
                econtext['economy'] = __item
                __append('\n    ')

                # <Value "industry.get_property('enabled', economy) == True" (41:39)> -> __condition
                __token = 1653
                __condition = (_lookup_attr(
                    getitem('industry'),
                    'get_property')('enabled', getitem('economy')) == True)
                if __condition:

                    # <Interpolation value=<Substitution '\n        if (economy==${economy.numeric_id}) {\n            item(FEAT_INDUSTRIES, ${industry.id}, ${industry.numeric_id}) {\n                graphics {\n                    construction_probability: ${industry.id}_check_availability;\n                    produce_cargo_arrival:    ${industry.id}_produce;\n                    monthly_prod_change:      ${industry.id}_check_secondary_production_level;\n                    random_prod_change:       ${industry.id}_check_secondary_closure;\n                    location_check:           ${industry.id}_check_location;\n                    extra_text_fund:          ${industry.get_extra_text_fund(economy)};\n                    extra_text_industry:      ${industry.id}_extra_text;\n                    cargo_subtype_display:    ${industry.id}_cargo_subtype_display;\n                    colour:                   switch_colour;\n                }\n            }\n        }\n    ' (41:90)> braces_required=True translation=False at 7f9ab09cac88> -> __content_140302383355024
                    __token = 1713
                    __token = 1728
                    __content_140302383355024 = _lookup_attr(
                        getitem('economy'), 'numeric_id')
                    __content_140302383355024 = __quote(
                        __content_140302383355024, '\x00', '&#0;', None, False)
                    __token = 1787
                    __content_140302383355024_1785 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_140302383355024_1785 = __quote(
                        __content_140302383355024_1785, '\x00', '&#0;', None,
                        False)
                    __token = 1803
                    __content_140302383355024_1801 = _lookup_attr(
                        getitem('industry'), 'numeric_id')
                    __content_140302383355024_1801 = __quote(
                        __content_140302383355024_1801, '\x00', '&#0;', None,
                        False)
                    __token = 1902
                    __content_140302383355024_1900 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_140302383355024_1900 = __quote(
                        __content_140302383355024_1900, '\x00', '&#0;', None,
                        False)
                    __token = 1983
                    __content_140302383355024_1981 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_140302383355024_1981 = __quote(
                        __content_140302383355024_1981, '\x00', '&#0;', None,
                        False)
                    __token = 2053
                    __content_140302383355024_2051 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_140302383355024_2051 = __quote(
                        __content_140302383355024_2051, '\x00', '&#0;', None,
                        False)
                    __token = 2148
                    __content_140302383355024_2146 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_140302383355024_2146 = __quote(
                        __content_140302383355024_2146, '\x00', '&#0;', None,
                        False)
                    __token = 2234
                    __content_140302383355024_2232 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_140302383355024_2232 = __quote(
                        __content_140302383355024_2232, '\x00', '&#0;', None,
                        False)
                    __token = 2311
                    __content_140302383355024_2309 = _lookup_attr(
                        getitem('industry'),
                        'get_extra_text_fund')(getitem('economy'))
                    __content_140302383355024_2309 = __quote(
                        __content_140302383355024_2309, '\x00', '&#0;', None,
                        False)
                    __token = 2399
                    __content_140302383355024_2397 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_140302383355024_2397 = __quote(
                        __content_140302383355024_2397, '\x00', '&#0;', None,
                        False)
                    __token = 2472
                    __content_140302383355024_2470 = _lookup_attr(
                        getitem('industry'), 'id')
                    __content_140302383355024_2470 = __quote(
                        __content_140302383355024_2470, '\x00', '&#0;', None,
                        False)
                    __content_140302383355024 = ('%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s' % (
                        '\n        if (economy==',
                        (__content_140302383355024 if
                         (__content_140302383355024 is not None) else ''),
                        ') {\n            item(FEAT_INDUSTRIES, ',
                        (__content_140302383355024_1785 if
                         (__content_140302383355024_1785 is not None) else ''),
                        ', ',
                        (__content_140302383355024_1801 if
                         (__content_140302383355024_1801 is not None) else ''),
                        ') {\n                graphics {\n                    construction_probability: ',
                        (__content_140302383355024_1900 if
                         (__content_140302383355024_1900 is not None) else ''),
                        '_check_availability;\n                    produce_cargo_arrival:    ',
                        (__content_140302383355024_1981 if
                         (__content_140302383355024_1981 is not None) else ''),
                        '_produce;\n                    monthly_prod_change:      ',
                        (__content_140302383355024_2051 if
                         (__content_140302383355024_2051 is not None) else ''),
                        '_check_secondary_production_level;\n                    random_prod_change:       ',
                        (__content_140302383355024_2146 if
                         (__content_140302383355024_2146 is not None) else ''),
                        '_check_secondary_closure;\n                    location_check:           ',
                        (__content_140302383355024_2232 if
                         (__content_140302383355024_2232 is not None) else ''),
                        '_check_location;\n                    extra_text_fund:          ',
                        (__content_140302383355024_2309 if
                         (__content_140302383355024_2309 is not None) else ''),
                        ';\n                    extra_text_industry:      ',
                        (__content_140302383355024_2397 if
                         (__content_140302383355024_2397 is not None) else ''),
                        '_extra_text;\n                    cargo_subtype_display:    ',
                        (__content_140302383355024_2470 if
                         (__content_140302383355024_2470 is not None) else ''),
                        '_cargo_subtype_display;\n                    colour:                   switch_colour;\n                }\n            }\n        }\n    ',
                    ))
                    if (__content_140302383355024 is None):
                        pass
                    else:
                        if (__content_140302383355024 is False):
                            __content_140302383355024 = None
                        else:
                            __tt = type(__content_140302383355024)
                            if ((__tt is int) or (__tt is float)
                                    or (__tt is int)):
                                __content_140302383355024 = str(
                                    __content_140302383355024)
                            else:
                                if (__tt is bytes):
                                    __content_140302383355024 = decode(
                                        __content_140302383355024)
                                else:
                                    if (__tt is not str):
                                        try:
                                            __content_140302383355024 = __content_140302383355024.__html__
                                        except get('AttributeError',
                                                   AttributeError):
                                            __converted = convert(
                                                __content_140302383355024)
                                            __content_140302383355024 = (
                                                str(__content_140302383355024)
                                                if
                                                (__content_140302383355024 is
                                                 __converted) else __converted)
                                        else:
                                            __content_140302383355024 = __content_140302383355024(
                                            )
                    if (__content_140302383355024 is not None):
                        __append(__content_140302383355024)
                __append('\n')
                ____index_140302364748320 -= 1
                if (____index_140302364748320 > 0):
                    __append('')
            if (__backup_economy_140302364495376 is __marker):
                del econtext['economy']
            else:
                econtext['economy'] = __backup_economy_140302364495376
            __append('\n')
        except:
            if (__token is not None):
                rcontext.setdefault('__error__', []).append(
                    (__tokens[__token] + (
                        __filename,
                        _exc_info()[1],
                    )))
            raise