nwo stringlengths 5 106 | sha stringlengths 40 40 | path stringlengths 4 174 | language stringclasses 1
value | identifier stringlengths 1 140 | parameters stringlengths 0 87.7k | argument_list stringclasses 1
value | return_statement stringlengths 0 426k | docstring stringlengths 0 64.3k | docstring_summary stringlengths 0 26.3k | docstring_tokens list | function stringlengths 18 4.83M | function_tokens list | url stringlengths 83 304 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
giswqs/whitebox-python | b4df0bbb10a1dee3bd0f6b3482511f7c829b38fe | whitebox/whitebox_tools.py | python | WhiteboxTools.symmetrical_difference | (self, i, overlay, output, snap=0.0, callback=None) | return self.run_tool('symmetrical_difference', args, callback) | Outputs the features that occur in one of the two vector inputs but not both, i.e. no overlapping features.
Keyword arguments:
i -- Input vector file.
overlay -- Input overlay vector file.
output -- Output vector file.
snap -- Snap tolerance.
callback -- Custom func... | Outputs the features that occur in one of the two vector inputs but not both, i.e. no overlapping features. | [
"Outputs",
"the",
"features",
"that",
"occur",
"in",
"one",
"of",
"the",
"two",
"vector",
"inputs",
"but",
"not",
"both",
"i",
".",
"e",
".",
"no",
"overlapping",
"features",
"."
] | def symmetrical_difference(self, i, overlay, output, snap=0.0, callback=None):
"""Outputs the features that occur in one of the two vector inputs but not both, i.e. no overlapping features.
Keyword arguments:
i -- Input vector file.
overlay -- Input overlay vector file.
outpu... | [
"def",
"symmetrical_difference",
"(",
"self",
",",
"i",
",",
"overlay",
",",
"output",
",",
"snap",
"=",
"0.0",
",",
"callback",
"=",
"None",
")",
":",
"args",
"=",
"[",
"]",
"args",
".",
"append",
"(",
"\"--input='{}'\"",
".",
"format",
"(",
"i",
")... | https://github.com/giswqs/whitebox-python/blob/b4df0bbb10a1dee3bd0f6b3482511f7c829b38fe/whitebox/whitebox_tools.py#L2245-L2261 | |
cogitas3d/OrtogOnBlender | 881e93f5beb2263e44c270974dd0e81deca44762 | CompareTools.py | python | Lower_Lip_real_pt.poll | (cls, context) | [] | def poll(cls, context):
found = 'Lower Lip real' in bpy.data.objects
if found == False:
return True
else:
if found == True:
return False | [
"def",
"poll",
"(",
"cls",
",",
"context",
")",
":",
"found",
"=",
"'Lower Lip real'",
"in",
"bpy",
".",
"data",
".",
"objects",
"if",
"found",
"==",
"False",
":",
"return",
"True",
"else",
":",
"if",
"found",
"==",
"True",
":",
"return",
"False"
] | https://github.com/cogitas3d/OrtogOnBlender/blob/881e93f5beb2263e44c270974dd0e81deca44762/CompareTools.py#L768-L776 | ||||
graphcore/examples | 46d2b7687b829778369fc6328170a7b14761e5c6 | applications/popart/bert/bert_data/tokenization.py | python | printable_text | (text) | Returns text encoded in a way suitable for print or `tf.logging`. | Returns text encoded in a way suitable for print or `tf.logging`. | [
"Returns",
"text",
"encoded",
"in",
"a",
"way",
"suitable",
"for",
"print",
"or",
"tf",
".",
"logging",
"."
] | def printable_text(text):
"""Returns text encoded in a way suitable for print or `tf.logging`."""
# These functions want `str` for both Python2 and Python3, but in one case
# it's a Unicode string and in the other it's a byte string.
if six.PY3:
if isinstance(text, str):
return text
elif isinstan... | [
"def",
"printable_text",
"(",
"text",
")",
":",
"# These functions want `str` for both Python2 and Python3, but in one case",
"# it's a Unicode string and in the other it's a byte string.",
"if",
"six",
".",
"PY3",
":",
"if",
"isinstance",
"(",
"text",
",",
"str",
")",
":",
... | https://github.com/graphcore/examples/blob/46d2b7687b829778369fc6328170a7b14761e5c6/applications/popart/bert/bert_data/tokenization.py#L97-L117 | ||
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/preview/hosted_numbers/authorization_document/__init__.py | python | AuthorizationDocumentInstance.email | (self) | return self._properties['email'] | :returns: Email.
:rtype: unicode | :returns: Email.
:rtype: unicode | [
":",
"returns",
":",
"Email",
".",
":",
"rtype",
":",
"unicode"
] | def email(self):
"""
:returns: Email.
:rtype: unicode
"""
return self._properties['email'] | [
"def",
"email",
"(",
"self",
")",
":",
"return",
"self",
".",
"_properties",
"[",
"'email'",
"]"
] | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/preview/hosted_numbers/authorization_document/__init__.py#L400-L405 | |
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/cloudinary/utils.py | python | generate_responsive_breakpoints_string | (breakpoints) | return json.dumps(list(map(breakpoint_settings_mapper, breakpoints))) | [] | def generate_responsive_breakpoints_string(breakpoints):
if breakpoints is None:
return None
breakpoints = build_array(breakpoints)
return json.dumps(list(map(breakpoint_settings_mapper, breakpoints))) | [
"def",
"generate_responsive_breakpoints_string",
"(",
"breakpoints",
")",
":",
"if",
"breakpoints",
"is",
"None",
":",
"return",
"None",
"breakpoints",
"=",
"build_array",
"(",
"breakpoints",
")",
"return",
"json",
".",
"dumps",
"(",
"list",
"(",
"map",
"(",
"... | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/cloudinary/utils.py#L598-L602 | |||
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/bmlb/v20180625/models.py | python | CreateLoadBalancerBzConf.__init__ | (self) | r"""
:param BzPayMode: 按月/按小时计费。
:type BzPayMode: str
:param BzL4Metrics: 四层可选按带宽,连接数衡量。
:type BzL4Metrics: str
:param BzL7Metrics: 七层可选按qps衡量。
:type BzL7Metrics: str | r"""
:param BzPayMode: 按月/按小时计费。
:type BzPayMode: str
:param BzL4Metrics: 四层可选按带宽,连接数衡量。
:type BzL4Metrics: str
:param BzL7Metrics: 七层可选按qps衡量。
:type BzL7Metrics: str | [
"r",
":",
"param",
"BzPayMode",
":",
"按月",
"/",
"按小时计费。",
":",
"type",
"BzPayMode",
":",
"str",
":",
"param",
"BzL4Metrics",
":",
"四层可选按带宽,连接数衡量。",
":",
"type",
"BzL4Metrics",
":",
"str",
":",
"param",
"BzL7Metrics",
":",
"七层可选按qps衡量。",
":",
"type",
"BzL7M... | def __init__(self):
r"""
:param BzPayMode: 按月/按小时计费。
:type BzPayMode: str
:param BzL4Metrics: 四层可选按带宽,连接数衡量。
:type BzL4Metrics: str
:param BzL7Metrics: 七层可选按qps衡量。
:type BzL7Metrics: str
"""
self.BzPayMode = None
self.BzL4Metrics = None
... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"BzPayMode",
"=",
"None",
"self",
".",
"BzL4Metrics",
"=",
"None",
"self",
".",
"BzL7Metrics",
"=",
"None"
] | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/bmlb/v20180625/models.py#L783-L794 | ||
gwpy/gwpy | 82becd78d166a32985cb657a54d0d39f6a207739 | gwpy/signal/window.py | python | planck | (N, nleft=0, nright=0) | return w | Return a Planck taper window.
Parameters
----------
N : `int`
Number of samples in the output window
nleft : `int`, optional
Number of samples to taper on the left, should be less than `N/2`
nright : `int`, optional
Number of samples to taper on the right, should be less t... | Return a Planck taper window. | [
"Return",
"a",
"Planck",
"taper",
"window",
"."
] | def planck(N, nleft=0, nright=0):
"""Return a Planck taper window.
Parameters
----------
N : `int`
Number of samples in the output window
nleft : `int`, optional
Number of samples to taper on the left, should be less than `N/2`
nright : `int`, optional
Number of sample... | [
"def",
"planck",
"(",
"N",
",",
"nleft",
"=",
"0",
",",
"nright",
"=",
"0",
")",
":",
"# construct a Planck taper window",
"w",
"=",
"numpy",
".",
"ones",
"(",
"N",
")",
"if",
"nleft",
":",
"w",
"[",
"0",
"]",
"*=",
"0",
"zleft",
"=",
"numpy",
".... | https://github.com/gwpy/gwpy/blob/82becd78d166a32985cb657a54d0d39f6a207739/gwpy/signal/window.py#L132-L182 | |
CGATOxford/cgat | 326aad4694bdfae8ddc194171bb5d73911243947 | CGAT/scripts/gff2plot.py | python | plotContig | (contig, tracks, options, plot_legend=False,
extra_features=None) | return figure, legend | plot data for contig. | plot data for contig. | [
"plot",
"data",
"for",
"contig",
"."
] | def plotContig(contig, tracks, options, plot_legend=False,
extra_features=None):
"""plot data for contig."""
if extra_features and "figure" in extra_features:
figure = pylab.figure(**enterParams(extra_features['figure'],
(("figsize", lambda x: ... | [
"def",
"plotContig",
"(",
"contig",
",",
"tracks",
",",
"options",
",",
"plot_legend",
"=",
"False",
",",
"extra_features",
"=",
"None",
")",
":",
"if",
"extra_features",
"and",
"\"figure\"",
"in",
"extra_features",
":",
"figure",
"=",
"pylab",
".",
"figure"... | https://github.com/CGATOxford/cgat/blob/326aad4694bdfae8ddc194171bb5d73911243947/CGAT/scripts/gff2plot.py#L242-L392 | |
LuxCoreRender/BlendLuxCore | bf31ca58501d54c02acd97001b6db7de81da7cbf | utils/node.py | python | copy_links_after_socket_swap | (socket1, socket2, was_socket1_enabled) | Copy socket links from the output socket that was disabled to the one that was enabled.
This function should be used on nodes that have two different output sockets which are
enabled or disabled in turn depending on settings of the node.
Example: the smoke node (color output when color grid is selected, val... | Copy socket links from the output socket that was disabled to the one that was enabled.
This function should be used on nodes that have two different output sockets which are
enabled or disabled in turn depending on settings of the node.
Example: the smoke node (color output when color grid is selected, val... | [
"Copy",
"socket",
"links",
"from",
"the",
"output",
"socket",
"that",
"was",
"disabled",
"to",
"the",
"one",
"that",
"was",
"enabled",
".",
"This",
"function",
"should",
"be",
"used",
"on",
"nodes",
"that",
"have",
"two",
"different",
"output",
"sockets",
... | def copy_links_after_socket_swap(socket1, socket2, was_socket1_enabled):
"""
Copy socket links from the output socket that was disabled to the one that was enabled.
This function should be used on nodes that have two different output sockets which are
enabled or disabled in turn depending on settings of... | [
"def",
"copy_links_after_socket_swap",
"(",
"socket1",
",",
"socket2",
",",
"was_socket1_enabled",
")",
":",
"node_tree",
"=",
"socket1",
".",
"id_data",
"if",
"was_socket1_enabled",
"==",
"socket1",
".",
"enabled",
":",
"# Nothing changed",
"pass",
"elif",
"was_soc... | https://github.com/LuxCoreRender/BlendLuxCore/blob/bf31ca58501d54c02acd97001b6db7de81da7cbf/utils/node.py#L293-L311 | ||
tenpy/tenpy | bbdd3dbbdb511948eb0e6ba7ff619ac6ca657fff | tenpy/algorithms/truncation.py | python | _combine_constraints | (good1, good2, warn) | return good1 | return logical_and(good1, good2) if there remains at least one `True` entry.
Otherwise print a warning and return just `good1`. | return logical_and(good1, good2) if there remains at least one `True` entry. | [
"return",
"logical_and",
"(",
"good1",
"good2",
")",
"if",
"there",
"remains",
"at",
"least",
"one",
"True",
"entry",
"."
] | def _combine_constraints(good1, good2, warn):
"""return logical_and(good1, good2) if there remains at least one `True` entry.
Otherwise print a warning and return just `good1`.
"""
res = np.logical_and(good1, good2)
if np.any(res):
return res
warnings.warn("truncation: can't satisfy con... | [
"def",
"_combine_constraints",
"(",
"good1",
",",
"good2",
",",
"warn",
")",
":",
"res",
"=",
"np",
".",
"logical_and",
"(",
"good1",
",",
"good2",
")",
"if",
"np",
".",
"any",
"(",
"res",
")",
":",
"return",
"res",
"warnings",
".",
"warn",
"(",
"\... | https://github.com/tenpy/tenpy/blob/bbdd3dbbdb511948eb0e6ba7ff619ac6ca657fff/tenpy/algorithms/truncation.py#L317-L326 | |
Kinto/kinto | a9e46e57de8f33c7be098c6f583de18df03b2824 | kinto/core/utils.py | python | decode64 | (encoded_content, encoding="utf-8") | return b64decode(encoded_content.encode(encoding)).decode(encoding) | Decode some base64 encoded content.
:rtype: str | Decode some base64 encoded content. | [
"Decode",
"some",
"base64",
"encoded",
"content",
"."
] | def decode64(encoded_content, encoding="utf-8"):
"""Decode some base64 encoded content.
:rtype: str
"""
return b64decode(encoded_content.encode(encoding)).decode(encoding) | [
"def",
"decode64",
"(",
"encoded_content",
",",
"encoding",
"=",
"\"utf-8\"",
")",
":",
"return",
"b64decode",
"(",
"encoded_content",
".",
"encode",
"(",
"encoding",
")",
")",
".",
"decode",
"(",
"encoding",
")"
] | https://github.com/Kinto/kinto/blob/a9e46e57de8f33c7be098c6f583de18df03b2824/kinto/core/utils.py#L153-L158 | |
boltgolt/howdy | bea79c00a79b286d632875338f89c1b3ba3ac277 | howdy/src/recorders/pyv4l2_reader.py | python | pyv4l2_reader.get | (self, prop) | Getter method for height and width | Getter method for height and width | [
"Getter",
"method",
"for",
"height",
"and",
"width"
] | def get(self, prop):
""" Getter method for height and width """
if prop == CAP_PROP_FRAME_WIDTH:
return self.width
elif prop == CAP_PROP_FRAME_HEIGHT:
return self.height | [
"def",
"get",
"(",
"self",
",",
"prop",
")",
":",
"if",
"prop",
"==",
"CAP_PROP_FRAME_WIDTH",
":",
"return",
"self",
".",
"width",
"elif",
"prop",
"==",
"CAP_PROP_FRAME_HEIGHT",
":",
"return",
"self",
".",
"height"
] | https://github.com/boltgolt/howdy/blob/bea79c00a79b286d632875338f89c1b3ba3ac277/howdy/src/recorders/pyv4l2_reader.py#L39-L44 | ||
scrtlabs/catalyst | 2e8029780f2381da7a0729f7b52505e5db5f535b | catalyst/data/resample.py | python | DailyHistoryAggregator.highs | (self, assets, dt) | return np.array(highs) | The high field's aggregation returns the largest high seen between
the market open and the current dt.
If there has been no data on or before the `dt` the high is `nan`.
Returns
-------
np.array with dtype=float64, in order of assets parameter. | The high field's aggregation returns the largest high seen between
the market open and the current dt.
If there has been no data on or before the `dt` the high is `nan`. | [
"The",
"high",
"field",
"s",
"aggregation",
"returns",
"the",
"largest",
"high",
"seen",
"between",
"the",
"market",
"open",
"and",
"the",
"current",
"dt",
".",
"If",
"there",
"has",
"been",
"no",
"data",
"on",
"or",
"before",
"the",
"dt",
"the",
"high",... | def highs(self, assets, dt):
"""
The high field's aggregation returns the largest high seen between
the market open and the current dt.
If there has been no data on or before the `dt` the high is `nan`.
Returns
-------
np.array with dtype=float64, in order of ass... | [
"def",
"highs",
"(",
"self",
",",
"assets",
",",
"dt",
")",
":",
"market_open",
",",
"prev_dt",
",",
"dt_value",
",",
"entries",
"=",
"self",
".",
"_prelude",
"(",
"dt",
",",
"'high'",
")",
"highs",
"=",
"[",
"]",
"session_label",
"=",
"self",
".",
... | https://github.com/scrtlabs/catalyst/blob/2e8029780f2381da7a0729f7b52505e5db5f535b/catalyst/data/resample.py#L241-L308 | |
huggingface/datasets | 249b4a38390bf1543f5b6e2f3dc208b5689c1c13 | datasets/wikisql/wikisql.py | python | WikiSQL._split_generators | (self, dl_manager) | return [
datasets.SplitGenerator(
name=datasets.Split.TEST,
gen_kwargs={
"main_filepath": os.path.join(dl_dir, "test.jsonl"),
"tables_filepath": os.path.join(dl_dir, "test.tables.jsonl"),
},
),
da... | Returns SplitGenerators. | Returns SplitGenerators. | [
"Returns",
"SplitGenerators",
"."
] | def _split_generators(self, dl_manager):
"""Returns SplitGenerators."""
dl_dir = dl_manager.download_and_extract(_DATA_URL)
dl_dir = os.path.join(dl_dir, "data")
return [
datasets.SplitGenerator(
name=datasets.Split.TEST,
gen_kwargs={
... | [
"def",
"_split_generators",
"(",
"self",
",",
"dl_manager",
")",
":",
"dl_dir",
"=",
"dl_manager",
".",
"download_and_extract",
"(",
"_DATA_URL",
")",
"dl_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"dl_dir",
",",
"\"data\"",
")",
"return",
"[",
"datas... | https://github.com/huggingface/datasets/blob/249b4a38390bf1543f5b6e2f3dc208b5689c1c13/datasets/wikisql/wikisql.py#L79-L106 | |
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/tcss/v20201101/models.py | python | AddEditWarningRulesRequest.__init__ | (self) | r"""
:param WarningRules: 告警开关策略
:type WarningRules: list of WarningRule | r"""
:param WarningRules: 告警开关策略
:type WarningRules: list of WarningRule | [
"r",
":",
"param",
"WarningRules",
":",
"告警开关策略",
":",
"type",
"WarningRules",
":",
"list",
"of",
"WarningRule"
] | def __init__(self):
r"""
:param WarningRules: 告警开关策略
:type WarningRules: list of WarningRule
"""
self.WarningRules = None | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"WarningRules",
"=",
"None"
] | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/tcss/v20201101/models.py#L937-L942 | ||
buke/GreenOdoo | 3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df | runtime/python/lib/python2.7/distutils/dist.py | python | fix_help_options | (options) | return new_options | Convert a 4-tuple 'help_options' list as found in various command
classes to the 3-tuple form required by FancyGetopt. | Convert a 4-tuple 'help_options' list as found in various command
classes to the 3-tuple form required by FancyGetopt. | [
"Convert",
"a",
"4",
"-",
"tuple",
"help_options",
"list",
"as",
"found",
"in",
"various",
"command",
"classes",
"to",
"the",
"3",
"-",
"tuple",
"form",
"required",
"by",
"FancyGetopt",
"."
] | def fix_help_options(options):
"""Convert a 4-tuple 'help_options' list as found in various command
classes to the 3-tuple form required by FancyGetopt.
"""
new_options = []
for help_tuple in options:
new_options.append(help_tuple[0:3])
return new_options | [
"def",
"fix_help_options",
"(",
"options",
")",
":",
"new_options",
"=",
"[",
"]",
"for",
"help_tuple",
"in",
"options",
":",
"new_options",
".",
"append",
"(",
"help_tuple",
"[",
"0",
":",
"3",
"]",
")",
"return",
"new_options"
] | https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/distutils/dist.py#L1242-L1249 | |
etsy/boundary-layer | 466b8343ac8e75fe3e784b77bb2a3f05a76dfe47 | boundary_layer/graph.py | python | _GraphUtil.attach_destroy_resource | (resource, graph, fc_node_builder) | Method to attach the destroy-resource node to the graph,
which is simpler than the attachment of the create-resource node
because it can be attached directly to the downstream boundary nodes
without breaking any existing dependencies. | Method to attach the destroy-resource node to the graph,
which is simpler than the attachment of the create-resource node
because it can be attached directly to the downstream boundary nodes
without breaking any existing dependencies. | [
"Method",
"to",
"attach",
"the",
"destroy",
"-",
"resource",
"node",
"to",
"the",
"graph",
"which",
"is",
"simpler",
"than",
"the",
"attachment",
"of",
"the",
"create",
"-",
"resource",
"node",
"because",
"it",
"can",
"be",
"attached",
"directly",
"to",
"t... | def attach_destroy_resource(resource, graph, fc_node_builder):
""" Method to attach the destroy-resource node to the graph,
which is simpler than the attachment of the create-resource node
because it can be attached directly to the downstream boundary nodes
without breaking a... | [
"def",
"attach_destroy_resource",
"(",
"resource",
",",
"graph",
",",
"fc_node_builder",
")",
":",
"destroy_resource",
"=",
"resource",
".",
"destroy_operator",
"if",
"not",
"destroy_resource",
":",
"return",
"downstream_boundary",
"=",
"_GraphUtil",
".",
"downstream_... | https://github.com/etsy/boundary-layer/blob/466b8343ac8e75fe3e784b77bb2a3f05a76dfe47/boundary_layer/graph.py#L337-L388 | ||
robotlearn/pyrobolearn | 9cd7c060723fda7d2779fa255ac998c2c82b8436 | pyrobolearn/distributions/modules.py | python | wrap_init_tensor | (init_tensor, *args, **kwargs) | return init | r"""Define a higher order function that accepts as inputs the initial method to initialize a tensor, as well
as its arguments, and returns a function that only awaits for its tensor input. With this, you can use the above
:func:`init_module` function quite easily. For instance:
Examples:
>>> module... | r"""Define a higher order function that accepts as inputs the initial method to initialize a tensor, as well
as its arguments, and returns a function that only awaits for its tensor input. With this, you can use the above
:func:`init_module` function quite easily. For instance: | [
"r",
"Define",
"a",
"higher",
"order",
"function",
"that",
"accepts",
"as",
"inputs",
"the",
"initial",
"method",
"to",
"initialize",
"a",
"tensor",
"as",
"well",
"as",
"its",
"arguments",
"and",
"returns",
"a",
"function",
"that",
"only",
"awaits",
"for",
... | def wrap_init_tensor(init_tensor, *args, **kwargs):
r"""Define a higher order function that accepts as inputs the initial method to initialize a tensor, as well
as its arguments, and returns a function that only awaits for its tensor input. With this, you can use the above
:func:`init_module` function quite... | [
"def",
"wrap_init_tensor",
"(",
"init_tensor",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"init",
"(",
"tensor",
")",
":",
"return",
"init_tensor",
"(",
"tensor",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"init"
] | https://github.com/robotlearn/pyrobolearn/blob/9cd7c060723fda7d2779fa255ac998c2c82b8436/pyrobolearn/distributions/modules.py#L64-L80 | |
mesalock-linux/mesapy | ed546d59a21b36feb93e2309d5c6b75aa0ad95c9 | lib-python/2.7/platform.py | python | python_compiler | () | return _sys_version()[6] | Returns a string identifying the compiler used for compiling
Python. | Returns a string identifying the compiler used for compiling
Python. | [
"Returns",
"a",
"string",
"identifying",
"the",
"compiler",
"used",
"for",
"compiling",
"Python",
"."
] | def python_compiler():
""" Returns a string identifying the compiler used for compiling
Python.
"""
return _sys_version()[6] | [
"def",
"python_compiler",
"(",
")",
":",
"return",
"_sys_version",
"(",
")",
"[",
"6",
"]"
] | https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/lib-python/2.7/platform.py#L1518-L1524 | |
nschloe/quadpy | c4c076d8ddfa968486a2443a95e2fb3780dcde0f | src/quadpy/tn/_stroud_1966.py | python | stroud_1966_5 | (n) | return TnScheme("Stroud 1966-I", n, weights, points, degree, source) | [] | def stroud_1966_5(n):
degree = 3
r = frac(1, n)
s = frac(1, 3)
prod = (n + 1) * (n + 2) * (n + 3)
A = frac(-(n ** 2) + 11 * n - 12, 2 * (n - 1) * prod)
B = frac(n ** 3, (n - 1) * prod)
C = frac(27, (n - 1) * prod)
data = [
(A, rd(n + 1, [(1, 1)])),
(B, rd(n + 1, [(r, n)... | [
"def",
"stroud_1966_5",
"(",
"n",
")",
":",
"degree",
"=",
"3",
"r",
"=",
"frac",
"(",
"1",
",",
"n",
")",
"s",
"=",
"frac",
"(",
"1",
",",
"3",
")",
"prod",
"=",
"(",
"n",
"+",
"1",
")",
"*",
"(",
"n",
"+",
"2",
")",
"*",
"(",
"n",
"... | https://github.com/nschloe/quadpy/blob/c4c076d8ddfa968486a2443a95e2fb3780dcde0f/src/quadpy/tn/_stroud_1966.py#L103-L120 | |||
dgk/django-business-logic | 80c1ee24478bdc0dbb4916cf7603b6514f89af4b | business_logic/rest/serializers.py | python | BlocklyXMLSerializer.to_internal_value | (self, data) | return NodeTreeCreator().create(BlocklyXmlParser().parse(data)[0]) | [] | def to_internal_value(self, data):
return NodeTreeCreator().create(BlocklyXmlParser().parse(data)[0]) | [
"def",
"to_internal_value",
"(",
"self",
",",
"data",
")",
":",
"return",
"NodeTreeCreator",
"(",
")",
".",
"create",
"(",
"BlocklyXmlParser",
"(",
")",
".",
"parse",
"(",
"data",
")",
"[",
"0",
"]",
")"
] | https://github.com/dgk/django-business-logic/blob/80c1ee24478bdc0dbb4916cf7603b6514f89af4b/business_logic/rest/serializers.py#L98-L99 | |||
huawei-noah/Pretrained-Language-Model | d4694a134bdfacbaef8ff1d99735106bd3b3372b | BinaryBERT/transformer/tokenization.py | python | WordpieceTokenizer.tokenize | (self, text) | return output_tokens | Tokenizes a piece of text into its word pieces.
This uses a greedy longest-match-first algorithm to perform tokenization
using the given vocabulary.
For example:
input = "unaffable"
output = ["un", "##aff", "##able"]
Args:
text: A single token or whitespa... | Tokenizes a piece of text into its word pieces. | [
"Tokenizes",
"a",
"piece",
"of",
"text",
"into",
"its",
"word",
"pieces",
"."
] | def tokenize(self, text):
"""Tokenizes a piece of text into its word pieces.
This uses a greedy longest-match-first algorithm to perform tokenization
using the given vocabulary.
For example:
input = "unaffable"
output = ["un", "##aff", "##able"]
Args:
... | [
"def",
"tokenize",
"(",
"self",
",",
"text",
")",
":",
"output_tokens",
"=",
"[",
"]",
"for",
"token",
"in",
"whitespace_tokenize",
"(",
"text",
")",
":",
"chars",
"=",
"list",
"(",
"token",
")",
"if",
"len",
"(",
"chars",
")",
">",
"self",
".",
"m... | https://github.com/huawei-noah/Pretrained-Language-Model/blob/d4694a134bdfacbaef8ff1d99735106bd3b3372b/BinaryBERT/transformer/tokenization.py#L300-L349 | |
jonrau1/ElectricEye | 31960e1e1cfb75c5d354844ea9e07d5295442823 | eeauditor/auditors/aws/Amazon_EC2_Auditor.py | python | ec2_public_facing_check | (cache: dict, awsAccountId: str, awsRegion: str, awsPartition: str) | [EC2.3] EC2 Instances should not be internet-facing | [EC2.3] EC2 Instances should not be internet-facing | [
"[",
"EC2",
".",
"3",
"]",
"EC2",
"Instances",
"should",
"not",
"be",
"internet",
"-",
"facing"
] | def ec2_public_facing_check(cache: dict, awsAccountId: str, awsRegion: str, awsPartition: str) -> dict:
"""[EC2.3] EC2 Instances should not be internet-facing"""
# ISO Time
iso8601Time = (datetime.datetime.utcnow().replace(tzinfo=datetime.timezone.utc).isoformat())
try:
iterator = paginate(cache... | [
"def",
"ec2_public_facing_check",
"(",
"cache",
":",
"dict",
",",
"awsAccountId",
":",
"str",
",",
"awsRegion",
":",
"str",
",",
"awsPartition",
":",
"str",
")",
"->",
"dict",
":",
"# ISO Time",
"iso8601Time",
"=",
"(",
"datetime",
".",
"datetime",
".",
"u... | https://github.com/jonrau1/ElectricEye/blob/31960e1e1cfb75c5d354844ea9e07d5295442823/eeauditor/auditors/aws/Amazon_EC2_Auditor.py#L371-L521 | ||
kanzure/nanoengineer | 874e4c9f8a9190f093625b267f9767e19f82e6c4 | cad/src/operations/bond_chains.py | python | abstract_bond_chain_analyzer.atom_ok | (self, atom) | return True | Subclass-specific primitive for whether an atom qualifies.
@note: if an atom is only ok if it matches the prior atom in some way,
use bond_ok instead, for that part of the condition.
[subclass should override] | Subclass-specific primitive for whether an atom qualifies. | [
"Subclass",
"-",
"specific",
"primitive",
"for",
"whether",
"an",
"atom",
"qualifies",
"."
] | def atom_ok(self, atom):
"""
Subclass-specific primitive for whether an atom qualifies.
@note: if an atom is only ok if it matches the prior atom in some way,
use bond_ok instead, for that part of the condition.
[subclass should override]
"""
return True | [
"def",
"atom_ok",
"(",
"self",
",",
"atom",
")",
":",
"return",
"True"
] | https://github.com/kanzure/nanoengineer/blob/874e4c9f8a9190f093625b267f9767e19f82e6c4/cad/src/operations/bond_chains.py#L158-L167 | |
Doist/redis_graph | 6cd2677867c5176327f67d2ee1c27813804f1a3a | redis_graph/__init__.py | python | neighbors | (node_x, system='default') | return get_set( node_x, system=system ) | [] | def neighbors(node_x, system='default'):
return get_set( node_x, system=system ) | [
"def",
"neighbors",
"(",
"node_x",
",",
"system",
"=",
"'default'",
")",
":",
"return",
"get_set",
"(",
"node_x",
",",
"system",
"=",
"system",
")"
] | https://github.com/Doist/redis_graph/blob/6cd2677867c5176327f67d2ee1c27813804f1a3a/redis_graph/__init__.py#L19-L20 | |||
pithos/pithos | fff93d0740ad752d53027732467155219c20acb2 | pithos/plugins/mpris.py | python | PithosMprisService.TrackAdded | (self, Metadata, AfterTrack) | a{sv}o Interface MediaPlayer2.TrackList | a{sv}o Interface MediaPlayer2.TrackList | [
"a",
"{",
"sv",
"}",
"o",
"Interface",
"MediaPlayer2",
".",
"TrackList"
] | def TrackAdded(self, Metadata, AfterTrack):
'''a{sv}o Interface MediaPlayer2.TrackList'''
pass | [
"def",
"TrackAdded",
"(",
"self",
",",
"Metadata",
",",
"AfterTrack",
")",
":",
"pass"
] | https://github.com/pithos/pithos/blob/fff93d0740ad752d53027732467155219c20acb2/pithos/plugins/mpris.py#L799-L801 | ||
holoviz/panel | 5e25cb09447d8edf0b316f130ee1318a2aeb880f | panel/widgets/slider.py | python | DiscreteSlider._sync_value | (self, event) | This will update the DiscreteSlider (front)
based on changes to the IntSlider (behind the scene).
_syncing options is to avoid infinite loop.
event.name is either value or value_throttled. | This will update the DiscreteSlider (front)
based on changes to the IntSlider (behind the scene). | [
"This",
"will",
"update",
"the",
"DiscreteSlider",
"(",
"front",
")",
"based",
"on",
"changes",
"to",
"the",
"IntSlider",
"(",
"behind",
"the",
"scene",
")",
"."
] | def _sync_value(self, event):
"""
This will update the DiscreteSlider (front)
based on changes to the IntSlider (behind the scene).
_syncing options is to avoid infinite loop.
event.name is either value or value_throttled.
"""
if self._syncing:
retu... | [
"def",
"_sync_value",
"(",
"self",
",",
"event",
")",
":",
"if",
"self",
".",
"_syncing",
":",
"return",
"try",
":",
"self",
".",
"_syncing",
"=",
"True",
"with",
"param",
".",
"edit_constant",
"(",
"self",
")",
":",
"setattr",
"(",
"self",
",",
"eve... | https://github.com/holoviz/panel/blob/5e25cb09447d8edf0b316f130ee1318a2aeb880f/panel/widgets/slider.py#L313-L330 | ||
oracle/oci-python-sdk | 3c1604e4e212008fb6718e2f68cdb5ef71fd5793 | src/oci/apm_synthetics/apm_synthetic_client_composite_operations.py | python | ApmSyntheticClientCompositeOperations.__init__ | (self, client, **kwargs) | Creates a new ApmSyntheticClientCompositeOperations object
:param ApmSyntheticClient client:
The service client which will be wrapped by this object | Creates a new ApmSyntheticClientCompositeOperations object | [
"Creates",
"a",
"new",
"ApmSyntheticClientCompositeOperations",
"object"
] | def __init__(self, client, **kwargs):
"""
Creates a new ApmSyntheticClientCompositeOperations object
:param ApmSyntheticClient client:
The service client which will be wrapped by this object
"""
self.client = client | [
"def",
"__init__",
"(",
"self",
",",
"client",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"client",
"=",
"client"
] | https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/src/oci/apm_synthetics/apm_synthetic_client_composite_operations.py#L17-L24 | ||
spyder-ide/spyder | 55da47c032dfcf519600f67f8b30eab467f965e7 | spyder/widgets/switcher.py | python | create_vcs_example_switcher | (sw) | Add example data for vcs. | Add example data for vcs. | [
"Add",
"example",
"data",
"for",
"vcs",
"."
] | def create_vcs_example_switcher(sw):
"""Add example data for vcs."""
sw.clear()
sw.set_placeholder_text('Select a ref to Checkout')
sw.add_item(title='Create New Branch', action_item=True,
icon=ima.icon('MessageBoxInformation'))
sw.add_item(title='master', description='123123')
s... | [
"def",
"create_vcs_example_switcher",
"(",
"sw",
")",
":",
"sw",
".",
"clear",
"(",
")",
"sw",
".",
"set_placeholder_text",
"(",
"'Select a ref to Checkout'",
")",
"sw",
".",
"add_item",
"(",
"title",
"=",
"'Create New Branch'",
",",
"action_item",
"=",
"True",
... | https://github.com/spyder-ide/spyder/blob/55da47c032dfcf519600f67f8b30eab467f965e7/spyder/widgets/switcher.py#L910-L920 | ||
keon/algorithms | 23d4e85a506eaeaff315e855be12f8dbe47a7ec3 | algorithms/strings/domain_extractor.py | python | domain_name_1 | (url) | return actual_domain[0] | [] | def domain_name_1(url):
#grab only the non http(s) part
full_domain_name = url.split('//')[-1]
#grab the actual one depending on the len of the list
actual_domain = full_domain_name.split('.')
# case when www is in the url
if (len(actual_domain) > 2):
return actual_domain[1]
... | [
"def",
"domain_name_1",
"(",
"url",
")",
":",
"#grab only the non http(s) part",
"full_domain_name",
"=",
"url",
".",
"split",
"(",
"'//'",
")",
"[",
"-",
"1",
"]",
"#grab the actual one depending on the len of the list ",
"actual_domain",
"=",
"full_domain_name",
".",... | https://github.com/keon/algorithms/blob/23d4e85a506eaeaff315e855be12f8dbe47a7ec3/algorithms/strings/domain_extractor.py#L13-L23 | |||
ring04h/weakfilescan | b1a3066e3fdcd60b8ecf635526f49cb5ad603064 | libs/requests/utils.py | python | unquote_unreserved | (uri) | return ''.join(parts) | Un-escape any percent-escape sequences in a URI that are unreserved
characters. This leaves all reserved, illegal and non-ASCII bytes encoded. | Un-escape any percent-escape sequences in a URI that are unreserved
characters. This leaves all reserved, illegal and non-ASCII bytes encoded. | [
"Un",
"-",
"escape",
"any",
"percent",
"-",
"escape",
"sequences",
"in",
"a",
"URI",
"that",
"are",
"unreserved",
"characters",
".",
"This",
"leaves",
"all",
"reserved",
"illegal",
"and",
"non",
"-",
"ASCII",
"bytes",
"encoded",
"."
] | def unquote_unreserved(uri):
"""Un-escape any percent-escape sequences in a URI that are unreserved
characters. This leaves all reserved, illegal and non-ASCII bytes encoded.
"""
parts = uri.split('%')
for i in range(1, len(parts)):
h = parts[i][0:2]
if len(h) == 2 and h.isalnum():
... | [
"def",
"unquote_unreserved",
"(",
"uri",
")",
":",
"parts",
"=",
"uri",
".",
"split",
"(",
"'%'",
")",
"for",
"i",
"in",
"range",
"(",
"1",
",",
"len",
"(",
"parts",
")",
")",
":",
"h",
"=",
"parts",
"[",
"i",
"]",
"[",
"0",
":",
"2",
"]",
... | https://github.com/ring04h/weakfilescan/blob/b1a3066e3fdcd60b8ecf635526f49cb5ad603064/libs/requests/utils.py#L393-L412 | |
robotframework/RIDE | 6e8a50774ff33dead3a2757a11b0b4418ab205c0 | src/robotide/lib/robot/libraries/BuiltIn.py | python | _Variables.set_test_variable | (self, name, *values) | Makes a variable available everywhere within the scope of the current test.
Variables set with this keyword are available everywhere within the
scope of the currently executed test case. For example, if you set a
variable in a user keyword, it is available both in the test case level
an... | Makes a variable available everywhere within the scope of the current test. | [
"Makes",
"a",
"variable",
"available",
"everywhere",
"within",
"the",
"scope",
"of",
"the",
"current",
"test",
"."
] | def set_test_variable(self, name, *values):
"""Makes a variable available everywhere within the scope of the current test.
Variables set with this keyword are available everywhere within the
scope of the currently executed test case. For example, if you set a
variable in a user keyword,... | [
"def",
"set_test_variable",
"(",
"self",
",",
"name",
",",
"*",
"values",
")",
":",
"name",
"=",
"self",
".",
"_get_var_name",
"(",
"name",
")",
"value",
"=",
"self",
".",
"_get_var_value",
"(",
"name",
",",
"values",
")",
"self",
".",
"_variables",
".... | https://github.com/robotframework/RIDE/blob/6e8a50774ff33dead3a2757a11b0b4418ab205c0/src/robotide/lib/robot/libraries/BuiltIn.py#L1432-L1446 | ||
Pylons/webob | 259230aa2b8b9cf675c996e157c5cf021c256059 | src/webob/request.py | python | BaseRequest.body_file_seekable | (self) | return self.body_file_raw | Get the body of the request (wsgi.input) as a seekable file-like
object. Middleware and routing applications should use this
attribute over .body_file.
If you access this value, CONTENT_LENGTH will also be updated. | Get the body of the request (wsgi.input) as a seekable file-like
object. Middleware and routing applications should use this
attribute over .body_file. | [
"Get",
"the",
"body",
"of",
"the",
"request",
"(",
"wsgi",
".",
"input",
")",
"as",
"a",
"seekable",
"file",
"-",
"like",
"object",
".",
"Middleware",
"and",
"routing",
"applications",
"should",
"use",
"this",
"attribute",
"over",
".",
"body_file",
"."
] | def body_file_seekable(self):
"""
Get the body of the request (wsgi.input) as a seekable file-like
object. Middleware and routing applications should use this
attribute over .body_file.
If you access this value, CONTENT_LENGTH will also be updated.
"""
if not se... | [
"def",
"body_file_seekable",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"is_body_seekable",
":",
"self",
".",
"make_body_seekable",
"(",
")",
"return",
"self",
".",
"body_file_raw"
] | https://github.com/Pylons/webob/blob/259230aa2b8b9cf675c996e157c5cf021c256059/src/webob/request.py#L246-L258 | |
eBay/bayesian-belief-networks | 23c3e3ce1c7f99d83efb79f9b7798af2a1537e1c | bayesian/factor_graph.py | python | FactorGraph.get_eligible_senders | (self) | return eligible | Return a list of nodes that are
eligible to send messages at this
round. Only nodes that have received
messages from all but one neighbour
may send at any round. | Return a list of nodes that are
eligible to send messages at this
round. Only nodes that have received
messages from all but one neighbour
may send at any round. | [
"Return",
"a",
"list",
"of",
"nodes",
"that",
"are",
"eligible",
"to",
"send",
"messages",
"at",
"this",
"round",
".",
"Only",
"nodes",
"that",
"have",
"received",
"messages",
"from",
"all",
"but",
"one",
"neighbour",
"may",
"send",
"at",
"any",
"round",
... | def get_eligible_senders(self):
'''
Return a list of nodes that are
eligible to send messages at this
round. Only nodes that have received
messages from all but one neighbour
may send at any round.
'''
eligible = []
for node in self.nodes:
... | [
"def",
"get_eligible_senders",
"(",
"self",
")",
":",
"eligible",
"=",
"[",
"]",
"for",
"node",
"in",
"self",
".",
"nodes",
":",
"if",
"node",
".",
"get_target",
"(",
")",
":",
"eligible",
".",
"append",
"(",
"node",
")",
"return",
"eligible"
] | https://github.com/eBay/bayesian-belief-networks/blob/23c3e3ce1c7f99d83efb79f9b7798af2a1537e1c/bayesian/factor_graph.py#L929-L941 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/whoosh/externalsort.py | python | SortingPool.add | (self, item) | Adds `item` to the pool to be sorted. | Adds `item` to the pool to be sorted. | [
"Adds",
"item",
"to",
"the",
"pool",
"to",
"be",
"sorted",
"."
] | def add(self, item):
"""Adds `item` to the pool to be sorted.
"""
if len(self.current) >= self.maxsize:
self.save()
self.current.append(item) | [
"def",
"add",
"(",
"self",
",",
"item",
")",
":",
"if",
"len",
"(",
"self",
".",
"current",
")",
">=",
"self",
".",
"maxsize",
":",
"self",
".",
"save",
"(",
")",
"self",
".",
"current",
".",
"append",
"(",
"item",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/whoosh/externalsort.py#L152-L158 | ||
gentoo/portage | e5be73709b1a42b40380fd336f9381452b01a723 | lib/_emerge/BlockerCache.py | python | BlockerCache.__init__ | (self, myroot, vardb) | myroot is ignored in favour of EROOT | myroot is ignored in favour of EROOT | [
"myroot",
"is",
"ignored",
"in",
"favour",
"of",
"EROOT"
] | def __init__(self, myroot, vardb):
"""myroot is ignored in favour of EROOT"""
self._vardb = vardb
self._cache_filename = os.path.join(
vardb.settings["EROOT"], portage.CACHE_PATH, "vdb_blockers.pickle"
)
self._cache_version = "1"
self._cache_data = None
... | [
"def",
"__init__",
"(",
"self",
",",
"myroot",
",",
"vardb",
")",
":",
"self",
".",
"_vardb",
"=",
"vardb",
"self",
".",
"_cache_filename",
"=",
"os",
".",
"path",
".",
"join",
"(",
"vardb",
".",
"settings",
"[",
"\"EROOT\"",
"]",
",",
"portage",
"."... | https://github.com/gentoo/portage/blob/e5be73709b1a42b40380fd336f9381452b01a723/lib/_emerge/BlockerCache.py#L32-L41 | ||
vlachoudis/bCNC | 67126b4894dabf6579baf47af8d0f9b7de35e6e3 | bCNC/CNCCanvas.py | python | CNCCanvas.mouseZoomOut | (self, event) | [] | def mouseZoomOut(self, event):
self.zoomCanvas(event.x, event.y, 1.0/ZOOM) | [
"def",
"mouseZoomOut",
"(",
"self",
",",
"event",
")",
":",
"self",
".",
"zoomCanvas",
"(",
"event",
".",
"x",
",",
"event",
".",
"y",
",",
"1.0",
"/",
"ZOOM",
")"
] | https://github.com/vlachoudis/bCNC/blob/67126b4894dabf6579baf47af8d0f9b7de35e6e3/bCNC/CNCCanvas.py#L1006-L1007 | ||||
iclavera/learning_to_adapt | bd7d99ba402521c96631e7d09714128f549db0f1 | learning_to_adapt/mujoco_py/mjtypes.py | python | MjModelWrapper.jnt_solref | (self) | return arr | [] | def jnt_solref(self):
arr = np.reshape(np.fromiter(self._wrapped.contents.jnt_solref, dtype=np.double, count=(self.njnt*2)), (self.njnt, 2, ))
arr.setflags(write=False)
return arr | [
"def",
"jnt_solref",
"(",
"self",
")",
":",
"arr",
"=",
"np",
".",
"reshape",
"(",
"np",
".",
"fromiter",
"(",
"self",
".",
"_wrapped",
".",
"contents",
".",
"jnt_solref",
",",
"dtype",
"=",
"np",
".",
"double",
",",
"count",
"=",
"(",
"self",
".",... | https://github.com/iclavera/learning_to_adapt/blob/bd7d99ba402521c96631e7d09714128f549db0f1/learning_to_adapt/mujoco_py/mjtypes.py#L3985-L3988 | |||
Qiskit/qiskit-terra | b66030e3b9192efdd3eb95cf25c6545fe0a13da4 | qiskit/transpiler/passes/optimization/collect_multiqubit_blocks.py | python | CollectMultiQBlocks.union_set | (self, set1, set2) | DSU function for unioning two sets together
Find the roots of each set. Then assign one to have the other
as its parent, thus liking the sets.
Merges smaller set into larger set in order to have better runtime | DSU function for unioning two sets together
Find the roots of each set. Then assign one to have the other
as its parent, thus liking the sets.
Merges smaller set into larger set in order to have better runtime | [
"DSU",
"function",
"for",
"unioning",
"two",
"sets",
"together",
"Find",
"the",
"roots",
"of",
"each",
"set",
".",
"Then",
"assign",
"one",
"to",
"have",
"the",
"other",
"as",
"its",
"parent",
"thus",
"liking",
"the",
"sets",
".",
"Merges",
"smaller",
"s... | def union_set(self, set1, set2):
"""DSU function for unioning two sets together
Find the roots of each set. Then assign one to have the other
as its parent, thus liking the sets.
Merges smaller set into larger set in order to have better runtime
"""
set1 = self.find_set(... | [
"def",
"union_set",
"(",
"self",
",",
"set1",
",",
"set2",
")",
":",
"set1",
"=",
"self",
".",
"find_set",
"(",
"set1",
")",
"set2",
"=",
"self",
".",
"find_set",
"(",
"set2",
")",
"if",
"set1",
"==",
"set2",
":",
"return",
"if",
"len",
"(",
"sel... | https://github.com/Qiskit/qiskit-terra/blob/b66030e3b9192efdd3eb95cf25c6545fe0a13da4/qiskit/transpiler/passes/optimization/collect_multiqubit_blocks.py#L69-L86 | ||
tomplus/kubernetes_asyncio | f028cc793e3a2c519be6a52a49fb77ff0b014c9b | kubernetes_asyncio/client/models/v2beta2_object_metric_status.py | python | V2beta2ObjectMetricStatus.metric | (self, metric) | Sets the metric of this V2beta2ObjectMetricStatus.
:param metric: The metric of this V2beta2ObjectMetricStatus. # noqa: E501
:type: V2beta2MetricIdentifier | Sets the metric of this V2beta2ObjectMetricStatus. | [
"Sets",
"the",
"metric",
"of",
"this",
"V2beta2ObjectMetricStatus",
"."
] | def metric(self, metric):
"""Sets the metric of this V2beta2ObjectMetricStatus.
:param metric: The metric of this V2beta2ObjectMetricStatus. # noqa: E501
:type: V2beta2MetricIdentifier
"""
if self.local_vars_configuration.client_side_validation and metric is None: # noqa: E50... | [
"def",
"metric",
"(",
"self",
",",
"metric",
")",
":",
"if",
"self",
".",
"local_vars_configuration",
".",
"client_side_validation",
"and",
"metric",
"is",
"None",
":",
"# noqa: E501",
"raise",
"ValueError",
"(",
"\"Invalid value for `metric`, must not be `None`\"",
"... | https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/models/v2beta2_object_metric_status.py#L119-L129 | ||
pypa/pipenv | b21baade71a86ab3ee1429f71fbc14d4f95fb75d | pipenv/vendor/distlib/_backport/tarfile.py | python | TarFile.addfile | (self, tarinfo, fileobj=None) | Add the TarInfo object `tarinfo' to the archive. If `fileobj' is
given, tarinfo.size bytes are read from it and added to the archive.
You can create TarInfo objects using gettarinfo().
On Windows platforms, `fileobj' should always be opened with mode
'rb' to avoid irritation ... | Add the TarInfo object `tarinfo' to the archive. If `fileobj' is
given, tarinfo.size bytes are read from it and added to the archive.
You can create TarInfo objects using gettarinfo().
On Windows platforms, `fileobj' should always be opened with mode
'rb' to avoid irritation ... | [
"Add",
"the",
"TarInfo",
"object",
"tarinfo",
"to",
"the",
"archive",
".",
"If",
"fileobj",
"is",
"given",
"tarinfo",
".",
"size",
"bytes",
"are",
"read",
"from",
"it",
"and",
"added",
"to",
"the",
"archive",
".",
"You",
"can",
"create",
"TarInfo",
"obje... | def addfile(self, tarinfo, fileobj=None):
"""Add the TarInfo object `tarinfo' to the archive. If `fileobj' is
given, tarinfo.size bytes are read from it and added to the archive.
You can create TarInfo objects using gettarinfo().
On Windows platforms, `fileobj' should always be ... | [
"def",
"addfile",
"(",
"self",
",",
"tarinfo",
",",
"fileobj",
"=",
"None",
")",
":",
"self",
".",
"_check",
"(",
"\"aw\"",
")",
"tarinfo",
"=",
"copy",
".",
"copy",
"(",
"tarinfo",
")",
"buf",
"=",
"tarinfo",
".",
"tobuf",
"(",
"self",
".",
"forma... | https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/vendor/distlib/_backport/tarfile.py#L2100-L2124 | ||
sqall01/alertR | e1d1a83e54f876cc4cd7bd87387e05cb75d4dc13 | alertClientKodi/lib/update.py | python | Updater.setInstance | (self, instance: str, retrieveInfo: bool = True) | Sets the instance to the newly given instance. Necessary if globalData does not hold the instance we
are looking for.
:param instance: target instance
:param retrieveInfo: should we directly retrieve all information from the online repository? | Sets the instance to the newly given instance. Necessary if globalData does not hold the instance we
are looking for. | [
"Sets",
"the",
"instance",
"to",
"the",
"newly",
"given",
"instance",
".",
"Necessary",
"if",
"globalData",
"does",
"not",
"hold",
"the",
"instance",
"we",
"are",
"looking",
"for",
"."
] | def setInstance(self, instance: str, retrieveInfo: bool = True):
"""
Sets the instance to the newly given instance. Necessary if globalData does not hold the instance we
are looking for.
:param instance: target instance
:param retrieveInfo: should we directly retrieve all inform... | [
"def",
"setInstance",
"(",
"self",
",",
"instance",
":",
"str",
",",
"retrieveInfo",
":",
"bool",
"=",
"True",
")",
":",
"self",
".",
"instance",
"=",
"instance",
"self",
".",
"instanceInfo",
"=",
"None",
"self",
".",
"lastChecked",
"=",
"0",
"self",
"... | https://github.com/sqall01/alertR/blob/e1d1a83e54f876cc4cd7bd87387e05cb75d4dc13/alertClientKodi/lib/update.py#L808-L824 | ||
jython/jython3 | def4f8ec47cb7a9c799ea4c745f12badf92c5769 | lib-python/3.5.1/tkinter/__init__.py | python | Canvas.tag_lower | (self, *args) | Lower an item TAGORID given in ARGS
(optional below another item). | Lower an item TAGORID given in ARGS
(optional below another item). | [
"Lower",
"an",
"item",
"TAGORID",
"given",
"in",
"ARGS",
"(",
"optional",
"below",
"another",
"item",
")",
"."
] | def tag_lower(self, *args):
"""Lower an item TAGORID given in ARGS
(optional below another item)."""
self.tk.call((self._w, 'lower') + args) | [
"def",
"tag_lower",
"(",
"self",
",",
"*",
"args",
")",
":",
"self",
".",
"tk",
".",
"call",
"(",
"(",
"self",
".",
"_w",
",",
"'lower'",
")",
"+",
"args",
")"
] | https://github.com/jython/jython3/blob/def4f8ec47cb7a9c799ea4c745f12badf92c5769/lib-python/3.5.1/tkinter/__init__.py#L2423-L2426 | ||
viewfinderco/viewfinder | 453845b5d64ab5b3b826c08b02546d1ca0a07c14 | backend/db/dynamodb_client.py | python | DynamoDBClient.AddAbsoluteTimeout | (self, abs_timeout, callback) | return ioloop.IOLoop.current().add_timeout(abs_timeout, callback) | Invokes the specified callback at time 'abs_timeout'. | Invokes the specified callback at time 'abs_timeout'. | [
"Invokes",
"the",
"specified",
"callback",
"at",
"time",
"abs_timeout",
"."
] | def AddAbsoluteTimeout(self, abs_timeout, callback):
"""Invokes the specified callback at time 'abs_timeout'."""
return ioloop.IOLoop.current().add_timeout(abs_timeout, callback) | [
"def",
"AddAbsoluteTimeout",
"(",
"self",
",",
"abs_timeout",
",",
"callback",
")",
":",
"return",
"ioloop",
".",
"IOLoop",
".",
"current",
"(",
")",
".",
"add_timeout",
"(",
"abs_timeout",
",",
"callback",
")"
] | https://github.com/viewfinderco/viewfinder/blob/453845b5d64ab5b3b826c08b02546d1ca0a07c14/backend/db/dynamodb_client.py#L568-L570 | |
cantools/cantools | 8d86d61bc010f328cf414150331fecfd4b6f4dc3 | cantools/database/can/bus.py | python | Bus.comments | (self) | return self._comments | The dictionary with the descriptions of the bus in multiple
languages. ``None`` if unavailable. | The dictionary with the descriptions of the bus in multiple
languages. ``None`` if unavailable. | [
"The",
"dictionary",
"with",
"the",
"descriptions",
"of",
"the",
"bus",
"in",
"multiple",
"languages",
".",
"None",
"if",
"unavailable",
"."
] | def comments(self):
"""The dictionary with the descriptions of the bus in multiple
languages. ``None`` if unavailable.
"""
return self._comments | [
"def",
"comments",
"(",
"self",
")",
":",
"return",
"self",
".",
"_comments"
] | https://github.com/cantools/cantools/blob/8d86d61bc010f328cf414150331fecfd4b6f4dc3/cantools/database/can/bus.py#L59-L64 | |
kubernetes-client/python | 47b9da9de2d02b2b7a34fbe05afb44afd130d73a | kubernetes/client/models/v2beta1_container_resource_metric_status.py | python | V2beta1ContainerResourceMetricStatus.current_average_value | (self, current_average_value) | Sets the current_average_value of this V2beta1ContainerResourceMetricStatus.
currentAverageValue is the current value of the average of the resource metric across all relevant pods, as a raw value (instead of as a percentage of the request), similar to the \"pods\" metric source type. It will always be set, re... | Sets the current_average_value of this V2beta1ContainerResourceMetricStatus. | [
"Sets",
"the",
"current_average_value",
"of",
"this",
"V2beta1ContainerResourceMetricStatus",
"."
] | def current_average_value(self, current_average_value):
"""Sets the current_average_value of this V2beta1ContainerResourceMetricStatus.
currentAverageValue is the current value of the average of the resource metric across all relevant pods, as a raw value (instead of as a percentage of the request), si... | [
"def",
"current_average_value",
"(",
"self",
",",
"current_average_value",
")",
":",
"if",
"self",
".",
"local_vars_configuration",
".",
"client_side_validation",
"and",
"current_average_value",
"is",
"None",
":",
"# noqa: E501",
"raise",
"ValueError",
"(",
"\"Invalid v... | https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/v2beta1_container_resource_metric_status.py#L127-L138 | ||
minerllabs/minerl | 0123527c334c96ebb3f0cf313df1552fa4302691 | minerl/herobraine/env_specs/basalt_specs.py | python | PenAnimalsVillageEnvSpec.create_server_decorators | (self) | return [handlers.VillageSpawnDecorator()] | [] | def create_server_decorators(self) -> List[handlers.Handler]:
return [handlers.VillageSpawnDecorator()] | [
"def",
"create_server_decorators",
"(",
"self",
")",
"->",
"List",
"[",
"handlers",
".",
"Handler",
"]",
":",
"return",
"[",
"handlers",
".",
"VillageSpawnDecorator",
"(",
")",
"]"
] | https://github.com/minerllabs/minerl/blob/0123527c334c96ebb3f0cf313df1552fa4302691/minerl/herobraine/env_specs/basalt_specs.py#L436-L437 | |||
lanpa/tensorboardX | eefcaa76503447f6188121855ce0499d748131b3 | tensorboardX/comet_utils.py | python | CometLogger.log_asset_data | (self, data, name=None, overwrite=False, step=None,
metadata=None, epoch=None) | Logs the data given (str, binary, or JSON).
Args:
data: data to be saved as asset
name: String, optional. A custom file name to be displayed If
not provided the filename from the temporary saved file
will be used.
overwrite: Boolean, optional. Default False. If T... | Logs the data given (str, binary, or JSON). | [
"Logs",
"the",
"data",
"given",
"(",
"str",
"binary",
"or",
"JSON",
")",
"."
] | def log_asset_data(self, data, name=None, overwrite=False, step=None,
metadata=None, epoch=None):
"""Logs the data given (str, binary, or JSON).
Args:
data: data to be saved as asset
name: String, optional. A custom file name to be displayed If
not pro... | [
"def",
"log_asset_data",
"(",
"self",
",",
"data",
",",
"name",
"=",
"None",
",",
"overwrite",
"=",
"False",
",",
"step",
"=",
"None",
",",
"metadata",
"=",
"None",
",",
"epoch",
"=",
"None",
")",
":",
"self",
".",
"_experiment",
".",
"log_asset_data",... | https://github.com/lanpa/tensorboardX/blob/eefcaa76503447f6188121855ce0499d748131b3/tensorboardX/comet_utils.py#L207-L224 | ||
google/grr | 8ad8a4d2c5a93c92729206b7771af19d92d4f915 | grr/server/grr_response_server/gui/api_plugins/metadata.py | python | ApiGetOpenApiDescriptionHandler._GetPaths | (self) | return paths_obj | Create the OpenAPI description of all the routes exposed by the API. | Create the OpenAPI description of all the routes exposed by the API. | [
"Create",
"the",
"OpenAPI",
"description",
"of",
"all",
"the",
"routes",
"exposed",
"by",
"the",
"API",
"."
] | def _GetPaths(self) -> Dict[str, Dict[Any, Any]]:
"""Create the OpenAPI description of all the routes exposed by the API."""
# The `Paths Object` `paths` field of the root `OpenAPI Object`.
paths_obj: DefaultDict[str, Dict[Any, Any]] = collections.defaultdict(dict)
router_methods = self.router.__class... | [
"def",
"_GetPaths",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"Dict",
"[",
"Any",
",",
"Any",
"]",
"]",
":",
"# The `Paths Object` `paths` field of the root `OpenAPI Object`.",
"paths_obj",
":",
"DefaultDict",
"[",
"str",
",",
"Dict",
"[",
"Any",
",",
... | https://github.com/google/grr/blob/8ad8a4d2c5a93c92729206b7771af19d92d4f915/grr/server/grr_response_server/gui/api_plugins/metadata.py#L816-L876 | |
skarra/ASynK | e908a1ad670a2d79f791a6a7539392e078a64add | lib/s/__init__.py | python | loads | (s, encoding=None, cls=None, object_hook=None, parse_float=None,
parse_int=None, parse_constant=None, object_pairs_hook=None,
use_decimal=False, **kw) | return cls(encoding=encoding, **kw).decode(s) | Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON
document) to a Python object.
*encoding* determines the encoding used to interpret any
:class:`str` objects decoded by this instance (``'utf-8'`` by
default). It has no effect when decoding :class:`unicode` objects.
Note that ... | Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON
document) to a Python object. | [
"Deserialize",
"s",
"(",
"a",
"str",
"or",
"unicode",
"instance",
"containing",
"a",
"JSON",
"document",
")",
"to",
"a",
"Python",
"object",
"."
] | def loads(s, encoding=None, cls=None, object_hook=None, parse_float=None,
parse_int=None, parse_constant=None, object_pairs_hook=None,
use_decimal=False, **kw):
"""Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON
document) to a Python object.
*encoding* determines the ... | [
"def",
"loads",
"(",
"s",
",",
"encoding",
"=",
"None",
",",
"cls",
"=",
"None",
",",
"object_hook",
"=",
"None",
",",
"parse_float",
"=",
"None",
",",
"parse_int",
"=",
"None",
",",
"parse_constant",
"=",
"None",
",",
"object_pairs_hook",
"=",
"None",
... | https://github.com/skarra/ASynK/blob/e908a1ad670a2d79f791a6a7539392e078a64add/lib/s/__init__.py#L332-L402 | |
tomplus/kubernetes_asyncio | f028cc793e3a2c519be6a52a49fb77ff0b014c9b | kubernetes_asyncio/client/models/v1_env_from_source.py | python | V1EnvFromSource.__repr__ | (self) | return self.to_str() | For `print` and `pprint` | For `print` and `pprint` | [
"For",
"print",
"and",
"pprint"
] | def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str() | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"self",
".",
"to_str",
"(",
")"
] | https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/models/v1_env_from_source.py#L158-L160 | |
F8LEFT/DecLLVM | d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c | python/idaapi.py | python | get_frame_retsize | (*args) | return _idaapi.get_frame_retsize(*args) | get_frame_retsize(pfn) -> int | get_frame_retsize(pfn) -> int | [
"get_frame_retsize",
"(",
"pfn",
")",
"-",
">",
"int"
] | def get_frame_retsize(*args):
"""
get_frame_retsize(pfn) -> int
"""
return _idaapi.get_frame_retsize(*args) | [
"def",
"get_frame_retsize",
"(",
"*",
"args",
")",
":",
"return",
"_idaapi",
".",
"get_frame_retsize",
"(",
"*",
"args",
")"
] | https://github.com/F8LEFT/DecLLVM/blob/d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c/python/idaapi.py#L27156-L27160 | |
JinpengLI/deep_ocr | 450148c0c51b3565a96ac2f3c94ee33022e55307 | deep_ocr/ocrolib/lstm.py | python | prepare_line | (line,pad=16) | return line | Prepare a line for recognition; this inverts it, transposes
it, and pads it. | Prepare a line for recognition; this inverts it, transposes
it, and pads it. | [
"Prepare",
"a",
"line",
"for",
"recognition",
";",
"this",
"inverts",
"it",
"transposes",
"it",
"and",
"pads",
"it",
"."
] | def prepare_line(line,pad=16):
"""Prepare a line for recognition; this inverts it, transposes
it, and pads it."""
line = line * 1.0/amax(line)
line = amax(line)-line
line = line.T
if pad>0:
w = line.shape[1]
line = vstack([zeros((pad,w)),line,zeros((pad,w))])
return line | [
"def",
"prepare_line",
"(",
"line",
",",
"pad",
"=",
"16",
")",
":",
"line",
"=",
"line",
"*",
"1.0",
"/",
"amax",
"(",
"line",
")",
"line",
"=",
"amax",
"(",
"line",
")",
"-",
"line",
"line",
"=",
"line",
".",
"T",
"if",
"pad",
">",
"0",
":"... | https://github.com/JinpengLI/deep_ocr/blob/450148c0c51b3565a96ac2f3c94ee33022e55307/deep_ocr/ocrolib/lstm.py#L48-L57 | |
buke/GreenOdoo | 3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df | runtime/common/lib/python2.7/site-packages/libxml2.py | python | isDigit | (ch) | return ret | This function is DEPRECATED. Use xmlIsDigit_ch or
xmlIsDigitQ instead | This function is DEPRECATED. Use xmlIsDigit_ch or
xmlIsDigitQ instead | [
"This",
"function",
"is",
"DEPRECATED",
".",
"Use",
"xmlIsDigit_ch",
"or",
"xmlIsDigitQ",
"instead"
] | def isDigit(ch):
"""This function is DEPRECATED. Use xmlIsDigit_ch or
xmlIsDigitQ instead """
ret = libxml2mod.xmlIsDigit(ch)
return ret | [
"def",
"isDigit",
"(",
"ch",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlIsDigit",
"(",
"ch",
")",
"return",
"ret"
] | https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/common/lib/python2.7/site-packages/libxml2.py#L994-L998 | |
Scalsol/mega.pytorch | a6aa6e0537b82d70da94228100a51e6a53d98f82 | mega_core/modeling/roi_heads/keypoint_head/loss.py | python | make_roi_keypoint_loss_evaluator | (cfg) | return loss_evaluator | [] | def make_roi_keypoint_loss_evaluator(cfg):
matcher = Matcher(
cfg.MODEL.ROI_HEADS.FG_IOU_THRESHOLD,
cfg.MODEL.ROI_HEADS.BG_IOU_THRESHOLD,
allow_low_quality_matches=False,
)
fg_bg_sampler = BalancedPositiveNegativeSampler(
cfg.MODEL.ROI_HEADS.BATCH_SIZE_PER_IMAGE, cfg.MODEL.RO... | [
"def",
"make_roi_keypoint_loss_evaluator",
"(",
"cfg",
")",
":",
"matcher",
"=",
"Matcher",
"(",
"cfg",
".",
"MODEL",
".",
"ROI_HEADS",
".",
"FG_IOU_THRESHOLD",
",",
"cfg",
".",
"MODEL",
".",
"ROI_HEADS",
".",
"BG_IOU_THRESHOLD",
",",
"allow_low_quality_matches",
... | https://github.com/Scalsol/mega.pytorch/blob/a6aa6e0537b82d70da94228100a51e6a53d98f82/mega_core/modeling/roi_heads/keypoint_head/loss.py#L172-L183 | |||
s-leger/archipack | 5a6243bf1edf08a6b429661ce291dacb551e5f8a | pygeos/algorithms.py | python | LineIntersector._isInteriorIntersection | (self, inputLineIndex) | return False | * Tests whether either intersection point is an interiors point
* of the specified input segment.
*
* @return true if either intersection point is in
* the interiors of the input segment | * Tests whether either intersection point is an interiors point
* of the specified input segment.
*
* | [
"*",
"Tests",
"whether",
"either",
"intersection",
"point",
"is",
"an",
"interiors",
"point",
"*",
"of",
"the",
"specified",
"input",
"segment",
".",
"*",
"*"
] | def _isInteriorIntersection(self, inputLineIndex):
"""
* Tests whether either intersection point is an interiors point
* of the specified input segment.
*
* @return true if either intersection point is in
* the interiors of the input segment
"""
for i... | [
"def",
"_isInteriorIntersection",
"(",
"self",
",",
"inputLineIndex",
")",
":",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"intersections",
")",
":",
"if",
"not",
"(",
"(",
"self",
".",
"intersectionPts",
"[",
"i",
"]",
"==",
"self",
".",
"_inputLines"... | https://github.com/s-leger/archipack/blob/5a6243bf1edf08a6b429661ce291dacb551e5f8a/pygeos/algorithms.py#L1880-L1892 | |
midgetspy/Sick-Beard | 171a607e41b7347a74cc815f6ecce7968d9acccf | 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/midgetspy/Sick-Beard/blob/171a607e41b7347a74cc815f6ecce7968d9acccf/cherrypy/wsgiserver/ssl_pyopenssl.py#L174-L176 | |
python/mypy | 17850b3bd77ae9efb5d21f656c4e4e05ac48d894 | mypy/modulefinder.py | python | filter_redundant_py2_dirs | (dirs: List[str]) | return result | If dirs has <dir>/@python2 followed by <dir>, filter out the latter. | If dirs has <dir>/ | [
"If",
"dirs",
"has",
"<dir",
">",
"/"
] | def filter_redundant_py2_dirs(dirs: List[str]) -> List[str]:
"""If dirs has <dir>/@python2 followed by <dir>, filter out the latter."""
if len(dirs) <= 1 or not any(d.endswith(PYTHON2_STUB_DIR) for d in dirs):
# Fast path -- nothing to do
return dirs
seen = []
result = []
for d in di... | [
"def",
"filter_redundant_py2_dirs",
"(",
"dirs",
":",
"List",
"[",
"str",
"]",
")",
"->",
"List",
"[",
"str",
"]",
":",
"if",
"len",
"(",
"dirs",
")",
"<=",
"1",
"or",
"not",
"any",
"(",
"d",
".",
"endswith",
"(",
"PYTHON2_STUB_DIR",
")",
"for",
"d... | https://github.com/python/mypy/blob/17850b3bd77ae9efb5d21f656c4e4e05ac48d894/mypy/modulefinder.py#L861-L874 | |
google/rekall | 55d1925f2df9759a989b35271b4fa48fc54a1c86 | rekall-core/rekall/obj.py | python | Profile.legacy_field_descriptor | (self, typeList) | return dict(target=target, target_args=target_args) | Converts the list expression into a target, target_args notation.
Legacy vtypes use lists to specify the objects. This function is used to
convert from the legacy format to the more accurate modern
format. Hopefully the legacy format can be deprecated at some point.
Args:
ty... | Converts the list expression into a target, target_args notation. | [
"Converts",
"the",
"list",
"expression",
"into",
"a",
"target",
"target_args",
"notation",
"."
] | def legacy_field_descriptor(self, typeList):
"""Converts the list expression into a target, target_args notation.
Legacy vtypes use lists to specify the objects. This function is used to
convert from the legacy format to the more accurate modern
format. Hopefully the legacy format can b... | [
"def",
"legacy_field_descriptor",
"(",
"self",
",",
"typeList",
")",
":",
"# This is of the form [ '_HMAP_TABLE' ] - First element is the target",
"# name, with no args.",
"if",
"len",
"(",
"typeList",
")",
"==",
"1",
":",
"target",
"=",
"typeList",
"[",
"0",
"]",
"ta... | https://github.com/google/rekall/blob/55d1925f2df9759a989b35271b4fa48fc54a1c86/rekall-core/rekall/obj.py#L2135-L2176 | |
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/ses/v20201002/models.py | python | UpdateEmailTemplateResponse.__init__ | (self) | r"""
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str | r"""
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str | [
"r",
":",
"param",
"RequestId",
":",
"唯一请求",
"ID,每次请求都会返回。定位问题时需要提供该次请求的",
"RequestId。",
":",
"type",
"RequestId",
":",
"str"
] | def __init__(self):
r"""
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.RequestId = None | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"RequestId",
"=",
"None"
] | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/ses/v20201002/models.py#L1479-L1484 | ||
mdiazcl/fuzzbunch-debian | 2b76c2249ade83a389ae3badb12a1bd09901fd2c | windows/Resources/Python/Core/Lib/DocXMLRPCServer.py | python | ServerHTMLDoc.docroutine | (self, object, name, mod=None, funcs={}, classes={}, methods={}, cl=None) | return '<dl><dt>%s</dt>%s</dl>\n' % (decl, doc) | Produce HTML documentation for a function or method object. | Produce HTML documentation for a function or method object. | [
"Produce",
"HTML",
"documentation",
"for",
"a",
"function",
"or",
"method",
"object",
"."
] | def docroutine(self, object, name, mod=None, funcs={}, classes={}, methods={}, cl=None):
"""Produce HTML documentation for a function or method object."""
anchor = (cl and cl.__name__ or '') + '-' + name
note = ''
title = '<a name="%s"><strong>%s</strong></a>' % (
self.escape(an... | [
"def",
"docroutine",
"(",
"self",
",",
"object",
",",
"name",
",",
"mod",
"=",
"None",
",",
"funcs",
"=",
"{",
"}",
",",
"classes",
"=",
"{",
"}",
",",
"methods",
"=",
"{",
"}",
",",
"cl",
"=",
"None",
")",
":",
"anchor",
"=",
"(",
"cl",
"and... | https://github.com/mdiazcl/fuzzbunch-debian/blob/2b76c2249ade83a389ae3badb12a1bd09901fd2c/windows/Resources/Python/Core/Lib/DocXMLRPCServer.py#L60-L82 | |
aws/aws-cli | d697e0ed79fca0f853ce53efe1f83ee41a478134 | awscli/customizations/utils.py | python | create_client_from_parsed_globals | (session, service_name, parsed_globals,
overrides=None) | return session.create_client(service_name, **client_args) | Creates a service client, taking parsed_globals into account
Any values specified in overrides will override the returned dict. Note
that this override occurs after 'region' from parsed_globals has been
translated into 'region_name' in the resulting dict. | Creates a service client, taking parsed_globals into account | [
"Creates",
"a",
"service",
"client",
"taking",
"parsed_globals",
"into",
"account"
] | def create_client_from_parsed_globals(session, service_name, parsed_globals,
overrides=None):
"""Creates a service client, taking parsed_globals into account
Any values specified in overrides will override the returned dict. Note
that this override occurs after 'region... | [
"def",
"create_client_from_parsed_globals",
"(",
"session",
",",
"service_name",
",",
"parsed_globals",
",",
"overrides",
"=",
"None",
")",
":",
"client_args",
"=",
"{",
"}",
"if",
"'region'",
"in",
"parsed_globals",
":",
"client_args",
"[",
"'region_name'",
"]",
... | https://github.com/aws/aws-cli/blob/d697e0ed79fca0f853ce53efe1f83ee41a478134/awscli/customizations/utils.py#L158-L175 | |
ucsb-seclab/karonte | 427ac313e596f723e40768b95d13bd7a9fc92fd8 | eval/multi_bin/network-facing/taint_analysis/coretaint.py | python | CoreTaint._set_fake_ret_succ | (self, path, state, addr, ret) | return path.copy(
stashes={'active': [new_s], 'unsat': [], 'pruned': [], 'unconstrained': [], 'deadended': []}) | Create a fake ret successors of a given path.
:param path: current path
:param: state: state to set in the new succ
:param addr: address where the fake ret block will return
:param ret: return of the current function
:return: angr path | Create a fake ret successors of a given path.
:param path: current path
:param: state: state to set in the new succ
:param addr: address where the fake ret block will return
:param ret: return of the current function
:return: angr path | [
"Create",
"a",
"fake",
"ret",
"successors",
"of",
"a",
"given",
"path",
".",
":",
"param",
"path",
":",
"current",
"path",
":",
"param",
":",
"state",
":",
"state",
"to",
"set",
"in",
"the",
"new",
"succ",
":",
"param",
"addr",
":",
"address",
"where... | def _set_fake_ret_succ(self, path, state, addr, ret):
"""
Create a fake ret successors of a given path.
:param path: current path
:param: state: state to set in the new succ
:param addr: address where the fake ret block will return
:param ret: return of the current functi... | [
"def",
"_set_fake_ret_succ",
"(",
"self",
",",
"path",
",",
"state",
",",
"addr",
",",
"ret",
")",
":",
"new_s",
"=",
"state",
".",
"copy",
"(",
")",
"new_s",
".",
"history",
".",
"jumpkind",
"=",
"\"Ijk_FakeRet\"",
"# check whether any of the function paramet... | https://github.com/ucsb-seclab/karonte/blob/427ac313e596f723e40768b95d13bd7a9fc92fd8/eval/multi_bin/network-facing/taint_analysis/coretaint.py#L793-L848 | |
timkpaine/pyEX | 254acd2b0cf7cb7183100106f4ecc11d1860c46a | pyEX/streaming/sse.py | python | iexOpHaltStatusSSEAsync | (
symbols=None, exit=None, nosnapshot=False, token="", version="stable"
) | The Exchange may suspend trading of one or more securities on IEX for operational reasons and indicates such operational halt using the Operational halt status message.
IEX disseminates a full pre-market spin of Operational halt status messages indicating the operational halt status of all securities.
In the s... | The Exchange may suspend trading of one or more securities on IEX for operational reasons and indicates such operational halt using the Operational halt status message. | [
"The",
"Exchange",
"may",
"suspend",
"trading",
"of",
"one",
"or",
"more",
"securities",
"on",
"IEX",
"for",
"operational",
"reasons",
"and",
"indicates",
"such",
"operational",
"halt",
"using",
"the",
"Operational",
"halt",
"status",
"message",
"."
] | async def iexOpHaltStatusSSEAsync(
symbols=None, exit=None, nosnapshot=False, token="", version="stable"
):
"""The Exchange may suspend trading of one or more securities on IEX for operational reasons and indicates such operational halt using the Operational halt status message.
IEX disseminates a full pre... | [
"async",
"def",
"iexOpHaltStatusSSEAsync",
"(",
"symbols",
"=",
"None",
",",
"exit",
"=",
"None",
",",
"nosnapshot",
"=",
"False",
",",
"token",
"=",
"\"\"",
",",
"version",
"=",
"\"stable\"",
")",
":",
"async",
"for",
"item",
"in",
"_runSSEAsync",
"(",
... | https://github.com/timkpaine/pyEX/blob/254acd2b0cf7cb7183100106f4ecc11d1860c46a/pyEX/streaming/sse.py#L578-L606 | ||
OpenEndedGroup/Field | 4f7c8edfb01bb0ccc927b78d3c500f018a4ae37c | Contents/lib/python/logging/__init__.py | python | addLevelName | (level, levelName) | Associate 'levelName' with 'level'.
This is used when converting levels to text during message formatting. | Associate 'levelName' with 'level'. | [
"Associate",
"levelName",
"with",
"level",
"."
] | def addLevelName(level, levelName):
"""
Associate 'levelName' with 'level'.
This is used when converting levels to text during message formatting.
"""
_acquireLock()
try: #unlikely to cause an exception, but you never know...
_levelNames[level] = levelName
_levelNames[levelNa... | [
"def",
"addLevelName",
"(",
"level",
",",
"levelName",
")",
":",
"_acquireLock",
"(",
")",
"try",
":",
"#unlikely to cause an exception, but you never know...",
"_levelNames",
"[",
"level",
"]",
"=",
"levelName",
"_levelNames",
"[",
"levelName",
"]",
"=",
"level",
... | https://github.com/OpenEndedGroup/Field/blob/4f7c8edfb01bb0ccc927b78d3c500f018a4ae37c/Contents/lib/python/logging/__init__.py#L154-L165 | ||
harvard-lil/capstone | f15c98fce0b50b74616c40f862146d858b54be5d | capstone/capapi/filters.py | python | CAPFacetedSearchFilterBackend.aggregate | (self, request, queryset, view) | return queryset | Generate field aggregations. Supports 3 parallel aggs and 2 sub-aggregations | Generate field aggregations. Supports 3 parallel aggs and 2 sub-aggregations | [
"Generate",
"field",
"aggregations",
".",
"Supports",
"3",
"parallel",
"aggs",
"and",
"2",
"sub",
"-",
"aggregations"
] | def aggregate(self, request, queryset, view):
"""
Generate field aggregations. Supports 3 parallel aggs and 2 sub-aggregations
"""
# If cursor is attached, don't aggregate
query_params = request.query_params.copy()
if query_params.getlist('cursor', []):
retur... | [
"def",
"aggregate",
"(",
"self",
",",
"request",
",",
"queryset",
",",
"view",
")",
":",
"# If cursor is attached, don't aggregate",
"query_params",
"=",
"request",
".",
"query_params",
".",
"copy",
"(",
")",
"if",
"query_params",
".",
"getlist",
"(",
"'cursor'"... | https://github.com/harvard-lil/capstone/blob/f15c98fce0b50b74616c40f862146d858b54be5d/capstone/capapi/filters.py#L667-L714 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/knots/knotinfo.py | python | KnotInfoBase.kauffman_polynomial | (self, var1='a', var2='z', original=False) | return R(eval_knotinfo(kauffman_polynomial, locals=lc)) | r"""
Return the Kauffman polynomial according to the value of column
``kauffman_polynomial`` for this knot or link as an instance of
:class:`~sage.rings.polynomial.laurent_polynomial.LaurentPolynomial_mpair`.
The Kauffman polynomial `F(L)` respectivlely its corresponding invariant
... | r"""
Return the Kauffman polynomial according to the value of column
``kauffman_polynomial`` for this knot or link as an instance of
:class:`~sage.rings.polynomial.laurent_polynomial.LaurentPolynomial_mpair`. | [
"r",
"Return",
"the",
"Kauffman",
"polynomial",
"according",
"to",
"the",
"value",
"of",
"column",
"kauffman_polynomial",
"for",
"this",
"knot",
"or",
"link",
"as",
"an",
"instance",
"of",
":",
"class",
":",
"~sage",
".",
"rings",
".",
"polynomial",
".",
"... | def kauffman_polynomial(self, var1='a', var2='z', original=False):
r"""
Return the Kauffman polynomial according to the value of column
``kauffman_polynomial`` for this knot or link as an instance of
:class:`~sage.rings.polynomial.laurent_polynomial.LaurentPolynomial_mpair`.
The... | [
"def",
"kauffman_polynomial",
"(",
"self",
",",
"var1",
"=",
"'a'",
",",
"var2",
"=",
"'z'",
",",
"original",
"=",
"False",
")",
":",
"kauffman_polynomial",
"=",
"self",
"[",
"self",
".",
"items",
".",
"kauffman_polynomial",
"]",
"if",
"original",
":",
"... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/knots/knotinfo.py#L1250-L1330 | |
wkentaro/labelme | 6ccebff3175b9dbe088c7208ac3784c390b2f679 | labelme/widgets/canvas.py | python | Canvas.selectShapePoint | (self, point, multiple_selection_mode) | Select the first shape created which contains this point. | Select the first shape created which contains this point. | [
"Select",
"the",
"first",
"shape",
"created",
"which",
"contains",
"this",
"point",
"."
] | def selectShapePoint(self, point, multiple_selection_mode):
"""Select the first shape created which contains this point."""
if self.selectedVertex(): # A vertex is marked for selection.
index, shape = self.hVertex, self.hShape
shape.highlightVertex(index, shape.MOVE_VERTEX)
... | [
"def",
"selectShapePoint",
"(",
"self",
",",
"point",
",",
"multiple_selection_mode",
")",
":",
"if",
"self",
".",
"selectedVertex",
"(",
")",
":",
"# A vertex is marked for selection.",
"index",
",",
"shape",
"=",
"self",
".",
"hVertex",
",",
"self",
".",
"hS... | https://github.com/wkentaro/labelme/blob/6ccebff3175b9dbe088c7208ac3784c390b2f679/labelme/widgets/canvas.py#L487-L508 | ||
flasgger/flasgger | beb9fa781fc6b063fe3f3081b9677dd70184a2da | flasgger/utils.py | python | get_specs | (rules, ignore_verbs, optional_fields, sanitizer,
openapi_version, doc_dir=None) | return specs | [] | def get_specs(rules, ignore_verbs, optional_fields, sanitizer,
openapi_version, doc_dir=None):
specs = []
for rule in rules:
endpoint = current_app.view_functions[rule.endpoint]
methods = dict()
is_mv = is_valid_method_view(endpoint)
for verb in rule.methods.diffe... | [
"def",
"get_specs",
"(",
"rules",
",",
"ignore_verbs",
",",
"optional_fields",
",",
"sanitizer",
",",
"openapi_version",
",",
"doc_dir",
"=",
"None",
")",
":",
"specs",
"=",
"[",
"]",
"for",
"rule",
"in",
"rules",
":",
"endpoint",
"=",
"current_app",
".",
... | https://github.com/flasgger/flasgger/blob/beb9fa781fc6b063fe3f3081b9677dd70184a2da/flasgger/utils.py#L77-L204 | |||
CGATOxford/cgat | 326aad4694bdfae8ddc194171bb5d73911243947 | obsolete/pipeline_metagenomecommunities.py | python | connect | () | return dbh | connect to database.
This method also attaches to helper databases. | connect to database. | [
"connect",
"to",
"database",
"."
] | def connect():
'''connect to database.
This method also attaches to helper databases.
'''
dbh = sqlite3.connect(PARAMS["database"])
return dbh | [
"def",
"connect",
"(",
")",
":",
"dbh",
"=",
"sqlite3",
".",
"connect",
"(",
"PARAMS",
"[",
"\"database\"",
"]",
")",
"return",
"dbh"
] | https://github.com/CGATOxford/cgat/blob/326aad4694bdfae8ddc194171bb5d73911243947/obsolete/pipeline_metagenomecommunities.py#L208-L214 | |
NVlabs/stylegan2 | bf0fe0baba9fc7039eae0cac575c1778be1ce3e3 | dnnlib/tflib/tfutil.py | python | _sanitize_tf_config | (config_dict: dict = None) | return cfg | [] | def _sanitize_tf_config(config_dict: dict = None) -> dict:
# Defaults.
cfg = dict()
cfg["rnd.np_random_seed"] = None # Random seed for NumPy. None = keep as is.
cfg["rnd.tf_random_seed"] = "auto" # Random seed for TensorFlow. 'auto' = derive from NumPy random state. N... | [
"def",
"_sanitize_tf_config",
"(",
"config_dict",
":",
"dict",
"=",
"None",
")",
"->",
"dict",
":",
"# Defaults.",
"cfg",
"=",
"dict",
"(",
")",
"cfg",
"[",
"\"rnd.np_random_seed\"",
"]",
"=",
"None",
"# Random seed for NumPy. None = keep as is.",
"cfg",
"[",
"\... | https://github.com/NVlabs/stylegan2/blob/bf0fe0baba9fc7039eae0cac575c1778be1ce3e3/dnnlib/tflib/tfutil.py#L84-L104 | |||
josw123/dart-fss | 816d0fc6002aefb61912d5871af0438a6e1e7c99 | dart_fss/fs/fs.py | python | FinancialStatement.to_dict | (self) | return info | FinancialStatement의 요약 정보를 Dictionary 로 반환 | FinancialStatement의 요약 정보를 Dictionary 로 반환 | [
"FinancialStatement의",
"요약",
"정보를",
"Dictionary",
"로",
"반환"
] | def to_dict(self) -> Dict[str, str]:
""" FinancialStatement의 요약 정보를 Dictionary 로 반환"""
info = self.info
df_info = []
for tp in self._order:
df = self._statements.get(tp)
if df is not None:
df_info.append({'title': df.columns.tolist()[0][0]})
... | [
"def",
"to_dict",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"str",
"]",
":",
"info",
"=",
"self",
".",
"info",
"df_info",
"=",
"[",
"]",
"for",
"tp",
"in",
"self",
".",
"_order",
":",
"df",
"=",
"self",
".",
"_statements",
".",
"get",
"(... | https://github.com/josw123/dart-fss/blob/816d0fc6002aefb61912d5871af0438a6e1e7c99/dart_fss/fs/fs.py#L116-L127 | |
yinhm/datafeed | 62193278212c2441d8e49b45d71b8d9d79aab31c | datafeed/datastore.py | python | Minute.__len__ | (self) | return len(self.keys()) | [] | def __len__(self):
return len(self.keys()) | [
"def",
"__len__",
"(",
"self",
")",
":",
"return",
"len",
"(",
"self",
".",
"keys",
"(",
")",
")"
] | https://github.com/yinhm/datafeed/blob/62193278212c2441d8e49b45d71b8d9d79aab31c/datafeed/datastore.py#L776-L777 | |||
largelymfs/topical_word_embeddings | 1ae3d15d0afcd3fcd39cc81eec4ad9463413a9f6 | TWE-1/gensim/utils.py | python | is_corpus | (obj) | return True, obj | Check whether `obj` is a corpus. Return (is_corpus, new) 2-tuple, where
`new is obj` if `obj` was an iterable, or `new` yields the same sequence as
`obj` if it was an iterator.
`obj` is a corpus if it supports iteration over documents, where a document
is in turn anything that acts as a sequence of 2-t... | Check whether `obj` is a corpus. Return (is_corpus, new) 2-tuple, where
`new is obj` if `obj` was an iterable, or `new` yields the same sequence as
`obj` if it was an iterator. | [
"Check",
"whether",
"obj",
"is",
"a",
"corpus",
".",
"Return",
"(",
"is_corpus",
"new",
")",
"2",
"-",
"tuple",
"where",
"new",
"is",
"obj",
"if",
"obj",
"was",
"an",
"iterable",
"or",
"new",
"yields",
"the",
"same",
"sequence",
"as",
"obj",
"if",
"i... | def is_corpus(obj):
"""
Check whether `obj` is a corpus. Return (is_corpus, new) 2-tuple, where
`new is obj` if `obj` was an iterable, or `new` yields the same sequence as
`obj` if it was an iterator.
`obj` is a corpus if it supports iteration over documents, where a document
is in turn anythin... | [
"def",
"is_corpus",
"(",
"obj",
")",
":",
"try",
":",
"if",
"'Corpus'",
"in",
"obj",
".",
"__class__",
".",
"__name__",
":",
"# the most common case, quick hack",
"return",
"True",
",",
"obj",
"except",
":",
"pass",
"try",
":",
"if",
"hasattr",
"(",
"obj",... | https://github.com/largelymfs/topical_word_embeddings/blob/1ae3d15d0afcd3fcd39cc81eec4ad9463413a9f6/TWE-1/gensim/utils.py#L376-L409 | |
qutebrowser/qutebrowser | 3a2aaaacbf97f4bf0c72463f3da94ed2822a5442 | qutebrowser/utils/qtutils.py | python | interpolate_color | (
start: QColor,
end: QColor,
percent: int,
colorspace: Optional[QColor.Spec] = QColor.Rgb
) | return out | Get an interpolated color value.
Args:
start: The start color.
end: The end color.
percent: Which value to get (0 - 100)
colorspace: The desired interpolation color system,
QColor::{Rgb,Hsv,Hsl} (from QColor::Spec enum)
If None, start is used ... | Get an interpolated color value. | [
"Get",
"an",
"interpolated",
"color",
"value",
"."
] | def interpolate_color(
start: QColor,
end: QColor,
percent: int,
colorspace: Optional[QColor.Spec] = QColor.Rgb
) -> QColor:
"""Get an interpolated color value.
Args:
start: The start color.
end: The end color.
percent: Which value to get (0 - 100)
... | [
"def",
"interpolate_color",
"(",
"start",
":",
"QColor",
",",
"end",
":",
"QColor",
",",
"percent",
":",
"int",
",",
"colorspace",
":",
"Optional",
"[",
"QColor",
".",
"Spec",
"]",
"=",
"QColor",
".",
"Rgb",
")",
"->",
"QColor",
":",
"ensure_valid",
"(... | https://github.com/qutebrowser/qutebrowser/blob/3a2aaaacbf97f4bf0c72463f3da94ed2822a5442/qutebrowser/utils/qtutils.py#L502-L550 | |
svpcom/wifibroadcast | 51251b8c484b8c4f548aa3bbb1633e0edbb605dc | telemetry/mavlink.py | python | MAVLink.mag_cal_progress_send | (self, compass_id, cal_mask, cal_status, attempt, completion_pct, completion_mask, direction_x, direction_y, direction_z, force_mavlink1=False) | return self.send(self.mag_cal_progress_encode(compass_id, cal_mask, cal_status, attempt, completion_pct, completion_mask, direction_x, direction_y, direction_z), force_mavlink1=force_mavlink1) | Reports progress of compass calibration.
compass_id : Compass being calibrated. (type:uint8_t)
cal_mask : Bitmask of compasses being calibrated. (type:uint8_t)
cal_status : Calibration Status. (type:uint8_t, values:MAG_CAL_S... | Reports progress of compass calibration. | [
"Reports",
"progress",
"of",
"compass",
"calibration",
"."
] | def mag_cal_progress_send(self, compass_id, cal_mask, cal_status, attempt, completion_pct, completion_mask, direction_x, direction_y, direction_z, force_mavlink1=False):
'''
Reports progress of compass calibration.
compass_id : Compass being calibrated. (t... | [
"def",
"mag_cal_progress_send",
"(",
"self",
",",
"compass_id",
",",
"cal_mask",
",",
"cal_status",
",",
"attempt",
",",
"completion_pct",
",",
"completion_mask",
",",
"direction_x",
",",
"direction_y",
",",
"direction_z",
",",
"force_mavlink1",
"=",
"False",
")",... | https://github.com/svpcom/wifibroadcast/blob/51251b8c484b8c4f548aa3bbb1633e0edbb605dc/telemetry/mavlink.py#L21290-L21305 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | scripts/monitoring/cron-send-saml-status.py | python | curl | (url) | return 0 | Test URL, return http code | Test URL, return http code | [
"Test",
"URL",
"return",
"http",
"code"
] | def curl(url):
""" Test URL, return http code """
try:
return urllib2.urlopen(url, timeout=30).getcode()
except urllib2.HTTPError as e:
return e.fp.getcode()
except Exception:
logger.exception("unknown error")
return 0 | [
"def",
"curl",
"(",
"url",
")",
":",
"try",
":",
"return",
"urllib2",
".",
"urlopen",
"(",
"url",
",",
"timeout",
"=",
"30",
")",
".",
"getcode",
"(",
")",
"except",
"urllib2",
".",
"HTTPError",
"as",
"e",
":",
"return",
"e",
".",
"fp",
".",
"get... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/scripts/monitoring/cron-send-saml-status.py#L74-L83 | |
pytroll/satpy | 09e51f932048f98cce7919a4ff8bd2ec01e1ae98 | satpy/dataset/metadata.py | python | _is_array | (val) | return hasattr(val, "__array__") and not np.isscalar(val) | Check if val is an array. | Check if val is an array. | [
"Check",
"if",
"val",
"is",
"an",
"array",
"."
] | def _is_array(val):
"""Check if val is an array."""
return hasattr(val, "__array__") and not np.isscalar(val) | [
"def",
"_is_array",
"(",
"val",
")",
":",
"return",
"hasattr",
"(",
"val",
",",
"\"__array__\"",
")",
"and",
"not",
"np",
".",
"isscalar",
"(",
"val",
")"
] | https://github.com/pytroll/satpy/blob/09e51f932048f98cce7919a4ff8bd2ec01e1ae98/satpy/dataset/metadata.py#L132-L134 | |
terrencepreilly/darglint | abc26b768cd7135d848223ba53f68323593c33d5 | darglint/errors.py | python | ExcessVariableError.__init__ | (self, function, name, line_numbers=None) | Instantiate the error's message.
Args:
function: The ast node for the function.
name: The name of the variable which is in excess.
line_numbers: The first and last line numbers where this
error occurs. | Instantiate the error's message. | [
"Instantiate",
"the",
"error",
"s",
"message",
"."
] | def __init__(self, function, name, line_numbers=None):
# type: (Union[ast.FunctionDef, ast.AsyncFunctionDef], str, Tuple[int, int]) -> None
"""Instantiate the error's message.
Args:
function: The ast node for the function.
name: The name of the variable which is in exces... | [
"def",
"__init__",
"(",
"self",
",",
"function",
",",
"name",
",",
"line_numbers",
"=",
"None",
")",
":",
"# type: (Union[ast.FunctionDef, ast.AsyncFunctionDef], str, Tuple[int, int]) -> None",
"self",
".",
"general_message",
"=",
"'Excess variable description.'",
"self",
"... | https://github.com/terrencepreilly/darglint/blob/abc26b768cd7135d848223ba53f68323593c33d5/darglint/errors.py#L572-L589 | ||
hardbyte/python-can | e7a2b040ee1f0cdd7fd77fbfef0454353166b333 | can/interfaces/ics_neovi/neovi_bus.py | python | ICSApiError.__init__ | (
self,
error_code: int,
description_short: str,
description_long: str,
severity: int,
restart_needed: int,
) | [] | def __init__(
self,
error_code: int,
description_short: str,
description_long: str,
severity: int,
restart_needed: int,
):
super().__init__(f"{description_short}. {description_long}", error_code)
self.description_short = description_short
self.... | [
"def",
"__init__",
"(",
"self",
",",
"error_code",
":",
"int",
",",
"description_short",
":",
"str",
",",
"description_long",
":",
"str",
",",
"severity",
":",
"int",
",",
"restart_needed",
":",
"int",
",",
")",
":",
"super",
"(",
")",
".",
"__init__",
... | https://github.com/hardbyte/python-can/blob/e7a2b040ee1f0cdd7fd77fbfef0454353166b333/can/interfaces/ics_neovi/neovi_bus.py#L84-L96 | ||||
spotify/luigi | c3b66f4a5fa7eaa52f9a72eb6704b1049035c789 | luigi/contrib/sge.py | python | _parse_qsub_job_id | (qsub_out) | return int(qsub_out.split()[2]) | Parse job id from qsub output string.
Assume format:
"Your job <job_id> ("<job_name>") has been submitted" | Parse job id from qsub output string. | [
"Parse",
"job",
"id",
"from",
"qsub",
"output",
"string",
"."
] | def _parse_qsub_job_id(qsub_out):
"""Parse job id from qsub output string.
Assume format:
"Your job <job_id> ("<job_name>") has been submitted"
"""
return int(qsub_out.split()[2]) | [
"def",
"_parse_qsub_job_id",
"(",
"qsub_out",
")",
":",
"return",
"int",
"(",
"qsub_out",
".",
"split",
"(",
")",
"[",
"2",
"]",
")"
] | https://github.com/spotify/luigi/blob/c3b66f4a5fa7eaa52f9a72eb6704b1049035c789/luigi/contrib/sge.py#L131-L139 | |
exaile/exaile | a7b58996c5c15b3aa7b9975ac13ee8f784ef4689 | xlgui/main.py | python | MainWindow._setup_hotkeys | (self) | Sets up accelerators that haven't been set up in UI designer | Sets up accelerators that haven't been set up in UI designer | [
"Sets",
"up",
"accelerators",
"that",
"haven",
"t",
"been",
"set",
"up",
"in",
"UI",
"designer"
] | def _setup_hotkeys(self):
"""
Sets up accelerators that haven't been set up in UI designer
"""
def factory(integer, description):
"""Generate key bindings for Alt keys"""
keybinding = '<Alt>%s' % str(integer)
callback = lambda *_e: self._on_focus_play... | [
"def",
"_setup_hotkeys",
"(",
"self",
")",
":",
"def",
"factory",
"(",
"integer",
",",
"description",
")",
":",
"\"\"\"Generate key bindings for Alt keys\"\"\"",
"keybinding",
"=",
"'<Alt>%s'",
"%",
"str",
"(",
"integer",
")",
"callback",
"=",
"lambda",
"*",
"_e... | https://github.com/exaile/exaile/blob/a7b58996c5c15b3aa7b9975ac13ee8f784ef4689/xlgui/main.py#L134-L241 | ||
metabrainz/picard | 535bf8c7d9363ffc7abb3f69418ec11823c38118 | picard/ui/scripteditor.py | python | ScriptDetailsEditor.__init__ | (self, parent, script_item) | Script metadata viewer / editor.
Args:
parent (ScriptEditorDialog): The page used for editing the scripts
script_item (dict): The script whose metadata is displayed | Script metadata viewer / editor. | [
"Script",
"metadata",
"viewer",
"/",
"editor",
"."
] | def __init__(self, parent, script_item):
"""Script metadata viewer / editor.
Args:
parent (ScriptEditorDialog): The page used for editing the scripts
script_item (dict): The script whose metadata is displayed
"""
super().__init__(parent=parent)
self.scrip... | [
"def",
"__init__",
"(",
"self",
",",
"parent",
",",
"script_item",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"parent",
"=",
"parent",
")",
"self",
".",
"script_item",
"=",
"script_item",
"self",
".",
"readonly",
"=",
"script_item",
"[",
"\"reado... | https://github.com/metabrainz/picard/blob/535bf8c7d9363ffc7abb3f69418ec11823c38118/picard/ui/scripteditor.py#L1311-L1350 | ||
jython/jython3 | def4f8ec47cb7a9c799ea4c745f12badf92c5769 | lib-python/3.5.1/tkinter/__init__.py | python | Canvas.create_rectangle | (self, *args, **kw) | return self._create('rectangle', args, kw) | Create rectangle with coordinates x1,y1,x2,y2. | Create rectangle with coordinates x1,y1,x2,y2. | [
"Create",
"rectangle",
"with",
"coordinates",
"x1",
"y1",
"x2",
"y2",
"."
] | def create_rectangle(self, *args, **kw):
"""Create rectangle with coordinates x1,y1,x2,y2."""
return self._create('rectangle', args, kw) | [
"def",
"create_rectangle",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"return",
"self",
".",
"_create",
"(",
"'rectangle'",
",",
"args",
",",
"kw",
")"
] | https://github.com/jython/jython3/blob/def4f8ec47cb7a9c799ea4c745f12badf92c5769/lib-python/3.5.1/tkinter/__init__.py#L2338-L2340 | |
golismero/golismero | 7d605b937e241f51c1ca4f47b20f755eeefb9d76 | golismero/api/data/information/portscan.py | python | Portscan.open_udp_ports | (self) | return ports | :returns: Open UDP ports.
:rtype: list(int) | :returns: Open UDP ports.
:rtype: list(int) | [
":",
"returns",
":",
"Open",
"UDP",
"ports",
".",
":",
"rtype",
":",
"list",
"(",
"int",
")"
] | def open_udp_ports(self):
"""
:returns: Open UDP ports.
:rtype: list(int)
"""
ports = [
port for state, protocol, port in self.ports
if state == "OPEN" and protocol == "UDP"
]
ports.sort()
return ports | [
"def",
"open_udp_ports",
"(",
"self",
")",
":",
"ports",
"=",
"[",
"port",
"for",
"state",
",",
"protocol",
",",
"port",
"in",
"self",
".",
"ports",
"if",
"state",
"==",
"\"OPEN\"",
"and",
"protocol",
"==",
"\"UDP\"",
"]",
"ports",
".",
"sort",
"(",
... | https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/golismero/api/data/information/portscan.py#L187-L197 | |
MegEngine/Models | 4c55d28bad03652a4e352bf5e736a75df041d84a | official/vision/gan/megengine_mimicry/nets/losses.py | python | ns_loss_gen | (output_fake) | return -F.log(output_fake + 1e-8).mean() | r"""
Non-saturating loss for generator.
Args:
output_fake (Tensor): Discriminator output logits for fake images.
Returns:
Tensor: A scalar tensor loss output. | r"""
Non-saturating loss for generator. | [
"r",
"Non",
"-",
"saturating",
"loss",
"for",
"generator",
"."
] | def ns_loss_gen(output_fake):
r"""
Non-saturating loss for generator.
Args:
output_fake (Tensor): Discriminator output logits for fake images.
Returns:
Tensor: A scalar tensor loss output.
"""
output_fake = F.sigmoid(output_fake)
return -F.log(output_fake + 1e-8).mean() | [
"def",
"ns_loss_gen",
"(",
"output_fake",
")",
":",
"output_fake",
"=",
"F",
".",
"sigmoid",
"(",
"output_fake",
")",
"return",
"-",
"F",
".",
"log",
"(",
"output_fake",
"+",
"1e-8",
")",
".",
"mean",
"(",
")"
] | https://github.com/MegEngine/Models/blob/4c55d28bad03652a4e352bf5e736a75df041d84a/official/vision/gan/megengine_mimicry/nets/losses.py#L20-L32 | |
kivy/python-for-android | 4ecaa5fe01aa25e3bc8cadc52ae481645754f955 | pythonforandroid/recipes/android/src/android/storage.py | python | _get_sdcard_path | () | return (
Environment.getExternalStorageDirectory().getAbsolutePath()
) | Internal function to return getExternalStorageDirectory()
path. This is internal because it may either return the internal,
or an external sd card, depending on the device.
Use primary_external_storage_path()
or secondary_external_storage_path() instead which try to
distinguish t... | Internal function to return getExternalStorageDirectory()
path. This is internal because it may either return the internal,
or an external sd card, depending on the device.
Use primary_external_storage_path()
or secondary_external_storage_path() instead which try to
distinguish t... | [
"Internal",
"function",
"to",
"return",
"getExternalStorageDirectory",
"()",
"path",
".",
"This",
"is",
"internal",
"because",
"it",
"may",
"either",
"return",
"the",
"internal",
"or",
"an",
"external",
"sd",
"card",
"depending",
"on",
"the",
"device",
".",
"U... | def _get_sdcard_path():
""" Internal function to return getExternalStorageDirectory()
path. This is internal because it may either return the internal,
or an external sd card, depending on the device.
Use primary_external_storage_path()
or secondary_external_storage_path() instead wh... | [
"def",
"_get_sdcard_path",
"(",
")",
":",
"return",
"(",
"Environment",
".",
"getExternalStorageDirectory",
"(",
")",
".",
"getAbsolutePath",
"(",
")",
")"
] | https://github.com/kivy/python-for-android/blob/4ecaa5fe01aa25e3bc8cadc52ae481645754f955/pythonforandroid/recipes/android/src/android/storage.py#L16-L26 | |
bikalims/bika.lims | 35e4bbdb5a3912cae0b5eb13e51097c8b0486349 | bika/lims/browser/samplinground/edit.py | python | EditForm.__call__ | (self) | [] | def __call__(self):
# Checking current user permissions
if self.context.hasUserAddEditPermission():
return edit.DefaultEditForm.__call__(self)
else:
raise Unauthorized | [
"def",
"__call__",
"(",
"self",
")",
":",
"# Checking current user permissions",
"if",
"self",
".",
"context",
".",
"hasUserAddEditPermission",
"(",
")",
":",
"return",
"edit",
".",
"DefaultEditForm",
".",
"__call__",
"(",
"self",
")",
"else",
":",
"raise",
"U... | https://github.com/bikalims/bika.lims/blob/35e4bbdb5a3912cae0b5eb13e51097c8b0486349/bika/lims/browser/samplinground/edit.py#L15-L20 | ||||
modflowpy/flopy | eecd1ad193c5972093c9712e5c4b7a83284f0688 | flopy/modflow/mfswt.py | python | ModflowSwt.write_file | (self, f=None) | Write the package file.
Returns
-------
None | Write the package file. | [
"Write",
"the",
"package",
"file",
"."
] | def write_file(self, f=None):
"""
Write the package file.
Returns
-------
None
"""
nrow, ncol, nlay, nper = self.parent.nrow_ncol_nlay_nper
# Open file for writing
if f is None:
f = open(self.fn_path, "w")
# First line: headin... | [
"def",
"write_file",
"(",
"self",
",",
"f",
"=",
"None",
")",
":",
"nrow",
",",
"ncol",
",",
"nlay",
",",
"nper",
"=",
"self",
".",
"parent",
".",
"nrow_ncol_nlay_nper",
"# Open file for writing",
"if",
"f",
"is",
"None",
":",
"f",
"=",
"open",
"(",
... | https://github.com/modflowpy/flopy/blob/eecd1ad193c5972093c9712e5c4b7a83284f0688/flopy/modflow/mfswt.py#L230-L323 | ||
ahmetcemturan/SFACT | 7576e29ba72b33e5058049b77b7b558875542747 | skeinforge_application/skeinforge_plugins/craft_plugins/raft.py | python | RaftSkein.truncateSupportSegmentTables | (self) | Truncate the support segments after the last support segment which contains elements. | Truncate the support segments after the last support segment which contains elements. | [
"Truncate",
"the",
"support",
"segments",
"after",
"the",
"last",
"support",
"segment",
"which",
"contains",
"elements",
"."
] | def truncateSupportSegmentTables(self):
'Truncate the support segments after the last support segment which contains elements.'
for supportLayerIndex in xrange( len(self.supportLayers) - 1, - 1, - 1 ):
if len( self.supportLayers[supportLayerIndex].xIntersectionsTable ) > 0:
self.supportLayers = self.supportL... | [
"def",
"truncateSupportSegmentTables",
"(",
"self",
")",
":",
"for",
"supportLayerIndex",
"in",
"xrange",
"(",
"len",
"(",
"self",
".",
"supportLayers",
")",
"-",
"1",
",",
"-",
"1",
",",
"-",
"1",
")",
":",
"if",
"len",
"(",
"self",
".",
"supportLayer... | https://github.com/ahmetcemturan/SFACT/blob/7576e29ba72b33e5058049b77b7b558875542747/skeinforge_application/skeinforge_plugins/craft_plugins/raft.py#L1089-L1095 | ||
IronLanguages/main | a949455434b1fda8c783289e897e78a9a0caabb5 | External.LCA_RESTRICTED/Languages/IronPython/27/Lib/ftplib.py | python | FTP.transfercmd | (self, cmd, rest=None) | return self.ntransfercmd(cmd, rest)[0] | Like ntransfercmd() but returns only the socket. | Like ntransfercmd() but returns only the socket. | [
"Like",
"ntransfercmd",
"()",
"but",
"returns",
"only",
"the",
"socket",
"."
] | def transfercmd(self, cmd, rest=None):
"""Like ntransfercmd() but returns only the socket."""
return self.ntransfercmd(cmd, rest)[0] | [
"def",
"transfercmd",
"(",
"self",
",",
"cmd",
",",
"rest",
"=",
"None",
")",
":",
"return",
"self",
".",
"ntransfercmd",
"(",
"cmd",
",",
"rest",
")",
"[",
"0",
"]"
] | https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/27/Lib/ftplib.py#L374-L376 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/kombu/transport/librabbitmq.py | python | Transport.drain_events | (self, connection, **kwargs) | return connection.drain_events(**kwargs) | [] | def drain_events(self, connection, **kwargs):
return connection.drain_events(**kwargs) | [
"def",
"drain_events",
"(",
"self",
",",
"connection",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"connection",
".",
"drain_events",
"(",
"*",
"*",
"kwargs",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/kombu/transport/librabbitmq.py#L111-L112 | |||
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-linux/x64/pyasn1/type/base.py | python | Asn1Type.effectiveTagSet | (self) | return self.tagSet | For |ASN.1| type is equivalent to *tagSet* | For |ASN.1| type is equivalent to *tagSet* | [
"For",
"|ASN",
".",
"1|",
"type",
"is",
"equivalent",
"to",
"*",
"tagSet",
"*"
] | def effectiveTagSet(self):
"""For |ASN.1| type is equivalent to *tagSet*
"""
return self.tagSet | [
"def",
"effectiveTagSet",
"(",
"self",
")",
":",
"return",
"self",
".",
"tagSet"
] | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-linux/x64/pyasn1/type/base.py#L77-L80 | |
ansible/ansible-modules-extras | f216ba8e0616bc8ad8794c22d4b48e1ab18886cf | monitoring/nagios.py | python | Nagios.disable_servicegroup_host_notifications | (self, servicegroup) | This command is used to prevent notifications from being sent
out for all hosts in the specified servicegroup.
Note that this command does not disable notifications for
services associated with hosts in this service group.
Syntax: DISABLE_SERVICEGROUP_HOST_NOTIFICATIONS;<servicegroup_n... | This command is used to prevent notifications from being sent
out for all hosts in the specified servicegroup. | [
"This",
"command",
"is",
"used",
"to",
"prevent",
"notifications",
"from",
"being",
"sent",
"out",
"for",
"all",
"hosts",
"in",
"the",
"specified",
"servicegroup",
"."
] | def disable_servicegroup_host_notifications(self, servicegroup):
"""
This command is used to prevent notifications from being sent
out for all hosts in the specified servicegroup.
Note that this command does not disable notifications for
services associated with hosts in this se... | [
"def",
"disable_servicegroup_host_notifications",
"(",
"self",
",",
"servicegroup",
")",
":",
"cmd",
"=",
"\"DISABLE_SERVICEGROUP_HOST_NOTIFICATIONS\"",
"notif_str",
"=",
"self",
".",
"_fmt_notif_str",
"(",
"cmd",
",",
"servicegroup",
")",
"self",
".",
"_write_command",... | https://github.com/ansible/ansible-modules-extras/blob/f216ba8e0616bc8ad8794c22d4b48e1ab18886cf/monitoring/nagios.py#L719-L732 | ||
caiiiac/Machine-Learning-with-Python | 1a26c4467da41ca4ebc3d5bd789ea942ef79422f | MachineLearning/venv/lib/python3.5/site-packages/wheel/pep425tags.py | python | get_impl_ver | () | return impl_ver | Return implementation version. | Return implementation version. | [
"Return",
"implementation",
"version",
"."
] | def get_impl_ver():
"""Return implementation version."""
impl_ver = get_config_var("py_version_nodot")
if not impl_ver or get_abbr_impl() == 'pp':
impl_ver = ''.join(map(str, get_impl_version_info()))
return impl_ver | [
"def",
"get_impl_ver",
"(",
")",
":",
"impl_ver",
"=",
"get_config_var",
"(",
"\"py_version_nodot\"",
")",
"if",
"not",
"impl_ver",
"or",
"get_abbr_impl",
"(",
")",
"==",
"'pp'",
":",
"impl_ver",
"=",
"''",
".",
"join",
"(",
"map",
"(",
"str",
",",
"get_... | https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/wheel/pep425tags.py#L35-L40 | |
SUSE/DeepSea | 9c7fad93915ba1250c40d50c855011e9fe41ed21 | srv/modules/runners/validate.py | python | Validate.check_ipversion | (self) | Check that all subnets are the same version | Check that all subnets are the same version | [
"Check",
"that",
"all",
"subnets",
"are",
"the",
"same",
"version"
] | def check_ipversion(self):
"""
Check that all subnets are the same version
"""
log.debug("ipversion: {}".format(self.ipversion))
if len(self.ipversion) != 1:
msg = "Networks must be either IPv4 or IPv6"
self.errors.setdefault('ip_version', []).append(msg)
... | [
"def",
"check_ipversion",
"(",
"self",
")",
":",
"log",
".",
"debug",
"(",
"\"ipversion: {}\"",
".",
"format",
"(",
"self",
".",
"ipversion",
")",
")",
"if",
"len",
"(",
"self",
".",
"ipversion",
")",
"!=",
"1",
":",
"msg",
"=",
"\"Networks must be eithe... | https://github.com/SUSE/DeepSea/blob/9c7fad93915ba1250c40d50c855011e9fe41ed21/srv/modules/runners/validate.py#L595-L604 | ||
snapcore/snapcraft | b81550376df7f2d0dfe65f7bfb006a3107252450 | snapcraft/storeapi/_store_client.py | python | StoreClient.whoami | (self) | return self.dashboard.whoami() | Return user relevant login information. | Return user relevant login information. | [
"Return",
"user",
"relevant",
"login",
"information",
"."
] | def whoami(self) -> whoami.WhoAmI:
"""Return user relevant login information."""
return self.dashboard.whoami() | [
"def",
"whoami",
"(",
"self",
")",
"->",
"whoami",
".",
"WhoAmI",
":",
"return",
"self",
".",
"dashboard",
".",
"whoami",
"(",
")"
] | https://github.com/snapcore/snapcraft/blob/b81550376df7f2d0dfe65f7bfb006a3107252450/snapcraft/storeapi/_store_client.py#L96-L98 | |
apache/libcloud | 90971e17bfd7b6bb97b2489986472c531cc8e140 | libcloud/compute/drivers/ecs.py | python | ECSDriver.detach_volume | (self, volume, ex_instance_id=None) | return resp.success() | Detaches a volume from a node.
@inherits :class:`NodeDriver.detach_volume`
:keyword ex_instance_id: the id of the instance from which the volume
is detached.
:type ex_instance_id: ``str`` | Detaches a volume from a node. | [
"Detaches",
"a",
"volume",
"from",
"a",
"node",
"."
] | def detach_volume(self, volume, ex_instance_id=None):
"""
Detaches a volume from a node.
@inherits :class:`NodeDriver.detach_volume`
:keyword ex_instance_id: the id of the instance from which the volume
is detached.
:type ex_instance_id: ``str``... | [
"def",
"detach_volume",
"(",
"self",
",",
"volume",
",",
"ex_instance_id",
"=",
"None",
")",
":",
"params",
"=",
"{",
"\"Action\"",
":",
"\"DetachDisk\"",
",",
"\"DiskId\"",
":",
"volume",
".",
"id",
"}",
"if",
"ex_instance_id",
":",
"params",
"[",
"\"Inst... | https://github.com/apache/libcloud/blob/90971e17bfd7b6bb97b2489986472c531cc8e140/libcloud/compute/drivers/ecs.py#L1047-L1072 | |
buffer/thug | 96ccd5bb1a45375ad665dfb8fb975978bf4659cb | thug/Logging/modules/Mapper.py | python | Mapper.activate | (self, conto) | Iterate through data and set display for hot connections | Iterate through data and set display for hot connections | [
"Iterate",
"through",
"data",
"and",
"set",
"display",
"for",
"hot",
"connections"
] | def activate(self, conto):
"""
Iterate through data and set display for hot connections
"""
tofix = []
for c in self.data["connections"]:
if c["display"] is False and c["destination"] == conto:
c["display"] = True
tofix.append(c["... | [
"def",
"activate",
"(",
"self",
",",
"conto",
")",
":",
"tofix",
"=",
"[",
"]",
"for",
"c",
"in",
"self",
".",
"data",
"[",
"\"connections\"",
"]",
":",
"if",
"c",
"[",
"\"display\"",
"]",
"is",
"False",
"and",
"c",
"[",
"\"destination\"",
"]",
"==... | https://github.com/buffer/thug/blob/96ccd5bb1a45375ad665dfb8fb975978bf4659cb/thug/Logging/modules/Mapper.py#L316-L333 | ||
pysathq/pysat | 07bf3a5a4428d40eca804e7ebdf4f496aadf4213 | examples/hitman.py | python | Hitman.hit | (self, to_hit, weights=None) | This method adds a new set to hit to the hitting set solver. This
is done by translating the input iterable of objects into a list of
Boolean variables in the MaxSAT problem formulation.
Note that an optional parameter that can be passed to this method
is ``weights``, wh... | This method adds a new set to hit to the hitting set solver. This
is done by translating the input iterable of objects into a list of
Boolean variables in the MaxSAT problem formulation. | [
"This",
"method",
"adds",
"a",
"new",
"set",
"to",
"hit",
"to",
"the",
"hitting",
"set",
"solver",
".",
"This",
"is",
"done",
"by",
"translating",
"the",
"input",
"iterable",
"of",
"objects",
"into",
"a",
"list",
"of",
"Boolean",
"variables",
"in",
"the"... | def hit(self, to_hit, weights=None):
"""
This method adds a new set to hit to the hitting set solver. This
is done by translating the input iterable of objects into a list of
Boolean variables in the MaxSAT problem formulation.
Note that an optional parameter tha... | [
"def",
"hit",
"(",
"self",
",",
"to_hit",
",",
"weights",
"=",
"None",
")",
":",
"# translating objects to variables",
"to_hit",
"=",
"list",
"(",
"map",
"(",
"lambda",
"obj",
":",
"self",
".",
"idpool",
".",
"id",
"(",
"obj",
")",
",",
"to_hit",
")",
... | https://github.com/pysathq/pysat/blob/07bf3a5a4428d40eca804e7ebdf4f496aadf4213/examples/hitman.py#L356-L385 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.