p3lib 1.1.84__py3-none-any.whl → 1.1.86__py3-none-any.whl

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.
p3lib/pconfig.py CHANGED
@@ -474,18 +474,28 @@ class ConfigManager(object):
474
474
  #Get the config from the stored config file.
475
475
  loadedConfig = self._getDict()
476
476
  #Get list of all the keys from the config file loaded.
477
- loadedConfigKeys = loadedConfig.keys()
477
+ loadedConfigKeys = list(loadedConfig.keys())
478
+
478
479
  #Get the default config
479
- self._configDict = copy.deepcopy( self._defaultConfig )
480
- #Ensure that the config we use has all the values from the file we just loaded and any other values
481
- #not in the config file loaded but defined in the default config are set to default values.
482
- for key in loadedConfigKeys:
483
- if key in self._configDict:
484
- self._configDict[key] = loadedConfig[key]
485
- self._debug("{} = {}".format(key, self._configDict[key]))
486
- else:
487
- self._debug("----------> DROPPED FROM CONFIG: {} = {}".format(key, loadedConfig[key]))
480
+ defaultConfig = copy.deepcopy( self._defaultConfig )
481
+ defaultConfigKeys = list(defaultConfig.keys())
482
+
483
+ # Config parameters may be added or dropped over time. We use the default config to
484
+ # check for parameters that should be added/removed.
485
+
486
+ # Add any missing keys to the loaded config from the default config.
487
+ for defaultKey in defaultConfigKeys:
488
+ if defaultKey not in loadedConfigKeys:
489
+ loadedConfig[defaultKey] = self._defaultConfig[defaultKey]
490
+ self._debug("----------> DEFAULT VALUE ADDED: {} = {}".format(defaultKey, loadedConfig[defaultKey]))
491
+
492
+ # If some keys have been dropped from the config, remove them.
493
+ for loadedConfigKey in loadedConfigKeys:
494
+ if loadedConfigKey not in defaultConfigKeys:
495
+ self._debug("----------> DROPPED FROM CONFIG: {} = {}".format(loadedConfigKey, loadedConfig[loadedConfigKey]))
496
+ loadedConfig.pop(loadedConfigKey, None)
488
497
 
498
+ self._configDict = loadedConfig
489
499
  self._info("Loaded config from %s" % (self._cfgFile) )
490
500
 
491
501
  def inputFloat(self, key, prompt, minValue=UNSET_VALUE, maxValue=UNSET_VALUE):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: p3lib
3
- Version: 1.1.84
3
+ Version: 1.1.86
4
4
  Summary: A group of python modules for networking, plotting data, config storage, automating boot scripts, ssh access and user input output.
5
5
  Home-page: https://github.com/pjaos/p3lib
6
6
  Author: Paul Austen
@@ -11,12 +11,12 @@ p3lib/mqtt_rpc.py,sha256=6LmFA1kR4HSJs9eWbOJORRHNY01L_lHWjvtE2fmY8P8,10511
11
11
  p3lib/netif.py,sha256=3QV5OGdHhELIf4MBj6mx5MNCtVeZ7JXoNEkeu4KzCaE,9796
12
12
  p3lib/netplotly.py,sha256=PMDx-w1jtRVW6Od5u_kuKbBxNpTS_Y88mMF60puMxLM,9363
13
13
  p3lib/ngt.py,sha256=rXA-6zQkfeOupZ-3Q-k3-1DvbKYIi2TCtLKgUb0waWY,37726
14
- p3lib/pconfig.py,sha256=s6s8HRAXLgDO5hQsIbVP-XgLEhoTQKjwKHrwyJUO4UU,33945
14
+ p3lib/pconfig.py,sha256=g9Qk-tSjxtSuEfLbvIvR1SHC7x7BHxp1evT2IFfk05I,34407
15
15
  p3lib/ssh.py,sha256=klqQ9YuqU8GwPVPHrAJeEs5PI5hgoYiXflq2kIGG3as,39509
16
16
  p3lib/table_plot.py,sha256=RPncwVlGUkkx5Fw0dHQedXo0TSPlTi__VrJBDzaMsuI,32116
17
17
  p3lib/uio.py,sha256=Aaxc99XiE3d2f9vLjaN-bZsckoNxay5t0ujdK6PXGrw,23265
18
- p3lib-1.1.84.dist-info/LICENSE,sha256=igqTy5u0kVWM1n-NUZMvAlinY6lVjAXKoag0okkS8V8,1067
19
- p3lib-1.1.84.dist-info/METADATA,sha256=SLRlR7NXQivWGy6xkcl_ph9ZaP7RRcDPmNoAqrqmzEM,918
20
- p3lib-1.1.84.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
21
- p3lib-1.1.84.dist-info/top_level.txt,sha256=SDCpXYh-19yCFp4Z8ZK4B-3J4NvTCJElZ42NPgcR6-U,6
22
- p3lib-1.1.84.dist-info/RECORD,,
18
+ p3lib-1.1.86.dist-info/LICENSE,sha256=igqTy5u0kVWM1n-NUZMvAlinY6lVjAXKoag0okkS8V8,1067
19
+ p3lib-1.1.86.dist-info/METADATA,sha256=viCrPzOCPwdWFfXg31oL2Q84MpF3bxesV2951yIULjA,918
20
+ p3lib-1.1.86.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
21
+ p3lib-1.1.86.dist-info/top_level.txt,sha256=SDCpXYh-19yCFp4Z8ZK4B-3J4NvTCJElZ42NPgcR6-U,6
22
+ p3lib-1.1.86.dist-info/RECORD,,
File without changes