nwo stringlengths 5 86 | sha stringlengths 40 40 | path stringlengths 4 189 | language stringclasses 1
value | identifier stringlengths 1 94 | parameters stringlengths 2 4.03k | argument_list stringclasses 1
value | return_statement stringlengths 0 11.5k | docstring stringlengths 1 33.2k | docstring_summary stringlengths 0 5.15k | docstring_tokens list | function stringlengths 34 151k | function_tokens list | url stringlengths 90 278 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/boto3/resources/response.py | python | build_empty_response | (search_path, operation_name, service_model) | return response | Creates an appropriate empty response for the type that is expected,
based on the service model's shape type. For example, a value that
is normally a list would then return an empty list. A structure would
return an empty dict, and a number would return None.
:type search_path: string
:param search... | Creates an appropriate empty response for the type that is expected,
based on the service model's shape type. For example, a value that
is normally a list would then return an empty list. A structure would
return an empty dict, and a number would return None. | [
"Creates",
"an",
"appropriate",
"empty",
"response",
"for",
"the",
"type",
"that",
"is",
"expected",
"based",
"on",
"the",
"service",
"model",
"s",
"shape",
"type",
".",
"For",
"example",
"a",
"value",
"that",
"is",
"normally",
"a",
"list",
"would",
"then"... | def build_empty_response(search_path, operation_name, service_model):
"""
Creates an appropriate empty response for the type that is expected,
based on the service model's shape type. For example, a value that
is normally a list would then return an empty list. A structure would
return an empty dict... | [
"def",
"build_empty_response",
"(",
"search_path",
",",
"operation_name",
",",
"service_model",
")",
":",
"response",
"=",
"None",
"operation_model",
"=",
"service_model",
".",
"operation_model",
"(",
"operation_name",
")",
"shape",
"=",
"operation_model",
".",
"out... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/boto3/resources/response.py#L79-L125 | |
hakuna-m/wubiuefi | caec1af0a09c78fd5a345180ada1fe45e0c63493 | src/wubi/application.py | python | Wubi.parse_commandline_arguments | (self) | Parses commandline arguments | Parses commandline arguments | [
"Parses",
"commandline",
"arguments"
] | def parse_commandline_arguments(self):
'''
Parses commandline arguments
'''
usage = "%s [options]" % self.info.application_name
parser = OptionParser(usage=usage, version=self.info.full_version)
parser.add_option("--quiet", action="store_const", const="quiet", dest="verbo... | [
"def",
"parse_commandline_arguments",
"(",
"self",
")",
":",
"usage",
"=",
"\"%s [options]\"",
"%",
"self",
".",
"info",
".",
"application_name",
"parser",
"=",
"OptionParser",
"(",
"usage",
"=",
"usage",
",",
"version",
"=",
"self",
".",
"info",
".",
"full_... | https://github.com/hakuna-m/wubiuefi/blob/caec1af0a09c78fd5a345180ada1fe45e0c63493/src/wubi/application.py#L243-L290 | ||
potassco/clingo | e0c91d8f95cc28de1c480a871f9c97c30de83d40 | libpyclingo/clingo/solving.py | python | SolveHandle.get | (self) | return SolveResult(res) | Get the result of a solve call.
If the search is not completed yet, the function blocks until the
result is ready. | Get the result of a solve call. | [
"Get",
"the",
"result",
"of",
"a",
"solve",
"call",
"."
] | def get(self) -> SolveResult:
'''
Get the result of a solve call.
If the search is not completed yet, the function blocks until the
result is ready.
'''
res = _c_call('clingo_solve_result_bitset_t', _lib.clingo_solve_handle_get, self._rep, handler=self._handler)
... | [
"def",
"get",
"(",
"self",
")",
"->",
"SolveResult",
":",
"res",
"=",
"_c_call",
"(",
"'clingo_solve_result_bitset_t'",
",",
"_lib",
".",
"clingo_solve_handle_get",
",",
"self",
".",
"_rep",
",",
"handler",
"=",
"self",
".",
"_handler",
")",
"return",
"Solve... | https://github.com/potassco/clingo/blob/e0c91d8f95cc28de1c480a871f9c97c30de83d40/libpyclingo/clingo/solving.py#L491-L499 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/grid.py | python | GridUpdateLocker.__init__ | (self, *args, **kwargs) | __init__(self, Grid grid=None) -> GridUpdateLocker | __init__(self, Grid grid=None) -> GridUpdateLocker | [
"__init__",
"(",
"self",
"Grid",
"grid",
"=",
"None",
")",
"-",
">",
"GridUpdateLocker"
] | def __init__(self, *args, **kwargs):
"""__init__(self, Grid grid=None) -> GridUpdateLocker"""
_grid.GridUpdateLocker_swiginit(self,_grid.new_GridUpdateLocker(*args, **kwargs)) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_grid",
".",
"GridUpdateLocker_swiginit",
"(",
"self",
",",
"_grid",
".",
"new_GridUpdateLocker",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/grid.py#L2282-L2284 | ||
lhmRyan/deep-supervised-hashing-DSH | 631901f82e2ab031fbac33f914a5b08ef8e21d57 | python/caffe/draw.py | python | draw_net_to_file | (caffe_net, filename, rankdir='LR') | Draws a caffe net, and saves it to file using the format given as the
file extension. Use '.raw' to output raw text that you can manually feed
to graphviz to draw graphs.
Parameters
----------
caffe_net : a caffe.proto.caffe_pb2.NetParameter protocol buffer.
filename : string
The path t... | Draws a caffe net, and saves it to file using the format given as the
file extension. Use '.raw' to output raw text that you can manually feed
to graphviz to draw graphs. | [
"Draws",
"a",
"caffe",
"net",
"and",
"saves",
"it",
"to",
"file",
"using",
"the",
"format",
"given",
"as",
"the",
"file",
"extension",
".",
"Use",
".",
"raw",
"to",
"output",
"raw",
"text",
"that",
"you",
"can",
"manually",
"feed",
"to",
"graphviz",
"t... | def draw_net_to_file(caffe_net, filename, rankdir='LR'):
"""Draws a caffe net, and saves it to file using the format given as the
file extension. Use '.raw' to output raw text that you can manually feed
to graphviz to draw graphs.
Parameters
----------
caffe_net : a caffe.proto.caffe_pb2.NetPar... | [
"def",
"draw_net_to_file",
"(",
"caffe_net",
",",
"filename",
",",
"rankdir",
"=",
"'LR'",
")",
":",
"ext",
"=",
"filename",
"[",
"filename",
".",
"rfind",
"(",
"'.'",
")",
"+",
"1",
":",
"]",
"with",
"open",
"(",
"filename",
",",
"'wb'",
")",
"as",
... | https://github.com/lhmRyan/deep-supervised-hashing-DSH/blob/631901f82e2ab031fbac33f914a5b08ef8e21d57/python/caffe/draw.py#L207-L222 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/cuda/cudadrv/driver.py | python | event_elapsed_time | (evtstart, evtend) | return msec.value | Compute the elapsed time between two events in milliseconds. | Compute the elapsed time between two events in milliseconds. | [
"Compute",
"the",
"elapsed",
"time",
"between",
"two",
"events",
"in",
"milliseconds",
"."
] | def event_elapsed_time(evtstart, evtend):
'''
Compute the elapsed time between two events in milliseconds.
'''
msec = c_float()
driver.cuEventElapsedTime(byref(msec), evtstart.handle, evtend.handle)
return msec.value | [
"def",
"event_elapsed_time",
"(",
"evtstart",
",",
"evtend",
")",
":",
"msec",
"=",
"c_float",
"(",
")",
"driver",
".",
"cuEventElapsedTime",
"(",
"byref",
"(",
"msec",
")",
",",
"evtstart",
".",
"handle",
",",
"evtend",
".",
"handle",
")",
"return",
"ms... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/cuda/cudadrv/driver.py#L1485-L1491 | |
freesurfer/freesurfer | 6dbe527d43ffa611acb2cd112e9469f9bfec8e36 | .git-keywords/update-modified-keywords.py | python | keywordfiles | (fns) | return rv | Filter those files that have keywords in them
Arguments:
fns: A list of filenames.
Returns:
A list for filenames for files that contain keywords. | Filter those files that have keywords in them | [
"Filter",
"those",
"files",
"that",
"have",
"keywords",
"in",
"them"
] | def keywordfiles(fns):
"""Filter those files that have keywords in them
Arguments:
fns: A list of filenames.
Returns:
A list for filenames for files that contain keywords.
"""
# These lines are encoded otherwise they would be mangled if this file
# is checked in my git repo!
... | [
"def",
"keywordfiles",
"(",
"fns",
")",
":",
"# These lines are encoded otherwise they would be mangled if this file",
"# is checked in my git repo!",
"datekw",
"=",
"b64decode",
"(",
"'JERhdGU='",
")",
"revkw",
"=",
"b64decode",
"(",
"'JFJldmlzaW9u'",
")",
"rv",
"=",
"["... | https://github.com/freesurfer/freesurfer/blob/6dbe527d43ffa611acb2cd112e9469f9bfec8e36/.git-keywords/update-modified-keywords.py#L97-L120 | |
hpi-xnor/BMXNet | ed0b201da6667887222b8e4b5f997c4f6b61943d | python/mxnet/initializer.py | python | Initializer._verbose_print | (self, desc, init, arr) | Internal verbose print function
Parameters
----------
desc : InitDesc or str
name of the array
init : str
initializer pattern
arr : NDArray
initialized array | Internal verbose print function | [
"Internal",
"verbose",
"print",
"function"
] | def _verbose_print(self, desc, init, arr):
"""Internal verbose print function
Parameters
----------
desc : InitDesc or str
name of the array
init : str
initializer pattern
arr : NDArray
initialized array
"""
if self._ve... | [
"def",
"_verbose_print",
"(",
"self",
",",
"desc",
",",
"init",
",",
"arr",
")",
":",
"if",
"self",
".",
"_verbose",
"and",
"self",
".",
"_print_func",
":",
"logging",
".",
"info",
"(",
"'Initialized %s as %s: %s'",
",",
"desc",
",",
"init",
",",
"self",... | https://github.com/hpi-xnor/BMXNet/blob/ed0b201da6667887222b8e4b5f997c4f6b61943d/python/mxnet/initializer.py#L81-L94 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/aui/aui_utilities.py | python | LightColour | (colour, percent) | return wx.Colour(r, g, b) | Brighten input `colour` by `percent`.
:param Colour `colour`: the colour to be brightened;
:param integer `percent`: brightening percentage. | Brighten input `colour` by `percent`. | [
"Brighten",
"input",
"colour",
"by",
"percent",
"."
] | def LightColour(colour, percent):
"""
Brighten input `colour` by `percent`.
:param Colour `colour`: the colour to be brightened;
:param integer `percent`: brightening percentage.
"""
end_colour = wx.WHITE
rd = end_colour.Red() - colour.Red()
gd = end_colour.Green() - colour.Gr... | [
"def",
"LightColour",
"(",
"colour",
",",
"percent",
")",
":",
"end_colour",
"=",
"wx",
".",
"WHITE",
"rd",
"=",
"end_colour",
".",
"Red",
"(",
")",
"-",
"colour",
".",
"Red",
"(",
")",
"gd",
"=",
"end_colour",
".",
"Green",
"(",
")",
"-",
"colour"... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/aui/aui_utilities.py#L255-L276 | |
HKUST-Aerial-Robotics/Fast-Planner | 2ddd7793eecd573dbb5b47e2c985aa06606df3cf | uav_simulator/Utils/multi_map_server/build/devel/_setup_util.py | python | rollback_env_variables | (environ, env_var_subfolders) | return lines | Generate shell code to reset environment variables
by unrolling modifications based on all workspaces in CMAKE_PREFIX_PATH.
This does not cover modifications performed by environment hooks. | Generate shell code to reset environment variables
by unrolling modifications based on all workspaces in CMAKE_PREFIX_PATH.
This does not cover modifications performed by environment hooks. | [
"Generate",
"shell",
"code",
"to",
"reset",
"environment",
"variables",
"by",
"unrolling",
"modifications",
"based",
"on",
"all",
"workspaces",
"in",
"CMAKE_PREFIX_PATH",
".",
"This",
"does",
"not",
"cover",
"modifications",
"performed",
"by",
"environment",
"hooks"... | def rollback_env_variables(environ, env_var_subfolders):
'''
Generate shell code to reset environment variables
by unrolling modifications based on all workspaces in CMAKE_PREFIX_PATH.
This does not cover modifications performed by environment hooks.
'''
lines = []
unmodified_environ = copy.... | [
"def",
"rollback_env_variables",
"(",
"environ",
",",
"env_var_subfolders",
")",
":",
"lines",
"=",
"[",
"]",
"unmodified_environ",
"=",
"copy",
".",
"copy",
"(",
"environ",
")",
"for",
"key",
"in",
"sorted",
"(",
"env_var_subfolders",
".",
"keys",
"(",
")",... | https://github.com/HKUST-Aerial-Robotics/Fast-Planner/blob/2ddd7793eecd573dbb5b47e2c985aa06606df3cf/uav_simulator/Utils/multi_map_server/build/devel/_setup_util.py#L62-L81 | |
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2class.py | python | catalogAdd | (type, orig, replace) | return ret | Add an entry in the catalog, it may overwrite existing but
different entries. If called before any other catalog
routine, allows to override the default shared catalog put
in place by xmlInitializeCatalog(); | Add an entry in the catalog, it may overwrite existing but
different entries. If called before any other catalog
routine, allows to override the default shared catalog put
in place by xmlInitializeCatalog(); | [
"Add",
"an",
"entry",
"in",
"the",
"catalog",
"it",
"may",
"overwrite",
"existing",
"but",
"different",
"entries",
".",
"If",
"called",
"before",
"any",
"other",
"catalog",
"routine",
"allows",
"to",
"override",
"the",
"default",
"shared",
"catalog",
"put",
... | def catalogAdd(type, orig, replace):
"""Add an entry in the catalog, it may overwrite existing but
different entries. If called before any other catalog
routine, allows to override the default shared catalog put
in place by xmlInitializeCatalog(); """
ret = libxml2mod.xmlCatalogAdd(type, orig... | [
"def",
"catalogAdd",
"(",
"type",
",",
"orig",
",",
"replace",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlCatalogAdd",
"(",
"type",
",",
"orig",
",",
"replace",
")",
"return",
"ret"
] | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2class.py#L117-L123 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py3/numpy/core/einsumfunc.py | python | _update_other_results | (results, best) | return mod_results | Update the positions and provisional input_sets of ``results`` based on
performing the contraction result ``best``. Remove any involving the tensors
contracted.
Parameters
----------
results : list
List of contraction results produced by ``_parse_possible_contraction``.
best : list
... | Update the positions and provisional input_sets of ``results`` based on
performing the contraction result ``best``. Remove any involving the tensors
contracted. | [
"Update",
"the",
"positions",
"and",
"provisional",
"input_sets",
"of",
"results",
"based",
"on",
"performing",
"the",
"contraction",
"result",
"best",
".",
"Remove",
"any",
"involving",
"the",
"tensors",
"contracted",
"."
] | def _update_other_results(results, best):
"""Update the positions and provisional input_sets of ``results`` based on
performing the contraction result ``best``. Remove any involving the tensors
contracted.
Parameters
----------
results : list
List of contraction results produced by ``_p... | [
"def",
"_update_other_results",
"(",
"results",
",",
"best",
")",
":",
"best_con",
"=",
"best",
"[",
"1",
"]",
"bx",
",",
"by",
"=",
"best_con",
"mod_results",
"=",
"[",
"]",
"for",
"cost",
",",
"(",
"x",
",",
"y",
")",
",",
"con_sets",
"in",
"resu... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py3/numpy/core/einsumfunc.py#L273-L310 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_controls.py | python | DatePickerCtrl.Create | (*args, **kwargs) | return _controls_.DatePickerCtrl_Create(*args, **kwargs) | Create(self, Window parent, int id=-1, DateTime dt=wxDefaultDateTime,
Point pos=DefaultPosition, Size size=DefaultSize,
long style=wxDP_DEFAULT|wxDP_SHOWCENTURY,
Validator validator=DefaultValidator,
String name=DatePickerCtrlNameStr) -> bool
Create the GUI p... | Create(self, Window parent, int id=-1, DateTime dt=wxDefaultDateTime,
Point pos=DefaultPosition, Size size=DefaultSize,
long style=wxDP_DEFAULT|wxDP_SHOWCENTURY,
Validator validator=DefaultValidator,
String name=DatePickerCtrlNameStr) -> bool | [
"Create",
"(",
"self",
"Window",
"parent",
"int",
"id",
"=",
"-",
"1",
"DateTime",
"dt",
"=",
"wxDefaultDateTime",
"Point",
"pos",
"=",
"DefaultPosition",
"Size",
"size",
"=",
"DefaultSize",
"long",
"style",
"=",
"wxDP_DEFAULT|wxDP_SHOWCENTURY",
"Validator",
"va... | def Create(*args, **kwargs):
"""
Create(self, Window parent, int id=-1, DateTime dt=wxDefaultDateTime,
Point pos=DefaultPosition, Size size=DefaultSize,
long style=wxDP_DEFAULT|wxDP_SHOWCENTURY,
Validator validator=DefaultValidator,
String name=DatePic... | [
"def",
"Create",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"DatePickerCtrl_Create",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_controls.py#L6515-L6526 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/propgrid.py | python | PyEnumProperty._SetSelf | (*args, **kwargs) | return _propgrid.PyEnumProperty__SetSelf(*args, **kwargs) | _SetSelf(self, PyObject self) | _SetSelf(self, PyObject self) | [
"_SetSelf",
"(",
"self",
"PyObject",
"self",
")"
] | def _SetSelf(*args, **kwargs):
"""_SetSelf(self, PyObject self)"""
return _propgrid.PyEnumProperty__SetSelf(*args, **kwargs) | [
"def",
"_SetSelf",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PyEnumProperty__SetSelf",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/propgrid.py#L3903-L3905 | |
facebook/ThreatExchange | 31914a51820c73c8a0daffe62ccca29a6e3d359e | api-reference-examples/python/pytx/pytx/common.py | python | Common.new | (cls,
params,
request_dict=False,
retries=None,
headers=None,
proxies=None,
verify=None) | return Broker.post(cls._URL,
params=params,
retries=retries,
headers=headers,
proxies=proxies,
verify=verify) | Submit params to the graph to add an object. We will submit to the
object URL used for creating new objects in the graph. When submitting
new objects you must provide privacy type and privacy members if the
privacy type is something other than visible.
:param params: The parameters to s... | Submit params to the graph to add an object. We will submit to the
object URL used for creating new objects in the graph. When submitting
new objects you must provide privacy type and privacy members if the
privacy type is something other than visible. | [
"Submit",
"params",
"to",
"the",
"graph",
"to",
"add",
"an",
"object",
".",
"We",
"will",
"submit",
"to",
"the",
"object",
"URL",
"used",
"for",
"creating",
"new",
"objects",
"in",
"the",
"graph",
".",
"When",
"submitting",
"new",
"objects",
"you",
"must... | def new(cls,
params,
request_dict=False,
retries=None,
headers=None,
proxies=None,
verify=None):
"""
Submit params to the graph to add an object. We will submit to the
object URL used for creating new objects in the graph. W... | [
"def",
"new",
"(",
"cls",
",",
"params",
",",
"request_dict",
"=",
"False",
",",
"retries",
"=",
"None",
",",
"headers",
"=",
"None",
",",
"proxies",
"=",
"None",
",",
"verify",
"=",
"None",
")",
":",
"if",
"cls",
".",
"__name__",
"!=",
"'ThreatPriva... | https://github.com/facebook/ThreatExchange/blob/31914a51820c73c8a0daffe62ccca29a6e3d359e/api-reference-examples/python/pytx/pytx/common.py#L506-L551 | |
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/external/bazel_tools/third_party/py/gflags/__init__.py | python | DEFINE_integer | (name, default, help, lower_bound=None, upper_bound=None,
flag_values=FLAGS, **args) | Registers a flag whose value must be an integer.
If lower_bound, or upper_bound are set, then this flag must be
within the given range. | Registers a flag whose value must be an integer. | [
"Registers",
"a",
"flag",
"whose",
"value",
"must",
"be",
"an",
"integer",
"."
] | def DEFINE_integer(name, default, help, lower_bound=None, upper_bound=None,
flag_values=FLAGS, **args):
"""Registers a flag whose value must be an integer.
If lower_bound, or upper_bound are set, then this flag must be
within the given range.
"""
parser = IntegerParser(lower_bound, upper_b... | [
"def",
"DEFINE_integer",
"(",
"name",
",",
"default",
",",
"help",
",",
"lower_bound",
"=",
"None",
",",
"upper_bound",
"=",
"None",
",",
"flag_values",
"=",
"FLAGS",
",",
"*",
"*",
"args",
")",
":",
"parser",
"=",
"IntegerParser",
"(",
"lower_bound",
",... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/external/bazel_tools/third_party/py/gflags/__init__.py#L2569-L2579 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/resample.py | python | _GroupByMixin._apply | (self, f, grouper=None, *args, **kwargs) | return self._wrap_result(result) | Dispatch to _upsample; we are stripping all of the _upsample kwargs and
performing the original function call on the grouped object. | Dispatch to _upsample; we are stripping all of the _upsample kwargs and
performing the original function call on the grouped object. | [
"Dispatch",
"to",
"_upsample",
";",
"we",
"are",
"stripping",
"all",
"of",
"the",
"_upsample",
"kwargs",
"and",
"performing",
"the",
"original",
"function",
"call",
"on",
"the",
"grouped",
"object",
"."
] | def _apply(self, f, grouper=None, *args, **kwargs):
"""
Dispatch to _upsample; we are stripping all of the _upsample kwargs and
performing the original function call on the grouped object.
"""
def func(x):
x = self._shallow_copy(x, groupby=self.groupby)
... | [
"def",
"_apply",
"(",
"self",
",",
"f",
",",
"grouper",
"=",
"None",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"func",
"(",
"x",
")",
":",
"x",
"=",
"self",
".",
"_shallow_copy",
"(",
"x",
",",
"groupby",
"=",
"self",
".",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/resample.py#L954-L969 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/richtext.py | python | TextAttrDimensionConverter.ConvertPixelsToTenthsMM | (*args, **kwargs) | return _richtext.TextAttrDimensionConverter_ConvertPixelsToTenthsMM(*args, **kwargs) | ConvertPixelsToTenthsMM(self, int pixels) -> int | ConvertPixelsToTenthsMM(self, int pixels) -> int | [
"ConvertPixelsToTenthsMM",
"(",
"self",
"int",
"pixels",
")",
"-",
">",
"int"
] | def ConvertPixelsToTenthsMM(*args, **kwargs):
"""ConvertPixelsToTenthsMM(self, int pixels) -> int"""
return _richtext.TextAttrDimensionConverter_ConvertPixelsToTenthsMM(*args, **kwargs) | [
"def",
"ConvertPixelsToTenthsMM",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"TextAttrDimensionConverter_ConvertPixelsToTenthsMM",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/richtext.py#L282-L284 | |
PaddlePaddle/Anakin | 5fd68a6cc4c4620cd1a30794c1bf06eebd3f4730 | tools/external_converter_v2/parser/tensorflow/med_graph.py | python | MedGraphUtil.search_output_list | (graph) | return list(output_list) | search output list in recursive method
:param graph:
:return: | search output list in recursive method
:param graph:
:return: | [
"search",
"output",
"list",
"in",
"recursive",
"method",
":",
"param",
"graph",
":",
":",
"return",
":"
] | def search_output_list(graph):
'''
search output list in recursive method
:param graph:
:return:
'''
output_list = set()
graph_cp = graph.copy()
def recursive_search(node):
if node.get('out_search_flag') is not None:
return set... | [
"def",
"search_output_list",
"(",
"graph",
")",
":",
"output_list",
"=",
"set",
"(",
")",
"graph_cp",
"=",
"graph",
".",
"copy",
"(",
")",
"def",
"recursive_search",
"(",
"node",
")",
":",
"if",
"node",
".",
"get",
"(",
"'out_search_flag'",
")",
"is",
... | https://github.com/PaddlePaddle/Anakin/blob/5fd68a6cc4c4620cd1a30794c1bf06eebd3f4730/tools/external_converter_v2/parser/tensorflow/med_graph.py#L304-L328 | |
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | python/mozversioncontrol/mozversioncontrol/__init__.py | python | get_hg_version | (hg) | return StrictVersion(match.group(1)) | Obtain the version of the Mercurial client. | Obtain the version of the Mercurial client. | [
"Obtain",
"the",
"version",
"of",
"the",
"Mercurial",
"client",
"."
] | def get_hg_version(hg):
"""Obtain the version of the Mercurial client."""
env = os.environ.copy()
env[b'HGPLAIN'] = b'1'
info = subprocess.check_output([hg, 'version'], env=env)
match = re.search('version ([^\+\)]+)', info)
if not match:
raise Exception('Unable to identify Mercurial ve... | [
"def",
"get_hg_version",
"(",
"hg",
")",
":",
"env",
"=",
"os",
".",
"environ",
".",
"copy",
"(",
")",
"env",
"[",
"b'HGPLAIN'",
"]",
"=",
"b'1'",
"info",
"=",
"subprocess",
".",
"check_output",
"(",
"[",
"hg",
",",
"'version'",
"]",
",",
"env",
"=... | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/python/mozversioncontrol/mozversioncontrol/__init__.py#L13-L24 | |
flexflow/FlexFlow | 581fad8ba8d10a16a3102ee2b406b0319586df24 | python/flexflow/core/flexflow_cffi.py | python | FFModel.gelu | (self, input, inplace=True, name=None) | return Tensor(handle, owner_op_type=OpType.GELU) | Gaussian Error Linear Unit activation function.
:param input: the input Tensor.
:type input: Tensor
:param name: the name of the layer. Default is None.
:type name: string
:returns: Tensor -- the output tensor. | Gaussian Error Linear Unit activation function.
:param input: the input Tensor.
:type input: Tensor
:param name: the name of the layer. Default is None.
:type name: string | [
"Gaussian",
"Error",
"Linear",
"Unit",
"activation",
"function",
".",
":",
"param",
"input",
":",
"the",
"input",
"Tensor",
".",
":",
"type",
"input",
":",
"Tensor",
":",
"param",
"name",
":",
"the",
"name",
"of",
"the",
"layer",
".",
"Default",
"is",
... | def gelu(self, input, inplace=True, name=None):
"""Gaussian Error Linear Unit activation function.
:param input: the input Tensor.
:type input: Tensor
:param name: the name of the layer. Default is None.
:type name: string
:returns: Tensor -- the output tensor.
... | [
"def",
"gelu",
"(",
"self",
",",
"input",
",",
"inplace",
"=",
"True",
",",
"name",
"=",
"None",
")",
":",
"c_name",
"=",
"get_c_name",
"(",
"name",
")",
"handle",
"=",
"ffc",
".",
"flexflow_model_add_gelu",
"(",
"self",
".",
"handle",
",",
"input",
... | https://github.com/flexflow/FlexFlow/blob/581fad8ba8d10a16a3102ee2b406b0319586df24/python/flexflow/core/flexflow_cffi.py#L1509-L1523 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/lib-tk/ttk.py | python | _format_elemcreate | (etype, script=False, *args, **kw) | return spec, opts | Formats args and kw according to the given element factory etype. | Formats args and kw according to the given element factory etype. | [
"Formats",
"args",
"and",
"kw",
"according",
"to",
"the",
"given",
"element",
"factory",
"etype",
"."
] | def _format_elemcreate(etype, script=False, *args, **kw):
"""Formats args and kw according to the given element factory etype."""
spec = None
opts = ()
if etype in ("image", "vsapi"):
if etype == "image": # define an element based on an image
# first arg should be the default image n... | [
"def",
"_format_elemcreate",
"(",
"etype",
",",
"script",
"=",
"False",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"spec",
"=",
"None",
"opts",
"=",
"(",
")",
"if",
"etype",
"in",
"(",
"\"image\"",
",",
"\"vsapi\"",
")",
":",
"if",
"etype",
... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/lib-tk/ttk.py#L117-L152 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_internal/utils/logging.py | python | IndentingFormatter.__init__ | (self, *args, **kwargs) | A logging.Formatter that obeys the indent_log() context manager.
:param add_timestamp: A bool indicating output lines should be prefixed
with their record's timestamp. | [] | def __init__(self, *args, **kwargs):
"""
A logging.Formatter that obeys the indent_log() context manager.
:param add_timestamp: A bool indicating output lines should be prefixed
with their record's timestamp.
"""
self.add_timestamp = kwargs.pop("add_timestamp"... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"add_timestamp",
"=",
"kwargs",
".",
"pop",
"(",
"\"add_timestamp\"",
",",
"False",
")",
"super",
"(",
")",
".",
"__init__",
"(",
"*",
"args",
",",
"*... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_internal/utils/logging.py#L171-L187 | |||
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/contrib/distributions/python/ops/student_t.py | python | StudentT.__init__ | (self,
df,
mu,
sigma,
validate_args=True,
allow_nan_stats=False,
name="StudentT") | Construct Student's t distributions.
The distributions have degree of freedom `df`, mean `mu`, and scale `sigma`.
The parameters `df`, `mu`, and `sigma` must be shaped in a way that supports
broadcasting (e.g. `df + mu + sigma` is a valid operation).
Args:
df: Floating point tensor, the degrees... | Construct Student's t distributions. | [
"Construct",
"Student",
"s",
"t",
"distributions",
"."
] | def __init__(self,
df,
mu,
sigma,
validate_args=True,
allow_nan_stats=False,
name="StudentT"):
"""Construct Student's t distributions.
The distributions have degree of freedom `df`, mean `mu`, and scale `sigma`.
The ... | [
"def",
"__init__",
"(",
"self",
",",
"df",
",",
"mu",
",",
"sigma",
",",
"validate_args",
"=",
"True",
",",
"allow_nan_stats",
"=",
"False",
",",
"name",
"=",
"\"StudentT\"",
")",
":",
"self",
".",
"_allow_nan_stats",
"=",
"allow_nan_stats",
"self",
".",
... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/contrib/distributions/python/ops/student_t.py#L88-L133 | ||
HackWebRTC/webrtc | 7abfc990c00ab35090fff285fcf635d1d7892433 | tools_webrtc/gn_check_autofix.py | python | Rebase | (base_path, dependency_path, dependency) | return rebased + ':' + dependency | Adapt paths so they work both in stand-alone WebRTC and Chromium tree.
To cope with varying top-level directory (WebRTC VS Chromium), we use:
* relative paths for WebRTC modules.
* absolute paths for shared ones.
E.g. '//common_audio/...' -> '../../common_audio/'
'//third_party/...' remains as is.
... | Adapt paths so they work both in stand-alone WebRTC and Chromium tree. | [
"Adapt",
"paths",
"so",
"they",
"work",
"both",
"in",
"stand",
"-",
"alone",
"WebRTC",
"and",
"Chromium",
"tree",
"."
] | def Rebase(base_path, dependency_path, dependency):
"""Adapt paths so they work both in stand-alone WebRTC and Chromium tree.
To cope with varying top-level directory (WebRTC VS Chromium), we use:
* relative paths for WebRTC modules.
* absolute paths for shared ones.
E.g. '//common_audio/...' -> '../../c... | [
"def",
"Rebase",
"(",
"base_path",
",",
"dependency_path",
",",
"dependency",
")",
":",
"root",
"=",
"FirstNonEmpty",
"(",
"dependency_path",
".",
"split",
"(",
"'/'",
")",
")",
"if",
"root",
"in",
"CHROMIUM_DIRS",
":",
"# Chromium paths must remain absolute. E.g.... | https://github.com/HackWebRTC/webrtc/blob/7abfc990c00ab35090fff285fcf635d1d7892433/tools_webrtc/gn_check_autofix.py#L98-L135 | |
google/syzygy | 8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5 | third_party/numpy/files/numpy/polynomial/chebyshev.py | python | chebline | (off, scl) | Chebyshev series whose graph is a straight line.
Parameters
----------
off, scl : scalars
The specified line is given by ``off + scl*x``.
Returns
-------
y : ndarray
This module's representation of the Chebyshev series for
``off + scl*x``.
See Also
--------
... | Chebyshev series whose graph is a straight line. | [
"Chebyshev",
"series",
"whose",
"graph",
"is",
"a",
"straight",
"line",
"."
] | def chebline(off, scl) :
"""
Chebyshev series whose graph is a straight line.
Parameters
----------
off, scl : scalars
The specified line is given by ``off + scl*x``.
Returns
-------
y : ndarray
This module's representation of the Chebyshev series for
``off + ... | [
"def",
"chebline",
"(",
"off",
",",
"scl",
")",
":",
"if",
"scl",
"!=",
"0",
":",
"return",
"np",
".",
"array",
"(",
"[",
"off",
",",
"scl",
"]",
")",
"else",
":",
"return",
"np",
".",
"array",
"(",
"[",
"off",
"]",
")"
] | https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/third_party/numpy/files/numpy/polynomial/chebyshev.py#L437-L470 | ||
keyboardio/Kaleidoscope | d59604e98b2439d108647f15be52984a6837d360 | bin/cpplint.py | python | CheckOperatorSpacing | (filename, clean_lines, linenum, error) | Checks for horizontal spacing around operators.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any errors found. | Checks for horizontal spacing around operators. | [
"Checks",
"for",
"horizontal",
"spacing",
"around",
"operators",
"."
] | def CheckOperatorSpacing(filename, clean_lines, linenum, error):
"""Checks for horizontal spacing around operators.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any... | [
"def",
"CheckOperatorSpacing",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"# Don't try to do spacing checks for operator methods. Do this by",
"# replacing the troublesome cha... | https://github.com/keyboardio/Kaleidoscope/blob/d59604e98b2439d108647f15be52984a6837d360/bin/cpplint.py#L3526-L3638 | ||
clementine-player/Clementine | 111379dfd027802b59125829fcf87e3e1d0ad73b | dist/cpplint.py | python | CheckForCopyright | (filename, lines, error) | Logs an error if no Copyright message appears at the top of the file. | Logs an error if no Copyright message appears at the top of the file. | [
"Logs",
"an",
"error",
"if",
"no",
"Copyright",
"message",
"appears",
"at",
"the",
"top",
"of",
"the",
"file",
"."
] | def CheckForCopyright(filename, lines, error):
"""Logs an error if no Copyright message appears at the top of the file."""
# We'll say it should occur by line 10. Don't forget there's a
# dummy line at the front.
for line in xrange(1, min(len(lines), 11)):
if re.search(r'Copyright', lines[line], re.I): bre... | [
"def",
"CheckForCopyright",
"(",
"filename",
",",
"lines",
",",
"error",
")",
":",
"# We'll say it should occur by line 10. Don't forget there's a",
"# dummy line at the front.",
"for",
"line",
"in",
"xrange",
"(",
"1",
",",
"min",
"(",
"len",
"(",
"lines",
")",
","... | https://github.com/clementine-player/Clementine/blob/111379dfd027802b59125829fcf87e3e1d0ad73b/dist/cpplint.py#L1614-L1624 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/masked/textctrl.py | python | BaseMaskedTextCtrl._ChangeValue | (self, value) | Allow mixin to set the raw value of the control with this function without
generating an event as a result. (New for masked.TextCtrl as of 2.8.4) | Allow mixin to set the raw value of the control with this function without
generating an event as a result. (New for masked.TextCtrl as of 2.8.4) | [
"Allow",
"mixin",
"to",
"set",
"the",
"raw",
"value",
"of",
"the",
"control",
"with",
"this",
"function",
"without",
"generating",
"an",
"event",
"as",
"a",
"result",
".",
"(",
"New",
"for",
"masked",
".",
"TextCtrl",
"as",
"of",
"2",
".",
"8",
".",
... | def _ChangeValue(self, value):
"""
Allow mixin to set the raw value of the control with this function without
generating an event as a result. (New for masked.TextCtrl as of 2.8.4)
"""
## dbg('MaskedTextCtrl::_ChangeValue("%(value)s", use_change_value=%(use_change_value)d)' % loca... | [
"def",
"_ChangeValue",
"(",
"self",
",",
"value",
")",
":",
"## dbg('MaskedTextCtrl::_ChangeValue(\"%(value)s\", use_change_value=%(use_change_value)d)' % locals(), indent=1)",
"# Record current selection and insertion point, for undo",
"self",
".",
"_prevSelection",
"=",
"self",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/masked/textctrl.py#L170-L179 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/Tkinter.py | python | Radiobutton.select | (self) | Put the button in on-state. | Put the button in on-state. | [
"Put",
"the",
"button",
"in",
"on",
"-",
"state",
"."
] | def select(self):
"""Put the button in on-state."""
self.tk.call(self._w, 'select') | [
"def",
"select",
"(",
"self",
")",
":",
"self",
".",
"tk",
".",
"call",
"(",
"self",
".",
"_w",
",",
"'select'",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/Tkinter.py#L2787-L2789 | ||
KhronosGroup/SPIR | f33c27876d9f3d5810162b60fa89cc13d2b55725 | bindings/python/clang/cindex.py | python | Token.location | (self) | return conf.lib.clang_getTokenLocation(self._tu, self) | The SourceLocation this Token occurs at. | The SourceLocation this Token occurs at. | [
"The",
"SourceLocation",
"this",
"Token",
"occurs",
"at",
"."
] | def location(self):
"""The SourceLocation this Token occurs at."""
return conf.lib.clang_getTokenLocation(self._tu, self) | [
"def",
"location",
"(",
"self",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_getTokenLocation",
"(",
"self",
".",
"_tu",
",",
"self",
")"
] | https://github.com/KhronosGroup/SPIR/blob/f33c27876d9f3d5810162b60fa89cc13d2b55725/bindings/python/clang/cindex.py#L2425-L2427 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | build/android/pylib/results/flakiness_dashboard/json_results_generator.py | python | JSONResultsGeneratorBase._InsertItemIntoRawList | (self, results_for_builder, item, key) | Inserts the item into the list with the given key in the results for
this builder. Creates the list if no such list exists.
Args:
results_for_builder: Dictionary containing the test results for a
single builder.
item: Number or string to insert into the list.
key: Key in results_for... | Inserts the item into the list with the given key in the results for
this builder. Creates the list if no such list exists. | [
"Inserts",
"the",
"item",
"into",
"the",
"list",
"with",
"the",
"given",
"key",
"in",
"the",
"results",
"for",
"this",
"builder",
".",
"Creates",
"the",
"list",
"if",
"no",
"such",
"list",
"exists",
"."
] | def _InsertItemIntoRawList(self, results_for_builder, item, key):
"""Inserts the item into the list with the given key in the results for
this builder. Creates the list if no such list exists.
Args:
results_for_builder: Dictionary containing the test results for a
single builder.
item... | [
"def",
"_InsertItemIntoRawList",
"(",
"self",
",",
"results_for_builder",
",",
"item",
",",
"key",
")",
":",
"if",
"key",
"in",
"results_for_builder",
":",
"raw_list",
"=",
"results_for_builder",
"[",
"key",
"]",
"else",
":",
"raw_list",
"=",
"[",
"]",
"raw_... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/build/android/pylib/results/flakiness_dashboard/json_results_generator.py#L439-L456 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_misc.py | python | ArtProvider.GetMessageBoxIconId | (*args, **kwargs) | return _misc_.ArtProvider_GetMessageBoxIconId(*args, **kwargs) | GetMessageBoxIconId(int flags) -> wxArtID | GetMessageBoxIconId(int flags) -> wxArtID | [
"GetMessageBoxIconId",
"(",
"int",
"flags",
")",
"-",
">",
"wxArtID"
] | def GetMessageBoxIconId(*args, **kwargs):
"""GetMessageBoxIconId(int flags) -> wxArtID"""
return _misc_.ArtProvider_GetMessageBoxIconId(*args, **kwargs) | [
"def",
"GetMessageBoxIconId",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"ArtProvider_GetMessageBoxIconId",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_misc.py#L2839-L2841 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_aarch64/python2.7/dist-packages/rosdep2/installers.py | python | InstallerContext.get_os_keys | (self) | return self.os_installers.keys() | :returns: list of OS keys that have registered with this context, ``[str]`` | :returns: list of OS keys that have registered with this context, ``[str]`` | [
":",
"returns",
":",
"list",
"of",
"OS",
"keys",
"that",
"have",
"registered",
"with",
"this",
"context",
"[",
"str",
"]"
] | def get_os_keys(self):
"""
:returns: list of OS keys that have registered with this context, ``[str]``
"""
return self.os_installers.keys() | [
"def",
"get_os_keys",
"(",
"self",
")",
":",
"return",
"self",
".",
"os_installers",
".",
"keys",
"(",
")"
] | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_aarch64/python2.7/dist-packages/rosdep2/installers.py#L161-L165 | |
deepmind/open_spiel | 4ca53bea32bb2875c7385d215424048ae92f78c8 | open_spiel/python/mfg/games/linear_quadratic.py | python | MFGLinearQuadraticState.current_player | (self) | return int(self._player_id) | Returns id of the next player to move, or TERMINAL if game is over. | Returns id of the next player to move, or TERMINAL if game is over. | [
"Returns",
"id",
"of",
"the",
"next",
"player",
"to",
"move",
"or",
"TERMINAL",
"if",
"game",
"is",
"over",
"."
] | def current_player(self):
"""Returns id of the next player to move, or TERMINAL if game is over."""
if self.is_terminal():
return int(pyspiel.PlayerId.TERMINAL)
return int(self._player_id) | [
"def",
"current_player",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_terminal",
"(",
")",
":",
"return",
"int",
"(",
"pyspiel",
".",
"PlayerId",
".",
"TERMINAL",
")",
"return",
"int",
"(",
"self",
".",
"_player_id",
")"
] | https://github.com/deepmind/open_spiel/blob/4ca53bea32bb2875c7385d215424048ae92f78c8/open_spiel/python/mfg/games/linear_quadratic.py#L288-L292 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/calendar.py | python | CalendarCtrlBase.GetHolidayColourBg | (*args, **kwargs) | return _calendar.CalendarCtrlBase_GetHolidayColourBg(*args, **kwargs) | GetHolidayColourBg(self) -> Colour
Holiday colour is used for the holidays (if CAL_SHOW_HOLIDAYS style is
used). | GetHolidayColourBg(self) -> Colour | [
"GetHolidayColourBg",
"(",
"self",
")",
"-",
">",
"Colour"
] | def GetHolidayColourBg(*args, **kwargs):
"""
GetHolidayColourBg(self) -> Colour
Holiday colour is used for the holidays (if CAL_SHOW_HOLIDAYS style is
used).
"""
return _calendar.CalendarCtrlBase_GetHolidayColourBg(*args, **kwargs) | [
"def",
"GetHolidayColourBg",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_calendar",
".",
"CalendarCtrlBase_GetHolidayColourBg",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/calendar.py#L378-L385 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/ros_comm/roslaunch/src/roslaunch/launch.py | python | ROSLaunchRunner._launch_master | (self) | Launches master if requested.
@raise RLException: if master launch fails | Launches master if requested. | [
"Launches",
"master",
"if",
"requested",
"."
] | def _launch_master(self):
"""
Launches master if requested.
@raise RLException: if master launch fails
"""
m = self.config.master
is_running = m.is_running()
if self.is_core and is_running:
raise RLException("roscore cannot run as another roscore/mas... | [
"def",
"_launch_master",
"(",
"self",
")",
":",
"m",
"=",
"self",
".",
"config",
".",
"master",
"is_running",
"=",
"m",
".",
"is_running",
"(",
")",
"if",
"self",
".",
"is_core",
"and",
"is_running",
":",
"raise",
"RLException",
"(",
"\"roscore cannot run ... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/ros_comm/roslaunch/src/roslaunch/launch.py#L382-L427 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py3/IPython/core/oinspect.py | python | call_tip | (oinfo, format_call=True) | return call_line, doc | DEPRECATED. Extract call tip data from an oinfo dict. | DEPRECATED. Extract call tip data from an oinfo dict. | [
"DEPRECATED",
".",
"Extract",
"call",
"tip",
"data",
"from",
"an",
"oinfo",
"dict",
"."
] | def call_tip(oinfo, format_call=True):
"""DEPRECATED. Extract call tip data from an oinfo dict.
"""
warnings.warn('`call_tip` function is deprecated as of IPython 6.0'
'and will be removed in future versions.', DeprecationWarning, stacklevel=2)
# Get call definition
argspec = oinfo... | [
"def",
"call_tip",
"(",
"oinfo",
",",
"format_call",
"=",
"True",
")",
":",
"warnings",
".",
"warn",
"(",
"'`call_tip` function is deprecated as of IPython 6.0'",
"'and will be removed in future versions.'",
",",
"DeprecationWarning",
",",
"stacklevel",
"=",
"2",
")",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py3/IPython/core/oinspect.py#L236-L267 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_core.py | python | TextEntryBase.Clear | (*args, **kwargs) | return _core_.TextEntryBase_Clear(*args, **kwargs) | Clear(self)
Clear all text from the text field | Clear(self) | [
"Clear",
"(",
"self",
")"
] | def Clear(*args, **kwargs):
"""
Clear(self)
Clear all text from the text field
"""
return _core_.TextEntryBase_Clear(*args, **kwargs) | [
"def",
"Clear",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"TextEntryBase_Clear",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_core.py#L13148-L13154 | |
intel/caffe | 3f494b442ee3f9d17a07b09ecbd5fa2bbda00836 | examples/rfcn/tools/train_faster_rcnn_alt_opt.py | python | rpn_generate | (queue=None, imdb_name=None, rpn_model_path=None, cfg=None,
rpn_test_prototxt=None) | Use a trained RPN to generate proposals. | Use a trained RPN to generate proposals. | [
"Use",
"a",
"trained",
"RPN",
"to",
"generate",
"proposals",
"."
] | def rpn_generate(queue=None, imdb_name=None, rpn_model_path=None, cfg=None,
rpn_test_prototxt=None):
"""Use a trained RPN to generate proposals.
"""
cfg.TEST.RPN_PRE_NMS_TOP_N = -1 # no pre NMS filtering
cfg.TEST.RPN_POST_NMS_TOP_N = 2000 # limit top boxes after NMS
print 'RPN... | [
"def",
"rpn_generate",
"(",
"queue",
"=",
"None",
",",
"imdb_name",
"=",
"None",
",",
"rpn_model_path",
"=",
"None",
",",
"cfg",
"=",
"None",
",",
"rpn_test_prototxt",
"=",
"None",
")",
":",
"cfg",
".",
"TEST",
".",
"RPN_PRE_NMS_TOP_N",
"=",
"-",
"1",
... | https://github.com/intel/caffe/blob/3f494b442ee3f9d17a07b09ecbd5fa2bbda00836/examples/rfcn/tools/train_faster_rcnn_alt_opt.py#L137-L171 | ||
facebookincubator/BOLT | 88c70afe9d388ad430cc150cc158641701397f70 | libcxx/utils/gdb/libcxx/printers.py | python | AbstractRBTreePrinter._get_key_value | (self, node) | Subclasses should override to return a list of values to yield. | Subclasses should override to return a list of values to yield. | [
"Subclasses",
"should",
"override",
"to",
"return",
"a",
"list",
"of",
"values",
"to",
"yield",
"."
] | def _get_key_value(self, node):
"""Subclasses should override to return a list of values to yield."""
raise NotImplementedError | [
"def",
"_get_key_value",
"(",
"self",
",",
"node",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/facebookincubator/BOLT/blob/88c70afe9d388ad430cc150cc158641701397f70/libcxx/utils/gdb/libcxx/printers.py#L636-L638 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/AWS/common-code/lib/six.py | python | add_metaclass | (metaclass) | return wrapper | Class decorator for creating a class with a metaclass. | Class decorator for creating a class with a metaclass. | [
"Class",
"decorator",
"for",
"creating",
"a",
"class",
"with",
"a",
"metaclass",
"."
] | def add_metaclass(metaclass):
"""Class decorator for creating a class with a metaclass."""
def wrapper(cls):
orig_vars = cls.__dict__.copy()
slots = orig_vars.get('__slots__')
if slots is not None:
if isinstance(slots, str):
slots = [slots]
for slo... | [
"def",
"add_metaclass",
"(",
"metaclass",
")",
":",
"def",
"wrapper",
"(",
"cls",
")",
":",
"orig_vars",
"=",
"cls",
".",
"__dict__",
".",
"copy",
"(",
")",
"slots",
"=",
"orig_vars",
".",
"get",
"(",
"'__slots__'",
")",
"if",
"slots",
"is",
"not",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/common-code/lib/six.py#L864-L879 | |
PlatformLab/Arachne | e67391471007174dd4002dc2c160628e19c284e8 | scripts/cpplint.py | python | CleansedLines.NumLines | (self) | return self.num_lines | Returns the number of lines represented. | Returns the number of lines represented. | [
"Returns",
"the",
"number",
"of",
"lines",
"represented",
"."
] | def NumLines(self):
"""Returns the number of lines represented."""
return self.num_lines | [
"def",
"NumLines",
"(",
"self",
")",
":",
"return",
"self",
".",
"num_lines"
] | https://github.com/PlatformLab/Arachne/blob/e67391471007174dd4002dc2c160628e19c284e8/scripts/cpplint.py#L1420-L1422 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | native_client_sdk/src/build_tools/manifest_util.py | python | SDKManifest.RemoveBundle | (self, name) | return False | Remove a bundle by name.
Args:
name: the name of the bundle to remove.
Return:
True if the bundle was removed, False if there is no bundle with that
name. | Remove a bundle by name. | [
"Remove",
"a",
"bundle",
"by",
"name",
"."
] | def RemoveBundle(self, name):
"""Remove a bundle by name.
Args:
name: the name of the bundle to remove.
Return:
True if the bundle was removed, False if there is no bundle with that
name.
"""
if not BUNDLES_KEY in self._manifest_data:
return False
bundles = self._manifes... | [
"def",
"RemoveBundle",
"(",
"self",
",",
"name",
")",
":",
"if",
"not",
"BUNDLES_KEY",
"in",
"self",
".",
"_manifest_data",
":",
"return",
"False",
"bundles",
"=",
"self",
".",
"_manifest_data",
"[",
"BUNDLES_KEY",
"]",
"for",
"i",
",",
"bundle",
"in",
"... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/native_client_sdk/src/build_tools/manifest_util.py#L479-L495 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_gdi.py | python | DC.GetSizeMMTuple | (*args, **kwargs) | return _gdi_.DC_GetSizeMMTuple(*args, **kwargs) | GetSizeMMTuple() -> (width, height)
Get the DC size in milimeters. | GetSizeMMTuple() -> (width, height) | [
"GetSizeMMTuple",
"()",
"-",
">",
"(",
"width",
"height",
")"
] | def GetSizeMMTuple(*args, **kwargs):
"""
GetSizeMMTuple() -> (width, height)
Get the DC size in milimeters.
"""
return _gdi_.DC_GetSizeMMTuple(*args, **kwargs) | [
"def",
"GetSizeMMTuple",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"DC_GetSizeMMTuple",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_gdi.py#L4199-L4205 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/mapreduce/mapreduce/context.py | python | _ItemList.should_flush | (self) | return len(self.items) >= self.__max_entity_count | Whether to flush before append the next entity.
Returns:
True to flush. False other. | Whether to flush before append the next entity. | [
"Whether",
"to",
"flush",
"before",
"append",
"the",
"next",
"entity",
"."
] | def should_flush(self):
"""Whether to flush before append the next entity.
Returns:
True to flush. False other.
"""
return len(self.items) >= self.__max_entity_count | [
"def",
"should_flush",
"(",
"self",
")",
":",
"return",
"len",
"(",
"self",
".",
"items",
")",
">=",
"self",
".",
"__max_entity_count"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/mapreduce/mapreduce/context.py#L187-L193 | |
nasa/fprime | 595cf3682d8365943d86c1a6fe7c78f0a116acf0 | Autocoders/Python/src/fprime_ac/generators/writers/InstChannelWriter.py | python | InstChannelWriter.__init__ | (self) | Constructor. | Constructor. | [
"Constructor",
"."
] | def __init__(self):
"""
Constructor.
"""
super().__init__(None)
self.__config = ConfigManager.ConfigManager.getInstance()
self.__form = formatters.Formatters.getInstance()
self.__form_comment = formatters.CommentFormatters()
DEBUG.info("InstChannelWriter: ... | [
"def",
"__init__",
"(",
"self",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"None",
")",
"self",
".",
"__config",
"=",
"ConfigManager",
".",
"ConfigManager",
".",
"getInstance",
"(",
")",
"self",
".",
"__form",
"=",
"formatters",
".",
"Formatters"... | https://github.com/nasa/fprime/blob/595cf3682d8365943d86c1a6fe7c78f0a116acf0/Autocoders/Python/src/fprime_ac/generators/writers/InstChannelWriter.py#L64-L74 | ||
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/node-10.15.3/tools/gyp/pylib/gyp/MSVSSettings.py | python | FixVCMacroSlashes | (s) | return s | Replace macros which have excessive following slashes.
These macros are known to have a built-in trailing slash. Furthermore, many
scripts hiccup on processing paths with extra slashes in the middle.
This list is probably not exhaustive. Add as needed. | Replace macros which have excessive following slashes. | [
"Replace",
"macros",
"which",
"have",
"excessive",
"following",
"slashes",
"."
] | def FixVCMacroSlashes(s):
"""Replace macros which have excessive following slashes.
These macros are known to have a built-in trailing slash. Furthermore, many
scripts hiccup on processing paths with extra slashes in the middle.
This list is probably not exhaustive. Add as needed.
"""
if '$' in s:
s ... | [
"def",
"FixVCMacroSlashes",
"(",
"s",
")",
":",
"if",
"'$'",
"in",
"s",
":",
"s",
"=",
"fix_vc_macro_slashes_regex",
".",
"sub",
"(",
"r'\\1'",
",",
"s",
")",
"return",
"s"
] | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/node-10.15.3/tools/gyp/pylib/gyp/MSVSSettings.py#L406-L416 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/scipy/special/basic.py | python | kerp_zeros | (nt) | return specfun.klvnzo(nt, 7) | Compute nt zeros of the Kelvin function ker'(x).
References
----------
.. [1] Zhang, Shanjie and Jin, Jianming. "Computation of Special
Functions", John Wiley and Sons, 1996.
http://jin.ece.illinois.edu/specfunc.html | Compute nt zeros of the Kelvin function ker'(x). | [
"Compute",
"nt",
"zeros",
"of",
"the",
"Kelvin",
"function",
"ker",
"(",
"x",
")",
"."
] | def kerp_zeros(nt):
"""Compute nt zeros of the Kelvin function ker'(x).
References
----------
.. [1] Zhang, Shanjie and Jin, Jianming. "Computation of Special
Functions", John Wiley and Sons, 1996.
http://jin.ece.illinois.edu/specfunc.html
"""
if not isscalar(nt) or (floo... | [
"def",
"kerp_zeros",
"(",
"nt",
")",
":",
"if",
"not",
"isscalar",
"(",
"nt",
")",
"or",
"(",
"floor",
"(",
"nt",
")",
"!=",
"nt",
")",
"or",
"(",
"nt",
"<=",
"0",
")",
":",
"raise",
"ValueError",
"(",
"\"nt must be positive integer scalar.\"",
")",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/scipy/special/basic.py#L1967-L1979 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/requests/sessions.py | python | Session.get | (self, url, **kwargs) | return self.request('GET', url, **kwargs) | r"""Sends a GET request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:rtype: requests.Response | r"""Sends a GET request. Returns :class:`Response` object. | [
"r",
"Sends",
"a",
"GET",
"request",
".",
"Returns",
":",
"class",
":",
"Response",
"object",
"."
] | def get(self, url, **kwargs):
r"""Sends a GET request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:rtype: requests.Response
"""
kwargs.setdefault('allow_redirects',... | [
"def",
"get",
"(",
"self",
",",
"url",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
".",
"setdefault",
"(",
"'allow_redirects'",
",",
"True",
")",
"return",
"self",
".",
"request",
"(",
"'GET'",
",",
"url",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/requests/sessions.py#L546-L555 | |
ROCmSoftwarePlatform/hipCaffe | 4ec5d482515cce532348553b6db6d00d015675d5 | python/caffe/pycaffe.py | python | _Net_blobs | (self) | return self._blobs_dict | An OrderedDict (bottom to top, i.e., input to output) of network
blobs indexed by name | An OrderedDict (bottom to top, i.e., input to output) of network
blobs indexed by name | [
"An",
"OrderedDict",
"(",
"bottom",
"to",
"top",
"i",
".",
"e",
".",
"input",
"to",
"output",
")",
"of",
"network",
"blobs",
"indexed",
"by",
"name"
] | def _Net_blobs(self):
"""
An OrderedDict (bottom to top, i.e., input to output) of network
blobs indexed by name
"""
if not hasattr(self, '_blobs_dict'):
self._blobs_dict = OrderedDict(zip(self._blob_names, self._blobs))
return self._blobs_dict | [
"def",
"_Net_blobs",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'_blobs_dict'",
")",
":",
"self",
".",
"_blobs_dict",
"=",
"OrderedDict",
"(",
"zip",
"(",
"self",
".",
"_blob_names",
",",
"self",
".",
"_blobs",
")",
")",
"return"... | https://github.com/ROCmSoftwarePlatform/hipCaffe/blob/4ec5d482515cce532348553b6db6d00d015675d5/python/caffe/pycaffe.py#L25-L32 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/distutils/command/install_egg_info.py | python | to_filename | (name) | return name.replace('-','_') | Convert a project or version name to its filename-escaped form
Any '-' characters are currently replaced with '_'. | Convert a project or version name to its filename-escaped form | [
"Convert",
"a",
"project",
"or",
"version",
"name",
"to",
"its",
"filename",
"-",
"escaped",
"form"
] | def to_filename(name):
"""Convert a project or version name to its filename-escaped form
Any '-' characters are currently replaced with '_'.
"""
return name.replace('-','_') | [
"def",
"to_filename",
"(",
"name",
")",
":",
"return",
"name",
".",
"replace",
"(",
"'-'",
",",
"'_'",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/distutils/command/install_egg_info.py#L73-L78 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/maximum-erasure-value.py | python | Solution.maximumUniqueSubarray | (self, nums) | return result | :type nums: List[int]
:rtype: int | :type nums: List[int]
:rtype: int | [
":",
"type",
"nums",
":",
"List",
"[",
"int",
"]",
":",
"rtype",
":",
"int"
] | def maximumUniqueSubarray(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
lookup = {}
prefix = [0]*(len(nums)+1)
result, left = 0, 0
for right, num in enumerate(nums):
prefix[right+1] = prefix[right]+num
if num in lookup:
... | [
"def",
"maximumUniqueSubarray",
"(",
"self",
",",
"nums",
")",
":",
"lookup",
"=",
"{",
"}",
"prefix",
"=",
"[",
"0",
"]",
"*",
"(",
"len",
"(",
"nums",
")",
"+",
"1",
")",
"result",
",",
"left",
"=",
"0",
",",
"0",
"for",
"right",
",",
"num",
... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/maximum-erasure-value.py#L5-L19 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_core.py | python | Sizer.PrependSpacer | (self, *args, **kw) | PrependSpacer(int size) --> SizerItem
Prepend a spacer that is (size, size) pixels. | PrependSpacer(int size) --> SizerItem | [
"PrependSpacer",
"(",
"int",
"size",
")",
"--",
">",
"SizerItem"
] | def PrependSpacer(self, *args, **kw):
"""PrependSpacer(int size) --> SizerItem
Prepend a spacer that is (size, size) pixels."""
if args and type(args[0]) == int:
return self.Prepend( (args[0],args[0] ), 0)
else: # otherwise stay compatible with old PrependSpacer
... | [
"def",
"PrependSpacer",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"if",
"args",
"and",
"type",
"(",
"args",
"[",
"0",
"]",
")",
"==",
"int",
":",
"return",
"self",
".",
"Prepend",
"(",
"(",
"args",
"[",
"0",
"]",
",",
"arg... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_core.py#L14681-L14688 | ||
psi4/psi4 | be533f7f426b6ccc263904e55122899b16663395 | psi4/driver/procrouting/diis.py | python | DIIS.copier | (self, x, new_name: str) | return copy | Copy the object x and give it a new_name. Save it to disk if needed. | Copy the object x and give it a new_name. Save it to disk if needed. | [
"Copy",
"the",
"object",
"x",
"and",
"give",
"it",
"a",
"new_name",
".",
"Save",
"it",
"to",
"disk",
"if",
"needed",
"."
] | def copier(self, x, new_name: str):
""" Copy the object x and give it a new_name. Save it to disk if needed. """
if isinstance(x, (core.Matrix, core.Vector)):
copy = x.clone()
elif isinstance(x, (core.dpdbuf4, core.dpdfile2)):
copy = core.Matrix(x)
elif isinstance... | [
"def",
"copier",
"(",
"self",
",",
"x",
",",
"new_name",
":",
"str",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"(",
"core",
".",
"Matrix",
",",
"core",
".",
"Vector",
")",
")",
":",
"copy",
"=",
"x",
".",
"clone",
"(",
")",
"elif",
"isinstan... | https://github.com/psi4/psi4/blob/be533f7f426b6ccc263904e55122899b16663395/psi4/driver/procrouting/diis.py#L101-L122 | |
klzgrad/naiveproxy | ed2c513637c77b18721fe428d7ed395b4d284c83 | src/build/android/gyp/util/build_utils.py | python | ExpandFileArgs | (args) | return new_args | Replaces file-arg placeholders in args.
These placeholders have the form:
@FileArg(filename:key1:key2:...:keyn)
The value of such a placeholder is calculated by reading 'filename' as json.
And then extracting the value at [key1][key2]...[keyn]. If a key has a '[]'
suffix the (intermediate) value will be i... | Replaces file-arg placeholders in args. | [
"Replaces",
"file",
"-",
"arg",
"placeholders",
"in",
"args",
"."
] | def ExpandFileArgs(args):
"""Replaces file-arg placeholders in args.
These placeholders have the form:
@FileArg(filename:key1:key2:...:keyn)
The value of such a placeholder is calculated by reading 'filename' as json.
And then extracting the value at [key1][key2]...[keyn]. If a key has a '[]'
suffix the... | [
"def",
"ExpandFileArgs",
"(",
"args",
")",
":",
"new_args",
"=",
"list",
"(",
"args",
")",
"file_jsons",
"=",
"dict",
"(",
")",
"r",
"=",
"re",
".",
"compile",
"(",
"'@FileArg\\((.*?)\\)'",
")",
"for",
"i",
",",
"arg",
"in",
"enumerate",
"(",
"args",
... | https://github.com/klzgrad/naiveproxy/blob/ed2c513637c77b18721fe428d7ed395b4d284c83/src/build/android/gyp/util/build_utils.py#L662-L714 | |
microsoft/ivy | 9f3c7ecc0b2383129fdd0953e10890d98d09a82d | ivy/ivy_cpp.py | python | add_local | (code) | Adds code to the current local context. | Adds code to the current local context. | [
"Adds",
"code",
"to",
"the",
"current",
"local",
"context",
"."
] | def add_local(code):
""" Adds code to the current local context. """
context.locals.write(code) | [
"def",
"add_local",
"(",
"code",
")",
":",
"context",
".",
"locals",
".",
"write",
"(",
"code",
")"
] | https://github.com/microsoft/ivy/blob/9f3c7ecc0b2383129fdd0953e10890d98d09a82d/ivy/ivy_cpp.py#L129-L131 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/ConfigParser.py | python | RawConfigParser.set | (self, section, option, value=None) | Set an option. | Set an option. | [
"Set",
"an",
"option",
"."
] | def set(self, section, option, value=None):
"""Set an option."""
if not section or section == DEFAULTSECT:
sectdict = self._defaults
else:
try:
sectdict = self._sections[section]
except KeyError:
raise NoSectionError(section)
... | [
"def",
"set",
"(",
"self",
",",
"section",
",",
"option",
",",
"value",
"=",
"None",
")",
":",
"if",
"not",
"section",
"or",
"section",
"==",
"DEFAULTSECT",
":",
"sectdict",
"=",
"self",
".",
"_defaults",
"else",
":",
"try",
":",
"sectdict",
"=",
"se... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/ConfigParser.py#L388-L397 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/ops/math_ops.py | python | truediv | (x, y, name=None) | return _truediv_python3(x, y, name) | Divides x / y elementwise (using Python 3 division operator semantics).
NOTE: Prefer using the Tensor operator or tf.divide which obey Python
division operator semantics.
This function forces Python 3 division operator semantics where all integer
arguments are cast to floating types first. This op is genera... | Divides x / y elementwise (using Python 3 division operator semantics). | [
"Divides",
"x",
"/",
"y",
"elementwise",
"(",
"using",
"Python",
"3",
"division",
"operator",
"semantics",
")",
"."
] | def truediv(x, y, name=None):
"""Divides x / y elementwise (using Python 3 division operator semantics).
NOTE: Prefer using the Tensor operator or tf.divide which obey Python
division operator semantics.
This function forces Python 3 division operator semantics where all integer
arguments are cast to floati... | [
"def",
"truediv",
"(",
"x",
",",
"y",
",",
"name",
"=",
"None",
")",
":",
"return",
"_truediv_python3",
"(",
"x",
",",
"y",
",",
"name",
")"
] | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/ops/math_ops.py#L988-L1016 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/ftplib.py | python | FTP.abort | (self) | Abort a file transfer. Uses out-of-band data.
This does not follow the procedure from the RFC to send Telnet
IP and Synch; that doesn't seem to work with the servers I've
tried. Instead, just send the ABOR command as OOB data. | Abort a file transfer. Uses out-of-band data.
This does not follow the procedure from the RFC to send Telnet
IP and Synch; that doesn't seem to work with the servers I've
tried. Instead, just send the ABOR command as OOB data. | [
"Abort",
"a",
"file",
"transfer",
".",
"Uses",
"out",
"-",
"of",
"-",
"band",
"data",
".",
"This",
"does",
"not",
"follow",
"the",
"procedure",
"from",
"the",
"RFC",
"to",
"send",
"Telnet",
"IP",
"and",
"Synch",
";",
"that",
"doesn",
"t",
"seem",
"to... | def abort(self):
'''Abort a file transfer. Uses out-of-band data.
This does not follow the procedure from the RFC to send Telnet
IP and Synch; that doesn't seem to work with the servers I've
tried. Instead, just send the ABOR command as OOB data.'''
line = 'ABOR' + CRLF
... | [
"def",
"abort",
"(",
"self",
")",
":",
"line",
"=",
"'ABOR'",
"+",
"CRLF",
"if",
"self",
".",
"debugging",
">",
"1",
":",
"print",
"'*put urgent*'",
",",
"self",
".",
"sanitize",
"(",
"line",
")",
"self",
".",
"sock",
".",
"sendall",
"(",
"line",
"... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/ftplib.py#L229-L239 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/coverage/coverage/plugin.py | python | FileReporter.arcs | (self) | return set() | Get the executable arcs in this file.
To support branch coverage, your plugin needs to be able to indicate
possible execution paths, as a set of line number pairs. Each pair is
a `(prev, next)` pair indicating that execution can transition from the
`prev` line number to the `next` line... | Get the executable arcs in this file. | [
"Get",
"the",
"executable",
"arcs",
"in",
"this",
"file",
"."
] | def arcs(self):
"""Get the executable arcs in this file.
To support branch coverage, your plugin needs to be able to indicate
possible execution paths, as a set of line number pairs. Each pair is
a `(prev, next)` pair indicating that execution can transition from the
`prev` lin... | [
"def",
"arcs",
"(",
"self",
")",
":",
"return",
"set",
"(",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/coverage/coverage/plugin.py#L279-L291 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/vis/ipython/widgets.py | python | KlamptWidget.addXform | (self,name="Xform1",length=DEFAULT_AXIS_LENGTH,width=DEFAULT_AXIS_WIDTH) | Adds a new transform widget to the world with the given line length and width | Adds a new transform widget to the world with the given line length and width | [
"Adds",
"a",
"new",
"transform",
"widget",
"to",
"the",
"world",
"with",
"the",
"given",
"line",
"length",
"and",
"width"
] | def addXform(self,name="Xform1",length=DEFAULT_AXIS_LENGTH,width=DEFAULT_AXIS_WIDTH):
"""Adds a new transform widget to the world with the given line length and width"""
self._extras[name] = ('RigidTransform',(length,width))
self._do_rpc({'type':'add_xform','name':name,'length':length,'width':wi... | [
"def",
"addXform",
"(",
"self",
",",
"name",
"=",
"\"Xform1\"",
",",
"length",
"=",
"DEFAULT_AXIS_LENGTH",
",",
"width",
"=",
"DEFAULT_AXIS_WIDTH",
")",
":",
"self",
".",
"_extras",
"[",
"name",
"]",
"=",
"(",
"'RigidTransform'",
",",
"(",
"length",
",",
... | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/vis/ipython/widgets.py#L406-L409 | ||
google/mozc | 7329757e1ad30e327c1ae823a8302c79482d6b9c | src/prediction/gen_zero_query_data.py | python | ParseCodePoint | (s) | return int(s, 16) | Parses the pua string representation.
The format of the input is either:
- empty string
- hexadecimal integer.
- hexadecimal integer leading '>'.
We're not interested in empty string nor '>'-leading codes, so returns None
for them.
Note that '>'-leading code means it is "secondary" code point to represe... | Parses the pua string representation. | [
"Parses",
"the",
"pua",
"string",
"representation",
"."
] | def ParseCodePoint(s):
"""Parses the pua string representation.
The format of the input is either:
- empty string
- hexadecimal integer.
- hexadecimal integer leading '>'.
We're not interested in empty string nor '>'-leading codes, so returns None
for them.
Note that '>'-leading code means it is "seco... | [
"def",
"ParseCodePoint",
"(",
"s",
")",
":",
"if",
"not",
"s",
"or",
"s",
"[",
"0",
"]",
"==",
"'>'",
":",
"return",
"0",
"return",
"int",
"(",
"s",
",",
"16",
")"
] | https://github.com/google/mozc/blob/7329757e1ad30e327c1ae823a8302c79482d6b9c/src/prediction/gen_zero_query_data.py#L49-L70 | |
SpaceNetChallenge/BuildingDetectors | 3def3c44b5847c744cd2f3356182892d92496579 | qinhaifang/src/caffe-mnc/python/caffe/io.py | python | blobprotovector_str_to_arraylist | (str) | return [blobproto_to_array(blob) for blob in vec.blobs] | Converts a serialized blobprotovec to a list of arrays. | Converts a serialized blobprotovec to a list of arrays. | [
"Converts",
"a",
"serialized",
"blobprotovec",
"to",
"a",
"list",
"of",
"arrays",
"."
] | def blobprotovector_str_to_arraylist(str):
"""Converts a serialized blobprotovec to a list of arrays.
"""
vec = caffe_pb2.BlobProtoVector()
vec.ParseFromString(str)
return [blobproto_to_array(blob) for blob in vec.blobs] | [
"def",
"blobprotovector_str_to_arraylist",
"(",
"str",
")",
":",
"vec",
"=",
"caffe_pb2",
".",
"BlobProtoVector",
"(",
")",
"vec",
".",
"ParseFromString",
"(",
"str",
")",
"return",
"[",
"blobproto_to_array",
"(",
"blob",
")",
"for",
"blob",
"in",
"vec",
"."... | https://github.com/SpaceNetChallenge/BuildingDetectors/blob/3def3c44b5847c744cd2f3356182892d92496579/qinhaifang/src/caffe-mnc/python/caffe/io.py#L58-L63 | |
freesurfer/freesurfer | 6dbe527d43ffa611acb2cd112e9469f9bfec8e36 | cnn_sphere_register/ext/neuron/neuron/metrics.py | python | Dice.mean_dice | (self, y_true, y_pred) | return mean_dice_metric | weighted mean dice across all patches and labels | weighted mean dice across all patches and labels | [
"weighted",
"mean",
"dice",
"across",
"all",
"patches",
"and",
"labels"
] | def mean_dice(self, y_true, y_pred):
""" weighted mean dice across all patches and labels """
# compute dice, which will now be [batch_size, nb_labels]
dice_metric = self.dice(y_true, y_pred)
# weigh the entries in the dice matrix:
if self.weights is not None:
dice_... | [
"def",
"mean_dice",
"(",
"self",
",",
"y_true",
",",
"y_pred",
")",
":",
"# compute dice, which will now be [batch_size, nb_labels]",
"dice_metric",
"=",
"self",
".",
"dice",
"(",
"y_true",
",",
"y_pred",
")",
"# weigh the entries in the dice matrix:",
"if",
"self",
"... | https://github.com/freesurfer/freesurfer/blob/6dbe527d43ffa611acb2cd112e9469f9bfec8e36/cnn_sphere_register/ext/neuron/neuron/metrics.py#L240-L255 | |
tzutalin/dlib-android | 989627cb7fe81cd1d41d73434b0e91ce1dd2683f | tools/lint/cpplint.py | python | CheckRedundantVirtual | (filename, clean_lines, linenum, error) | Check if line contains a redundant "virtual" function-specifier.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any errors found. | Check if line contains a redundant "virtual" function-specifier.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any errors found. | [
"Check",
"if",
"line",
"contains",
"a",
"redundant",
"virtual",
"function",
"-",
"specifier",
".",
"Args",
":",
"filename",
":",
"The",
"name",
"of",
"the",
"current",
"file",
".",
"clean_lines",
":",
"A",
"CleansedLines",
"instance",
"containing",
"the",
"f... | def CheckRedundantVirtual(filename, clean_lines, linenum, error):
"""Check if line contains a redundant "virtual" function-specifier.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function... | [
"def",
"CheckRedundantVirtual",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"# Look for \"virtual\" on current line.",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"virtual",
"=",
"Match",
"(",
"r'^(.*)(\\bvirtual\... | https://github.com/tzutalin/dlib-android/blob/989627cb7fe81cd1d41d73434b0e91ce1dd2683f/tools/lint/cpplint.py#L5341-L5401 | ||
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/python/turicreate/toolkits/_internal_utils.py | python | _toolkit_get_topk_bottomk | (values, k=5) | return (top_values, bottom_values) | Returns a tuple of the top k values from the positive and
negative values in a SArray
Parameters
----------
values : SFrame of model coefficients
k: Maximum number of largest positive and k lowest negative numbers to return
Returns
-------
(topk_positive, bottomk_positive) : tuple
... | Returns a tuple of the top k values from the positive and
negative values in a SArray | [
"Returns",
"a",
"tuple",
"of",
"the",
"top",
"k",
"values",
"from",
"the",
"positive",
"and",
"negative",
"values",
"in",
"a",
"SArray"
] | def _toolkit_get_topk_bottomk(values, k=5):
"""
Returns a tuple of the top k values from the positive and
negative values in a SArray
Parameters
----------
values : SFrame of model coefficients
k: Maximum number of largest positive and k lowest negative numbers to return
Returns
-... | [
"def",
"_toolkit_get_topk_bottomk",
"(",
"values",
",",
"k",
"=",
"5",
")",
":",
"top_values",
"=",
"values",
".",
"topk",
"(",
"\"value\"",
",",
"k",
"=",
"k",
")",
"top_values",
"=",
"top_values",
"[",
"top_values",
"[",
"\"value\"",
"]",
">",
"0",
"... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/python/turicreate/toolkits/_internal_utils.py#L339-L367 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/genericpath.py | python | getctime | (filename) | return os.stat(filename).st_ctime | Return the metadata change time of a file, reported by os.stat(). | Return the metadata change time of a file, reported by os.stat(). | [
"Return",
"the",
"metadata",
"change",
"time",
"of",
"a",
"file",
"reported",
"by",
"os",
".",
"stat",
"()",
"."
] | def getctime(filename):
"""Return the metadata change time of a file, reported by os.stat()."""
return os.stat(filename).st_ctime | [
"def",
"getctime",
"(",
"filename",
")",
":",
"return",
"os",
".",
"stat",
"(",
"filename",
")",
".",
"st_ctime"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/genericpath.py#L62-L64 | |
gnuradio/gnuradio | 09c3c4fa4bfb1a02caac74cb5334dfe065391e3b | gr-fec/python/fec/LDPC/Generate_LDPC_matrix_functions.py | python | inv_mod2 | (squareMatrix, verbose=0) | Calculates the mod 2 inverse of a matrix. | Calculates the mod 2 inverse of a matrix. | [
"Calculates",
"the",
"mod",
"2",
"inverse",
"of",
"a",
"matrix",
"."
] | def inv_mod2(squareMatrix, verbose=0):
"""
Calculates the mod 2 inverse of a matrix.
"""
A = squareMatrix.copy()
t = A.shape[0]
# Special case for one element array [1]
if A.size == 1 and A[0] == 1:
return array([1])
Ainverse = inv(A)
B = det(A) * Ainverse
C = B % 2
... | [
"def",
"inv_mod2",
"(",
"squareMatrix",
",",
"verbose",
"=",
"0",
")",
":",
"A",
"=",
"squareMatrix",
".",
"copy",
"(",
")",
"t",
"=",
"A",
".",
"shape",
"[",
"0",
"]",
"# Special case for one element array [1]",
"if",
"A",
".",
"size",
"==",
"1",
"and... | https://github.com/gnuradio/gnuradio/blob/09c3c4fa4bfb1a02caac74cb5334dfe065391e3b/gr-fec/python/fec/LDPC/Generate_LDPC_matrix_functions.py#L428-L476 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/arrays/interval.py | python | maybe_convert_platform_interval | (values) | return maybe_convert_platform(values) | Try to do platform conversion, with special casing for IntervalArray.
Wrapper around maybe_convert_platform that alters the default return
dtype in certain cases to be compatible with IntervalArray. For example,
empty lists return with integer dtype instead of object dtype, which is
prohibited for Inte... | Try to do platform conversion, with special casing for IntervalArray.
Wrapper around maybe_convert_platform that alters the default return
dtype in certain cases to be compatible with IntervalArray. For example,
empty lists return with integer dtype instead of object dtype, which is
prohibited for Inte... | [
"Try",
"to",
"do",
"platform",
"conversion",
"with",
"special",
"casing",
"for",
"IntervalArray",
".",
"Wrapper",
"around",
"maybe_convert_platform",
"that",
"alters",
"the",
"default",
"return",
"dtype",
"in",
"certain",
"cases",
"to",
"be",
"compatible",
"with",... | def maybe_convert_platform_interval(values):
"""
Try to do platform conversion, with special casing for IntervalArray.
Wrapper around maybe_convert_platform that alters the default return
dtype in certain cases to be compatible with IntervalArray. For example,
empty lists return with integer dtype ... | [
"def",
"maybe_convert_platform_interval",
"(",
"values",
")",
":",
"if",
"isinstance",
"(",
"values",
",",
"(",
"list",
",",
"tuple",
")",
")",
"and",
"len",
"(",
"values",
")",
"==",
"0",
":",
"# GH 19016",
"# empty lists/tuples get object dtype by default, but t... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/arrays/interval.py#L1080-L1104 | |
idaholab/moose | 9eeebc65e098b4c30f8205fb41591fd5b61eb6ff | modules/geochemistry/python/dbutils.py | python | printRedoxReaction | (db, sec_species) | return printReaction(db, 'redox couples', sec_species) | Print a readable version of the redox reaction | Print a readable version of the redox reaction | [
"Print",
"a",
"readable",
"version",
"of",
"the",
"redox",
"reaction"
] | def printRedoxReaction(db, sec_species):
"""
Print a readable version of the redox reaction
"""
return printReaction(db, 'redox couples', sec_species) | [
"def",
"printRedoxReaction",
"(",
"db",
",",
"sec_species",
")",
":",
"return",
"printReaction",
"(",
"db",
",",
"'redox couples'",
",",
"sec_species",
")"
] | https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/modules/geochemistry/python/dbutils.py#L111-L116 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqt/mantidqt/widgets/samplelogs/model.py | python | SampleLogsModel.get_name | (self) | return self._ws.name() | Return the workspace name | Return the workspace name | [
"Return",
"the",
"workspace",
"name"
] | def get_name(self):
"""Return the workspace name"""
return self._ws.name() | [
"def",
"get_name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_ws",
".",
"name",
"(",
")"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqt/mantidqt/widgets/samplelogs/model.py#L99-L101 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/dataview.py | python | DataViewListCtrl.InsertColumn | (*args, **kwargs) | return _dataview.DataViewListCtrl_InsertColumn(*args, **kwargs) | InsertColumn(self, unsigned int pos, DataViewColumn column, String varianttype="string") -> bool | InsertColumn(self, unsigned int pos, DataViewColumn column, String varianttype="string") -> bool | [
"InsertColumn",
"(",
"self",
"unsigned",
"int",
"pos",
"DataViewColumn",
"column",
"String",
"varianttype",
"=",
"string",
")",
"-",
">",
"bool"
] | def InsertColumn(*args, **kwargs):
"""InsertColumn(self, unsigned int pos, DataViewColumn column, String varianttype="string") -> bool"""
return _dataview.DataViewListCtrl_InsertColumn(*args, **kwargs) | [
"def",
"InsertColumn",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_dataview",
".",
"DataViewListCtrl_InsertColumn",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/dataview.py#L2124-L2126 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Source/ThirdParty/CEF3/pristine/cef_source/tools/automate/automate-git.py | python | write_branch_config_file | (path, branch) | Write the CEF branch to the specified path. | Write the CEF branch to the specified path. | [
"Write",
"the",
"CEF",
"branch",
"to",
"the",
"specified",
"path",
"."
] | def write_branch_config_file(path, branch):
""" Write the CEF branch to the specified path. """
config_file = os.path.join(path, 'cef.branch')
if not os.path.isfile(config_file):
write_config_file(config_file, {'branch': branch}) | [
"def",
"write_branch_config_file",
"(",
"path",
",",
"branch",
")",
":",
"config_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"path",
",",
"'cef.branch'",
")",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"config_file",
")",
":",
"write_config... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Source/ThirdParty/CEF3/pristine/cef_source/tools/automate/automate-git.py#L207-L211 | ||
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/src/robotsim.py | python | SimBody.setCollisionPadding | (self, padding: "double") | return _robotsim.SimBody_setCollisionPadding(self, padding) | r"""
setCollisionPadding(SimBody self, double padding)
Sets the collision padding used for contact generation. At 0 padding the
simulation will be unstable for triangle mesh and point cloud geometries. A
larger value is useful to maintain simulation stability for thin or soft
o... | r"""
setCollisionPadding(SimBody self, double padding) | [
"r",
"setCollisionPadding",
"(",
"SimBody",
"self",
"double",
"padding",
")"
] | def setCollisionPadding(self, padding: "double") -> "void":
r"""
setCollisionPadding(SimBody self, double padding)
Sets the collision padding used for contact generation. At 0 padding the
simulation will be unstable for triangle mesh and point cloud geometries. A
larger value i... | [
"def",
"setCollisionPadding",
"(",
"self",
",",
"padding",
":",
"\"double\"",
")",
"->",
"\"void\"",
":",
"return",
"_robotsim",
".",
"SimBody_setCollisionPadding",
"(",
"self",
",",
"padding",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/src/robotsim.py#L7955-L7966 | |
kevinlin311tw/caffe-cvprw15 | 45c2a1bf0368569c54e0be4edf8d34285cf79e70 | scripts/cpp_lint.py | python | ReplaceAll | (pattern, rep, s) | return _regexp_compile_cache[pattern].sub(rep, s) | Replaces instances of pattern in a string with a replacement.
The compiled regex is kept in a cache shared by Match and Search.
Args:
pattern: regex pattern
rep: replacement text
s: search string
Returns:
string with replacements made (or original string if no replacements) | Replaces instances of pattern in a string with a replacement. | [
"Replaces",
"instances",
"of",
"pattern",
"in",
"a",
"string",
"with",
"a",
"replacement",
"."
] | def ReplaceAll(pattern, rep, s):
"""Replaces instances of pattern in a string with a replacement.
The compiled regex is kept in a cache shared by Match and Search.
Args:
pattern: regex pattern
rep: replacement text
s: search string
Returns:
string with replacements made (or original string if... | [
"def",
"ReplaceAll",
"(",
"pattern",
",",
"rep",
",",
"s",
")",
":",
"if",
"pattern",
"not",
"in",
"_regexp_compile_cache",
":",
"_regexp_compile_cache",
"[",
"pattern",
"]",
"=",
"sre_compile",
".",
"compile",
"(",
"pattern",
")",
"return",
"_regexp_compile_c... | https://github.com/kevinlin311tw/caffe-cvprw15/blob/45c2a1bf0368569c54e0be4edf8d34285cf79e70/scripts/cpp_lint.py#L525-L540 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/ultimatelistctrl.py | python | UltimateListMainWindow.OnCompareItems | (self, line1, line2) | Returns whether 2 lines have the same index.
Override this function in the derived class to change the sort order of the items
in the :class:`UltimateListCtrl`. The function should return a negative, zero or positive
value if the first line is less than, equal to or greater than the sec... | Returns whether 2 lines have the same index.
Override this function in the derived class to change the sort order of the items
in the :class:`UltimateListCtrl`. The function should return a negative, zero or positive
value if the first line is less than, equal to or greater than the sec... | [
"Returns",
"whether",
"2",
"lines",
"have",
"the",
"same",
"index",
".",
"Override",
"this",
"function",
"in",
"the",
"derived",
"class",
"to",
"change",
"the",
"sort",
"order",
"of",
"the",
"items",
"in",
"the",
":",
"class",
":",
"UltimateListCtrl",
".",... | def OnCompareItems(self, line1, line2):
"""
Returns whether 2 lines have the same index.
Override this function in the derived class to change the sort order of the items
in the :class:`UltimateListCtrl`. The function should return a negative, zero or positive
value if t... | [
"def",
"OnCompareItems",
"(",
"self",
",",
"line1",
",",
"line2",
")",
":",
"item",
"=",
"UltimateListItem",
"(",
")",
"item1",
"=",
"line1",
".",
"GetItem",
"(",
"0",
",",
"item",
")",
"item",
"=",
"UltimateListItem",
"(",
")",
"item2",
"=",
"line2",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/ultimatelistctrl.py#L10398-L10423 | ||
infinit/memo | 3a8394d0f647efe03ccb8bfe885a7279cb8be8a6 | elle/drake/src/drake/__init__.py | python | Node.path | (self, absolute = False) | Filesystem path to node file, relative to the root of the
build directory.
>>> with Drake('source/tree') as drake:
... n = node('file1')
... print(n.path())
... n = node('file2')
... builder = TouchBuilder([n])
... print(n.path())
source/tree/file1
file2 | Filesystem path to node file, relative to the root of the
build directory. | [
"Filesystem",
"path",
"to",
"node",
"file",
"relative",
"to",
"the",
"root",
"of",
"the",
"build",
"directory",
"."
] | def path(self, absolute = False):
"""Filesystem path to node file, relative to the root of the
build directory.
>>> with Drake('source/tree') as drake:
... n = node('file1')
... print(n.path())
... n = node('file2')
... builder = TouchBuilder([n])
... print(n.path())
sourc... | [
"def",
"path",
"(",
"self",
",",
"absolute",
"=",
"False",
")",
":",
"if",
"self",
".",
"__path",
"is",
"None",
":",
"name",
"=",
"self",
".",
"_BaseNode__name",
"if",
"name",
".",
"absolute",
"(",
")",
"or",
"name",
".",
"virtual",
":",
"self",
".... | https://github.com/infinit/memo/blob/3a8394d0f647efe03ccb8bfe885a7279cb8be8a6/elle/drake/src/drake/__init__.py#L1632-L1659 | ||
emscripten-core/emscripten | 0d413d3c5af8b28349682496edc14656f5700c2f | tools/filelock.py | python | BaseFileLock.lock_file | (self) | return self._lock_file | The path to the lock file. | The path to the lock file. | [
"The",
"path",
"to",
"the",
"lock",
"file",
"."
] | def lock_file(self):
"""
The path to the lock file.
"""
return self._lock_file | [
"def",
"lock_file",
"(",
"self",
")",
":",
"return",
"self",
".",
"_lock_file"
] | https://github.com/emscripten-core/emscripten/blob/0d413d3c5af8b28349682496edc14656f5700c2f/tools/filelock.py#L166-L170 | |
nieklinnenbank/FreeNOS | db27dbbce09cff86debb58a2d01b49c2b9572c95 | support/scons/config.py | python | ConfDict.__setitem__ | (self, name, value) | This function overrides variable assignment
Ensures variables from the command line are taken first
instead of from the .conf files. | This function overrides variable assignment
Ensures variables from the command line are taken first
instead of from the .conf files. | [
"This",
"function",
"overrides",
"variable",
"assignment",
"Ensures",
"variables",
"from",
"the",
"command",
"line",
"are",
"taken",
"first",
"instead",
"of",
"from",
"the",
".",
"conf",
"files",
"."
] | def __setitem__(self, name, value):
"""
This function overrides variable assignment
Ensures variables from the command line are taken first
instead of from the .conf files.
"""
global cmd_items
if self.locked and (self.cmdPrefix + name) in cmd_items:
... | [
"def",
"__setitem__",
"(",
"self",
",",
"name",
",",
"value",
")",
":",
"global",
"cmd_items",
"if",
"self",
".",
"locked",
"and",
"(",
"self",
".",
"cmdPrefix",
"+",
"name",
")",
"in",
"cmd_items",
":",
"return",
"else",
":",
"return",
"dict",
".",
... | https://github.com/nieklinnenbank/FreeNOS/blob/db27dbbce09cff86debb58a2d01b49c2b9572c95/support/scons/config.py#L41-L52 | ||
cmu-db/noisepage | 79276e68fe83322f1249e8a8be96bd63c583ae56 | build-support/cpplint.py | python | ReplaceAll | (pattern, rep, s) | return _regexp_compile_cache[pattern].sub(rep, s) | Replaces instances of pattern in a string with a replacement.
The compiled regex is kept in a cache shared by Match and Search.
Args:
pattern: regex pattern
rep: replacement text
s: search string
Returns:
string with replacements made (or original string if no replacements) | Replaces instances of pattern in a string with a replacement. | [
"Replaces",
"instances",
"of",
"pattern",
"in",
"a",
"string",
"with",
"a",
"replacement",
"."
] | def ReplaceAll(pattern, rep, s):
"""Replaces instances of pattern in a string with a replacement.
The compiled regex is kept in a cache shared by Match and Search.
Args:
pattern: regex pattern
rep: replacement text
s: search string
Returns:
string with replacements made (or original string ... | [
"def",
"ReplaceAll",
"(",
"pattern",
",",
"rep",
",",
"s",
")",
":",
"if",
"pattern",
"not",
"in",
"_regexp_compile_cache",
":",
"_regexp_compile_cache",
"[",
"pattern",
"]",
"=",
"sre_compile",
".",
"compile",
"(",
"pattern",
")",
"return",
"_regexp_compile_c... | https://github.com/cmu-db/noisepage/blob/79276e68fe83322f1249e8a8be96bd63c583ae56/build-support/cpplint.py#L807-L822 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/asyncio/protocols.py | python | SubprocessProtocol.pipe_connection_lost | (self, fd, exc) | Called when a file descriptor associated with the child process is
closed.
fd is the int file descriptor that was closed. | Called when a file descriptor associated with the child process is
closed. | [
"Called",
"when",
"a",
"file",
"descriptor",
"associated",
"with",
"the",
"child",
"process",
"is",
"closed",
"."
] | def pipe_connection_lost(self, fd, exc):
"""Called when a file descriptor associated with the child process is
closed.
fd is the int file descriptor that was closed.
""" | [
"def",
"pipe_connection_lost",
"(",
"self",
",",
"fd",
",",
"exc",
")",
":"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/asyncio/protocols.py#L183-L188 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/pty.py | python | openpty | () | return master_fd, slave_fd | openpty() -> (master_fd, slave_fd)
Open a pty master/slave pair, using os.openpty() if possible. | openpty() -> (master_fd, slave_fd)
Open a pty master/slave pair, using os.openpty() if possible. | [
"openpty",
"()",
"-",
">",
"(",
"master_fd",
"slave_fd",
")",
"Open",
"a",
"pty",
"master",
"/",
"slave",
"pair",
"using",
"os",
".",
"openpty",
"()",
"if",
"possible",
"."
] | def openpty():
"""openpty() -> (master_fd, slave_fd)
Open a pty master/slave pair, using os.openpty() if possible."""
try:
return os.openpty()
except (AttributeError, OSError):
pass
master_fd, slave_name = _open_terminal()
slave_fd = slave_open(slave_name)
return master_fd, ... | [
"def",
"openpty",
"(",
")",
":",
"try",
":",
"return",
"os",
".",
"openpty",
"(",
")",
"except",
"(",
"AttributeError",
",",
"OSError",
")",
":",
"pass",
"master_fd",
",",
"slave_name",
"=",
"_open_terminal",
"(",
")",
"slave_fd",
"=",
"slave_open",
"(",... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/pty.py#L21-L31 | |
plaidml/plaidml | f3c6681db21460e5fdc11ae651d6d7b6c27f8262 | plaidml/edsl/__init__.py | python | min | (x, y) | return intrinsic('min', x, y) | Computes the elementwise minimum of ``x`` and ``y``.
Args:
x (Tensor): The first input Tensor.
y (Tensor): The second input Tensor.
Returns:
Tensor: The resultant tensor. | Computes the elementwise minimum of ``x`` and ``y``. | [
"Computes",
"the",
"elementwise",
"minimum",
"of",
"x",
"and",
"y",
"."
] | def min(x, y):
"""Computes the elementwise minimum of ``x`` and ``y``.
Args:
x (Tensor): The first input Tensor.
y (Tensor): The second input Tensor.
Returns:
Tensor: The resultant tensor.
"""
return intrinsic('min', x, y) | [
"def",
"min",
"(",
"x",
",",
"y",
")",
":",
"return",
"intrinsic",
"(",
"'min'",
",",
"x",
",",
"y",
")"
] | https://github.com/plaidml/plaidml/blob/f3c6681db21460e5fdc11ae651d6d7b6c27f8262/plaidml/edsl/__init__.py#L977-L987 | |
Slicer/SlicerGitSVNArchive | 65e92bb16c2b32ea47a1a66bee71f238891ee1ca | Base/Python/slicer/release/midasdata.py | python | versionDataModulesDirectory | (sourceVersion, destVersion, token, communicator, modulesID, ignoreModules, overwrite) | Version the Data/Modules directory
sourceVersion -- String indicating source version.
destVersion -- String indicating destination version.
token -- Authentication token.
communicator -- Midas session communicator.
modulesID -- ID of Modules folder.
ignoreModules -- List of modules to ignore whi... | Version the Data/Modules directory
sourceVersion -- String indicating source version.
destVersion -- String indicating destination version.
token -- Authentication token.
communicator -- Midas session communicator.
modulesID -- ID of Modules folder.
ignoreModules -- List of modules to ignore whi... | [
"Version",
"the",
"Data",
"/",
"Modules",
"directory",
"sourceVersion",
"--",
"String",
"indicating",
"source",
"version",
".",
"destVersion",
"--",
"String",
"indicating",
"destination",
"version",
".",
"token",
"--",
"Authentication",
"token",
".",
"communicator",... | def versionDataModulesDirectory(sourceVersion, destVersion, token, communicator, modulesID, ignoreModules, overwrite):
"""Version the Data/Modules directory
sourceVersion -- String indicating source version.
destVersion -- String indicating destination version.
token -- Authentication token.
communica... | [
"def",
"versionDataModulesDirectory",
"(",
"sourceVersion",
",",
"destVersion",
",",
"token",
",",
"communicator",
",",
"modulesID",
",",
"ignoreModules",
",",
"overwrite",
")",
":",
"availableModules",
"=",
"communicator",
".",
"folder_children",
"(",
"token",
",",... | https://github.com/Slicer/SlicerGitSVNArchive/blob/65e92bb16c2b32ea47a1a66bee71f238891ee1ca/Base/Python/slicer/release/midasdata.py#L168-L219 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py2/sklearn/linear_model/logistic.py | python | LogisticRegressionCV.fit | (self, X, y, sample_weight=None) | return self | Fit the model according to the given training data.
Parameters
----------
X : {array-like, sparse matrix}, shape (n_samples, n_features)
Training vector, where n_samples is the number of samples and
n_features is the number of features.
y : array-like, shape (n_... | Fit the model according to the given training data. | [
"Fit",
"the",
"model",
"according",
"to",
"the",
"given",
"training",
"data",
"."
] | def fit(self, X, y, sample_weight=None):
"""Fit the model according to the given training data.
Parameters
----------
X : {array-like, sparse matrix}, shape (n_samples, n_features)
Training vector, where n_samples is the number of samples and
n_features is the nu... | [
"def",
"fit",
"(",
"self",
",",
"X",
",",
"y",
",",
"sample_weight",
"=",
"None",
")",
":",
"_check_solver_option",
"(",
"self",
".",
"solver",
",",
"self",
".",
"multi_class",
",",
"self",
".",
"penalty",
",",
"self",
".",
"dual",
")",
"if",
"not",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/linear_model/logistic.py#L1521-L1729 | |
epiqc/ScaffCC | 66a79944ee4cd116b27bc1a69137276885461db8 | clang/tools/scan-build-py/libscanbuild/report.py | python | copy_resource_files | (output_dir) | Copy the javascript and css files to the report directory. | Copy the javascript and css files to the report directory. | [
"Copy",
"the",
"javascript",
"and",
"css",
"files",
"to",
"the",
"report",
"directory",
"."
] | def copy_resource_files(output_dir):
""" Copy the javascript and css files to the report directory. """
this_dir = os.path.dirname(os.path.realpath(__file__))
for resource in os.listdir(os.path.join(this_dir, 'resources')):
shutil.copy(os.path.join(this_dir, 'resources', resource), output_dir) | [
"def",
"copy_resource_files",
"(",
"output_dir",
")",
":",
"this_dir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"realpath",
"(",
"__file__",
")",
")",
"for",
"resource",
"in",
"os",
".",
"listdir",
"(",
"os",
".",
"path",
... | https://github.com/epiqc/ScaffCC/blob/66a79944ee4cd116b27bc1a69137276885461db8/clang/tools/scan-build-py/libscanbuild/report.py#L426-L431 | ||
h0x91b/redis-v8 | ac8b9d49701d75bcee3719892a2a6a50b437e47a | redis/deps/v8/tools/stats-viewer.py | python | StatsViewer.ComputeCounters | (self) | return groups | Group the counters by the suffix of their name.
Since the same code-level counter (for instance "X") can result in
several variables in the binary counters file that differ only by a
two-character prefix (for instance "c:X" and "t:X") counters are
grouped by suffix and then displayed with custom format... | Group the counters by the suffix of their name. | [
"Group",
"the",
"counters",
"by",
"the",
"suffix",
"of",
"their",
"name",
"."
] | def ComputeCounters(self):
"""Group the counters by the suffix of their name.
Since the same code-level counter (for instance "X") can result in
several variables in the binary counters file that differ only by a
two-character prefix (for instance "c:X" and "t:X") counters are
grouped by suffix and... | [
"def",
"ComputeCounters",
"(",
"self",
")",
":",
"names",
"=",
"{",
"}",
"for",
"i",
"in",
"xrange",
"(",
"self",
".",
"data",
".",
"CountersInUse",
"(",
")",
")",
":",
"counter",
"=",
"self",
".",
"data",
".",
"Counter",
"(",
"i",
")",
"name",
"... | https://github.com/h0x91b/redis-v8/blob/ac8b9d49701d75bcee3719892a2a6a50b437e47a/redis/deps/v8/tools/stats-viewer.py#L177-L212 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/third_party/mlir/utils/spirv/gen_spirv_dialect.py | python | get_spirv_grammar_from_json_spec | () | return spirv['operand_kinds'], spirv['instructions'] | Extracts operand kind and instruction grammar from SPIR-V JSON spec.
Returns:
- A list containing all operand kinds' grammar
- A list containing all instructions' grammar | Extracts operand kind and instruction grammar from SPIR-V JSON spec. | [
"Extracts",
"operand",
"kind",
"and",
"instruction",
"grammar",
"from",
"SPIR",
"-",
"V",
"JSON",
"spec",
"."
] | def get_spirv_grammar_from_json_spec():
"""Extracts operand kind and instruction grammar from SPIR-V JSON spec.
Returns:
- A list containing all operand kinds' grammar
- A list containing all instructions' grammar
"""
response = requests.get(SPIRV_JSON_SPEC_URL)
spec = response.content
import json... | [
"def",
"get_spirv_grammar_from_json_spec",
"(",
")",
":",
"response",
"=",
"requests",
".",
"get",
"(",
"SPIRV_JSON_SPEC_URL",
")",
"spec",
"=",
"response",
".",
"content",
"import",
"json",
"spirv",
"=",
"json",
".",
"loads",
"(",
"spec",
")",
"return",
"sp... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/third_party/mlir/utils/spirv/gen_spirv_dialect.py#L68-L81 | |
DeepGraphLearning/graphvite | e067c59146f676e3eee3eee6106dce7ccc7cf9e4 | python/graphvite/dataset.py | python | Dataset.edge_split | (self, graph_file, files, portions) | Divide a graph into several splits.
Parameters:
graph_file (str): graph file
files (list of str): file names
portions (list of float): split portions | Divide a graph into several splits. | [
"Divide",
"a",
"graph",
"into",
"several",
"splits",
"."
] | def edge_split(self, graph_file, files, portions):
"""
Divide a graph into several splits.
Parameters:
graph_file (str): graph file
files (list of str): file names
portions (list of float): split portions
"""
assert len(files) == len(portions)... | [
"def",
"edge_split",
"(",
"self",
",",
"graph_file",
",",
"files",
",",
"portions",
")",
":",
"assert",
"len",
"(",
"files",
")",
"==",
"len",
"(",
"portions",
")",
"logger",
".",
"info",
"(",
"\"splitting graph %s into %s\"",
"%",
"(",
"self",
".",
"rel... | https://github.com/DeepGraphLearning/graphvite/blob/e067c59146f676e3eee3eee6106dce7ccc7cf9e4/python/graphvite/dataset.py#L295-L316 | ||
google/earthenterprise | 0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9 | earth_enterprise/src/server/wsgi/wms/ogc/common/utils.py | python | GetServerURL | (environ) | return server_url, complete_url, proxy_url | Process server end point from "environ".
Args:
environ: A list which contains the WSGI environment information.
Returns:
(server_url, complete_url): server URL (shceme+host+port) and complete URL (
server_url/path). | Process server end point from "environ". | [
"Process",
"server",
"end",
"point",
"from",
"environ",
"."
] | def GetServerURL(environ):
"""Process server end point from "environ".
Args:
environ: A list which contains the WSGI environment information.
Returns:
(server_url, complete_url): server URL (shceme+host+port) and complete URL (
server_url/path).
"""
server_url = environ["wsgi.url_scheme"] + "://"... | [
"def",
"GetServerURL",
"(",
"environ",
")",
":",
"server_url",
"=",
"environ",
"[",
"\"wsgi.url_scheme\"",
"]",
"+",
"\"://\"",
"if",
"environ",
".",
"get",
"(",
"\"HTTP_HOST\"",
")",
":",
"server_url",
"+=",
"environ",
"[",
"\"HTTP_HOST\"",
"]",
"else",
":"... | https://github.com/google/earthenterprise/blob/0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9/earth_enterprise/src/server/wsgi/wms/ogc/common/utils.py#L117-L156 | |
pybox2d/pybox2d | 09643321fd363f0850087d1bde8af3f4afd82163 | library/Box2D/examples/pgu/gui/container.py | python | Container.remove | (self,w) | Remove a widget from the container. | Remove a widget from the container. | [
"Remove",
"a",
"widget",
"from",
"the",
"container",
"."
] | def remove(self,w):
"""Remove a widget from the container."""
self.blur(w)
self.widgets.remove(w)
#self.repaint()
self.chsize() | [
"def",
"remove",
"(",
"self",
",",
"w",
")",
":",
"self",
".",
"blur",
"(",
"w",
")",
"self",
".",
"widgets",
".",
"remove",
"(",
"w",
")",
"#self.repaint()",
"self",
".",
"chsize",
"(",
")"
] | https://github.com/pybox2d/pybox2d/blob/09643321fd363f0850087d1bde8af3f4afd82163/library/Box2D/examples/pgu/gui/container.py#L256-L261 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/re.py | python | fullmatch | (pattern, string, flags=0) | return _compile(pattern, flags).fullmatch(string) | Try to apply the pattern to all of the string, returning
a Match object, or None if no match was found. | Try to apply the pattern to all of the string, returning
a Match object, or None if no match was found. | [
"Try",
"to",
"apply",
"the",
"pattern",
"to",
"all",
"of",
"the",
"string",
"returning",
"a",
"Match",
"object",
"or",
"None",
"if",
"no",
"match",
"was",
"found",
"."
] | def fullmatch(pattern, string, flags=0):
"""Try to apply the pattern to all of the string, returning
a Match object, or None if no match was found."""
return _compile(pattern, flags).fullmatch(string) | [
"def",
"fullmatch",
"(",
"pattern",
",",
"string",
",",
"flags",
"=",
"0",
")",
":",
"return",
"_compile",
"(",
"pattern",
",",
"flags",
")",
".",
"fullmatch",
"(",
"string",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/re.py#L177-L180 | |
memkind/memkind | cbbf843ba63d852914f665064b6bf74cdc07ac54 | utils/qemu/main.py | python | QEMU._memory_topology | (self, tpg: TopologyCfg) | return mem_tpg | Memory topology string | Memory topology string | [
"Memory",
"topology",
"string"
] | def _memory_topology(self, tpg: TopologyCfg) -> str:
"""
Memory topology string
"""
mem_tpg = tpg.mem_options
# workaround for QEMU - validation in machine_set_cpu_numa_node method
if tpg.hmat:
mem_tpg_parsed = re.sub(r'cpus=(\d+\-\d+,)', '', tpg.mem_options)
... | [
"def",
"_memory_topology",
"(",
"self",
",",
"tpg",
":",
"TopologyCfg",
")",
"->",
"str",
":",
"mem_tpg",
"=",
"tpg",
".",
"mem_options",
"# workaround for QEMU - validation in machine_set_cpu_numa_node method",
"if",
"tpg",
".",
"hmat",
":",
"mem_tpg_parsed",
"=",
... | https://github.com/memkind/memkind/blob/cbbf843ba63d852914f665064b6bf74cdc07ac54/utils/qemu/main.py#L329-L342 | |
epam/Indigo | 30e40b4b1eb9bae0207435a26cfcb81ddcc42be1 | api/python/indigo/__init__.py | python | IndigoObject.iterateRepeatingUnits | (self) | return self.dispatcher.IndigoObject(
self.dispatcher,
self.dispatcher._checkResult(
Indigo._lib.indigoIterateRepeatingUnits(self.id)
),
) | Molecule method iterates repeating units
Returns:
IndigoObject: repeating units iterator | Molecule method iterates repeating units | [
"Molecule",
"method",
"iterates",
"repeating",
"units"
] | def iterateRepeatingUnits(self):
"""Molecule method iterates repeating units
Returns:
IndigoObject: repeating units iterator
"""
self.dispatcher._setSessionId()
return self.dispatcher.IndigoObject(
self.dispatcher,
self.dispatcher._checkResult... | [
"def",
"iterateRepeatingUnits",
"(",
"self",
")",
":",
"self",
".",
"dispatcher",
".",
"_setSessionId",
"(",
")",
"return",
"self",
".",
"dispatcher",
".",
"IndigoObject",
"(",
"self",
".",
"dispatcher",
",",
"self",
".",
"dispatcher",
".",
"_checkResult",
"... | https://github.com/epam/Indigo/blob/30e40b4b1eb9bae0207435a26cfcb81ddcc42be1/api/python/indigo/__init__.py#L1402-L1414 | |
tangzhenyu/Scene-Text-Understanding | 0f7ffc7aea5971a50cdc03d33d0a41075285948b | ctpn_crnn_ocr/CTPN/caffe/python/caffe/pycaffe.py | python | _Net_backward | (self, diffs=None, start=None, end=None, **kwargs) | return {out: self.blobs[out].diff for out in outputs} | Backward pass: prepare diffs and run the net backward.
Parameters
----------
diffs : list of diffs to return in addition to bottom diffs.
kwargs : Keys are output blob names and values are diff ndarrays.
If None, top diffs are taken from forward loss.
start : optional name of layer at w... | Backward pass: prepare diffs and run the net backward. | [
"Backward",
"pass",
":",
"prepare",
"diffs",
"and",
"run",
"the",
"net",
"backward",
"."
] | def _Net_backward(self, diffs=None, start=None, end=None, **kwargs):
"""
Backward pass: prepare diffs and run the net backward.
Parameters
----------
diffs : list of diffs to return in addition to bottom diffs.
kwargs : Keys are output blob names and values are diff ndarrays.
If Non... | [
"def",
"_Net_backward",
"(",
"self",
",",
"diffs",
"=",
"None",
",",
"start",
"=",
"None",
",",
"end",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"diffs",
"is",
"None",
":",
"diffs",
"=",
"[",
"]",
"if",
"start",
"is",
"not",
"None",
... | https://github.com/tangzhenyu/Scene-Text-Understanding/blob/0f7ffc7aea5971a50cdc03d33d0a41075285948b/ctpn_crnn_ocr/CTPN/caffe/python/caffe/pycaffe.py#L110-L157 | |
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | python/mxnet/contrib/onnx/onnx2mx/_op_translations.py | python | global_maxpooling | (attrs, inputs, proto_obj) | return 'Pooling', new_attrs, inputs | Performs max pooling on the input. | Performs max pooling on the input. | [
"Performs",
"max",
"pooling",
"on",
"the",
"input",
"."
] | def global_maxpooling(attrs, inputs, proto_obj):
"""Performs max pooling on the input."""
new_attrs = translation_utils._add_extra_attributes(attrs, {'global_pool': True,
'kernel': (1, 1),
... | [
"def",
"global_maxpooling",
"(",
"attrs",
",",
"inputs",
",",
"proto_obj",
")",
":",
"new_attrs",
"=",
"translation_utils",
".",
"_add_extra_attributes",
"(",
"attrs",
",",
"{",
"'global_pool'",
":",
"True",
",",
"'kernel'",
":",
"(",
"1",
",",
"1",
")",
"... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/python/mxnet/contrib/onnx/onnx2mx/_op_translations.py#L390-L395 | |
wywu/LAB | 4b6debd302ae109fd104d4dd04dccc3418ae7471 | tools/extra/parse_log.py | python | fix_initial_nan_learning_rate | (dict_list) | Correct initial value of learning rate
Learning rate is normally not printed until after the initial test and
training step, which means the initial testing and training rows have
LearningRate = NaN. Fix this by copying over the LearningRate from the
second row, if it exists. | Correct initial value of learning rate | [
"Correct",
"initial",
"value",
"of",
"learning",
"rate"
] | def fix_initial_nan_learning_rate(dict_list):
"""Correct initial value of learning rate
Learning rate is normally not printed until after the initial test and
training step, which means the initial testing and training rows have
LearningRate = NaN. Fix this by copying over the LearningRate from the
... | [
"def",
"fix_initial_nan_learning_rate",
"(",
"dict_list",
")",
":",
"if",
"len",
"(",
"dict_list",
")",
">",
"1",
":",
"dict_list",
"[",
"0",
"]",
"[",
"'LearningRate'",
"]",
"=",
"dict_list",
"[",
"1",
"]",
"[",
"'LearningRate'",
"]"
] | https://github.com/wywu/LAB/blob/4b6debd302ae109fd104d4dd04dccc3418ae7471/tools/extra/parse_log.py#L128-L138 | ||
floooh/oryol | eb08cffe1b1cb6b05ed14ec692bca9372cef064e | tools/texexport.py | python | toDDS | (srcFilename, dstFilename, linearGamma, fmt, rgbFmt=None) | Convert a file to DDS format | Convert a file to DDS format | [
"Convert",
"a",
"file",
"to",
"DDS",
"format"
] | def toDDS(srcFilename, dstFilename, linearGamma, fmt, rgbFmt=None) :
'''
Convert a file to DDS format
'''
ensureDstDirectory()
ddsTool = getToolsBinPath() + 'nvcompress'
srcPath = TexSrcDirectory + '/' + srcFilename
dstPath = TexDstDirectory + '/' + dstFilename
print('=== toDDS: {} => {}... | [
"def",
"toDDS",
"(",
"srcFilename",
",",
"dstFilename",
",",
"linearGamma",
",",
"fmt",
",",
"rgbFmt",
"=",
"None",
")",
":",
"ensureDstDirectory",
"(",
")",
"ddsTool",
"=",
"getToolsBinPath",
"(",
")",
"+",
"'nvcompress'",
"srcPath",
"=",
"TexSrcDirectory",
... | https://github.com/floooh/oryol/blob/eb08cffe1b1cb6b05ed14ec692bca9372cef064e/tools/texexport.py#L63-L82 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/distlib/index.py | python | PackageIndex.get_verify_command | (self, signature_filename, data_filename,
keystore=None) | return cmd | Return a suitable command for verifying a file.
:param signature_filename: The pathname to the file containing the
signature.
:param data_filename: The pathname to the file containing the
signed data.
:param keystore: The path to ... | Return a suitable command for verifying a file. | [
"Return",
"a",
"suitable",
"command",
"for",
"verifying",
"a",
"file",
"."
] | def get_verify_command(self, signature_filename, data_filename,
keystore=None):
"""
Return a suitable command for verifying a file.
:param signature_filename: The pathname to the file containing the
signature.
:param data_fil... | [
"def",
"get_verify_command",
"(",
"self",
",",
"signature_filename",
",",
"data_filename",
",",
"keystore",
"=",
"None",
")",
":",
"cmd",
"=",
"[",
"self",
".",
"gpg",
",",
"'--status-fd'",
",",
"'2'",
",",
"'--no-tty'",
"]",
"if",
"keystore",
"is",
"None"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/distlib/index.py#L324-L346 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.