MCPcopy Create free account
hub / github.com/intelowlproject/IntelOwl / __contains__

Method __contains__

api_app/models.py:151–166  ·  view source on GitHub ↗

Check if a string or PythonConfig is in the module. Args: item (str or PythonConfig): The item to check. Returns: bool: True if the item is in the module, False otherwise.

(self, item: str)

Source from the content-addressed store, hash-verified

149 return self.module
150
151 def __contains__(self, item: str):
152 """
153 Check if a string or PythonConfig is in the module.
154
155 Args:
156 item (str or PythonConfig): The item to check.
157
158 Returns:
159 bool: True if the item is in the module, False otherwise.
160 """
161 if not isinstance(item, str) and not isinstance(item, PythonConfig):
162 raise TypeError(f"{self.__class__.__name__} needs a string or pythonConfig")
163 if isinstance(item, str):
164 return item in self.python_complete_path
165 elif isinstance(item, PythonConfig):
166 return self.configs.filter(name=item.name).exists()
167
168 @cached_property
169 def python_complete_path(self) -> str:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected