INSTRUCTION
stringlengths
1
8.43k
RESPONSE
stringlengths
75
104k
Explain prediction and export explanation to a dict with pandas. DataFrame values ( as: func: eli5. formatters. as_dataframe. format_as_dataframes does ). All keyword arguments are passed to: func: eli5. explain_prediction. Weights of all features are exported by default.
def explain_prediction_dfs(estimator, doc, **kwargs): # type: (...) -> Dict[str, pd.DataFrame] """ Explain prediction and export explanation to a dict with ``pandas.DataFrame`` values (as :func:`eli5.formatters.as_dataframe.format_as_dataframes` does). All keyword arguments are passed to :func:`eli5...
Export an explanation to a dictionary with pandas. DataFrame values and string keys that correspond to explanation attributes. Use this method if several dataframes can be exported from a single explanation ( e. g. for CRF explanation with has both feature weights and transition matrix ). Note that: func: eli5. explain...
def format_as_dataframes(explanation): # type: (Explanation) -> Dict[str, pd.DataFrame] """ Export an explanation to a dictionary with ``pandas.DataFrame`` values and string keys that correspond to explanation attributes. Use this method if several dataframes can be exported from a single explanatio...
Export an explanation to a single pandas. DataFrame. In case several dataframes could be exported by: func: eli5. formatters. as_dataframe. format_as_dataframes a warning is raised. If no dataframe can be exported None is returned. This function also accepts some components of the explanation as arguments: feature impo...
def format_as_dataframe(explanation): # type: (Explanation) -> Optional[pd.DataFrame] """ Export an explanation to a single ``pandas.DataFrame``. In case several dataframes could be exported by :func:`eli5.formatters.as_dataframe.format_as_dataframes`, a warning is raised. If no dataframe can be exp...
Return an iterator of X matrices which have one or more columns shuffled. After each iteration yielded matrix is mutated inplace so if you want to use multiple of them at the same time make copies.
def iter_shuffled(X, columns_to_shuffle=None, pre_shuffle=False, random_state=None): """ Return an iterator of X matrices which have one or more columns shuffled. After each iteration yielded matrix is mutated inplace, so if you want to use multiple of them at the same time, make copie...
Return ( base_score score_decreases ) tuple with the base score and score decreases when a feature is not available.
def get_score_importances( score_func, # type: Callable[[Any, Any], float] X, y, n_iter=5, # type: int columns_to_shuffle=None, random_state=None ): # type: (...) -> Tuple[float, List[np.ndarray]] """ Return ``(base_score, score_decreases)`` tuple with t...
Return an explanation of estimator parameters ( weights ) as an IPython. display. HTML object. Use this function to show classifier weights in IPython.
def show_weights(estimator, **kwargs): """ Return an explanation of estimator parameters (weights) as an IPython.display.HTML object. Use this function to show classifier weights in IPython. :func:`show_weights` accepts all :func:`eli5.explain_weights` arguments and all :func:`eli5.formatters.h...
Return an explanation of estimator prediction as an IPython. display. HTML object. Use this function to show information about classifier prediction in IPython.
def show_prediction(estimator, doc, **kwargs): """ Return an explanation of estimator prediction as an IPython.display.HTML object. Use this function to show information about classifier prediction in IPython. :func:`show_prediction` accepts all :func:`eli5.explain_prediction` arguments and all ...
Convert DecisionTreeClassifier or DecisionTreeRegressor to an inspectable object.
def get_tree_info(decision_tree, feature_names=None, **export_graphviz_kwargs): # type: (...) -> TreeInfo """ Convert DecisionTreeClassifier or DecisionTreeRegressor to an inspectable object. """ return TreeInfo( criterion=decision_tree.criterion, ...
Return n_samples changed versions of text ( with some words removed ) along with distances between the original text and a generated examples. If bow = False all tokens are considered unique ( i. e. token position matters ).
def generate_samples(text, # type: TokenizedText n_samples=500, # type: int bow=True, # type: bool random_state=None, replacement='', # type: str min_replace=1, # type: Uni...
Return cosine similarity between a binary vector with all ones of length num_tokens and vectors of the same length with num_removed_vec elements set to zero.
def cosine_similarity_vec(num_tokens, num_removed_vec): """ Return cosine similarity between a binary vector with all ones of length ``num_tokens`` and vectors of the same length with ``num_removed_vec`` elements set to zero. """ remaining = -np.array(num_removed_vec) + num_tokens return rem...
Return a list of ( text replaced_count mask ) tuples with n_samples versions of text with some words replaced. By default words are replaced with i. e. removed.
def replace_random_tokens(self, n_samples, # type: int replacement='', # type: str random_state=None, min_replace=1, # type: Union[int, float] max_replace=1.0, # type...
Return a list of ( text replaced_words_count mask ) tuples with n_samples versions of text with some words replaced. If a word is replaced all duplicate words are also replaced from the text. By default words are replaced with i. e. removed.
def replace_random_tokens_bow(self, n_samples, # type: int replacement='', # type: str random_state=None, min_replace=1, # type: Union[int, float] ...
Explain predict_proba probabilistic classification function for the doc example. This method fits a local classification pipeline following LIME approach.
def fit(self, doc, # type: str predict_proba, # type: Callable[[Any], Any] ): # type: (...) -> TextExplainer """ Explain ``predict_proba`` probabilistic classification function for the ``doc`` example. This method fits a local classificat...
Call: func: eli5. show_prediction for the locally - fit classification pipeline. Keyword arguments are passed to: func: eli5. show_prediction.
def show_prediction(self, **kwargs): """ Call :func:`eli5.show_prediction` for the locally-fit classification pipeline. Keyword arguments are passed to :func:`eli5.show_prediction`. :func:`fit` must be called before using this method. """ self._fix_target_names(k...
Call: func: eli5. show_weights for the locally - fit classification pipeline. Keyword arguments are passed to: func: eli5. show_weights.
def show_weights(self, **kwargs): """ Call :func:`eli5.show_weights` for the locally-fit classification pipeline. Keyword arguments are passed to :func:`eli5.show_weights`. :func:`fit` must be called before using this method. """ self._fix_target_names(kwargs) ...
Call: func: eli5. show_weights for the locally - fit classification pipeline. Keyword arguments are passed to: func: eli5. show_weights.
def explain_weights(self, **kwargs): """ Call :func:`eli5.show_weights` for the locally-fit classification pipeline. Keyword arguments are passed to :func:`eli5.show_weights`. :func:`fit` must be called before using this method. """ self._fix_target_names(kwargs)...
Fit classifier clf to return probabilities close to y_proba.
def fit_proba(clf, X, y_proba, expand_factor=10, sample_weight=None, shuffle=True, random_state=None, **fit_params): """ Fit classifier ``clf`` to return probabilities close to ``y_proba``. scikit-learn can't optimize cross-entropy directly if target probability values are n...
Return fit_params with added sample_weight argument. Unlike fit_params [ sample_weight ] = sample_weight it handles a case where clf is a pipeline.
def with_sample_weight(clf, sample_weight, fit_params): """ Return fit_params with added "sample_weight" argument. Unlike `fit_params['sample_weight'] = sample_weight` it handles a case where ``clf`` is a pipeline. """ param_name = _get_classifier_prefix(clf) + "sample_weight" params = {para...
Add missing columns to predict_proba result.
def fix_multiclass_predict_proba(y_proba, # type: np.ndarray seen_classes, complete_classes ): # type: (...) -> np.ndarray """ Add missing columns to predict_proba result. When a multiclass class...
scikit - learn can t optimize cross - entropy directly if target probability values are not indicator vectors. As a workaround this function expands the dataset according to target probabilities. expand_factor = None means no dataset expansion.
def expanded_X_y_sample_weights(X, y_proba, expand_factor=10, sample_weight=None, shuffle=True, random_state=None): """ scikit-learn can't optimize cross-entropy directly if target probability values are not indicator vectors. As a workarou...
Convert a dataset with float multiclass probabilities to a dataset with indicator probabilities by duplicating X rows and sampling true labels.
def expand_dataset(X, y_proba, factor=10, random_state=None, extra_arrays=None): """ Convert a dataset with float multiclass probabilities to a dataset with indicator probabilities by duplicating X rows and sampling true labels. """ rng = check_random_state(random_state) extra_arrays = extra...
Get feature names for transformer output as a function of input names.
def transform_feature_names(transformer, in_names=None): """Get feature names for transformer output as a function of input names. Used by :func:`explain_weights` when applied to a scikit-learn Pipeline, this ``singledispatch`` should be registered with custom name transformations for each class of tra...
If possible return a dict with preprocessed document and a list of spans with weights corresponding to features in the document.
def get_weighted_spans(doc, vec, feature_weights): # type: (Any, Any, FeatureWeights) -> Optional[WeightedSpans] """ If possible, return a dict with preprocessed document and a list of spans with weights, corresponding to features in the document. """ if isinstance(vec, FeatureUnion): return...
Compute and set target_expl. weighted_spans attribute when possible.
def add_weighted_spans(doc, vec, vectorized, target_expl): # type: (Any, Any, bool, TargetExplanation) -> None """ Compute and set ``target_expl.weighted_spans`` attribute, when possible. """ if vec is None or vectorized: return weighted_spans = get_weighted_spans(doc, vec, target_expl....
Return { feat_name: ( weight ( group idx )) } mapping.
def _get_feature_weights_dict(feature_weights, # type: FeatureWeights feature_fn # type: Optional[Callable[[str], str]] ): # type: (...) -> Dict[str, Tuple[float, Tuple[str, int]]] """ Return {feat_name: (weight, (group, idx))} mapping. """ ...
Compute feature_importances_ attribute and optionally fit the base estimator.
def fit(self, X, y, groups=None, **fit_params): # type: (...) -> PermutationImportance """Compute ``feature_importances_`` attribute and optionally fit the base estimator. Parameters ---------- X : array-like of shape (n_samples, n_features) The training inpu...
Return an explanation of an estimator prediction.
def explain_prediction(estimator, doc, **kwargs): """ Return an explanation of an estimator prediction. :func:`explain_prediction` is not doing any work itself, it dispatches to a concrete implementation based on estimator type. Parameters ---------- estimator : object Estimator in...
Get directions between an origin point and a destination point.
def directions(client, origin, destination, mode=None, waypoints=None, alternatives=False, avoid=None, language=None, units=None, region=None, departure_time=None, arrival_time=None, optimize_waypoints=False, transit_mode=None, transit_routing_preference=None,...
Geocoding is the process of converting addresses ( like 1600 Amphitheatre Parkway Mountain View CA ) into geographic coordinates ( like latitude 37. 423021 and longitude - 122. 083739 ) which you can use to place markers or position the map.
def geocode(client, address=None, components=None, bounds=None, region=None, language=None): """ Geocoding is the process of converting addresses (like ``"1600 Amphitheatre Parkway, Mountain View, CA"``) into geographic coordinates (like latitude 37.423021 and longitude -122.083739), which y...
Reverse geocoding is the process of converting geographic coordinates into a human - readable address.
def reverse_geocode(client, latlng, result_type=None, location_type=None, language=None): """ Reverse geocoding is the process of converting geographic coordinates into a human-readable address. :param latlng: The latitude/longitude value or place_id for which you wish to ob...
Provides elevation data for locations provided on the surface of the earth including depth locations on the ocean floor ( which return negative values )
def elevation(client, locations): """ Provides elevation data for locations provided on the surface of the earth, including depth locations on the ocean floor (which return negative values) :param locations: List of latitude/longitude values from which you wish to calculate elevation data. ...
Provides elevation data sampled along a path on the surface of the earth.
def elevation_along_path(client, path, samples): """ Provides elevation data sampled along a path on the surface of the earth. :param path: An encoded polyline string, or a list of latitude/longitude values from which you wish to calculate elevation data. :type path: string, dict, list, or tupl...
Converts a lat/ lon pair to a comma - separated string.
def latlng(arg): """Converts a lat/lon pair to a comma-separated string. For example: sydney = { "lat" : -33.8674869, "lng" : 151.2069902 } convert.latlng(sydney) # '-33.8674869,151.2069902' For convenience, also accepts lat/lon pair as a string, in which case it's re...
Take the various lat/ lng representations and return a tuple.
def normalize_lat_lng(arg): """Take the various lat/lng representations and return a tuple. Accepts various representations: 1) dict with two entries - "lat" and "lng" 2) list or tuple - e.g. (-33, 151) or [-33, 151] :param arg: The lat/lng pair. :type arg: dict or list or tuple :rtype: t...
Joins a list of locations into a pipe separated string handling the various formats supported for lat/ lng values.
def location_list(arg): """Joins a list of locations into a pipe separated string, handling the various formats supported for lat/lng values. For example: p = [{"lat" : -33.867486, "lng" : 151.206990}, "Sydney"] convert.waypoint(p) # '-33.867486,151.206990|Sydney' :param arg: The lat/lng l...
Checks if arg is list - like. This excludes strings and dicts.
def _is_list(arg): """Checks if arg is list-like. This excludes strings and dicts.""" if isinstance(arg, dict): return False if isinstance(arg, str): # Python 3-only, as str has __iter__ return False return (not _has_method(arg, "strip") and _has_method(arg, "__getitem__") ...
Determines whether the passed value is a string safe for 2/ 3.
def is_string(val): """Determines whether the passed value is a string, safe for 2/3.""" try: basestring except NameError: return isinstance(val, str) return isinstance(val, basestring)
Converts the value into a unix time ( seconds since unix epoch ).
def time(arg): """Converts the value into a unix time (seconds since unix epoch). For example: convert.time(datetime.now()) # '1409810596' :param arg: The time. :type arg: datetime.datetime or int """ # handle datetime instances. if _has_method(arg, "timetuple"): ar...
Returns true if the given object has a method with the given name.
def _has_method(arg, method): """Returns true if the given object has a method with the given name. :param arg: the object :param method: the method name :type method: string :rtype: bool """ return hasattr(arg, method) and callable(getattr(arg, method))
Converts a dict of components to the format expected by the Google Maps server.
def components(arg): """Converts a dict of components to the format expected by the Google Maps server. For example: c = {"country": "US", "postal_code": "94043"} convert.components(c) # 'country:US|postal_code:94043' :param arg: The component filter. :type arg: dict :rtype: bases...
Converts a lat/ lon bounds to a comma - and pipe - separated string.
def bounds(arg): """Converts a lat/lon bounds to a comma- and pipe-separated string. Accepts two representations: 1) string: pipe-separated pair of comma-separated lat/lon pairs. 2) dict with two entries - "southwest" and "northeast". See convert.latlng for information on how these can be represent...
Decodes a Polyline string into a list of lat/ lng dicts.
def decode_polyline(polyline): """Decodes a Polyline string into a list of lat/lng dicts. See the developer docs for a detailed description of this encoding: https://developers.google.com/maps/documentation/utilities/polylinealgorithm :param polyline: An encoded polyline :type polyline: string ...
Encodes a list of points into a polyline string.
def encode_polyline(points): """Encodes a list of points into a polyline string. See the developer docs for a detailed description of this encoding: https://developers.google.com/maps/documentation/utilities/polylinealgorithm :param points: a list of lat/lng pairs :type points: list of dicts or tu...
Get time zone for a location on the earth as well as that location s time offset from UTC.
def timezone(client, location, timestamp=None, language=None): """Get time zone for a location on the earth, as well as that location's time offset from UTC. :param location: The latitude/longitude value representing the location to look up. :type location: string, dict, list, or tuple :pa...
Snaps a path to the most likely roads travelled.
def snap_to_roads(client, path, interpolate=False): """Snaps a path to the most likely roads travelled. Takes up to 100 GPS points collected along a route, and returns a similar set of data with the points snapped to the most likely roads the vehicle was traveling along. :param path: The path to b...
Find the closest road segments for each point
def nearest_roads(client, points): """Find the closest road segments for each point Takes up to 100 independent coordinates, and returns the closest road segment for each point. The points passed do not need to be part of a continuous path. :param points: The points for which the nearest road segm...
Returns the posted speed limit ( in km/ h ) for given road segments.
def speed_limits(client, place_ids): """Returns the posted speed limit (in km/h) for given road segments. :param place_ids: The Place ID of the road segment. Place IDs are returned by the snap_to_roads function. You can pass up to 100 Place IDs. :type place_ids: str or list :rtype: list of spe...
Returns the posted speed limit ( in km/ h ) for given road segments.
def snapped_speed_limits(client, path): """Returns the posted speed limit (in km/h) for given road segments. The provided points will first be snapped to the most likely roads the vehicle was traveling along. :param path: The path of points to be snapped. :type path: a single location, or a list o...
Extracts a result from a Roads API HTTP response.
def _roads_extract(resp): """Extracts a result from a Roads API HTTP response.""" try: j = resp.json() except: if resp.status_code != 200: raise googlemaps.exceptions.HTTPError(resp.status_code) raise googlemaps.exceptions.ApiError("UNKNOWN_ERROR", ...
A Find Place request takes a text input and returns a place. The text input can be any kind of Places data for example a name address or phone number.
def find_place(client, input, input_type, fields=None, location_bias=None, language=None): """ A Find Place request takes a text input, and returns a place. The text input can be any kind of Places data, for example, a name, address, or phone number. :param input: The text input spe...
Places search.
def places(client, query, location=None, radius=None, language=None, min_price=None, max_price=None, open_now=False, type=None, region=None, page_token=None): """ Places search. :param query: The text string on which to search, for example: "restaurant". :type query: string :...
Performs nearby search for places.
def places_nearby(client, location=None, radius=None, keyword=None, language=None, min_price=None, max_price=None, name=None, open_now=False, rank_by=None, type=None, page_token=None): """ Performs nearby search for places. :param location: The latitude/longitude value f...
Performs radar search for places.
def places_radar(client, location, radius, keyword=None, min_price=None, max_price=None, name=None, open_now=False, type=None): """ Performs radar search for places. :param location: The latitude/longitude value for which you wish to obtain the closest, human-readable ...
Internal handler for places places_nearby and places_radar. See each method s docs for arg details.
def _places(client, url_part, query=None, location=None, radius=None, keyword=None, language=None, min_price=0, max_price=4, name=None, open_now=False, rank_by=None, type=None, region=None, page_token=None): """ Internal handler for ``places``, ``places_nearby``, and ``places_radar``. ...
Comprehensive details for an individual place.
def place(client, place_id, session_token=None, fields=None, language=None): """ Comprehensive details for an individual place. :param place_id: A textual identifier that uniquely identifies a place, returned from a Places search. :type place_id: string :param session_token: A random strin...
Downloads a photo from the Places API.
def places_photo(client, photo_reference, max_width=None, max_height=None): """ Downloads a photo from the Places API. :param photo_reference: A string identifier that uniquely identifies a photo, as provided by either a Places search or Places detail request. :type photo_reference: string ...
Returns Place predictions given a textual search string and optional geographic bounds.
def places_autocomplete(client, input_text, session_token, offset=None, location=None, radius=None, language=None, types=None, components=None, strict_bounds=False): """ Returns Place predictions given a textual search string and optional geographic bounds. ...
Returns Place predictions given a textual search query such as pizza near New York and optional geographic bounds.
def places_autocomplete_query(client, input_text, offset=None, location=None, radius=None, language=None): """ Returns Place predictions given a textual search query, such as "pizza near New York", and optional geographic bounds. :param input_text: The text query on which ...
Internal handler for autocomplete and autocomplete_query. See each method s docs for arg details.
def _autocomplete(client, url_part, input_text, session_token=None, offset=None, location=None, radius=None, language=None, types=None, components=None, strict_bounds=False): """ Internal handler for ``autocomplete`` and ``autocomplete_query``. See each method's docs for ...
Mimics the exception handling logic in client. _get_body but for geolocation which uses a different response format.
def _geolocation_extract(response): """ Mimics the exception handling logic in ``client._get_body``, but for geolocation which uses a different response format. """ body = response.json() if response.status_code in (200, 404): return body try: error = body["error"]["errors"]...
The Google Maps Geolocation API returns a location and accuracy radius based on information about cell towers and WiFi nodes given.
def geolocate(client, home_mobile_country_code=None, home_mobile_network_code=None, radio_type=None, carrier=None, consider_ip=None, cell_towers=None, wifi_access_points=None): """ The Google Maps Geolocation API returns a location and accuracy radius based on information about c...
Gets travel distance and time for a matrix of origins and destinations.
def distance_matrix(client, origins, destinations, mode=None, language=None, avoid=None, units=None, departure_time=None, arrival_time=None, transit_mode=None, transit_routing_preference=None, traffic_model=None, region=None): """ Gets travel distance and ...
Provides a single entry point for modifying all API methods. For now this is limited to allowing the client object to be modified with an extra_params keyword arg to each method that is then used as the params for each web service request.
def make_api_method(func): """ Provides a single entry point for modifying all API methods. For now this is limited to allowing the client object to be modified with an `extra_params` keyword arg to each method, that is then used as the params for each web service request. Please note that this...
Returns a base64 - encoded HMAC - SHA1 signature of a given string.
def sign_hmac(secret, payload): """Returns a base64-encoded HMAC-SHA1 signature of a given string. :param secret: The key used for the signature, base64 encoded. :type secret: string :param payload: The payload to sign. :type payload: string :rtype: string """ payload = payload.encode...
URL encodes the parameters.
def urlencode_params(params): """URL encodes the parameters. :param params: The parameters :type params: list of key/value tuples. :rtype: string """ # urlencode does not handle unicode strings in Python 2. # Firstly, normalize the values so they get encoded correctly. params = [(key, ...
Performs HTTP GET/ POST with credentials returning the body as JSON.
def _request(self, url, params, first_request_time=None, retry_counter=0, base_url=_DEFAULT_BASE_URL, accepts_clientid=True, extract_body=None, requests_kwargs=None, post_json=None): """Performs HTTP GET/POST with credentials, returning the body as JSON. :param url: UR...
Returns the path and query string portion of the request URL first adding any necessary parameters.
def _generate_auth_url(self, path, params, accepts_clientid): """Returns the path and query string portion of the request URL, first adding any necessary parameters. :param path: The path portion of the URL. :type path: string :param params: URL parameters. :type params...
Run all jobs that are scheduled to run.
def run_pending(self): """ Run all jobs that are scheduled to run. Please note that it is *intended behavior that run_pending() does not run missed jobs*. For example, if you've registered a job that should run every minute and you only call run_pending() in one hour inc...
Run all jobs regardless if they are scheduled to run or not.
def run_all(self, delay_seconds=0): """ Run all jobs regardless if they are scheduled to run or not. A delay of `delay` seconds is added between each job. This helps distribute system load generated by the jobs more evenly over time. :param delay_seconds: A delay added ...
Deletes scheduled jobs marked with the given tag or all jobs if tag is omitted.
def clear(self, tag=None): """ Deletes scheduled jobs marked with the given tag, or all jobs if tag is omitted. :param tag: An identifier used to identify a subset of jobs to delete """ if tag is None: del self.jobs[:] else: ...
Tags the job with one or more unique indentifiers.
def tag(self, *tags): """ Tags the job with one or more unique indentifiers. Tags must be hashable. Duplicate tags are discarded. :param tags: A unique list of ``Hashable`` tags. :return: The invoked job instance """ if not all(isinstance(tag, collections.Hashab...
Specify a particular time that the job should be run at.
def at(self, time_str): """ Specify a particular time that the job should be run at. :param time_str: A string in one of the following formats: `HH:MM:SS`, `HH:MM`,`:MM`, `:SS`. The format must make sense given how often the job is repeating; for example, a job that repe...
Specifies the job_func that should be called every time the job runs.
def do(self, job_func, *args, **kwargs): """ Specifies the job_func that should be called every time the job runs. Any additional arguments are passed on to job_func when the job runs. :param job_func: The function to be scheduled :return: The invoked job instan...
Run the job and immediately reschedule it.
def run(self): """ Run the job and immediately reschedule it. :return: The return value returned by the `job_func` """ logger.info('Running job %s', self) ret = self.job_func() self.last_run = datetime.datetime.now() self._schedule_next_run() retu...
Compute the instant when this job should run next.
def _schedule_next_run(self): """ Compute the instant when this job should run next. """ if self.unit not in ('seconds', 'minutes', 'hours', 'days', 'weeks'): raise ScheduleValueError('Invalid unit') if self.latest is not None: if not (self.latest >= self...
Creates a Class representing an Issuer Credential: param source_id: Tag associated by user of sdk: param attrs: attributes that will form the credential: param cred_def_handle: Handle from previously created credential def object: param name: Name given to the Credential: param price: Price in tokens required as paymen...
async def create(source_id: str, attrs: dict, cred_def_handle: int, name: str, price: str): """ Creates a Class representing an Issuer Credential :param source_id: Tag associated by user of sdk :param attrs: attributes that will form the credential :param cred_def...
Creates IssuerCredential object from a dict.: param data: dict representing a serialized IssuerCredential Object: return: IssuerCredential object
async def deserialize(data: dict): """ Creates IssuerCredential object from a dict. :param data: dict representing a serialized IssuerCredential Object :return: IssuerCredential object Example: source_id = '1' cred_def_id = 'cred_def_id1' ...
Sends an offer to a prover. Once accepted a request will be recieved.: param connection: vcx. api. connection. Connection: return: None
async def send_offer(self, connection: Connection): """ Sends an offer to a prover. Once accepted, a request will be recieved. :param connection: vcx.api.connection.Connection :return: None Example: source_id = '1' cred_def_id = 'cred_def_id1' attrs = {'...
Revokes a credential.: return: None Example: credential. revoke_credential ()
async def revoke_credential(self): """ Revokes a credential. :return: None Example: credential.revoke_credential() """ if not hasattr(IssuerCredential.revoke_credential, "cb"): self.logger.debug("vcx_issuer_revoke_credential: Creating callback"...
Creates a new secure wallet with the given unique name.
async def create_wallet(config: str, credentials: str) -> None: """ Creates a new secure wallet with the given unique name. :param config: Wallet configuration json. { "id": string, Identifier of the wallet. Configured storage uses this identifier to lookup ...
Closes opened wallet and frees allocated resources.
async def close_wallet(handle: int) -> None: """ Closes opened wallet and frees allocated resources. :param handle: wallet handle returned by indy_open_wallet. :return: Error code """ logger = logging.getLogger(__name__) logger.debug("close_wallet: >>> handle: %i", handle) if not hasa...
Exports opened wallet to the file.
async def export_wallet(handle: int, export_config_json: str) -> None: """ Exports opened wallet to the file. :param handle: wallet handle returned by indy_open_wallet. :param export_config_json: JSON containing settings for input operation. { "path": path of th...
Creates a new secure wallet with the given unique name and then imports its content according to fields provided in import_config This can be seen as an indy_create_wallet call with additional content import
async def import_wallet(config: str, credentials: str, import_config_json: str) -> None: """ Creates a new secure wallet with the given unique name and then imports its content according to fields provided in import_config This can be seen as an indy_creat...
Generate wallet master key. Returned key is compatible with RAW key derivation method. It allows to avoid expensive key derivation for use cases when wallet keys can be stored in a secure enclave.
async def generate_wallet_key(config: Optional[str]) -> str: """ Generate wallet master key. Returned key is compatible with "RAW" key derivation method. It allows to avoid expensive key derivation for use cases when wallet keys can be stored in a secure enclave. :param config: (optional) key confi...
Create credential schema entity that describes credential attributes list and allows credentials interoperability.
async def issuer_create_schema(issuer_did: str, name: str, version: str, attrs: str) -> (str, str): """ Create credential schema entity that describes credential attributes list and allows credentials interoperabili...
Create credential definition entity that encapsulates credentials issuer DID credential schema secrets used for signing credentials and secrets used for credentials revocation.
async def issuer_create_and_store_credential_def(wallet_handle: int, issuer_did: str, schema_json: str, tag: str, signature_...
Create a new revocation registry for the given credential definition as tuple of entities: - Revocation registry definition that encapsulates credentials definition reference revocation type specific configuration and secrets used for credentials revocation - Revocation registry state that stores the information about ...
async def issuer_create_and_store_revoc_reg(wallet_handle: int, issuer_did: str, revoc_def_type: Optional[str], tag: str, cred_def_id: str, ...
Create credential offer that will be used by Prover for credential request creation. Offer includes nonce and key correctness proof for authentication between protocol steps and integrity checking.
async def issuer_create_credential_offer(wallet_handle: int, cred_def_id: str) -> str: """ Create credential offer that will be used by Prover for credential request creation. Offer includes nonce and key correctness proof for authentication between protocol step...
Check Cred Request for the given Cred Offer and issue Credential for the given Cred Request.
async def issuer_create_credential(wallet_handle: int, cred_offer_json: str, cred_req_json: str, cred_values_json: str, rev_reg_id: Optional[str], ...
Revoke a credential identified by a cred_revoc_id ( returned by issuer_create_credential ).
async def issuer_revoke_credential(wallet_handle: int, blob_storage_reader_handle: int, rev_reg_id: str, cred_revoc_id: str) -> str: """ Revoke a credential identified by a cred_revoc_id (returned by issuer_...
Merge two revocation registry deltas ( returned by issuer_create_credential or issuer_revoke_credential ) to accumulate common delta. Send common delta to ledger to reduce the load.
async def issuer_merge_revocation_registry_deltas(rev_reg_delta_json: str, other_rev_reg_delta_json: str) -> str: """ Merge two revocation registry deltas (returned by issuer_create_credential or issuer_revoke_credential) to accumulate common delta. Send com...
Creates a master secret with a given name and stores it in the wallet. The name must be unique.
async def prover_create_master_secret(wallet_handle: int, master_secret_name: Optional[str]) -> str: """ Creates a master secret with a given name and stores it in the wallet. The name must be unique. :param wallet_handle: wallet handler (created by open_wallet). ...
Creates a clam request for the given credential offer.
async def prover_create_credential_req(wallet_handle: int, prover_did: str, cred_offer_json: str, cred_def_json: str, master_secret_id: str) -> (str, str): """ ...
Check credential provided by Issuer for the given credential request updates the credential by a master secret and stores in a secure wallet. To support efficient search the following tags will be created for stored credential: { schema_id: <credential schema id > schema_issuer_did: <credential schema issuer did > sche...
async def prover_store_credential(wallet_handle: int, cred_id: Optional[str], cred_req_metadata_json: str, cred_json: str, cred_def_json: str, rev_reg...
Gets human readable credential by the given id.
async def prover_get_credential(wallet_handle: int, cred_id: str) -> str: """ Gets human readable credential by the given id. :param wallet_handle: wallet handler (created by open_wallet). :param cred_id: Identifier by which requested credential is stored in the wallet ...
Gets human readable credentials according to the filter. If filter is NULL then all credentials are returned. Credentials can be filtered by tags created during saving of credential.
async def prover_get_credentials(wallet_handle: int, filter_json: str) -> str: """ Gets human readable credentials according to the filter. If filter is NULL, then all credentials are returned. Credentials can be filtered by tags created during saving of credential. ...
Search for credentials stored in wallet. Credentials can be filtered by tags created during saving of credential.
async def prover_search_credentials(wallet_handle: int, query_json: str) -> (int, int): """ Search for credentials stored in wallet. Credentials can be filtered by tags created during saving of credential. Instead of immediately returning of fetched credentials this ...
Fetch next credentials for search.
async def prover_fetch_credentials(search_handle: int, count: int) -> str: """ Fetch next credentials for search. :param search_handle: Search handle (created by prover_open_credentials_search) :param count: Count of records to fetch :return: credentials_json: Lis...
Close credentials search ( make search handle invalid )
async def prover_close_credentials_search(search_handle: int) -> None: """ Close credentials search (make search handle invalid) :param search_handle: Search handle (created by prover_open_credentials_search) :return: None """ logger = logging.getLogger(__name__) logger.debug("prover_close...
Gets human readable credentials matching the given proof request.
async def prover_get_credentials_for_proof_req(wallet_handle: int, proof_request_json: str) -> str: """ Gets human readable credentials matching the given proof request. NOTE: This method is deprecated because immediately returns all fetched credentials. U...