MCPcopy Create free account
hub / github.com/UX-Decoder/Semantic-SAM / _called_with_cfg

Function _called_with_cfg

semantic_sam/utils/config.py:95–110  ·  view source on GitHub ↗

Returns: bool: whether the arguments contain CfgNode and should be considered forwarded to from_config.

(*args, **kwargs)

Source from the content-addressed store, hash-verified

93 return wrapper
94
95def _called_with_cfg(*args, **kwargs):
96 """
97 Returns:
98 bool: whether the arguments contain CfgNode and should be considered
99 forwarded to from_config.
100 """
101 from omegaconf import DictConfig, OmegaConf, ListConfig
102 # from detectron2.config import LazyConfig
103
104 if len(args) and (isinstance(args[0], (dict)) or (isinstance(args[0], (DictConfig)))):
105 return True
106 if isinstance(kwargs.pop("cfg", None), (dict)):
107 return True
108 # `from_config`'s first argument is forced to be "cfg".
109 # So the above check covers all cases.
110 return False
111
112def _get_args_from_config(from_config_func, *args, **kwargs):
113 """

Callers 1

wrappedFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected