Search is not available for this dataset
identifier
stringlengths
1
155
parameters
stringlengths
2
6.09k
docstring
stringlengths
11
63.4k
docstring_summary
stringlengths
0
63.4k
function
stringlengths
29
99.8k
function_tokens
list
start_point
list
end_point
list
language
stringclasses
1 value
docstring_language
stringlengths
2
7
docstring_language_predictions
stringlengths
18
23
is_langid_reliable
stringclasses
2 values
ThreeInterpolate.backward
( ctx, grad_out: torch.Tensor )
Backward of three interpolate. Args: grad_out (Tensor): (B, C, N) tensor with gradients of outputs Returns: Tensor: (B, C, M) tensor with gradients of features
Backward of three interpolate.
def backward( ctx, grad_out: torch.Tensor ) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor]: """Backward of three interpolate. Args: grad_out (Tensor): (B, C, N) tensor with gradients of outputs Returns: Tensor: (B, C, M) tensor with gradients of features...
[ "def", "backward", "(", "ctx", ",", "grad_out", ":", "torch", ".", "Tensor", ")", "->", "Tuple", "[", "torch", ".", "Tensor", ",", "torch", ".", "Tensor", ",", "torch", ".", "Tensor", "]", ":", "idx", ",", "weight", ",", "m", "=", "ctx", ".", "th...
[ 38, 4 ]
[ 59, 40 ]
python
en
['en', 'so', 'en']
True
Textfont.color
(self)
The 'color' property is a color and may be specified as: - A hex string (e.g. '#ff0000') - An rgb/rgba string (e.g. 'rgb(255,0,0)') - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') - An hsv/hsva string (e.g. 'hsv(0,100%,100%)') - A named CSS color: ...
The 'color' property is a color and may be specified as: - A hex string (e.g. '#ff0000') - An rgb/rgba string (e.g. 'rgb(255,0,0)') - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') - An hsv/hsva string (e.g. 'hsv(0,100%,100%)') - A named CSS color: ...
def color(self): """ The 'color' property is a color and may be specified as: - A hex string (e.g. '#ff0000') - An rgb/rgba string (e.g. 'rgb(255,0,0)') - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') - An hsv/hsva string (e.g. 'hsv(0,100%,100%)') - A name...
[ "def", "color", "(", "self", ")", ":", "return", "self", "[", "\"color\"", "]" ]
[ 15, 4 ]
[ 64, 28 ]
python
en
['en', 'error', 'th']
False
Textfont.colorsrc
(self)
Sets the source reference on Chart Studio Cloud for color . The 'colorsrc' property must be specified as a string or as a plotly.grid_objs.Column object Returns ------- str
Sets the source reference on Chart Studio Cloud for color . The 'colorsrc' property must be specified as a string or as a plotly.grid_objs.Column object
def colorsrc(self): """ Sets the source reference on Chart Studio Cloud for color . The 'colorsrc' property must be specified as a string or as a plotly.grid_objs.Column object Returns ------- str """ return self["colorsrc"]
[ "def", "colorsrc", "(", "self", ")", ":", "return", "self", "[", "\"colorsrc\"", "]" ]
[ 73, 4 ]
[ 84, 31 ]
python
en
['en', 'error', 'th']
False
Textfont.family
(self)
HTML font family - the typeface that will be applied by the web browser. The web browser will only be able to apply a font if it is available on the system which it operates. Provide multiple font families, separated by commas, to indicate the preference in which to apply fonts ...
HTML font family - the typeface that will be applied by the web browser. The web browser will only be able to apply a font if it is available on the system which it operates. Provide multiple font families, separated by commas, to indicate the preference in which to apply fonts ...
def family(self): """ HTML font family - the typeface that will be applied by the web browser. The web browser will only be able to apply a font if it is available on the system which it operates. Provide multiple font families, separated by commas, to indicate the prefer...
[ "def", "family", "(", "self", ")", ":", "return", "self", "[", "\"family\"", "]" ]
[ 93, 4 ]
[ 116, 29 ]
python
en
['en', 'error', 'th']
False
Textfont.familysrc
(self)
Sets the source reference on Chart Studio Cloud for family . The 'familysrc' property must be specified as a string or as a plotly.grid_objs.Column object Returns ------- str
Sets the source reference on Chart Studio Cloud for family . The 'familysrc' property must be specified as a string or as a plotly.grid_objs.Column object
def familysrc(self): """ Sets the source reference on Chart Studio Cloud for family . The 'familysrc' property must be specified as a string or as a plotly.grid_objs.Column object Returns ------- str """ return self["familysrc"]
[ "def", "familysrc", "(", "self", ")", ":", "return", "self", "[", "\"familysrc\"", "]" ]
[ 125, 4 ]
[ 136, 32 ]
python
en
['en', 'error', 'th']
False
Textfont.size
(self)
The 'size' property is a number and may be specified as: - An int or float in the interval [1, inf] - A tuple, list, or one-dimensional numpy array of the above Returns ------- int|float|numpy.ndarray
The 'size' property is a number and may be specified as: - An int or float in the interval [1, inf] - A tuple, list, or one-dimensional numpy array of the above
def size(self): """ The 'size' property is a number and may be specified as: - An int or float in the interval [1, inf] - A tuple, list, or one-dimensional numpy array of the above Returns ------- int|float|numpy.ndarray """ return self["size"...
[ "def", "size", "(", "self", ")", ":", "return", "self", "[", "\"size\"", "]" ]
[ 145, 4 ]
[ 155, 27 ]
python
en
['en', 'error', 'th']
False
Textfont.sizesrc
(self)
Sets the source reference on Chart Studio Cloud for size . The 'sizesrc' property must be specified as a string or as a plotly.grid_objs.Column object Returns ------- str
Sets the source reference on Chart Studio Cloud for size . The 'sizesrc' property must be specified as a string or as a plotly.grid_objs.Column object
def sizesrc(self): """ Sets the source reference on Chart Studio Cloud for size . The 'sizesrc' property must be specified as a string or as a plotly.grid_objs.Column object Returns ------- str """ return self["sizesrc"]
[ "def", "sizesrc", "(", "self", ")", ":", "return", "self", "[", "\"sizesrc\"", "]" ]
[ 164, 4 ]
[ 175, 30 ]
python
en
['en', 'error', 'th']
False
Textfont.__init__
( self, arg=None, color=None, colorsrc=None, family=None, familysrc=None, size=None, sizesrc=None, **kwargs )
Construct a new Textfont object Sets the font used for `textinfo`. Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.sunburst.Textfont` color co...
Construct a new Textfont object Sets the font used for `textinfo`.
def __init__( self, arg=None, color=None, colorsrc=None, family=None, familysrc=None, size=None, sizesrc=None, **kwargs ): """ Construct a new Textfont object Sets the font used for `textinfo`. Paramete...
[ "def", "__init__", "(", "self", ",", "arg", "=", "None", ",", "color", "=", "None", ",", "colorsrc", "=", "None", ",", "family", "=", "None", ",", "familysrc", "=", "None", ",", "size", "=", "None", ",", "sizesrc", "=", "None", ",", "*", "*", "kw...
[ 215, 4 ]
[ 329, 34 ]
python
en
['en', 'error', 'th']
False
Tickformatstop.dtickrange
(self)
range [*min*, *max*], where "min", "max" - dtick values which describe some zoom level, it is possible to omit "min" or "max" value by passing "null" The 'dtickrange' property is an info array that may be specified as: * a list or tuple of 2 elements where: (0) The...
range [*min*, *max*], where "min", "max" - dtick values which describe some zoom level, it is possible to omit "min" or "max" value by passing "null" The 'dtickrange' property is an info array that may be specified as: * a list or tuple of 2 elements where: (0) The...
def dtickrange(self): """ range [*min*, *max*], where "min", "max" - dtick values which describe some zoom level, it is possible to omit "min" or "max" value by passing "null" The 'dtickrange' property is an info array that may be specified as: * a list or tuple...
[ "def", "dtickrange", "(", "self", ")", ":", "return", "self", "[", "\"dtickrange\"", "]" ]
[ 15, 4 ]
[ 31, 33 ]
python
en
['en', 'error', 'th']
False
Tickformatstop.enabled
(self)
Determines whether or not this stop is used. If `false`, this stop is ignored even within its `dtickrange`. The 'enabled' property must be specified as a bool (either True, or False) Returns ------- bool
Determines whether or not this stop is used. If `false`, this stop is ignored even within its `dtickrange`. The 'enabled' property must be specified as a bool (either True, or False)
def enabled(self): """ Determines whether or not this stop is used. If `false`, this stop is ignored even within its `dtickrange`. The 'enabled' property must be specified as a bool (either True, or False) Returns ------- bool """ ret...
[ "def", "enabled", "(", "self", ")", ":", "return", "self", "[", "\"enabled\"", "]" ]
[ 40, 4 ]
[ 52, 30 ]
python
en
['en', 'error', 'th']
False
Tickformatstop.name
(self)
When used in a template, named items are created in the output figure in addition to any items the figure already has in this array. You can modify these items in the output figure by making your own item with `templateitemname` matching this `name` alongside your modifications ...
When used in a template, named items are created in the output figure in addition to any items the figure already has in this array. You can modify these items in the output figure by making your own item with `templateitemname` matching this `name` alongside your modifications ...
def name(self): """ When used in a template, named items are created in the output figure in addition to any items the figure already has in this array. You can modify these items in the output figure by making your own item with `templateitemname` matching this `name` al...
[ "def", "name", "(", "self", ")", ":", "return", "self", "[", "\"name\"", "]" ]
[ 61, 4 ]
[ 79, 27 ]
python
en
['en', 'error', 'th']
False
Tickformatstop.templateitemname
(self)
Used to refer to a named item in this array in the template. Named items from the template will be created even without a matching item in the input figure, but you can modify one by making an item with `templateitemname` matching its `name`, alongside your modifications (includ...
Used to refer to a named item in this array in the template. Named items from the template will be created even without a matching item in the input figure, but you can modify one by making an item with `templateitemname` matching its `name`, alongside your modifications (includ...
def templateitemname(self): """ Used to refer to a named item in this array in the template. Named items from the template will be created even without a matching item in the input figure, but you can modify one by making an item with `templateitemname` matching its `name`, ...
[ "def", "templateitemname", "(", "self", ")", ":", "return", "self", "[", "\"templateitemname\"", "]" ]
[ 88, 4 ]
[ 107, 39 ]
python
en
['en', 'error', 'th']
False
Tickformatstop.value
(self)
string - dtickformat for described zoom level, the same as "tickformat" The 'value' property is a string and must be specified as: - A string - A number that will be converted to a string Returns ------- str
string - dtickformat for described zoom level, the same as "tickformat" The 'value' property is a string and must be specified as: - A string - A number that will be converted to a string
def value(self): """ string - dtickformat for described zoom level, the same as "tickformat" The 'value' property is a string and must be specified as: - A string - A number that will be converted to a string Returns ------- str "...
[ "def", "value", "(", "self", ")", ":", "return", "self", "[", "\"value\"", "]" ]
[ 116, 4 ]
[ 129, 28 ]
python
en
['en', 'error', 'th']
False
Tickformatstop.__init__
( self, arg=None, dtickrange=None, enabled=None, name=None, templateitemname=None, value=None, **kwargs )
Construct a new Tickformatstop object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.layout.xaxis.Tickformatstop` dtickrange range [*min*, *max*], ...
Construct a new Tickformatstop object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.layout.xaxis.Tickformatstop` dtickrange range [*min*, *max*], ...
def __init__( self, arg=None, dtickrange=None, enabled=None, name=None, templateitemname=None, value=None, **kwargs ): """ Construct a new Tickformatstop object Parameters ---------- arg dict...
[ "def", "__init__", "(", "self", ",", "arg", "=", "None", ",", "dtickrange", "=", "None", ",", "enabled", "=", "None", ",", "name", "=", "None", ",", "templateitemname", "=", "None", ",", "value", "=", "None", ",", "*", "*", "kwargs", ")", ":", "sup...
[ 172, 4 ]
[ 282, 34 ]
python
en
['en', 'error', 'th']
False
connections_send_message
(request: web.BaseRequest)
Request handler for sending a basic message to a connection. Args: request: aiohttp request object
Request handler for sending a basic message to a connection.
async def connections_send_message(request: web.BaseRequest): """ Request handler for sending a basic message to a connection. Args: request: aiohttp request object """ context = request.app["request_context"] connection_id = request.match_info["id"] outbound_handler = request.app[...
[ "async", "def", "connections_send_message", "(", "request", ":", "web", ".", "BaseRequest", ")", ":", "context", "=", "request", ".", "app", "[", "\"request_context\"", "]", "connection_id", "=", "request", ".", "match_info", "[", "\"id\"", "]", "outbound_handle...
[ 21, 0 ]
[ 43, 32 ]
python
en
['en', 'error', 'th']
False
register
(app: web.Application)
Register routes.
Register routes.
async def register(app: web.Application): """Register routes.""" app.add_routes( [web.post("/connections/{id}/send-message", connections_send_message)] )
[ "async", "def", "register", "(", "app", ":", "web", ".", "Application", ")", ":", "app", ".", "add_routes", "(", "[", "web", ".", "post", "(", "\"/connections/{id}/send-message\"", ",", "connections_send_message", ")", "]", ")" ]
[ 46, 0 ]
[ 51, 5 ]
python
en
['en', 'fr', 'en']
False
Title.font
(self)
Sets this axis' title font. Note that the title's font used to be customized by the now deprecated `titlefont` attribute. The 'font' property is an instance of Font that may be specified as: - An instance of :class:`plotly.graph_objs.layout.scene.xaxis.title.Font` ...
Sets this axis' title font. Note that the title's font used to be customized by the now deprecated `titlefont` attribute. The 'font' property is an instance of Font that may be specified as: - An instance of :class:`plotly.graph_objs.layout.scene.xaxis.title.Font` ...
def font(self): """ Sets this axis' title font. Note that the title's font used to be customized by the now deprecated `titlefont` attribute. The 'font' property is an instance of Font that may be specified as: - An instance of :class:`plotly.graph_objs.layout.scen...
[ "def", "font", "(", "self", ")", ":", "return", "self", "[", "\"font\"", "]" ]
[ 15, 4 ]
[ 53, 27 ]
python
en
['en', 'error', 'th']
False
Title.text
(self)
Sets the title of this axis. Note that before the existence of `title.text`, the title's contents used to be defined as the `title` attribute itself. This behavior has been deprecated. The 'text' property is a string and must be specified as: - A string - A numb...
Sets the title of this axis. Note that before the existence of `title.text`, the title's contents used to be defined as the `title` attribute itself. This behavior has been deprecated. The 'text' property is a string and must be specified as: - A string - A numb...
def text(self): """ Sets the title of this axis. Note that before the existence of `title.text`, the title's contents used to be defined as the `title` attribute itself. This behavior has been deprecated. The 'text' property is a string and must be specified as: - ...
[ "def", "text", "(", "self", ")", ":", "return", "self", "[", "\"text\"", "]" ]
[ 62, 4 ]
[ 76, 27 ]
python
en
['en', 'error', 'th']
False
Title.__init__
(self, arg=None, font=None, text=None, **kwargs)
Construct a new Title object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.layout.scene.xaxis.Title` font Sets this axis' title font. Note that th...
Construct a new Title object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.layout.scene.xaxis.Title` font Sets this axis' title font. Note that th...
def __init__(self, arg=None, font=None, text=None, **kwargs): """ Construct a new Title object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.layout.scene.xaxis...
[ "def", "__init__", "(", "self", ",", "arg", "=", "None", ",", "font", "=", "None", ",", "text", "=", "None", ",", "*", "*", "kwargs", ")", ":", "super", "(", "Title", ",", "self", ")", ".", "__init__", "(", "\"title\"", ")", "if", "\"_parent\"", ...
[ 98, 4 ]
[ 166, 34 ]
python
en
['en', 'error', 'th']
False
validate_streamline
(x, y)
Streamline-specific validations Specifically, this checks that x and y are both evenly spaced, and that the package numpy is available. See FigureFactory.create_streamline() for params :raises: (ImportError) If numpy is not available. :raises: (PlotlyError) If x is not evenly spaced. :ra...
Streamline-specific validations
def validate_streamline(x, y): """ Streamline-specific validations Specifically, this checks that x and y are both evenly spaced, and that the package numpy is available. See FigureFactory.create_streamline() for params :raises: (ImportError) If numpy is not available. :raises: (PlotlyErr...
[ "def", "validate_streamline", "(", "x", ",", "y", ")", ":", "if", "np", "is", "False", ":", "raise", "ImportError", "(", "\"FigureFactory.create_streamline requires numpy\"", ")", "for", "index", "in", "range", "(", "len", "(", "x", ")", "-", "1", ")", ":"...
[ 11, 0 ]
[ 35, 13 ]
python
en
['en', 'error', 'th']
False
create_streamline
( x, y, u, v, density=1, angle=math.pi / 9, arrow_scale=0.09, **kwargs )
Returns data for a streamline plot. :param (list|ndarray) x: 1 dimensional, evenly spaced list or array :param (list|ndarray) y: 1 dimensional, evenly spaced list or array :param (ndarray) u: 2 dimensional array :param (ndarray) v: 2 dimensional array :param (float|int) density: controls the d...
Returns data for a streamline plot.
def create_streamline( x, y, u, v, density=1, angle=math.pi / 9, arrow_scale=0.09, **kwargs ): """ Returns data for a streamline plot. :param (list|ndarray) x: 1 dimensional, evenly spaced list or array :param (list|ndarray) y: 1 dimensional, evenly spaced list or array :param (ndarray) u: 2 di...
[ "def", "create_streamline", "(", "x", ",", "y", ",", "u", ",", "v", ",", "density", "=", "1", ",", "angle", "=", "math", ".", "pi", "/", "9", ",", "arrow_scale", "=", "0.09", ",", "*", "*", "kwargs", ")", ":", "utils", ".", "validate_equal_length",...
[ 38, 0 ]
[ 130, 54 ]
python
en
['en', 'error', 'th']
False
_Streamline.blank_pos
(self, xi, yi)
Set up positions for trajectories to be used with rk4 function.
Set up positions for trajectories to be used with rk4 function.
def blank_pos(self, xi, yi): """ Set up positions for trajectories to be used with rk4 function. """ return (int((xi / self.spacing_x) + 0.5), int((yi / self.spacing_y) + 0.5))
[ "def", "blank_pos", "(", "self", ",", "xi", ",", "yi", ")", ":", "return", "(", "int", "(", "(", "xi", "/", "self", ".", "spacing_x", ")", "+", "0.5", ")", ",", "int", "(", "(", "yi", "/", "self", ".", "spacing_y", ")", "+", "0.5", ")", ")" ]
[ 171, 4 ]
[ 175, 83 ]
python
en
['en', 'error', 'th']
False
_Streamline.value_at
(self, a, xi, yi)
Set up for RK4 function, based on Bokeh's streamline code
Set up for RK4 function, based on Bokeh's streamline code
def value_at(self, a, xi, yi): """ Set up for RK4 function, based on Bokeh's streamline code """ if isinstance(xi, np.ndarray): self.x = xi.astype(np.int) self.y = yi.astype(np.int) else: self.val_x = np.int(xi) self.val_y = np.int(...
[ "def", "value_at", "(", "self", ",", "a", ",", "xi", ",", "yi", ")", ":", "if", "isinstance", "(", "xi", ",", "np", ".", "ndarray", ")", ":", "self", ".", "x", "=", "xi", ".", "astype", "(", "np", ".", "int", ")", "self", ".", "y", "=", "yi...
[ 177, 4 ]
[ 195, 38 ]
python
en
['en', 'error', 'th']
False
_Streamline.rk4_integrate
(self, x0, y0)
RK4 forward and back trajectories from the initial conditions. Adapted from Bokeh's streamline -uses Runge-Kutta method to fill x and y trajectories then checks length of traj (s in units of axes)
RK4 forward and back trajectories from the initial conditions.
def rk4_integrate(self, x0, y0): """ RK4 forward and back trajectories from the initial conditions. Adapted from Bokeh's streamline -uses Runge-Kutta method to fill x and y trajectories then checks length of traj (s in units of axes) """ def f(xi, yi): dt_ds...
[ "def", "rk4_integrate", "(", "self", ",", "x0", ",", "y0", ")", ":", "def", "f", "(", "xi", ",", "yi", ")", ":", "dt_ds", "=", "1.0", "/", "self", ".", "value_at", "(", "self", ".", "speed", ",", "xi", ",", "yi", ")", "ui", "=", "self", ".", ...
[ 197, 4 ]
[ 273, 23 ]
python
en
['en', 'error', 'th']
False
_Streamline.traj
(self, xb, yb)
Integrate trajectories :param (int) xb: results of passing xi through self.blank_pos :param (int) xy: results of passing yi through self.blank_pos Calculate each trajectory based on rk4 integrate method.
Integrate trajectories
def traj(self, xb, yb): """ Integrate trajectories :param (int) xb: results of passing xi through self.blank_pos :param (int) xy: results of passing yi through self.blank_pos Calculate each trajectory based on rk4 integrate method. """ if xb < 0 or xb >= self.d...
[ "def", "traj", "(", "self", ",", "xb", ",", "yb", ")", ":", "if", "xb", "<", "0", "or", "xb", ">=", "self", ".", "density", "or", "yb", "<", "0", "or", "yb", ">=", "self", ".", "density", ":", "return", "if", "self", ".", "blank", "[", "yb", ...
[ 275, 4 ]
[ 290, 43 ]
python
en
['en', 'error', 'th']
False
_Streamline.get_streamlines
(self)
Get streamlines by building trajectory set.
Get streamlines by building trajectory set.
def get_streamlines(self): """ Get streamlines by building trajectory set. """ for indent in range(self.density // 2): for xi in range(self.density - 2 * indent): self.traj(xi + indent, indent) self.traj(xi + indent, self.density - 1 - indent) ...
[ "def", "get_streamlines", "(", "self", ")", ":", "for", "indent", "in", "range", "(", "self", ".", "density", "//", "2", ")", ":", "for", "xi", "in", "range", "(", "self", ".", "density", "-", "2", "*", "indent", ")", ":", "self", ".", "traj", "(...
[ 292, 4 ]
[ 316, 43 ]
python
en
['en', 'error', 'th']
False
_Streamline.get_streamline_arrows
(self)
Makes an arrow for each streamline. Gets angle of streamline at 1/3 mark and creates arrow coordinates based off of user defined angle and arrow_scale. :param (array) st_x: x-values for all streamlines :param (array) st_y: y-values for all streamlines :param (angle in ...
Makes an arrow for each streamline.
def get_streamline_arrows(self): """ Makes an arrow for each streamline. Gets angle of streamline at 1/3 mark and creates arrow coordinates based off of user defined angle and arrow_scale. :param (array) st_x: x-values for all streamlines :param (array) st_y: y-values f...
[ "def", "get_streamline_arrows", "(", "self", ")", ":", "arrow_end_x", "=", "np", ".", "empty", "(", "(", "len", "(", "self", ".", "st_x", ")", ")", ")", "arrow_end_y", "=", "np", ".", "empty", "(", "(", "len", "(", "self", ".", "st_y", ")", ")", ...
[ 318, 4 ]
[ 395, 33 ]
python
en
['en', 'error', 'th']
False
_Streamline.sum_streamlines
(self)
Makes all streamlines readable as a single trace. :rtype (list, list): streamline_x: all x values for each streamline combined into single list and streamline_y: all y values for each streamline combined into single list
Makes all streamlines readable as a single trace.
def sum_streamlines(self): """ Makes all streamlines readable as a single trace. :rtype (list, list): streamline_x: all x values for each streamline combined into single list and streamline_y: all y values for each streamline combined into single list """ ...
[ "def", "sum_streamlines", "(", "self", ")", ":", "streamline_x", "=", "sum", "(", "self", ".", "st_x", ",", "[", "]", ")", "streamline_y", "=", "sum", "(", "self", ".", "st_y", ",", "[", "]", ")", "return", "streamline_x", ",", "streamline_y" ]
[ 397, 4 ]
[ 407, 41 ]
python
en
['en', 'error', 'th']
False
_table_exists
(db_cursor, tablename)
Returns bool if table exists or not
Returns bool if table exists or not
def _table_exists(db_cursor, tablename): "Returns bool if table exists or not" return tablename in connection.introspection.table_names()
[ "def", "_table_exists", "(", "db_cursor", ",", "tablename", ")", ":", "return", "tablename", "in", "connection", ".", "introspection", ".", "table_names", "(", ")" ]
[ 8, 0 ]
[ 10, 62 ]
python
en
['en', 'en', 'en']
True
Fill.outlinecolor
(self)
Sets the fill outline color (mapbox.layer.paint.fill-outline- color). Has an effect only when `type` is set to "fill". The 'outlinecolor' property is a color and may be specified as: - A hex string (e.g. '#ff0000') - An rgb/rgba string (e.g. 'rgb(255,0,0)') - ...
Sets the fill outline color (mapbox.layer.paint.fill-outline- color). Has an effect only when `type` is set to "fill". The 'outlinecolor' property is a color and may be specified as: - A hex string (e.g. '#ff0000') - An rgb/rgba string (e.g. 'rgb(255,0,0)') - ...
def outlinecolor(self): """ Sets the fill outline color (mapbox.layer.paint.fill-outline- color). Has an effect only when `type` is set to "fill". The 'outlinecolor' property is a color and may be specified as: - A hex string (e.g. '#ff0000') - An rgb/rgba string...
[ "def", "outlinecolor", "(", "self", ")", ":", "return", "self", "[", "\"outlinecolor\"", "]" ]
[ 15, 4 ]
[ 66, 35 ]
python
en
['en', 'error', 'th']
False
Fill.__init__
(self, arg=None, outlinecolor=None, **kwargs)
Construct a new Fill object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.layout.mapbox.layer.Fill` outlinecolor Sets the fill outline color (mapb...
Construct a new Fill object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.layout.mapbox.layer.Fill` outlinecolor Sets the fill outline color (mapb...
def __init__(self, arg=None, outlinecolor=None, **kwargs): """ Construct a new Fill object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.layout.mapbox.layer.Fi...
[ "def", "__init__", "(", "self", ",", "arg", "=", "None", ",", "outlinecolor", "=", "None", ",", "*", "*", "kwargs", ")", ":", "super", "(", "Fill", ",", "self", ")", ".", "__init__", "(", "\"fill\"", ")", "if", "\"_parent\"", "in", "kwargs", ":", "...
[ 83, 4 ]
[ 142, 34 ]
python
en
['en', 'error', 'th']
False
ConnectionResponseHandler.handle
(self, context: RequestContext, responder: BaseResponder)
Handle connection response. Args: context: Request context responder: Responder callback
Handle connection response.
async def handle(self, context: RequestContext, responder: BaseResponder): """ Handle connection response. Args: context: Request context responder: Responder callback """ self._logger.debug(f"ConnectionResponseHandler called with context {context}") ...
[ "async", "def", "handle", "(", "self", ",", "context", ":", "RequestContext", ",", "responder", ":", "BaseResponder", ")", ":", "self", ".", "_logger", ".", "debug", "(", "f\"ConnectionResponseHandler called with context {context}\"", ")", "assert", "isinstance", "(...
[ 13, 4 ]
[ 51, 80 ]
python
en
['en', 'error', 'th']
False
ControllableTaskTeacher._get_save_path
(self, datapath: str, date: str)
Return save path for the controllable gen data. :param datapath: path to ParlAI Data :param date: current date :return path: return path to save
Return save path for the controllable gen data.
def _get_save_path(self, datapath: str, date: str) -> str: """ Return save path for the controllable gen data. :param datapath: path to ParlAI Data :param date: current date :return path: return path to save """ return os.path...
[ "def", "_get_save_path", "(", "self", ",", "datapath", ":", "str", ",", "date", ":", "str", ")", "->", "str", ":", "return", "os", ".", "path", ".", "join", "(", "datapath", ",", "f\"{self.original_task_name.replace(':', '_')}_flattened_controllable_gen_{date}\"", ...
[ 121, 4 ]
[ 136, 9 ]
python
en
['en', 'error', 'th']
False
ControllableTaskTeacher.build_wordlists
(cls, opt: Opt)
Load list of explicitly gendered words. Words taken from <https://github.com/uclanlp/gn_glove/blob/master/wordlist/>. Examples include brother, girl, actress, husbands, etc.
Load list of explicitly gendered words.
def build_wordlists(cls, opt: Opt) -> Tuple[List[str], List[str]]: """ Load list of explicitly gendered words. Words taken from <https://github.com/uclanlp/gn_glove/blob/master/wordlist/>. Examples include brother, girl, actress, husbands, etc. """ build(opt['datapath']...
[ "def", "build_wordlists", "(", "cls", ",", "opt", ":", "Opt", ")", "->", "Tuple", "[", "List", "[", "str", "]", ",", "List", "[", "str", "]", "]", ":", "build", "(", "opt", "[", "'datapath'", "]", ")", "folder", "=", "os", ".", "path", ".", "jo...
[ 139, 4 ]
[ 158, 27 ]
python
en
['en', 'error', 'th']
False
ControllableTaskTeacher._setup_data
(self, opt: Opt)
Flatten and classify the normal task data. Save/load where applicable. :param opt: options dict.
Flatten and classify the normal task data.
def _setup_data(self, opt: Opt) -> List[List[Message]]: """ Flatten and classify the normal task data. Save/load where applicable. :param opt: options dict. """ # create save directory, if it does not already exist self.original_task_name = ':'.join(...
[ "def", "_setup_data", "(", "self", ",", "opt", ":", "Opt", ")", "->", "List", "[", "List", "[", "Message", "]", "]", ":", "# create save directory, if it does not already exist", "self", ".", "original_task_name", "=", "':'", ".", "join", "(", "opt", "[", "'...
[ 160, 4 ]
[ 225, 27 ]
python
en
['en', 'error', 'th']
False
ControllableTaskTeacher.load_data
(self, opt: Opt, filename: str)
Attempt to load pre-build data. Checks for the most recently build data via the date string. :param opt: options dict :param filename: name of (potentially) saved data :return episodes: return list of episodes, if available
Attempt to load pre-build data.
def load_data(self, opt: Opt, filename: str) -> Optional[List[List[Message]]]: """ Attempt to load pre-build data. Checks for the most recently build data via the date string. :param opt: options dict :param filename: name of (potentially) saved data ...
[ "def", "load_data", "(", "self", ",", "opt", ":", "Opt", ",", "filename", ":", "str", ")", "->", "Optional", "[", "List", "[", "List", "[", "Message", "]", "]", "]", ":", "# first check for the most recent date", "save_dir", "=", "self", ".", "_get_save_pa...
[ 227, 4 ]
[ 271, 19 ]
python
en
['en', 'error', 'th']
False
ControllableTaskTeacher.save_data
(self, data: List[List[Message]])
Save the data via dumping to a json file. :param data: list of episodes
Save the data via dumping to a json file.
def save_data(self, data: List[List[Message]]): """ Save the data via dumping to a json file. :param data: list of episodes """ try: json_data = json.dumps(data) with PathManager.open(self.save_path, 'w') as f: f.write(json_dat...
[ "def", "save_data", "(", "self", ",", "data", ":", "List", "[", "List", "[", "Message", "]", "]", ")", ":", "try", ":", "json_data", "=", "json", ".", "dumps", "(", "data", ")", "with", "PathManager", ".", "open", "(", "self", ".", "save_path", ","...
[ 273, 4 ]
[ 286, 69 ]
python
en
['en', 'error', 'th']
False
ControllableTaskTeacher.get
(self, episode_idx: int, entry_idx: int = 0)
Return a flattened example. If using a fixed control, put that in instead of what was originally in the text. :param episode_idx: index of ep in data :param entry_idx: index of ex in ep :return ex: return an example
Return a flattened example.
def get(self, episode_idx: int, entry_idx: int = 0) -> Message: """ Return a flattened example. If using a fixed control, put that in instead of what was originally in the text. :param episode_idx: index of ep in data :param entry_idx: index of ex in ep ...
[ "def", "get", "(", "self", ",", "episode_idx", ":", "int", ",", "entry_idx", ":", "int", "=", "0", ")", "->", "Message", ":", "ex", "=", "Message", "(", "self", ".", "data", "[", "episode_idx", "]", ")", "if", "self", ".", "opt", "[", "'fixed_contr...
[ 288, 4 ]
[ 309, 17 ]
python
en
['en', 'error', 'th']
False
bpe_factory
(opt: Opt, shared: TShared)
BPE Helper Factory. Returns the appropriate BPE helper given the opt as well as available libraries. :param opt: options :param shared: shared dict :return BPEHelper: returns the appropriate BPEHelper object
BPE Helper Factory.
def bpe_factory(opt: Opt, shared: TShared) -> 'BPEHelper': """ BPE Helper Factory. Returns the appropriate BPE helper given the opt as well as available libraries. :param opt: options :param shared: shared dict :return BPEHelper: returns the appropriate BPEHelper o...
[ "def", "bpe_factory", "(", "opt", ":", "Opt", ",", "shared", ":", "TShared", ")", "->", "'BPEHelper'", ":", "from", "parlai", ".", "core", ".", "dict", "import", "DictionaryAgent", "tokenizer", "=", "opt", ".", "get", "(", "'dict_tokenizer'", ",", "Diction...
[ 37, 0 ]
[ 88, 21 ]
python
en
['en', 'error', 'th']
False
BPEHelper.__init__
(self, opt: Opt, shared: TShared = None)
Subclasses _should_ override __init__ to initialize other things.
Subclasses _should_ override __init__ to initialize other things.
def __init__(self, opt: Opt, shared: TShared = None): """ Subclasses _should_ override __init__ to initialize other things. """ from parlai.core.dict import DictionaryAgent self.lower = opt.get('dict_lower', DictionaryAgent.default_lower) self.maxtokens = opt.get('dict_m...
[ "def", "__init__", "(", "self", ",", "opt", ":", "Opt", ",", "shared", ":", "TShared", "=", "None", ")", ":", "from", "parlai", ".", "core", ".", "dict", "import", "DictionaryAgent", "self", ".", "lower", "=", "opt", ".", "get", "(", "'dict_lower'", ...
[ 98, 4 ]
[ 113, 41 ]
python
en
['en', 'error', 'th']
False
BPEHelper.enable_bpe_dropout
(self, enabled: bool)
Used to toggle BPE dropout on (True) or off (False).
Used to toggle BPE dropout on (True) or off (False).
def enable_bpe_dropout(self, enabled: bool): """ Used to toggle BPE dropout on (True) or off (False). """ self._bpe_dropout_enabled = enabled
[ "def", "enable_bpe_dropout", "(", "self", ",", "enabled", ":", "bool", ")", ":", "self", ".", "_bpe_dropout_enabled", "=", "enabled" ]
[ 140, 4 ]
[ 144, 43 ]
python
en
['en', 'error', 'th']
False
BPEHelper.encode
(self, text: str)
Tokenize text. Checks for add_prefix_space; handles accordingly NOTE: DO NOT OVERRIDE :param text: text to tokenize :return tokens: A list of tokens
Tokenize text.
def encode(self, text: str) -> List[str]: """ Tokenize text. Checks for add_prefix_space; handles accordingly NOTE: DO NOT OVERRIDE :param text: text to tokenize :return tokens: A list of tokens """ for special_token in self._sp...
[ "def", "encode", "(", "self", ",", "text", ":", "str", ")", "->", "List", "[", "str", "]", ":", "for", "special_token", "in", "self", ".", "_special_tokens", ".", "keys", "(", ")", ":", "split", "=", "text", ".", "split", "(", "special_token", ")", ...
[ 147, 4 ]
[ 172, 39 ]
python
en
['en', 'error', 'th']
False
BPEHelper.helper_encode
(self, text: str)
Tokenize text. Subclasses should override this method for encoding. :param text: text to tokenize :return tokens: A list of tokens
Tokenize text.
def helper_encode(self, text: str) -> List[str]: """ Tokenize text. Subclasses should override this method for encoding. :param text: text to tokenize :return tokens: A list of tokens """
[ "def", "helper_encode", "(", "self", ",", "text", ":", "str", ")", "->", "List", "[", "str", "]", ":" ]
[ 175, 4 ]
[ 186, 11 ]
python
en
['en', 'error', 'th']
False
BPEHelper.decode
( self, tokens: List[str], token_ids: List[int], delimiter: str = ' ' )
Decode list of tokens into a text string. NOTE: DO NOT OVERRIDE :param tokens: list of tokens :param token_ids: list of token ids :param delimiter: string delimiter for tokens :return text: decoded text
Decode list of tokens into a text string.
def decode( self, tokens: List[str], token_ids: List[int], delimiter: str = ' ' ) -> str: """ Decode list of tokens into a text string. NOTE: DO NOT OVERRIDE :param tokens: list of tokens :param token_ids: list of token ids :param del...
[ "def", "decode", "(", "self", ",", "tokens", ":", "List", "[", "str", "]", ",", "token_ids", ":", "List", "[", "int", "]", ",", "delimiter", ":", "str", "=", "' '", ")", "->", "str", ":", "if", "self", ".", "debug", ":", "return", "delimiter", "....
[ 189, 4 ]
[ 231, 19 ]
python
en
['en', 'error', 'th']
False
BPEHelper.helper_decode
( self, tokens: List[str], token_ids: List[int], delimiter: str )
Decode list of tokens into text string. Subclasses should override this method for decoding. :param tokens: list of tokens :param token_ids: list of token ids :param delimiter: string delimiter for tokens :return text: d...
Decode list of tokens into text string.
def helper_decode( self, tokens: List[str], token_ids: List[int], delimiter: str ) -> str: """ Decode list of tokens into text string. Subclasses should override this method for decoding. :param tokens: list of tokens :param token_ids: list o...
[ "def", "helper_decode", "(", "self", ",", "tokens", ":", "List", "[", "str", "]", ",", "token_ids", ":", "List", "[", "int", "]", ",", "delimiter", ":", "str", ")", "->", "str", ":" ]
[ 234, 4 ]
[ 251, 11 ]
python
en
['en', 'error', 'th']
False
BPEHelper.sync_with_dict
(self, dict_agent)
Sync BPE Helper dictionary with dict_agent dict. :param dict_agent: agent with which we are syncing the dictionary
Sync BPE Helper dictionary with dict_agent dict.
def sync_with_dict(self, dict_agent): """ Sync BPE Helper dictionary with dict_agent dict. :param dict_agent: agent with which we are syncing the dictionary """
[ "def", "sync_with_dict", "(", "self", ",", "dict_agent", ")", ":" ]
[ 254, 4 ]
[ 260, 11 ]
python
en
['en', 'error', 'th']
False
BPEHelper.add_special_tokens
(self, dict_agent, special_tokens: List[str])
Add special tokens to the tokenizer. These tokens are never split, and prioritized over the BPE tokenization.
Add special tokens to the tokenizer.
def add_special_tokens(self, dict_agent, special_tokens: List[str]): """ Add special tokens to the tokenizer. These tokens are never split, and prioritized over the BPE tokenization. """ # note, HF ByteLevelBPE tokenizer handles special tokens itself in # a special way, ...
[ "def", "add_special_tokens", "(", "self", ",", "dict_agent", ",", "special_tokens", ":", "List", "[", "str", "]", ")", ":", "# note, HF ByteLevelBPE tokenizer handles special tokens itself in", "# a special way, so this will be skipped", "for", "token", "in", "special_tokens"...
[ 262, 4 ]
[ 272, 43 ]
python
en
['en', 'error', 'th']
False
BPEHelper.finalize
( self, frequencies: Dict[str, int], num_symbols: int, minfreq: int )
Build the codecs. Default helpers are pre-trained and thus do not build their own codecs :param frequencies: dictionary of (token: frequency) pairs :param num_symbols: Number of BPE symbols. Recommend 30000-40000. If <= 0, default 30000 will be use...
Build the codecs.
def finalize( self, frequencies: Dict[str, int], num_symbols: int, minfreq: int ) -> bool: """ Build the codecs. Default helpers are pre-trained and thus do not build their own codecs :param frequencies: dictionary of (token: frequency) pairs :param num_...
[ "def", "finalize", "(", "self", ",", "frequencies", ":", "Dict", "[", "str", ",", "int", "]", ",", "num_symbols", ":", "int", ",", "minfreq", ":", "int", ")", "->", "bool", ":", "return", "False" ]
[ 274, 4 ]
[ 294, 20 ]
python
en
['en', 'error', 'th']
False
BPEHelper.copy_codecs_file
(self, target_file: str)
Copy the codecs file to a new location. Default behavior is to do nothing. :param target_file: where to copy the codecs.
Copy the codecs file to a new location.
def copy_codecs_file(self, target_file: str): """ Copy the codecs file to a new location. Default behavior is to do nothing. :param target_file: where to copy the codecs. """ pass
[ "def", "copy_codecs_file", "(", "self", ",", "target_file", ":", "str", ")", ":", "pass" ]
[ 296, 4 ]
[ 305, 12 ]
python
en
['en', 'error', 'th']
False
BPEHelper.should_sort
(self)
Return whether tokens should be sorted for this particular helper. DictionaryAgent sorts tokens upon saving; we don't generally want to sort with our pre-trained dictionaries, so default is False.
Return whether tokens should be sorted for this particular helper.
def should_sort(self) -> bool: """ Return whether tokens should be sorted for this particular helper. DictionaryAgent sorts tokens upon saving; we don't generally want to sort with our pre-trained dictionaries, so default is False. """ return False
[ "def", "should_sort", "(", "self", ")", "->", "bool", ":", "return", "False" ]
[ 307, 4 ]
[ 314, 20 ]
python
en
['en', 'error', 'th']
False
SubwordBPEHelper.__init__
(self, opt: Opt, shared: TShared = None)
Initialize the BPE module. :param opt: options :param shared: shared dictionary
Initialize the BPE module.
def __init__(self, opt: Opt, shared: TShared = None): """ Initialize the BPE module. :param opt: options :param shared: shared dictionary """ super().__init__(opt, shared) if not SUBWORD_BPE_INSTALLED: raise RuntimeError("Pleas...
[ "def", "__init__", "(", "self", ",", "opt", ":", "Opt", ",", "shared", ":", "TShared", "=", "None", ")", ":", "super", "(", ")", ".", "__init__", "(", "opt", ",", "shared", ")", "if", "not", "SUBWORD_BPE_INSTALLED", ":", "raise", "RuntimeError", "(", ...
[ 334, 4 ]
[ 353, 36 ]
python
en
['en', 'error', 'th']
False
SubwordBPEHelper.helper_encode
(self, text: str)
Tokenize the text with bpe if codecs are already finalized. Otherwise, returns the regularly split tokens that will train the bpe. :param text: Raw text to tokenize. :return: a list of tokens. Will use BPE once finalized.
Tokenize the text with bpe if codecs are already finalized.
def helper_encode(self, text: str) -> List[str]: """ Tokenize the text with bpe if codecs are already finalized. Otherwise, returns the regularly split tokens that will train the bpe. :param text: Raw text to tokenize. :return: a list of tokens. Will use...
[ "def", "helper_encode", "(", "self", ",", "text", ":", "str", ")", "->", "List", "[", "str", "]", ":", "text", "=", "text", ".", "replace", "(", "'\\n'", ",", "' __newln__ '", ")", "tokens", "=", "self", ".", "splitter", ".", "findall", "(", "text", ...
[ 360, 4 ]
[ 377, 25 ]
python
en
['en', 'error', 'th']
False
SubwordBPEHelper.helper_decode
( self, tokens: List[str], token_ids: List[int], delimiter: str )
Decode list of tokens into text string. :param tokens: list of tokens :param token_ids: list of token ids :param delimiter: string delimiter for tokens :return text: decoded text
Decode list of tokens into text string.
def helper_decode( self, tokens: List[str], token_ids: List[int], delimiter: str ) -> str: """ Decode list of tokens into text string. :param tokens: list of tokens :param token_ids: list of token ids :param delimiter: string delim...
[ "def", "helper_decode", "(", "self", ",", "tokens", ":", "List", "[", "str", "]", ",", "token_ids", ":", "List", "[", "int", "]", ",", "delimiter", ":", "str", ")", "->", "str", ":", "text", "=", "delimiter", ".", "join", "(", "tokens", ")", "text"...
[ 379, 4 ]
[ 401, 19 ]
python
en
['en', 'error', 'th']
False
SubwordBPEHelper.finalize
( self, frequencies: Dict[str, int], num_symbols: int = 30000, minfreq: int = 2 )
Build the codecs. :param frequencies: dictionary of (token: frequency) pairs :param num_symbols: Number of BPE symbols. Recommend 30000-40000. If <= 0, default 30000 will be used. :param minfreq: Minimum frequency of a token before force...
Build the codecs.
def finalize( self, frequencies: Dict[str, int], num_symbols: int = 30000, minfreq: int = 2 ) -> bool: """ Build the codecs. :param frequencies: dictionary of (token: frequency) pairs :param num_symbols: Number of BPE symbols. Recommend 30000-40000. ...
[ "def", "finalize", "(", "self", ",", "frequencies", ":", "Dict", "[", "str", ",", "int", "]", ",", "num_symbols", ":", "int", "=", "30000", ",", "minfreq", ":", "int", "=", "2", ")", "->", "bool", ":", "if", "hasattr", "(", "self", ",", "'bpe'", ...
[ 403, 4 ]
[ 446, 19 ]
python
en
['en', 'error', 'th']
False
SubwordBPEHelper._load_from_codecs
(self)
Load BPE from codecs file.
Load BPE from codecs file.
def _load_from_codecs(self): """ Load BPE from codecs file. """ with PathManager.open(self.codecs, 'r', encoding='utf-8') as codecs_file: self.bpe = apply_bpe.BPE(codecs_file)
[ "def", "_load_from_codecs", "(", "self", ")", ":", "with", "PathManager", ".", "open", "(", "self", ".", "codecs", ",", "'r'", ",", "encoding", "=", "'utf-8'", ")", "as", "codecs_file", ":", "self", ".", "bpe", "=", "apply_bpe", ".", "BPE", "(", "codec...
[ 448, 4 ]
[ 453, 49 ]
python
en
['en', 'error', 'th']
False
SubwordBPEHelper.copy_codecs_file
(self, target_file: str)
Copy the codecs file to a new location. :param target_file: where to copy the codecs.
Copy the codecs file to a new location.
def copy_codecs_file(self, target_file: str): """ Copy the codecs file to a new location. :param target_file: where to copy the codecs. """ with PathManager.open(target_file, 'w', encoding='utf-8') as wfile: with PathManager.open(self.codecs, encoding='ut...
[ "def", "copy_codecs_file", "(", "self", ",", "target_file", ":", "str", ")", ":", "with", "PathManager", ".", "open", "(", "target_file", ",", "'w'", ",", "encoding", "=", "'utf-8'", ")", "as", "wfile", ":", "with", "PathManager", ".", "open", "(", "self...
[ 455, 4 ]
[ 465, 37 ]
python
en
['en', 'error', 'th']
False
SubwordBPEHelper.sync_with_dict
(self, dict_agent)
No need to sync subword BPE.
No need to sync subword BPE.
def sync_with_dict(self, dict_agent): """ No need to sync subword BPE. """ pass
[ "def", "sync_with_dict", "(", "self", ",", "dict_agent", ")", ":", "pass" ]
[ 467, 4 ]
[ 471, 12 ]
python
en
['en', 'error', 'th']
False
SubwordBPEHelper.should_sort
(self)
Return whether tokens should be sorted for this particular helper. We want to sort with SubwordBPEHelper.
Return whether tokens should be sorted for this particular helper.
def should_sort(self) -> bool: """ Return whether tokens should be sorted for this particular helper. We want to sort with SubwordBPEHelper. """ return True
[ "def", "should_sort", "(", "self", ")", "->", "bool", ":", "return", "True" ]
[ 473, 4 ]
[ 479, 19 ]
python
en
['en', 'error', 'th']
False
Gpt2BpeHelper.__init__
(self, opt: Opt, shared: TShared = None)
Override init to build the data.
Override init to build the data.
def __init__(self, opt: Opt, shared: TShared = None): """ Override init to build the data. """ super().__init__(opt, shared) if self.lower: warn_once('Are you sure you want to lower case your BPE dictionary?') if self.maxtokens > 0 or self.minfreq > 0: ...
[ "def", "__init__", "(", "self", ",", "opt", ":", "Opt", ",", "shared", ":", "TShared", "=", "None", ")", ":", "super", "(", ")", ".", "__init__", "(", "opt", ",", "shared", ")", "if", "self", ".", "lower", ":", "warn_once", "(", "'Are you sure you wa...
[ 509, 4 ]
[ 546, 9 ]
python
en
['en', 'error', 'th']
False
Gpt2BpeHelper._build_data
(self)
Build data. Maybe download the appropriate data. :return (bpe_data, json_path): bpe_data and path to encoder json
Build data.
def _build_data(self) -> Tuple[str, str]: """ Build data. Maybe download the appropriate data. :return (bpe_data, json_path): bpe_data and path to encoder json """ data_path = os.path.join(self.opt['datapath'], 'gpt2') vocab_path = os.path.join(data_...
[ "def", "_build_data", "(", "self", ")", "->", "Tuple", "[", "str", ",", "str", "]", ":", "data_path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "opt", "[", "'datapath'", "]", ",", "'gpt2'", ")", "vocab_path", "=", "os", ".", "path", ...
[ 548, 4 ]
[ 567, 46 ]
python
en
['en', 'error', 'th']
False
Gpt2BpeHelper._build_encoder
(self, json_path: str)
Build and return the encoder. :param json_path: path to encoder json file :return: encoder, mapping tokens to unicode reps
Build and return the encoder.
def _build_encoder(self, json_path: str) -> Dict[str, str]: """ Build and return the encoder. :param json_path: path to encoder json file :return: encoder, mapping tokens to unicode reps """ with PathManager.open(json_path, 'r', encoding='utf8') ...
[ "def", "_build_encoder", "(", "self", ",", "json_path", ":", "str", ")", "->", "Dict", "[", "str", ",", "str", "]", ":", "with", "PathManager", ".", "open", "(", "json_path", ",", "'r'", ",", "encoding", "=", "'utf8'", ")", "as", "f", ":", "encoder",...
[ 569, 4 ]
[ 589, 22 ]
python
en
['en', 'error', 'th']
False
Gpt2BpeHelper.bytes_to_unicode
(self)
Returns list of utf-8 byte and a corresponding list of unicode strings. The reversible bpe codes work on unicode strings. This means you need a large # of unicode characters in your vocab if you want to avoid UNKs. When you're at something like a 10B token dataset you end up needing ar...
Returns list of utf-8 byte and a corresponding list of unicode strings.
def bytes_to_unicode(self) -> Dict[int, str]: """ Returns list of utf-8 byte and a corresponding list of unicode strings. The reversible bpe codes work on unicode strings. This means you need a large # of unicode characters in your vocab if you want to avoid UNKs. When you're at ...
[ "def", "bytes_to_unicode", "(", "self", ")", "->", "Dict", "[", "int", ",", "str", "]", ":", "bs", ":", "List", "[", "int", "]", "=", "(", "list", "(", "range", "(", "ord", "(", "\"!\"", ")", ",", "ord", "(", "\"~\"", ")", "+", "1", ")", ")",...
[ 592, 4 ]
[ 616, 36 ]
python
en
['en', 'error', 'th']
False
Gpt2BpeHelper.get_pairs
(self, word: Tuple[str, ...])
Return set of symbol pairs in a word. Word is represented as tuple of symbols (symbols being variable-length strings). :param word: word to symbolize :return pairs: set of tuples of symbols
Return set of symbol pairs in a word.
def get_pairs(self, word: Tuple[str, ...]) -> Set[Tuple[str, str]]: """ Return set of symbol pairs in a word. Word is represented as tuple of symbols (symbols being variable-length strings). :param word: word to symbolize :return pairs: set of tuples of...
[ "def", "get_pairs", "(", "self", ",", "word", ":", "Tuple", "[", "str", ",", "...", "]", ")", "->", "Set", "[", "Tuple", "[", "str", ",", "str", "]", "]", ":", "pairs", "=", "[", "]", "prev_char", "=", "word", "[", "0", "]", "for", "char", "i...
[ 618, 4 ]
[ 635, 20 ]
python
en
['en', 'error', 'th']
False
Gpt2BpeHelper._dropout_pairs
(self, pairs)
Implements BPE dropout (Provlikov et al., 2019). https://arxiv.org/abs/1910.13267 Randomly removes merges from the list of possible merges. This can result in different subwords being used to realized the same string, and effectively regularizes representations.
Implements BPE dropout (Provlikov et al., 2019).
def _dropout_pairs(self, pairs): """ Implements BPE dropout (Provlikov et al., 2019). https://arxiv.org/abs/1910.13267 Randomly removes merges from the list of possible merges. This can result in different subwords being used to realized the same string, and effectively...
[ "def", "_dropout_pairs", "(", "self", ",", "pairs", ")", ":", "if", "not", "self", ".", "bpe_dropout", "or", "not", "self", ".", "_bpe_dropout_enabled", ":", "return", "pairs", "dropped_pairs", "=", "[", "p", "for", "p", "in", "pairs", "if", "random", "....
[ 637, 4 ]
[ 653, 28 ]
python
en
['en', 'error', 'th']
False
Gpt2BpeHelper.bpe
(self, token: str)
Convert token to BPE. :param token: token to convert :return bpe_encoding: string bpe encoding
Convert token to BPE.
def bpe(self, token: str) -> str: """ Convert token to BPE. :param token: token to convert :return bpe_encoding: string bpe encoding """ word = tuple(token) pairs = self.get_pairs(word) if not pairs: return token ...
[ "def", "bpe", "(", "self", ",", "token", ":", "str", ")", "->", "str", ":", "word", "=", "tuple", "(", "token", ")", "pairs", "=", "self", ".", "get_pairs", "(", "word", ")", "if", "not", "pairs", ":", "return", "token", "while", "True", ":", "dr...
[ 655, 4 ]
[ 701, 29 ]
python
en
['en', 'error', 'th']
False
Gpt2BpeHelper.helper_encode
(self, text: str)
Tokenize text. :param text: text to tokenize :return tokens: A list of tokens
Tokenize text.
def helper_encode(self, text: str) -> List[str]: """ Tokenize text. :param text: text to tokenize :return tokens: A list of tokens """ bpe_tokens: List[str] = [] for token in self.re.findall(self.pat, text): token = ''.join(se...
[ "def", "helper_encode", "(", "self", ",", "text", ":", "str", ")", "->", "List", "[", "str", "]", ":", "bpe_tokens", ":", "List", "[", "str", "]", "=", "[", "]", "for", "token", "in", "self", ".", "re", ".", "findall", "(", "self", ".", "pat", ...
[ 703, 4 ]
[ 719, 25 ]
python
en
['en', 'error', 'th']
False
Gpt2BpeHelper.helper_decode
( self, tokens: List[str], token_ids: List[int], delimiter: str )
Decode list of tokens into text string. :param tokens: list of tokens :param token_ids: list of token ids :param delimiter: string delimiter for tokens :return text: decoded text
Decode list of tokens into text string.
def helper_decode( self, tokens: List[str], token_ids: List[int], delimiter: str ) -> str: """ Decode list of tokens into text string. :param tokens: list of tokens :param token_ids: list of token ids :param delimiter: string delim...
[ "def", "helper_decode", "(", "self", ",", "tokens", ":", "List", "[", "str", "]", ",", "token_ids", ":", "List", "[", "int", "]", ",", "delimiter", ":", "str", ")", "->", "str", ":", "text", "=", "''", ".", "join", "(", "[", "self", ".", "decoder...
[ 721, 4 ]
[ 741, 19 ]
python
en
['en', 'error', 'th']
False
Gpt2BpeHelper.sync_with_dict
(self, dict_agent)
Sync with dictionary agent. Just add all of the tokens to the dict NOTE: How does this handle special tokens? :param dict_agent: A DictionaryAgent instantiation
Sync with dictionary agent.
def sync_with_dict(self, dict_agent): """ Sync with dictionary agent. Just add all of the tokens to the dict NOTE: How does this handle special tokens? :param dict_agent: A DictionaryAgent instantiation """ for each_token in self.encoder.values(): ...
[ "def", "sync_with_dict", "(", "self", ",", "dict_agent", ")", ":", "for", "each_token", "in", "self", ".", "encoder", ".", "values", "(", ")", ":", "dict_agent", ".", "add_token", "(", "each_token", ")", "dict_agent", ".", "freq", "[", "each_token", "]", ...
[ 743, 4 ]
[ 756, 43 ]
python
en
['en', 'error', 'th']
False
Gpt2BpeHelper.save
(self, dir_name: str, file_name: str)
Save appropriate files. :param dir_name: directory to save. :param file_name: file to save.
Save appropriate files.
def save(self, dir_name: str, file_name: str): """ Save appropriate files. :param dir_name: directory to save. :param file_name: file to save. """ out_json_path = os.path.join(dir_name, file_name + "-vocab.json") out_merge_path = os.path.j...
[ "def", "save", "(", "self", ",", "dir_name", ":", "str", ",", "file_name", ":", "str", ")", ":", "out_json_path", "=", "os", ".", "path", ".", "join", "(", "dir_name", ",", "file_name", "+", "\"-vocab.json\"", ")", "out_merge_path", "=", "os", ".", "pa...
[ 758, 4 ]
[ 776, 61 ]
python
en
['en', 'error', 'th']
False
HuggingFaceBpeHelper.helper_encode
(self, text: str)
Decode list of tokens into text string. :param tokens: list of tokens :param delimiter: string delimiter for tokens :return text: decoded text
Decode list of tokens into text string.
def helper_encode(self, text: str) -> List[str]: """ Decode list of tokens into text string. :param tokens: list of tokens :param delimiter: string delimiter for tokens :return text: decoded text """ return self.tokenizer.enco...
[ "def", "helper_encode", "(", "self", ",", "text", ":", "str", ")", "->", "List", "[", "str", "]", ":", "return", "self", ".", "tokenizer", ".", "encode", "(", "text", ")", ".", "tokens" ]
[ 852, 4 ]
[ 864, 49 ]
python
en
['en', 'error', 'th']
False
HuggingFaceBpeHelper.helper_decode
( self, tokens: List[str], token_ids: List[int], delimiter: str )
Decode list of tokens into text string. :param tokens: list of tokens :param token_ids: list of token ids :param delimiter: string delimiter for tokens :return text: decoded text
Decode list of tokens into text string.
def helper_decode( self, tokens: List[str], token_ids: List[int], delimiter: str ) -> str: """ Decode list of tokens into text string. :param tokens: list of tokens :param token_ids: list of token ids :param delimiter: string delim...
[ "def", "helper_decode", "(", "self", ",", "tokens", ":", "List", "[", "str", "]", ",", "token_ids", ":", "List", "[", "int", "]", ",", "delimiter", ":", "str", ")", "->", "str", ":", "text", "=", "self", ".", "tokenizer", ".", "decode", "(", "token...
[ 866, 4 ]
[ 884, 19 ]
python
en
['en', 'error', 'th']
False
HuggingFaceBpeHelper.add_special_tokens
(self, dict_agent, special_tokens: List[str])
Add special tokens to the tokenizer and dict_agent.
Add special tokens to the tokenizer and dict_agent.
def add_special_tokens(self, dict_agent, special_tokens: List[str]): """ Add special tokens to the tokenizer and dict_agent. """ logging.debug(f'adding the following special tokens: {special_tokens}') self.tokenizer.add_special_tokens(special_tokens) # add to HF for tok...
[ "def", "add_special_tokens", "(", "self", ",", "dict_agent", ",", "special_tokens", ":", "List", "[", "str", "]", ")", ":", "logging", ".", "debug", "(", "f'adding the following special tokens: {special_tokens}'", ")", "self", ".", "tokenizer", ".", "add_special_tok...
[ 886, 4 ]
[ 896, 53 ]
python
en
['en', 'error', 'th']
False
HuggingFaceBpeHelper.sync_with_dict
(self, dict_agent)
Sync the dictionary agent with Hugging Face tokenizer's BPE dict. Called only once on initialization.
Sync the dictionary agent with Hugging Face tokenizer's BPE dict.
def sync_with_dict(self, dict_agent): """ Sync the dictionary agent with Hugging Face tokenizer's BPE dict. Called only once on initialization. """ special_tokens = [ dict_agent.null_token, dict_agent.start_token, dict_agent.end_token, ...
[ "def", "sync_with_dict", "(", "self", ",", "dict_agent", ")", ":", "special_tokens", "=", "[", "dict_agent", ".", "null_token", ",", "dict_agent", ".", "start_token", ",", "dict_agent", ".", "end_token", ",", "dict_agent", ".", "unk_token", ",", "]", "self", ...
[ 898, 4 ]
[ 917, 38 ]
python
en
['en', 'error', 'th']
False
HuggingFaceBpeHelper.save
(self, dir_name: str, file_name: str)
Save appropriate files. :param dir_name: directory to save. :param file_name: file to save.
Save appropriate files.
def save(self, dir_name: str, file_name: str): """ Save appropriate files. :param dir_name: directory to save. :param file_name: file to save. """ self.tokenizer.save_model(dir_name, file_name)
[ "def", "save", "(", "self", ",", "dir_name", ":", "str", ",", "file_name", ":", "str", ")", ":", "self", ".", "tokenizer", ".", "save_model", "(", "dir_name", ",", "file_name", ")" ]
[ 919, 4 ]
[ 928, 54 ]
python
en
['en', 'error', 'th']
False
SlowBytelevelBPE._build_data
(self)
Override to load dicts if they exist. :return (bpe_data, json_path): bpe_data and path to encoder json
Override to load dicts if they exist.
def _build_data(self) -> Tuple[str, str]: """ Override to load dicts if they exist. :return (bpe_data, json_path): bpe_data and path to encoder json """ bpe_data = None json_path = '' vocab_path = '' if self.opt.get('dict_loaded'): ...
[ "def", "_build_data", "(", "self", ")", "->", "Tuple", "[", "str", ",", "str", "]", ":", "bpe_data", "=", "None", "json_path", "=", "''", "vocab_path", "=", "''", "if", "self", ".", "opt", ".", "get", "(", "'dict_loaded'", ")", ":", "dfname", "=", ...
[ 939, 4 ]
[ 962, 46 ]
python
en
['en', 'error', 'th']
False
SlowBytelevelBPE.sync_with_dict
(self, dict_agent)
Basically a combination of syncing HF dict with the GPT2 standard. It's kinda reversed. :param dict_agent: Dictionary Agent
Basically a combination of syncing HF dict with the GPT2 standard.
def sync_with_dict(self, dict_agent): """ Basically a combination of syncing HF dict with the GPT2 standard. It's kinda reversed. :param dict_agent: Dictionary Agent """ special_tokens = [ dict_agent.null_token, dict_agent.start_token...
[ "def", "sync_with_dict", "(", "self", ",", "dict_agent", ")", ":", "special_tokens", "=", "[", "dict_agent", ".", "null_token", ",", "dict_agent", ".", "start_token", ",", "dict_agent", ".", "end_token", ",", "dict_agent", ".", "unk_token", ",", "]", "dict_age...
[ 964, 4 ]
[ 985, 43 ]
python
en
['en', 'error', 'th']
False
DIDDocWrapper._serialize
(self, value, attr, obj, **kwargs)
Serialize the DIDDoc. Args: value: The value to serialize Returns: The serialized DIDDoc
Serialize the DIDDoc.
def _serialize(self, value, attr, obj, **kwargs): """ Serialize the DIDDoc. Args: value: The value to serialize Returns: The serialized DIDDoc """ return value.serialize()
[ "def", "_serialize", "(", "self", ",", "value", ",", "attr", ",", "obj", ",", "*", "*", "kwargs", ")", ":", "return", "value", ".", "serialize", "(", ")" ]
[ 12, 4 ]
[ 23, 32 ]
python
en
['en', 'error', 'th']
False
DIDDocWrapper._deserialize
(self, value, attr, data, **kwargs)
Deserialize a value into a DIDDoc. Args: value: The value to deserialize Returns: The deserialized value
Deserialize a value into a DIDDoc.
def _deserialize(self, value, attr, data, **kwargs): """ Deserialize a value into a DIDDoc. Args: value: The value to deserialize Returns: The deserialized value """ # quick fix for missing optional values if "authentication" not in valu...
[ "def", "_deserialize", "(", "self", ",", "value", ",", "attr", ",", "data", ",", "*", "*", "kwargs", ")", ":", "# quick fix for missing optional values", "if", "\"authentication\"", "not", "in", "value", ":", "value", "[", "\"authentication\"", "]", "=", "[", ...
[ 25, 4 ]
[ 41, 40 ]
python
en
['en', 'error', 'th']
False
ConnectionDetail.__init__
(self, *, did: str = None, did_doc: DIDDoc = None, **kwargs)
Initialize a ConnectionDetail instance. Args: did: DID for the connection detail did_doc: DIDDoc for connection detail
Initialize a ConnectionDetail instance.
def __init__(self, *, did: str = None, did_doc: DIDDoc = None, **kwargs): """ Initialize a ConnectionDetail instance. Args: did: DID for the connection detail did_doc: DIDDoc for connection detail """ super(ConnectionDetail, self).__init__(**kwargs) ...
[ "def", "__init__", "(", "self", ",", "*", ",", "did", ":", "str", "=", "None", ",", "did_doc", ":", "DIDDoc", "=", "None", ",", "*", "*", "kwargs", ")", ":", "super", "(", "ConnectionDetail", ",", "self", ")", ".", "__init__", "(", "*", "*", "kwa...
[ 52, 4 ]
[ 63, 31 ]
python
en
['en', 'error', 'th']
False
ConnectionDetail.did
(self)
Accessor for the connection DID. Returns: The DID for this connection
Accessor for the connection DID.
def did(self) -> str: """ Accessor for the connection DID. Returns: The DID for this connection """ return self._did
[ "def", "did", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_did" ]
[ 66, 4 ]
[ 74, 24 ]
python
en
['en', 'error', 'th']
False
ConnectionDetail.did_doc
(self)
Accessor for the connection DID Document. Returns: The DIDDoc for this connection
Accessor for the connection DID Document.
def did_doc(self) -> DIDDoc: """ Accessor for the connection DID Document. Returns: The DIDDoc for this connection """ return self._did_doc
[ "def", "did_doc", "(", "self", ")", "->", "DIDDoc", ":", "return", "self", ".", "_did_doc" ]
[ 77, 4 ]
[ 85, 28 ]
python
en
['en', 'error', 'th']
False
canopy_total_PAR_absorbed
(states: ClimateStates, setpoints: Setpoints, weather: Weather)
Equation 17 [2] Returns: PAR absorbed by the canopy [µmol{photons} m^{-2} s^{-1}]
Equation 17 [2] Returns: PAR absorbed by the canopy [µmol{photons} m^{-2} s^{-1}]
def canopy_total_PAR_absorbed(states: ClimateStates, setpoints: Setpoints, weather: Weather): """ Equation 17 [2] Returns: PAR absorbed by the canopy [µmol{photons} m^{-2} s^{-1}] """ return Coefficients.Lamp.lamp_photons_per_joule * canopy_PAR_absorbed_from_lamp(states, setpoints) \ + Co...
[ "def", "canopy_total_PAR_absorbed", "(", "states", ":", "ClimateStates", ",", "setpoints", ":", "Setpoints", ",", "weather", ":", "Weather", ")", ":", "return", "Coefficients", ".", "Lamp", ".", "lamp_photons_per_joule", "*", "canopy_PAR_absorbed_from_lamp", "(", "s...
[ 13, 0 ]
[ 20, 94 ]
python
en
['en', 'error', 'th']
False
canopy_PAR_absorbed_from_sun
(states: ClimateStates, setpoints: Setpoints, weather: Weather)
The PAR absorbed by the canopy Equation 8.26 :return: The PAR absorbed by the canopy [W m^-2]
The PAR absorbed by the canopy Equation 8.26 :return: The PAR absorbed by the canopy [W m^-2]
def canopy_PAR_absorbed_from_sun(states: ClimateStates, setpoints: Setpoints, weather: Weather): """The PAR absorbed by the canopy Equation 8.26 :return: The PAR absorbed by the canopy [W m^-2] """ return canopy_PAR_absorbed_from_greenhouse_cover(states, setpoints, weather) + \ canopy_PAR...
[ "def", "canopy_PAR_absorbed_from_sun", "(", "states", ":", "ClimateStates", ",", "setpoints", ":", "Setpoints", ",", "weather", ":", "Weather", ")", ":", "return", "canopy_PAR_absorbed_from_greenhouse_cover", "(", "states", ",", "setpoints", ",", "weather", ")", "+"...
[ 23, 0 ]
[ 29, 80 ]
python
en
['en', 'en', 'en']
True
PAR_above_canopy_from_sun
(setpoints: Setpoints, weather: Weather)
The PAR above the canopy The model contains four cover layers: + A movable outdoor shading screen + A semi-permanent shading screen + The greenhouse roof + A movable indoor thermal screen Equation 8.28 :return: the PAR above the canopy [W m^-2]
The PAR above the canopy
def PAR_above_canopy_from_sun(setpoints: Setpoints, weather: Weather): """The PAR above the canopy The model contains four cover layers: + A movable outdoor shading screen + A semi-permanent shading screen + The greenhouse roof + A movable indoor thermal screen Equation 8.28 :return: t...
[ "def", "PAR_above_canopy_from_sun", "(", "setpoints", ":", "Setpoints", ",", "weather", ":", "Weather", ")", ":", "# TODO: need to re-verify the order of four cover layers", "shScr_PAR_transmission_coef", "=", "Coefficients", ".", "Shadowscreen", ".", "shScr_PAR_transmission_co...
[ 98, 0 ]
[ 126, 99 ]
python
en
['en', 'en', 'en']
True
canopy_NIR_absorbed_from_sun
(states: ClimateStates, setpoints: Setpoints, weather: Weather)
The NIR absorbed by the canopy The model contains four cover layers: + A movable outdoor shading screen + A semi-permanent shading screen + The greenhouse roof + A movable indoor thermal screen Equation 8.33 :return: The NIR absorbed by the canopy [W m^-2]
The NIR absorbed by the canopy
def canopy_NIR_absorbed_from_sun(states: ClimateStates, setpoints: Setpoints, weather: Weather): """The NIR absorbed by the canopy The model contains four cover layers: + A movable outdoor shading screen + A semi-permanent shading screen + The greenhouse roof + A movable indoor thermal screen ...
[ "def", "canopy_NIR_absorbed_from_sun", "(", "states", ":", "ClimateStates", ",", "setpoints", ":", "Setpoints", ",", "weather", ":", "Weather", ")", ":", "# TODO: need to re-verify the order of four cover layers and cover-canopy-floor", "shScr_NIR_transmission_coef", "=", "Coef...
[ 129, 0 ]
[ 181, 132 ]
python
en
['en', 'en', 'en']
True
canopy_PAR_absorbed_from_lamp
(states: ClimateStates, setpoints: Setpoints)
Equation A19 [2] Returns: PAR from the lamps directly absorbed by the canopy [W m^{-2}]
Equation A19 [2]
def canopy_PAR_absorbed_from_lamp(states: ClimateStates, setpoints: Setpoints): """ Equation A19 [2] Returns: PAR from the lamps directly absorbed by the canopy [W m^{-2}] """ return canopy_PAR_absorbed_from_lamp_Down(states, setpoints) \ + canopy_PAR_absorbed_from_lamp_reflected_by_floor_...
[ "def", "canopy_PAR_absorbed_from_lamp", "(", "states", ":", "ClimateStates", ",", "setpoints", ":", "Setpoints", ")", ":", "return", "canopy_PAR_absorbed_from_lamp_Down", "(", "states", ",", "setpoints", ")", "+", "canopy_PAR_absorbed_from_lamp_reflected_by_floor_Up", "(", ...
[ 184, 0 ]
[ 191, 81 ]
python
en
['en', 'error', 'th']
False
canopy_PAR_absorbed_from_lamp_Down
(states: ClimateStates, setpoints: Setpoints)
Equation A17 [2] Returns: Total PAR from the lamps absorbed by the canopy [W m^{-2}]
Equation A17 [2]
def canopy_PAR_absorbed_from_lamp_Down(states: ClimateStates, setpoints: Setpoints): """ Equation A17 [2] Returns: Total PAR from the lamps absorbed by the canopy [W m^{-2}] """ radiation_flux_PARGh_Lamp = PAR_above_canopy_from_lamp(setpoints) return radiation_flux_PARGh_Lamp * (1 - CANOPY_PAR...
[ "def", "canopy_PAR_absorbed_from_lamp_Down", "(", "states", ":", "ClimateStates", ",", "setpoints", ":", "Setpoints", ")", ":", "radiation_flux_PARGh_Lamp", "=", "PAR_above_canopy_from_lamp", "(", "setpoints", ")", "return", "radiation_flux_PARGh_Lamp", "*", "(", "1", "...
[ 194, 0 ]
[ 203, 81 ]
python
en
['en', 'error', 'th']
False
PAR_above_canopy_from_lamp
(setpoints: Setpoints)
Equation A15 [2] Returns: PAR above the canopy from the lamps [W m^{-2}]
Equation A15 [2]
def PAR_above_canopy_from_lamp(setpoints: Setpoints): """ Equation A15 [2] Returns: PAR above the canopy from the lamps [W m^{-2}] """ electrical_input_lamp = lamp_electrical_input(setpoints) return Coefficients.Lamp.lamp_electrical_input_PAR_conversion * electrical_input_lamp
[ "def", "PAR_above_canopy_from_lamp", "(", "setpoints", ":", "Setpoints", ")", ":", "electrical_input_lamp", "=", "lamp_electrical_input", "(", "setpoints", ")", "return", "Coefficients", ".", "Lamp", ".", "lamp_electrical_input_PAR_conversion", "*", "electrical_input_lamp" ...
[ 206, 0 ]
[ 213, 89 ]
python
en
['en', 'error', 'th']
False
canopy_PAR_absorbed_from_lamp_reflected_by_floor_Up
(states: ClimateStates, setpoints: Setpoints)
Equation A18 [2] Returns: PAR from the lamps absorbed by the canopy after reflection from the floor [W m^{-2}]
Equation A18 [2]
def canopy_PAR_absorbed_from_lamp_reflected_by_floor_Up(states: ClimateStates, setpoints: Setpoints): """ Equation A18 [2] Returns: PAR from the lamps absorbed by the canopy after reflection from the floor [W m^{-2}] """ radiation_flux_PARGh_Lamp = PAR_above_canopy_from_lamp(setpoints) floor_PA...
[ "def", "canopy_PAR_absorbed_from_lamp_reflected_by_floor_Up", "(", "states", ":", "ClimateStates", ",", "setpoints", ":", "Setpoints", ")", ":", "radiation_flux_PARGh_Lamp", "=", "PAR_above_canopy_from_lamp", "(", "setpoints", ")", "floor_PAR_reflection_coef", "=", "Coefficie...
[ 216, 0 ]
[ 226, 80 ]
python
en
['en', 'error', 'th']
False
canopy_NIR_absorbed_from_lamp
(states: ClimateStates, setpoints: Setpoints)
Equation A20 [2] Args: states: setpoints: Returns: NIR from the lamps absorbed by the canopy [W m^{-2}]
Equation A20 [2] Args: states: setpoints:
def canopy_NIR_absorbed_from_lamp(states: ClimateStates, setpoints: Setpoints): """ Equation A20 [2] Args: states: setpoints: Returns: NIR from the lamps absorbed by the canopy [W m^{-2}] """ radiation_flux_PARGh_Lamp = PAR_above_canopy_from_lamp(setpoints) return Coefficie...
[ "def", "canopy_NIR_absorbed_from_lamp", "(", "states", ":", "ClimateStates", ",", "setpoints", ":", "Setpoints", ")", ":", "radiation_flux_PARGh_Lamp", "=", "PAR_above_canopy_from_lamp", "(", "setpoints", ")", "return", "Coefficients", ".", "Lamp", ".", "lamp_electrical...
[ 229, 0 ]
[ 241, 116 ]
python
en
['en', 'error', 'th']
False
canopy_PAR_absorbed_from_inter_lamp
(setpoints: Setpoints)
Equation A24 [2] Args: setpoints: Returns: PAR from the interlights to the canopy lamps [W m^{-2}]
Equation A24 [2] Args: setpoints:
def canopy_PAR_absorbed_from_inter_lamp(setpoints: Setpoints): """ Equation A24 [2] Args: setpoints: Returns: PAR from the interlights to the canopy lamps [W m^{-2}] """ radiation_flux_PARGh_Lamp = PAR_above_canopy_from_lamp(setpoints) return Coefficients.Interlight.inter_lamp_elect...
[ "def", "canopy_PAR_absorbed_from_inter_lamp", "(", "setpoints", ":", "Setpoints", ")", ":", "radiation_flux_PARGh_Lamp", "=", "PAR_above_canopy_from_lamp", "(", "setpoints", ")", "return", "Coefficients", ".", "Interlight", ".", "inter_lamp_electrical_input_PAR_conversion", "...
[ 252, 0 ]
[ 261, 105 ]
python
en
['en', 'error', 'th']
False
canopy_NIR_absorbed_from_inter_lamp
(setpoints: Setpoints)
Equation A25 [2] Args: setpoints: Returns: NIR from the interlight absorbed by the canopy [W m^{-2}]
Equation A25 [2] Args: setpoints:
def canopy_NIR_absorbed_from_inter_lamp(setpoints: Setpoints): """ Equation A25 [2] Args: setpoints: Returns: NIR from the interlight absorbed by the canopy [W m^{-2}] """ radiation_flux_PARGh_Lamp = PAR_above_canopy_from_lamp(setpoints) return Coefficients.Interlight.inter_lamp_ele...
[ "def", "canopy_NIR_absorbed_from_inter_lamp", "(", "setpoints", ":", "Setpoints", ")", ":", "radiation_flux_PARGh_Lamp", "=", "PAR_above_canopy_from_lamp", "(", "setpoints", ")", "return", "Coefficients", ".", "Interlight", ".", "inter_lamp_electrical_input_NIR_conversion", "...
[ 264, 0 ]
[ 273, 105 ]
python
en
['en', 'error', 'th']
False
floor_PAR_absorbed_from_lamp
(states: ClimateStates, setpoints: Setpoints)
Equation A21 [2] Args: states: setpoints: Returns: PAR from the lamps absorbed by the floor [W m^{-2}]
Equation A21 [2] Args: states: setpoints:
def floor_PAR_absorbed_from_lamp(states: ClimateStates, setpoints: Setpoints): """ Equation A21 [2] Args: states: setpoints: Returns: PAR from the lamps absorbed by the floor [W m^{-2}] """ radiation_flux_PARGh_Lamp = PAR_above_canopy_from_lamp(setpoints) return (1-Coeffici...
[ "def", "floor_PAR_absorbed_from_lamp", "(", "states", ":", "ClimateStates", ",", "setpoints", ":", "Setpoints", ")", ":", "radiation_flux_PARGh_Lamp", "=", "PAR_above_canopy_from_lamp", "(", "setpoints", ")", "return", "(", "1", "-", "Coefficients", ".", "Floor", "....
[ 283, 0 ]
[ 296, 38 ]
python
en
['en', 'error', 'th']
False
floor_NIR_absorbed_from_lamp
(states: ClimateStates, setpoints: Setpoints)
Equation A22 [5] Args: states: setpoints: Returns: NIR from the lamps absorbed by the floor [W m^{-2}]
Equation A22 [5] Args: states: setpoints:
def floor_NIR_absorbed_from_lamp(states: ClimateStates, setpoints: Setpoints): """ Equation A22 [5] Args: states: setpoints: Returns: NIR from the lamps absorbed by the floor [W m^{-2}] """ electrical_input_lamp = lamp_electrical_input(setpoints) return (1 - Coefficients.Flo...
[ "def", "floor_NIR_absorbed_from_lamp", "(", "states", ":", "ClimateStates", ",", "setpoints", ":", "Setpoints", ")", ":", "electrical_input_lamp", "=", "lamp_electrical_input", "(", "setpoints", ")", "return", "(", "1", "-", "Coefficients", ".", "Floor", ".", "flo...
[ 299, 0 ]
[ 311, 91 ]
python
en
['en', 'error', 'th']
False
net_far_infrared_radiation_fluxes
(A_i, ep_i, ep_j, F_ij, object_i_t, object_j_t)
The net far infrared radiation fluxes from surface ‘i’ to ‘j’ Equation 8.38 :param float A_i: the surface of object ‘i’ per square meter greenhouse soil :param float ep_i, ep_j : the thermal infrared emission coefficients for object ‘i’ and ‘j’ respectively :param float F_ij: the view factor from objec...
The net far infrared radiation fluxes from surface ‘i’ to ‘j’ Equation 8.38
def net_far_infrared_radiation_fluxes(A_i, ep_i, ep_j, F_ij, object_i_t, object_j_t) -> float: """The net far infrared radiation fluxes from surface ‘i’ to ‘j’ Equation 8.38 :param float A_i: the surface of object ‘i’ per square meter greenhouse soil :param float ep_i, ep_j : the thermal infrared emiss...
[ "def", "net_far_infrared_radiation_fluxes", "(", "A_i", ",", "ep_i", ",", "ep_j", ",", "F_ij", ",", "object_i_t", ",", "object_j_t", ")", "->", "float", ":", "return", "A_i", "*", "ep_i", "*", "ep_j", "*", "F_ij", "*", "BOLTZMANN", "*", "(", "(", "object...
[ 739, 0 ]
[ 749, 107 ]
python
en
['en', 'en', 'en']
True
Line.color
(self)
Sets the line color. The 'color' property is a color and may be specified as: - A hex string (e.g. '#ff0000') - An rgb/rgba string (e.g. 'rgb(255,0,0)') - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') - An hsv/hsva string (e.g. 'hsv(0,100%,100%)') - ...
Sets the line color. The 'color' property is a color and may be specified as: - A hex string (e.g. '#ff0000') - An rgb/rgba string (e.g. 'rgb(255,0,0)') - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') - An hsv/hsva string (e.g. 'hsv(0,100%,100%)') - ...
def color(self): """ Sets the line color. The 'color' property is a color and may be specified as: - A hex string (e.g. '#ff0000') - An rgb/rgba string (e.g. 'rgb(255,0,0)') - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') - An hsv/hsva string (e.g. 'hsv...
[ "def", "color", "(", "self", ")", ":", "return", "self", "[", "\"color\"", "]" ]
[ 15, 4 ]
[ 65, 28 ]
python
en
['en', 'error', 'th']
False
Line.dash
(self)
Sets the dash style of lines. Set to a dash type string ("solid", "dot", "dash", "longdash", "dashdot", or "longdashdot") or a dash length list in px (eg "5px,10px,2px,2px"). The 'dash' property is an enumeration that may be specified as: - One of the following da...
Sets the dash style of lines. Set to a dash type string ("solid", "dot", "dash", "longdash", "dashdot", or "longdashdot") or a dash length list in px (eg "5px,10px,2px,2px"). The 'dash' property is an enumeration that may be specified as: - One of the following da...
def dash(self): """ Sets the dash style of lines. Set to a dash type string ("solid", "dot", "dash", "longdash", "dashdot", or "longdashdot") or a dash length list in px (eg "5px,10px,2px,2px"). The 'dash' property is an enumeration that may be specified as: ...
[ "def", "dash", "(", "self", ")", ":", "return", "self", "[", "\"dash\"", "]" ]
[ 74, 4 ]
[ 91, 27 ]
python
en
['en', 'error', 'th']
False
Line.width
(self)
Sets the line width (in px). The 'width' property is a number and may be specified as: - An int or float in the interval [0, inf] Returns ------- int|float
Sets the line width (in px). The 'width' property is a number and may be specified as: - An int or float in the interval [0, inf]
def width(self): """ Sets the line width (in px). The 'width' property is a number and may be specified as: - An int or float in the interval [0, inf] Returns ------- int|float """ return self["width"]
[ "def", "width", "(", "self", ")", ":", "return", "self", "[", "\"width\"", "]" ]
[ 100, 4 ]
[ 111, 28 ]
python
en
['en', 'error', 'th']
False
Line.__init__
(self, arg=None, color=None, dash=None, width=None, **kwargs)
Construct a new Line object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.ohlc.decreasing.Line` color Sets the line color. dash ...
Construct a new Line object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.ohlc.decreasing.Line` color Sets the line color. dash ...
def __init__(self, arg=None, color=None, dash=None, width=None, **kwargs): """ Construct a new Line object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.ohlc.d...
[ "def", "__init__", "(", "self", ",", "arg", "=", "None", ",", "color", "=", "None", ",", "dash", "=", "None", ",", "width", "=", "None", ",", "*", "*", "kwargs", ")", ":", "super", "(", "Line", ",", "self", ")", ".", "__init__", "(", "\"line\"", ...
[ 133, 4 ]
[ 205, 34 ]
python
en
['en', 'error', 'th']
False
PublicKeyType.get
(val: str)
Find enum instance corresponding to input value (RsaVerificationKey2018 etc). Args: val: input value marking public key type Returns: the public key type
Find enum instance corresponding to input value (RsaVerificationKey2018 etc).
def get(val: str) -> "PublicKeyType": """ Find enum instance corresponding to input value (RsaVerificationKey2018 etc). Args: val: input value marking public key type Returns: the public key type """ for pktype in PublicKeyType: if val in (pkty...
[ "def", "get", "(", "val", ":", "str", ")", "->", "\"PublicKeyType\"", ":", "for", "pktype", "in", "PublicKeyType", ":", "if", "val", "in", "(", "pktype", ".", "ver_type", ",", "pktype", ".", "authn_type", ")", ":", "return", "pktype", "return", "None" ]
[ 47, 4 ]
[ 61, 19 ]
python
en
['en', 'error', 'th']
False