Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
Public Member Functions | Static Protected Attributes | List of all members
pip._vendor.typing_extensions.ParamSpec Class Reference
Inheritance diagram for pip._vendor.typing_extensions.ParamSpec:
Inheritance graph
[legend]
Collaboration diagram for pip._vendor.typing_extensions.ParamSpec:
Collaboration graph
[legend]

Public Member Functions

 __new__ (cls, name, *bound=None, covariant=False, contravariant=False, infer_variance=False, default=_marker)
 
None __init_subclass__ (cls)
 
 args (self)
 
 kwargs (self)
 
 __init__ (self, name, *bound=None, covariant=False, contravariant=False, infer_variance=False, default=_marker)
 
 __repr__ (self)
 
 __hash__ (self)
 
 __eq__ (self, other)
 
 __reduce__ (self)
 
 __call__ (self, *args, **kwargs)
 
- Public Member Functions inherited from pip._vendor.typing_extensions._TypeVarLikeMeta
bool __instancecheck__ (cls, Any __instance)
 

Static Protected Attributes

 _backported_typevarlike = typing.ParamSpec
 

Additional Inherited Members

- Protected Attributes inherited from pip._vendor.typing_extensions._TypeVarLikeMeta
 _backported_typevarlike
 

Detailed Description

Parameter specification.
Parameter specification variable.

Usage::

   P = ParamSpec('P')

Parameter specification variables exist primarily for the benefit of static
type checkers.  They are used to forward the parameter types of one
callable to another callable, a pattern commonly found in higher order
functions and decorators.  They are only valid when used in ``Concatenate``,
or s the first argument to ``Callable``. In Python 3.10 and higher,
they are also supported in user-defined Generics at runtime.
See class Generic for more information on generic types.  An
example for annotating a decorator::

   T = TypeVar('T')
   P = ParamSpec('P')

   def add_logging(f: Callable[P, T]) -> Callable[P, T]:
       '''A type-safe decorator to add logging to a function.'''
       def inner(*args: P.args, **kwargs: P.kwargs) -> T:
           logging.info(f'{f.__name__} was called')
           return f(*args, **kwargs)
       return inner

   @add_logging
   def add_two(x: float, y: float) -> float:
       '''Add two numbers together.'''
       return x + y

Parameter specification variables defined with covariant=True or
contravariant=True can be used to declare covariant or contravariant
generic types.  These keyword arguments are valid, but their actual semantics
are yet to be decided.  See PEP 612 for details.

Parameter specification variables can be introspected. e.g.:

   P.__name__ == 'T'
   P.__bound__ == None
   P.__covariant__ == False
   P.__contravariant__ == False

Note that only parameter specification variables defined in global scope can
be pickled.

Constructor & Destructor Documentation

◆ __init__()

pip._vendor.typing_extensions.ParamSpec.__init__ (   self,
  name,
bound = None,
  covariant = False,
  contravariant = False,
  infer_variance = False,
  default = _marker 
)

The documentation for this class was generated from the following file: