mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-08-08 22:36:48 +02:00
remove special DEFAULT section handling
This commit is contained in:
@@ -6,11 +6,6 @@ Parses standard `INI` files.
|
|||||||
- Comment prefix can be `#` or `;`. Comments must be on their own line.
|
- Comment prefix can be `#` or `;`. Comments must be on their own line.
|
||||||
- If duplicate keys are found, only the last value will be used.
|
- If duplicate keys are found, only the last value will be used.
|
||||||
|
|
||||||
> Note: The section identifier `[DEFAULT]` is special and provides default
|
|
||||||
> values for the section keys that follow. To disable this behavior you must
|
|
||||||
> rename the `[DEFAULT]` section identifier to something else before
|
|
||||||
> parsing.
|
|
||||||
|
|
||||||
> Note: Values starting and ending with double or single quotation marks
|
> Note: Values starting and ending with double or single quotation marks
|
||||||
> will have the marks removed. If you would like to keep the quotation
|
> will have the marks removed. If you would like to keep the quotation
|
||||||
> marks, use the `-r` command-line argument or the `raw=True` argument in
|
> marks, use the `-r` command-line argument or the `raw=True` argument in
|
||||||
@@ -143,6 +138,7 @@ def parse(data, raw=False, quiet=False):
|
|||||||
ini_parser = configparser.ConfigParser(
|
ini_parser = configparser.ConfigParser(
|
||||||
allow_no_value=True,
|
allow_no_value=True,
|
||||||
interpolation=None,
|
interpolation=None,
|
||||||
|
default_section=None,
|
||||||
strict=False
|
strict=False
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -36,6 +36,7 @@ Examples:
|
|||||||
name = John Doe
|
name = John Doe
|
||||||
address=555 California Drive
|
address=555 California Drive
|
||||||
age: 34
|
age: 34
|
||||||
|
|
||||||
; comments can include # or ;
|
; comments can include # or ;
|
||||||
# delimiter can be = or :
|
# delimiter can be = or :
|
||||||
# quoted values have quotation marks stripped by default
|
# quoted values have quotation marks stripped by default
|
||||||
@@ -118,6 +119,7 @@ def parse(data, raw=False, quiet=False):
|
|||||||
kv_parser = configparser.ConfigParser(
|
kv_parser = configparser.ConfigParser(
|
||||||
allow_no_value=True,
|
allow_no_value=True,
|
||||||
interpolation=None,
|
interpolation=None,
|
||||||
|
default_section=None,
|
||||||
strict=False
|
strict=False
|
||||||
)
|
)
|
||||||
|
|
||||||
|
2
tests/fixtures/generic/ini-test.json
vendored
2
tests/fixtures/generic/ini-test.json
vendored
@@ -1 +1 @@
|
|||||||
{"bitbucket.org":{"ServerAliveInterval":"45","Compression":"yes","CompressionLevel":"9","ForwardX11":"yes","User":"hg"},"topsecret.server.com":{"ServerAliveInterval":"45","Compression":"yes","CompressionLevel":"9","ForwardX11":"no","Port":"50022"}}
|
{"DEFAULT":{"ServerAliveInterval":"45","Compression":"yes","CompressionLevel":"9","ForwardX11":"yes"},"bitbucket.org":{"User":"hg"},"topsecret.server.com":{"Port":"50022","ForwardX11":"no"}}
|
||||||
|
Reference in New Issue
Block a user