Python compiler.parseFile() Examples
The following are 7
code examples of compiler.parseFile().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
compiler
, or try the search function
.
Example #1
Source File: rspet_server.py From RSPET with MIT License | 6 votes |
def installed_plugins(self): """List all plugins installed.""" from os import listdir from fnmatch import fnmatch import compiler import inspect files = listdir('Plugins') try: files.remove('mount.py') files.remove('template.py') except ValueError: pass plugins = {} for element in files: if fnmatch(element, '*.py') and not fnmatch(element, '_*'): plug_doc = compiler.parseFile('Plugins/' + element).doc plug_doc = inspect.cleandoc(plug_doc) plugins[element[:-3]] = plug_doc # Remove .py) return plugins
Example #2
Source File: pyjs.py From OpenPLC_Editor with GNU General Public License v3.0 | 6 votes |
def parseModule(self, module_name, file_name): importing = False if file_name not in self.parse_cache: importing = True mod = compiler.parseFile(file_name) self.parse_cache[file_name] = mod else: mod = self.parse_cache[file_name] override = False platform_file_name = self.generatePlatformFilename(file_name) if self.platform and os.path.isfile(platform_file_name): mod = copy.deepcopy(mod) mod_override = compiler.parseFile(platform_file_name) self.merge(mod, mod_override) override = True if self.verbose: if override: print("Importing %s (Platform %s)" % (module_name, self.platform)) elif importing: print("Importing %s" % (module_name)) return mod, override
Example #3
Source File: check_i18n.py From neutron-vpnaas with Apache License 2.0 | 5 votes |
def check_i18n(input_file, i18n_msg_predicates, msg_format_checkers, debug): input_mod = compiler.parseFile(input_file) v = compiler.visitor.walk(input_mod, Visitor(input_file, i18n_msg_predicates, msg_format_checkers, debug), ASTWalker()) return v.error
Example #4
Source File: check_i18n.py From networking-odl with Apache License 2.0 | 5 votes |
def check_i18n(input_file, i18n_msg_predicates, msg_format_checkers, debug): input_mod = compiler.parseFile(input_file) v = compiler.visitor.walk(input_mod, Visitor(input_file, i18n_msg_predicates, msg_format_checkers, debug), ASTWalker()) return v.error
Example #5
Source File: check_i18n.py From tacker with Apache License 2.0 | 5 votes |
def check_i18n(input_file, i18n_msg_predicates, msg_format_checkers, debug): input_mod = compiler.parseFile(input_file) v = compiler.visitor.walk(input_mod, Visitor(input_file, i18n_msg_predicates, msg_format_checkers, debug), ASTWalker()) return v.error
Example #6
Source File: test_compiler.py From medicare-demo with Apache License 2.0 | 5 votes |
def testLineNo(self): # Test that all nodes except Module have a correct lineno attribute. filename = __file__ if filename.endswith((".pyc", ".pyo")): filename = filename[:-1] tree = compiler.parseFile(filename) self.check_lineno(tree)
Example #7
Source File: pyjs.py From OpenPLC_Editor with GNU General Public License v3.0 | 5 votes |
def translate(file_name, module_name, debug=False): f = open(file_name, "r") src = f.read() f.close() output = cStringIO() mod = compiler.parseFile(file_name) Translator(module_name, module_name, module_name, src, debug, mod, output) return output.getvalue()