The py-configparser Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The py-configparser Reference Manual

This is the py-configparser Reference Manual, generated automatically by Declt version 2.4 "Will Decker" on Wed Jun 20 12:26:37 2018 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

$URL: https://svn.common-lisp.net/py-configparser/trunk/README $
$Id: README 19 2008-03-14 20:17:12Z ehuelsmann $

py-configparser
===============

This package provides the same functionality as the Python configparser module,
implemented in pure Common Lisp.


Differences between the two
===========================

The CL version makes a strong distinction in the parser on one hand and the in-memory
storage management on the other hand.  Because of it, the CL version doesn't call its
objects 'Parser', but 'config' instead.

The parser/writer part of the package provides the three functions READ-STREAM,
READ-FILES and WRITE-STREAM, which map from the python variants 'readfp', 'read'
and 'write'.


API mapping
===========

The functions provided in the Python module (which are all methods of the ConfigParser
class):

ConfigParser() -> (make-config)
defaults() ->  (defaults )
sections() ->  (sections )
add_section(name) -> (add-section  name)
has_section(name) -> (has-section-p  name)
options(section_name) -> (options  section-name)
has_option(section_name, name) -> (has-option-p  section-name name)
read(filenames) -> (read-files  filenames)
readfd(fp) -> (read-stream  stream)
get(section, option[, raw[, vars]]) ->
          (get-option  section option &key expand defaults type)
getint(section, option) -> [folded into get-option using 'type' key]
getfloat(section, option) -> [folded into get-option using 'type' key]
getboolean(section, option) -> [folded into get-option using 'type' key]
items(section_name[, raw[, vars]]) -> (items  section-name &key expand defaults)
set(section, option, value) -> (set-option  section-name option-name value)
write(fp) -> (write-stream  stream)
remove_option(section, option) -> (remove-option  section-name option-name)
remove_section(section) -> (remove-section  section-name)

Note that the above is just a simple mapping table, but is all you need to get
you started.  Documentation from the ConfigParser module should sufficiently document
this package.  However minor differences in parameter and method naming may occur.



Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

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


Previous: , Up: Systems   [Contents][Index]

2.1 py-configparser

Author

Erik Huelsmann

License

MIT

Description

Common Lisp implementation of the Python ConfigParser module

Dependency

parse-number

Source

py-configparser.asd (file)

Components

Next: , Previous: , Up: Top   [Contents][Index]

3 Files

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


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.1 py-configparser.asd

Location

py-configparser.asd

Systems

py-configparser (system)

Packages

py-configparser-system


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.2 py-configparser/package.lisp

Parent

py-configparser (system)

Location

package.lisp

Packages

py-configparser


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.3 py-configparser/config.lisp

Dependency

package.lisp (file)

Parent

py-configparser (system)

Location

config.lisp

Exported Definitions
Internal Definitions

Previous: , Up: Lisp files   [Contents][Index]

3.1.4 py-configparser/parser.lisp

Dependency

config.lisp (file)

Parent

py-configparser (system)

Location

parser.lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

4 Packages

Packages are listed by definition order.


Next: , Previous: , Up: Packages   [Contents][Index]

4.1 py-configparser-system

Source

py-configparser.asd

Use List

Previous: , Up: Packages   [Contents][Index]

4.2 py-configparser

Source

package.lisp (file)

Use List

common-lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

5 Definitions

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


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.1 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 (file)

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 (file)

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 (file)

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 (file)

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 (file)

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 (file)

Function: make-config &key (DEFAULTS DEFAULTS) (SECTIONS SECTIONS) (OPTION-NAME-TRANSFORM-FN OPTION-NAME-TRANSFORM-FN) (SECTION-NAME-TRANSFORM-FN SECTION-NAME-TRANSFORM-FN)
Package

py-configparser

Source

config.lisp (file)

Function: options CONFIG SECTION-NAME

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

Package

py-configparser

Source

config.lisp (file)

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 (file)

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 (file)

Function: remove-option CONFIG SECTION-NAME OPTION-NAME

Remove the specified option from the given section.

Package

py-configparser

Source

config.lisp (file)

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 (file)

Function: sections CONFIG

Returns a list of names of defined sections.

Package

py-configparser

Source

config.lisp (file)

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 (file)

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 (file)


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.2 Conditions

