def __init__(self, package_fn=None):
"""Creates a new interactive prompt.
The interactive prompt will work using an exisiting
configuration file (if it exists).
It is also able to load an existing configuration file placed
in a non standard place if REPL is created using the
`package_fn`.
Finally, if there is no configuration file present in the
working directory, neighter a package file is explicty passed,
`UHURepl` will create a new one.
:param package_fn: An UHU package filename.
"""
self.local_config = get_local_config_file()
if package_fn is not None:
self.package = self.load_package(package_fn)
elif os.path.exists(self.local_config):
self.package = self.load_package(self.local_config)
else:
self.package = Package()
if self.package.product:
self.prompt = set_product_prompt(self.package.product)
else:
self.prompt = 'uhu> '
self.arg = None
self.history = InMemoryHistory()
评论列表
文章目录