The py-configparser Reference Manual

This is the py-configparser Reference Manual, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 07:21:49 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 py-configparser

Common Lisp implementation of the Python ConfigParser module

Author

Erik Huelsmann

License

MIT

Dependency

parse-number (system).

Source

py-configparser.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


3.1 Lisp


3.1.1 py-configparser/py-configparser.asd

Source

py-configparser.asd.

Parent Component

py-configparser (system).

ASDF Systems

py-configparser.

Packages

py-configparser-system.


3.1.2 py-configparser/package.lisp

Source

py-configparser.asd.

Parent Component

py-configparser (system).

Packages

py-configparser.


3.1.3 py-configparser/config.lisp

Dependency

package.lisp (file).

Source

py-configparser.asd.

Parent Component

py-configparser (system).

Public Interface
Internals

3.1.4 py-configparser/parser.lisp

Dependency

config.lisp (file).

Source

py-configparser.asd.

Parent Component

py-configparser (system).

Public Interface
Internals

4 Packages

Packages are listed by definition order.


4.1 py-configparser

Source

package.lisp.

Use List

common-lisp.

Public Interface
Internals

4.2 py-configparser-system

Source

py-configparser.asd.

Use List
  • asdf/interface.
  • common-lisp.

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


5.1 Public Interface


5.1.1 Ordinary functions

Function: add-section (config section-name)

Adds a new section to the config.

If the section exists, the ‘duplicate-section-error’ is raised.

Package

py-configparser.

Source

config.lisp.

Function: defaults (config)

Returns an alist containing instance wide defaults, where the elements are 2-element dotted lists: the CDR is the value associated with the key.

Package

py-configparser.

Source

config.lisp.

Function: get-option (config section-name option-name &key expand defaults type)

Returns the value of the specified option in the specified section.

If ‘expand’ is ‘NIL’, any options which depend on other options
won’t be expanded and the raw configuration value is returned.

When ‘defaults’ is an alist of which the elements are dotted lists of key/value pairs, these values are used in the expansion of option values.

‘type’ may be one of ‘:boolean’, ‘:number’ or it may remain unspecified.

Package

py-configparser.

Source

config.lisp.

Function: has-option-p (config section-name option-name)

Returns a generalised boolean with a value of ‘NIL’ when the specified option does not exist in the specified section and some other value otherwise.

Package

py-configparser.

Source

config.lisp.

Function: has-section-p (config section-name)

Returns ‘NIL’ when the section is not added to the config yet, some other value if it is.

Package

py-configparser.

Source

config.lisp.

Function: items (config section-name &key expand defaults)

Returns an alist of which the items are dotted lists of key/value pairs being the option names and values specified in the given section.

When ‘expand’ is ‘NIL’, options are returned in raw form. Otherwise option values are expanded.

The definition of ‘defaults’ is the same as for ‘get-option’.

Package

py-configparser.

Source

config.lisp.

Function: make-config (&key defaults sections option-name-transform-fn section-name-transform-fn)
Package

py-configparser.

Source

config.lisp.

Function: options (config section-name)

Returns a list of option names which are defined in the given section.

Package

py-configparser.

Source

config.lisp.

Function: read-files (config filenames)

Parses the files given in the list ‘filenames’, if they exist.
The list is processed first to last, overwriting any pre-existing values with the last value read.

The results are stored in ‘config’ which is modified destructively.

Returns as values the configuration and the list of files actually read.

Package

py-configparser.

Source

parser.lisp.

Function: read-stream (config stream &key stream-name)

Parses the content of ‘stream’ as a configuration file, storing any values in ‘config’ which is modified destructively.

This function maps from the python ’readfp()’ function.

Package

py-configparser.

Source

parser.lisp.

Function: remove-option (config section-name option-name)

Remove the specified option from the given section.

Package

py-configparser.

Source

config.lisp.

Function: remove-section (config section-name)

Remove the specified section.

