eric7/Plugins/WizardPlugins/SetupWizard/SetupCfgUtilities.py

branch
eric7
changeset 9205
b75da2ba2a1a
parent 9201
2f1ccadee231
equal deleted inserted replaced
9204:be84ff69f30e 9205:b75da2ba2a1a
14 # list-comma - dangling list or string of comma-separated values 14 # list-comma - dangling list or string of comma-separated values
15 # list-semi - dangling list or string of semicolon-separated values 15 # list-semi - dangling list or string of semicolon-separated values
16 # bool - True is 1, yes, true 16 # bool - True is 1, yes, true
17 # dict - list-comma where keys are separated from values by = 17 # dict - list-comma where keys are separated from values by =
18 # 18 #
19
19 20
20 def _bool2string(value): 21 def _bool2string(value):
21 """ 22 """
22 Function to convert a bool value to a setup.cfg string. 23 Function to convert a bool value to a setup.cfg string.
23 24
38 @return setup.cfg string 39 @return setup.cfg string
39 @rtype str 40 @rtype str
40 """ 41 """
41 if value: 42 if value:
42 return "\n{0}".format("\n".join(sorted(filter(None, value)))) 43 return "\n{0}".format("\n".join(sorted(filter(None, value))))
44
45 return ""
43 46
44 47
45 def _dict2list(value): 48 def _dict2list(value):
46 """ 49 """
47 Function to convert a dict value to a setup.cfg list string. 50 Function to convert a dict value to a setup.cfg list string.
64 @return setup.cfg string 67 @return setup.cfg string
65 @rtype str 68 @rtype str
66 """ 69 """
67 return _list2string(list(_dict2list(value))) 70 return _list2string(list(_dict2list(value)))
68 71
72
69 def toString(value): 73 def toString(value):
70 """ 74 """
71 Function to convert a value to a setup.cfg string 75 Function to convert a value to a setup.cfg string.
72 76
73 @param value value to be converted 77 @param value value to be converted
74 @type bool, list, set, tuple or dict 78 @type bool, list, set, tuple or dict
75 @return setup.cfg string 79 @return setup.cfg string
76 @rtype str 80 @rtype str

eric ide

mercurial