Condition: configparser-error ()
Package

py-configparser

Source

config.lisp (file)

Direct superclasses

error (condition)

Direct subclasses
Condition: duplicate-section-error ()
Package

py-configparser

Source

config.lisp (file)

Direct superclasses

config-error (condition)

Condition: interpolation-depth-error ()
Package

py-configparser

Source

config.lisp (file)

Direct superclasses

interpolation-error (condition)

Condition: interpolation-error ()
Package

py-configparser

Source

config.lisp (file)

Direct superclasses

config-error (condition)

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

py-configparser

Source

config.lisp (file)

Direct superclasses

interpolation-error (condition)

Condition: interpolation-syntax-error ()
Package

py-configparser

Source

config.lisp (file)

Direct superclasses

interpolation-error (condition)

Condition: missing-section-header-error ()
Package

py-configparser

Source

parser.lisp (file)

Direct superclasses

parsing-error (condition)

Condition: no-option-error ()
Package

py-configparser

Source

config.lisp (file)

Direct superclasses

config-error (condition)

Condition: no-section-error ()
Package

py-configparser

Source

config.lisp (file)

Direct superclasses

config-error (condition)

Condition: parsing-error ()
Package

py-configparser

Source

parser.lisp (file)

Direct superclasses

configparser-error (condition)

Direct subclasses

missing-section-header-error (condition)

Direct methods
Direct slots
Slot: line-no
Initargs

:line-no

Initform

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

Readers

line (generic function)

Slot: file
Initargs

:file

Initform

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

Readers

file (generic function)

Slot: section
Initargs

:section

Initform

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

Readers

section (generic function)

Slot: message
Initargs

:text

Readers

message (generic function)


Previous: , Up: Exported definitions   [Contents][Index]

5.1.3 Structures

Structure: config ()
Package

py-configparser

Source

config.lisp (file)

Direct superclasses

structure-object (structure)

Direct slots
Slot: defaults
Initform

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

Readers

config-defaults (function)

Writers

(setf config-defaults) (function)

Slot: sections
Readers

config-sections (function)

Writers

(setf config-sections) (function)

Slot: option-name-transform-fn
Initform

(function string-downcase)

Readers

config-option-name-transform-fn (function)

Writers

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

Slot: section-name-transform-fn
Initform

(function identity)

Readers

config-section-name-transform-fn (function)

Writers

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


Previous: , Up: Definitions   [Contents][Index]

5.2 Internal definitions


Next: , Previous: , Up: Internal definitions   [Contents][Index]

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


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.2 Functions

Function: %expand-option-value CONFIG SECTION OPTION-VALUE DEFAULTS &optional DEPENDEES
Package

py-configparser

Source

config.lisp (file)

Function: %extract-replacement OPTION-VALUE
Package

py-configparser

Source

config.lisp (file)

Function: %format-value VALUE
Package

py-configparser

Source

parser.lisp (file)

Function: %get-option CONFIG SECTION-NAME OPTION-NAME IF-DOES-NOT-EXIST
Package

py-configparser

Source

config.lisp (file)

Function: %get-section CONFIG SECTION-NAME
Package

py-configparser

Source

config.lisp (file)

Function: %option-value CONFIG SECTION OPTION-NAME &key DEFAULTS
Package

py-configparser

Source

config.lisp (file)

Function: %read-char STREAM
Package

py-configparser

Source

parser.lisp (file)

Function: %validate-option-name NAME
Package

py-configparser

Source

config.lisp (file)

Function: %validate-section-name NAME
Package

py-configparser

Source

config.lisp (file)

Function: config-defaults INSTANCE
Function: (setf config-defaults) VALUE INSTANCE
Package

py-configparser

Source

config.lisp (file)

Function: config-option-name-transform-fn INSTANCE
Function: (setf config-option-name-transform-fn) VALUE INSTANCE
Package

py-configparser

Source

config.lisp (file)

Function: config-p OBJECT
Package

py-configparser

Source

config.lisp (file)

Function: config-section-name-transform-fn INSTANCE
Function: (setf config-section-name-transform-fn) VALUE INSTANCE
Package

py-configparser

Source

config.lisp (file)

Function: config-sections INSTANCE
Function: (setf config-sections) VALUE INSTANCE
Package

