clingo.core
Core functionality used throughout the clingo package.
Examples
>>> from clingo.core import version
>>> version()
(6, 0, 0)
A library object that manages Clingo's core resources.
This object is responsible for storing the logger, symbols, strings, and scripts. Functions and classes that need to create symbols require an instance of this class.
This class implements the ContextManager
interface.
Create a library object.
Arguments:
- slotted: Use a slotted allocator to store symbols. Setting this to true might improve performance.
- shared: Indicates whether symbols should be created in a thread-safe manner. Setting this to false might improve performance in single-threaded applications.
- log_level: The log level.
- logger: A logger to emit/intercept messages.
- message_limit: The maximum number of messages to emit.
Represents a range of positions in a source file.
The Location
object tracks the start and end positions of a region in the
file. It is used for error reporting and debugging, providing information about
the source of the program elements.
The available log levels.
Message categories emitted by the logger.
Represents a position in a source file.
A Position
object tracks the location of a symbol or construct
within a source file, including its file name, line number, and column.
Create a position object.
Arguments:
- lib: The library object managing symbols.
- file: The file name where the position is located.
- line: The line number in the file.
- column: The column number in the line.
Get Clingo's version.
Returns:
A tuple (major, minor, revision) representing the Clingo version.