MCPcopy Create free account
hub / github.com/OpenImagingLab/4DSloMo / get_combined_args

Function get_combined_args

arguments/__init__.py:109–129  ·  view source on GitHub ↗
(parser : ArgumentParser)

Source from the content-addressed store, hash-verified

107 super().__init__(parser, "Optimization Parameters")
108
109def get_combined_args(parser : ArgumentParser):
110 cmdlne_string = sys.argv[1:]
111 cfgfile_string = "Namespace()"
112 args_cmdline = parser.parse_args(cmdlne_string)
113
114 try:
115 cfgfilepath = os.path.join(args_cmdline.model_path, "cfg_args")
116 print("Looking for config file in", cfgfilepath)
117 with open(cfgfilepath) as cfg_file:
118 print("Config file found: {}".format(cfgfilepath))
119 cfgfile_string = cfg_file.read()
120 except TypeError:
121 print("Config file not found at")
122 pass
123 args_cfgfile = eval(cfgfile_string)
124
125 merged_dict = vars(args_cfgfile).copy()
126 for k,v in vars(args_cmdline).items():
127 if v != None:
128 merged_dict[k] = v
129 return Namespace(**merged_dict)

Callers 1

render.pyFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected