diff --git a/jc/parsers/ini.py b/jc/parsers/ini.py index dad07b29..5c19d7e4 100644 --- a/jc/parsers/ini.py +++ b/jc/parsers/ini.py @@ -6,11 +6,6 @@ Parses standard `INI` files. - Comment prefix can be `#` or `;`. Comments must be on their own line. - 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 > 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 @@ -143,6 +138,7 @@ def parse(data, raw=False, quiet=False): ini_parser = configparser.ConfigParser( allow_no_value=True, interpolation=None, + default_section=None, strict=False ) diff --git a/jc/parsers/kv.py b/jc/parsers/kv.py index f7e6420a..ab54e62e 100644 --- a/jc/parsers/kv.py +++ b/jc/parsers/kv.py @@ -36,6 +36,7 @@ Examples: name = John Doe address=555 California Drive age: 34 + ; comments can include # or ; # delimiter can be = or : # quoted values have quotation marks stripped by default @@ -118,6 +119,7 @@ def parse(data, raw=False, quiet=False): kv_parser = configparser.ConfigParser( allow_no_value=True, interpolation=None, + default_section=None, strict=False ) diff --git a/tests/fixtures/generic/ini-test.json b/tests/fixtures/generic/ini-test.json index c3250682..86125f82 100644 --- a/tests/fixtures/generic/ini-test.json +++ b/tests/fixtures/generic/ini-test.json @@ -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"}}