Пример #1
0
 def __subclasshook__(cls, C):
     if cls is CommandlineAbility:
         try:
             return _check_methods(C, "add_commandline_arguments")
         except AttributeError:
             return False
     return NotImplemented
Пример #2
0
 def __subclasshook__(cls, C):
     if cls is WebSocketHandler:
         try:
             return _check_methods(C, "websocket_connect",
                                   "websocket_disconnect",
                                   "websocket_receive")
         except AttributeError:
             return False
     return NotImplemented
Пример #3
0
 def __subclasshook__(cls, classe):
     if cls is Fila:
         return _check_methods(
             classe,
             'entrar',
             'sair',
             '__len__',
             '__contains__',
             '__repr__'
         )
Пример #4
0
    def __subclasshook__(cls, subclass: Type)->bool:
        """Will check if the class `C` is a subclass of ``ConnectionClient``.

        We do this by iterating on all http methods and if at least one
        is not defined as a method in `C`, then we return ``False``

        Parameters
        ----------
        subclass : Type
            The class to check

        Returns
        -------
        bool
            ``True`` if `C` is a subclass of ``ConnectionClient``, ``False`` otherwise

        """

        return abc._check_methods(subclass, *[  # pylint: disable=protected-access
            method.lower() for method in HTTP_METHODS
        ]) is not NotImplemented
Пример #5
0
 def __subclasshook__(cls, C):
     if cls is AbstractContextManager:
         return _collections_abc._check_methods(C, "__enter__", "__exit__")
     return NotImplemented
Пример #6
0
 def __subclasshook__(cls, subclass):
     if cls is PathLike:
         return _check_methods(subclass, '__fspath__')
     return NotImplemented
Пример #7
0
 def __subclasshook__(cls, C: Type) -> bool:
     if cls is AbstractAsyncContextManager:
         return cast(
             bool,
             _collections_abc._check_methods(C, '__aenter__', '__aexit__'))
     return cast(bool, NotImplemented)
Пример #8
0
 def __subclasshook__(cls, C):
     if cls is AbstractContextManager:
         return _collections_abc._check_methods(C, "__enter__", "__exit__")
     return NotImplemented
 def __subclasshook__(cls, C):
     if cls is AbstractAsyncContextManager:
         return _collections_abc._check_methods(C, "__aenter__",
                                                "__aexit__")  # type: ignore
     return NotImplemented
Пример #10
0
 def __subclasshook__(cls, C):
     if cls is AsyncContextManager:
         return _collections_abc._check_methods(
             C, '__aenter__', '__aexit__')
     return NotImplemented
Пример #11
0
 def __subclasshook__(cls, C):
     if cls is DatasetMixin:
         return _check_methods(C, '__iter__', 'get_example', '__len__')
     return NotImplemented
Пример #12
0
 def __subclasshook__(cls, C):
     """Check whether subclass is considered a subclass of this ABC."""
     if cls is AbstractContextManager:
         return _collections_abc._check_methods(C, "__enter__",
                                                "__exit__")
     return NotImplemented
Пример #13
0
 def __subclasshook__(cls, C):
     if cls is not Collection:
         return NotImplemented
     return _check_methods(C, "__len__", "__iter__", "__contains__")
Пример #14
0
 def update_event(self, inp=-1):
     self.set_output_val(0, _collections_abc._check_methods(self.input(0)))