In case the section name equals the magic name ‘DEFAULT’, an error is raised, since this section can’t be removed.

Package

py-configparser.

Source

config.lisp.

Function: sections (config)

Returns a list of names of defined sections.

Package

py-configparser.

Source

config.lisp.

Function: set-option (config section-name option-name value)

Sets the value of the specified option in the specified section.

If the section does not exist, a ‘no-section-error’ is raised. If the option does not exist, it is created.

Package

py-configparser.

Source

config.lisp.

Function: write-stream (config stream)

Writes the configuration file corresponding to the in-memory config state. Reloading the file
with ‘read-stream’ or ‘read-files’ will restore config state.

Package

py-configparser.

Source

parser.lisp.


5.1.2 Conditions

Condition: configparser-error
Package

py-configparser.

Source

config.lisp.

Direct superclasses

error.

Direct subclasses
Condition: duplicate-section-error
Package

py-configparser.

Source

config.lisp.

Direct superclasses

config-error.

Condition: interpolation-depth-error
Package

py-configparser.

Source

config.lisp.

Direct superclasses

interpolation-error.

Condition: interpolation-error
Package

py-configparser.

Source

config.lisp.

Direct superclasses

config-error.

Direct subclasses
Condition: interpolation-missing-option-error
Package

py-configparser.

Source

config.lisp.

Direct superclasses

interpolation-error.

Condition: interpolation-syntax-error
Package

py-configparser.

Source

config.lisp.

Direct superclasses

interpolation-error.

Condition: missing-section-header-error
Package

py-configparser.

Source

parser.lisp.

Direct superclasses

parsing-error.

Condition: no-option-error
Package

py-configparser.

Source

config.lisp.

Direct superclasses

config-error.

Condition: no-section-error
Package

py-configparser.

Source

config.lisp.

Direct superclasses

config-error.

Condition: parsing-error
Package

py-configparser.

Source

parser.lisp.

Direct superclasses

configparser-error.

Direct subclasses

missing-section-header-error.

Direct methods
Direct slots
Slot: line-no
Initform

(quote py-configparser::*line-no*)

Initargs

:line-no

Readers

line.

Writers

This slot is read-only.

Slot: file
Initform

(quote py-configparser::*file-name*)

Initargs

:file

Readers

file.

Writers

This slot is read-only.

Slot: section
Initform

(quote py-configparser::*current-section*)

Initargs

:section

Readers

section.

Writers

This slot is read-only.

Slot: message
Initargs

:text

Readers

message.

Writers

This slot is read-only.


5.1.3 Structures

Structure: config
Package

py-configparser.

Source

config.lisp.

Direct superclasses

structure-object.

Direct slots
Slot: defaults
Initform

(py-configparser::make-section :name "default")

Readers

config-defaults.

Writers

(setf config-defaults).

Slot: sections
Readers

config-sections.

Writers

(setf config-sections).

Slot: option-name-transform-fn
Initform

(function string-downcase)

Readers

config-option-name-transform-fn.

Writers

(setf config-option-name-transform-fn).

Slot: section-name-transform-fn
Initform

(function identity)

Readers

config-section-name-transform-fn.

Writers

(setf config-section-name-transform-fn).


5.2 Internals


5.2.1 Special variables

Special Variable: *current-input*
Package

py-configparser.

Special Variable: *current-section*
Package

py-configparser.

Special Variable: *file-name*
Package

py-configparser.

Special Variable: *line-no*
Package

py-configparser.


5.2.2 Ordinary functions

Function: %expand-option-value (config section option-value defaults &optional dependees)
Package

py-configparser.

Source

config.lisp.

Function: %extract-replacement (option-value)
Package

py-configparser.

Source

config.lisp.

Function: %format-value (value)
Package

py-configparser.

Source

parser.lisp.

Function: %get-option (config section-name option-name if-does-not-exist)
Package

py-configparser.

Source

config.lisp.

Function: %get-section (config section-name)
Package

py-configparser.

Source

