Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def load_one():
path = inputPath / 'com.pelagicore.one.qface'
return FileSystem.parse_document(path)
def loadSystem():
path = inputPath / 'com.pelagicore.ivi.tuner.qface'
return FileSystem.parse_document(path)
def load_system():
path = inputPath / 'com.pelagicore.ivi.climate.qface'
return FileSystem.parse_document(path)
#!/usr/bin/env python3
from qface.generator import FileSystem, Generator
system = FileSystem.parse_document('./examples/test.qface')
def paramterType(symbol):
moduleName = symbol.package.nameParts[-1].capitalize()
if symbol.type.is_enum:
return 'Qml{0}Module::{1} {2}'.format(moduleName, symbol.type, symbol)
if symbol.type.is_void or symbol.type.is_primitive:
if symbol.type.name == 'string':
return 'const QString &{0}'.format(symbol)
if symbol.type.name == 'real':
return 'float {0}'.format(symbol)
return '{0} {1}'.format(symbol.type, symbol)
elif symbol.type.is_list:
return 'const QList<{0}> &{1}'.format(symbol.type.nested, symbol)
else:
return 'const {0} &{1}'.format(symbol.type, symbol)
logger.debug('parse input={0}'.format(inputs))
identifier = 'system' if not identifier else identifier
system = System()
cache = None
if use_cache:
cache = shelve.open('qface.cache')
if identifier in cache and clear_cache:
del cache[identifier]
if identifier in cache:
# use the cached domain model
system = cache[identifier]
# if domain model not cached generate it
for input in inputs:
path = Path.getcwd() / str(input)
if path.isfile():
FileSystem.parse_document(path, system)
else:
for document in path.walkfiles(pattern):
FileSystem.parse_document(document, system)
if use_cache:
cache[identifier] = system
return system