MCPcopy Create free account
hub / github.com/ormar-orm/ormar / is_explicitly_included

Method is_explicitly_included

ormar/models/excludable.py:294–307  ·  view source on GitHub ↗

Check whether ``key`` is explicitly named in the include set. Unlike :meth:`is_included`, this returns ``False`` for an empty include set rather than ``True`` - callers asking "did the user name this?" want a no when nothing was specified at all. :param key

(self, key: str)

Source from the content-addressed store, hash-verified

292 return (... in self.include or key in self.include) if self.include else True
293
294 def is_explicitly_included(self, key: str) -> bool:
295 """
296 Check whether ``key`` is explicitly named in the include set.
297
298 Unlike :meth:`is_included`, this returns ``False`` for an empty
299 include set rather than ``True`` - callers asking "did the user
300 name this?" want a no when nothing was specified at all.
301
302 :param key: key to check
303 :type key: str
304 :return: True if include is non-empty and contains key (or ``...``)
305 :rtype: bool
306 """
307 return bool(self.include) and self.is_included(key)
308
309 def is_excluded(self, key: str) -> bool:
310 """

Callers 1

Calls 1

is_includedMethod · 0.95

Tested by

no test coverage detected