config.lisp.

Function: %option-value (config section option-name &key defaults)
Package

py-configparser.

Source

config.lisp.

Function: %read-char (stream)
Package

py-configparser.

Source

parser.lisp.

Function: %validate-option-name (name)
Package

py-configparser.

Source

config.lisp.

Function: %validate-section-name (name)
Package

py-configparser.

Source

config.lisp.

Reader: config-defaults (instance)
Writer: (setf config-defaults) (instance)
Package

py-configparser.

Source

config.lisp.

Target Slot

defaults.

Reader: config-option-name-transform-fn (instance)
Writer: (setf config-option-name-transform-fn) (instance)
Package

py-configparser.

Source

config.lisp.

Target Slot

option-name-transform-fn.

Function: config-p (object)
Package

py-configparser.

Source

config.lisp.

Reader: config-section-name-transform-fn (instance)
Writer: (setf config-section-name-transform-fn) (instance)
Package

py-configparser.

Source

config.lisp.

Target Slot

section-name-transform-fn.

Reader: config-sections (instance)
Writer: (setf config-sections) (instance)
Package

py-configparser.

Source

config.lisp.

Target Slot

sections.

Function: copy-config (instance)
Package

py-configparser.

Source

config.lisp.

Function: copy-section (instance)
Package

py-configparser.

Source

config.lisp.

Function: ensure-section (config section-name)
Package

py-configparser.

Source

parser.lisp.

Function: expect-char (s expect &key skip-whitespace)
Package

py-configparser.

Source

parser.lisp.

Function: expect-one-of (s expect-bag &key skip-whitespace)
Package

py-configparser.

Source

parser.lisp.

Function: extend-input (p c)
Package

py-configparser.

Source

parser.lisp.

Function: finalize-input (p)
Package

py-configparser.

Source

parser.lisp.

Function: is-comment-char (c)
Package

py-configparser.

Source

parser.lisp.

Function: is-whitespace (c)
Package

py-configparser.

Source

parser.lisp.

Function: make-input-buffer (p)
Package

py-configparser.

Source

parser.lisp.

Function: make-section (&key name options)
Package

py-configparser.

Source

config.lisp.

Function: norm-option-name (config option-name)
Package

py-configparser.

Source

config.lisp.

Function: norm-section-name (config section-name)
Package

py-configparser.

Source

config.lisp.

Function: read-option-name (p s)
Package

py-configparser.

Source

parser.lisp.

Function: read-option-value (p s &key leading-white)
Package

py-configparser.

Source

parser.lisp.

Function: read-section-name (p s)
Package

py-configparser.

Source

parser.lisp.

Function: reading-driver (p s)
Package

py-configparser.

Source

parser.lisp.

Reader: section-name (instance)
Writer: (setf section-name) (instance)
Package

py-configparser.

Source

config.lisp.

Target Slot

name.

Reader: section-options (instance)
Writer: (setf section-options) (instance)
Package

py-configparser.

Source

config.lisp.

Target Slot

options.

Function: section-p (object)
Package

py-configparser.

Source

config.lisp.

Function: skip-empty-line (s)
Package

py-configparser.

Source

parser.lisp.

Function: skip-to-eol (s)
Package

py-configparser.

Source

parser.lisp.

Function: skip-whitespace (s)
Package

py-configparser.

Source

parser.lisp.


5.2.3 Generic functions

Generic Reader: file (condition)
Package

py-configparser.

Methods
Reader Method: file ((condition parsing-error))
Source

parser.lisp.

Target Slot

file.

Generic Reader: line (condition)
Package

py-configparser.

Methods
Reader Method: line ((condition parsing-error))
Source

parser.lisp.

Target Slot

line-no.

Generic Reader: message (condition)
Package

py-configparser.

Methods
Reader Method: message ((condition parsing-error))
Source

parser.lisp.

Target Slot

message.

Generic Reader: section (condition)
Package

py-configparser.