py-configparser

Source

config.lisp (file)

Function: copy-config INSTANCE
Package

py-configparser

Source

config.lisp (file)

Function: copy-section INSTANCE
Package

py-configparser

Source

config.lisp (file)

Function: ensure-section CONFIG SECTION-NAME
Package

py-configparser

Source

parser.lisp (file)

Function: expect-char S EXPECT &key SKIP-WHITESPACE
Package

py-configparser

Source

parser.lisp (file)

Function: expect-one-of S EXPECT-BAG &key SKIP-WHITESPACE
Package

py-configparser

Source

parser.lisp (file)

Function: extend-input P C
Package

py-configparser

Source

parser.lisp (file)

Function: finalize-input P
Package

py-configparser

Source

parser.lisp (file)

Function: is-comment-char C
Package

py-configparser

Source

parser.lisp (file)

Function: is-whitespace C
Package

py-configparser

Source

parser.lisp (file)

Function: make-input-buffer P
Package

py-configparser

Source

parser.lisp (file)

Function: make-section &key (NAME NAME) (OPTIONS OPTIONS)
Package

py-configparser

Source

config.lisp (file)

Function: norm-option-name CONFIG OPTION-NAME
Package

py-configparser

Source

config.lisp (file)

Function: norm-section-name CONFIG SECTION-NAME
Package

py-configparser

Source

config.lisp (file)

Function: read-option-name P S
Package

py-configparser

Source

parser.lisp (file)

Function: read-option-value P S &key LEADING-WHITE
Package

py-configparser

Source

parser.lisp (file)

Function: read-section-name P S
Package

py-configparser

Source

parser.lisp (file)

Function: reading-driver P S
Package

py-configparser

Source

parser.lisp (file)

Function: section-name INSTANCE
Function: (setf section-name) VALUE INSTANCE
Package

py-configparser

Source

config.lisp (file)

Function: section-options INSTANCE
Function: (setf section-options) VALUE INSTANCE
Package

py-configparser

Source

config.lisp (file)

Function: section-p OBJECT
Package

py-configparser

Source

config.lisp (file)

Function: skip-empty-line S
Package

py-configparser

Source

parser.lisp (file)

Function: skip-to-eol S
Package

py-configparser

Source

parser.lisp (file)

Function: skip-whitespace S
Package

py-configparser

Source

