Coverage for python/lsst/sims/utils/CodeUtilities.py : 83%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
""" This method will clean up data caches created by the sims software stack. Any time a cache is added to the sims software stack, it can be added to the list sims_clean_up.targets. When sims_clean_up() is called, it will loop through the contents of sims_clean_up.targets. It will call pop() on all of the contents of each sims_clean_up.target, run close() on each item it pops (if applicable), delete each item it pops, and then reset each sims_clean_up.target to either a blank dict or list (depending on what the target was). sims_clean_up() will then run the garbage collector.
Note: if a target cache is not a dict or a list, it will attempt to call close() on the cache and delete the cache. """
return None
try: obj[1].close() except: pass try: obj.close() except: pass else: if hasattr(target, 'close'): target.close() del target
""" This method will validate the inputs of other methods.
input_list is a list of the inputs passed to a method.
input_name is a list of the variable names associated with input_list
method_name is the name of the method whose input is being validated.
_validate_inputs will verify that all of the inputs in input_list are:
1) of the same type 2) either numpy arrays or instances of numbers.Number (floats or ints) 3) if they are numpy arrays, they all have the same length
If any of these criteria are violated, a RuntimeError will be raised
returns True if the inputs are numpy arrays; False if not """
else: "should be either a number or a numpy array")
"all need to have the same length")
|