Methods
Reader Method: section ((condition parsing-error))
Source

parser.lisp.

Target Slot

section.


5.2.4 Conditions

Condition: config-error
Package

py-configparser.

Source

config.lisp.

Direct superclasses

configparser-error.

Direct subclasses

5.2.5 Structures

Structure: section
Package

py-configparser.

Source

config.lisp.

Direct superclasses

structure-object.

Direct slots
Slot: name
Readers

section-name.

Writers

(setf section-name).

Slot: options
Readers

section-options.

Writers

(setf section-options).


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   %   (  
A   C   D   E   F   G   H   I   L   M   N   O   R   S   W  
Index Entry  Section

%
%expand-option-value: Private ordinary functions
%extract-replacement: Private ordinary functions
%format-value: Private ordinary functions
%get-option: Private ordinary functions
%get-section: Private ordinary functions
%option-value: Private ordinary functions
%read-char: Private ordinary functions
%validate-option-name: Private ordinary functions
%validate-section-name: Private ordinary functions

(
(setf config-defaults): Private ordinary functions
(setf config-option-name-transform-fn): Private ordinary functions
(setf config-section-name-transform-fn): Private ordinary functions
(setf config-sections): Private ordinary functions
(setf section-name): Private ordinary functions
(setf section-options): Private ordinary functions

A
add-section: Public ordinary functions

C
config-defaults: Private ordinary functions
config-option-name-transform-fn: Private ordinary functions
config-p: Private ordinary functions
config-section-name-transform-fn: Private ordinary functions
config-sections: Private ordinary functions
copy-config: Private ordinary functions
copy-section: Private ordinary functions

D
defaults: Public ordinary functions

E
ensure-section: Private ordinary functions
expect-char: Private ordinary functions
expect-one-of: Private ordinary functions
extend-input: Private ordinary functions

F
file: Private generic functions
file: Private generic functions
finalize-input: Private ordinary functions
Function, %expand-option-value: Private ordinary functions
Function, %extract-replacement: Private ordinary functions
Function, %format-value: Private ordinary functions
Function, %get-option: Private ordinary functions
Function, %get-section: Private ordinary functions
Function, %option-value: Private ordinary functions
Function, %read-char: Private ordinary functions
Function, %validate-option-name: Private ordinary functions
Function, %validate-section-name: Private ordinary functions
Function, (setf config-defaults): Private ordinary functions
Function, (setf config-option-name-transform-fn): Private ordinary functions
Function, (setf config-section-name-transform-fn): Private ordinary functions
Function, (setf config-sections): Private ordinary functions
Function, (setf section-name): Private ordinary functions
Function, (setf section-options): Private ordinary functions
Function, add-section: Public ordinary functions
Function, config-defaults: Private ordinary functions
Function, config-option-name-transform-fn: Private ordinary functions
Function, config-p: Private ordinary functions
Function, config-section-name-transform-fn: Private ordinary functions
Function, config-sections: Private ordinary functions
Function, copy-config: Private ordinary functions
Function, copy-section: Private ordinary functions
Function, defaults: Public ordinary functions
Function, ensure-section: Private ordinary functions
Function, expect-char: Private ordinary functions
Function, expect-one-of: Private ordinary functions
Function, extend-input: Private ordinary functions
Function, finalize-input: Private ordinary functions
Function, get-option: Public ordinary functions
Function, has-option-p: Public ordinary functions
Function, has-section-p: Public ordinary functions
Function, is-comment-char: Private ordinary functions
Function, is-whitespace: Private ordinary functions
Function, items: Public ordinary functions
Function, make-config: Public ordinary functions
Function, make-input-buffer: Private ordinary functions
Function, make-section: Private ordinary functions
Function, norm-option-name: Private ordinary functions
Function, norm-section-name: Private ordinary functions
Function, options: Public ordinary functions
Function, read-files: Public ordinary functions
Function, read-option-name: Private ordinary functions
Function, read-option-value: Private ordinary functions
Function, read-section-name: Private ordinary functions
Function, read-stream: Public ordinary functions
Function, reading-driver: Private ordinary functions
Function, remove-option: Public ordinary functions
Function, remove-section: Public ordinary functions
Function, section-name: Private ordinary functions
Function, section-options: Private ordinary functions
Function, section-p: Private ordinary functions
Function, sections: Public ordinary functions
Function, set-option: Public ordinary functions
Function, skip-empty-line: Private ordinary functions
Function, skip-to-eol: Private ordinary functions
Function, skip-whitespace: Private ordinary functions
Function, write-stream: Public ordinary functions

G
Generic Function, file: Private generic functions
Generic Function, line: Private generic functions
Generic Function, message: Private generic functions
Generic Function, section: Private generic functions
get-option: Public ordinary functions

H
has-option-p: Public ordinary functions
has-section-p: Public ordinary functions

I
is-comment-char: Private ordinary functions
is-whitespace: Private ordinary functions
items: Public ordinary functions

L
line: Private generic functions
line: Private generic functions

M
make-config: Public ordinary functions
make-input-buffer: Private ordinary functions
make-section: Private ordinary functions
message: Private generic functions
message: Private generic functions
Method, file: Private generic functions
Method, line: Private generic functions
Method, message: Private generic functions
Method, section: Private generic functions

N
norm-option-name: Private ordinary functions
norm-section-name: Private ordinary functions

O
options: Public ordinary functions

R
read-files: Public ordinary functions
read-option-name: Private ordinary functions
read-option-value: Private ordinary functions
read-section-name: Private ordinary functions
read-stream: Public ordinary functions
reading-driver: Private ordinary functions
remove-option: Public ordinary functions
remove-section: Public ordinary functions

S
section: Private generic functions
section: Private generic functions
section-name: Private ordinary functions
section-options: Private ordinary functions
section-p: Private ordinary functions
sections: Public ordinary functions
set-option: Public ordinary functions
skip-empty-line: Private ordinary functions
skip-to-eol: Private ordinary functions
skip-whitespace: Private ordinary functions

W
write-stream: Public ordinary functions


A.4 Data types

Jump to:   C   D   F   I   M   N   P   S  
Index Entry  Section

C
Condition, config-error: Private conditions
Condition, configparser-error: Public conditions
Condition, duplicate-section-error: Public conditions
Condition, interpolation-depth-error: Public conditions
Condition, interpolation-error: Public conditions
Condition, interpolation-missing-option-error: Public conditions
Condition, interpolation-syntax-error: Public conditions
Condition, missing-section-header-error: Public conditions
Condition, no-option-error: Public conditions
Condition, no-section-error: Public conditions
Condition, parsing-error: Public conditions
config: Public structures
config-error: Private conditions
config.lisp: The py-configparser/config․lisp file
configparser-error: Public conditions

D
duplicate-section-error: Public conditions

F
File, config.lisp: The py-configparser/config․lisp file
File, package.lisp: The py-configparser/package․lisp file
File, parser.lisp: The py-configparser/parser․lisp file
File, py-configparser.asd: The py-configparser/py-configparser․asd file

I
interpolation-depth-error: Public conditions
interpolation-error: Public conditions
interpolation-missing-option-error: Public conditions
interpolation-syntax-error: Public conditions

M
missing-section-header-error: Public conditions

N
no-option-error: Public conditions
no-section-error: Public conditions

P
Package, py-configparser: The py-configparser package
Package, py-configparser-system: The py-configparser-system package
package.lisp: The py-configparser/package․lisp file
parser.lisp: The py-configparser/parser․lisp file
parsing-error: Public conditions
py-configparser: The py-configparser system
py-configparser: The py-configparser package
py-configparser-system: The py-configparser-system package
py-configparser.asd: The py-configparser/py-configparser․asd file

S
section: Private structures
Structure, config: Public structures
Structure, section: Private structures
System, py-configparser: The py-configparser system