
    cwiD                     R    S r SSKJrJrJr  SSKJrJrJrJ	r	J
r
  S/r " S S5      rg)a  
Functions and classes related to configuration.

Examples
--------
The following example shows how to modify the configuration to enumerate all
models:

```python
>>> from clingo.control import Control
>>>
>>> ctl = Control()
>>> ctl.configuration.keys
['tester', 'solve', 'asp', 'solver', 'configuration', 'share',
 'learn_explicit', 'sat_prepro', 'stats', 'parse_ext', 'parse_maxsat']
>>> ctl.configuration.solve.keys
['solve_limit', 'parallel_mode', 'global_restarts', 'distribute',
 'integrate', 'enum_mode', 'project', 'models', 'opt_mode']
>>> ctl.configuration.solve.description("models")
'Compute at most %A models (0 for all)\n'
>>> ctl.configuration.solve.models = 0
>>> ctl.add("base", [], "1 {a; b}.")
>>> ctl.ground([("base", [])])
>>> print(ctl.solve(on_model=print))
b
a
a b
SAT
```
    )ListOptionalUnion   )_c_call_ffi_handle_error_lib_to_strConfigurationc                      ^  \ rS rSrSrU 4S jr\S\4S j5       r\S\	4S j5       r
S\S\\   4S jrS	 rS
\SS 4S jrS\S\S\S 4   4S jrS\SS4S jrS\S\4S jr\S\\\      4S j5       rSrU =r$ )r   '   a  
Allows for changing the configuration of the underlying solver.

Options are organized hierarchically. To change and inspect an option use:

    config.group.subgroup.option = "value"
    value = config.group.subgroup.option

There are also arrays of option groups that can be accessed using integer
indices:

    config.group.subgroup[0].option = "value1"
    config.group.subgroup[1].option = "value2"

To list the subgroups of an option group, use the `Configuration.keys`
member. Array option groups, like solver, can be iterated. Furthermore,
there are meta options having key `configuration`. Assigning a meta option
sets a number of related options.  To get further information about an
option or option group, use `Configuration.description`.

Notes
-----
The value of an option is always a string and any value assigned to an
option is automatically converted into a string.

See Also
--------
clingo.control.Control.configuration
c                 F   > [         TU ]  SU5        [         TU ]  SU5        g )N_rep_key)super__setattr__)selfrepkey	__class__s      N/home/james-whalen/.local/lib/python3.13/site-packages/clingo/configuration.py__init__Configuration.__init__F   s!    FC(FC(    returnc                 b    [        S[        R                  U R                  U R                  5      $ )N"clingo_configuration_type_bitset_t)r   r
   clingo_configuration_typer   r   r   s    r   _typeConfiguration._typeK   s)    0**IIII	
 	
r   c                 N    [        U R                  [        R                  -  5      $ )z@
This property is true if the configuration option is an array.
)boolr!   r
   clingo_configuration_type_arrayr    s    r   is_arrayConfiguration.is_arrayT   s    
 DJJ!E!EEFFr   namec                 N   U R                   [        R                  -  (       a  [        S[        R                  U R
                  U R                  UR                  5       5      (       a?  [        S[        R                  U R
                  U R                  UR                  5       5      $ g )Nr$   clingo_id_t)	r!   r
   clingo_configuration_type_mapr   #clingo_configuration_map_has_subkeyr   r   encodeclingo_configuration_map_at)r   r(   s     r   _get_subkeyConfiguration._get_subkey[   s{    :::::88				  !44IIIIKKM  r   c                     U R                   [        R                  -  (       a0  [        S[        R                  U R
                  U R                  5      $ g)Nsize_tr   )r!   r
   r%   r   clingo_configuration_array_sizer   r   r    s    r   __len__Configuration.__len__m   s=    ::<<<$>>		499  r   idxc                     US:  d  U[        U 5      :  a  [        S5      e[        S[        R                  U R
                  U R                  U5      n[        U R
                  U5      $ )Nr   zinvalid indexr*   )len
IndexErrorr   r
   clingo_configuration_array_atr   r   r   )r   r6   r   s      r   __getitem__Configuration.__getitem__t   sV    7cSY&_--4==tyy$))UX
 TYY,,r   Nc                 ,   U R                  U5      nUc  [        SU 35      e[        S[        R                  U R
                  U5      nU[        R                  -  (       a  [        S[        R                  U R
                  U5      (       d  g [        S[        R                  U R
                  U5      n[        R                  " SU5      n[        [        R                  " U R
                  X%U5      5        [        U5      $ [        U R
                  U5      $ )Nzno attribute: r   r$   r2   zchar[])r/   AttributeErrorr   r
   r   r   clingo_configuration_type_value&clingo_configuration_value_is_assigned#clingo_configuration_value_get_sizer   newr	   clingo_configuration_value_getr   r   )r   r(   r   type_sizec_vals         r   __getattr__Configuration.__getattr__}   s    t$; >$!8990**II	
 4777CCTYYPS  $BBDIIsD HHXt,E33DIIs4P 5>!TYY,,r   c           	          U R                  U5      nUc  [        SU 35      e[        [        R                  " U R
                  U[        U5      R                  5       5      5        g )Nzget attribute: )r/   r>   r	   r
   clingo_configuration_value_setr   strr-   )r   r(   valr   s       r   r   Configuration.__setattr__   sR    t$; ?4&!9:://		3C@QR	
r   c                     U R                  U5      nUc  [        SU 35      e[        [        S[        R
                  U R                  U5      5      $ )zj
Get a description for an option or option group.

Parameters
----------
name
    The name of the option.
zunknown option char*)r/   RuntimeErrorr   r   r
    clingo_configuration_descriptionr   )r   r(   r   s      r   descriptionConfiguration.description   sP     t$;788GTBBDIIsS
 	
r   c                 h   SnU R                   [        R                  -  (       a  / n[        [	        S[        R
                  U R                  U R                  5      5       HN  n[	        S[        R                  U R                  U R                  U5      nUR                  [        U5      5        MP     U$ )zv
The list of names of sub-option groups or options.

The list is `None` if the current object is not an option group.
Nr2   rO   )r!   r
   r+   ranger   clingo_configuration_map_sizer   r   $clingo_configuration_map_subkey_nameappendr   )r   retir(   s       r   keysConfiguration.keys   s     :::::Cd@@$))TYY
 ==IIII 

74=) 
r    )__name__
__module____qualname____firstlineno____doc__r   propertyintr!   r$   r&   rK   r   r/   r4   r;   r   rG   r   rR   r   r[   __static_attributes____classcell__)r   s   @r   r   r   '   s    <)
 
s 
 
 G$ G G  $-s - -- -dC.H(I -<
 
T 

 
 
  htCy)  r   N)rb   typingr   r   r   	_internalr   r   r	   r
   r   __all__r   r]   r   r   <module>rj      s,   > ) ( B B
c cr   