kmisc 2.1.111__tar.gz → 2.1.112__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: kmisc
3
- Version: 2.1.111
3
+ Version: 2.1.112
4
4
  Summary: Enginering useful library
5
5
  Home-page: https://github.com/kagepark/kmisc
6
6
  Author: Kage Park
@@ -2054,6 +2054,36 @@ def findXML(xmlfile,find_name=None,find_path=None,default=None,out='xmlobj',get_
2054
2054
  return found_root[0]
2055
2055
  return default
2056
2056
 
2057
+ def findPlanCfg(filename,find_name=None,default=False,original=False):
2058
+ data=cat(filename)
2059
+ if data is False:
2060
+ return default
2061
+ if find_name and isinstance(find_name,str):
2062
+ out=[]
2063
+ for ff in find_name.split(','):
2064
+ found=False
2065
+ for i in data.split('\n'):
2066
+ if isinstance(i,str) and '=' in i:
2067
+ i_a=i.split('=')
2068
+ if len(i_a) == 2 and i_a[0] == ff:
2069
+ found=True
2070
+ if original:
2071
+ out.append(i_a[1])
2072
+ else:
2073
+ if i_a[1][0] == '"' and i_a[1][-1] == '"':
2074
+ out.append(i_a[1][1:-1])
2075
+ elif i_a[1][0] == "'" and i_a[1][-1] == "'":
2076
+ out.append(i_a[1][1:-1])
2077
+ else:
2078
+ out.append(i_a[1])
2079
+ if not found:
2080
+ out.append(default)
2081
+ if len(out) == 1:
2082
+ return out[0]
2083
+ return out
2084
+ return data
2085
+
2086
+
2057
2087
  def Compress(data,mode='lz4'):
2058
2088
  if mode == 'lz4':
2059
2089
  Import('from lz4 import frame')
@@ -2863,7 +2893,7 @@ def encode(string):
2863
2893
  return '{0}'.format(base64.b64encode(tmp).decode('utf-8'))
2864
2894
  except Exception as e:
2865
2895
  printf('Issue for {}:\n{}'.format(string,e),mode='e')
2866
- return False
2896
+ return False
2867
2897
 
2868
2898
  def decode(string):
2869
2899
  if type(string) is str:
@@ -2872,7 +2902,7 @@ def decode(string):
2872
2902
  return '{0}'.format(dd.decode("utf-8"))
2873
2903
  except Exception as e:
2874
2904
  printf('Issue for {}:\n{}'.format(string,e),mode='e')
2875
- return False
2905
+ return False
2876
2906
  return string
2877
2907
 
2878
2908
  def get_node_info(loop=0):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: kmisc
3
- Version: 2.1.111
3
+ Version: 2.1.112
4
4
  Summary: Enginering useful library
5
5
  Home-page: https://github.com/kagepark/kmisc
6
6
  Author: Kage Park
File without changes
File without changes
File without changes
File without changes
File without changes