parser.lisp (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.3 Generic functions

Generic Function: file CONDITION
Package

py-configparser

Methods
Method: file (CONDITION parsing-error)
Source

parser.lisp (file)

Generic Function: line CONDITION
Package

py-configparser

Methods
Method: line (CONDITION parsing-error)
Source

parser.lisp (file)

Generic Function: message CONDITION
Package

py-configparser

Methods
Method: message (CONDITION parsing-error)
Source

parser.lisp (file)

Generic Function: section CONDITION
Package

py-configparser

Methods
Method: section (CONDITION parsing-error)
Source

parser.lisp (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.4 Conditions

Condition: config-error ()
Package

py-configparser

Source

config.lisp (file)

Direct superclasses

configparser-error (condition)

Direct subclasses

Previous: , Up: Internal definitions   [Contents][Index]

5.2.5 Structures

Structure: section ()
Package

py-configparser

Source

config.lisp (file)

Direct superclasses

structure-object (structure)

Direct slots
Slot: name
Readers

section-name (function)

Writers

(setf section-name) (function)

Slot: options
Readers

section-options (function)

Writers

(setf section-options) (function)


Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   F   L   P  
Index Entry  Section

F
File, Lisp, py-configparser.asd: The py-configparser<dot>asd file
File, Lisp, py-configparser/config.lisp: The py-configparser/config<dot>lisp file
File, Lisp, py-configparser/package.lisp: The py-configparser/package<dot>lisp file
File, Lisp, py-configparser/parser.lisp: The py-configparser/parser<dot>lisp file

L
Lisp File, py-configparser.asd: The py-configparser<dot>asd file
Lisp File, py-configparser/config.lisp: The py-configparser/config<dot>lisp file
Lisp File, py-configparser/package.lisp: The py-configparser/package<dot>lisp file
Lisp File, py-configparser/parser.lisp: The py-configparser/parser<dot>lisp file

P
py-configparser.asd: The py-configparser<dot>asd file
py-configparser/config.lisp: The py-configparser/config<dot>lisp file
py-configparser/package.lisp: The py-configparser/package<dot>lisp file
py-configparser/parser.lisp: The py-configparser/parser<dot>lisp file

Jump to:   F   L   P  

Next: , Previous: , Up: Indexes   [Contents][Index]

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: Internal functions
%extract-replacement: Internal functions
%format-value: Internal functions
%get-option: Internal functions
%get-section: Internal functions
%option-value: Internal functions
%read-char: Internal functions
%validate-option-name: Internal functions
%validate-section-name: Internal functions

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

A
add-section: Exported functions

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

D
defaults: Exported functions

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

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

G
Generic Function, file: Internal generic functions
Generic Function, line: Internal generic functions
Generic Function, message: Internal generic functions
Generic Function, section: Internal generic functions
get-option: Exported functions

H
has-option-p: Exported functions
has-section-p: Exported functions

I
is-comment-char: Internal functions
is-whitespace: Internal functions
items: Exported functions

L
line: Internal generic functions
line: Internal generic functions

M
make-config: Exported functions
make-input-buffer: Internal functions
make-section: Internal functions
message: Internal generic functions
message: Internal generic functions
Method, file: Internal generic functions
Method, line: Internal generic functions
Method, message: Internal generic functions
Method, section: Internal generic functions

N
norm-option-name: Internal functions
norm-section-name: Internal functions

O
options: Exported functions

R
read-files: Exported functions
read-option-name: Internal functions
read-option-value: Internal functions
read-section-name: Internal functions
read-stream: Exported functions
reading-driver: Internal functions
remove-option: Exported functions
remove-section: Exported functions

S
section: Internal generic functions
section: Internal generic functions
section-name: Internal functions
section-options: Internal functions
section-p: Internal functions
sections: Exported functions
set-option: Exported functions
skip-empty-line: Internal functions
skip-to-eol: Internal functions
skip-whitespace: Internal functions

W
write-stream: Exported functions

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

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   *  
D   F   L   M   N   O   S  
Index Entry  Section

*
*current-input*: Internal special variables
*current-section*: Internal special variables
*file-name*: Internal special variables
*line-no*: Internal special variables

D
defaults: Exported structures

F
file: Exported conditions

L
line-no: Exported conditions

M
message: Exported conditions

N
name: Internal structures

O
option-name-transform-fn: Exported structures
options: Internal structures

S
section: Exported conditions
section-name-transform-fn: Exported structures
sections: Exported structures
Slot, defaults: Exported structures
Slot, file: Exported conditions
Slot, line-no: Exported conditions
Slot, message: Exported conditions
Slot, name: Internal structures
Slot, option-name-transform-fn: Exported structures
Slot, options: Internal structures
Slot, section: Exported conditions
Slot, section-name-transform-fn: Exported structures
Slot, sections: Exported structures
Special Variable, *current-input*: Internal special variables
Special Variable, *current-section*: Internal special variables
Special Variable, *file-name*: Internal special variables
Special Variable, *line-no*: Internal special variables

Jump to:   *  
D   F   L   M   N   O   S  

Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

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

C
Condition, config-error: Internal conditions
Condition, configparser-error: Exported conditions
Condition, duplicate-section-error: Exported conditions
Condition, interpolation-depth-error: Exported conditions
Condition, interpolation-error: Exported conditions
Condition, interpolation-missing-option-error: Exported conditions
Condition, interpolation-syntax-error: Exported conditions
Condition, missing-section-header-error: Exported conditions
Condition, no-option-error: Exported conditions
Condition, no-section-error: Exported conditions
Condition, parsing-error: Exported conditions
config: Exported structures
config-error: Internal conditions
configparser-error: Exported conditions

D
duplicate-section-error: Exported conditions

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

M
missing-section-header-error: Exported conditions

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

P
Package, py-configparser: The py-configparser package
Package, py-configparser-system: The py-configparser-system package
parsing-error: Exported conditions
py-configparser: The py-configparser system
py-configparser: The py-configparser package
py-configparser-system: The py-configparser-system package

S
section: Internal structures
Structure, config: Exported structures
Structure, section: Internal structures
System, py-configparser: The py-configparser system

Jump to:   C   D   I   M   N   P   S