curry.interpreter.import_ package

Code for importing Curry modules into a Curry interpreter.

curry.interpreter.import_.edited_source(moduleobj)[source]

The source file of a loaded module when the file changed after the import, else None. An import of such a module returns the module as it was loaded; a new process reads the edited file.

curry.interpreter.import_.import_(arg, currypath=None, is_sourcefile=False)[source]

Import one or more Curry modules.

Parameters:
  • arg – A module descriptor indicating what to import. A module descriptor is a module name (string), curry.icurry.IModule object, or a sequence of module descriptors.

  • currypath – The search path for Curry files. By default, self.path is used.

  • is_sourcefile – Indicates whether to interpret arg as a source file name rather than a module name.

Returns:

A CurryModule or sequence thereof.

curry.interpreter.import_.record_source(moduleobj)[source]

Records the modification time of the source file of a module at its import (Handle.source_mtime), so that edited_source can tell a later edit. A module without a source file, or whose file cannot be read, records nothing.

curry.interpreter.import_.warn_edited(moduleobj, always=False)[source]

Logs a warning when the source of a loaded module changed after the import: the module stays as it was loaded, and the process does not read the file again. The warning is logged once per edit of a module object (Handle.warned_mtime), so that the imports of other modules, and the expression module of every evaluation, do not repeat it; with always it is logged on every call (the :load of the REPL prints it once per :load). Returns the source file, or None when the file did not change.

curry.interpreter.import_.warn_other_file(moduleobj, filename)[source]

Logs a warning when filename, the source file a caller named, is not the file the loaded module was read from: the module name is loaded already, and the file named is not read. Returns True when it warned.

Submodules