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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
ColorBar.ticklen | (self) |
Sets the tick length (in px).
The 'ticklen' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float
|
Sets the tick length (in px).
The 'ticklen' property is a number and may be specified as:
- An int or float in the interval [0, inf] | def ticklen(self):
"""
Sets the tick length (in px).
The 'ticklen' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float
"""
return self["ticklen"] | [
"def",
"ticklen",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"ticklen\"",
"]"
] | [
831,
4
] | [
842,
30
] | python | en | ['en', 'error', 'th'] | False |
ColorBar.tickmode | (self) |
Sets the tick mode for this axis. If "auto", the number of
ticks is set via `nticks`. If "linear", the placement of the
ticks is determined by a starting position `tick0` and a tick
step `dtick` ("linear" is the default value if `tick0` and
`dtick` are provided). If "array", the... |
Sets the tick mode for this axis. If "auto", the number of
ticks is set via `nticks`. If "linear", the placement of the
ticks is determined by a starting position `tick0` and a tick
step `dtick` ("linear" is the default value if `tick0` and
`dtick` are provided). If "array", the... | def tickmode(self):
"""
Sets the tick mode for this axis. If "auto", the number of
ticks is set via `nticks`. If "linear", the placement of the
ticks is determined by a starting position `tick0` and a tick
step `dtick` ("linear" is the default value if `tick0` and
`dtick`... | [
"def",
"tickmode",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"tickmode\"",
"]"
] | [
851,
4
] | [
869,
31
] | python | en | ['en', 'error', 'th'] | False |
ColorBar.tickprefix | (self) |
Sets a tick label prefix.
The 'tickprefix' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
|
Sets a tick label prefix.
The 'tickprefix' property is a string and must be specified as:
- A string
- A number that will be converted to a string | def tickprefix(self):
"""
Sets a tick label prefix.
The 'tickprefix' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
"""
return self["tickprefix"] | [
"def",
"tickprefix",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"tickprefix\"",
"]"
] | [
878,
4
] | [
890,
33
] | python | en | ['en', 'error', 'th'] | False |
ColorBar.ticks | (self) |
Determines whether ticks are drawn or not. If "", this axis'
ticks are not drawn. If "outside" ("inside"), this axis' are
drawn outside (inside) the axis lines.
The 'ticks' property is an enumeration that may be specified as:
- One of the following enumeration values:
... |
Determines whether ticks are drawn or not. If "", this axis'
ticks are not drawn. If "outside" ("inside"), this axis' are
drawn outside (inside) the axis lines.
The 'ticks' property is an enumeration that may be specified as:
- One of the following enumeration values:
... | def ticks(self):
"""
Determines whether ticks are drawn or not. If "", this axis'
ticks are not drawn. If "outside" ("inside"), this axis' are
drawn outside (inside) the axis lines.
The 'ticks' property is an enumeration that may be specified as:
- One of the follo... | [
"def",
"ticks",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"ticks\"",
"]"
] | [
899,
4
] | [
913,
28
] | python | en | ['en', 'error', 'th'] | False |
ColorBar.ticksuffix | (self) |
Sets a tick label suffix.
The 'ticksuffix' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
|
Sets a tick label suffix.
The 'ticksuffix' property is a string and must be specified as:
- A string
- A number that will be converted to a string | def ticksuffix(self):
"""
Sets a tick label suffix.
The 'ticksuffix' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
"""
return self["ticksuffix"] | [
"def",
"ticksuffix",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"ticksuffix\"",
"]"
] | [
922,
4
] | [
934,
33
] | python | en | ['en', 'error', 'th'] | False |
ColorBar.ticktext | (self) |
Sets the text displayed at the ticks position via `tickvals`.
Only has an effect if `tickmode` is set to "array". Used with
`tickvals`.
The 'ticktext' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------... |
Sets the text displayed at the ticks position via `tickvals`.
Only has an effect if `tickmode` is set to "array". Used with
`tickvals`.
The 'ticktext' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series | def ticktext(self):
"""
Sets the text displayed at the ticks position via `tickvals`.
Only has an effect if `tickmode` is set to "array". Used with
`tickvals`.
The 'ticktext' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
... | [
"def",
"ticktext",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"ticktext\"",
"]"
] | [
943,
4
] | [
956,
31
] | python | en | ['en', 'error', 'th'] | False |
ColorBar.ticktextsrc | (self) |
Sets the source reference on Chart Studio Cloud for ticktext .
The 'ticktextsrc' 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 ticktext .
The 'ticktextsrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def ticktextsrc(self):
"""
Sets the source reference on Chart Studio Cloud for ticktext .
The 'ticktextsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["ticktextsrc"] | [
"def",
"ticktextsrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"ticktextsrc\"",
"]"
] | [
965,
4
] | [
976,
34
] | python | en | ['en', 'error', 'th'] | False |
ColorBar.tickvals | (self) |
Sets the values at which ticks on this axis appear. Only has an
effect if `tickmode` is set to "array". Used with `ticktext`.
The 'tickvals' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.nda... |
Sets the values at which ticks on this axis appear. Only has an
effect if `tickmode` is set to "array". Used with `ticktext`.
The 'tickvals' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series | def tickvals(self):
"""
Sets the values at which ticks on this axis appear. Only has an
effect if `tickmode` is set to "array". Used with `ticktext`.
The 'tickvals' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
... | [
"def",
"tickvals",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"tickvals\"",
"]"
] | [
985,
4
] | [
997,
31
] | python | en | ['en', 'error', 'th'] | False |
ColorBar.tickvalssrc | (self) |
Sets the source reference on Chart Studio Cloud for tickvals .
The 'tickvalssrc' 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 tickvals .
The 'tickvalssrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def tickvalssrc(self):
"""
Sets the source reference on Chart Studio Cloud for tickvals .
The 'tickvalssrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["tickvalssrc"] | [
"def",
"tickvalssrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"tickvalssrc\"",
"]"
] | [
1006,
4
] | [
1017,
34
] | python | en | ['en', 'error', 'th'] | False |
ColorBar.tickwidth | (self) |
Sets the tick width (in px).
The 'tickwidth' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float
|
Sets the tick width (in px).
The 'tickwidth' property is a number and may be specified as:
- An int or float in the interval [0, inf] | def tickwidth(self):
"""
Sets the tick width (in px).
The 'tickwidth' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float
"""
return self["tickwidth"] | [
"def",
"tickwidth",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"tickwidth\"",
"]"
] | [
1026,
4
] | [
1037,
32
] | python | en | ['en', 'error', 'th'] | False |
ColorBar.title | (self) |
The 'title' property is an instance of Title
that may be specified as:
- An instance of :class:`plotly.graph_objs.splom.marker.colorbar.Title`
- A dict of string/value properties that will be passed
to the Title constructor
Supported dict properties:
... |
The 'title' property is an instance of Title
that may be specified as:
- An instance of :class:`plotly.graph_objs.splom.marker.colorbar.Title`
- A dict of string/value properties that will be passed
to the Title constructor
Supported dict properties:
... | def title(self):
"""
The 'title' property is an instance of Title
that may be specified as:
- An instance of :class:`plotly.graph_objs.splom.marker.colorbar.Title`
- A dict of string/value properties that will be passed
to the Title constructor
Su... | [
"def",
"title",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"title\"",
"]"
] | [
1046,
4
] | [
1076,
28
] | python | en | ['en', 'error', 'th'] | False |
ColorBar.titlefont | (self) |
Deprecated: Please use splom.marker.colorbar.title.font
instead. Sets this color bar's title font. Note that the
title's font used to be set by the now deprecated `titlefont`
attribute.
The 'font' property is an instance of Font
that may be specified as:
-... |
Deprecated: Please use splom.marker.colorbar.title.font
instead. Sets this color bar's title font. Note that the
title's font used to be set by the now deprecated `titlefont`
attribute.
The 'font' property is an instance of Font
that may be specified as:
-... | def titlefont(self):
"""
Deprecated: Please use splom.marker.colorbar.title.font
instead. Sets this color bar's title font. Note that the
title's font used to be set by the now deprecated `titlefont`
attribute.
The 'font' property is an instance of Font
that ... | [
"def",
"titlefont",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"titlefont\"",
"]"
] | [
1085,
4
] | [
1125,
32
] | python | en | ['en', 'error', 'th'] | False |
ColorBar.titleside | (self) |
Deprecated: Please use splom.marker.colorbar.title.side
instead. Determines the location of color bar's title with
respect to the color bar. Note that the title's location used
to be set by the now deprecated `titleside` attribute.
The 'side' property is an enumeration that... |
Deprecated: Please use splom.marker.colorbar.title.side
instead. Determines the location of color bar's title with
respect to the color bar. Note that the title's location used
to be set by the now deprecated `titleside` attribute.
The 'side' property is an enumeration that... | def titleside(self):
"""
Deprecated: Please use splom.marker.colorbar.title.side
instead. Determines the location of color bar's title with
respect to the color bar. Note that the title's location used
to be set by the now deprecated `titleside` attribute.
The 'side'... | [
"def",
"titleside",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"titleside\"",
"]"
] | [
1134,
4
] | [
1149,
32
] | python | en | ['en', 'error', 'th'] | False |
ColorBar.x | (self) |
Sets the x position of the color bar (in plot fraction).
The 'x' property is a number and may be specified as:
- An int or float in the interval [-2, 3]
Returns
-------
int|float
|
Sets the x position of the color bar (in plot fraction).
The 'x' property is a number and may be specified as:
- An int or float in the interval [-2, 3] | def x(self):
"""
Sets the x position of the color bar (in plot fraction).
The 'x' property is a number and may be specified as:
- An int or float in the interval [-2, 3]
Returns
-------
int|float
"""
return self["x"] | [
"def",
"x",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"x\"",
"]"
] | [
1158,
4
] | [
1169,
24
] | python | en | ['en', 'error', 'th'] | False |
ColorBar.xanchor | (self) |
Sets this color bar's horizontal position anchor. This anchor
binds the `x` position to the "left", "center" or "right" of
the color bar.
The 'xanchor' property is an enumeration that may be specified as:
- One of the following enumeration values:
['left',... |
Sets this color bar's horizontal position anchor. This anchor
binds the `x` position to the "left", "center" or "right" of
the color bar.
The 'xanchor' property is an enumeration that may be specified as:
- One of the following enumeration values:
['left',... | def xanchor(self):
"""
Sets this color bar's horizontal position anchor. This anchor
binds the `x` position to the "left", "center" or "right" of
the color bar.
The 'xanchor' property is an enumeration that may be specified as:
- One of the following enumeration va... | [
"def",
"xanchor",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"xanchor\"",
"]"
] | [
1178,
4
] | [
1192,
30
] | python | en | ['en', 'error', 'th'] | False |
ColorBar.xpad | (self) |
Sets the amount of padding (in px) along the x direction.
The 'xpad' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float
|
Sets the amount of padding (in px) along the x direction.
The 'xpad' property is a number and may be specified as:
- An int or float in the interval [0, inf] | def xpad(self):
"""
Sets the amount of padding (in px) along the x direction.
The 'xpad' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float
"""
return self["xpad"] | [
"def",
"xpad",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"xpad\"",
"]"
] | [
1201,
4
] | [
1212,
27
] | python | en | ['en', 'error', 'th'] | False |
ColorBar.y | (self) |
Sets the y position of the color bar (in plot fraction).
The 'y' property is a number and may be specified as:
- An int or float in the interval [-2, 3]
Returns
-------
int|float
|
Sets the y position of the color bar (in plot fraction).
The 'y' property is a number and may be specified as:
- An int or float in the interval [-2, 3] | def y(self):
"""
Sets the y position of the color bar (in plot fraction).
The 'y' property is a number and may be specified as:
- An int or float in the interval [-2, 3]
Returns
-------
int|float
"""
return self["y"] | [
"def",
"y",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"y\"",
"]"
] | [
1221,
4
] | [
1232,
24
] | python | en | ['en', 'error', 'th'] | False |
ColorBar.yanchor | (self) |
Sets this color bar's vertical position anchor This anchor
binds the `y` position to the "top", "middle" or "bottom" of
the color bar.
The 'yanchor' property is an enumeration that may be specified as:
- One of the following enumeration values:
['top', 'mi... |
Sets this color bar's vertical position anchor This anchor
binds the `y` position to the "top", "middle" or "bottom" of
the color bar.
The 'yanchor' property is an enumeration that may be specified as:
- One of the following enumeration values:
['top', 'mi... | def yanchor(self):
"""
Sets this color bar's vertical position anchor This anchor
binds the `y` position to the "top", "middle" or "bottom" of
the color bar.
The 'yanchor' property is an enumeration that may be specified as:
- One of the following enumeration value... | [
"def",
"yanchor",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"yanchor\"",
"]"
] | [
1241,
4
] | [
1255,
30
] | python | en | ['en', 'error', 'th'] | False |
ColorBar.ypad | (self) |
Sets the amount of padding (in px) along the y direction.
The 'ypad' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float
|
Sets the amount of padding (in px) along the y direction.
The 'ypad' property is a number and may be specified as:
- An int or float in the interval [0, inf] | def ypad(self):
"""
Sets the amount of padding (in px) along the y direction.
The 'ypad' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float
"""
return self["ypad"] | [
"def",
"ypad",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"ypad\"",
"]"
] | [
1264,
4
] | [
1275,
27
] | python | en | ['en', 'error', 'th'] | False |
ColorBar.__init__ | (
self,
arg=None,
bgcolor=None,
bordercolor=None,
borderwidth=None,
dtick=None,
exponentformat=None,
len=None,
lenmode=None,
nticks=None,
outlinecolor=None,
outlinewidth=None,
separatethousands=None,
showexpo... |
Construct a new ColorBar object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.splom.marker.ColorBar`
bgcolor
Sets the color of padded area.
... |
Construct a new ColorBar object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.splom.marker.ColorBar`
bgcolor
Sets the color of padded area.
... | def __init__(
self,
arg=None,
bgcolor=None,
bordercolor=None,
borderwidth=None,
dtick=None,
exponentformat=None,
len=None,
lenmode=None,
nticks=None,
outlinecolor=None,
outlinewidth=None,
separatethousands=None,
... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"bgcolor",
"=",
"None",
",",
"bordercolor",
"=",
"None",
",",
"borderwidth",
"=",
"None",
",",
"dtick",
"=",
"None",
",",
"exponentformat",
"=",
"None",
",",
"len",
"=",
"None",
",",
"lenm... | [
1482,
4
] | [
1941,
34
] | python | en | ['en', 'error', 'th'] | False |
scale_boxes | (bboxes, scale) | Expand an array of boxes by a given scale.
Args:
bboxes (Tensor): Shape (m, 4)
scale (float): The scale factor of bboxes
Returns:
(Tensor): Shape (m, 4). Scaled bboxes
| Expand an array of boxes by a given scale. | def scale_boxes(bboxes, scale):
"""Expand an array of boxes by a given scale.
Args:
bboxes (Tensor): Shape (m, 4)
scale (float): The scale factor of bboxes
Returns:
(Tensor): Shape (m, 4). Scaled bboxes
"""
assert bboxes.size(1) == 4
w_half = (bboxes[:, 2] - bboxes[:, 0... | [
"def",
"scale_boxes",
"(",
"bboxes",
",",
"scale",
")",
":",
"assert",
"bboxes",
".",
"size",
"(",
"1",
")",
"==",
"4",
"w_half",
"=",
"(",
"bboxes",
"[",
":",
",",
"2",
"]",
"-",
"bboxes",
"[",
":",
",",
"0",
"]",
")",
"*",
".5",
"h_half",
"... | [
8,
0
] | [
32,
23
] | python | en | ['en', 'en', 'en'] | True |
is_located_in | (points, bboxes) | Are points located in bboxes.
Args:
points (Tensor): Points, shape: (m, 2).
bboxes (Tensor): Bounding boxes, shape: (n, 4).
Return:
Tensor: Flags indicating if points are located in bboxes, shape: (m, n).
| Are points located in bboxes. | def is_located_in(points, bboxes):
"""Are points located in bboxes.
Args:
points (Tensor): Points, shape: (m, 2).
bboxes (Tensor): Bounding boxes, shape: (n, 4).
Return:
Tensor: Flags indicating if points are located in bboxes, shape: (m, n).
"""
assert points.size(1) == 2
as... | [
"def",
"is_located_in",
"(",
"points",
",",
"bboxes",
")",
":",
"assert",
"points",
".",
"size",
"(",
"1",
")",
"==",
"2",
"assert",
"bboxes",
".",
"size",
"(",
"1",
")",
"==",
"4",
"return",
"(",
"points",
"[",
":",
",",
"0",
"]",
".",
"unsqueez... | [
35,
0
] | [
50,
66
] | python | en | ['en', 'en', 'en'] | True |
bboxes_area | (bboxes) | Compute the area of an array of bboxes.
Args:
bboxes (Tensor): The coordinates ox bboxes. Shape: (m, 4)
Returns:
Tensor: Area of the bboxes. Shape: (m, )
| Compute the area of an array of bboxes. | def bboxes_area(bboxes):
"""Compute the area of an array of bboxes.
Args:
bboxes (Tensor): The coordinates ox bboxes. Shape: (m, 4)
Returns:
Tensor: Area of the bboxes. Shape: (m, )
"""
assert bboxes.size(1) == 4
w = (bboxes[:, 2] - bboxes[:, 0])
h = (bboxes[:, 3] - bboxes[... | [
"def",
"bboxes_area",
"(",
"bboxes",
")",
":",
"assert",
"bboxes",
".",
"size",
"(",
"1",
")",
"==",
"4",
"w",
"=",
"(",
"bboxes",
"[",
":",
",",
"2",
"]",
"-",
"bboxes",
"[",
":",
",",
"0",
"]",
")",
"h",
"=",
"(",
"bboxes",
"[",
":",
",",... | [
53,
0
] | [
66,
16
] | python | en | ['en', 'en', 'en'] | True |
points_to_voxel | (points,
voxel_size,
coors_range,
max_points=35,
reverse_index=True,
max_voxels=20000) | convert kitti points(N, >=3) to voxels.
Args:
points (np.ndarray): [N, ndim]. points[:, :3] contain xyz points and \
points[:, 3:] contain other information such as reflectivity.
voxel_size (list, tuple, np.ndarray): [3] xyz, indicate voxel size
coors_range (list[float | tuple[f... | convert kitti points(N, >=3) to voxels. | def points_to_voxel(points,
voxel_size,
coors_range,
max_points=35,
reverse_index=True,
max_voxels=20000):
"""convert kitti points(N, >=3) to voxels.
Args:
points (np.ndarray): [N, ndim]. points[:, :3] c... | [
"def",
"points_to_voxel",
"(",
"points",
",",
"voxel_size",
",",
"coors_range",
",",
"max_points",
"=",
"35",
",",
"reverse_index",
"=",
"True",
",",
"max_voxels",
"=",
"20000",
")",
":",
"if",
"not",
"isinstance",
"(",
"voxel_size",
",",
"np",
".",
"ndarr... | [
74,
0
] | [
132,
46
] | python | en | ['it', 'en', 'hi'] | False |
_points_to_voxel_reverse_kernel | (points,
voxel_size,
coors_range,
num_points_per_voxel,
coor_to_voxelidx,
voxels,
coors,
... | convert kitti points(N, >=3) to voxels.
Args:
points (np.ndarray): [N, ndim]. points[:, :3] contain xyz points and \
points[:, 3:] contain other information such as reflectivity.
voxel_size (list, tuple, np.ndarray): [3] xyz, indicate voxel size \
coors_range (list[float | tuple... | convert kitti points(N, >=3) to voxels. | def _points_to_voxel_reverse_kernel(points,
voxel_size,
coors_range,
num_points_per_voxel,
coor_to_voxelidx,
voxels,
... | [
"def",
"_points_to_voxel_reverse_kernel",
"(",
"points",
",",
"voxel_size",
",",
"coors_range",
",",
"num_points_per_voxel",
",",
"coor_to_voxelidx",
",",
"voxels",
",",
"coors",
",",
"max_points",
"=",
"35",
",",
"max_voxels",
"=",
"20000",
")",
":",
"# put all c... | [
136,
0
] | [
206,
20
] | python | en | ['it', 'en', 'hi'] | False |
_points_to_voxel_kernel | (points,
voxel_size,
coors_range,
num_points_per_voxel,
coor_to_voxelidx,
voxels,
coors,
max_points=35,
... | convert kitti points(N, >=3) to voxels.
Args:
points (np.ndarray): [N, ndim]. points[:, :3] contain xyz points and \
points[:, 3:] contain other information such as reflectivity.
voxel_size (list, tuple, np.ndarray): [3] xyz, indicate voxel size.
coors_range (list[float | tuple[... | convert kitti points(N, >=3) to voxels. | def _points_to_voxel_kernel(points,
voxel_size,
coors_range,
num_points_per_voxel,
coor_to_voxelidx,
voxels,
coors,
max_poin... | [
"def",
"_points_to_voxel_kernel",
"(",
"points",
",",
"voxel_size",
",",
"coors_range",
",",
"num_points_per_voxel",
",",
"coor_to_voxelidx",
",",
"voxels",
",",
"coors",
",",
"max_points",
"=",
"35",
",",
"max_voxels",
"=",
"20000",
")",
":",
"N",
"=",
"point... | [
210,
0
] | [
278,
20
] | python | en | ['it', 'en', 'hi'] | False |
VoxelGenerator.generate | (self, points) | Generate voxels given points. | Generate voxels given points. | def generate(self, points):
"""Generate voxels given points."""
return points_to_voxel(points, self._voxel_size,
self._point_cloud_range, self._max_num_points,
True, self._max_voxels) | [
"def",
"generate",
"(",
"self",
",",
"points",
")",
":",
"return",
"points_to_voxel",
"(",
"points",
",",
"self",
".",
"_voxel_size",
",",
"self",
".",
"_point_cloud_range",
",",
"self",
".",
"_max_num_points",
",",
"True",
",",
"self",
".",
"_max_voxels",
... | [
34,
4
] | [
38,
54
] | python | en | ['en', 'en', 'en'] | True |
VoxelGenerator.voxel_size | (self) | list[float]: Size of a single voxel. | list[float]: Size of a single voxel. | def voxel_size(self):
"""list[float]: Size of a single voxel."""
return self._voxel_size | [
"def",
"voxel_size",
"(",
"self",
")",
":",
"return",
"self",
".",
"_voxel_size"
] | [
41,
4
] | [
43,
31
] | python | en | ['en', 'en', 'en'] | True |
VoxelGenerator.max_num_points_per_voxel | (self) | int: Maximum number of points per voxel. | int: Maximum number of points per voxel. | def max_num_points_per_voxel(self):
"""int: Maximum number of points per voxel."""
return self._max_num_points | [
"def",
"max_num_points_per_voxel",
"(",
"self",
")",
":",
"return",
"self",
".",
"_max_num_points"
] | [
46,
4
] | [
48,
35
] | python | en | ['en', 'la', 'it'] | False |
VoxelGenerator.point_cloud_range | (self) | list[float]: Range of point cloud. | list[float]: Range of point cloud. | def point_cloud_range(self):
"""list[float]: Range of point cloud."""
return self._point_cloud_range | [
"def",
"point_cloud_range",
"(",
"self",
")",
":",
"return",
"self",
".",
"_point_cloud_range"
] | [
51,
4
] | [
53,
38
] | python | en | ['en', 'fr', 'en'] | True |
VoxelGenerator.grid_size | (self) | np.ndarray: The size of grids. | np.ndarray: The size of grids. | def grid_size(self):
"""np.ndarray: The size of grids."""
return self._grid_size | [
"def",
"grid_size",
"(",
"self",
")",
":",
"return",
"self",
".",
"_grid_size"
] | [
56,
4
] | [
58,
30
] | python | en | ['en', 'en', 'en'] | True |
VoxelGenerator.__repr__ | (self) | str: Return a string that describes the module. | str: Return a string that describes the module. | def __repr__(self):
"""str: Return a string that describes the module."""
repr_str = self.__class__.__name__
indent = ' ' * (len(repr_str) + 1)
repr_str += f'(voxel_size={self._voxel_size},\n'
repr_str += indent + 'point_cloud_range='
repr_str += f'{self._point_cloud_rang... | [
"def",
"__repr__",
"(",
"self",
")",
":",
"repr_str",
"=",
"self",
".",
"__class__",
".",
"__name__",
"indent",
"=",
"' '",
"*",
"(",
"len",
"(",
"repr_str",
")",
"+",
"1",
")",
"repr_str",
"+=",
"f'(voxel_size={self._voxel_size},\\n'",
"repr_str",
"+=",
"... | [
60,
4
] | [
71,
23
] | python | en | ['en', 'gd', 'en'] | True |
Tickfont.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
] | [
63,
28
] | python | en | ['en', 'error', 'th'] | False |
Tickfont.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\"",
"]"
] | [
72,
4
] | [
94,
29
] | python | en | ['en', 'error', 'th'] | False |
Tickfont.size | (self) |
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf]
Returns
-------
int|float
|
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf] | def size(self):
"""
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf]
Returns
-------
int|float
"""
return self["size"] | [
"def",
"size",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"size\"",
"]"
] | [
103,
4
] | [
112,
27
] | python | en | ['en', 'error', 'th'] | False |
Tickfont.__init__ | (self, arg=None, color=None, family=None, size=None, **kwargs) |
Construct a new Tickfont object
Sets the color bar's tick label font
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.funnel.marker.
colorbar.Tickfont`
... |
Construct a new Tickfont object
Sets the color bar's tick label font | def __init__(self, arg=None, color=None, family=None, size=None, **kwargs):
"""
Construct a new Tickfont object
Sets the color bar's tick label font
Parameters
----------
arg
dict of properties compatible with this constructor or
an insta... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"color",
"=",
"None",
",",
"family",
"=",
"None",
",",
"size",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Tickfont",
",",
"self",
")",
".",
"__init__",
"(",
"\"tick... | [
143,
4
] | [
226,
34
] | python | en | ['en', 'error', 'th'] | False |
CredentialStored.__init__ | (self, **kwargs) | Initialize credential object. | Initialize credential object. | def __init__(self, **kwargs):
"""Initialize credential object."""
super(CredentialStored, self).__init__(**kwargs) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"CredentialStored",
",",
"self",
")",
".",
"__init__",
"(",
"*",
"*",
"kwargs",
")"
] | [
21,
4
] | [
23,
56
] | python | en | ['en', 'en', 'en'] | True |
Stream.__init__ | (
self,
server,
port=80,
headers={},
url="/",
ssl_enabled=False,
ssl_verification_enabled=True,
) | Initialize a stream object and an HTTP or HTTPS connection
with chunked Transfer-Encoding to server:port with optional headers.
| Initialize a stream object and an HTTP or HTTPS connection
with chunked Transfer-Encoding to server:port with optional headers.
| def __init__(
self,
server,
port=80,
headers={},
url="/",
ssl_enabled=False,
ssl_verification_enabled=True,
):
""" Initialize a stream object and an HTTP or HTTPS connection
with chunked Transfer-Encoding to server:port with optional headers.
... | [
"def",
"__init__",
"(",
"self",
",",
"server",
",",
"port",
"=",
"80",
",",
"headers",
"=",
"{",
"}",
",",
"url",
"=",
"\"/\"",
",",
"ssl_enabled",
"=",
"False",
",",
"ssl_verification_enabled",
"=",
"True",
",",
")",
":",
"self",
".",
"maxtries",
"=... | [
12,
4
] | [
34,
23
] | python | en | ['en', 'en', 'en'] | True |
Stream.write | (self, data, reconnect_on=("", 200, 502)) | Send `data` to the server in chunk-encoded form.
Check the connection before writing and reconnect
if disconnected and if the response status code is in `reconnect_on`.
The response may either be an HTTPResponse object or an empty string.
| Send `data` to the server in chunk-encoded form.
Check the connection before writing and reconnect
if disconnected and if the response status code is in `reconnect_on`. | def write(self, data, reconnect_on=("", 200, 502)):
""" Send `data` to the server in chunk-encoded form.
Check the connection before writing and reconnect
if disconnected and if the response status code is in `reconnect_on`.
The response may either be an HTTPResponse object or an empty ... | [
"def",
"write",
"(",
"self",
",",
"data",
",",
"reconnect_on",
"=",
"(",
"\"\"",
",",
"200",
",",
"502",
")",
")",
":",
"if",
"not",
"self",
".",
"_isconnected",
"(",
")",
":",
"# Attempt to get the response.",
"response",
"=",
"self",
".",
"_getresponse... | [
36,
4
] | [
89,
28
] | python | en | ['en', 'en', 'en'] | True |
Stream._get_proxy_config | (self) |
Determine if self._url should be passed through a proxy. If so, return
the appropriate proxy_server and proxy_port. Assumes https_proxy is used
when ssl_enabled=True.
|
Determine if self._url should be passed through a proxy. If so, return
the appropriate proxy_server and proxy_port. Assumes https_proxy is used
when ssl_enabled=True. | def _get_proxy_config(self):
"""
Determine if self._url should be passed through a proxy. If so, return
the appropriate proxy_server and proxy_port. Assumes https_proxy is used
when ssl_enabled=True.
"""
proxy_server = None
proxy_port = None
proxy_userna... | [
"def",
"_get_proxy_config",
"(",
"self",
")",
":",
"proxy_server",
"=",
"None",
"proxy_port",
"=",
"None",
"proxy_username",
"=",
"None",
"proxy_password",
"=",
"None",
"proxy_auth",
"=",
"None",
"ssl_enabled",
"=",
"self",
".",
"_ssl_enabled",
"if",
"ssl_enable... | [
91,
4
] | [
126,
51
] | python | en | ['en', 'error', 'th'] | False |
Stream._get_ssl_context | (self) |
Return an unverified context if ssl verification is disabled.
|
Return an unverified context if ssl verification is disabled. | def _get_ssl_context(self):
"""
Return an unverified context if ssl verification is disabled.
"""
context = None
if not self._ssl_verification_enabled:
context = ssl._create_unverified_context()
return context | [
"def",
"_get_ssl_context",
"(",
"self",
")",
":",
"context",
"=",
"None",
"if",
"not",
"self",
".",
"_ssl_verification_enabled",
":",
"context",
"=",
"ssl",
".",
"_create_unverified_context",
"(",
")",
"return",
"context"
] | [
128,
4
] | [
139,
22
] | python | en | ['en', 'error', 'th'] | False |
Stream._connect | (self) | Initialize an HTTP/HTTPS connection with chunked Transfer-Encoding
to server:port with optional headers.
| Initialize an HTTP/HTTPS connection with chunked Transfer-Encoding
to server:port with optional headers.
| def _connect(self):
""" Initialize an HTTP/HTTPS connection with chunked Transfer-Encoding
to server:port with optional headers.
"""
server = self._server
port = self._port
headers = self._headers
ssl_enabled = self._ssl_enabled
proxy_server, proxy_port, p... | [
"def",
"_connect",
"(",
"self",
")",
":",
"server",
"=",
"self",
".",
"_server",
"port",
"=",
"self",
".",
"_port",
"headers",
"=",
"self",
".",
"_headers",
"ssl_enabled",
"=",
"self",
".",
"_ssl_enabled",
"proxy_server",
",",
"proxy_port",
",",
"proxy_aut... | [
141,
4
] | [
183,
23
] | python | en | ['en', 'en', 'en'] | True |
Stream.close | (self) | Close the connection to server.
If available, return a http_client.HTTPResponse object.
Closing the connection involves sending the
Transfer-Encoding terminating bytes.
| Close the connection to server. | def close(self):
""" Close the connection to server.
If available, return a http_client.HTTPResponse object.
Closing the connection involves sending the
Transfer-Encoding terminating bytes.
"""
self._reset_retries()
self._closed = True
# Chunked-encoded... | [
"def",
"close",
"(",
"self",
")",
":",
"self",
".",
"_reset_retries",
"(",
")",
"self",
".",
"_closed",
"=",
"True",
"# Chunked-encoded posts are terminated with '0\\r\\n\\r\\n'",
"# For some reason, either Python or node.js seems to",
"# require an extra \\r\\n.",
"try",
":"... | [
185,
4
] | [
205,
34
] | python | en | ['en', 'en', 'en'] | True |
Stream._getresponse | (self) | Read from recv and return a HTTPResponse object if possible.
Either
1 - The client has succesfully closed the connection: Return ''
2 - The server has already closed the connection: Return the response
if possible.
| Read from recv and return a HTTPResponse object if possible.
Either
1 - The client has succesfully closed the connection: Return ''
2 - The server has already closed the connection: Return the response
if possible.
| def _getresponse(self):
""" Read from recv and return a HTTPResponse object if possible.
Either
1 - The client has succesfully closed the connection: Return ''
2 - The server has already closed the connection: Return the response
if possible.
"""
# Wait for a ... | [
"def",
"_getresponse",
"(",
"self",
")",
":",
"# Wait for a response",
"self",
".",
"_conn",
".",
"sock",
".",
"setblocking",
"(",
"True",
")",
"# Parse the response",
"response",
"=",
"self",
".",
"_bytes",
"while",
"True",
":",
"try",
":",
"_bytes",
"=",
... | [
207,
4
] | [
243,
23
] | python | en | ['en', 'en', 'en'] | True |
Stream._isconnected | (self) | Return True if the socket is still connected
to the server, False otherwise.
This check is done in 3 steps:
1 - Check if we have closed the connection
2 - Check if the original socket connection failed
3 - Check if the server has returned any data. If they have,
ass... | Return True if the socket is still connected
to the server, False otherwise. | def _isconnected(self):
""" Return True if the socket is still connected
to the server, False otherwise.
This check is done in 3 steps:
1 - Check if we have closed the connection
2 - Check if the original socket connection failed
3 - Check if the server has returned any ... | [
"def",
"_isconnected",
"(",
"self",
")",
":",
"# 1 - check if we've closed the connection.",
"if",
"self",
".",
"_closed",
":",
"return",
"False",
"# 2 - Check if the original socket connection failed",
"# If this failed, then no socket was initialized",
"if",
"self",
".",
"_co... | [
245,
4
] | [
313,
23
] | python | en | ['en', 'en', 'en'] | True |
Stream._reconnect | (self) | Connect if disconnected.
Retry self.maxtries times with delays
| Connect if disconnected.
Retry self.maxtries times with delays
| def _reconnect(self):
""" Connect if disconnected.
Retry self.maxtries times with delays
"""
if not self._isconnected():
try:
self._connect()
except http_client.socket.error as e:
# Attempt to reconnect if the connection was refused... | [
"def",
"_reconnect",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_isconnected",
"(",
")",
":",
"try",
":",
"self",
".",
"_connect",
"(",
")",
"except",
"http_client",
".",
"socket",
".",
"error",
"as",
"e",
":",
"# Attempt to reconnect if the connect... | [
315,
4
] | [
339,
28
] | python | en | ['de', 'en', 'en'] | True |
Stream._reset_retries | (self) | Reset the connect counters and delays
| Reset the connect counters and delays
| def _reset_retries(self):
""" Reset the connect counters and delays
"""
self._tries = 0
self._delay = 1 | [
"def",
"_reset_retries",
"(",
"self",
")",
":",
"self",
".",
"_tries",
"=",
"0",
"self",
".",
"_delay",
"=",
"1"
] | [
341,
4
] | [
345,
23
] | python | en | ['en', 'en', '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
] | [
63,
28
] | 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\"",
"]"
] | [
72,
4
] | [
94,
29
] | 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]
Returns
-------
int|float
|
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf] | def size(self):
"""
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf]
Returns
-------
int|float
"""
return self["size"] | [
"def",
"size",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"size\"",
"]"
] | [
103,
4
] | [
112,
27
] | python | en | ['en', 'error', 'th'] | False |
Textfont.__init__ | (self, arg=None, color=None, family=None, size=None, **kwargs) |
Construct a new Textfont object
Sets the icon text font (color=mapbox.layer.paint.text-color,
size=mapbox.layer.layout.text-size). Has an effect only when
`type` is set to "symbol".
Parameters
----------
arg
dict of properties compatible wit... |
Construct a new Textfont object
Sets the icon text font (color=mapbox.layer.paint.text-color,
size=mapbox.layer.layout.text-size). Has an effect only when
`type` is set to "symbol". | def __init__(self, arg=None, color=None, family=None, size=None, **kwargs):
"""
Construct a new Textfont object
Sets the icon text font (color=mapbox.layer.paint.text-color,
size=mapbox.layer.layout.text-size). Has an effect only when
`type` is set to "symbol".
... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"color",
"=",
"None",
",",
"family",
"=",
"None",
",",
"size",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Textfont",
",",
"self",
")",
".",
"__init__",
"(",
"\"text... | [
143,
4
] | [
228,
34
] | 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 |
BaseBBoxCoder.encode | (self, bboxes, gt_bboxes) | Encode deltas between bboxes and ground truth boxes. | Encode deltas between bboxes and ground truth boxes. | def encode(self, bboxes, gt_bboxes):
"""Encode deltas between bboxes and ground truth boxes."""
pass | [
"def",
"encode",
"(",
"self",
",",
"bboxes",
",",
"gt_bboxes",
")",
":",
"pass"
] | [
10,
4
] | [
12,
12
] | python | en | ['en', 'en', 'en'] | True |
BaseBBoxCoder.decode | (self, bboxes, bboxes_pred) | Decode the predicted bboxes according to prediction and base
boxes. | Decode the predicted bboxes according to prediction and base
boxes. | def decode(self, bboxes, bboxes_pred):
"""Decode the predicted bboxes according to prediction and base
boxes."""
pass | [
"def",
"decode",
"(",
"self",
",",
"bboxes",
",",
"bboxes_pred",
")",
":",
"pass"
] | [
15,
4
] | [
18,
12
] | python | en | ['en', 'en', 'en'] | True |
scatter_nd | (indices, updates, shape) | pytorch edition of tensorflow scatter_nd.
this function don't contain except handle code. so use this carefully when
indice repeats, don't support repeat add which is supported in tensorflow.
| pytorch edition of tensorflow scatter_nd. | def scatter_nd(indices, updates, shape):
"""pytorch edition of tensorflow scatter_nd.
this function don't contain except handle code. so use this carefully when
indice repeats, don't support repeat add which is supported in tensorflow.
"""
ret = torch.zeros(*shape, dtype=updates.dtype, device=updat... | [
"def",
"scatter_nd",
"(",
"indices",
",",
"updates",
",",
"shape",
")",
":",
"ret",
"=",
"torch",
".",
"zeros",
"(",
"*",
"shape",
",",
"dtype",
"=",
"updates",
".",
"dtype",
",",
"device",
"=",
"updates",
".",
"device",
")",
"ndim",
"=",
"indices",
... | [
4,
0
] | [
17,
14
] | python | en | ['en', 'en', 'en'] | True |
SparseConvTensor.__init__ | (self,
features,
indices,
spatial_shape,
batch_size,
grid=None) |
Args:
grid: pre-allocated grid tensor.
should be used when the volume of spatial shape
is very large.
|
Args:
grid: pre-allocated grid tensor.
should be used when the volume of spatial shape
is very large.
| def __init__(self,
features,
indices,
spatial_shape,
batch_size,
grid=None):
"""
Args:
grid: pre-allocated grid tensor.
should be used when the volume of spatial shape
is ... | [
"def",
"__init__",
"(",
"self",
",",
"features",
",",
"indices",
",",
"spatial_shape",
",",
"batch_size",
",",
"grid",
"=",
"None",
")",
":",
"self",
".",
"features",
"=",
"features",
"self",
".",
"indices",
"=",
"indices",
"if",
"self",
".",
"indices",
... | [
22,
4
] | [
41,
24
] | python | en | ['en', 'error', 'th'] | False |
GetEmail | (prompt) | Prompts the user for their email address and returns it.
The last used email address is saved to a file and offered up as a suggestion
to the user. If the user presses enter without typing in anything the last
used email address is used. If the user enters a new address, it is saved
for next time we prompt.
... | Prompts the user for their email address and returns it. | def GetEmail(prompt):
"""Prompts the user for their email address and returns it.
The last used email address is saved to a file and offered up as a suggestion
to the user. If the user presses enter without typing in anything the last
used email address is used. If the user enters a new address, it is saved
... | [
"def",
"GetEmail",
"(",
"prompt",
")",
":",
"last_email_file_name",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"\"~/.last_codereview_email_address\"",
")",
"last_email",
"=",
"\"\"",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"last_email_file_name",
")",
... | [
64,
0
] | [
93,
14
] | python | en | ['en', 'en', 'en'] | True |
StatusUpdate | (msg) | Print a status message to stdout.
If 'verbosity' is greater than 0, print the message.
Args:
msg: The string to print.
| Print a status message to stdout. | def StatusUpdate(msg):
"""Print a status message to stdout.
If 'verbosity' is greater than 0, print the message.
Args:
msg: The string to print.
"""
if verbosity > 0:
print msg | [
"def",
"StatusUpdate",
"(",
"msg",
")",
":",
"if",
"verbosity",
">",
"0",
":",
"print",
"msg"
] | [
96,
0
] | [
105,
13
] | python | en | ['en', 'en', 'en'] | True |
ErrorExit | (msg) | Print an error message to stderr and exit. | Print an error message to stderr and exit. | def ErrorExit(msg):
"""Print an error message to stderr and exit."""
print >>sys.stderr, msg
sys.exit(1) | [
"def",
"ErrorExit",
"(",
"msg",
")",
":",
"print",
">>",
"sys",
".",
"stderr",
",",
"msg",
"sys",
".",
"exit",
"(",
"1",
")"
] | [
108,
0
] | [
111,
13
] | python | en | ['en', 'en', 'en'] | True |
GetRpcServer | (options) | Returns an instance of an AbstractRpcServer.
Returns:
A new AbstractRpcServer, on which RPC calls can be made.
| Returns an instance of an AbstractRpcServer. | def GetRpcServer(options):
"""Returns an instance of an AbstractRpcServer.
Returns:
A new AbstractRpcServer, on which RPC calls can be made.
"""
rpc_server_class = HttpRpcServer
def GetUserCredentials():
"""Prompts the user for a username and password."""
email = options.email
if email is N... | [
"def",
"GetRpcServer",
"(",
"options",
")",
":",
"rpc_server_class",
"=",
"HttpRpcServer",
"def",
"GetUserCredentials",
"(",
")",
":",
"\"\"\"Prompts the user for a username and password.\"\"\"",
"email",
"=",
"options",
".",
"email",
"if",
"email",
"is",
"None",
":",... | [
457,
0
] | [
494,
60
] | python | en | ['en', 'en', 'en'] | True |
EncodeMultipartFormData | (fields, files) | Encode form fields for multipart/form-data.
Args:
fields: A sequence of (name, value) elements for regular form fields.
files: A sequence of (name, filename, value) elements for data to be
uploaded as files.
Returns:
(content_type, body) ready for httplib.HTTP instance.
Source:
http:/... | Encode form fields for multipart/form-data. | def EncodeMultipartFormData(fields, files):
"""Encode form fields for multipart/form-data.
Args:
fields: A sequence of (name, value) elements for regular form fields.
files: A sequence of (name, filename, value) elements for data to be
uploaded as files.
Returns:
(content_type, body) ready... | [
"def",
"EncodeMultipartFormData",
"(",
"fields",
",",
"files",
")",
":",
"BOUNDARY",
"=",
"'-M-A-G-I-C---B-O-U-N-D-A-R-Y-'",
"CRLF",
"=",
"'\\r\\n'",
"lines",
"=",
"[",
"]",
"for",
"(",
"key",
",",
"value",
")",
"in",
"fields",
":",
"lines",
".",
"append",
... | [
497,
0
] | [
529,
27
] | python | en | ['en', 'en', 'en'] | True |
GetContentType | (filename) | Helper to guess the content-type from the filename. | Helper to guess the content-type from the filename. | def GetContentType(filename):
"""Helper to guess the content-type from the filename."""
return mimetypes.guess_type(filename)[0] or 'application/octet-stream' | [
"def",
"GetContentType",
"(",
"filename",
")",
":",
"return",
"mimetypes",
".",
"guess_type",
"(",
"filename",
")",
"[",
"0",
"]",
"or",
"'application/octet-stream'"
] | [
532,
0
] | [
534,
72
] | python | en | ['en', 'en', 'en'] | True |
RunShellWithReturnCode | (command, print_output=False,
universal_newlines=True) | Executes a command and returns the output from stdout and the return code.
Args:
command: Command to execute.
print_output: If True, the output is printed to stdout.
If False, both stdout and stderr are ignored.
universal_newlines: Use universal_newlines flag (default: True).
Returns... | Executes a command and returns the output from stdout and the return code. | def RunShellWithReturnCode(command, print_output=False,
universal_newlines=True):
"""Executes a command and returns the output from stdout and the return code.
Args:
command: Command to execute.
print_output: If True, the output is printed to stdout.
If False, b... | [
"def",
"RunShellWithReturnCode",
"(",
"command",
",",
"print_output",
"=",
"False",
",",
"universal_newlines",
"=",
"True",
")",
":",
"logging",
".",
"info",
"(",
"\"Running %s\"",
",",
"command",
")",
"p",
"=",
"subprocess",
".",
"Popen",
"(",
"command",
",... | [
540,
0
] | [
573,
29
] | python | en | ['en', 'en', 'en'] | True |
SplitPatch | (data) | Splits a patch into separate pieces for each file.
Args:
data: A string containing the output of svn diff.
Returns:
A list of 2-tuple (filename, text) where text is the svn diff output
pertaining to filename.
| Splits a patch into separate pieces for each file. | def SplitPatch(data):
"""Splits a patch into separate pieces for each file.
Args:
data: A string containing the output of svn diff.
Returns:
A list of 2-tuple (filename, text) where text is the svn diff output
pertaining to filename.
"""
patches = []
filename = None
diff = []
for line in... | [
"def",
"SplitPatch",
"(",
"data",
")",
":",
"patches",
"=",
"[",
"]",
"filename",
"=",
"None",
"diff",
"=",
"[",
"]",
"for",
"line",
"in",
"data",
".",
"splitlines",
"(",
"True",
")",
":",
"new_filename",
"=",
"None",
"if",
"line",
".",
"startswith",... | [
1140,
0
] | [
1177,
16
] | python | en | ['en', 'en', 'en'] | True |
UploadSeparatePatches | (issue, rpc_server, patchset, data, options) | Uploads a separate patch for each file in the diff output.
Returns a list of [patch_key, filename] for each file.
| Uploads a separate patch for each file in the diff output. | def UploadSeparatePatches(issue, rpc_server, patchset, data, options):
"""Uploads a separate patch for each file in the diff output.
Returns a list of [patch_key, filename] for each file.
"""
patches = SplitPatch(data)
rv = []
for patch in patches:
if len(patch[1]) > MAX_UPLOAD_SIZE:
print ("Not ... | [
"def",
"UploadSeparatePatches",
"(",
"issue",
",",
"rpc_server",
",",
"patchset",
",",
"data",
",",
"options",
")",
":",
"patches",
"=",
"SplitPatch",
"(",
"data",
")",
"rv",
"=",
"[",
"]",
"for",
"patch",
"in",
"patches",
":",
"if",
"len",
"(",
"patch... | [
1180,
0
] | [
1205,
11
] | python | en | ['en', 'en', 'en'] | True |
GuessVCS | (options) | Helper to guess the version control system.
This examines the current directory, guesses which VersionControlSystem
we're using, and returns an instance of the appropriate class. Exit with an
error if we can't figure it out.
Returns:
A VersionControlSystem instance. Exits if the VCS can't be guessed.
| Helper to guess the version control system. | def GuessVCS(options):
"""Helper to guess the version control system.
This examines the current directory, guesses which VersionControlSystem
we're using, and returns an instance of the appropriate class. Exit with an
error if we can't figure it out.
Returns:
A VersionControlSystem instance. Exits if t... | [
"def",
"GuessVCS",
"(",
"options",
")",
":",
"# Mercurial has a command to get the base directory of a repository",
"# Try running it, but don't die if we don't have hg installed.",
"# NOTE: we try Mercurial first as it can sit on top of an SVN working copy.",
"try",
":",
"out",
",",
"retu... | [
1208,
0
] | [
1246,
53
] | python | en | ['en', 'en', 'en'] | True |
RealMain | (argv, data=None) | The real main function.
Args:
argv: Command line arguments.
data: Diff contents. If None (default) the diff is generated by
the VersionControlSystem implementation returned by GuessVCS().
Returns:
A 2-tuple (issue id, patchset id).
The patchset id is None if the base files are not uploaded b... | The real main function. | def RealMain(argv, data=None):
"""The real main function.
Args:
argv: Command line arguments.
data: Diff contents. If None (default) the diff is generated by
the VersionControlSystem implementation returned by GuessVCS().
Returns:
A 2-tuple (issue id, patchset id).
The patchset id is None ... | [
"def",
"RealMain",
"(",
"argv",
",",
"data",
"=",
"None",
")",
":",
"logging",
".",
"basicConfig",
"(",
"format",
"=",
"(",
"\"%(asctime).19s %(levelname)s %(filename)s:\"",
"\"%(lineno)s %(message)s \"",
")",
")",
"os",
".",
"environ",
"[",
"'LC_ALL'",
"]",
"="... | [
1249,
0
] | [
1373,
24
] | python | en | ['en', 'en', 'en'] | True |
AbstractRpcServer.__init__ | (self, host, auth_function, host_override=None, extra_headers={},
save_cookies=False) | Creates a new HttpRpcServer.
Args:
host: The host to send requests to.
auth_function: A function that takes no arguments and returns an
(email, password) tuple when called. Will be called if authentication
is required.
host_override: The host header to send to the server (defaults... | Creates a new HttpRpcServer. | def __init__(self, host, auth_function, host_override=None, extra_headers={},
save_cookies=False):
"""Creates a new HttpRpcServer.
Args:
host: The host to send requests to.
auth_function: A function that takes no arguments and returns an
(email, password) tuple when called. W... | [
"def",
"__init__",
"(",
"self",
",",
"host",
",",
"auth_function",
",",
"host_override",
"=",
"None",
",",
"extra_headers",
"=",
"{",
"}",
",",
"save_cookies",
"=",
"False",
")",
":",
"self",
".",
"host",
"=",
"host",
"self",
".",
"host_override",
"=",
... | [
126,
2
] | [
151,
43
] | python | en | ['en', 'en', 'en'] | True |
AbstractRpcServer._GetOpener | (self) | Returns an OpenerDirector for making HTTP requests.
Returns:
A urllib2.OpenerDirector object.
| Returns an OpenerDirector for making HTTP requests. | def _GetOpener(self):
"""Returns an OpenerDirector for making HTTP requests.
Returns:
A urllib2.OpenerDirector object.
"""
raise NotImplementedError() | [
"def",
"_GetOpener",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | [
153,
2
] | [
159,
31
] | python | en | ['en', 'en', 'en'] | True |
AbstractRpcServer._CreateRequest | (self, url, data=None) | Creates a new urllib request. | Creates a new urllib request. | def _CreateRequest(self, url, data=None):
"""Creates a new urllib request."""
logging.debug("Creating request for: '%s' with payload:\n%s", url, data)
req = urllib2.Request(url, data=data)
if self.host_override:
req.add_header("Host", self.host_override)
for key, value in self.extra_headers.it... | [
"def",
"_CreateRequest",
"(",
"self",
",",
"url",
",",
"data",
"=",
"None",
")",
":",
"logging",
".",
"debug",
"(",
"\"Creating request for: '%s' with payload:\\n%s\"",
",",
"url",
",",
"data",
")",
"req",
"=",
"urllib2",
".",
"Request",
"(",
"url",
",",
"... | [
161,
2
] | [
169,
14
] | python | en | ['en', 'mt', 'en'] | True |
AbstractRpcServer._GetAuthToken | (self, email, password) | Uses ClientLogin to authenticate the user, returning an auth token.
Args:
email: The user's email address
password: The user's password
Raises:
ClientLoginError: If there was an error authenticating with ClientLogin.
HTTPError: If there was some other form of HTTP error.
Return... | Uses ClientLogin to authenticate the user, returning an auth token. | def _GetAuthToken(self, email, password):
"""Uses ClientLogin to authenticate the user, returning an auth token.
Args:
email: The user's email address
password: The user's password
Raises:
ClientLoginError: If there was an error authenticating with ClientLogin.
HTTPError: If the... | [
"def",
"_GetAuthToken",
"(",
"self",
",",
"email",
",",
"password",
")",
":",
"account_type",
"=",
"\"GOOGLE\"",
"if",
"self",
".",
"host",
".",
"endswith",
"(",
"\".google.com\"",
")",
":",
"# Needed for use inside Google.",
"account_type",
"=",
"\"HOSTED\"",
"... | [
171,
2
] | [
212,
13
] | python | en | ['en', 'en', 'en'] | True |
AbstractRpcServer._GetAuthCookie | (self, auth_token) | Fetches authentication cookies for an authentication token.
Args:
auth_token: The authentication token returned by ClientLogin.
Raises:
HTTPError: If there was an error fetching the authentication cookies.
| Fetches authentication cookies for an authentication token. | def _GetAuthCookie(self, auth_token):
"""Fetches authentication cookies for an authentication token.
Args:
auth_token: The authentication token returned by ClientLogin.
Raises:
HTTPError: If there was an error fetching the authentication cookies.
"""
# This is a dummy value to allow us... | [
"def",
"_GetAuthCookie",
"(",
"self",
",",
"auth_token",
")",
":",
"# This is a dummy value to allow us to identify when we're successful.",
"continue_location",
"=",
"\"http://localhost/\"",
"args",
"=",
"{",
"\"continue\"",
":",
"continue_location",
",",
"\"auth\"",
":",
... | [
214,
2
] | [
236,
29
] | python | en | ['en', 'en', 'en'] | True |
AbstractRpcServer._Authenticate | (self) | Authenticates the user.
The authentication process works as follows:
1) We get a username and password from the user
2) We use ClientLogin to obtain an AUTH token for the user
(see http://code.google.com/apis/accounts/AuthForInstalledApps.html).
3) We pass the auth token to /_ah/login on the... | Authenticates the user. | def _Authenticate(self):
"""Authenticates the user.
The authentication process works as follows:
1) We get a username and password from the user
2) We use ClientLogin to obtain an AUTH token for the user
(see http://code.google.com/apis/accounts/AuthForInstalledApps.html).
3) We pass the... | [
"def",
"_Authenticate",
"(",
"self",
")",
":",
"for",
"i",
"in",
"range",
"(",
"3",
")",
":",
"credentials",
"=",
"self",
".",
"auth_function",
"(",
")",
"try",
":",
"auth_token",
"=",
"self",
".",
"_GetAuthToken",
"(",
"credentials",
"[",
"0",
"]",
... | [
238,
2
] | [
288,
12
] | python | en | ['en', 'en', 'en'] | True |
AbstractRpcServer.Send | (self, request_path, payload=None,
content_type="application/octet-stream",
timeout=None,
**kwargs) | Sends an RPC and returns the response.
Args:
request_path: The path to send the request to, eg /api/appversion/create.
payload: The body of the request, or None to send an empty request.
content_type: The Content-Type header to use.
timeout: timeout in seconds; default None i.e. no timeout.... | Sends an RPC and returns the response. | def Send(self, request_path, payload=None,
content_type="application/octet-stream",
timeout=None,
**kwargs):
"""Sends an RPC and returns the response.
Args:
request_path: The path to send the request to, eg /api/appversion/create.
payload: The body of the request, o... | [
"def",
"Send",
"(",
"self",
",",
"request_path",
",",
"payload",
"=",
"None",
",",
"content_type",
"=",
"\"application/octet-stream\"",
",",
"timeout",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# TODO: Don't require authentication. Let the server say",
"# wh... | [
290,
2
] | [
340,
43
] | python | en | ['en', 'en', 'en'] | True |
HttpRpcServer._Authenticate | (self) | Save the cookie jar after authentication. | Save the cookie jar after authentication. | def _Authenticate(self):
"""Save the cookie jar after authentication."""
super(HttpRpcServer, self)._Authenticate()
if self.save_cookies:
StatusUpdate("Saving authentication cookies to %s" % self.cookie_file)
self.cookie_jar.save() | [
"def",
"_Authenticate",
"(",
"self",
")",
":",
"super",
"(",
"HttpRpcServer",
",",
"self",
")",
".",
"_Authenticate",
"(",
")",
"if",
"self",
".",
"save_cookies",
":",
"StatusUpdate",
"(",
"\"Saving authentication cookies to %s\"",
"%",
"self",
".",
"cookie_file... | [
346,
2
] | [
351,
28
] | python | en | ['en', 'en', 'en'] | True |
HttpRpcServer._GetOpener | (self) | Returns an OpenerDirector that supports cookies and ignores redirects.
Returns:
A urllib2.OpenerDirector object.
| Returns an OpenerDirector that supports cookies and ignores redirects. | def _GetOpener(self):
"""Returns an OpenerDirector that supports cookies and ignores redirects.
Returns:
A urllib2.OpenerDirector object.
"""
opener = urllib2.OpenerDirector()
opener.add_handler(urllib2.ProxyHandler())
opener.add_handler(urllib2.UnknownHandler())
opener.add_handler(ur... | [
"def",
"_GetOpener",
"(",
"self",
")",
":",
"opener",
"=",
"urllib2",
".",
"OpenerDirector",
"(",
")",
"opener",
".",
"add_handler",
"(",
"urllib2",
".",
"ProxyHandler",
"(",
")",
")",
"opener",
".",
"add_handler",
"(",
"urllib2",
".",
"UnknownHandler",
"(... | [
353,
2
] | [
388,
17
] | python | en | ['en', 'en', 'en'] | True |
VersionControlSystem.__init__ | (self, options) | Constructor.
Args:
options: Command line options.
| Constructor. | def __init__(self, options):
"""Constructor.
Args:
options: Command line options.
"""
self.options = options | [
"def",
"__init__",
"(",
"self",
",",
"options",
")",
":",
"self",
".",
"options",
"=",
"options"
] | [
590,
2
] | [
596,
26
] | python | en | ['en', 'en', 'en'] | False |
VersionControlSystem.GenerateDiff | (self, args) | Return the current diff as a string.
Args:
args: Extra arguments to pass to the diff command.
| Return the current diff as a string. | def GenerateDiff(self, args):
"""Return the current diff as a string.
Args:
args: Extra arguments to pass to the diff command.
"""
raise NotImplementedError(
"abstract method -- subclass %s must override" % self.__class__) | [
"def",
"GenerateDiff",
"(",
"self",
",",
"args",
")",
":",
"raise",
"NotImplementedError",
"(",
"\"abstract method -- subclass %s must override\"",
"%",
"self",
".",
"__class__",
")"
] | [
598,
2
] | [
605,
72
] | python | en | ['en', 'en', 'en'] | True |
VersionControlSystem.GetUnknownFiles | (self) | Return a list of files unknown to the VCS. | Return a list of files unknown to the VCS. | def GetUnknownFiles(self):
"""Return a list of files unknown to the VCS."""
raise NotImplementedError(
"abstract method -- subclass %s must override" % self.__class__) | [
"def",
"GetUnknownFiles",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
"\"abstract method -- subclass %s must override\"",
"%",
"self",
".",
"__class__",
")"
] | [
607,
2
] | [
610,
72
] | python | en | ['en', 'en', 'en'] | True |
VersionControlSystem.CheckForUnknownFiles | (self) | Show an "are you sure?" prompt if there are unknown files. | Show an "are you sure?" prompt if there are unknown files. | def CheckForUnknownFiles(self):
"""Show an "are you sure?" prompt if there are unknown files."""
unknown_files = self.GetUnknownFiles()
if unknown_files:
print "The following files are not added to version control:"
for line in unknown_files:
print line
prompt = "Are you sure to co... | [
"def",
"CheckForUnknownFiles",
"(",
"self",
")",
":",
"unknown_files",
"=",
"self",
".",
"GetUnknownFiles",
"(",
")",
"if",
"unknown_files",
":",
"print",
"\"The following files are not added to version control:\"",
"for",
"line",
"in",
"unknown_files",
":",
"print",
... | [
612,
2
] | [
622,
33
] | python | en | ['en', 'en', 'en'] | True |
VersionControlSystem.GetBaseFile | (self, filename) | Get the content of the upstream version of a file.
Returns:
A tuple (base_content, new_content, is_binary, status)
base_content: The contents of the base file.
new_content: For text files, this is empty. For binary files, this is
the contents of the new file, since the diff output ... | Get the content of the upstream version of a file. | def GetBaseFile(self, filename):
"""Get the content of the upstream version of a file.
Returns:
A tuple (base_content, new_content, is_binary, status)
base_content: The contents of the base file.
new_content: For text files, this is empty. For binary files, this is
the contents... | [
"def",
"GetBaseFile",
"(",
"self",
",",
"filename",
")",
":",
"raise",
"NotImplementedError",
"(",
"\"abstract method -- subclass %s must override\"",
"%",
"self",
".",
"__class__",
")"
] | [
624,
2
] | [
638,
72
] | python | en | ['en', 'en', 'en'] | True |
VersionControlSystem.GetBaseFiles | (self, diff) | Helper that calls GetBase file for each file in the patch.
Returns:
A dictionary that maps from filename to GetBaseFile's tuple. Filenames
are retrieved based on lines that start with "Index:" or
"Property changes on:".
| Helper that calls GetBase file for each file in the patch. | def GetBaseFiles(self, diff):
"""Helper that calls GetBase file for each file in the patch.
Returns:
A dictionary that maps from filename to GetBaseFile's tuple. Filenames
are retrieved based on lines that start with "Index:" or
"Property changes on:".
"""
files = {}
for line in ... | [
"def",
"GetBaseFiles",
"(",
"self",
",",
"diff",
")",
":",
"files",
"=",
"{",
"}",
"for",
"line",
"in",
"diff",
".",
"splitlines",
"(",
"True",
")",
":",
"if",
"line",
".",
"startswith",
"(",
"'Index:'",
")",
"or",
"line",
".",
"startswith",
"(",
"... | [
641,
2
] | [
657,
16
] | python | en | ['en', 'en', 'en'] | True |
VersionControlSystem.UploadBaseFiles | (self, issue, rpc_server, patch_list, patchset, options,
files) | Uploads the base files (and if necessary, the current ones as well). | Uploads the base files (and if necessary, the current ones as well). | def UploadBaseFiles(self, issue, rpc_server, patch_list, patchset, options,
files):
"""Uploads the base files (and if necessary, the current ones as well)."""
def UploadFile(filename, file_id, content, is_binary, status, is_base):
"""Uploads a file to the server."""
file_too_l... | [
"def",
"UploadBaseFiles",
"(",
"self",
",",
"issue",
",",
"rpc_server",
",",
"patch_list",
",",
"patchset",
",",
"options",
",",
"files",
")",
":",
"def",
"UploadFile",
"(",
"filename",
",",
"file_id",
",",
"content",
",",
"is_binary",
",",
"status",
",",
... | [
660,
2
] | [
710,
76
] | python | en | ['en', 'en', 'en'] | True |
VersionControlSystem.IsImage | (self, filename) | Returns true if the filename has an image extension. | Returns true if the filename has an image extension. | def IsImage(self, filename):
"""Returns true if the filename has an image extension."""
mimetype = mimetypes.guess_type(filename)[0]
if not mimetype:
return False
return mimetype.startswith("image/") | [
"def",
"IsImage",
"(",
"self",
",",
"filename",
")",
":",
"mimetype",
"=",
"mimetypes",
".",
"guess_type",
"(",
"filename",
")",
"[",
"0",
"]",
"if",
"not",
"mimetype",
":",
"return",
"False",
"return",
"mimetype",
".",
"startswith",
"(",
"\"image/\"",
"... | [
712,
2
] | [
717,
40
] | python | en | ['en', 'en', 'en'] | True |
SubversionVCS.GuessBase | (self, required) | Wrapper for _GuessBase. | Wrapper for _GuessBase. | def GuessBase(self, required):
"""Wrapper for _GuessBase."""
return self.svn_base | [
"def",
"GuessBase",
"(",
"self",
",",
"required",
")",
":",
"return",
"self",
".",
"svn_base"
] | [
741,
2
] | [
743,
24
] | python | en | ['da', 'en', 'en'] | True |
SubversionVCS._GuessBase | (self, required) | Returns the SVN base URL.
Args:
required: If true, exits if the url can't be guessed, otherwise None is
returned.
| Returns the SVN base URL. | def _GuessBase(self, required):
"""Returns the SVN base URL.
Args:
required: If true, exits if the url can't be guessed, otherwise None is
returned.
"""
info = RunShell(["svn", "info"])
for line in info.splitlines():
words = line.split()
if len(words) == 2 and words[0] == ... | [
"def",
"_GuessBase",
"(",
"self",
",",
"required",
")",
":",
"info",
"=",
"RunShell",
"(",
"[",
"\"svn\"",
",",
"\"info\"",
"]",
")",
"for",
"line",
"in",
"info",
".",
"splitlines",
"(",
")",
":",
"words",
"=",
"line",
".",
"split",
"(",
")",
"if",... | [
745,
2
] | [
787,
15
] | python | en | ['en', 'no', 'en'] | True |
SubversionVCS._CollapseKeywords | (self, content, keyword_str) | Collapses SVN keywords. | Collapses SVN keywords. | def _CollapseKeywords(self, content, keyword_str):
"""Collapses SVN keywords."""
# svn cat translates keywords but svn diff doesn't. As a result of this
# behavior patching.PatchChunks() fails with a chunk mismatch error.
# This part was originally written by the Review Board development team
# who ... | [
"def",
"_CollapseKeywords",
"(",
"self",
",",
"content",
",",
"keyword_str",
")",
":",
"# svn cat translates keywords but svn diff doesn't. As a result of this",
"# behavior patching.PatchChunks() fails with a chunk mismatch error.",
"# This part was originally written by the Review Board de... | [
804,
2
] | [
833,
79
] | python | en | ['en', 'en', 'en'] | True |
SubversionVCS.ReadFile | (self, filename) | Returns the contents of a file. | Returns the contents of a file. | def ReadFile(self, filename):
"""Returns the contents of a file."""
file = open(filename, 'rb')
result = ""
try:
result = file.read()
finally:
file.close()
return result | [
"def",
"ReadFile",
"(",
"self",
",",
"filename",
")",
":",
"file",
"=",
"open",
"(",
"filename",
",",
"'rb'",
")",
"result",
"=",
"\"\"",
"try",
":",
"result",
"=",
"file",
".",
"read",
"(",
")",
"finally",
":",
"file",
".",
"close",
"(",
")",
"r... | [
843,
2
] | [
851,
17
] | python | en | ['en', 'en', 'en'] | True |
SubversionVCS.GetStatus | (self, filename) | Returns the status of a file. | Returns the status of a file. | def GetStatus(self, filename):
"""Returns the status of a file."""
if not self.options.revision:
status = RunShell(["svn", "status", "--ignore-externals", filename])
if not status:
ErrorExit("svn status returned no output for %s" % filename)
status_lines = status.splitlines()
# I... | [
"def",
"GetStatus",
"(",
"self",
",",
"filename",
")",
":",
"if",
"not",
"self",
".",
"options",
".",
"revision",
":",
"status",
"=",
"RunShell",
"(",
"[",
"\"svn\"",
",",
"\"status\"",
",",
"\"--ignore-externals\"",
",",
"filename",
"]",
")",
"if",
"not... | [
853,
2
] | [
895,
17
] | python | en | ['en', 'en', 'en'] | True |
MercurialVCS._GetRelPath | (self, filename) | Get relative path of a file according to the current directory,
given its logical path in the repo. | Get relative path of a file according to the current directory,
given its logical path in the repo. | def _GetRelPath(self, filename):
"""Get relative path of a file according to the current directory,
given its logical path in the repo."""
assert filename.startswith(self.subdir), filename
return filename[len(self.subdir):].lstrip(r"\/") | [
"def",
"_GetRelPath",
"(",
"self",
",",
"filename",
")",
":",
"assert",
"filename",
".",
"startswith",
"(",
"self",
".",
"subdir",
")",
",",
"filename",
"return",
"filename",
"[",
"len",
"(",
"self",
".",
"subdir",
")",
":",
"]",
".",
"lstrip",
"(",
... | [
1057,
2
] | [
1061,
52
] | python | en | ['en', 'en', 'en'] | True |
MercurialVCS.GetUnknownFiles | (self) | Return a list of files unknown to the VCS. | Return a list of files unknown to the VCS. | def GetUnknownFiles(self):
"""Return a list of files unknown to the VCS."""
args = []
status = RunShell(["hg", "status", "--rev", self.base_rev, "-u", "."],
silent_ok=True)
unknown_files = []
for line in status.splitlines():
st, fn = line.split(" ", 1)
if st == "?":
unkno... | [
"def",
"GetUnknownFiles",
"(",
"self",
")",
":",
"args",
"=",
"[",
"]",
"status",
"=",
"RunShell",
"(",
"[",
"\"hg\"",
",",
"\"status\"",
",",
"\"--rev\"",
",",
"self",
".",
"base_rev",
",",
"\"-u\"",
",",
"\".\"",
"]",
",",
"silent_ok",
"=",
"True",
... | [
1089,
2
] | [
1099,
24
] | python | en | ['en', 'en', 'en'] | True |
Lighting.ambient | (self) |
Ambient light increases overall color visibility but can wash
out the image.
The 'ambient' property is a number and may be specified as:
- An int or float in the interval [0, 1]
Returns
-------
int|float
|
Ambient light increases overall color visibility but can wash
out the image.
The 'ambient' property is a number and may be specified as:
- An int or float in the interval [0, 1] | def ambient(self):
"""
Ambient light increases overall color visibility but can wash
out the image.
The 'ambient' property is a number and may be specified as:
- An int or float in the interval [0, 1]
Returns
-------
int|float
"""
r... | [
"def",
"ambient",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"ambient\"",
"]"
] | [
15,
4
] | [
27,
30
] | python | en | ['en', 'error', 'th'] | False |
Lighting.diffuse | (self) |
Represents the extent that incident rays are reflected in a
range of angles.
The 'diffuse' property is a number and may be specified as:
- An int or float in the interval [0, 1]
Returns
-------
int|float
|
Represents the extent that incident rays are reflected in a
range of angles.
The 'diffuse' property is a number and may be specified as:
- An int or float in the interval [0, 1] | def diffuse(self):
"""
Represents the extent that incident rays are reflected in a
range of angles.
The 'diffuse' property is a number and may be specified as:
- An int or float in the interval [0, 1]
Returns
-------
int|float
"""
r... | [
"def",
"diffuse",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"diffuse\"",
"]"
] | [
36,
4
] | [
48,
30
] | python | en | ['en', 'error', 'th'] | False |
Lighting.fresnel | (self) |
Represents the reflectance as a dependency of the viewing
angle; e.g. paper is reflective when viewing it from the edge
of the paper (almost 90 degrees), causing shine.
The 'fresnel' property is a number and may be specified as:
- An int or float in the interval [0, 5]
... |
Represents the reflectance as a dependency of the viewing
angle; e.g. paper is reflective when viewing it from the edge
of the paper (almost 90 degrees), causing shine.
The 'fresnel' property is a number and may be specified as:
- An int or float in the interval [0, 5] | def fresnel(self):
"""
Represents the reflectance as a dependency of the viewing
angle; e.g. paper is reflective when viewing it from the edge
of the paper (almost 90 degrees), causing shine.
The 'fresnel' property is a number and may be specified as:
- An int or f... | [
"def",
"fresnel",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"fresnel\"",
"]"
] | [
57,
4
] | [
70,
30
] | python | en | ['en', 'error', 'th'] | False |
Lighting.roughness | (self) |
Alters specular reflection; the rougher the surface, the wider
and less contrasty the shine.
The 'roughness' property is a number and may be specified as:
- An int or float in the interval [0, 1]
Returns
-------
int|float
|
Alters specular reflection; the rougher the surface, the wider
and less contrasty the shine.
The 'roughness' property is a number and may be specified as:
- An int or float in the interval [0, 1] | def roughness(self):
"""
Alters specular reflection; the rougher the surface, the wider
and less contrasty the shine.
The 'roughness' property is a number and may be specified as:
- An int or float in the interval [0, 1]
Returns
-------
int|float
... | [
"def",
"roughness",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"roughness\"",
"]"
] | [
79,
4
] | [
91,
32
] | python | en | ['en', 'error', 'th'] | False |
Lighting.specular | (self) |
Represents the level that incident rays are reflected in a
single direction, causing shine.
The 'specular' property is a number and may be specified as:
- An int or float in the interval [0, 2]
Returns
-------
int|float
|
Represents the level that incident rays are reflected in a
single direction, causing shine.
The 'specular' property is a number and may be specified as:
- An int or float in the interval [0, 2] | def specular(self):
"""
Represents the level that incident rays are reflected in a
single direction, causing shine.
The 'specular' property is a number and may be specified as:
- An int or float in the interval [0, 2]
Returns
-------
int|float
... | [
"def",
"specular",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"specular\"",
"]"
] | [
100,
4
] | [
112,
31
] | python | en | ['en', 'error', 'th'] | False |
Lighting.__init__ | (
self,
arg=None,
ambient=None,
diffuse=None,
fresnel=None,
roughness=None,
specular=None,
**kwargs
) |
Construct a new Lighting object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.surface.Lighting`
ambient
Ambient light increases overall color visi... |
Construct a new Lighting object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.surface.Lighting`
ambient
Ambient light increases overall color visi... | def __init__(
self,
arg=None,
ambient=None,
diffuse=None,
fresnel=None,
roughness=None,
specular=None,
**kwargs
):
"""
Construct a new Lighting object
Parameters
----------
arg
dict of proper... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"ambient",
"=",
"None",
",",
"diffuse",
"=",
"None",
",",
"fresnel",
"=",
"None",
",",
"roughness",
"=",
"None",
",",
"specular",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",... | [
142,
4
] | [
239,
34
] | python | en | ['en', 'error', 'th'] | False |
normalize_answer | (s) |
Lower text and remove punctuation, articles and extra whitespace.
|
Lower text and remove punctuation, articles and extra whitespace.
| def normalize_answer(s):
"""
Lower text and remove punctuation, articles and extra whitespace.
"""
s = s.lower()
s = re_punc.sub(' ', s)
s = re_art.sub(' ', s)
# TODO: this could almost certainly be faster with a regex \s+ -> ' '
s = ' '.join(s.split())
return s | [
"def",
"normalize_answer",
"(",
"s",
")",
":",
"s",
"=",
"s",
".",
"lower",
"(",
")",
"s",
"=",
"re_punc",
".",
"sub",
"(",
"' '",
",",
"s",
")",
"s",
"=",
"re_art",
".",
"sub",
"(",
"' '",
",",
"s",
")",
"# TODO: this could almost certainly be faste... | [
585,
0
] | [
595,
12
] | python | en | ['en', 'error', 'th'] | False |
aggregate_named_reports | (
named_reports: Dict[str, Dict[str, Metric]], micro_average: bool = False
) |
Aggregate metrics from multiple reports.
:param reports:
Dict of tasks -> metrics.
:param micro_average:
If true, top level metrics will be the micro average. By default, we
use macro average.
:return:
The aggregated report
|
Aggregate metrics from multiple reports. | def aggregate_named_reports(
named_reports: Dict[str, Dict[str, Metric]], micro_average: bool = False
) -> Dict[str, Metric]:
"""
Aggregate metrics from multiple reports.
:param reports:
Dict of tasks -> metrics.
:param micro_average:
If true, top level metrics will be the micro ave... | [
"def",
"aggregate_named_reports",
"(",
"named_reports",
":",
"Dict",
"[",
"str",
",",
"Dict",
"[",
"str",
",",
"Metric",
"]",
"]",
",",
"micro_average",
":",
"bool",
"=",
"False",
")",
"->",
"Dict",
"[",
"str",
",",
"Metric",
"]",
":",
"if",
"len",
"... | [
598,
0
] | [
640,
12
] | python | en | ['en', 'error', 'th'] | False |
aggregate_unnamed_reports | (reports: List[Dict[str, Metric]]) |
Combines metrics without regard for tracking provenence.
|
Combines metrics without regard for tracking provenence.
| def aggregate_unnamed_reports(reports: List[Dict[str, Metric]]) -> Dict[str, Metric]:
"""
Combines metrics without regard for tracking provenence.
"""
m: Dict[str, Metric] = {}
for task_report in reports:
for each_metric, value in task_report.items():
m[each_metric] = m.get(each_... | [
"def",
"aggregate_unnamed_reports",
"(",
"reports",
":",
"List",
"[",
"Dict",
"[",
"str",
",",
"Metric",
"]",
"]",
")",
"->",
"Dict",
"[",
"str",
",",
"Metric",
"]",
":",
"m",
":",
"Dict",
"[",
"str",
",",
"Metric",
"]",
"=",
"{",
"}",
"for",
"ta... | [
643,
0
] | [
651,
12
] | python | en | ['en', 'error', 'th'] | False |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.