Skip to content

Commit

Permalink
added message removal functions to MBSenderProxy
Browse files Browse the repository at this point in the history
  • Loading branch information
tmaeno committed Jul 11, 2022
1 parent 05123c2 commit 72622c0
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion PandaPkgInfo.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
release_version = "0.0.30"
release_version = "0.0.31"
3 changes: 3 additions & 0 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Includes all libraries used by both server and monitor (and others).
Release Note
------------

* 0.0.31 (11/7/2022)
* added expand_values

* 0.0.30 (1/7/2022)
* added message removal functions to MBSenderProxy

Expand Down
22 changes: 22 additions & 0 deletions pandacommon/liveconfigparser/LiveConfigParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#

import os
import re

try:
from urllib.request import urlopen
Expand Down Expand Up @@ -68,3 +69,24 @@ def read(self, fileName, config_url=None):
ConfigParser.read_file(self, res)
# read
ConfigParser.read(self, confFiles)


# expand values
def expand_values(target, values_dict):
for tmpKey in values_dict:
tmpVal = values_dict[tmpKey]
# env variable
m = re.search(r'^\$\{*(\w+)\}*$', tmpVal)
if m and m.group(1) in os.environ:
tmpVal = os.environ[m.group(1)]
# convert string to bool/int
if tmpVal == 'True':
tmpVal = True
elif tmpVal == 'False':
tmpVal = False
elif tmpVal == 'None':
tmpVal = None
elif isinstance(tmpVal, str) and re.match('^\d+$', tmpVal):
tmpVal = int(tmpVal)
# update dict
target.__dict__[tmpKey] = tmpVal

0 comments on commit 72622c0

Please sign in to comment.