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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sdhash/sdhash | b9eff63e4e5867e910f41fd69032bbb1c94a2a5e | sdhash-ui/cherrypy/_cptools.py | python | _getargs | (func) | return co.co_varnames[:co.co_argcount] | Return the names of all static arguments to the given function. | Return the names of all static arguments to the given function. | [
"Return",
"the",
"names",
"of",
"all",
"static",
"arguments",
"to",
"the",
"given",
"function",
"."
] | def _getargs(func):
"""Return the names of all static arguments to the given function."""
# Use this instead of importing inspect for less mem overhead.
import types
if sys.version_info >= (3, 0):
if isinstance(func, types.MethodType):
func = func.__func__
co = func.__code__
... | [
"def",
"_getargs",
"(",
"func",
")",
":",
"# Use this instead of importing inspect for less mem overhead.",
"import",
"types",
"if",
"sys",
".",
"version_info",
">=",
"(",
"3",
",",
"0",
")",
":",
"if",
"isinstance",
"(",
"func",
",",
"types",
".",
"MethodType",... | https://github.com/sdhash/sdhash/blob/b9eff63e4e5867e910f41fd69032bbb1c94a2a5e/sdhash-ui/cherrypy/_cptools.py#L31-L43 | |
tfwu/FaceDetection-ConvNet-3D | f9251c48eb40c5aec8fba7455115c355466555be | python/build/lib.linux-x86_64-2.7/mxnet/executor.py | python | Executor.set_monitor_callback | (self, callback) | Install callback.
Parameters
----------
callback : function
Takes a string and an NDArrayHandle. | Install callback. | [
"Install",
"callback",
"."
] | def set_monitor_callback(self, callback):
"""Install callback.
Parameters
----------
callback : function
Takes a string and an NDArrayHandle.
"""
cb_type = ctypes.CFUNCTYPE(None, ctypes.c_char_p, NDArrayHandle, ctypes.c_void_p)
self._monitor_callback ... | [
"def",
"set_monitor_callback",
"(",
"self",
",",
"callback",
")",
":",
"cb_type",
"=",
"ctypes",
".",
"CFUNCTYPE",
"(",
"None",
",",
"ctypes",
".",
"c_char_p",
",",
"NDArrayHandle",
",",
"ctypes",
".",
"c_void_p",
")",
"self",
".",
"_monitor_callback",
"=",
... | https://github.com/tfwu/FaceDetection-ConvNet-3D/blob/f9251c48eb40c5aec8fba7455115c355466555be/python/build/lib.linux-x86_64-2.7/mxnet/executor.py#L139-L152 | ||
apache/mesos | 97d9a4063332aae3825d78de71611657e05cf5e2 | support/cpplint.py | python | NestingState.InTemplateArgumentList | (self, clean_lines, linenum, pos) | return False | Check if current position is inside template argument list.
Args:
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
pos: position just after the suspected template argument.
Returns:
True if (linenum, pos) is inside template arguments. | Check if current position is inside template argument list. | [
"Check",
"if",
"current",
"position",
"is",
"inside",
"template",
"argument",
"list",
"."
] | def InTemplateArgumentList(self, clean_lines, linenum, pos):
"""Check if current position is inside template argument list.
Args:
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
pos: position just after the suspected template argument.
... | [
"def",
"InTemplateArgumentList",
"(",
"self",
",",
"clean_lines",
",",
"linenum",
",",
"pos",
")",
":",
"while",
"linenum",
"<",
"clean_lines",
".",
"NumLines",
"(",
")",
":",
"# Find the earliest character that might indicate a template argument",
"line",
"=",
"clean... | https://github.com/apache/mesos/blob/97d9a4063332aae3825d78de71611657e05cf5e2/support/cpplint.py#L2478-L2528 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/numpy/math_ops.py | python | cross | (a, b, axisa=- 1, axisb=- 1, axisc=- 1, axis=None) | return moveaxis(res, -1, axisc).astype(dtype) | Returns the cross product of two (arrays of) vectors.
The cross product of `a` and `b` in :math:`R^3` is a vector perpendicular to both
`a` and `b`. If `a` and `b` are arrays of vectors, the vectors are defined by the
last axis of `a` and `b` by default, and these axes can have dimensions 2 or 3.
Where... | Returns the cross product of two (arrays of) vectors. | [
"Returns",
"the",
"cross",
"product",
"of",
"two",
"(",
"arrays",
"of",
")",
"vectors",
"."
] | def cross(a, b, axisa=- 1, axisb=- 1, axisc=- 1, axis=None):
"""
Returns the cross product of two (arrays of) vectors.
The cross product of `a` and `b` in :math:`R^3` is a vector perpendicular to both
`a` and `b`. If `a` and `b` are arrays of vectors, the vectors are defined by the
last axis of `a`... | [
"def",
"cross",
"(",
"a",
",",
"b",
",",
"axisa",
"=",
"-",
"1",
",",
"axisb",
"=",
"-",
"1",
",",
"axisc",
"=",
"-",
"1",
",",
"axis",
"=",
"None",
")",
":",
"a",
",",
"b",
"=",
"_to_tensor",
"(",
"a",
",",
"b",
")",
"if",
"axis",
"is",
... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/numpy/math_ops.py#L2895-L2995 | |
Kitware/ParaView | f760af9124ff4634b23ebbeab95a4f56e0261955 | Wrapping/Python/paraview/smtrace.py | python | PropertyTraceHelper.get_varname | (self, not_fully_scoped=False) | return self.PropertyName if not_fully_scoped else self.FullScopedName | Returns the variable name to use when referring to this property.
:param not_fully_scoped: If False, this will return
fully-scoped name when referring to the property e.g. sphere0.Radius,
else it will use just the property name, *e.g.*, Radius. | Returns the variable name to use when referring to this property. | [
"Returns",
"the",
"variable",
"name",
"to",
"use",
"when",
"referring",
"to",
"this",
"property",
"."
] | def get_varname(self, not_fully_scoped=False):
"""Returns the variable name to use when referring to this property.
:param not_fully_scoped: If False, this will return
fully-scoped name when referring to the property e.g. sphere0.Radius,
else it will use just the property name, ... | [
"def",
"get_varname",
"(",
"self",
",",
"not_fully_scoped",
"=",
"False",
")",
":",
"return",
"self",
".",
"PropertyName",
"if",
"not_fully_scoped",
"else",
"self",
".",
"FullScopedName"
] | https://github.com/Kitware/ParaView/blob/f760af9124ff4634b23ebbeab95a4f56e0261955/Wrapping/Python/paraview/smtrace.py#L643-L650 | |
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | python/mxnet/gluon/trainer.py | python | Trainer.save_states | (self, fname) | Saves trainer states (e.g. optimizer, momentum) to a file.
Parameters
----------
fname : str
Path to output states file.
Note
----
`optimizer.param_dict`, which contains Parameter information (such as
`lr_mult` and `wd_mult`) will not be saved. | Saves trainer states (e.g. optimizer, momentum) to a file. | [
"Saves",
"trainer",
"states",
"(",
"e",
".",
"g",
".",
"optimizer",
"momentum",
")",
"to",
"a",
"file",
"."
] | def save_states(self, fname):
"""Saves trainer states (e.g. optimizer, momentum) to a file.
Parameters
----------
fname : str
Path to output states file.
Note
----
`optimizer.param_dict`, which contains Parameter information (such as
`lr_mul... | [
"def",
"save_states",
"(",
"self",
",",
"fname",
")",
":",
"assert",
"self",
".",
"_optimizer",
"is",
"not",
"None",
"if",
"not",
"self",
".",
"_kv_initialized",
":",
"self",
".",
"_init_kvstore",
"(",
")",
"if",
"self",
".",
"_params_to_init",
":",
"sel... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/python/mxnet/gluon/trainer.py#L436-L463 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/richtext.py | python | RichTextParagraphLayoutBox.GetParagraphAtLine | (*args, **kwargs) | return _richtext.RichTextParagraphLayoutBox_GetParagraphAtLine(*args, **kwargs) | GetParagraphAtLine(self, long paragraphNumber) -> RichTextParagraph | GetParagraphAtLine(self, long paragraphNumber) -> RichTextParagraph | [
"GetParagraphAtLine",
"(",
"self",
"long",
"paragraphNumber",
")",
"-",
">",
"RichTextParagraph"
] | def GetParagraphAtLine(*args, **kwargs):
"""GetParagraphAtLine(self, long paragraphNumber) -> RichTextParagraph"""
return _richtext.RichTextParagraphLayoutBox_GetParagraphAtLine(*args, **kwargs) | [
"def",
"GetParagraphAtLine",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextParagraphLayoutBox_GetParagraphAtLine",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/richtext.py#L1696-L1698 | |
runtimejs/runtime | 0a6e84c30823d35a4548d6634166784260ae7b74 | deps/v8/tools/release/common_includes.py | python | SortingKey | (version) | return ".".join(map("{0:04d}".format, version_keys)) | Key for sorting version number strings: '3.11' > '3.2.1.1 | Key for sorting version number strings: '3.11' > '3.2.1.1 | [
"Key",
"for",
"sorting",
"version",
"number",
"strings",
":",
"3",
".",
"11",
">",
"3",
".",
"2",
".",
"1",
".",
"1"
] | def SortingKey(version):
"""Key for sorting version number strings: '3.11' > '3.2.1.1'"""
version_keys = map(int, version.split("."))
# Fill up to full version numbers to normalize comparison.
while len(version_keys) < 4: # pragma: no cover
version_keys.append(0)
# Fill digits.
return ".".join(map("{0:... | [
"def",
"SortingKey",
"(",
"version",
")",
":",
"version_keys",
"=",
"map",
"(",
"int",
",",
"version",
".",
"split",
"(",
"\".\"",
")",
")",
"# Fill up to full version numbers to normalize comparison.",
"while",
"len",
"(",
"version_keys",
")",
"<",
"4",
":",
... | https://github.com/runtimejs/runtime/blob/0a6e84c30823d35a4548d6634166784260ae7b74/deps/v8/tools/release/common_includes.py#L178-L185 | |
google/syzygy | 8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5 | third_party/numpy/files/numpy/lib/npyio.py | python | genfromtxt | (fname, dtype=float, comments='#', delimiter=None,
skiprows=0, skip_header=0, skip_footer=0, converters=None,
missing='', missing_values=None, filling_values=None,
usecols=None, names=None,
excludelist=None, deletechars=None, replace_space='_',
... | return output.squeeze() | Load data from a text file, with missing values handled as specified.
Each line past the first `skip_header` lines is split at the `delimiter`
character, and characters following the `comments` character are discarded.
Parameters
----------
fname : file or str
File, filename, or generator ... | Load data from a text file, with missing values handled as specified. | [
"Load",
"data",
"from",
"a",
"text",
"file",
"with",
"missing",
"values",
"handled",
"as",
"specified",
"."
] | def genfromtxt(fname, dtype=float, comments='#', delimiter=None,
skiprows=0, skip_header=0, skip_footer=0, converters=None,
missing='', missing_values=None, filling_values=None,
usecols=None, names=None,
excludelist=None, deletechars=None, replace_space='_',
... | [
"def",
"genfromtxt",
"(",
"fname",
",",
"dtype",
"=",
"float",
",",
"comments",
"=",
"'#'",
",",
"delimiter",
"=",
"None",
",",
"skiprows",
"=",
"0",
",",
"skip_header",
"=",
"0",
",",
"skip_footer",
"=",
"0",
",",
"converters",
"=",
"None",
",",
"mi... | https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/third_party/numpy/files/numpy/lib/npyio.py#L1076-L1689 | |
Samsung/veles | 95ed733c2e49bc011ad98ccf2416ecec23fbf352 | veles/external/progressbar/progressbar.py | python | ProgressBar._need_update | (self) | return self.time_sensitive and delta > self.poll | Returns whether the ProgressBar should redraw the line. | Returns whether the ProgressBar should redraw the line. | [
"Returns",
"whether",
"the",
"ProgressBar",
"should",
"redraw",
"the",
"line",
"."
] | def _need_update(self):
"""Returns whether the ProgressBar should redraw the line."""
if self.currval >= self.next_update or self.finished:
return True
delta = time.time() - self.last_update_time
return self.time_sensitive and delta > self.poll | [
"def",
"_need_update",
"(",
"self",
")",
":",
"if",
"self",
".",
"currval",
">=",
"self",
".",
"next_update",
"or",
"self",
".",
"finished",
":",
"return",
"True",
"delta",
"=",
"time",
".",
"time",
"(",
")",
"-",
"self",
".",
"last_update_time",
"retu... | https://github.com/Samsung/veles/blob/95ed733c2e49bc011ad98ccf2416ecec23fbf352/veles/external/progressbar/progressbar.py#L235-L241 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/idlelib/squeezer.py | python | Squeezer.squeeze_current_text_event | (self, event) | return "break" | squeeze-current-text event handler
Squeeze the block of text inside which contains the "insert" cursor.
If the insert cursor is not in a squeezable block of text, give the
user a small warning and do nothing. | squeeze-current-text event handler | [
"squeeze",
"-",
"current",
"-",
"text",
"event",
"handler"
] | def squeeze_current_text_event(self, event):
"""squeeze-current-text event handler
Squeeze the block of text inside which contains the "insert" cursor.
If the insert cursor is not in a squeezable block of text, give the
user a small warning and do nothing.
"""
# Set tag... | [
"def",
"squeeze_current_text_event",
"(",
"self",
",",
"event",
")",
":",
"# Set tag_name to the first valid tag found on the \"insert\" cursor.",
"tag_names",
"=",
"self",
".",
"text",
".",
"tag_names",
"(",
"tk",
".",
"INSERT",
")",
"for",
"tag_name",
"in",
"(",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/idlelib/squeezer.py#L288-L335 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/support/layer1.py | python | SupportConnection.describe_cases | (self, case_id_list=None, display_id=None,
after_time=None, before_time=None,
include_resolved_cases=None, next_token=None,
max_results=None, language=None,
include_communications=None) | return self.make_request(action='DescribeCases',
body=json.dumps(params)) | Returns a list of cases that you specify by passing one or
more case IDs. In addition, you can filter the cases by date
by setting values for the `AfterTime` and `BeforeTime` request
parameters.
Case data is available for 12 months after creation. If a case
was created more than... | Returns a list of cases that you specify by passing one or
more case IDs. In addition, you can filter the cases by date
by setting values for the `AfterTime` and `BeforeTime` request
parameters. | [
"Returns",
"a",
"list",
"of",
"cases",
"that",
"you",
"specify",
"by",
"passing",
"one",
"or",
"more",
"case",
"IDs",
".",
"In",
"addition",
"you",
"can",
"filter",
"the",
"cases",
"by",
"date",
"by",
"setting",
"values",
"for",
"the",
"AfterTime",
"and"... | def describe_cases(self, case_id_list=None, display_id=None,
after_time=None, before_time=None,
include_resolved_cases=None, next_token=None,
max_results=None, language=None,
include_communications=None):
"""
Ret... | [
"def",
"describe_cases",
"(",
"self",
",",
"case_id_list",
"=",
"None",
",",
"display_id",
"=",
"None",
",",
"after_time",
"=",
"None",
",",
"before_time",
"=",
"None",
",",
"include_resolved_cases",
"=",
"None",
",",
"next_token",
"=",
"None",
",",
"max_res... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/support/layer1.py#L326-L410 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/android/loading/cloud/frontend/clovis_frontend.py | python | EnqueueTasks | (tasks, task_tag) | return True | Enqueues a list of tasks in the Google Cloud task queue, for consumption by
Google Compute Engine. | Enqueues a list of tasks in the Google Cloud task queue, for consumption by
Google Compute Engine. | [
"Enqueues",
"a",
"list",
"of",
"tasks",
"in",
"the",
"Google",
"Cloud",
"task",
"queue",
"for",
"consumption",
"by",
"Google",
"Compute",
"Engine",
"."
] | def EnqueueTasks(tasks, task_tag):
"""Enqueues a list of tasks in the Google Cloud task queue, for consumption by
Google Compute Engine.
"""
q = taskqueue.Queue('clovis-queue')
# Add tasks to the queue by groups.
# TODO(droger): This supports thousands of tasks, but maybe not millions.
# Defer the enqueui... | [
"def",
"EnqueueTasks",
"(",
"tasks",
",",
"task_tag",
")",
":",
"q",
"=",
"taskqueue",
".",
"Queue",
"(",
"'clovis-queue'",
")",
"# Add tasks to the queue by groups.",
"# TODO(droger): This supports thousands of tasks, but maybe not millions.",
"# Defer the enqueuing if it times ... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/android/loading/cloud/frontend/clovis_frontend.py#L488-L514 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/scipy/interpolate/fitpack2.py | python | UnivariateSpline.derivatives | (self, x) | return d | Return all derivatives of the spline at the point x.
Parameters
----------
x : float
The point to evaluate the derivatives at.
Returns
-------
der : ndarray, shape(k+1,)
Derivatives of the orders 0 to k.
Examples
--------
... | Return all derivatives of the spline at the point x. | [
"Return",
"all",
"derivatives",
"of",
"the",
"spline",
"at",
"the",
"point",
"x",
"."
] | def derivatives(self, x):
""" Return all derivatives of the spline at the point x.
Parameters
----------
x : float
The point to evaluate the derivatives at.
Returns
-------
der : ndarray, shape(k+1,)
Derivatives of the orders 0 to k.
... | [
"def",
"derivatives",
"(",
"self",
",",
"x",
")",
":",
"d",
",",
"ier",
"=",
"dfitpack",
".",
"spalde",
"(",
"*",
"(",
"self",
".",
"_eval_args",
"+",
"(",
"x",
",",
")",
")",
")",
"if",
"not",
"ier",
"==",
"0",
":",
"raise",
"ValueError",
"(",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/scipy/interpolate/fitpack2.py#L373-L399 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/customtreectrl.py | python | CustomTreeCtrl.HandleHyperLink | (self, item) | Handles the hyperlink items, sending the ``EVT_TREE_ITEM_HYPERLINK`` event.
:param `item`: an instance of :class:`GenericTreeItem`. | Handles the hyperlink items, sending the ``EVT_TREE_ITEM_HYPERLINK`` event. | [
"Handles",
"the",
"hyperlink",
"items",
"sending",
"the",
"EVT_TREE_ITEM_HYPERLINK",
"event",
"."
] | def HandleHyperLink(self, item):
"""
Handles the hyperlink items, sending the ``EVT_TREE_ITEM_HYPERLINK`` event.
:param `item`: an instance of :class:`GenericTreeItem`.
"""
if self.IsItemHyperText(item):
event = TreeEvent(wxEVT_TREE_ITEM_HYPERLINK, self.GetI... | [
"def",
"HandleHyperLink",
"(",
"self",
",",
"item",
")",
":",
"if",
"self",
".",
"IsItemHyperText",
"(",
"item",
")",
":",
"event",
"=",
"TreeEvent",
"(",
"wxEVT_TREE_ITEM_HYPERLINK",
",",
"self",
".",
"GetId",
"(",
")",
")",
"event",
".",
"_item",
"=",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/customtreectrl.py#L5812-L5822 | ||
BitMEX/api-connectors | 37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812 | auto-generated/python/swagger_client/models/liquidation.py | python | Liquidation.symbol | (self) | return self._symbol | Gets the symbol of this Liquidation. # noqa: E501
:return: The symbol of this Liquidation. # noqa: E501
:rtype: str | Gets the symbol of this Liquidation. # noqa: E501 | [
"Gets",
"the",
"symbol",
"of",
"this",
"Liquidation",
".",
"#",
"noqa",
":",
"E501"
] | def symbol(self):
"""Gets the symbol of this Liquidation. # noqa: E501
:return: The symbol of this Liquidation. # noqa: E501
:rtype: str
"""
return self._symbol | [
"def",
"symbol",
"(",
"self",
")",
":",
"return",
"self",
".",
"_symbol"
] | https://github.com/BitMEX/api-connectors/blob/37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812/auto-generated/python/swagger_client/models/liquidation.py#L93-L100 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/training/checkpoint_utils.py | python | wait_for_new_checkpoint | (checkpoint_dir,
last_checkpoint=None,
seconds_to_sleep=1,
timeout=None) | Waits until a new checkpoint file is found.
Args:
checkpoint_dir: The directory in which checkpoints are saved.
last_checkpoint: The last checkpoint path used or `None` if we're expecting
a checkpoint for the first time.
seconds_to_sleep: The number of seconds to sleep for before looking for a
... | Waits until a new checkpoint file is found. | [
"Waits",
"until",
"a",
"new",
"checkpoint",
"file",
"is",
"found",
"."
] | def wait_for_new_checkpoint(checkpoint_dir,
last_checkpoint=None,
seconds_to_sleep=1,
timeout=None):
"""Waits until a new checkpoint file is found.
Args:
checkpoint_dir: The directory in which checkpoints are saved.
last_ch... | [
"def",
"wait_for_new_checkpoint",
"(",
"checkpoint_dir",
",",
"last_checkpoint",
"=",
"None",
",",
"seconds_to_sleep",
"=",
"1",
",",
"timeout",
"=",
"None",
")",
":",
"logging",
".",
"info",
"(",
"\"Waiting for new checkpoint at %s\"",
",",
"checkpoint_dir",
")",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/training/checkpoint_utils.py#L118-L146 | ||
Ifsttar/I-Simpa | 2283385f4cac769a92e265edabb9c79cb6c42d03 | currentRelease/ExperimentalCore/md_octave/kdtree.py | python | KDNode.should_remove | (self, point, node) | return (node is None) or (node is self) | checks if self's point (and maybe identity) matches | checks if self's point (and maybe identity) matches | [
"checks",
"if",
"self",
"s",
"point",
"(",
"and",
"maybe",
"identity",
")",
"matches"
] | def should_remove(self, point, node):
""" checks if self's point (and maybe identity) matches """
if not self.data == point:
return False
return (node is None) or (node is self) | [
"def",
"should_remove",
"(",
"self",
",",
"point",
",",
"node",
")",
":",
"if",
"not",
"self",
".",
"data",
"==",
"point",
":",
"return",
"False",
"return",
"(",
"node",
"is",
"None",
")",
"or",
"(",
"node",
"is",
"self",
")"
] | https://github.com/Ifsttar/I-Simpa/blob/2283385f4cac769a92e265edabb9c79cb6c42d03/currentRelease/ExperimentalCore/md_octave/kdtree.py#L281-L286 | |
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Draft/draftobjects/draftlink.py | python | DraftLink.onChanged | (self, obj, prop) | Execute when a property changes. | Execute when a property changes. | [
"Execute",
"when",
"a",
"property",
"changes",
"."
] | def onChanged(self, obj, prop):
"""Execute when a property changes."""
if not getattr(self, 'use_link', False):
return
if prop == 'Fuse':
if obj.Fuse:
obj.setPropertyStatus('Shape', '-Transient')
else:
obj.setPropertyStatus('Sh... | [
"def",
"onChanged",
"(",
"self",
",",
"obj",
",",
"prop",
")",
":",
"if",
"not",
"getattr",
"(",
"self",
",",
"'use_link'",
",",
"False",
")",
":",
"return",
"if",
"prop",
"==",
"'Fuse'",
":",
"if",
"obj",
".",
"Fuse",
":",
"obj",
".",
"setProperty... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Draft/draftobjects/draftlink.py#L230-L245 | ||
Z3Prover/z3 | d745d03afdfdf638d66093e2bfbacaf87187f35b | src/api/python/z3/z3.py | python | simplify | (a, *arguments, **keywords) | Simplify the expression `a` using the given options.
This function has many options. Use `help_simplify` to obtain the complete list.
>>> x = Int('x')
>>> y = Int('y')
>>> simplify(x + 1 + y + x + 1)
2 + 2*x + y
>>> simplify((x + 1)*(y + 1), som=True)
1 + x + y + x*y
>>> simplify(Disti... | Simplify the expression `a` using the given options. | [
"Simplify",
"the",
"expression",
"a",
"using",
"the",
"given",
"options",
"."
] | def simplify(a, *arguments, **keywords):
"""Simplify the expression `a` using the given options.
This function has many options. Use `help_simplify` to obtain the complete list.
>>> x = Int('x')
>>> y = Int('y')
>>> simplify(x + 1 + y + x + 1)
2 + 2*x + y
>>> simplify((x + 1)*(y + 1), som=... | [
"def",
"simplify",
"(",
"a",
",",
"*",
"arguments",
",",
"*",
"*",
"keywords",
")",
":",
"if",
"z3_debug",
"(",
")",
":",
"_z3_assert",
"(",
"is_expr",
"(",
"a",
")",
",",
"\"Z3 expression expected\"",
")",
"if",
"len",
"(",
"arguments",
")",
">",
"0... | https://github.com/Z3Prover/z3/blob/d745d03afdfdf638d66093e2bfbacaf87187f35b/src/api/python/z3/z3.py#L8685-L8707 | ||
tangzhenyu/Scene-Text-Understanding | 0f7ffc7aea5971a50cdc03d33d0a41075285948b | SynthText_Chinese/text_utils.py | python | RenderFont.render_multiline | (self,font,text) | return surf_arr, words, bbs | renders multiline TEXT on the pygame surface SURF with the
font style FONT.
A new line in text is denoted by \n, no other characters are
escaped. Other forms of white-spaces should be converted to space.
returns the updated surface, words and the character bounding boxes. | renders multiline TEXT on the pygame surface SURF with the
font style FONT.
A new line in text is denoted by \n, no other characters are
escaped. Other forms of white-spaces should be converted to space. | [
"renders",
"multiline",
"TEXT",
"on",
"the",
"pygame",
"surface",
"SURF",
"with",
"the",
"font",
"style",
"FONT",
".",
"A",
"new",
"line",
"in",
"text",
"is",
"denoted",
"by",
"\\",
"n",
"no",
"other",
"characters",
"are",
"escaped",
".",
"Other",
"forms... | def render_multiline(self,font,text):
"""
renders multiline TEXT on the pygame surface SURF with the
font style FONT.
A new line in text is denoted by \n, no other characters are
escaped. Other forms of white-spaces should be converted to space.
returns the updated surf... | [
"def",
"render_multiline",
"(",
"self",
",",
"font",
",",
"text",
")",
":",
"# get the number of lines",
"lines",
"=",
"text",
".",
"split",
"(",
"'\\n'",
")",
"lengths",
"=",
"[",
"len",
"(",
"l",
")",
"for",
"l",
"in",
"lines",
"]",
"# font parameters:... | https://github.com/tangzhenyu/Scene-Text-Understanding/blob/0f7ffc7aea5971a50cdc03d33d0a41075285948b/SynthText_Chinese/text_utils.py#L118-L169 | |
apiaryio/drafter | 4634ebd07f6c6f257cc656598ccd535492fdfb55 | tools/gyp/pylib/gyp/MSVSVersion.py | python | VisualStudioVersion.ProjectVersion | (self) | return self.project_version | Get the version number of the vcproj or vcxproj files. | Get the version number of the vcproj or vcxproj files. | [
"Get",
"the",
"version",
"number",
"of",
"the",
"vcproj",
"or",
"vcxproj",
"files",
"."
] | def ProjectVersion(self):
"""Get the version number of the vcproj or vcxproj files."""
return self.project_version | [
"def",
"ProjectVersion",
"(",
"self",
")",
":",
"return",
"self",
".",
"project_version"
] | https://github.com/apiaryio/drafter/blob/4634ebd07f6c6f257cc656598ccd535492fdfb55/tools/gyp/pylib/gyp/MSVSVersion.py#L43-L45 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/build/waf-1.7.13/waflib/extras/review.py | python | ReviewContext.invalidate_cache | (self) | Invalidate the cache to prevent bad builds. | Invalidate the cache to prevent bad builds. | [
"Invalidate",
"the",
"cache",
"to",
"prevent",
"bad",
"builds",
"."
] | def invalidate_cache(self):
"""Invalidate the cache to prevent bad builds."""
try:
Logs.warn("Removing the cached configuration since the options have changed")
shutil.rmtree(self.cache_path)
except:
pass | [
"def",
"invalidate_cache",
"(",
"self",
")",
":",
"try",
":",
"Logs",
".",
"warn",
"(",
"\"Removing the cached configuration since the options have changed\"",
")",
"shutil",
".",
"rmtree",
"(",
"self",
".",
"cache_path",
")",
"except",
":",
"pass"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/build/waf-1.7.13/waflib/extras/review.py#L172-L178 | ||
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/deps/v8/third_party/jinja2/sandbox.py | python | is_internal_attribute | (obj, attr) | return attr.startswith('__') | Test if the attribute given is an internal python attribute. For
example this function returns `True` for the `func_code` attribute of
python objects. This is useful if the environment method
:meth:`~SandboxedEnvironment.is_safe_attribute` is overridden.
>>> from jinja2.sandbox import is_internal_att... | Test if the attribute given is an internal python attribute. For
example this function returns `True` for the `func_code` attribute of
python objects. This is useful if the environment method
:meth:`~SandboxedEnvironment.is_safe_attribute` is overridden. | [
"Test",
"if",
"the",
"attribute",
"given",
"is",
"an",
"internal",
"python",
"attribute",
".",
"For",
"example",
"this",
"function",
"returns",
"True",
"for",
"the",
"func_code",
"attribute",
"of",
"python",
"objects",
".",
"This",
"is",
"useful",
"if",
"the... | def is_internal_attribute(obj, attr):
"""Test if the attribute given is an internal python attribute. For
example this function returns `True` for the `func_code` attribute of
python objects. This is useful if the environment method
:meth:`~SandboxedEnvironment.is_safe_attribute` is overridden.
>... | [
"def",
"is_internal_attribute",
"(",
"obj",
",",
"attr",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"types",
".",
"FunctionType",
")",
":",
"if",
"attr",
"in",
"UNSAFE_FUNCTION_ATTRIBUTES",
":",
"return",
"True",
"elif",
"isinstance",
"(",
"obj",
",",
... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/deps/v8/third_party/jinja2/sandbox.py#L171-L204 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/threading.py | python | Thread.start | (self) | Start the thread's activity.
It must be called at most once per thread object. It arranges for the
object's run() method to be invoked in a separate thread of control.
This method will raise a RuntimeError if called more than once on the
same thread object. | Start the thread's activity. | [
"Start",
"the",
"thread",
"s",
"activity",
"."
] | def start(self):
"""Start the thread's activity.
It must be called at most once per thread object. It arranges for the
object's run() method to be invoked in a separate thread of control.
This method will raise a RuntimeError if called more than once on the
same thread object.
... | [
"def",
"start",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"__initialized",
":",
"raise",
"RuntimeError",
"(",
"\"thread.__init__() not called\"",
")",
"if",
"self",
".",
"__started",
".",
"is_set",
"(",
")",
":",
"raise",
"RuntimeError",
"(",
"\"threa... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/threading.py#L724-L748 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqt/mantidqt/project/project.py | python | Project._offer_large_size_confirmation | () | return QMessageBox.question(None, "You are trying to save a large project.",
"The project may take a long time to save. Would you like to continue?",
QMessageBox.Yes | QMessageBox.Cancel, QMessageBox.Cancel) | Asks the user to confirm that they want to save a large project.
:return: QMessageBox; The response from the user. Default is Yes. | Asks the user to confirm that they want to save a large project.
:return: QMessageBox; The response from the user. Default is Yes. | [
"Asks",
"the",
"user",
"to",
"confirm",
"that",
"they",
"want",
"to",
"save",
"a",
"large",
"project",
".",
":",
"return",
":",
"QMessageBox",
";",
"The",
"response",
"from",
"the",
"user",
".",
"Default",
"is",
"Yes",
"."
] | def _offer_large_size_confirmation():
"""
Asks the user to confirm that they want to save a large project.
:return: QMessageBox; The response from the user. Default is Yes.
"""
return QMessageBox.question(None, "You are trying to save a large project.",
... | [
"def",
"_offer_large_size_confirmation",
"(",
")",
":",
"return",
"QMessageBox",
".",
"question",
"(",
"None",
",",
"\"You are trying to save a large project.\"",
",",
"\"The project may take a long time to save. Would you like to continue?\"",
",",
"QMessageBox",
".",
"Yes",
"... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqt/mantidqt/project/project.py#L281-L288 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/bisect-builds.py | python | GetBlinkDEPSRevisionForChromiumRevision | (self, rev) | Returns the blink revision that was in REVISIONS file at
chromium revision |rev|. | Returns the blink revision that was in REVISIONS file at
chromium revision |rev|. | [
"Returns",
"the",
"blink",
"revision",
"that",
"was",
"in",
"REVISIONS",
"file",
"at",
"chromium",
"revision",
"|rev|",
"."
] | def GetBlinkDEPSRevisionForChromiumRevision(self, rev):
"""Returns the blink revision that was in REVISIONS file at
chromium revision |rev|."""
def _GetBlinkRev(url, blink_re):
m = blink_re.search(url.read())
url.close()
if m:
return m.group(1)
url = urllib.urlopen(DEPS_FILE % GetGitHashFrom... | [
"def",
"GetBlinkDEPSRevisionForChromiumRevision",
"(",
"self",
",",
"rev",
")",
":",
"def",
"_GetBlinkRev",
"(",
"url",
",",
"blink_re",
")",
":",
"m",
"=",
"blink_re",
".",
"search",
"(",
"url",
".",
"read",
"(",
")",
")",
"url",
".",
"close",
"(",
")... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/bisect-builds.py#L889-L904 | ||
networkit/networkit | 695b7a786a894a303fa8587597d5ef916e797729 | networkit/gephi/streaming.py | python | GephiStreamingClient.removeExportedEdge | (self, u, v) | Removes an edge from an already exported graph. | Removes an edge from an already exported graph. | [
"Removes",
"an",
"edge",
"from",
"an",
"already",
"exported",
"graph",
"."
] | def removeExportedEdge(self, u, v):
""" Removes an edge from an already exported graph."""
if self.graphExported != True:
print("Error: Cannot remove edges. Export Graph first!")
return
try:
self._pygephi.delete_edge(self._edgeId(u, v))
self._pygep... | [
"def",
"removeExportedEdge",
"(",
"self",
",",
"u",
",",
"v",
")",
":",
"if",
"self",
".",
"graphExported",
"!=",
"True",
":",
"print",
"(",
"\"Error: Cannot remove edges. Export Graph first!\"",
")",
"return",
"try",
":",
"self",
".",
"_pygephi",
".",
"delete... | https://github.com/networkit/networkit/blob/695b7a786a894a303fa8587597d5ef916e797729/networkit/gephi/streaming.py#L96-L105 | ||
rdkit/rdkit | ede860ae316d12d8568daf5ee800921c3389c84e | rdkit/ML/GrowComposite.py | python | SetDefaults | (runDetails=None) | return CompositeRun.SetDefaults(runDetails) | initializes a details object with default values
**Arguments**
- details: (optional) a _CompositeRun.CompositeRun_ object.
If this is not provided, the global _runDetails will be used.
**Returns**
the initialized _CompositeRun_ object. | initializes a details object with default values | [
"initializes",
"a",
"details",
"object",
"with",
"default",
"values"
] | def SetDefaults(runDetails=None):
""" initializes a details object with default values
**Arguments**
- details: (optional) a _CompositeRun.CompositeRun_ object.
If this is not provided, the global _runDetails will be used.
**Returns**
the initialized _CompositeRun_ object.
... | [
"def",
"SetDefaults",
"(",
"runDetails",
"=",
"None",
")",
":",
"if",
"runDetails",
"is",
"None",
":",
"runDetails",
"=",
"_runDetails",
"return",
"CompositeRun",
".",
"SetDefaults",
"(",
"runDetails",
")"
] | https://github.com/rdkit/rdkit/blob/ede860ae316d12d8568daf5ee800921c3389c84e/rdkit/ML/GrowComposite.py#L395-L411 | |
tiann/android-native-debug | 198903ed9346dc4a74327a63cb98d449b97d8047 | app/source/art/tools/cpplint.py | python | _NestingState.SeenOpenBrace | (self) | return (not self.stack) or self.stack[-1].seen_open_brace | Check if we have seen the opening brace for the innermost block.
Returns:
True if we have seen the opening brace, False if the innermost
block is still expecting an opening brace. | Check if we have seen the opening brace for the innermost block. | [
"Check",
"if",
"we",
"have",
"seen",
"the",
"opening",
"brace",
"for",
"the",
"innermost",
"block",
"."
] | def SeenOpenBrace(self):
"""Check if we have seen the opening brace for the innermost block.
Returns:
True if we have seen the opening brace, False if the innermost
block is still expecting an opening brace.
"""
return (not self.stack) or self.stack[-1].seen_open_brace | [
"def",
"SeenOpenBrace",
"(",
"self",
")",
":",
"return",
"(",
"not",
"self",
".",
"stack",
")",
"or",
"self",
".",
"stack",
"[",
"-",
"1",
"]",
".",
"seen_open_brace"
] | https://github.com/tiann/android-native-debug/blob/198903ed9346dc4a74327a63cb98d449b97d8047/app/source/art/tools/cpplint.py#L1517-L1524 | |
google/ion | ef47f3b824050499ce5c6f774b366f6c4dbce0af | ion/build.py | python | BuildState.GetGypFileToRun | (self) | return self.filename_ | Returns the gypfile that should be passed to gyp.
This method always returns a relative path from ROOT_DIR, because gyp
requires that the gypfile be specified relative to <(DEPTH) in order for
--generator_output_dir to work correctly, and we currently pass
--depth=ROOT_DIR.
Returns:
The rela... | Returns the gypfile that should be passed to gyp. | [
"Returns",
"the",
"gypfile",
"that",
"should",
"be",
"passed",
"to",
"gyp",
"."
] | def GetGypFileToRun(self):
"""Returns the gypfile that should be passed to gyp.
This method always returns a relative path from ROOT_DIR, because gyp
requires that the gypfile be specified relative to <(DEPTH) in order for
--generator_output_dir to work correctly, and we currently pass
--depth=ROOT... | [
"def",
"GetGypFileToRun",
"(",
"self",
")",
":",
"return",
"self",
".",
"filename_"
] | https://github.com/google/ion/blob/ef47f3b824050499ce5c6f774b366f6c4dbce0af/ion/build.py#L1615-L1626 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/compat/numpy/function.py | python | validate_argsort_with_ascending | (ascending, args, kwargs) | return ascending | If 'Categorical.argsort' is called via the 'numpy' library, the
first parameter in its signature is 'axis', which takes either
an integer or 'None', so check if the 'ascending' parameter has
either integer type or is None, since 'ascending' itself should
be a boolean | If 'Categorical.argsort' is called via the 'numpy' library, the
first parameter in its signature is 'axis', which takes either
an integer or 'None', so check if the 'ascending' parameter has
either integer type or is None, since 'ascending' itself should
be a boolean | [
"If",
"Categorical",
".",
"argsort",
"is",
"called",
"via",
"the",
"numpy",
"library",
"the",
"first",
"parameter",
"in",
"its",
"signature",
"is",
"axis",
"which",
"takes",
"either",
"an",
"integer",
"or",
"None",
"so",
"check",
"if",
"the",
"ascending",
... | def validate_argsort_with_ascending(ascending, args, kwargs):
"""
If 'Categorical.argsort' is called via the 'numpy' library, the
first parameter in its signature is 'axis', which takes either
an integer or 'None', so check if the 'ascending' parameter has
either integer type or is None, since 'asce... | [
"def",
"validate_argsort_with_ascending",
"(",
"ascending",
",",
"args",
",",
"kwargs",
")",
":",
"if",
"is_integer",
"(",
"ascending",
")",
"or",
"ascending",
"is",
"None",
":",
"args",
"=",
"(",
"ascending",
",",
")",
"+",
"args",
"ascending",
"=",
"True... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/compat/numpy/function.py#L133-L147 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | third_party/closure_linter/closure_linter/common/position.py | python | Position.AtBeginning | () | return Position(0, 0) | Create a Position representing the beginning of any string.
Returns:
The created Position object. | Create a Position representing the beginning of any string. | [
"Create",
"a",
"Position",
"representing",
"the",
"beginning",
"of",
"any",
"string",
"."
] | def AtBeginning():
"""Create a Position representing the beginning of any string.
Returns:
The created Position object.
"""
return Position(0, 0) | [
"def",
"AtBeginning",
"(",
")",
":",
"return",
"Position",
"(",
"0",
",",
"0",
")"
] | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/third_party/closure_linter/closure_linter/common/position.py#L87-L93 | |
zju3dv/clean-pvnet | 5870c509e3cc205e1bb28910a7b1a9a3c8add9a8 | lib/utils/meshrenderer/pysixd/transform.py | python | quaternion_inverse | (quaternion) | return q / numpy.dot(q, q) | Return inverse of quaternion.
>>> q0 = random_quaternion()
>>> q1 = quaternion_inverse(q0)
>>> numpy.allclose(quaternion_multiply(q0, q1), [1, 0, 0, 0])
True | Return inverse of quaternion. | [
"Return",
"inverse",
"of",
"quaternion",
"."
] | def quaternion_inverse(quaternion):
"""Return inverse of quaternion.
>>> q0 = random_quaternion()
>>> q1 = quaternion_inverse(q0)
>>> numpy.allclose(quaternion_multiply(q0, q1), [1, 0, 0, 0])
True
"""
q = numpy.array(quaternion, dtype=numpy.float64, copy=True)
numpy.negative(q[1:], q[1... | [
"def",
"quaternion_inverse",
"(",
"quaternion",
")",
":",
"q",
"=",
"numpy",
".",
"array",
"(",
"quaternion",
",",
"dtype",
"=",
"numpy",
".",
"float64",
",",
"copy",
"=",
"True",
")",
"numpy",
".",
"negative",
"(",
"q",
"[",
"1",
":",
"]",
",",
"q... | https://github.com/zju3dv/clean-pvnet/blob/5870c509e3cc205e1bb28910a7b1a9a3c8add9a8/lib/utils/meshrenderer/pysixd/transform.py#L1388-L1399 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/aui.py | python | AuiManager.Update | (*args, **kwargs) | return _aui.AuiManager_Update(*args, **kwargs) | Update(self) | Update(self) | [
"Update",
"(",
"self",
")"
] | def Update(*args, **kwargs):
"""Update(self)"""
return _aui.AuiManager_Update(*args, **kwargs) | [
"def",
"Update",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_aui",
".",
"AuiManager_Update",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/aui.py#L659-L661 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/pkg_resources/_vendor/pyparsing.py | python | ParseResults.asList | ( self ) | return [res.asList() if isinstance(res,ParseResults) else res for res in self.__toklist] | Returns the parse results as a nested list of matching tokens, all converted to strings.
Example::
patt = OneOrMore(Word(alphas))
result = patt.parseString("sldkj lsdkj sldkj")
# even though the result prints in string-like form, it is actually a pyparsing ParseResults
... | Returns the parse results as a nested list of matching tokens, all converted to strings. | [
"Returns",
"the",
"parse",
"results",
"as",
"a",
"nested",
"list",
"of",
"matching",
"tokens",
"all",
"converted",
"to",
"strings",
"."
] | def asList( self ):
"""
Returns the parse results as a nested list of matching tokens, all converted to strings.
Example::
patt = OneOrMore(Word(alphas))
result = patt.parseString("sldkj lsdkj sldkj")
# even though the result prints in string-like form, it is... | [
"def",
"asList",
"(",
"self",
")",
":",
"return",
"[",
"res",
".",
"asList",
"(",
")",
"if",
"isinstance",
"(",
"res",
",",
"ParseResults",
")",
"else",
"res",
"for",
"res",
"in",
"self",
".",
"__toklist",
"]"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/pkg_resources/_vendor/pyparsing.py#L704-L718 | |
hfinkel/llvm-project-cxxjit | 91084ef018240bbb8e24235ff5cd8c355a9c1a1e | clang/utils/check_cfc/check_cfc.py | python | get_temp_file_name | (suffix) | return tf.name | Get a temporary file name with a particular suffix. Let the caller be
responsible for deleting it. | Get a temporary file name with a particular suffix. Let the caller be
responsible for deleting it. | [
"Get",
"a",
"temporary",
"file",
"name",
"with",
"a",
"particular",
"suffix",
".",
"Let",
"the",
"caller",
"be",
"responsible",
"for",
"deleting",
"it",
"."
] | def get_temp_file_name(suffix):
"""Get a temporary file name with a particular suffix. Let the caller be
responsible for deleting it."""
tf = tempfile.NamedTemporaryFile(suffix=suffix, delete=False)
tf.close()
return tf.name | [
"def",
"get_temp_file_name",
"(",
"suffix",
")",
":",
"tf",
"=",
"tempfile",
".",
"NamedTemporaryFile",
"(",
"suffix",
"=",
"suffix",
",",
"delete",
"=",
"False",
")",
"tf",
".",
"close",
"(",
")",
"return",
"tf",
".",
"name"
] | https://github.com/hfinkel/llvm-project-cxxjit/blob/91084ef018240bbb8e24235ff5cd8c355a9c1a1e/clang/utils/check_cfc/check_cfc.py#L241-L246 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/abins/powdercalculator.py | python | PowderCalculator._calculate_powder | (self) | return powder | Calculates powder data (a_tensors, b_tensors according to aCLIMAX manual). | Calculates powder data (a_tensors, b_tensors according to aCLIMAX manual). | [
"Calculates",
"powder",
"data",
"(",
"a_tensors",
"b_tensors",
"according",
"to",
"aCLIMAX",
"manual",
")",
"."
] | def _calculate_powder(self) -> abins.PowderData:
"""
Calculates powder data (a_tensors, b_tensors according to aCLIMAX manual).
"""
k_indices = sorted(self._frequencies.keys()) # make sure dictionary keys are in the same order on each machine
b_tensors = {}
a_tensors = ... | [
"def",
"_calculate_powder",
"(",
"self",
")",
"->",
"abins",
".",
"PowderData",
":",
"k_indices",
"=",
"sorted",
"(",
"self",
".",
"_frequencies",
".",
"keys",
"(",
")",
")",
"# make sure dictionary keys are in the same order on each machine",
"b_tensors",
"=",
"{",... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/abins/powdercalculator.py#L44-L63 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/cuda/cudadrv/driver.py | python | Context.get_ipc_handle | (self, memory) | return IpcHandle(memory, ipchandle, memory.size, source_info,
offset=offset) | Returns a *IpcHandle* from a GPU allocation. | Returns a *IpcHandle* from a GPU allocation. | [
"Returns",
"a",
"*",
"IpcHandle",
"*",
"from",
"a",
"GPU",
"allocation",
"."
] | def get_ipc_handle(self, memory):
"""
Returns a *IpcHandle* from a GPU allocation.
"""
if not SUPPORTS_IPC:
raise OSError('OS does not support CUDA IPC')
ipchandle = drvapi.cu_ipc_mem_handle()
driver.cuIpcGetMemHandle(
ctypes.byref(ipchandle),
... | [
"def",
"get_ipc_handle",
"(",
"self",
",",
"memory",
")",
":",
"if",
"not",
"SUPPORTS_IPC",
":",
"raise",
"OSError",
"(",
"'OS does not support CUDA IPC'",
")",
"ipchandle",
"=",
"drvapi",
".",
"cu_ipc_mem_handle",
"(",
")",
"driver",
".",
"cuIpcGetMemHandle",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/cuda/cudadrv/driver.py#L838-L852 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/strings.py | python | str_replace | (arr, pat, repl, n=-1, case=None, flags=0, regex=True) | return _na_map(f, arr, dtype=str) | r"""
Replace occurrences of pattern/regex in the Series/Index with
some other string. Equivalent to :meth:`str.replace` or
:func:`re.sub`.
Parameters
----------
pat : str or compiled regex
String can be a character sequence or regular expression.
repl : str or callable
Repla... | r"""
Replace occurrences of pattern/regex in the Series/Index with
some other string. Equivalent to :meth:`str.replace` or
:func:`re.sub`. | [
"r",
"Replace",
"occurrences",
"of",
"pattern",
"/",
"regex",
"in",
"the",
"Series",
"/",
"Index",
"with",
"some",
"other",
"string",
".",
"Equivalent",
"to",
":",
"meth",
":",
"str",
".",
"replace",
"or",
":",
"func",
":",
"re",
".",
"sub",
"."
] | def str_replace(arr, pat, repl, n=-1, case=None, flags=0, regex=True):
r"""
Replace occurrences of pattern/regex in the Series/Index with
some other string. Equivalent to :meth:`str.replace` or
:func:`re.sub`.
Parameters
----------
pat : str or compiled regex
String can be a charact... | [
"def",
"str_replace",
"(",
"arr",
",",
"pat",
",",
"repl",
",",
"n",
"=",
"-",
"1",
",",
"case",
"=",
"None",
",",
"flags",
"=",
"0",
",",
"regex",
"=",
"True",
")",
":",
"# Check whether repl is valid (GH 13438, GH 15055)",
"if",
"not",
"(",
"isinstance... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/strings.py#L573-L726 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/image/detection.py | python | DetBorrowAug.dumps | (self) | return [self.__class__.__name__.lower(), self.augmenter.dumps()] | Override the default one to avoid duplicate dump. | Override the default one to avoid duplicate dump. | [
"Override",
"the",
"default",
"one",
"to",
"avoid",
"duplicate",
"dump",
"."
] | def dumps(self):
"""Override the default one to avoid duplicate dump."""
return [self.__class__.__name__.lower(), self.augmenter.dumps()] | [
"def",
"dumps",
"(",
"self",
")",
":",
"return",
"[",
"self",
".",
"__class__",
".",
"__name__",
".",
"lower",
"(",
")",
",",
"self",
".",
"augmenter",
".",
"dumps",
"(",
")",
"]"
] | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/image/detection.py#L81-L83 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/wsgiref/headers.py | python | Headers.keys | (self) | return [k for k, v in self._headers] | Return a list of all the header field names.
These will be sorted in the order they appeared in the original header
list, or were added to this instance, and may contain duplicates.
Any fields deleted and re-inserted are always appended to the header
list. | Return a list of all the header field names. | [
"Return",
"a",
"list",
"of",
"all",
"the",
"header",
"field",
"names",
"."
] | def keys(self):
"""Return a list of all the header field names.
These will be sorted in the order they appeared in the original header
list, or were added to this instance, and may contain duplicates.
Any fields deleted and re-inserted are always appended to the header
list.
... | [
"def",
"keys",
"(",
"self",
")",
":",
"return",
"[",
"k",
"for",
"k",
",",
"v",
"in",
"self",
".",
"_headers",
"]"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/wsgiref/headers.py#L95-L103 | |
geemaple/leetcode | 68bc5032e1ee52c22ef2f2e608053484c487af54 | leetcode/55.jump-game.py | python | Solution2.canJump | (self, nums) | return table[-1] | :type nums: List[int]
:rtype: bool | :type nums: List[int]
:rtype: bool | [
":",
"type",
"nums",
":",
"List",
"[",
"int",
"]",
":",
"rtype",
":",
"bool"
] | def canJump(self, nums):
"""
:type nums: List[int]
:rtype: bool
"""
table = [False] * len(nums)
table[0] = True
for i in range(len(nums)):
for j in range(i):
if table[j] and nums[j] >= i - j:
table[i] = True
... | [
"def",
"canJump",
"(",
"self",
",",
"nums",
")",
":",
"table",
"=",
"[",
"False",
"]",
"*",
"len",
"(",
"nums",
")",
"table",
"[",
"0",
"]",
"=",
"True",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"nums",
")",
")",
":",
"for",
"j",
"in",
"... | https://github.com/geemaple/leetcode/blob/68bc5032e1ee52c22ef2f2e608053484c487af54/leetcode/55.jump-game.py#L19-L33 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/operations/array_ops.py | python | Padding.__init__ | (self, pad_dim_size=8) | Initialize padding | Initialize padding | [
"Initialize",
"padding"
] | def __init__(self, pad_dim_size=8):
"""Initialize padding"""
validator.check_value_type("pad_dim_size", pad_dim_size, [int], self.name)
validator.check_positive_int(pad_dim_size, "pad_dim_size", self.name)
self.pad_dim_size = pad_dim_size | [
"def",
"__init__",
"(",
"self",
",",
"pad_dim_size",
"=",
"8",
")",
":",
"validator",
".",
"check_value_type",
"(",
"\"pad_dim_size\"",
",",
"pad_dim_size",
",",
"[",
"int",
"]",
",",
"self",
".",
"name",
")",
"validator",
".",
"check_positive_int",
"(",
"... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/operations/array_ops.py#L993-L997 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | third_party/jinja2/filters.py | python | do_float | (value, default=0.0) | Convert the value into a floating point number. If the
conversion doesn't work it will return ``0.0``. You can
override this default using the first parameter. | Convert the value into a floating point number. If the
conversion doesn't work it will return ``0.0``. You can
override this default using the first parameter. | [
"Convert",
"the",
"value",
"into",
"a",
"floating",
"point",
"number",
".",
"If",
"the",
"conversion",
"doesn",
"t",
"work",
"it",
"will",
"return",
"0",
".",
"0",
".",
"You",
"can",
"override",
"this",
"default",
"using",
"the",
"first",
"parameter",
".... | def do_float(value, default=0.0):
"""Convert the value into a floating point number. If the
conversion doesn't work it will return ``0.0``. You can
override this default using the first parameter.
"""
try:
return float(value)
except (TypeError, ValueError):
return default | [
"def",
"do_float",
"(",
"value",
",",
"default",
"=",
"0.0",
")",
":",
"try",
":",
"return",
"float",
"(",
"value",
")",
"except",
"(",
"TypeError",
",",
"ValueError",
")",
":",
"return",
"default"
] | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/third_party/jinja2/filters.py#L521-L529 | ||
sdhash/sdhash | b9eff63e4e5867e910f41fd69032bbb1c94a2a5e | sdhash-ui/cherrypy/wsgiserver/ssl_pyopenssl.py | python | pyOpenSSLAdapter.wrap | (self, sock) | return sock, self._environ.copy() | Wrap and return the given socket, plus WSGI environ entries. | Wrap and return the given socket, plus WSGI environ entries. | [
"Wrap",
"and",
"return",
"the",
"given",
"socket",
"plus",
"WSGI",
"environ",
"entries",
"."
] | def wrap(self, sock):
"""Wrap and return the given socket, plus WSGI environ entries."""
return sock, self._environ.copy() | [
"def",
"wrap",
"(",
"self",
",",
"sock",
")",
":",
"return",
"sock",
",",
"self",
".",
"_environ",
".",
"copy",
"(",
")"
] | https://github.com/sdhash/sdhash/blob/b9eff63e4e5867e910f41fd69032bbb1c94a2a5e/sdhash-ui/cherrypy/wsgiserver/ssl_pyopenssl.py#L189-L191 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/plistlib.py | python | load | (fp, *, fmt=None, dict_type=dict) | return p.parse(fp) | Read a .plist file. 'fp' should be a readable and binary file object.
Return the unpacked root object (which usually is a dictionary). | Read a .plist file. 'fp' should be a readable and binary file object.
Return the unpacked root object (which usually is a dictionary). | [
"Read",
"a",
".",
"plist",
"file",
".",
"fp",
"should",
"be",
"a",
"readable",
"and",
"binary",
"file",
"object",
".",
"Return",
"the",
"unpacked",
"root",
"object",
"(",
"which",
"usually",
"is",
"a",
"dictionary",
")",
"."
] | def load(fp, *, fmt=None, dict_type=dict):
"""Read a .plist file. 'fp' should be a readable and binary file object.
Return the unpacked root object (which usually is a dictionary).
"""
if fmt is None:
header = fp.read(32)
fp.seek(0)
for info in _FORMATS.values():
if i... | [
"def",
"load",
"(",
"fp",
",",
"*",
",",
"fmt",
"=",
"None",
",",
"dict_type",
"=",
"dict",
")",
":",
"if",
"fmt",
"is",
"None",
":",
"header",
"=",
"fp",
".",
"read",
"(",
"32",
")",
"fp",
".",
"seek",
"(",
"0",
")",
"for",
"info",
"in",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/plistlib.py#L856-L875 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/profiler/internal/flops_registry.py | python | _arg_min_flops | (graph, node) | return _reduction_op_flops(graph, node, reduce_flops=1, finalize_flops=0) | Compute flops for ArgMin operation. | Compute flops for ArgMin operation. | [
"Compute",
"flops",
"for",
"ArgMin",
"operation",
"."
] | def _arg_min_flops(graph, node):
"""Compute flops for ArgMin operation."""
# reduction - comparison, no finalization
return _reduction_op_flops(graph, node, reduce_flops=1, finalize_flops=0) | [
"def",
"_arg_min_flops",
"(",
"graph",
",",
"node",
")",
":",
"# reduction - comparison, no finalization",
"return",
"_reduction_op_flops",
"(",
"graph",
",",
"node",
",",
"reduce_flops",
"=",
"1",
",",
"finalize_flops",
"=",
"0",
")"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/profiler/internal/flops_registry.py#L270-L273 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/debug/cli/base_ui.py | python | BaseUI.register_command_handler | (self,
prefix,
handler,
help_info,
prefix_aliases=None) | A wrapper around CommandHandlerRegistry.register_command_handler().
In addition to calling the wrapped register_command_handler() method, this
method also registers the top-level tab-completion context based on the
command prefixes and their aliases.
See the doc string of the wrapped method for more d... | A wrapper around CommandHandlerRegistry.register_command_handler(). | [
"A",
"wrapper",
"around",
"CommandHandlerRegistry",
".",
"register_command_handler",
"()",
"."
] | def register_command_handler(self,
prefix,
handler,
help_info,
prefix_aliases=None):
"""A wrapper around CommandHandlerRegistry.register_command_handler().
In addition to calling the wrap... | [
"def",
"register_command_handler",
"(",
"self",
",",
"prefix",
",",
"handler",
",",
"help_info",
",",
"prefix_aliases",
"=",
"None",
")",
":",
"self",
".",
"_command_handler_registry",
".",
"register_command_handler",
"(",
"prefix",
",",
"handler",
",",
"help_info... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/debug/cli/base_ui.py#L63-L88 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/setuptools/__init__.py | python | _find_all_simple | (path) | return filter(os.path.isfile, results) | Find all files under 'path' | Find all files under 'path' | [
"Find",
"all",
"files",
"under",
"path"
] | def _find_all_simple(path):
"""
Find all files under 'path'
"""
results = (
os.path.join(base, file)
for base, dirs, files in os.walk(path, followlinks=True)
for file in files
)
return filter(os.path.isfile, results) | [
"def",
"_find_all_simple",
"(",
"path",
")",
":",
"results",
"=",
"(",
"os",
".",
"path",
".",
"join",
"(",
"base",
",",
"file",
")",
"for",
"base",
",",
"dirs",
",",
"files",
"in",
"os",
".",
"walk",
"(",
"path",
",",
"followlinks",
"=",
"True",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/setuptools/__init__.py#L156-L165 | |
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Code/Tools/waf-1.7.13/waflib/Build.py | python | BuildContext.get_tgen_by_name | (self, name) | Retrieves a task generator from its name or its target name
the name must be unique::
def build(bld):
tg = bld(name='foo')
tg == bld.get_tgen_by_name('foo') | Retrieves a task generator from its name or its target name
the name must be unique:: | [
"Retrieves",
"a",
"task",
"generator",
"from",
"its",
"name",
"or",
"its",
"target",
"name",
"the",
"name",
"must",
"be",
"unique",
"::"
] | def get_tgen_by_name(self, name):
"""
Retrieves a task generator from its name or its target name
the name must be unique::
def build(bld):
tg = bld(name='foo')
tg == bld.get_tgen_by_name('foo')
"""
cache = self.task_gen_cache_names
if not cache:
# create the index lazily
for g in self.gro... | [
"def",
"get_tgen_by_name",
"(",
"self",
",",
"name",
")",
":",
"cache",
"=",
"self",
".",
"task_gen_cache_names",
"if",
"not",
"cache",
":",
"# create the index lazily",
"for",
"g",
"in",
"self",
".",
"groups",
":",
"for",
"tg",
"in",
"g",
":",
"try",
":... | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Code/Tools/waf-1.7.13/waflib/Build.py#L509-L534 | ||
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/python/training/training_util.py | python | write_graph | (graph_def, logdir, name, as_text=True) | Writes a graph proto to a file.
The graph is written as a binary proto unless `as_text` is `True`.
```python
v = tf.Variable(0, name='my_variable')
sess = tf.Session()
tf.train.write_graph(sess.graph_def, '/tmp/my-model', 'train.pbtxt')
```
Args:
graph_def: A `GraphDef` protocol buffer.
logdir:... | Writes a graph proto to a file. | [
"Writes",
"a",
"graph",
"proto",
"to",
"a",
"file",
"."
] | def write_graph(graph_def, logdir, name, as_text=True):
"""Writes a graph proto to a file.
The graph is written as a binary proto unless `as_text` is `True`.
```python
v = tf.Variable(0, name='my_variable')
sess = tf.Session()
tf.train.write_graph(sess.graph_def, '/tmp/my-model', 'train.pbtxt')
```
A... | [
"def",
"write_graph",
"(",
"graph_def",
",",
"logdir",
",",
"name",
",",
"as_text",
"=",
"True",
")",
":",
"# gcs does not have the concept of directory at the moment.",
"if",
"not",
"file_io",
".",
"file_exists",
"(",
"logdir",
")",
"and",
"not",
"logdir",
".",
... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/python/training/training_util.py#L53-L78 | ||
MegEngine/MegEngine | ce9ad07a27ec909fb8db4dd67943d24ba98fb93a | lite/pylite/megenginelite/tensor.py | python | LiteTensor.to_numpy | (self) | get the buffer of the tensor | get the buffer of the tensor | [
"get",
"the",
"buffer",
"of",
"the",
"tensor"
] | def to_numpy(self):
"""
get the buffer of the tensor
"""
self.update()
if self.nbytes <= 0:
np_type = _lite_type_to_nptypes[LiteDataType(self._layout.data_type)]
return np.array([], dtype=np_type)
if self.is_continue and (
self.is_pinne... | [
"def",
"to_numpy",
"(",
"self",
")",
":",
"self",
".",
"update",
"(",
")",
"if",
"self",
".",
"nbytes",
"<=",
"0",
":",
"np_type",
"=",
"_lite_type_to_nptypes",
"[",
"LiteDataType",
"(",
"self",
".",
"_layout",
".",
"data_type",
")",
"]",
"return",
"np... | https://github.com/MegEngine/MegEngine/blob/ce9ad07a27ec909fb8db4dd67943d24ba98fb93a/lite/pylite/megenginelite/tensor.py#L460-L483 | ||
nsnam/ns-3-dev-git | efdb2e21f45c0a87a60b47c547b68fa140a7b686 | src/visualizer/visualizer/plugins/show_last_packets.py | python | ShowLastPackets._response_cb | (self, win, response) | !
Response callback function
@param self this object
@param win the window
@param response the response
@return none | !
Response callback function | [
"!",
"Response",
"callback",
"function"
] | def _response_cb(self, win, response):
"""!
Response callback function
@param self this object
@param win the window
@param response the response
@return none
"""
self.win.destroy()
self.visualizer.remove_information_window(self) | [
"def",
"_response_cb",
"(",
"self",
",",
"win",
",",
"response",
")",
":",
"self",
".",
"win",
".",
"destroy",
"(",
")",
"self",
".",
"visualizer",
".",
"remove_information_window",
"(",
"self",
")"
] | https://github.com/nsnam/ns-3-dev-git/blob/efdb2e21f45c0a87a60b47c547b68fa140a7b686/src/visualizer/visualizer/plugins/show_last_packets.py#L258-L267 | ||
ivansafrin/Polycode | 37a40fefe194ec7f6e9d1257f3bb3517b0a168bc | Bindings/Scripts/create_lua_library/CppHeaderParser.py | python | CppUnion.show | (self) | Convert class to a string | Convert class to a string | [
"Convert",
"class",
"to",
"a",
"string"
] | def show(self):
"""Convert class to a string"""
print self | [
"def",
"show",
"(",
"self",
")",
":",
"print",
"self"
] | https://github.com/ivansafrin/Polycode/blob/37a40fefe194ec7f6e9d1257f3bb3517b0a168bc/Bindings/Scripts/create_lua_library/CppHeaderParser.py#L609-L611 | ||
BitMEX/api-connectors | 37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812 | auto-generated/python/swagger_client/models/position.py | python | Position.session_margin | (self, session_margin) | Sets the session_margin of this Position.
:param session_margin: The session_margin of this Position. # noqa: E501
:type: float | Sets the session_margin of this Position. | [
"Sets",
"the",
"session_margin",
"of",
"this",
"Position",
"."
] | def session_margin(self, session_margin):
"""Sets the session_margin of this Position.
:param session_margin: The session_margin of this Position. # noqa: E501
:type: float
"""
self._session_margin = session_margin | [
"def",
"session_margin",
"(",
"self",
",",
"session_margin",
")",
":",
"self",
".",
"_session_margin",
"=",
"session_margin"
] | https://github.com/BitMEX/api-connectors/blob/37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812/auto-generated/python/swagger_client/models/position.py#L1795-L1803 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/plat-mac/lib-scriptpackages/StdSuites/AppleScript_Suite.py | python | AppleScript_Suite_Events.idle | (self, _no_object=None, _attributes={}, **_arguments) | idle: Sent to a script application when it is idle
Keyword argument _attributes: AppleEvent attribute dictionary
Returns: the number of seconds to wait for next idle event | idle: Sent to a script application when it is idle
Keyword argument _attributes: AppleEvent attribute dictionary
Returns: the number of seconds to wait for next idle event | [
"idle",
":",
"Sent",
"to",
"a",
"script",
"application",
"when",
"it",
"is",
"idle",
"Keyword",
"argument",
"_attributes",
":",
"AppleEvent",
"attribute",
"dictionary",
"Returns",
":",
"the",
"number",
"of",
"seconds",
"to",
"wait",
"for",
"next",
"idle",
"e... | def idle(self, _no_object=None, _attributes={}, **_arguments):
"""idle: Sent to a script application when it is idle
Keyword argument _attributes: AppleEvent attribute dictionary
Returns: the number of seconds to wait for next idle event
"""
_code = 'misc'
_subcode = 'idl... | [
"def",
"idle",
"(",
"self",
",",
"_no_object",
"=",
"None",
",",
"_attributes",
"=",
"{",
"}",
",",
"*",
"*",
"_arguments",
")",
":",
"_code",
"=",
"'misc'",
"_subcode",
"=",
"'idle'",
"if",
"_arguments",
":",
"raise",
"TypeError",
",",
"'No optional arg... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/plat-mac/lib-scriptpackages/StdSuites/AppleScript_Suite.py#L437-L455 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/pythonwin/pywin/tools/browser.py | python | Browse | (ob=__main__) | Browse the argument, or the main dictionary | Browse the argument, or the main dictionary | [
"Browse",
"the",
"argument",
"or",
"the",
"main",
"dictionary"
] | def Browse (ob=__main__):
" Browse the argument, or the main dictionary "
root = MakeHLI (ob, 'root')
if not root.IsExpandable():
raise TypeError("Browse() argument must have __dict__ attribute, or be a Browser supported type")
dlg = dynamic_browser (root)
dlg.CreateWindow() | [
"def",
"Browse",
"(",
"ob",
"=",
"__main__",
")",
":",
"root",
"=",
"MakeHLI",
"(",
"ob",
",",
"'root'",
")",
"if",
"not",
"root",
".",
"IsExpandable",
"(",
")",
":",
"raise",
"TypeError",
"(",
"\"Browse() argument must have __dict__ attribute, or be a Browser s... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/pythonwin/pywin/tools/browser.py#L371-L378 | ||
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/python/ops/math_grad.py | python | _ComplexAbsGrad | (op, grad) | return (math_ops.complex(grad, array_ops.zeros_like(grad)) *
math_ops.sign(op.inputs[0])) | Returns the gradient of ComplexAbs. | Returns the gradient of ComplexAbs. | [
"Returns",
"the",
"gradient",
"of",
"ComplexAbs",
"."
] | def _ComplexAbsGrad(op, grad):
"""Returns the gradient of ComplexAbs."""
# TODO(b/27786104): The cast to complex could be removed once arithmetic
# supports mixtures of complex64 and real values.
return (math_ops.complex(grad, array_ops.zeros_like(grad)) *
math_ops.sign(op.inputs[0])) | [
"def",
"_ComplexAbsGrad",
"(",
"op",
",",
"grad",
")",
":",
"# TODO(b/27786104): The cast to complex could be removed once arithmetic",
"# supports mixtures of complex64 and real values.",
"return",
"(",
"math_ops",
".",
"complex",
"(",
"grad",
",",
"array_ops",
".",
"zeros_l... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/python/ops/math_grad.py#L768-L773 | |
rdiankov/openrave | d1a23023fd4b58f077d2ca949ceaf1b91f3f13d7 | python/databases/inversereachability.py | python | InverseReachabilityModel.showEquivalenceClass | (self,equivalenceclass,transparency = 0.8,neighthresh=0.1,onlymaniplinks=True) | Overlays several robots of the same equivalence class | Overlays several robots of the same equivalence class | [
"Overlays",
"several",
"robots",
"of",
"the",
"same",
"equivalence",
"class"
] | def showEquivalenceClass(self,equivalenceclass,transparency = 0.8,neighthresh=0.1,onlymaniplinks=True):
"""Overlays several robots of the same equivalence class"""
inds = linkstatistics.LinkStatisticsModel.prunePointsKDTree(equivalenceclass[2][:,0:3],neighthresh,1)
robotlocs = []
with se... | [
"def",
"showEquivalenceClass",
"(",
"self",
",",
"equivalenceclass",
",",
"transparency",
"=",
"0.8",
",",
"neighthresh",
"=",
"0.1",
",",
"onlymaniplinks",
"=",
"True",
")",
":",
"inds",
"=",
"linkstatistics",
".",
"LinkStatisticsModel",
".",
"prunePointsKDTree",... | https://github.com/rdiankov/openrave/blob/d1a23023fd4b58f077d2ca949ceaf1b91f3f13d7/python/databases/inversereachability.py#L599-L643 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/HFIR_4Circle_Reduction/reduce4circleGUI.py | python | MainWindow.do_export_detector_views_to_movie | (self) | go through all surveyed scans. plot all the measurements from all the scans. record the plot to PNG files,
and possibly convert them to movies
:return: | go through all surveyed scans. plot all the measurements from all the scans. record the plot to PNG files,
and possibly convert them to movies
:return: | [
"go",
"through",
"all",
"surveyed",
"scans",
".",
"plot",
"all",
"the",
"measurements",
"from",
"all",
"the",
"scans",
".",
"record",
"the",
"plot",
"to",
"PNG",
"files",
"and",
"possibly",
"convert",
"them",
"to",
"movies",
":",
"return",
":"
] | def do_export_detector_views_to_movie(self):
"""
go through all surveyed scans. plot all the measurements from all the scans. record the plot to PNG files,
and possibly convert them to movies
:return:
"""
scan_list = self.ui.tableWidget_surveyTable.get_scan_numbers(range(... | [
"def",
"do_export_detector_views_to_movie",
"(",
"self",
")",
":",
"scan_list",
"=",
"self",
".",
"ui",
".",
"tableWidget_surveyTable",
".",
"get_scan_numbers",
"(",
"range",
"(",
"self",
".",
"ui",
".",
"tableWidget_surveyTable",
".",
"rowCount",
"(",
")",
")",... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/HFIR_4Circle_Reduction/reduce4circleGUI.py#L1188-L1228 | ||
swift/swift | 12d031cf8177fdec0137f9aa7e2912fa23c4416b | 3rdParty/SCons/scons-3.0.1/engine/SCons/Tool/bcc32.py | python | generate | (env) | Add Builders and construction variables for bcc to an
Environment. | Add Builders and construction variables for bcc to an
Environment. | [
"Add",
"Builders",
"and",
"construction",
"variables",
"for",
"bcc",
"to",
"an",
"Environment",
"."
] | def generate(env):
findIt('bcc32', env)
"""Add Builders and construction variables for bcc to an
Environment."""
static_obj, shared_obj = SCons.Tool.createObjBuilders(env)
for suffix in ['.c', '.cpp']:
static_obj.add_action(suffix, SCons.Defaults.CAction)
shared_obj.add_action(suffix... | [
"def",
"generate",
"(",
"env",
")",
":",
"findIt",
"(",
"'bcc32'",
",",
"env",
")",
"static_obj",
",",
"shared_obj",
"=",
"SCons",
".",
"Tool",
".",
"createObjBuilders",
"(",
"env",
")",
"for",
"suffix",
"in",
"[",
"'.c'",
",",
"'.cpp'",
"]",
":",
"s... | https://github.com/swift/swift/blob/12d031cf8177fdec0137f9aa7e2912fa23c4416b/3rdParty/SCons/scons-3.0.1/engine/SCons/Tool/bcc32.py#L47-L72 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/extern/aui/auibook.py | python | AuiTabContainer.IsTabVisible | (self, tabPage, tabOffset, dc, wnd) | return True | Returns whether a tab is visible or not.
:param integer `tabPage`: the tab index;
:param integer `tabOffset`: the tab offset;
:param `dc`: a :class:`DC` device context;
:param `wnd`: an instance of :class:`Window` derived window. | Returns whether a tab is visible or not. | [
"Returns",
"whether",
"a",
"tab",
"is",
"visible",
"or",
"not",
"."
] | def IsTabVisible(self, tabPage, tabOffset, dc, wnd):
"""
Returns whether a tab is visible or not.
:param integer `tabPage`: the tab index;
:param integer `tabOffset`: the tab offset;
:param `dc`: a :class:`DC` device context;
:param `wnd`: an instance of :class:`Window` ... | [
"def",
"IsTabVisible",
"(",
"self",
",",
"tabPage",
",",
"tabOffset",
",",
"dc",
",",
"wnd",
")",
":",
"if",
"not",
"dc",
"or",
"not",
"dc",
".",
"IsOk",
"(",
")",
":",
"return",
"False",
"page_count",
"=",
"len",
"(",
"self",
".",
"_pages",
")",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/extern/aui/auibook.py#L1569-L1680 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/email/iterators.py | python | walk | (self) | Walk over the message tree, yielding each subpart.
The walk is performed in depth-first order. This method is a
generator. | Walk over the message tree, yielding each subpart. | [
"Walk",
"over",
"the",
"message",
"tree",
"yielding",
"each",
"subpart",
"."
] | def walk(self):
"""Walk over the message tree, yielding each subpart.
The walk is performed in depth-first order. This method is a
generator.
"""
yield self
if self.is_multipart():
for subpart in self.get_payload():
yield from subpart.walk() | [
"def",
"walk",
"(",
"self",
")",
":",
"yield",
"self",
"if",
"self",
".",
"is_multipart",
"(",
")",
":",
"for",
"subpart",
"in",
"self",
".",
"get_payload",
"(",
")",
":",
"yield",
"from",
"subpart",
".",
"walk",
"(",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/email/iterators.py#L20-L29 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | third_party/jinja2/bccache.py | python | Bucket.write_bytecode | (self, f) | Dump the bytecode into the file or file like object passed. | Dump the bytecode into the file or file like object passed. | [
"Dump",
"the",
"bytecode",
"into",
"the",
"file",
"or",
"file",
"like",
"object",
"passed",
"."
] | def write_bytecode(self, f):
"""Dump the bytecode into the file or file like object passed."""
if self.code is None:
raise TypeError('can\'t write empty bucket')
f.write(bc_magic)
pickle.dump(self.checksum, f, 2)
marshal_dump(self.code, f) | [
"def",
"write_bytecode",
"(",
"self",
",",
"f",
")",
":",
"if",
"self",
".",
"code",
"is",
"None",
":",
"raise",
"TypeError",
"(",
"'can\\'t write empty bucket'",
")",
"f",
".",
"write",
"(",
"bc_magic",
")",
"pickle",
".",
"dump",
"(",
"self",
".",
"c... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/third_party/jinja2/bccache.py#L90-L96 | ||
generalized-intelligence/GAAS | 29ab17d3e8a4ba18edef3a57c36d8db6329fac73 | deprecated/algorithms/sfm/OpenSfM/opensfm/transformations.py | python | quaternion_about_axis | (angle, axis) | return q | Return quaternion for rotation about axis.
>>> q = quaternion_about_axis(0.123, [1, 0, 0])
>>> numpy.allclose(q, [0.99810947, 0.06146124, 0, 0])
True | Return quaternion for rotation about axis. | [
"Return",
"quaternion",
"for",
"rotation",
"about",
"axis",
"."
] | def quaternion_about_axis(angle, axis):
"""Return quaternion for rotation about axis.
>>> q = quaternion_about_axis(0.123, [1, 0, 0])
>>> numpy.allclose(q, [0.99810947, 0.06146124, 0, 0])
True
"""
q = numpy.array([0.0, axis[0], axis[1], axis[2]])
qlen = vector_norm(q)
if qlen > _EPS:
... | [
"def",
"quaternion_about_axis",
"(",
"angle",
",",
"axis",
")",
":",
"q",
"=",
"numpy",
".",
"array",
"(",
"[",
"0.0",
",",
"axis",
"[",
"0",
"]",
",",
"axis",
"[",
"1",
"]",
",",
"axis",
"[",
"2",
"]",
"]",
")",
"qlen",
"=",
"vector_norm",
"("... | https://github.com/generalized-intelligence/GAAS/blob/29ab17d3e8a4ba18edef3a57c36d8db6329fac73/deprecated/algorithms/sfm/OpenSfM/opensfm/transformations.py#L1233-L1246 | |
simsong/bulk_extractor | 738911df22b7066ca9e1662f4131fb44090a4196 | python/ttable.py | python | ttable.typeset | (self,mode='text') | return "".join(ret) | Returns the typset output of the entire table | Returns the typset output of the entire table | [
"Returns",
"the",
"typset",
"output",
"of",
"the",
"entire",
"table"
] | def typeset(self,mode='text'):
" Returns the typset output of the entire table"
self.cols = self.ncols() # cache
self.mode = mode
if self.mode not in ['text','latex','html']:
raise ValueError("Invalid typsetting mode "+self.mode)
ret = []
if self.mode=='tex... | [
"def",
"typeset",
"(",
"self",
",",
"mode",
"=",
"'text'",
")",
":",
"self",
".",
"cols",
"=",
"self",
".",
"ncols",
"(",
")",
"# cache",
"self",
".",
"mode",
"=",
"mode",
"if",
"self",
".",
"mode",
"not",
"in",
"[",
"'text'",
",",
"'latex'",
","... | https://github.com/simsong/bulk_extractor/blob/738911df22b7066ca9e1662f4131fb44090a4196/python/ttable.py#L334-L402 | |
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | torch/cuda/__init__.py | python | can_device_access_peer | (device: _device_t, peer_device: _device_t) | return torch._C._cuda_canDeviceAccessPeer(device, peer_device) | r"""Checks if peer access between two devices is possible. | r"""Checks if peer access between two devices is possible. | [
"r",
"Checks",
"if",
"peer",
"access",
"between",
"two",
"devices",
"is",
"possible",
"."
] | def can_device_access_peer(device: _device_t, peer_device: _device_t) -> bool:
r"""Checks if peer access between two devices is possible.
"""
_lazy_init()
device = _get_device_index(device, optional=True)
peer_device = _get_device_index(peer_device)
if device < 0 or device >= device_count():
... | [
"def",
"can_device_access_peer",
"(",
"device",
":",
"_device_t",
",",
"peer_device",
":",
"_device_t",
")",
"->",
"bool",
":",
"_lazy_init",
"(",
")",
"device",
"=",
"_get_device_index",
"(",
"device",
",",
"optional",
"=",
"True",
")",
"peer_device",
"=",
... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/cuda/__init__.py#L364-L374 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/lib/arraypad.py | python | _round_if_needed | (arr, dtype) | Rounds arr inplace if destination dtype is integer.
Parameters
----------
arr : ndarray
Input array.
dtype : dtype
The dtype of the destination array. | Rounds arr inplace if destination dtype is integer. | [
"Rounds",
"arr",
"inplace",
"if",
"destination",
"dtype",
"is",
"integer",
"."
] | def _round_if_needed(arr, dtype):
"""
Rounds arr inplace if destination dtype is integer.
Parameters
----------
arr : ndarray
Input array.
dtype : dtype
The dtype of the destination array.
"""
if np.issubdtype(dtype, np.integer):
arr.round(out=arr) | [
"def",
"_round_if_needed",
"(",
"arr",
",",
"dtype",
")",
":",
"if",
"np",
".",
"issubdtype",
"(",
"dtype",
",",
"np",
".",
"integer",
")",
":",
"arr",
".",
"round",
"(",
"out",
"=",
"arr",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/lib/arraypad.py#L20-L32 | ||
trilinos/Trilinos | 6168be6dd51e35e1cd681e9c4b24433e709df140 | packages/seacas/scripts/exodus3.in.py | python | exodus.put_node_set | (self, object_id, nodeSetNodes) | store a node set by its id and the list of node *INDICES* in
the node set (see `exodus.get_id_map` for explanation of node
*INDEX* versus node *ID*)
>>> exo.put_node_set(node_set_id, ns_nodes)
Parameters
----------
<int> node_set_id node set *ID* (not *INDEX... | store a node set by its id and the list of node *INDICES* in
the node set (see `exodus.get_id_map` for explanation of node
*INDEX* versus node *ID*) | [
"store",
"a",
"node",
"set",
"by",
"its",
"id",
"and",
"the",
"list",
"of",
"node",
"*",
"INDICES",
"*",
"in",
"the",
"node",
"set",
"(",
"see",
"exodus",
".",
"get_id_map",
"for",
"explanation",
"of",
"node",
"*",
"INDEX",
"*",
"versus",
"node",
"*"... | def put_node_set(self, object_id, nodeSetNodes):
"""
store a node set by its id and the list of node *INDICES* in
the node set (see `exodus.get_id_map` for explanation of node
*INDEX* versus node *ID*)
>>> exo.put_node_set(node_set_id, ns_nodes)
Parameters
-----... | [
"def",
"put_node_set",
"(",
"self",
",",
"object_id",
",",
"nodeSetNodes",
")",
":",
"self",
".",
"__ex_put_node_set",
"(",
"object_id",
",",
"nodeSetNodes",
")"
] | https://github.com/trilinos/Trilinos/blob/6168be6dd51e35e1cd681e9c4b24433e709df140/packages/seacas/scripts/exodus3.in.py#L3296-L3309 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/pkg_resources/__init__.py | python | IMetadataProvider.metadata_isdir | (name) | Is the named metadata a directory? (like ``os.path.isdir()``) | Is the named metadata a directory? (like ``os.path.isdir()``) | [
"Is",
"the",
"named",
"metadata",
"a",
"directory?",
"(",
"like",
"os",
".",
"path",
".",
"isdir",
"()",
")"
] | def metadata_isdir(name):
"""Is the named metadata a directory? (like ``os.path.isdir()``)""" | [
"def",
"metadata_isdir",
"(",
"name",
")",
":"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/pkg_resources/__init__.py#L515-L516 | ||
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/control/robotinterface.py | python | RobotInterfaceBase.setTorque | (self,
t: Vector,
ttl: Optional[float] = None
) | Sets a instantaneous torque command.
Args:
t (list of floats): A list of floats giving the desired
torques at each joint.
ttl (float, optional): A time-to-live for this command. | Sets a instantaneous torque command. | [
"Sets",
"a",
"instantaneous",
"torque",
"command",
"."
] | def setTorque(self,
t: Vector,
ttl: Optional[float] = None
) -> None:
"""Sets a instantaneous torque command.
Args:
t (list of floats): A list of floats giving the desired
torques at each joint.
ttl (float, optional): A time-to-li... | [
"def",
"setTorque",
"(",
"self",
",",
"t",
":",
"Vector",
",",
"ttl",
":",
"Optional",
"[",
"float",
"]",
"=",
"None",
")",
"->",
"None",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/control/robotinterface.py#L620-L631 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/mailbox.py | python | MMDF._pre_message_hook | (self, f) | Called before writing each message to file f. | Called before writing each message to file f. | [
"Called",
"before",
"writing",
"each",
"message",
"to",
"file",
"f",
"."
] | def _pre_message_hook(self, f):
"""Called before writing each message to file f."""
f.write('\001\001\001\001' + os.linesep) | [
"def",
"_pre_message_hook",
"(",
"self",
",",
"f",
")",
":",
"f",
".",
"write",
"(",
"'\\001\\001\\001\\001'",
"+",
"os",
".",
"linesep",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/mailbox.py#L880-L882 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/operations/array_ops.py | python | StridedSlice._compute_dynamic_slicing_shape | (self, x_shape, slice_len) | return ret_shape | Computes the shape of the slicing for dynamic shape, mask is currently not supported. | Computes the shape of the slicing for dynamic shape, mask is currently not supported. | [
"Computes",
"the",
"shape",
"of",
"the",
"slicing",
"for",
"dynamic",
"shape",
"mask",
"is",
"currently",
"not",
"supported",
"."
] | def _compute_dynamic_slicing_shape(self, x_shape, slice_len):
"""Computes the shape of the slicing for dynamic shape, mask is currently not supported."""
x_rank = len(x_shape)
if self.begin_mask != 0 or self.end_mask != 0 or self.ellipsis_mask or self.new_axis_mask != 0 \
or self.shr... | [
"def",
"_compute_dynamic_slicing_shape",
"(",
"self",
",",
"x_shape",
",",
"slice_len",
")",
":",
"x_rank",
"=",
"len",
"(",
"x_shape",
")",
"if",
"self",
".",
"begin_mask",
"!=",
"0",
"or",
"self",
".",
"end_mask",
"!=",
"0",
"or",
"self",
".",
"ellipsi... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/operations/array_ops.py#L3484-L3505 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py2/IPython/utils/_signatures.py | python | Signature._bind | (self, args, kwargs, partial=False) | return self._bound_arguments_cls(self, arguments) | Private method. Don't use directly. | Private method. Don't use directly. | [
"Private",
"method",
".",
"Don",
"t",
"use",
"directly",
"."
] | def _bind(self, args, kwargs, partial=False):
'''Private method. Don't use directly.'''
arguments = OrderedDict()
parameters = iter(self.parameters.values())
parameters_ex = ()
arg_vals = iter(args)
if partial:
# Support for binding arguments to 'functools... | [
"def",
"_bind",
"(",
"self",
",",
"args",
",",
"kwargs",
",",
"partial",
"=",
"False",
")",
":",
"arguments",
"=",
"OrderedDict",
"(",
")",
"parameters",
"=",
"iter",
"(",
"self",
".",
"parameters",
".",
"values",
"(",
")",
")",
"parameters_ex",
"=",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py2/IPython/utils/_signatures.py#L647-L773 | |
google/brunsli | e811197ab1ad8ddde3e3cf444548e42e2bdacf92 | contrib/py/jxl_library_patches/jxl_pillow.py | python | register_jxl_support | (pil_image_module) | Registers JPEG-XL with PIL/Pillow. | Registers JPEG-XL with PIL/Pillow. | [
"Registers",
"JPEG",
"-",
"XL",
"with",
"PIL",
"/",
"Pillow",
"."
] | def register_jxl_support(pil_image_module):
"""Registers JPEG-XL with PIL/Pillow."""
# We are making the implicit assumption here that the ImageFile module
# imported above for the ImageFile.ImageFile parent class is compatible
# with pil_image_module.
pil_image_module.register_open(JpegXLImageFile.format, Jp... | [
"def",
"register_jxl_support",
"(",
"pil_image_module",
")",
":",
"# We are making the implicit assumption here that the ImageFile module",
"# imported above for the ImageFile.ImageFile parent class is compatible",
"# with pil_image_module.",
"pil_image_module",
".",
"register_open",
"(",
... | https://github.com/google/brunsli/blob/e811197ab1ad8ddde3e3cf444548e42e2bdacf92/contrib/py/jxl_library_patches/jxl_pillow.py#L58-L64 | ||
SFTtech/openage | d6a08c53c48dc1e157807471df92197f6ca9e04d | openage/convert/entity_object/conversion/aoc/genie_unit.py | python | GenieUnitTransformGroup.__init__ | (self, line_id, head_unit_id, full_data_set) | Creates a new Genie transform group.
:param head_unit_id: Internal unit obj_id of the unit that should be
the initial state.
:param full_data_set: GenieObjectContainer instance that
contains all relevant data for the conversion
... | Creates a new Genie transform group. | [
"Creates",
"a",
"new",
"Genie",
"transform",
"group",
"."
] | def __init__(self, line_id, head_unit_id, full_data_set):
"""
Creates a new Genie transform group.
:param head_unit_id: Internal unit obj_id of the unit that should be
the initial state.
:param full_data_set: GenieObjectContainer instance that
... | [
"def",
"__init__",
"(",
"self",
",",
"line_id",
",",
"head_unit_id",
",",
"full_data_set",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"line_id",
",",
"full_data_set",
")",
"self",
".",
"head_unit",
"=",
"self",
".",
"data",
".",
"genie_units",
"[... | https://github.com/SFTtech/openage/blob/d6a08c53c48dc1e157807471df92197f6ca9e04d/openage/convert/entity_object/conversion/aoc/genie_unit.py#L800-L816 | ||
blackberry/Boost | fc90c3fde129c62565c023f091eddc4a7ed9902b | libs/python/pyste/src/Pyste/ClassExporter.py | python | _VirtualWrapperGenerator.GenerateVirtualMethods | (self) | To correctly export all virtual methods, we must also make wrappers
for the virtual methods of the bases of this class, as if the methods
were from this class itself.
This method creates the instance variable self.virtual_methods. | To correctly export all virtual methods, we must also make wrappers
for the virtual methods of the bases of this class, as if the methods
were from this class itself.
This method creates the instance variable self.virtual_methods. | [
"To",
"correctly",
"export",
"all",
"virtual",
"methods",
"we",
"must",
"also",
"make",
"wrappers",
"for",
"the",
"virtual",
"methods",
"of",
"the",
"bases",
"of",
"this",
"class",
"as",
"if",
"the",
"methods",
"were",
"from",
"this",
"class",
"itself",
".... | def GenerateVirtualMethods(self):
'''To correctly export all virtual methods, we must also make wrappers
for the virtual methods of the bases of this class, as if the methods
were from this class itself.
This method creates the instance variable self.virtual_methods.
'''
... | [
"def",
"GenerateVirtualMethods",
"(",
"self",
")",
":",
"def",
"IsVirtual",
"(",
"m",
")",
":",
"if",
"type",
"(",
"m",
")",
"is",
"Method",
":",
"pure_virtual",
"=",
"m",
".",
"abstract",
"and",
"m",
".",
"virtual",
"virtual",
"=",
"m",
".",
"virtua... | https://github.com/blackberry/Boost/blob/fc90c3fde129c62565c023f091eddc4a7ed9902b/libs/python/pyste/src/Pyste/ClassExporter.py#L819-L868 | ||
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Import/App/automotive_design.py | python | gbsf_check_point | (pnt,) | return FALSE | :param pnt
:type pnt:point | :param pnt
:type pnt:point | [
":",
"param",
"pnt",
":",
"type",
"pnt",
":",
"point"
] | def gbsf_check_point(pnt,):
'''
:param pnt
:type pnt:point
'''
if ('AUTOMOTIVE_DESIGN.CARTESIAN_POINT' == TYPEOF(pnt)):
return TRUE
else:
if ('AUTOMOTIVE_DESIGN.POINT_ON_CURVE' == TYPEOF(pnt)):
return gbsf_check_curve(pnt.point_on_curve.basis_curve)
else:
if ('AUTOMOTIVE_DESIGN.POINT_ON_SURFACE' ... | [
"def",
"gbsf_check_point",
"(",
"pnt",
",",
")",
":",
"if",
"(",
"'AUTOMOTIVE_DESIGN.CARTESIAN_POINT'",
"==",
"TYPEOF",
"(",
"pnt",
")",
")",
":",
"return",
"TRUE",
"else",
":",
"if",
"(",
"'AUTOMOTIVE_DESIGN.POINT_ON_CURVE'",
"==",
"TYPEOF",
"(",
"pnt",
")",
... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Import/App/automotive_design.py#L40705-L40721 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/xrc.py | python | XmlResourceHandler.GetColour | (*args, **kwargs) | return _xrc.XmlResourceHandler_GetColour(*args, **kwargs) | GetColour(self, String param) -> Colour | GetColour(self, String param) -> Colour | [
"GetColour",
"(",
"self",
"String",
"param",
")",
"-",
">",
"Colour"
] | def GetColour(*args, **kwargs):
"""GetColour(self, String param) -> Colour"""
return _xrc.XmlResourceHandler_GetColour(*args, **kwargs) | [
"def",
"GetColour",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_xrc",
".",
"XmlResourceHandler_GetColour",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/xrc.py#L679-L681 | |
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/node-10.15.3/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py | python | MakefileWriter.WritePchTargets | (self, pch_commands) | Writes make rules to compile prefix headers. | Writes make rules to compile prefix headers. | [
"Writes",
"make",
"rules",
"to",
"compile",
"prefix",
"headers",
"."
] | def WritePchTargets(self, pch_commands):
"""Writes make rules to compile prefix headers."""
if not pch_commands:
return
for gch, lang_flag, lang, input in pch_commands:
extra_flags = {
'c': '$(CFLAGS_C_$(BUILDTYPE))',
'cc': '$(CFLAGS_CC_$(BUILDTYPE))',
'm': '$(CFLAGS_C_$... | [
"def",
"WritePchTargets",
"(",
"self",
",",
"pch_commands",
")",
":",
"if",
"not",
"pch_commands",
":",
"return",
"for",
"gch",
",",
"lang_flag",
",",
"lang",
",",
"input",
"in",
"pch_commands",
":",
"extra_flags",
"=",
"{",
"'c'",
":",
"'$(CFLAGS_C_$(BUILDT... | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/node-10.15.3/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py#L1320-L1350 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/tkinter/ttk.py | python | Checkbutton.__init__ | (self, master=None, **kw) | Construct a Ttk Checkbutton widget with the parent master.
STANDARD OPTIONS
class, compound, cursor, image, state, style, takefocus,
text, textvariable, underline, width
WIDGET-SPECIFIC OPTIONS
command, offvalue, onvalue, variable | Construct a Ttk Checkbutton widget with the parent master. | [
"Construct",
"a",
"Ttk",
"Checkbutton",
"widget",
"with",
"the",
"parent",
"master",
"."
] | def __init__(self, master=None, **kw):
"""Construct a Ttk Checkbutton widget with the parent master.
STANDARD OPTIONS
class, compound, cursor, image, state, style, takefocus,
text, textvariable, underline, width
WIDGET-SPECIFIC OPTIONS
command, offvalue, o... | [
"def",
"__init__",
"(",
"self",
",",
"master",
"=",
"None",
",",
"*",
"*",
"kw",
")",
":",
"Widget",
".",
"__init__",
"(",
"self",
",",
"master",
",",
"\"ttk::checkbutton\"",
",",
"kw",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/tkinter/ttk.py#L625-L637 | ||
runtimejs/runtime | 0a6e84c30823d35a4548d6634166784260ae7b74 | deps/v8/tools/run_perf.py | python | RunnableConfig.ChangeCWD | (self, suite_path) | Changes the cwd to to path defined in the current graph.
The tests are supposed to be relative to the suite configuration. | Changes the cwd to to path defined in the current graph. | [
"Changes",
"the",
"cwd",
"to",
"to",
"path",
"defined",
"in",
"the",
"current",
"graph",
"."
] | def ChangeCWD(self, suite_path):
"""Changes the cwd to to path defined in the current graph.
The tests are supposed to be relative to the suite configuration.
"""
suite_dir = os.path.abspath(os.path.dirname(suite_path))
bench_dir = os.path.normpath(os.path.join(*self.path))
os.chdir(os.path.joi... | [
"def",
"ChangeCWD",
"(",
"self",
",",
"suite_path",
")",
":",
"suite_dir",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"suite_path",
")",
")",
"bench_dir",
"=",
"os",
".",
"path",
".",
"normpath",
"(",
"os",
... | https://github.com/runtimejs/runtime/blob/0a6e84c30823d35a4548d6634166784260ae7b74/deps/v8/tools/run_perf.py#L447-L454 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_misc.py | python | ToolTip.SetReshow | (*args, **kwargs) | return _misc_.ToolTip_SetReshow(*args, **kwargs) | SetReshow(long milliseconds) | SetReshow(long milliseconds) | [
"SetReshow",
"(",
"long",
"milliseconds",
")"
] | def SetReshow(*args, **kwargs):
"""SetReshow(long milliseconds)"""
return _misc_.ToolTip_SetReshow(*args, **kwargs) | [
"def",
"SetReshow",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"ToolTip_SetReshow",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_misc.py#L694-L696 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_core.py | python | FlexGridSizer.SetNonFlexibleGrowMode | (*args, **kwargs) | return _core_.FlexGridSizer_SetNonFlexibleGrowMode(*args, **kwargs) | SetNonFlexibleGrowMode(self, int mode)
Specifies how the sizer should grow in the non-flexible direction if
there is one (so `SetFlexibleDirection` must have been called
previously). Argument *mode* can be one of the following values:
========================== ===================... | SetNonFlexibleGrowMode(self, int mode) | [
"SetNonFlexibleGrowMode",
"(",
"self",
"int",
"mode",
")"
] | def SetNonFlexibleGrowMode(*args, **kwargs):
"""
SetNonFlexibleGrowMode(self, int mode)
Specifies how the sizer should grow in the non-flexible direction if
there is one (so `SetFlexibleDirection` must have been called
previously). Argument *mode* can be one of the following val... | [
"def",
"SetNonFlexibleGrowMode",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"FlexGridSizer_SetNonFlexibleGrowMode",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_core.py#L15421-L15442 | |
apache/parquet-cpp | 642da055adf009652689b20e68a198cffb857651 | build-support/cpplint.py | python | _IncludeState.ResetSection | (self, directive) | Reset section checking for preprocessor directive.
Args:
directive: preprocessor directive (e.g. "if", "else"). | Reset section checking for preprocessor directive. | [
"Reset",
"section",
"checking",
"for",
"preprocessor",
"directive",
"."
] | def ResetSection(self, directive):
"""Reset section checking for preprocessor directive.
Args:
directive: preprocessor directive (e.g. "if", "else").
"""
# The name of the current section.
self._section = self._INITIAL_SECTION
# The path of last found header.
self._last_header = ''
... | [
"def",
"ResetSection",
"(",
"self",
",",
"directive",
")",
":",
"# The name of the current section.",
"self",
".",
"_section",
"=",
"self",
".",
"_INITIAL_SECTION",
"# The path of last found header.",
"self",
".",
"_last_header",
"=",
"''",
"# Update list of includes. No... | https://github.com/apache/parquet-cpp/blob/642da055adf009652689b20e68a198cffb857651/build-support/cpplint.py#L646-L662 | ||
tkn-tub/ns3-gym | 19bfe0a583e641142609939a090a09dfc63a095f | waf-tools/misc.py | python | copy_attrs | (orig, dest, names, only_if_set=False) | copy class attributes from an object to another | copy class attributes from an object to another | [
"copy",
"class",
"attributes",
"from",
"an",
"object",
"to",
"another"
] | def copy_attrs(orig, dest, names, only_if_set=False):
"""
copy class attributes from an object to another
"""
for a in Utils.to_list(names):
u = getattr(orig, a, ())
if u or not only_if_set:
setattr(dest, a, u) | [
"def",
"copy_attrs",
"(",
"orig",
",",
"dest",
",",
"names",
",",
"only_if_set",
"=",
"False",
")",
":",
"for",
"a",
"in",
"Utils",
".",
"to_list",
"(",
"names",
")",
":",
"u",
"=",
"getattr",
"(",
"orig",
",",
"a",
",",
"(",
")",
")",
"if",
"u... | https://github.com/tkn-tub/ns3-gym/blob/19bfe0a583e641142609939a090a09dfc63a095f/waf-tools/misc.py#L19-L26 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/stc.py | python | StyledTextCtrl.IndicatorSetUnder | (*args, **kwargs) | return _stc.StyledTextCtrl_IndicatorSetUnder(*args, **kwargs) | IndicatorSetUnder(self, int indic, bool under)
Set an indicator to draw under text or over(default). | IndicatorSetUnder(self, int indic, bool under) | [
"IndicatorSetUnder",
"(",
"self",
"int",
"indic",
"bool",
"under",
")"
] | def IndicatorSetUnder(*args, **kwargs):
"""
IndicatorSetUnder(self, int indic, bool under)
Set an indicator to draw under text or over(default).
"""
return _stc.StyledTextCtrl_IndicatorSetUnder(*args, **kwargs) | [
"def",
"IndicatorSetUnder",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_IndicatorSetUnder",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/stc.py#L2897-L2903 | |
emscripten-core/emscripten | 0d413d3c5af8b28349682496edc14656f5700c2f | third_party/ply/example/BASIC/basparse.py | python | p_command_goto | (p) | command : GOTO INTEGER | command : GOTO INTEGER | [
"command",
":",
"GOTO",
"INTEGER"
] | def p_command_goto(p):
'''command : GOTO INTEGER'''
p[0] = ('GOTO',int(p[2])) | [
"def",
"p_command_goto",
"(",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"(",
"'GOTO'",
",",
"int",
"(",
"p",
"[",
"2",
"]",
")",
")"
] | https://github.com/emscripten-core/emscripten/blob/0d413d3c5af8b28349682496edc14656f5700c2f/third_party/ply/example/BASIC/basparse.py#L140-L142 | ||
zhaoweicai/cascade-rcnn | 2252f46158ea6555868ca6fa5c221ea71d9b5e6c | scripts/cpp_lint.py | python | CheckForNonStandardConstructs | (filename, clean_lines, linenum,
nesting_state, error) | r"""Logs an error if we see certain non-ANSI constructs ignored by gcc-2.
Complain about several constructs which gcc-2 accepts, but which are
not standard C++. Warning about these in lint is one way to ease the
transition to new compilers.
- put storage class first (e.g. "static const" instead of "const stat... | r"""Logs an error if we see certain non-ANSI constructs ignored by gcc-2. | [
"r",
"Logs",
"an",
"error",
"if",
"we",
"see",
"certain",
"non",
"-",
"ANSI",
"constructs",
"ignored",
"by",
"gcc",
"-",
"2",
"."
] | def CheckForNonStandardConstructs(filename, clean_lines, linenum,
nesting_state, error):
r"""Logs an error if we see certain non-ANSI constructs ignored by gcc-2.
Complain about several constructs which gcc-2 accepts, but which are
not standard C++. Warning about these in lint ... | [
"def",
"CheckForNonStandardConstructs",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"nesting_state",
",",
"error",
")",
":",
"# Remove comments from the line, but leave in strings for now.",
"line",
"=",
"clean_lines",
".",
"lines",
"[",
"linenum",
"]",
"i... | https://github.com/zhaoweicai/cascade-rcnn/blob/2252f46158ea6555868ca6fa5c221ea71d9b5e6c/scripts/cpp_lint.py#L2198-L2302 | ||
macchina-io/macchina.io | ef24ba0e18379c3dd48fb84e6dbf991101cb8db0 | platform/JS/V8/tools/gyp/pylib/gyp/xcode_emulation.py | python | XcodeSettings.GetBundleFrameworksFolderPath | (self) | return os.path.join(self.GetBundleContentsFolderPath(), 'Frameworks') | Returns the qualified path to the bundle's frameworks folder. E.g,
Chromium.app/Contents/Frameworks. Only valid for bundles. | Returns the qualified path to the bundle's frameworks folder. E.g,
Chromium.app/Contents/Frameworks. Only valid for bundles. | [
"Returns",
"the",
"qualified",
"path",
"to",
"the",
"bundle",
"s",
"frameworks",
"folder",
".",
"E",
".",
"g",
"Chromium",
".",
"app",
"/",
"Contents",
"/",
"Frameworks",
".",
"Only",
"valid",
"for",
"bundles",
"."
] | def GetBundleFrameworksFolderPath(self):
"""Returns the qualified path to the bundle's frameworks folder. E.g,
Chromium.app/Contents/Frameworks. Only valid for bundles."""
assert self._IsBundle()
return os.path.join(self.GetBundleContentsFolderPath(), 'Frameworks') | [
"def",
"GetBundleFrameworksFolderPath",
"(",
"self",
")",
":",
"assert",
"self",
".",
"_IsBundle",
"(",
")",
"return",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"GetBundleContentsFolderPath",
"(",
")",
",",
"'Frameworks'",
")"
] | https://github.com/macchina-io/macchina.io/blob/ef24ba0e18379c3dd48fb84e6dbf991101cb8db0/platform/JS/V8/tools/gyp/pylib/gyp/xcode_emulation.py#L330-L334 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/dist.py | python | Distribution.include | (self, **attrs) | Add items to distribution that are named in keyword arguments
For example, 'dist.include(py_modules=["x"])' would add 'x' to
the distribution's 'py_modules' attribute, if it was not already
there.
Currently, this method only supports inclusion for attributes that are
lists or t... | Add items to distribution that are named in keyword arguments | [
"Add",
"items",
"to",
"distribution",
"that",
"are",
"named",
"in",
"keyword",
"arguments"
] | def include(self, **attrs):
"""Add items to distribution that are named in keyword arguments
For example, 'dist.include(py_modules=["x"])' would add 'x' to
the distribution's 'py_modules' attribute, if it was not already
there.
Currently, this method only supports inclusion for... | [
"def",
"include",
"(",
"self",
",",
"*",
"*",
"attrs",
")",
":",
"for",
"k",
",",
"v",
"in",
"attrs",
".",
"items",
"(",
")",
":",
"include",
"=",
"getattr",
"(",
"self",
",",
"'_include_'",
"+",
"k",
",",
"None",
")",
"if",
"include",
":",
"in... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/dist.py#L785-L805 | ||
kungfu-origin/kungfu | 90c84b2b590855654cb9a6395ed050e0f7763512 | core/extensions/sim/mdmaker/src/stock.py | python | main | (argv) | Market data generator entry point | Market data generator entry point | [
"Market",
"data",
"generator",
"entry",
"point"
] | def main(argv):
""" Market data generator entry point """
print("Market Data Generator")
now_nanos.sim_time = 0
args = parse_args(argv)
print("Output file '{}' in {} format".format(args.outputfile.name,
'CSV' if args.csv else 'binary'))
if args.... | [
"def",
"main",
"(",
"argv",
")",
":",
"print",
"(",
"\"Market Data Generator\"",
")",
"now_nanos",
".",
"sim_time",
"=",
"0",
"args",
"=",
"parse_args",
"(",
"argv",
")",
"print",
"(",
"\"Output file '{}' in {} format\"",
".",
"format",
"(",
"args",
".",
"ou... | https://github.com/kungfu-origin/kungfu/blob/90c84b2b590855654cb9a6395ed050e0f7763512/core/extensions/sim/mdmaker/src/stock.py#L603-L622 | ||
facebook/hermes | b1b1a00ab468ec1b397b31b71587110044830970 | external/llvh/utils/lit/lit/util.py | python | listdir_files | (dirname, suffixes=None, exclude_filenames=None) | Yields files in a directory.
Filenames that are not excluded by rules below are yielded one at a time, as
basenames (i.e., without dirname).
Files starting with '.' are always skipped.
If 'suffixes' is not None, then only filenames ending with one of its
members will be yielded. These can be exte... | Yields files in a directory. | [
"Yields",
"files",
"in",
"a",
"directory",
"."
] | def listdir_files(dirname, suffixes=None, exclude_filenames=None):
"""Yields files in a directory.
Filenames that are not excluded by rules below are yielded one at a time, as
basenames (i.e., without dirname).
Files starting with '.' are always skipped.
If 'suffixes' is not None, then only filen... | [
"def",
"listdir_files",
"(",
"dirname",
",",
"suffixes",
"=",
"None",
",",
"exclude_filenames",
"=",
"None",
")",
":",
"if",
"exclude_filenames",
"is",
"None",
":",
"exclude_filenames",
"=",
"set",
"(",
")",
"if",
"suffixes",
"is",
"None",
":",
"suffixes",
... | https://github.com/facebook/hermes/blob/b1b1a00ab468ec1b397b31b71587110044830970/external/llvh/utils/lit/lit/util.py#L177-L215 | ||
tangzhenyu/Scene-Text-Understanding | 0f7ffc7aea5971a50cdc03d33d0a41075285948b | ctpn_crnn_ocr/CTPN/caffe/scripts/cpp_lint.py | python | CheckSectionSpacing | (filename, clean_lines, class_info, linenum, error) | Checks for additional blank line issues related to sections.
Currently the only thing checked here is blank line before protected/private.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
class_info: A _ClassInfo objects.
linenum: The number ... | Checks for additional blank line issues related to sections. | [
"Checks",
"for",
"additional",
"blank",
"line",
"issues",
"related",
"to",
"sections",
"."
] | def CheckSectionSpacing(filename, clean_lines, class_info, linenum, error):
"""Checks for additional blank line issues related to sections.
Currently the only thing checked here is blank line before protected/private.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance co... | [
"def",
"CheckSectionSpacing",
"(",
"filename",
",",
"clean_lines",
",",
"class_info",
",",
"linenum",
",",
"error",
")",
":",
"# Skip checks if the class is small, where small means 25 lines or less.",
"# 25 lines seems like a good cutoff since that's the usual height of",
"# termina... | https://github.com/tangzhenyu/Scene-Text-Understanding/blob/0f7ffc7aea5971a50cdc03d33d0a41075285948b/ctpn_crnn_ocr/CTPN/caffe/scripts/cpp_lint.py#L2991-L3043 | ||
deepmind/open_spiel | 4ca53bea32bb2875c7385d215424048ae92f78c8 | open_spiel/python/algorithms/adidas_utils/solvers/nonsymmetric/regmatch.py | python | Solver.compute_gradients | (self, params, payoff_matrices) | return gradients(*params, payoff_matrices, self.num_players) | Compute and return gradients (and exploitabilities) for all parameters.
Args:
params: tuple of params (dist, regret), see regmatch.gradients
payoff_matrices: dictionary with keys as tuples of agents (i, j) and
values of (2 x A x A) np.arrays, payoffs for each joint action. keys
are sort... | Compute and return gradients (and exploitabilities) for all parameters. | [
"Compute",
"and",
"return",
"gradients",
"(",
"and",
"exploitabilities",
")",
"for",
"all",
"parameters",
"."
] | def compute_gradients(self, params, payoff_matrices):
"""Compute and return gradients (and exploitabilities) for all parameters.
Args:
params: tuple of params (dist, regret), see regmatch.gradients
payoff_matrices: dictionary with keys as tuples of agents (i, j) and
values of (2 x A x A) np... | [
"def",
"compute_gradients",
"(",
"self",
",",
"params",
",",
"payoff_matrices",
")",
":",
"return",
"gradients",
"(",
"*",
"params",
",",
"payoff_matrices",
",",
"self",
".",
"num_players",
")"
] | https://github.com/deepmind/open_spiel/blob/4ca53bea32bb2875c7385d215424048ae92f78c8/open_spiel/python/algorithms/adidas_utils/solvers/nonsymmetric/regmatch.py#L63-L76 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | build/android/pylib/flag_changer.py | python | FlagChanger._UpdateCommandLineFile | (self) | Writes out the command line to the file, or removes it if empty. | Writes out the command line to the file, or removes it if empty. | [
"Writes",
"out",
"the",
"command",
"line",
"to",
"the",
"file",
"or",
"removes",
"it",
"if",
"empty",
"."
] | def _UpdateCommandLineFile(self):
"""Writes out the command line to the file, or removes it if empty."""
logging.info('Current flags: %s', self._current_flags)
# Root is not required to write to /data/local/tmp/.
use_root = '/data/local/tmp/' not in self._cmdline_file
if self._current_flags:
#... | [
"def",
"_UpdateCommandLineFile",
"(",
"self",
")",
":",
"logging",
".",
"info",
"(",
"'Current flags: %s'",
",",
"self",
".",
"_current_flags",
")",
"# Root is not required to write to /data/local/tmp/.",
"use_root",
"=",
"'/data/local/tmp/'",
"not",
"in",
"self",
".",
... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/build/android/pylib/flag_changer.py#L91-L114 | ||
vtraag/leidenalg | b53366829360e10922a2dbf57eb405a516c23bc9 | src/leidenalg/VertexPartition.py | python | LinearResolutionParameterVertexPartition.bisect_value | (self) | return self.total_weight_in_all_comms() | Give the value on which we can perform bisectioning.
If p1 and p2 are two different optimal partitions for two different
resolution parameters g1 and g2, then if p1.bisect_value() ==
p2.bisect_value() the two partitions should be optimal for both g1 and g2. | Give the value on which we can perform bisectioning. | [
"Give",
"the",
"value",
"on",
"which",
"we",
"can",
"perform",
"bisectioning",
"."
] | def bisect_value(self):
""" Give the value on which we can perform bisectioning.
If p1 and p2 are two different optimal partitions for two different
resolution parameters g1 and g2, then if p1.bisect_value() ==
p2.bisect_value() the two partitions should be optimal for both g1 and g2.
"""
retur... | [
"def",
"bisect_value",
"(",
"self",
")",
":",
"return",
"self",
".",
"total_weight_in_all_comms",
"(",
")"
] | https://github.com/vtraag/leidenalg/blob/b53366829360e10922a2dbf57eb405a516c23bc9/src/leidenalg/VertexPartition.py#L666-L673 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/structured/structured_tensor.py | python | _normalize_field_name_to_tuple | (name: 'FieldName') | return name | FieldName can be given also as string, this normalizes it to a tuple. | FieldName can be given also as string, this normalizes it to a tuple. | [
"FieldName",
"can",
"be",
"given",
"also",
"as",
"string",
"this",
"normalizes",
"it",
"to",
"a",
"tuple",
"."
] | def _normalize_field_name_to_tuple(name: 'FieldName') -> Sequence[str]:
"""FieldName can be given also as string, this normalizes it to a tuple."""
if isinstance(name, str):
return (name,)
if isinstance(name, list):
return tuple(name)
assert isinstance(name, tuple)
return name | [
"def",
"_normalize_field_name_to_tuple",
"(",
"name",
":",
"'FieldName'",
")",
"->",
"Sequence",
"[",
"str",
"]",
":",
"if",
"isinstance",
"(",
"name",
",",
"str",
")",
":",
"return",
"(",
"name",
",",
")",
"if",
"isinstance",
"(",
"name",
",",
"list",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/structured/structured_tensor.py#L1690-L1697 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/_collections_abc.py | python | MutableMapping.popitem | (self) | return key, value | D.popitem() -> (k, v), remove and return some (key, value) pair
as a 2-tuple; but raise KeyError if D is empty. | D.popitem() -> (k, v), remove and return some (key, value) pair
as a 2-tuple; but raise KeyError if D is empty. | [
"D",
".",
"popitem",
"()",
"-",
">",
"(",
"k",
"v",
")",
"remove",
"and",
"return",
"some",
"(",
"key",
"value",
")",
"pair",
"as",
"a",
"2",
"-",
"tuple",
";",
"but",
"raise",
"KeyError",
"if",
"D",
"is",
"empty",
"."
] | def popitem(self):
'''D.popitem() -> (k, v), remove and return some (key, value) pair
as a 2-tuple; but raise KeyError if D is empty.
'''
try:
key = next(iter(self))
except StopIteration:
raise KeyError from None
value = self[key]
del se... | [
"def",
"popitem",
"(",
"self",
")",
":",
"try",
":",
"key",
"=",
"next",
"(",
"iter",
"(",
"self",
")",
")",
"except",
"StopIteration",
":",
"raise",
"KeyError",
"from",
"None",
"value",
"=",
"self",
"[",
"key",
"]",
"del",
"self",
"[",
"key",
"]",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/_collections_abc.py#L804-L814 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.