IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 245f20b6 authored by Alan Coleman's avatar Alan Coleman Committed by Marvin Gottowik
Browse files

Fix static vs class issues

parent a6436674
No related branches found
No related tags found
1 merge request!657Improved handling of corsika.Library
......@@ -133,7 +133,7 @@ class Library(object):
"""
return self.__load_yaml(path, "config.yaml")
return Library.__load_yaml(path, "config.yaml")
@staticmethod
def load_summary(path: str) -> Optional[Dict[str, Any]]:
......@@ -153,7 +153,7 @@ class Library(object):
"""
return self.__load_yaml(path, "summary.yaml")
return Library.__load_yaml(path, "summary.yaml")
@staticmethod
def __valid_library(path: str) -> bool:
......@@ -185,7 +185,9 @@ class Library(object):
return config["creator"] == "CORSIKA8"
@staticmethod
def __build_outputs(path: str, dirs: Union[list, None]) -> Dict[str, outputs.Output]:
def __build_outputs(
path: str, dirs: Union[list, None]
) -> Dict[str, outputs.Output]:
"""
Build the outputs contained in this library.
......@@ -233,7 +235,10 @@ class Library(object):
# if `out_type` was None, this is an invalid output
if out_type is None or name is None:
msg = f"'{subdir}' does not contain a valid config." "Missing 'type' or 'name' keyword."
msg = (
f"'{subdir}' does not contain a valid config."
"Missing 'type' or 'name' keyword."
)
logging.getLogger("corsika").warning(msg)
continue # skip to the next output, don't error
......@@ -245,13 +250,19 @@ class Library(object):
# check if the read failed
if not component.is_good():
msg = f"'{name}' encountered an error while reading. " "This process will be not be loaded."
msg = (
f"'{name}' encountered an error while reading. "
"This process will be not be loaded."
)
logging.getLogger("corsika").warning(msg)
else:
components[name] = component
except AttributeError as e:
msg = f"Unable to instantiate an instance of '{out_type}' " f"for a process called '{name}'. Skipping '{subdir}'"
msg = (
f"Unable to instantiate an instance of '{out_type}' "
f"for a process called '{name}'. Skipping '{subdir}'"
)
logging.getLogger("corsika").warning(msg)
logging.getLogger("corsika").warning(e)
continue # skip to the next output, don't error
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment