cox.utils module¶
-
class
cox.utils.
Parameters
(params)¶ Bases:
object
Parameters class, just a nice way of accessing a dictionary
ps = Parameters({"a": 1, "b": 3}) ps.A # returns 1
-
as_dict
()¶
-
-
cox.utils.
consistent
(old, new)¶ Asserts that either first argument is None or both arguments are equal, and returns the non-None argument.
-
cox.utils.
has_tensorboard
(dirname)¶ Given a directory path, return whether or not it has a tensorboard directory in it.
Parameters: dirname (str) – path to directory Returns: Whether or not the directory has a “tensorboard” folder in it.
-
cox.utils.
mkdirp
(x, should_msg=False)¶ Tries to make a directory, but doesn’t error if the directory exists/can’t be created.
-
cox.utils.
obj_to_string
(obj)¶ Serialize an object to a string
-
cox.utils.
override_json
(args, json_path, check_consistency=False)¶ Overrides the null values in an arguments object with values extracted from a JSON file.
Parameters: - args (object) – A python object with the arguments as properties.
- json_path (str) – Path to the JSON file with which to override.
- check_consistency (bool) – If true, make sure that the keys in the JSON file and the args object match up exactly
Returns: A new args object with appropriately overriden None values.
-
cox.utils.
string_to_obj
(s)¶ Unserialize a string back into an object.