Stores and handles metadata routing for a router object.
This class is used by router objects to store and handle metadata routing. Routing information is stored as a dictionary of the form {"object_name": RouteMappingPair(method_mapping, routing_info)}
, where method_mapping
is an instance of MethodMapping
and routing_info
is either a MetadataRequest
or a MetadataRouter
instance.
Added in version 1.3.
The name of the object to which these requests belong.
Add named objects with their corresponding method mapping.
The mapping between the child and the parent’s methods.
A dictionary of objects from which metadata is extracted by calling get_routing_for_object
on them.
Returns self
.
Add self
(as a consumer) to the routing.
This method is used if the router is also a consumer, and hence the router itself needs to be included in the routing. The passed object can be an estimator or a MetadataRequest
.
A router should add itself using this method instead of add
since it should be treated differently than the other objects to which metadata is routed by the router.
This is typically the router instance, i.e. self
in a get_metadata_routing()
implementation. It can also be a MetadataRequest
instance.
Returns self
.
Check whether the given parameters are consumed by the given method.
Added in version 1.4.
The name of the method to check.
An iterable of parameters to check.
A set of parameters which are consumed by the given method.
Return the input parameters requested by child objects.
The output of this method is a Bunch
, which includes the metadata for all methods of each child object that is used in the router’s caller
method.
If the router is also a consumer, it also checks for warnings of self
’s/consumer’s requested metadata.
The name of the method for which the parameters are requested and routed. If called inside the fit method of a router, it would be "fit"
.
A dictionary of provided metadata.
A Bunch
of the form {"object_name": {"method_name": {params: value}}}
which can be used to pass the required metadata to corresponding methods or corresponding child objects.
Validate given metadata for a method.
This raises a TypeError
if some of the passed metadata are not understood by child objects.
The name of the method for which the parameters are requested and routed. If called inside the fit method of a router, it would be "fit"
.
A dictionary of provided metadata.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4