appsettings2 2.1.3__tar.gz → 2.1.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. {appsettings2-2.1.3/src/appsettings2.egg-info → appsettings2-2.1.4}/PKG-INFO +1 -1
  2. {appsettings2-2.1.3 → appsettings2-2.1.4}/pyproject.toml +1 -1
  3. {appsettings2-2.1.3 → appsettings2-2.1.4}/src/appsettings2/Configuration.py +17 -1
  4. {appsettings2-2.1.3 → appsettings2-2.1.4}/src/appsettings2/SKILL.md +2 -0
  5. {appsettings2-2.1.3 → appsettings2-2.1.4}/src/appsettings2/__init__.py +2 -2
  6. {appsettings2-2.1.3 → appsettings2-2.1.4/src/appsettings2.egg-info}/PKG-INFO +1 -1
  7. {appsettings2-2.1.3 → appsettings2-2.1.4}/LICENSE +0 -0
  8. {appsettings2-2.1.3 → appsettings2-2.1.4}/README.md +0 -0
  9. {appsettings2-2.1.3 → appsettings2-2.1.4}/setup.cfg +0 -0
  10. {appsettings2-2.1.3 → appsettings2-2.1.4}/src/appsettings2/ConfigurationBuilder.py +0 -0
  11. {appsettings2-2.1.3 → appsettings2-2.1.4}/src/appsettings2/ConfigurationException.py +0 -0
  12. {appsettings2-2.1.3 → appsettings2-2.1.4}/src/appsettings2/ConfigurationWatcher.py +0 -0
  13. {appsettings2-2.1.3 → appsettings2-2.1.4}/src/appsettings2/helpers.py +0 -0
  14. {appsettings2-2.1.3 → appsettings2-2.1.4}/src/appsettings2/providers/CommandLineConfigurationProvider.py +0 -0
  15. {appsettings2-2.1.3 → appsettings2-2.1.4}/src/appsettings2/providers/ConfigurationProvider.py +0 -0
  16. {appsettings2-2.1.3 → appsettings2-2.1.4}/src/appsettings2/providers/EnvironmentConfigurationProvider.py +0 -0
  17. {appsettings2-2.1.3 → appsettings2-2.1.4}/src/appsettings2/providers/JsonConfigurationProvider.py +0 -0
  18. {appsettings2-2.1.3 → appsettings2-2.1.4}/src/appsettings2/providers/TomlConfigurationProvider.py +0 -0
  19. {appsettings2-2.1.3 → appsettings2-2.1.4}/src/appsettings2/providers/YamlConfigurationProvider.py +0 -0
  20. {appsettings2-2.1.3 → appsettings2-2.1.4}/src/appsettings2/providers/__init__.py +0 -0
  21. {appsettings2-2.1.3 → appsettings2-2.1.4}/src/appsettings2/py.typed +0 -0
  22. {appsettings2-2.1.3 → appsettings2-2.1.4}/src/appsettings2.egg-info/SOURCES.txt +0 -0
  23. {appsettings2-2.1.3 → appsettings2-2.1.4}/src/appsettings2.egg-info/dependency_links.txt +0 -0
  24. {appsettings2-2.1.3 → appsettings2-2.1.4}/src/appsettings2.egg-info/requires.txt +0 -0
  25. {appsettings2-2.1.3 → appsettings2-2.1.4}/src/appsettings2.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: appsettings2
3
- Version: 2.1.3
3
+ Version: 2.1.4
4
4
  Summary: ..unify configuration sources into a `Configuration` object that can be bound to complex types, or accessed directly for configuration data.
5
5
  Author-email: Shaun Wilson <mrshaunwilson@msn.com>
6
6
  License-Expression: MIT
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "appsettings2"
3
- version = "2.1.3"
3
+ version = "2.1.4"
4
4
  description = "..unify configuration sources into a `Configuration` object that can be bound to complex types, or accessed directly for configuration data."
5
5
  keywords = ["appsettings", "configuration"]
6
6
  authors = [
@@ -585,8 +585,13 @@ class Configuration:
585
585
  """
586
586
  Set the configuration value for a configuration key.
587
587
 
588
- :param key: The *key* to associate the configuration *value*.
588
+ :param key: The *key* to associate the configuration *value*. Supports `__` and `:` hierarchical delimiters.
589
589
  :param value: The *value* to be associated with the configuration *key*.
590
+
591
+ Intermediate segments of a hierarchical key are created as nested
592
+ :py:class:`~appsettings2.Configuration` objects as needed. If an
593
+ intermediate segment already holds a non-``Configuration`` value
594
+ (e.g. a scalar or list), it is replaced by a new ``Configuration``.
590
595
  """
591
596
  if self.__normalize:
592
597
  key = key.upper()
@@ -608,6 +613,12 @@ class Configuration:
608
613
  o = c
609
614
  else:
610
615
  o = getattr(self, self.__scrub_key(k))
616
+ if not isinstance(o, Configuration):
617
+ c = Configuration(normalize=self.__normalize, scrubkeys=(
618
+ self.__key_scrub_re is None))
619
+ setattr(self, self.__scrub_key(k), c)
620
+ self.__add_child_change_handler(parts[i])
621
+ o = c
611
622
  else:
612
623
  if not o.has_key(parts[i]):
613
624
  c = Configuration(normalize=self.__normalize, scrubkeys=(
@@ -616,6 +627,11 @@ class Configuration:
616
627
  o = c
617
628
  else:
618
629
  o = o.get(parts[i])
630
+ if not isinstance(o, Configuration):
631
+ c = Configuration(normalize=self.__normalize, scrubkeys=(
632
+ self.__key_scrub_re is None))
633
+ o.set(parts[i], c)
634
+ o = c
619
635
 
620
636
  # Convert dict/list values
621
637
  vtype = type(value)
@@ -124,6 +124,8 @@ config.set('Section__Key', 'value') # hierarchical key
124
124
  config['Section__Key'] = 'value' # same via setter
125
125
  ```
126
126
 
127
+ Intermediate segments are created as nested `Configuration` objects as needed; if an intermediate segment already holds a non-`Configuration` value (scalar/list), it is replaced by a new `Configuration`.
128
+
127
129
  ### Other members
128
130
 
129
131
  | Member | Signature | Description |
@@ -11,8 +11,8 @@ from . import helpers
11
11
  from . import providers
12
12
 
13
13
 
14
- __version__ = '2.1.3'
15
- __commit__ = '7215742'
14
+ __version__ = '2.1.4'
15
+ __commit__ = '56a39dc'
16
16
  __all__ = [
17
17
  '__version__', '__commit__',
18
18
  'Configuration',
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: appsettings2
3
- Version: 2.1.3
3
+ Version: 2.1.4
4
4
  Summary: ..unify configuration sources into a `Configuration` object that can be bound to complex types, or accessed directly for configuration data.
5
5
  Author-email: Shaun Wilson <mrshaunwilson@msn.com>
6
6
  License-Expression: MIT
File without changes
File without changes
File without changes