-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmisc_functions.py
More file actions
36 lines (31 loc) · 1.11 KB
/
misc_functions.py
File metadata and controls
36 lines (31 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
###############################################################################
###############################################################################
#
# This piece of code has been developed by
# Lucas C. Olivari
# and is part of the IM Foreground Sky Model (IMFSM).
#
# For more information about the IMFSM contact
# Lucas C. Olivari (lolivari@if.usp.br)
#
# May, 2018
#
###############################################################################
###############################################################################
import ConfigParser
def ConfigSectionMap(Config, initial_file, section):
dict1 = {}
Config.read(initial_file)
options = Config.options(section)
for option in options:
try:
dict1[option] = Config.get(section, option)
if dict1[option] == -1:
DebugPrint("skip: %s" % option)
except:
print("exception on %s!" % option)
dict1[option] = None
return dict1
def ConfigGetBoolean(Config, initial_file, section, entry):
Config.read(initial_file)
return Config.getboolean(section, entry)