module grammar.api_extension

Inheritance diagram of mlprodict.grammar.api_extension

Short summary

module mlprodict.grammar.api_extension

Implements decorators to extend the API.

source on GitHub

Classes

class

truncated documentation

AutoAction

Extends the API to automatically look for exporters.

AutoType

Extends the API to automatically look for exporters.

Static Methods

staticmethod

truncated documentation

cache

Caches the result of a function.

Methods

method

truncated documentation

_reset_cache

A same node may appear at different places in the graph. It means the output is used twice. However, we don’t want …

export

Exports into any format. The method is looking for one method call ‘_export_<lang>’ and calls it if found. …

format_value

Exports into any format. The method is looking for one method call ‘_export_<lang>’ and calls it if found. …

Documentation

Implements decorators to extend the API.

source on GitHub

class mlprodict.grammar.api_extension.AutoAction[source]

Bases: object

Extends the API to automatically look for exporters.

source on GitHub

_reset_cache()[source]

A same node may appear at different places in the graph. It means the output is used twice. However, we don’t want to include the code to generate that same output twice. We cache it and keep some information about it.

source on GitHub

static cache(func)[source]

Caches the result of a function.

source on GitHub

export(lang='json', hook=None, result_name=None)[source]

Exports into any format. The method is looking for one method call ‘_export_<lang>’ and calls it if found.

Parameters
  • lang – language

  • hook – tweaking parameters

  • result_name – the name of the result decided by the parent of this node

Returns

depends on the language

source on GitHub

class mlprodict.grammar.api_extension.AutoType[source]

Bases: object

Extends the API to automatically look for exporters.

source on GitHub

format_value(value, lang='json', hook=None)[source]

Exports into any format. The method is looking for one method call ‘_export_<lang>’ and calls it if found.

Parameters
  • lang – language

  • hook – tweaking parameters

  • result_name – the name of the result decided by the parent of this node

Returns

depends on the language

source on GitHub