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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-windows/x86/pyasn1/type/namedtype.py | python | NamedTypes.__gt__ | (self, other) | return self.__namedTypes > other | [] | def __gt__(self, other):
return self.__namedTypes > other | [
"def",
"__gt__",
"(",
"self",
",",
"other",
")",
":",
"return",
"self",
".",
"__namedTypes",
">",
"other"
] | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-windows/x86/pyasn1/type/namedtype.py#L192-L193 | |||
albertz/music-player | d23586f5bf657cbaea8147223be7814d117ae73d | src/modules/songdb.py | python | SongFileEntry.__setattr__ | (self, attr, value) | [] | def __setattr__(self, attr, value):
self.update(attr, lambda _: value) | [
"def",
"__setattr__",
"(",
"self",
",",
"attr",
",",
"value",
")",
":",
"self",
".",
"update",
"(",
"attr",
",",
"lambda",
"_",
":",
"value",
")"
] | https://github.com/albertz/music-player/blob/d23586f5bf657cbaea8147223be7814d117ae73d/src/modules/songdb.py#L617-L618 | ||||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/asyncio/transports.py | python | WriteTransport.get_write_buffer_size | (self) | Return the current size of the write buffer. | Return the current size of the write buffer. | [
"Return",
"the",
"current",
"size",
"of",
"the",
"write",
"buffer",
"."
] | def get_write_buffer_size(self):
"""Return the current size of the write buffer."""
raise NotImplementedError | [
"def",
"get_write_buffer_size",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/asyncio/transports.py#L92-L94 | ||
pyjanitor-devs/pyjanitor | 2207c0bddbf7e23f56e87892de0405787b11621e | janitor/functions/conditional_join.py | python | conditional_join | (
df: pd.DataFrame,
right: Union[pd.DataFrame, pd.Series],
*conditions,
how: str = "inner",
sort_by_appearance: bool = False,
) | return _conditional_join_compute(
df, right, conditions, how, sort_by_appearance
) | This is a convenience function that operates similarly to ``pd.merge``,
but allows joins on inequality operators,
or a combination of equi and non-equi joins.
If the join is solely on equality, `pd.merge` function
is more efficient and should be used instead.
If you are interested in nearest joins... | [] | def conditional_join(
df: pd.DataFrame,
right: Union[pd.DataFrame, pd.Series],
*conditions,
how: str = "inner",
sort_by_appearance: bool = False,
) -> pd.DataFrame:
"""
This is a convenience function that operates similarly to ``pd.merge``,
but allows joins on inequality operators,
... | [
"def",
"conditional_join",
"(",
"df",
":",
"pd",
".",
"DataFrame",
",",
"right",
":",
"Union",
"[",
"pd",
".",
"DataFrame",
",",
"pd",
".",
"Series",
"]",
",",
"*",
"conditions",
",",
"how",
":",
"str",
"=",
"\"inner\"",
",",
"sort_by_appearance",
":",... | https://github.com/pyjanitor-devs/pyjanitor/blob/2207c0bddbf7e23f56e87892de0405787b11621e/janitor/functions/conditional_join.py#L22-L121 | ||
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/bottle.py | python | _re_flatten | (p) | return re.sub(r'(\\*)(\(\?P<[^>]+>|\((?!\?))',
lambda m: m.group(0) if len(m.group(1)) % 2 else m.group(1) + '(?:', p) | Turn all capturing groups in a regular expression pattern into
non-capturing groups. | Turn all capturing groups in a regular expression pattern into
non-capturing groups. | [
"Turn",
"all",
"capturing",
"groups",
"in",
"a",
"regular",
"expression",
"pattern",
"into",
"non",
"-",
"capturing",
"groups",
"."
] | def _re_flatten(p):
''' Turn all capturing groups in a regular expression pattern into
non-capturing groups. '''
if '(' not in p: return p
return re.sub(r'(\\*)(\(\?P<[^>]+>|\((?!\?))',
lambda m: m.group(0) if len(m.group(1)) % 2 else m.group(1) + '(?:', p) | [
"def",
"_re_flatten",
"(",
"p",
")",
":",
"if",
"'('",
"not",
"in",
"p",
":",
"return",
"p",
"return",
"re",
".",
"sub",
"(",
"r'(\\\\*)(\\(\\?P<[^>]+>|\\((?!\\?))'",
",",
"lambda",
"m",
":",
"m",
".",
"group",
"(",
"0",
")",
"if",
"len",
"(",
"m",
... | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/bottle.py#L246-L251 | |
google/tf-quant-finance | 8fd723689ebf27ff4bb2bd2acb5f6091c5e07309 | tf_quant_finance/math/pde/steppers/multidim_parabolic_equation_stepper.py | python | _construct_contribution_of_mixed_term | (outer_coeff,
inner_coeff,
coord_grid,
value_grid,
dim1,
dim2,
batch... | return contrib_pp, contrib_pm, contrib_mp, contrib_mm | Constructs contribution of a mixed derivative term. | Constructs contribution of a mixed derivative term. | [
"Constructs",
"contribution",
"of",
"a",
"mixed",
"derivative",
"term",
"."
] | def _construct_contribution_of_mixed_term(outer_coeff,
inner_coeff,
coord_grid,
value_grid,
dim1,
dim2,
... | [
"def",
"_construct_contribution_of_mixed_term",
"(",
"outer_coeff",
",",
"inner_coeff",
",",
"coord_grid",
",",
"value_grid",
",",
"dim1",
",",
"dim2",
",",
"batch_rank",
",",
"lower_trim_indices",
",",
"upper_trim_indices",
",",
"has_default_lower_boundary",
",",
"has_... | https://github.com/google/tf-quant-finance/blob/8fd723689ebf27ff4bb2bd2acb5f6091c5e07309/tf_quant_finance/math/pde/steppers/multidim_parabolic_equation_stepper.py#L566-L653 | |
ashual/scene_generation | 6f6fe6afffae58da94c0c061e4dcaf273cdb9f44 | scene_generation/graph.py | python | GraphTripleConv.forward | (self, obj_vecs, pred_vecs, edges) | return new_obj_vecs, new_p_vecs | Inputs:
- obj_vecs: FloatTensor of shape (O, D) giving vectors for all objects
- pred_vecs: FloatTensor of shape (T, D) giving vectors for all predicates
- edges: LongTensor of shape (T, 2) where edges[k] = [i, j] indicates the
presence of a triple [obj_vecs[i], pred_vecs[k], obj_vecs[... | Inputs:
- obj_vecs: FloatTensor of shape (O, D) giving vectors for all objects
- pred_vecs: FloatTensor of shape (T, D) giving vectors for all predicates
- edges: LongTensor of shape (T, 2) where edges[k] = [i, j] indicates the
presence of a triple [obj_vecs[i], pred_vecs[k], obj_vecs[... | [
"Inputs",
":",
"-",
"obj_vecs",
":",
"FloatTensor",
"of",
"shape",
"(",
"O",
"D",
")",
"giving",
"vectors",
"for",
"all",
"objects",
"-",
"pred_vecs",
":",
"FloatTensor",
"of",
"shape",
"(",
"T",
"D",
")",
"giving",
"vectors",
"for",
"all",
"predicates",... | def forward(self, obj_vecs, pred_vecs, edges):
"""
Inputs:
- obj_vecs: FloatTensor of shape (O, D) giving vectors for all objects
- pred_vecs: FloatTensor of shape (T, D) giving vectors for all predicates
- edges: LongTensor of shape (T, 2) where edges[k] = [i, j] indicates the
... | [
"def",
"forward",
"(",
"self",
",",
"obj_vecs",
",",
"pred_vecs",
",",
"edges",
")",
":",
"dtype",
",",
"device",
"=",
"obj_vecs",
".",
"dtype",
",",
"obj_vecs",
".",
"device",
"O",
",",
"T",
"=",
"obj_vecs",
".",
"size",
"(",
"0",
")",
",",
"pred_... | https://github.com/ashual/scene_generation/blob/6f6fe6afffae58da94c0c061e4dcaf273cdb9f44/scene_generation/graph.py#L58-L122 | |
HymanLiuTS/flaskTs | 286648286976e85d9b9a5873632331efcafe0b21 | flasky/lib/python2.7/site-packages/sqlalchemy/sql/selectable.py | python | Join.select | (self, whereclause=None, **kwargs) | return Select(collist, whereclause, from_obj=[self], **kwargs) | Create a :class:`.Select` from this :class:`.Join`.
The equivalent long-hand form, given a :class:`.Join` object
``j``, is::
from sqlalchemy import select
j = select([j.left, j.right], **kw).\\
where(whereclause).\\
select_from(j)... | Create a :class:`.Select` from this :class:`.Join`. | [
"Create",
"a",
":",
"class",
":",
".",
"Select",
"from",
"this",
":",
"class",
":",
".",
"Join",
"."
] | def select(self, whereclause=None, **kwargs):
"""Create a :class:`.Select` from this :class:`.Join`.
The equivalent long-hand form, given a :class:`.Join` object
``j``, is::
from sqlalchemy import select
j = select([j.left, j.right], **kw).\\
whe... | [
"def",
"select",
"(",
"self",
",",
"whereclause",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"collist",
"=",
"[",
"self",
".",
"left",
",",
"self",
".",
"right",
"]",
"return",
"Select",
"(",
"collist",
",",
"whereclause",
",",
"from_obj",
"=",
... | https://github.com/HymanLiuTS/flaskTs/blob/286648286976e85d9b9a5873632331efcafe0b21/flasky/lib/python2.7/site-packages/sqlalchemy/sql/selectable.py#L1057-L1077 | |
oracle/oci-python-sdk | 3c1604e4e212008fb6718e2f68cdb5ef71fd5793 | examples/network_security_groups_example.py | python | launch_instance_in_nsg | (virtual_network_client,
compute_client,
availability_domain,
subnet_id,
image_id) | return launch_instance_response | [] | def launch_instance_in_nsg(virtual_network_client,
compute_client,
availability_domain,
subnet_id,
image_id):
launch_instance_details = oci.core.models.LaunchInstanceDetails(
display_name="NSG Exampl... | [
"def",
"launch_instance_in_nsg",
"(",
"virtual_network_client",
",",
"compute_client",
",",
"availability_domain",
",",
"subnet_id",
",",
"image_id",
")",
":",
"launch_instance_details",
"=",
"oci",
".",
"core",
".",
"models",
".",
"LaunchInstanceDetails",
"(",
"displ... | https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/examples/network_security_groups_example.py#L167-L194 | |||
ShivamSarodia/ShivyC | e7d72eff237e1ef49ec70333497348baf86be425 | shivyc/il_gen.py | python | SymbolTable.add_struct_union | (self, tag, ctype) | return self.tables[-1].structs[tag] | Add struct or union to the symbol table and return it.
If struct or union already exists in the topmost scope, this function
does not modify the symbol table and just returns the existing ctype.
Otherwise, this function adds this type to the topmost scope and
returns it. | Add struct or union to the symbol table and return it. | [
"Add",
"struct",
"or",
"union",
"to",
"the",
"symbol",
"table",
"and",
"return",
"it",
"."
] | def add_struct_union(self, tag, ctype):
"""Add struct or union to the symbol table and return it.
If struct or union already exists in the topmost scope, this function
does not modify the symbol table and just returns the existing ctype.
Otherwise, this function adds this type to the to... | [
"def",
"add_struct_union",
"(",
"self",
",",
"tag",
",",
"ctype",
")",
":",
"if",
"tag",
"not",
"in",
"self",
".",
"tables",
"[",
"-",
"1",
"]",
".",
"structs",
":",
"self",
".",
"tables",
"[",
"-",
"1",
"]",
".",
"structs",
"[",
"tag",
"]",
"=... | https://github.com/ShivamSarodia/ShivyC/blob/e7d72eff237e1ef49ec70333497348baf86be425/shivyc/il_gen.py#L303-L314 | |
pymc-devs/pymc | 38867dd19e96afb0ceccc8ccd74a9795f118dfe3 | pymc/distributions/dist_math.py | python | MvNormalLogp | () | return OpFromGraph([cov, delta], [logp], grad_overrides=dlogp, inline=True) | Compute the log pdf of a multivariate normal distribution.
This should be used in MvNormal.logp once Theano#5908 is released.
Parameters
----------
cov: at.matrix
The covariance matrix.
delta: at.matrix
Array of deviations from the mean. | Compute the log pdf of a multivariate normal distribution. | [
"Compute",
"the",
"log",
"pdf",
"of",
"a",
"multivariate",
"normal",
"distribution",
"."
] | def MvNormalLogp():
"""Compute the log pdf of a multivariate normal distribution.
This should be used in MvNormal.logp once Theano#5908 is released.
Parameters
----------
cov: at.matrix
The covariance matrix.
delta: at.matrix
Array of deviations from the mean.
"""
cov =... | [
"def",
"MvNormalLogp",
"(",
")",
":",
"cov",
"=",
"at",
".",
"matrix",
"(",
"\"cov\"",
")",
"cov",
".",
"tag",
".",
"test_value",
"=",
"floatX",
"(",
"np",
".",
"eye",
"(",
"3",
")",
")",
"delta",
"=",
"at",
".",
"matrix",
"(",
"\"delta\"",
")",
... | https://github.com/pymc-devs/pymc/blob/38867dd19e96afb0ceccc8ccd74a9795f118dfe3/pymc/distributions/dist_math.py#L219-L279 | |
SALib/SALib | b6b6b5cab3388f3b80590c98d66aca7dc784d894 | src/SALib/sample/ff.py | python | extend_bounds | (problem) | return problem | Extends the problem bounds to the nearest power of two
Parameters
----------
problem : dict
The problem definition | Extends the problem bounds to the nearest power of two | [
"Extends",
"the",
"problem",
"bounds",
"to",
"the",
"nearest",
"power",
"of",
"two"
] | def extend_bounds(problem):
"""Extends the problem bounds to the nearest power of two
Parameters
----------
problem : dict
The problem definition
"""
num_vars = problem['num_vars']
num_ff_vars = 2 ** find_smallest(num_vars)
num_dummy_variables = num_ff_vars - num_vars
boun... | [
"def",
"extend_bounds",
"(",
"problem",
")",
":",
"num_vars",
"=",
"problem",
"[",
"'num_vars'",
"]",
"num_ff_vars",
"=",
"2",
"**",
"find_smallest",
"(",
"num_vars",
")",
"num_dummy_variables",
"=",
"num_ff_vars",
"-",
"num_vars",
"bounds",
"=",
"list",
"(",
... | https://github.com/SALib/SALib/blob/b6b6b5cab3388f3b80590c98d66aca7dc784d894/src/SALib/sample/ff.py#L33-L56 | |
espressif/esptool | 41ceca0a72266960252717b3181389902fd89d55 | espsecure.py | python | _flash_encryption_operation_aes_xts | (output_file, input_file, flash_address, keyfile, do_decrypt) | Apply the AES-XTS algorithm with the hardware addressing scheme used by Espressif
key = AES-XTS key (32 or 64 bytes)
flash_address = address in flash to encrypt at. Must be multiple of 16 bytes.
indata = Data to encrypt/decrypt. Must be multiple of 16 bytes.
encrypt = True to Encrypt indata, False to d... | Apply the AES-XTS algorithm with the hardware addressing scheme used by Espressif | [
"Apply",
"the",
"AES",
"-",
"XTS",
"algorithm",
"with",
"the",
"hardware",
"addressing",
"scheme",
"used",
"by",
"Espressif"
] | def _flash_encryption_operation_aes_xts(output_file, input_file, flash_address, keyfile, do_decrypt):
"""
Apply the AES-XTS algorithm with the hardware addressing scheme used by Espressif
key = AES-XTS key (32 or 64 bytes)
flash_address = address in flash to encrypt at. Must be multiple of 16 bytes.
... | [
"def",
"_flash_encryption_operation_aes_xts",
"(",
"output_file",
",",
"input_file",
",",
"flash_address",
",",
"keyfile",
",",
"do_decrypt",
")",
":",
"backend",
"=",
"default_backend",
"(",
")",
"key",
"=",
"_load_hardware_key",
"(",
"keyfile",
")",
"indata",
"=... | https://github.com/espressif/esptool/blob/41ceca0a72266960252717b3181389902fd89d55/espsecure.py#L718-L780 | ||
mrJean1/PyGeodesy | 7da5ca71aa3edb7bc49e219e0b8190686e1a7965 | pygeodesy/gars.py | python | Garef.precision | (self) | return self._decoded3.precision if p is None else p | Get this garef's precision (C{int}). | Get this garef's precision (C{int}). | [
"Get",
"this",
"garef",
"s",
"precision",
"(",
"C",
"{",
"int",
"}",
")",
"."
] | def precision(self):
'''Get this garef's precision (C{int}).
'''
p = self._precision
return self._decoded3.precision if p is None else p | [
"def",
"precision",
"(",
"self",
")",
":",
"p",
"=",
"self",
".",
"_precision",
"return",
"self",
".",
"_decoded3",
".",
"precision",
"if",
"p",
"is",
"None",
"else",
"p"
] | https://github.com/mrJean1/PyGeodesy/blob/7da5ca71aa3edb7bc49e219e0b8190686e1a7965/pygeodesy/gars.py#L180-L184 | |
trakt/Plex-Trakt-Scrobbler | aeb0bfbe62fad4b06c164f1b95581da7f35dce0b | Trakttv.bundle/Contents/Libraries/FreeBSD/x86_64/ucs4/cryptography/hazmat/backends/openssl/encode_asn1.py | python | _encode_asn1_utf8_str | (backend, string) | return s | Create an ASN1_UTF8STRING from a Python unicode string.
This object will be an ASN1_STRING with UTF8 type in OpenSSL and
can be decoded with ASN1_STRING_to_UTF8. | Create an ASN1_UTF8STRING from a Python unicode string.
This object will be an ASN1_STRING with UTF8 type in OpenSSL and
can be decoded with ASN1_STRING_to_UTF8. | [
"Create",
"an",
"ASN1_UTF8STRING",
"from",
"a",
"Python",
"unicode",
"string",
".",
"This",
"object",
"will",
"be",
"an",
"ASN1_STRING",
"with",
"UTF8",
"type",
"in",
"OpenSSL",
"and",
"can",
"be",
"decoded",
"with",
"ASN1_STRING_to_UTF8",
"."
] | def _encode_asn1_utf8_str(backend, string):
"""
Create an ASN1_UTF8STRING from a Python unicode string.
This object will be an ASN1_STRING with UTF8 type in OpenSSL and
can be decoded with ASN1_STRING_to_UTF8.
"""
s = backend._lib.ASN1_UTF8STRING_new()
res = backend._lib.ASN1_STRING_set(
... | [
"def",
"_encode_asn1_utf8_str",
"(",
"backend",
",",
"string",
")",
":",
"s",
"=",
"backend",
".",
"_lib",
".",
"ASN1_UTF8STRING_new",
"(",
")",
"res",
"=",
"backend",
".",
"_lib",
".",
"ASN1_STRING_set",
"(",
"s",
",",
"string",
".",
"encode",
"(",
"\"u... | https://github.com/trakt/Plex-Trakt-Scrobbler/blob/aeb0bfbe62fad4b06c164f1b95581da7f35dce0b/Trakttv.bundle/Contents/Libraries/FreeBSD/x86_64/ucs4/cryptography/hazmat/backends/openssl/encode_asn1.py#L57-L68 | |
smart-mobile-software/gitstack | d9fee8f414f202143eb6e620529e8e5539a2af56 | python/Tools/Scripts/reindent.py | python | _rstrip | (line, JUNK='\n \t') | return line[:i] | Return line stripped of trailing spaces, tabs, newlines.
Note that line.rstrip() instead also strips sundry control characters,
but at least one known Emacs user expects to keep junk like that, not
mentioning Barry by name or anything <wink>. | Return line stripped of trailing spaces, tabs, newlines. | [
"Return",
"line",
"stripped",
"of",
"trailing",
"spaces",
"tabs",
"newlines",
"."
] | def _rstrip(line, JUNK='\n \t'):
"""Return line stripped of trailing spaces, tabs, newlines.
Note that line.rstrip() instead also strips sundry control characters,
but at least one known Emacs user expects to keep junk like that, not
mentioning Barry by name or anything <wink>.
"""
i = len(lin... | [
"def",
"_rstrip",
"(",
"line",
",",
"JUNK",
"=",
"'\\n \\t'",
")",
":",
"i",
"=",
"len",
"(",
"line",
")",
"while",
"i",
">",
"0",
"and",
"line",
"[",
"i",
"-",
"1",
"]",
"in",
"JUNK",
":",
"i",
"-=",
"1",
"return",
"line",
"[",
":",
"i",
"... | https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Tools/Scripts/reindent.py#L140-L151 | |
demisto/content | 5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07 | Packs/TaniumThreatResponse/Integrations/TaniumThreatResponseV2/TaniumThreatResponseV2.py | python | format_context_data | (context_to_format: Union[list, dict]) | Format a context dictionary to the standard demisto format.
:type context_to_format: ``dict``
:param context_to_format:
The object to convert.
:return: the formatted dictionary
:rtype: ``dict`` | Format a context dictionary to the standard demisto format.
:type context_to_format: ``dict``
:param context_to_format:
The object to convert. | [
"Format",
"a",
"context",
"dictionary",
"to",
"the",
"standard",
"demisto",
"format",
".",
":",
"type",
"context_to_format",
":",
"dict",
":",
"param",
"context_to_format",
":",
"The",
"object",
"to",
"convert",
"."
] | def format_context_data(context_to_format: Union[list, dict]) -> Union[list, dict]:
""" Format a context dictionary to the standard demisto format.
:type context_to_format: ``dict``
:param context_to_format:
The object to convert.
:return: the formatted dictionary
:rtype... | [
"def",
"format_context_data",
"(",
"context_to_format",
":",
"Union",
"[",
"list",
",",
"dict",
"]",
")",
"->",
"Union",
"[",
"list",
",",
"dict",
"]",
":",
"def",
"format_context_dict",
"(",
"context_dict",
":",
"dict",
")",
"->",
"dict",
":",
"# The API ... | https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/TaniumThreatResponse/Integrations/TaniumThreatResponseV2/TaniumThreatResponseV2.py#L127-L149 | ||
tasmota/tasmotizer | ea8484060f7451fde8b80dbabb83e9ec5faf7d87 | tasmotizer_esptool.py | python | ESPLoader.write_reg | (self, addr, value, mask=0xFFFFFFFF, delay_us=0) | return self.check_command("write target memory", self.ESP_WRITE_REG,
struct.pack('<IIII', addr, value, mask, delay_us)) | Write to memory address in target
Note: mask option is not supported by stub loaders, use update_reg() function. | Write to memory address in target | [
"Write",
"to",
"memory",
"address",
"in",
"target"
] | def write_reg(self, addr, value, mask=0xFFFFFFFF, delay_us=0):
""" Write to memory address in target
Note: mask option is not supported by stub loaders, use update_reg() function.
"""
return self.check_command("write target memory", self.ESP_WRITE_REG,
... | [
"def",
"write_reg",
"(",
"self",
",",
"addr",
",",
"value",
",",
"mask",
"=",
"0xFFFFFFFF",
",",
"delay_us",
"=",
"0",
")",
":",
"return",
"self",
".",
"check_command",
"(",
"\"write target memory\"",
",",
"self",
".",
"ESP_WRITE_REG",
",",
"struct",
".",
... | https://github.com/tasmota/tasmotizer/blob/ea8484060f7451fde8b80dbabb83e9ec5faf7d87/tasmotizer_esptool.py#L519-L525 | |
JacquesLucke/animation_nodes | b1e3ace8dcb0a771fd882fc3ac4e490b009fa0d1 | animation_nodes/nodes/spline/connect_splines.py | python | ConnectSplinesNode.create | (self) | [] | def create(self):
self.newInput("Spline List", "Splines", "splines", defaultDrawType = "PROPERTY_ONLY")
self.newOutput("Spline", "Spline", "spline") | [
"def",
"create",
"(",
"self",
")",
":",
"self",
".",
"newInput",
"(",
"\"Spline List\"",
",",
"\"Splines\"",
",",
"\"splines\"",
",",
"defaultDrawType",
"=",
"\"PROPERTY_ONLY\"",
")",
"self",
".",
"newOutput",
"(",
"\"Spline\"",
",",
"\"Spline\"",
",",
"\"spli... | https://github.com/JacquesLucke/animation_nodes/blob/b1e3ace8dcb0a771fd882fc3ac4e490b009fa0d1/animation_nodes/nodes/spline/connect_splines.py#L9-L11 | ||||
SUSE/DeepSea | 9c7fad93915ba1250c40d50c855011e9fe41ed21 | srv/salt/_modules/packagemanager.py | python | Zypper._handle | (self, strat='up') | Conbines up and dup and executes the constructed zypper command. | Conbines up and dup and executes the constructed zypper command. | [
"Conbines",
"up",
"and",
"dup",
"and",
"executes",
"the",
"constructed",
"zypper",
"command",
"."
] | def _handle(self, strat='up'):
"""
Conbines up and dup and executes the constructed zypper command.
"""
cmd = []
if strat == 'dup':
check_method = self._upgrades_needed
elif strat == 'up':
check_method = self._updates_needed
elif strat ==... | [
"def",
"_handle",
"(",
"self",
",",
"strat",
"=",
"'up'",
")",
":",
"cmd",
"=",
"[",
"]",
"if",
"strat",
"==",
"'dup'",
":",
"check_method",
"=",
"self",
".",
"_upgrades_needed",
"elif",
"strat",
"==",
"'up'",
":",
"check_method",
"=",
"self",
".",
"... | https://github.com/SUSE/DeepSea/blob/9c7fad93915ba1250c40d50c855011e9fe41ed21/srv/salt/_modules/packagemanager.py#L296-L332 | ||
jython/frozen-mirror | b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99 | Lib/decimal.py | python | Decimal.ln | (self, context=None) | return ans | Returns the natural (base e) logarithm of self. | Returns the natural (base e) logarithm of self. | [
"Returns",
"the",
"natural",
"(",
"base",
"e",
")",
"logarithm",
"of",
"self",
"."
] | def ln(self, context=None):
"""Returns the natural (base e) logarithm of self."""
if context is None:
context = getcontext()
# ln(NaN) = NaN
ans = self._check_nans(context=context)
if ans:
return ans
# ln(0.0) == -Infinity
if not self:
... | [
"def",
"ln",
"(",
"self",
",",
"context",
"=",
"None",
")",
":",
"if",
"context",
"is",
"None",
":",
"context",
"=",
"getcontext",
"(",
")",
"# ln(NaN) = NaN",
"ans",
"=",
"self",
".",
"_check_nans",
"(",
"context",
"=",
"context",
")",
"if",
"ans",
... | https://github.com/jython/frozen-mirror/blob/b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99/Lib/decimal.py#L3056-L3104 | |
KvasirSecurity/Kvasir | a5b3775184a8343240e1154a1f762f75df04dc0a | modules/xlsxwriter/chart_line.py | python | ChartLine.__init__ | (self, options=None) | Constructor. | Constructor. | [
"Constructor",
"."
] | def __init__(self, options=None):
"""
Constructor.
"""
super(ChartLine, self).__init__()
if options is None:
options = {}
self.default_marker = {'type': 'none'}
self.smooth_allowed = True | [
"def",
"__init__",
"(",
"self",
",",
"options",
"=",
"None",
")",
":",
"super",
"(",
"ChartLine",
",",
"self",
")",
".",
"__init__",
"(",
")",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"self",
".",
"default_marker",
"=",
"{",
"'... | https://github.com/KvasirSecurity/Kvasir/blob/a5b3775184a8343240e1154a1f762f75df04dc0a/modules/xlsxwriter/chart_line.py#L24-L35 | ||
openhatch/oh-mainline | ce29352a034e1223141dcc2f317030bbc3359a51 | vendor/packages/twisted/twisted/python/monkey.py | python | MonkeyPatcher.restore | (self) | Restore all original values to any patched objects. | Restore all original values to any patched objects. | [
"Restore",
"all",
"original",
"values",
"to",
"any",
"patched",
"objects",
"."
] | def restore(self):
"""
Restore all original values to any patched objects.
"""
while self._originals:
obj, name, value = self._originals.pop()
setattr(obj, name, value) | [
"def",
"restore",
"(",
"self",
")",
":",
"while",
"self",
".",
"_originals",
":",
"obj",
",",
"name",
",",
"value",
"=",
"self",
".",
"_originals",
".",
"pop",
"(",
")",
"setattr",
"(",
"obj",
",",
"name",
",",
"value",
")"
] | https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/twisted/twisted/python/monkey.py#L55-L61 | ||
OUCMachineLearning/OUCML | 5b54337d7c0316084cb1a74befda2bba96137d4a | One_Day_One_GAN/day3/cgan/cgan.py | python | CGAN.__init__ | (self) | [] | def __init__(self):
# Input shape
self.img_rows = 28
self.img_cols = 28
self.channels = 1
self.img_shape = (self.img_rows, self.img_cols, self.channels)
self.num_classes = 10
self.latent_dim = 100
optimizer = Adam(0.0002, 0.5)
# Build and compile... | [
"def",
"__init__",
"(",
"self",
")",
":",
"# Input shape",
"self",
".",
"img_rows",
"=",
"28",
"self",
".",
"img_cols",
"=",
"28",
"self",
".",
"channels",
"=",
"1",
"self",
".",
"img_shape",
"=",
"(",
"self",
".",
"img_rows",
",",
"self",
".",
"img_... | https://github.com/OUCMachineLearning/OUCML/blob/5b54337d7c0316084cb1a74befda2bba96137d4a/One_Day_One_GAN/day3/cgan/cgan.py#L16-L53 | ||||
plivo/plivoframework | 29fc41fb3c887d5d9022a941e87bbeb2269112ff | src/plivo/rest/freeswitch/api.py | python | PlivoRestApi.schedule_play | (self) | return self.send_response(Success=result, Message=msg) | Schedule playing something to a Call or bridged leg or both legs.
Allow to schedule playing a sound to a Call via the REST API. To play sound,
make an HTTP POST request to the resource URI.
POST Parameters
----------------
Required Parameters - You must POST the following param... | Schedule playing something to a Call or bridged leg or both legs.
Allow to schedule playing a sound to a Call via the REST API. To play sound,
make an HTTP POST request to the resource URI. | [
"Schedule",
"playing",
"something",
"to",
"a",
"Call",
"or",
"bridged",
"leg",
"or",
"both",
"legs",
".",
"Allow",
"to",
"schedule",
"playing",
"a",
"sound",
"to",
"a",
"Call",
"via",
"the",
"REST",
"API",
".",
"To",
"play",
"sound",
"make",
"an",
"HTT... | def schedule_play(self):
"""Schedule playing something to a Call or bridged leg or both legs.
Allow to schedule playing a sound to a Call via the REST API. To play sound,
make an HTTP POST request to the resource URI.
POST Parameters
----------------
Required Parameters... | [
"def",
"schedule_play",
"(",
"self",
")",
":",
"self",
".",
"_rest_inbound_socket",
".",
"log",
".",
"debug",
"(",
"\"RESTAPI SchedulePlay with %s\"",
"%",
"str",
"(",
"request",
".",
"form",
".",
"items",
"(",
")",
")",
")",
"msg",
"=",
"\"\"",
"result",
... | https://github.com/plivo/plivoframework/blob/29fc41fb3c887d5d9022a941e87bbeb2269112ff/src/plivo/rest/freeswitch/api.py#L1861-L1954 | |
ahmetcemturan/SFACT | 7576e29ba72b33e5058049b77b7b558875542747 | fabmetheus_utilities/geometry/manipulation_paths/segment.py | python | StartEnd.__repr__ | (self) | return '%s, %s, %s' % (self.start, self.end, self.revolutions) | Get the string representation of this StartEnd. | Get the string representation of this StartEnd. | [
"Get",
"the",
"string",
"representation",
"of",
"this",
"StartEnd",
"."
] | def __repr__(self):
"Get the string representation of this StartEnd."
return '%s, %s, %s' % (self.start, self.end, self.revolutions) | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"'%s, %s, %s'",
"%",
"(",
"self",
".",
"start",
",",
"self",
".",
"end",
",",
"self",
".",
"revolutions",
")"
] | https://github.com/ahmetcemturan/SFACT/blob/7576e29ba72b33e5058049b77b7b558875542747/fabmetheus_utilities/geometry/manipulation_paths/segment.py#L164-L166 | |
llSourcell/AI_Artist | 3038c06c2e389b9c919c881c9a169efe2fd7810e | lib/python2.7/site-packages/pip/cmdoptions.py | python | _get_format_control | (values, option) | return getattr(values, option.dest) | Get a format_control object. | Get a format_control object. | [
"Get",
"a",
"format_control",
"object",
"."
] | def _get_format_control(values, option):
"""Get a format_control object."""
return getattr(values, option.dest) | [
"def",
"_get_format_control",
"(",
"values",
",",
"option",
")",
":",
"return",
"getattr",
"(",
"values",
",",
"option",
".",
"dest",
")"
] | https://github.com/llSourcell/AI_Artist/blob/3038c06c2e389b9c919c881c9a169efe2fd7810e/lib/python2.7/site-packages/pip/cmdoptions.py#L396-L398 | |
kozec/sc-controller | ce92c773b8b26f6404882e9209aff212c4053170 | scc/gui/daemon_manager.py | python | ControllerManager.is_connected | (self) | return self._connected | Returns True, if controller is still connected to daemon.
Value is cached locally. | Returns True, if controller is still connected to daemon.
Value is cached locally. | [
"Returns",
"True",
"if",
"controller",
"is",
"still",
"connected",
"to",
"daemon",
".",
"Value",
"is",
"cached",
"locally",
"."
] | def is_connected(self):
"""
Returns True, if controller is still connected to daemon.
Value is cached locally.
"""
return self._connected | [
"def",
"is_connected",
"(",
"self",
")",
":",
"return",
"self",
".",
"_connected"
] | https://github.com/kozec/sc-controller/blob/ce92c773b8b26f6404882e9209aff212c4053170/scc/gui/daemon_manager.py#L373-L378 | |
smart-mobile-software/gitstack | d9fee8f414f202143eb6e620529e8e5539a2af56 | python/Lib/distutils/fancy_getopt.py | python | FancyGetopt.generate_help | (self, header=None) | return lines | Generate help text (a list of strings, one per suggested line of
output) from the option table for this FancyGetopt object. | Generate help text (a list of strings, one per suggested line of
output) from the option table for this FancyGetopt object. | [
"Generate",
"help",
"text",
"(",
"a",
"list",
"of",
"strings",
"one",
"per",
"suggested",
"line",
"of",
"output",
")",
"from",
"the",
"option",
"table",
"for",
"this",
"FancyGetopt",
"object",
"."
] | def generate_help (self, header=None):
"""Generate help text (a list of strings, one per suggested line of
output) from the option table for this FancyGetopt object.
"""
# Blithely assume the option table is good: probably wouldn't call
# 'generate_help()' unless you've already c... | [
"def",
"generate_help",
"(",
"self",
",",
"header",
"=",
"None",
")",
":",
"# Blithely assume the option table is good: probably wouldn't call",
"# 'generate_help()' unless you've already called 'getopt()'.",
"# First pass: determine maximum length of long option names",
"max_opt",
"=",
... | https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/distutils/fancy_getopt.py#L309-L389 | |
postgres/pgadmin4 | 374c5e952fa594d749fadf1f88076c1cba8c5f64 | web/pgadmin/utils/sqlautocomplete/autocomplete.py | python | SQLAutoComplete.fetch_foreign_keys | (self, schemas, obj_type) | return data | This function is used to fetch the foreign_keys for the given
schema name
:param schemas:
:param obj_type:
:return: | This function is used to fetch the foreign_keys for the given
schema name
:param schemas:
:param obj_type:
:return: | [
"This",
"function",
"is",
"used",
"to",
"fetch",
"the",
"foreign_keys",
"for",
"the",
"given",
"schema",
"name",
":",
"param",
"schemas",
":",
":",
"param",
"obj_type",
":",
":",
"return",
":"
] | def fetch_foreign_keys(self, schemas, obj_type):
"""
This function is used to fetch the foreign_keys for the given
schema name
:param schemas:
:param obj_type:
:return:
"""
data = []
query = render_template("/".join([self.sql_path, 'foreign_keys.s... | [
"def",
"fetch_foreign_keys",
"(",
"self",
",",
"schemas",
",",
"obj_type",
")",
":",
"data",
"=",
"[",
"]",
"query",
"=",
"render_template",
"(",
"\"/\"",
".",
"join",
"(",
"[",
"self",
".",
"sql_path",
",",
"'foreign_keys.sql'",
"]",
")",
",",
"schema_n... | https://github.com/postgres/pgadmin4/blob/374c5e952fa594d749fadf1f88076c1cba8c5f64/web/pgadmin/utils/sqlautocomplete/autocomplete.py#L1247-L1269 | |
hudora/huBarcode | e89cc42a4325aaab20297fecd33a785061633bed | hubarcode/code128/textencoder.py | python | TextEncoder.get_bars | (self, encoded_text, checksum) | return bars | Return the bar encoding (a string of ones and zeroes)
representing the given encoded text and checksum digit.
Stop code and termination bars are added onto the end | Return the bar encoding (a string of ones and zeroes)
representing the given encoded text and checksum digit.
Stop code and termination bars are added onto the end | [
"Return",
"the",
"bar",
"encoding",
"(",
"a",
"string",
"of",
"ones",
"and",
"zeroes",
")",
"representing",
"the",
"given",
"encoded",
"text",
"and",
"checksum",
"digit",
".",
"Stop",
"code",
"and",
"termination",
"bars",
"are",
"added",
"onto",
"the",
"en... | def get_bars(self, encoded_text, checksum):
"""Return the bar encoding (a string of ones and zeroes)
representing the given encoded text and checksum digit.
Stop code and termination bars are added onto the end"""
full_code = encoded_text + [checksum, ]
bars = ""
for cha... | [
"def",
"get_bars",
"(",
"self",
",",
"encoded_text",
",",
"checksum",
")",
":",
"full_code",
"=",
"encoded_text",
"+",
"[",
"checksum",
",",
"]",
"bars",
"=",
"\"\"",
"for",
"char",
"in",
"full_code",
":",
"bars",
"+=",
"encoding",
".",
"encodings",
"[",... | https://github.com/hudora/huBarcode/blob/e89cc42a4325aaab20297fecd33a785061633bed/hubarcode/code128/textencoder.py#L185-L198 | |
jinxiwang/ocr_TDR | 391966af1a5d06a31cadba809df35ba170c71c60 | dataload.py | python | Dataload.get_val_batch | (self, batch_size) | return batch_data, batch_label | 获取验证集数据
:param batch_size:
:return: | 获取验证集数据
:param batch_size:
:return: | [
"获取验证集数据",
":",
"param",
"batch_size",
":",
":",
"return",
":"
] | def get_val_batch(self, batch_size):
"""
获取验证集数据
:param batch_size:
:return:
"""
f = open('./data/val_data.txt', 'r')
data = f.read()
val_data_dict = eval(data)
val_img_path_list = list(self.data_dict.keys())
val_data_num = len(val_img_pa... | [
"def",
"get_val_batch",
"(",
"self",
",",
"batch_size",
")",
":",
"f",
"=",
"open",
"(",
"'./data/val_data.txt'",
",",
"'r'",
")",
"data",
"=",
"f",
".",
"read",
"(",
")",
"val_data_dict",
"=",
"eval",
"(",
"data",
")",
"val_img_path_list",
"=",
"list",
... | https://github.com/jinxiwang/ocr_TDR/blob/391966af1a5d06a31cadba809df35ba170c71c60/dataload.py#L23-L62 | |
donglixp/coarse2fine | d6c51a3073df9018e32c95c257c68b0d69d9aa46 | wikisql/table/Models.py | python | DecoderState.detach | (self) | Detaches all Variables from the graph
that created it, making it a leaf. | Detaches all Variables from the graph
that created it, making it a leaf. | [
"Detaches",
"all",
"Variables",
"from",
"the",
"graph",
"that",
"created",
"it",
"making",
"it",
"a",
"leaf",
"."
] | def detach(self):
"""
Detaches all Variables from the graph
that created it, making it a leaf.
"""
for h in self._all:
if h is not None:
h.detach_() | [
"def",
"detach",
"(",
"self",
")",
":",
"for",
"h",
"in",
"self",
".",
"_all",
":",
"if",
"h",
"is",
"not",
"None",
":",
"h",
".",
"detach_",
"(",
")"
] | https://github.com/donglixp/coarse2fine/blob/d6c51a3073df9018e32c95c257c68b0d69d9aa46/wikisql/table/Models.py#L306-L313 | ||
KristianOellegaard/django-hvad | b4fb1ff3674bd8309530ed5dcb95e9c3afd53a10 | hvad/manager.py | python | TranslationQueryset._translate_args_kwargs | (self, *args, **kwargs) | return newargs, newkwargs | [] | def _translate_args_kwargs(self, *args, **kwargs):
# Translate args (Q objects) from '<shared_field>' to
# 'master__<shared_field>' where necessary.
newargs = deepcopy(args)
for q in newargs:
for child, children, index in q_children(q):
children[index] = (self... | [
"def",
"_translate_args_kwargs",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Translate args (Q objects) from '<shared_field>' to",
"# 'master__<shared_field>' where necessary.",
"newargs",
"=",
"deepcopy",
"(",
"args",
")",
"for",
"q",
"in",
"... | https://github.com/KristianOellegaard/django-hvad/blob/b4fb1ff3674bd8309530ed5dcb95e9c3afd53a10/hvad/manager.py#L284-L295 | |||
angr/angr | 4b04d56ace135018083d36d9083805be8146688b | angr/engines/vex/claripy/ccall.py | python | pc_make_rdata_if_necessary | (nbits, cf, pf, af, zf, sf, of, platform=None) | return _concat_flags(nbits, vec) | [] | def pc_make_rdata_if_necessary(nbits, cf, pf, af, zf, sf, of, platform=None):
vec = [(data[platform]['CondBitOffsets']['G_CC_SHIFT_C'], cf),
(data[platform]['CondBitOffsets']['G_CC_SHIFT_P'], pf),
(data[platform]['CondBitOffsets']['G_CC_SHIFT_A'], af),
(data[platform]['CondBitOffset... | [
"def",
"pc_make_rdata_if_necessary",
"(",
"nbits",
",",
"cf",
",",
"pf",
",",
"af",
",",
"zf",
",",
"sf",
",",
"of",
",",
"platform",
"=",
"None",
")",
":",
"vec",
"=",
"[",
"(",
"data",
"[",
"platform",
"]",
"[",
"'CondBitOffsets'",
"]",
"[",
"'G_... | https://github.com/angr/angr/blob/4b04d56ace135018083d36d9083805be8146688b/angr/engines/vex/claripy/ccall.py#L287-L295 | |||
django/django | 0a17666045de6739ae1c2ac695041823d5f827f7 | django/db/backends/base/base.py | python | BaseDatabaseWrapper.rollback | (self) | Roll back a transaction and reset the dirty flag. | Roll back a transaction and reset the dirty flag. | [
"Roll",
"back",
"a",
"transaction",
"and",
"reset",
"the",
"dirty",
"flag",
"."
] | def rollback(self):
"""Roll back a transaction and reset the dirty flag."""
self.validate_thread_sharing()
self.validate_no_atomic_block()
self._rollback()
# A successful rollback means that the database connection works.
self.errors_occurred = False
self.needs_ro... | [
"def",
"rollback",
"(",
"self",
")",
":",
"self",
".",
"validate_thread_sharing",
"(",
")",
"self",
".",
"validate_no_atomic_block",
"(",
")",
"self",
".",
"_rollback",
"(",
")",
"# A successful rollback means that the database connection works.",
"self",
".",
"errors... | https://github.com/django/django/blob/0a17666045de6739ae1c2ac695041823d5f827f7/django/db/backends/base/base.py#L298-L306 | ||
beeware/ouroboros | a29123c6fab6a807caffbb7587cf548e0c370296 | ouroboros/datetime.py | python | datetime.__str__ | (self) | return self.isoformat(sep=' ') | Convert to string, for str(). | Convert to string, for str(). | [
"Convert",
"to",
"string",
"for",
"str",
"()",
"."
] | def __str__(self):
"Convert to string, for str()."
return self.isoformat(sep=' ') | [
"def",
"__str__",
"(",
"self",
")",
":",
"return",
"self",
".",
"isoformat",
"(",
"sep",
"=",
"' '",
")"
] | https://github.com/beeware/ouroboros/blob/a29123c6fab6a807caffbb7587cf548e0c370296/ouroboros/datetime.py#L1599-L1601 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Lib/lib-tk/Tkdnd.py | python | Tester.dnd_motion | (self, source, event) | [] | def dnd_motion(self, source, event):
x, y = source.where(self.canvas, event)
x1, y1, x2, y2 = self.canvas.bbox(self.dndid)
self.canvas.move(self.dndid, x-x1, y-y1) | [
"def",
"dnd_motion",
"(",
"self",
",",
"source",
",",
"event",
")",
":",
"x",
",",
"y",
"=",
"source",
".",
"where",
"(",
"self",
".",
"canvas",
",",
"event",
")",
"x1",
",",
"y1",
",",
"x2",
",",
"y2",
"=",
"self",
".",
"canvas",
".",
"bbox",
... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/lib-tk/Tkdnd.py#L287-L290 | ||||
OpenRCE/sulley | bff0dd1864d055eb4bfa8aacbbb6ecf215e4db4b | sulley/sessions.py | python | target.__init__ | (self, host, port, **kwargs) | @type host: String
@param host: Hostname or IP address of target system
@type port: Integer
@param port: Port of target service | [] | def __init__ (self, host, port, **kwargs):
'''
@type host: String
@param host: Hostname or IP address of target system
@type port: Integer
@param port: Port of target service
'''
self.host = host
self.port = port
# set these manually ... | [
"def",
"__init__",
"(",
"self",
",",
"host",
",",
"port",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"host",
"=",
"host",
"self",
".",
"port",
"=",
"port",
"# set these manually once target is instantiated.",
"self",
".",
"netmon",
"=",
"None",
"self"... | https://github.com/OpenRCE/sulley/blob/bff0dd1864d055eb4bfa8aacbbb6ecf215e4db4b/sulley/sessions.py#L27-L44 | |||
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/elastic.py | python | get_es_new | () | return es | Get a handle to the configured elastic search DB.
Returns an elasticsearch.Elasticsearch instance. | Get a handle to the configured elastic search DB.
Returns an elasticsearch.Elasticsearch instance. | [
"Get",
"a",
"handle",
"to",
"the",
"configured",
"elastic",
"search",
"DB",
".",
"Returns",
"an",
"elasticsearch",
".",
"Elasticsearch",
"instance",
"."
] | def get_es_new():
"""
Get a handle to the configured elastic search DB.
Returns an elasticsearch.Elasticsearch instance.
"""
hosts = _es_hosts()
es = Elasticsearch(hosts, timeout=settings.ES_SEARCH_TIMEOUT, serializer=ESJSONSerializer())
return es | [
"def",
"get_es_new",
"(",
")",
":",
"hosts",
"=",
"_es_hosts",
"(",
")",
"es",
"=",
"Elasticsearch",
"(",
"hosts",
",",
"timeout",
"=",
"settings",
".",
"ES_SEARCH_TIMEOUT",
",",
"serializer",
"=",
"ESJSONSerializer",
"(",
")",
")",
"return",
"es"
] | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/elastic.py#L61-L68 | |
brightmart/roberta_zh | 469246096b0c3f43e4de395ad3c09dacee16d591 | run_classifier.py | python | InputExample.__init__ | (self, guid, text_a, text_b=None, label=None) | Constructs a InputExample.
Args:
guid: Unique id for the example.
text_a: string. The untokenized text of the first sequence. For single
sequence tasks, only this sequence must be specified.
text_b: (Optional) string. The untokenized text of the second sequence.
Only must be specif... | Constructs a InputExample.
Args:
guid: Unique id for the example.
text_a: string. The untokenized text of the first sequence. For single
sequence tasks, only this sequence must be specified.
text_b: (Optional) string. The untokenized text of the second sequence.
Only must be specif... | [
"Constructs",
"a",
"InputExample",
".",
"Args",
":",
"guid",
":",
"Unique",
"id",
"for",
"the",
"example",
".",
"text_a",
":",
"string",
".",
"The",
"untokenized",
"text",
"of",
"the",
"first",
"sequence",
".",
"For",
"single",
"sequence",
"tasks",
"only",... | def __init__(self, guid, text_a, text_b=None, label=None):
"""Constructs a InputExample.
Args:
guid: Unique id for the example.
text_a: string. The untokenized text of the first sequence. For single
sequence tasks, only this sequence must be specified.
text_b: (Optional) string. The un... | [
"def",
"__init__",
"(",
"self",
",",
"guid",
",",
"text_a",
",",
"text_b",
"=",
"None",
",",
"label",
"=",
"None",
")",
":",
"self",
".",
"guid",
"=",
"guid",
"self",
".",
"text_a",
"=",
"text_a",
"self",
".",
"text_b",
"=",
"text_b",
"self",
".",
... | https://github.com/brightmart/roberta_zh/blob/469246096b0c3f43e4de395ad3c09dacee16d591/run_classifier.py#L131-L145 | ||
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/modules/firewalld.py | python | block_icmp | (zone, icmp, permanent=True) | return __firewall_cmd(cmd) | Block a specific ICMP type on a zone
.. versionadded:: 2015.8.0
CLI Example:
.. code-block:: bash
salt '*' firewalld.block_icmp zone echo-reply | Block a specific ICMP type on a zone | [
"Block",
"a",
"specific",
"ICMP",
"type",
"on",
"a",
"zone"
] | def block_icmp(zone, icmp, permanent=True):
"""
Block a specific ICMP type on a zone
.. versionadded:: 2015.8.0
CLI Example:
.. code-block:: bash
salt '*' firewalld.block_icmp zone echo-reply
"""
if icmp not in get_icmp_types(permanent):
log.error("Invalid ICMP type")
... | [
"def",
"block_icmp",
"(",
"zone",
",",
"icmp",
",",
"permanent",
"=",
"True",
")",
":",
"if",
"icmp",
"not",
"in",
"get_icmp_types",
"(",
"permanent",
")",
":",
"log",
".",
"error",
"(",
"\"Invalid ICMP type\"",
")",
"return",
"False",
"if",
"icmp",
"in"... | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/firewalld.py#L764-L789 | |
rbgirshick/yacs | 32d5e4ac300eca6cd3b839097dde39c4017a1070 | yacs/config.py | python | CfgNode.register_deprecated_key | (self, key) | Register key (e.g. `FOO.BAR`) a deprecated option. When merging deprecated
keys a warning is generated and the key is ignored. | Register key (e.g. `FOO.BAR`) a deprecated option. When merging deprecated
keys a warning is generated and the key is ignored. | [
"Register",
"key",
"(",
"e",
".",
"g",
".",
"FOO",
".",
"BAR",
")",
"a",
"deprecated",
"option",
".",
"When",
"merging",
"deprecated",
"keys",
"a",
"warning",
"is",
"generated",
"and",
"the",
"key",
"is",
"ignored",
"."
] | def register_deprecated_key(self, key):
"""Register key (e.g. `FOO.BAR`) a deprecated option. When merging deprecated
keys a warning is generated and the key is ignored.
"""
_assert_with_logging(
key not in self.__dict__[CfgNode.DEPRECATED_KEYS],
"key {} is alread... | [
"def",
"register_deprecated_key",
"(",
"self",
",",
"key",
")",
":",
"_assert_with_logging",
"(",
"key",
"not",
"in",
"self",
".",
"__dict__",
"[",
"CfgNode",
".",
"DEPRECATED_KEYS",
"]",
",",
"\"key {} is already registered as a deprecated key\"",
".",
"format",
"(... | https://github.com/rbgirshick/yacs/blob/32d5e4ac300eca6cd3b839097dde39c4017a1070/yacs/config.py#L277-L285 | ||
swimlane/pyattck | d57ab7d7d55c10ad71ffc27edc6fcb957d826493 | pyattck/preattck/technique.py | python | PreAttckTechnique.tactics | (self, obj) | Sets the associated tactic/phase this technique is in
Arguments:
obj (dict) -- A MITRE PRE-ATT&CK Framework json object
Returns:
(string) -- Returns a string that sets the tactic/phase this technique
is in. If there is no phase found, it will return 'no ... | Sets the associated tactic/phase this technique is in | [
"Sets",
"the",
"associated",
"tactic",
"/",
"phase",
"this",
"technique",
"is",
"in"
] | def tactics(self, obj):
"""
Sets the associated tactic/phase this technique is in
Arguments:
obj (dict) -- A MITRE PRE-ATT&CK Framework json object
Returns:
(string) -- Returns a string that sets the tactic/phase this technique
is in. If ... | [
"def",
"tactics",
"(",
"self",
",",
"obj",
")",
":",
"temp_list",
"=",
"[",
"]",
"try",
":",
"for",
"phase",
"in",
"obj",
"[",
"'kill_chain_phases'",
"]",
":",
"temp_list",
".",
"append",
"(",
"phase",
"[",
"'phase_name'",
"]",
")",
"self",
".",
"_ta... | https://github.com/swimlane/pyattck/blob/d57ab7d7d55c10ad71ffc27edc6fcb957d826493/pyattck/preattck/technique.py#L126-L143 | ||
smart-mobile-software/gitstack | d9fee8f414f202143eb6e620529e8e5539a2af56 | python/Lib/cookielib.py | python | CookieJar.extract_cookies | (self, response, request) | Extract cookies from response, where allowable given the request. | Extract cookies from response, where allowable given the request. | [
"Extract",
"cookies",
"from",
"response",
"where",
"allowable",
"given",
"the",
"request",
"."
] | def extract_cookies(self, response, request):
"""Extract cookies from response, where allowable given the request."""
_debug("extract_cookies: %s", response.info())
self._cookies_lock.acquire()
try:
self._policy._now = self._now = int(time.time())
for cookie in s... | [
"def",
"extract_cookies",
"(",
"self",
",",
"response",
",",
"request",
")",
":",
"_debug",
"(",
"\"extract_cookies: %s\"",
",",
"response",
".",
"info",
"(",
")",
")",
"self",
".",
"_cookies_lock",
".",
"acquire",
"(",
")",
"try",
":",
"self",
".",
"_po... | https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/cookielib.py#L1635-L1647 | ||
Source-Python-Dev-Team/Source.Python | d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb | addons/source-python/Python3/smtplib.py | python | SMTP.help | (self, args='') | return self.getreply()[1] | SMTP 'help' command.
Returns help text from server. | SMTP 'help' command.
Returns help text from server. | [
"SMTP",
"help",
"command",
".",
"Returns",
"help",
"text",
"from",
"server",
"."
] | def help(self, args=''):
"""SMTP 'help' command.
Returns help text from server."""
self.putcmd("help", args)
return self.getreply()[1] | [
"def",
"help",
"(",
"self",
",",
"args",
"=",
"''",
")",
":",
"self",
".",
"putcmd",
"(",
"\"help\"",
",",
"args",
")",
"return",
"self",
".",
"getreply",
"(",
")",
"[",
"1",
"]"
] | https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/Python3/smtplib.py#L488-L492 | |
pybliometrics-dev/pybliometrics | 26ad9656e5a1d4c80774937706a0df85776f07d0 | pybliometrics/scopus/plumx_metrics.py | python | PlumXMetrics.social_media | (self) | return _format_as_namedtuple_list(metrics) or None | A list of namedtuples representing social media metrics.
Note: For details on Social Media metrics see
https://plumanalytics.com/learn/about-metrics/social-media-metrics/. | A list of namedtuples representing social media metrics. | [
"A",
"list",
"of",
"namedtuples",
"representing",
"social",
"media",
"metrics",
"."
] | def social_media(self) -> Optional[List[NamedTuple]]:
"""A list of namedtuples representing social media metrics.
Note: For details on Social Media metrics see
https://plumanalytics.com/learn/about-metrics/social-media-metrics/.
"""
metrics = self._count_categories.get('socialMe... | [
"def",
"social_media",
"(",
"self",
")",
"->",
"Optional",
"[",
"List",
"[",
"NamedTuple",
"]",
"]",
":",
"metrics",
"=",
"self",
".",
"_count_categories",
".",
"get",
"(",
"'socialMedia'",
",",
"[",
"]",
")",
"return",
"_format_as_namedtuple_list",
"(",
"... | https://github.com/pybliometrics-dev/pybliometrics/blob/26ad9656e5a1d4c80774937706a0df85776f07d0/pybliometrics/scopus/plumx_metrics.py#L57-L64 | |
ahmetcemturan/SFACT | 7576e29ba72b33e5058049b77b7b558875542747 | fabmetheus_utilities/geometry/geometry_tools/dictionary.py | python | Dictionary.getVertexes | (self) | return getAllVertexes([], self) | Get all vertexes. | Get all vertexes. | [
"Get",
"all",
"vertexes",
"."
] | def getVertexes(self):
'Get all vertexes.'
return getAllVertexes([], self) | [
"def",
"getVertexes",
"(",
"self",
")",
":",
"return",
"getAllVertexes",
"(",
"[",
"]",
",",
"self",
")"
] | https://github.com/ahmetcemturan/SFACT/blob/7576e29ba72b33e5058049b77b7b558875542747/fabmetheus_utilities/geometry/geometry_tools/dictionary.py#L158-L160 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/sat/solvers/dimacs.py | python | DIMACS.render_dimacs | (clauses, filename, nlits) | Produce DIMACS file ``filename`` from ``clauses``.
INPUT:
- ``clauses`` - a list of clauses, either in simple format as a list of
literals or in extended format for CryptoMiniSat: a tuple of literals,
``is_xor`` and ``rhs``.
- ``filename`` - the file to write to
-... | Produce DIMACS file ``filename`` from ``clauses``. | [
"Produce",
"DIMACS",
"file",
"filename",
"from",
"clauses",
"."
] | def render_dimacs(clauses, filename, nlits):
"""
Produce DIMACS file ``filename`` from ``clauses``.
INPUT:
- ``clauses`` - a list of clauses, either in simple format as a list of
literals or in extended format for CryptoMiniSat: a tuple of literals,
``is_xor`` and `... | [
"def",
"render_dimacs",
"(",
"clauses",
",",
"filename",
",",
"nlits",
")",
":",
"fh",
"=",
"open",
"(",
"filename",
",",
"\"w\"",
")",
"fh",
".",
"write",
"(",
"\"p cnf %d %d\\n\"",
"%",
"(",
"nlits",
",",
"len",
"(",
"clauses",
")",
")",
")",
"for"... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/sat/solvers/dimacs.py#L299-L355 | ||
robotframework/SeleniumLibrary | 0d8caf35cd8325ff391c27fe814744060470018e | src/SeleniumLibrary/keywords/waiting.py | python | WaitingKeywords.wait_until_element_is_visible | (
self,
locator: Union[WebElement, None, str],
timeout: Optional[timedelta] = None,
error: Optional[str] = None,
) | Waits until the element ``locator`` is visible.
Fails if ``timeout`` expires before the element is visible. See
the `Timeouts` section for more information about using timeouts and
their default value and the `Locating elements` section for details
about the locator syntax.
``e... | Waits until the element ``locator`` is visible. | [
"Waits",
"until",
"the",
"element",
"locator",
"is",
"visible",
"."
] | def wait_until_element_is_visible(
self,
locator: Union[WebElement, None, str],
timeout: Optional[timedelta] = None,
error: Optional[str] = None,
):
"""Waits until the element ``locator`` is visible.
Fails if ``timeout`` expires before the element is visible. See
... | [
"def",
"wait_until_element_is_visible",
"(",
"self",
",",
"locator",
":",
"Union",
"[",
"WebElement",
",",
"None",
",",
"str",
"]",
",",
"timeout",
":",
"Optional",
"[",
"timedelta",
"]",
"=",
"None",
",",
"error",
":",
"Optional",
"[",
"str",
"]",
"=",
... | https://github.com/robotframework/SeleniumLibrary/blob/0d8caf35cd8325ff391c27fe814744060470018e/src/SeleniumLibrary/keywords/waiting.py#L299-L319 | ||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/sandpiles/sandpile.py | python | Sandpile.group_gens | (self, verbose=True) | r"""
A minimal list of generators for the sandpile group. If ``verbose`` is ``False``
then the generators are represented as lists of integers.
INPUT:
``verbose`` -- (default: ``True``) boolean
OUTPUT:
list of SandpileConfig (or of lists of integers if ``verbose`` is... | r"""
A minimal list of generators for the sandpile group. If ``verbose`` is ``False``
then the generators are represented as lists of integers. | [
"r",
"A",
"minimal",
"list",
"of",
"generators",
"for",
"the",
"sandpile",
"group",
".",
"If",
"verbose",
"is",
"False",
"then",
"the",
"generators",
"are",
"represented",
"as",
"lists",
"of",
"integers",
"."
] | def group_gens(self, verbose=True):
r"""
A minimal list of generators for the sandpile group. If ``verbose`` is ``False``
then the generators are represented as lists of integers.
INPUT:
``verbose`` -- (default: ``True``) boolean
OUTPUT:
list of SandpileConfi... | [
"def",
"group_gens",
"(",
"self",
",",
"verbose",
"=",
"True",
")",
":",
"if",
"verbose",
":",
"return",
"deepcopy",
"(",
"self",
".",
"_group_gens",
")",
"else",
":",
"return",
"[",
"c",
".",
"values",
"(",
")",
"for",
"c",
"in",
"self",
".",
"_gr... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/sandpiles/sandpile.py#L1473-L1504 | ||
F8LEFT/DecLLVM | d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c | python/idaapi.py | python | user_numforms_iterator_t.__ne__ | (self, *args) | return _idaapi.user_numforms_iterator_t___ne__(self, *args) | __ne__(self, p) -> bool | __ne__(self, p) -> bool | [
"__ne__",
"(",
"self",
"p",
")",
"-",
">",
"bool"
] | def __ne__(self, *args):
"""
__ne__(self, p) -> bool
"""
return _idaapi.user_numforms_iterator_t___ne__(self, *args) | [
"def",
"__ne__",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_idaapi",
".",
"user_numforms_iterator_t___ne__",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/F8LEFT/DecLLVM/blob/d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c/python/idaapi.py#L40022-L40026 | |
Runbook/runbook | 7b68622f75ef09f654046f0394540025f3ee7445 | src/web/payments/__init__.py | python | BasePayments.create | (self, request) | return self.create_subscription(form_data=None) | Base Method for creating a new subscription | Base Method for creating a new subscription | [
"Base",
"Method",
"for",
"creating",
"a",
"new",
"subscription"
] | def create(self, request):
''' Base Method for creating a new subscription '''
return self.create_subscription(form_data=None) | [
"def",
"create",
"(",
"self",
",",
"request",
")",
":",
"return",
"self",
".",
"create_subscription",
"(",
"form_data",
"=",
"None",
")"
] | https://github.com/Runbook/runbook/blob/7b68622f75ef09f654046f0394540025f3ee7445/src/web/payments/__init__.py#L24-L26 | |
openstack/ironic | b392dc19bcd29cef5a69ec00d2f18a7a19a679e5 | ironic/drivers/modules/ilo/firmware_processor.py | python | verify_firmware_update_args | (func) | return wrapper | Verifies the firmware update arguments. | Verifies the firmware update arguments. | [
"Verifies",
"the",
"firmware",
"update",
"arguments",
"."
] | def verify_firmware_update_args(func):
"""Verifies the firmware update arguments."""
@functools.wraps(func)
def wrapper(self, task, **kwargs):
"""Wrapper around ``update_firmware`` call.
:param task: a TaskManager object.
:raises: InvalidParameterValue if validation fails for input ... | [
"def",
"verify_firmware_update_args",
"(",
"func",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"func",
")",
"def",
"wrapper",
"(",
"self",
",",
"task",
",",
"*",
"*",
"kwargs",
")",
":",
"\"\"\"Wrapper around ``update_firmware`` call.\n\n :param task: a Ta... | https://github.com/openstack/ironic/blob/b392dc19bcd29cef5a69ec00d2f18a7a19a679e5/ironic/drivers/modules/ilo/firmware_processor.py#L54-L82 | |
gentoo/portage | e5be73709b1a42b40380fd336f9381452b01a723 | lib/portage/glsa.py | python | Glsa.isVulnerable | (self) | return rValue | Tests if the system is affected by this GLSA by checking if any
vulnerable package versions are installed. Also checks for affected
architectures.
@rtype: Boolean
@return: True if the system is affected, False if not | Tests if the system is affected by this GLSA by checking if any
vulnerable package versions are installed. Also checks for affected
architectures. | [
"Tests",
"if",
"the",
"system",
"is",
"affected",
"by",
"this",
"GLSA",
"by",
"checking",
"if",
"any",
"vulnerable",
"package",
"versions",
"are",
"installed",
".",
"Also",
"checks",
"for",
"affected",
"architectures",
"."
] | def isVulnerable(self):
"""
Tests if the system is affected by this GLSA by checking if any
vulnerable package versions are installed. Also checks for affected
architectures.
@rtype: Boolean
@return: True if the system is affected, False if not
"""
rValu... | [
"def",
"isVulnerable",
"(",
"self",
")",
":",
"rValue",
"=",
"False",
"for",
"k",
"in",
"self",
".",
"packages",
":",
"pkg",
"=",
"self",
".",
"packages",
"[",
"k",
"]",
"for",
"path",
"in",
"pkg",
":",
"if",
"path",
"[",
"\"arch\"",
"]",
"==",
"... | https://github.com/gentoo/portage/blob/e5be73709b1a42b40380fd336f9381452b01a723/lib/portage/glsa.py#L739-L764 | |
zatosource/zato | 2a9d273f06f9d776fbfeb53e73855af6e40fa208 | code/zato-web-admin/src/zato/admin/web/views/pubsub/__init__.py | python | get_client_html | (item, security_id, cluster_id) | return client | Client is a string representation of a WebSockets channel, HTTP credentials or a service. | Client is a string representation of a WebSockets channel, HTTP credentials or a service. | [
"Client",
"is",
"a",
"string",
"representation",
"of",
"a",
"WebSockets",
"channel",
"HTTP",
"credentials",
"or",
"a",
"service",
"."
] | def get_client_html(item, security_id, cluster_id):
""" Client is a string representation of a WebSockets channel, HTTP credentials or a service.
"""
client = ''
path_name = ''
if security_id:
path_name = 'security-basic-auth'
name = item.sec_name
protocol = 'HTTP'
elif... | [
"def",
"get_client_html",
"(",
"item",
",",
"security_id",
",",
"cluster_id",
")",
":",
"client",
"=",
"''",
"path_name",
"=",
"''",
"if",
"security_id",
":",
"path_name",
"=",
"'security-basic-auth'",
"name",
"=",
"item",
".",
"sec_name",
"protocol",
"=",
"... | https://github.com/zatosource/zato/blob/2a9d273f06f9d776fbfeb53e73855af6e40fa208/code/zato-web-admin/src/zato/admin/web/views/pubsub/__init__.py#L32-L58 | |
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/cfw/v20190904/models.py | python | DeleteSecurityGroupAllRuleRequest.__init__ | (self) | r"""
:param Direction: 方向,0:出站,1:入站
:type Direction: int
:param Area: 腾讯云地域的英文简写
:type Area: str | r"""
:param Direction: 方向,0:出站,1:入站
:type Direction: int
:param Area: 腾讯云地域的英文简写
:type Area: str | [
"r",
":",
"param",
"Direction",
":",
"方向,0:出站,1:入站",
":",
"type",
"Direction",
":",
"int",
":",
"param",
"Area",
":",
"腾讯云地域的英文简写",
":",
"type",
"Area",
":",
"str"
] | def __init__(self):
r"""
:param Direction: 方向,0:出站,1:入站
:type Direction: int
:param Area: 腾讯云地域的英文简写
:type Area: str
"""
self.Direction = None
self.Area = None | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"Direction",
"=",
"None",
"self",
".",
"Area",
"=",
"None"
] | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/cfw/v20190904/models.py#L1161-L1169 | ||
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter8-Regression/venv/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/chardet/latin1prober.py | python | Latin1Prober.feed | (self, aBuf) | return self.get_state() | [] | def feed(self, aBuf):
aBuf = self.filter_with_english_letters(aBuf)
for c in aBuf:
charClass = Latin1_CharToClass[wrap_ord(c)]
freq = Latin1ClassModel[(self._mLastCharClass * CLASS_NUM)
+ charClass]
if freq == 0:
sel... | [
"def",
"feed",
"(",
"self",
",",
"aBuf",
")",
":",
"aBuf",
"=",
"self",
".",
"filter_with_english_letters",
"(",
"aBuf",
")",
"for",
"c",
"in",
"aBuf",
":",
"charClass",
"=",
"Latin1_CharToClass",
"[",
"wrap_ord",
"(",
"c",
")",
"]",
"freq",
"=",
"Lati... | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter8-Regression/venv/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/chardet/latin1prober.py#L110-L122 | |||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/graphs/graph.py | python | Graph.twograph | (self) | return T | r"""
Return the two-graph of ``self``
Returns the :class:`two-graph <sage.combinat.designs.twographs.TwoGraph>`
with the triples
`T=\{t \in \binom {V}{3} : \left| \binom {t}{2} \cap E \right| \text{odd} \}`
where `V` and `E` are vertices and edges of ``self``, respectively.
... | r"""
Return the two-graph of ``self`` | [
"r",
"Return",
"the",
"two",
"-",
"graph",
"of",
"self"
] | def twograph(self):
r"""
Return the two-graph of ``self``
Returns the :class:`two-graph <sage.combinat.designs.twographs.TwoGraph>`
with the triples
`T=\{t \in \binom {V}{3} : \left| \binom {t}{2} \cap E \right| \text{odd} \}`
where `V` and `E` are vertices and edges of ... | [
"def",
"twograph",
"(",
"self",
")",
":",
"from",
"sage",
".",
"combinat",
".",
"designs",
".",
"twographs",
"import",
"TwoGraph",
"G",
"=",
"self",
".",
"relabel",
"(",
"range",
"(",
"self",
".",
"order",
"(",
")",
")",
",",
"inplace",
"=",
"False",... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/graphs/graph.py#L5722-L5776 | |
wistbean/fxxkpython | 88e16d79d8dd37236ba6ecd0d0ff11d63143968c | vip/qyxuan/projects/Snake/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/distlib/database.py | python | DependencyGraph.add_distribution | (self, distribution) | Add the *distribution* to the graph.
:type distribution: :class:`distutils2.database.InstalledDistribution`
or :class:`distutils2.database.EggInfoDistribution` | Add the *distribution* to the graph. | [
"Add",
"the",
"*",
"distribution",
"*",
"to",
"the",
"graph",
"."
] | def add_distribution(self, distribution):
"""Add the *distribution* to the graph.
:type distribution: :class:`distutils2.database.InstalledDistribution`
or :class:`distutils2.database.EggInfoDistribution`
"""
self.adjacency_list[distribution] = []
sel... | [
"def",
"add_distribution",
"(",
"self",
",",
"distribution",
")",
":",
"self",
".",
"adjacency_list",
"[",
"distribution",
"]",
"=",
"[",
"]",
"self",
".",
"reverse_list",
"[",
"distribution",
"]",
"=",
"[",
"]"
] | https://github.com/wistbean/fxxkpython/blob/88e16d79d8dd37236ba6ecd0d0ff11d63143968c/vip/qyxuan/projects/Snake/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/distlib/database.py#L1102-L1109 | ||
ansible-collections/community.general | 3faffe8f47968a2400ba3c896c8901c03001a194 | plugins/modules/copr.py | python | CoprModule.resolve_differences | (self, repo_content_file, repo_content_api, repo_filename_path) | return True | Detect differences between the contents of the repository stored on the
system and the information about the repository on the server.
Args:
repo_content_file: The contents of the repository stored on the system.
repo_content_api: The information about the repository from the se... | Detect differences between the contents of the repository stored on the
system and the information about the repository on the server. | [
"Detect",
"differences",
"between",
"the",
"contents",
"of",
"the",
"repository",
"stored",
"on",
"the",
"system",
"and",
"the",
"information",
"about",
"the",
"repository",
"on",
"the",
"server",
"."
] | def resolve_differences(self, repo_content_file, repo_content_api, repo_filename_path):
"""Detect differences between the contents of the repository stored on the
system and the information about the repository on the server.
Args:
repo_content_file: The contents of the repository s... | [
"def",
"resolve_differences",
"(",
"self",
",",
"repo_content_file",
",",
"repo_content_api",
",",
"repo_filename_path",
")",
":",
"repo_file_lines",
"=",
"repo_content_file",
".",
"split",
"(",
"\"\\n\"",
")",
"repo_api_lines",
"=",
"repo_content_api",
".",
"split",
... | https://github.com/ansible-collections/community.general/blob/3faffe8f47968a2400ba3c896c8901c03001a194/plugins/modules/copr.py#L322-L351 | |
FederatedAI/FATE | 32540492623568ecd1afcb367360133616e02fa3 | python/federatedml/framework/hetero/procedure/batch_generator.py | python | Host.generate_batch_data | (self) | [] | def generate_batch_data(self):
batch_index = 0
for batch_data_inst in self.batch_data_insts:
LOGGER.info("batch_num: {}, batch_data_inst size:{}".format(
batch_index, batch_data_inst.count()))
yield batch_data_inst
batch_index += 1 | [
"def",
"generate_batch_data",
"(",
"self",
")",
":",
"batch_index",
"=",
"0",
"for",
"batch_data_inst",
"in",
"self",
".",
"batch_data_insts",
":",
"LOGGER",
".",
"info",
"(",
"\"batch_num: {}, batch_data_inst size:{}\"",
".",
"format",
"(",
"batch_index",
",",
"b... | https://github.com/FederatedAI/FATE/blob/32540492623568ecd1afcb367360133616e02fa3/python/federatedml/framework/hetero/procedure/batch_generator.py#L72-L78 | ||||
pytorch/fairseq | 1575f30dd0a9f7b3c499db0b4767aa4e9f79056c | examples/MMPT/scripts/video_feature_extractor/videoreader.py | python | AvKeyframeVideoCompressor._get_output_dim | (self, height, width) | keep the shorter side be `self.size`, strech the other. | keep the shorter side be `self.size`, strech the other. | [
"keep",
"the",
"shorter",
"side",
"be",
"self",
".",
"size",
"strech",
"the",
"other",
"."
] | def _get_output_dim(self, height, width):
"""
keep the shorter side be `self.size`, strech the other.
"""
if height >= width:
return int(height * self.size / width), self.size
else:
return self.size, int(width * self.size / height) | [
"def",
"_get_output_dim",
"(",
"self",
",",
"height",
",",
"width",
")",
":",
"if",
"height",
">=",
"width",
":",
"return",
"int",
"(",
"height",
"*",
"self",
".",
"size",
"/",
"width",
")",
",",
"self",
".",
"size",
"else",
":",
"return",
"self",
... | https://github.com/pytorch/fairseq/blob/1575f30dd0a9f7b3c499db0b4767aa4e9f79056c/examples/MMPT/scripts/video_feature_extractor/videoreader.py#L195-L202 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/celery/utils/threads.py | python | _LocalStack._set__ident_func__ | (self, value) | [] | def _set__ident_func__(self, value):
object.__setattr__(self._local, '__ident_func__', value) | [
"def",
"_set__ident_func__",
"(",
"self",
",",
"value",
")",
":",
"object",
".",
"__setattr__",
"(",
"self",
".",
"_local",
",",
"'__ident_func__'",
",",
"value",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/celery/utils/threads.py#L195-L196 | ||||
hzlzh/AlfredWorkflow.com | 7055f14f6922c80ea5943839eb0caff11ae57255 | Sources/Workflows/ONE「一个」/workflow/web.py | python | Response.encoding | (self) | return self._encoding | Text encoding of document or ``None``
:returns: :class:`str` or ``None`` | Text encoding of document or ``None`` | [
"Text",
"encoding",
"of",
"document",
"or",
"None"
] | def encoding(self):
"""Text encoding of document or ``None``
:returns: :class:`str` or ``None``
"""
if not self._encoding:
self._encoding = self._get_encoding()
return self._encoding | [
"def",
"encoding",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_encoding",
":",
"self",
".",
"_encoding",
"=",
"self",
".",
"_get_encoding",
"(",
")",
"return",
"self",
".",
"_encoding"
] | https://github.com/hzlzh/AlfredWorkflow.com/blob/7055f14f6922c80ea5943839eb0caff11ae57255/Sources/Workflows/ONE「一个」/workflow/web.py#L272-L282 | |
carbonblack/cbapi-python | 24d677ffd99aee911c2c76ecb5528e4e9320c7cc | src/cbapi/psc/cblr.py | python | LiveResponseSession.__init__ | (self, cblr_manager, session_id, sensor_id, session_data=None) | [] | def __init__(self, cblr_manager, session_id, sensor_id, session_data=None):
super(LiveResponseSession, self).__init__(cblr_manager, session_id, sensor_id, session_data=session_data)
from cbapi.psc.defense.models import Device
device_info = self._cb.select(Device, self.sensor_id)
self.os_... | [
"def",
"__init__",
"(",
"self",
",",
"cblr_manager",
",",
"session_id",
",",
"sensor_id",
",",
"session_data",
"=",
"None",
")",
":",
"super",
"(",
"LiveResponseSession",
",",
"self",
")",
".",
"__init__",
"(",
"cblr_manager",
",",
"session_id",
",",
"sensor... | https://github.com/carbonblack/cbapi-python/blob/24d677ffd99aee911c2c76ecb5528e4e9320c7cc/src/cbapi/psc/cblr.py#L21-L25 | ||||
hyperledger/fabric-sdk-py | 8ee33a8981887e37950dc0f36a7ec63b3a5ba5c3 | hfc/fabric/user.py | python | User.roles | (self) | return self._roles | Get the roles
:return: The roles | Get the roles
:return: The roles | [
"Get",
"the",
"roles",
":",
"return",
":",
"The",
"roles"
] | def roles(self):
"""Get the roles
:return: The roles
"""
return self._roles | [
"def",
"roles",
"(",
"self",
")",
":",
"return",
"self",
".",
"_roles"
] | https://github.com/hyperledger/fabric-sdk-py/blob/8ee33a8981887e37950dc0f36a7ec63b3a5ba5c3/hfc/fabric/user.py#L74-L78 | |
otsaloma/gaupol | 6dec7826654d223c71a8d3279dcd967e95c46714 | gaupol/dialogs/position_shift.py | python | TimeShiftDialog._get_amount | (self) | return aeidon.as_seconds(self._amount_spin.get_value()) | Return the amount of seconds to shift. | Return the amount of seconds to shift. | [
"Return",
"the",
"amount",
"of",
"seconds",
"to",
"shift",
"."
] | def _get_amount(self):
"""Return the amount of seconds to shift."""
return aeidon.as_seconds(self._amount_spin.get_value()) | [
"def",
"_get_amount",
"(",
"self",
")",
":",
"return",
"aeidon",
".",
"as_seconds",
"(",
"self",
".",
"_amount_spin",
".",
"get_value",
"(",
")",
")"
] | https://github.com/otsaloma/gaupol/blob/6dec7826654d223c71a8d3279dcd967e95c46714/gaupol/dialogs/position_shift.py#L157-L159 | |
AstroPrint/AstroBox | e7e3b8a7d33ea85fcb6b2696869c0d719ceb8b75 | src/octoprint/server/api/log.py | python | downloadLog | (filename) | return redirectToTornado(request, url_for("index") + "downloads/logs/" + filename) | [] | def downloadLog(filename):
return redirectToTornado(request, url_for("index") + "downloads/logs/" + filename) | [
"def",
"downloadLog",
"(",
"filename",
")",
":",
"return",
"redirectToTornado",
"(",
"request",
",",
"url_for",
"(",
"\"index\"",
")",
"+",
"\"downloads/logs/\"",
"+",
"filename",
")"
] | https://github.com/AstroPrint/AstroBox/blob/e7e3b8a7d33ea85fcb6b2696869c0d719ceb8b75/src/octoprint/server/api/log.py#L29-L30 | |||
ctxis/CAPE | dae9fa6a254ecdbabeb7eb0d2389fa63722c1e82 | lib/cuckoo/core/scheduler.py | python | AnalysisManager.acquire_machine | (self) | Acquire an analysis machine from the pool of available ones. | Acquire an analysis machine from the pool of available ones. | [
"Acquire",
"an",
"analysis",
"machine",
"from",
"the",
"pool",
"of",
"available",
"ones",
"."
] | def acquire_machine(self):
"""Acquire an analysis machine from the pool of available ones."""
machine = None
# Start a loop to acquire the a machine to run the analysis on.
while True:
machine_lock.acquire()
# In some cases it's possible that we enter this loop ... | [
"def",
"acquire_machine",
"(",
"self",
")",
":",
"machine",
"=",
"None",
"# Start a loop to acquire the a machine to run the analysis on.",
"while",
"True",
":",
"machine_lock",
".",
"acquire",
"(",
")",
"# In some cases it's possible that we enter this loop without",
"# having... | https://github.com/ctxis/CAPE/blob/dae9fa6a254ecdbabeb7eb0d2389fa63722c1e82/lib/cuckoo/core/scheduler.py#L153-L187 | ||
biolab/orange3 | 41685e1c7b1d1babe680113685a2d44bcc9fec0b | Orange/data/table.py | python | Table.is_view | (self) | return ((not self._X.shape[-1] or self._X.base is not None) and
(not self._Y.shape[-1] or self._Y.base is not None) and
(not self._metas.shape[-1] or self._metas.base is not None) and
(not self._W.shape[-1] or self._W.base is not None)) | Return `True` if all arrays represent a view referring to another table | Return `True` if all arrays represent a view referring to another table | [
"Return",
"True",
"if",
"all",
"arrays",
"represent",
"a",
"view",
"referring",
"to",
"another",
"table"
] | def is_view(self):
"""
Return `True` if all arrays represent a view referring to another table
"""
return ((not self._X.shape[-1] or self._X.base is not None) and
(not self._Y.shape[-1] or self._Y.base is not None) and
(not self._metas.shape[-1] or self._m... | [
"def",
"is_view",
"(",
"self",
")",
":",
"return",
"(",
"(",
"not",
"self",
".",
"_X",
".",
"shape",
"[",
"-",
"1",
"]",
"or",
"self",
".",
"_X",
".",
"base",
"is",
"not",
"None",
")",
"and",
"(",
"not",
"self",
".",
"_Y",
".",
"shape",
"[",
... | https://github.com/biolab/orange3/blob/41685e1c7b1d1babe680113685a2d44bcc9fec0b/Orange/data/table.py#L1438-L1445 | |
rhinstaller/anaconda | 63edc8680f1b05cbfe11bef28703acba808c5174 | pyanaconda/modules/storage/devicetree/model.py | python | create_storage | () | return InstallerStorage() | Create the storage object.
:return: an instance of the Blivet's storage object | Create the storage object. | [
"Create",
"the",
"storage",
"object",
"."
] | def create_storage():
"""Create the storage object.
:return: an instance of the Blivet's storage object
"""
return InstallerStorage() | [
"def",
"create_storage",
"(",
")",
":",
"return",
"InstallerStorage",
"(",
")"
] | https://github.com/rhinstaller/anaconda/blob/63edc8680f1b05cbfe11bef28703acba808c5174/pyanaconda/modules/storage/devicetree/model.py#L45-L50 | |
welchbj/tt | 13920b0559561353993750872c6eba37411a33b7 | tt/expressions/bexpr.py | python | BooleanExpression.iter_dnf_clauses | (self) | Iterate over the DNF clauses in this expression.
.. code-block:: python
>>> from tt import BooleanExpression
>>> b = BooleanExpression('(A and ~B) or (C and D and E)')
>>> for clause in b.iter_dnf_clauses():
... print(clause)
...
A an... | Iterate over the DNF clauses in this expression. | [
"Iterate",
"over",
"the",
"DNF",
"clauses",
"in",
"this",
"expression",
"."
] | def iter_dnf_clauses(self):
"""Iterate over the DNF clauses in this expression.
.. code-block:: python
>>> from tt import BooleanExpression
>>> b = BooleanExpression('(A and ~B) or (C and D and E)')
>>> for clause in b.iter_dnf_clauses():
... print(c... | [
"def",
"iter_dnf_clauses",
"(",
"self",
")",
":",
"for",
"node",
"in",
"self",
".",
"_tree",
".",
"iter_dnf_clauses",
"(",
")",
":",
"yield",
"BooleanExpression",
"(",
"node",
")"
] | https://github.com/welchbj/tt/blob/13920b0559561353993750872c6eba37411a33b7/tt/expressions/bexpr.py#L739-L761 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py | python | _macosx_vers | (_cache=[]) | return _cache[0] | [] | def _macosx_vers(_cache=[]):
if not _cache:
version = platform.mac_ver()[0]
# fallback for MacPorts
if version == '':
plist = '/System/Library/CoreServices/SystemVersion.plist'
if os.path.exists(plist):
if hasattr(plistlib, 'readPlist'):
... | [
"def",
"_macosx_vers",
"(",
"_cache",
"=",
"[",
"]",
")",
":",
"if",
"not",
"_cache",
":",
"version",
"=",
"platform",
".",
"mac_ver",
"(",
")",
"[",
"0",
"]",
"# fallback for MacPorts",
"if",
"version",
"==",
"''",
":",
"plist",
"=",
"'/System/Library/C... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py#L442-L455 | |||
numba/numba | bf480b9e0da858a65508c2b17759a72ee6a44c51 | numba/cuda/libdevice.py | python | ceilf | (x) | See https://docs.nvidia.com/cuda/libdevice-users-guide/__nv_ceilf.html
:param x: Argument.
:type x: float32
:rtype: float32 | See https://docs.nvidia.com/cuda/libdevice-users-guide/__nv_ceilf.html | [
"See",
"https",
":",
"//",
"docs",
".",
"nvidia",
".",
"com",
"/",
"cuda",
"/",
"libdevice",
"-",
"users",
"-",
"guide",
"/",
"__nv_ceilf",
".",
"html"
] | def ceilf(x):
"""
See https://docs.nvidia.com/cuda/libdevice-users-guide/__nv_ceilf.html
:param x: Argument.
:type x: float32
:rtype: float32
""" | [
"def",
"ceilf",
"(",
"x",
")",
":"
] | https://github.com/numba/numba/blob/bf480b9e0da858a65508c2b17759a72ee6a44c51/numba/cuda/libdevice.py#L219-L226 | ||
marinho/geraldo | 868ebdce67176d9b6205cddc92476f642c783fff | site/newsite/site-geraldo/django/db/models/sql/query.py | python | Query.add_fields | (self, field_names, allow_m2m=True) | Adds the given (model) fields to the select set. The field names are
added in the order specified. | Adds the given (model) fields to the select set. The field names are
added in the order specified. | [
"Adds",
"the",
"given",
"(",
"model",
")",
"fields",
"to",
"the",
"select",
"set",
".",
"The",
"field",
"names",
"are",
"added",
"in",
"the",
"order",
"specified",
"."
] | def add_fields(self, field_names, allow_m2m=True):
"""
Adds the given (model) fields to the select set. The field names are
added in the order specified.
"""
alias = self.get_initial_alias()
opts = self.get_meta()
try:
for name in field_names:
... | [
"def",
"add_fields",
"(",
"self",
",",
"field_names",
",",
"allow_m2m",
"=",
"True",
")",
":",
"alias",
"=",
"self",
".",
"get_initial_alias",
"(",
")",
"opts",
"=",
"self",
".",
"get_meta",
"(",
")",
"try",
":",
"for",
"name",
"in",
"field_names",
":"... | https://github.com/marinho/geraldo/blob/868ebdce67176d9b6205cddc92476f642c783fff/site/newsite/site-geraldo/django/db/models/sql/query.py#L1518-L1548 | ||
pimutils/khal | 62d2aa2a7f018436b1baae0dbc3e35cfac8d0faf | khal/khalendar/khalendar.py | python | CalendarCollection._db_update | (self, calendar: str) | implements the actual db update on a per calendar base | implements the actual db update on a per calendar base | [
"implements",
"the",
"actual",
"db",
"update",
"on",
"a",
"per",
"calendar",
"base"
] | def _db_update(self, calendar: str):
"""implements the actual db update on a per calendar base"""
local_ctag = self._local_ctag(calendar)
db_hrefs = {href for href, etag in self._backend.list(calendar)}
storage_hrefs = set()
bdays = self._calendars[calendar].get('ctype') == 'birt... | [
"def",
"_db_update",
"(",
"self",
",",
"calendar",
":",
"str",
")",
":",
"local_ctag",
"=",
"self",
".",
"_local_ctag",
"(",
"calendar",
")",
"db_hrefs",
"=",
"{",
"href",
"for",
"href",
",",
"etag",
"in",
"self",
".",
"_backend",
".",
"list",
"(",
"... | https://github.com/pimutils/khal/blob/62d2aa2a7f018436b1baae0dbc3e35cfac8d0faf/khal/khalendar/khalendar.py#L304-L328 | ||
heronsystems/adeptRL | d8554d134c1dfee6659baafd886684351c1dd982 | adept/network/modular_network.py | python | ModularNetwork._validate_shapes | (self) | Ensures SubModule graph is valid.
:return: | Ensures SubModule graph is valid.
:return: | [
"Ensures",
"SubModule",
"graph",
"is",
"valid",
".",
":",
"return",
":"
] | def _validate_shapes(self):
"""
Ensures SubModule graph is valid.
:return:
"""
# non feature dims of source nets match non feature dim of body
# Doesn't matter if converting to 1D
if self.body.dim > 1:
for submod in self.source_nets.values():
... | [
"def",
"_validate_shapes",
"(",
"self",
")",
":",
"# non feature dims of source nets match non feature dim of body",
"# Doesn't matter if converting to 1D",
"if",
"self",
".",
"body",
".",
"dim",
">",
"1",
":",
"for",
"submod",
"in",
"self",
".",
"source_nets",
".",
"... | https://github.com/heronsystems/adeptRL/blob/d8554d134c1dfee6659baafd886684351c1dd982/adept/network/modular_network.py#L113-L150 | ||
gramps-project/gramps | 04d4651a43eb210192f40a9f8c2bad8ee8fa3753 | gramps/gen/plug/report/_book.py | python | Book.set_format_name | (self, format_name) | Set the format name for the Book.
@param format_name: name of the format to set.
@type format_name: str | Set the format name for the Book. | [
"Set",
"the",
"format",
"name",
"for",
"the",
"Book",
"."
] | def set_format_name(self, format_name):
"""
Set the format name for the Book.
@param format_name: name of the format to set.
@type format_name: str
"""
self.paper_format = format_name | [
"def",
"set_format_name",
"(",
"self",
",",
"format_name",
")",
":",
"self",
".",
"paper_format",
"=",
"format_name"
] | https://github.com/gramps-project/gramps/blob/04d4651a43eb210192f40a9f8c2bad8ee8fa3753/gramps/gen/plug/report/_book.py#L382-L388 | ||
trailofbits/manticore | b050fdf0939f6c63f503cdf87ec0ab159dd41159 | manticore/platforms/linux_syscall_stubs.py | python | SyscallStubs.sys_name_to_handle_at | (self, dfd, name, handle, mnt_id, flag) | return self.simple_returns() | AUTOGENERATED UNIMPLEMENTED STUB | AUTOGENERATED UNIMPLEMENTED STUB | [
"AUTOGENERATED",
"UNIMPLEMENTED",
"STUB"
] | def sys_name_to_handle_at(self, dfd, name, handle, mnt_id, flag) -> int:
""" AUTOGENERATED UNIMPLEMENTED STUB """
return self.simple_returns() | [
"def",
"sys_name_to_handle_at",
"(",
"self",
",",
"dfd",
",",
"name",
",",
"handle",
",",
"mnt_id",
",",
"flag",
")",
"->",
"int",
":",
"return",
"self",
".",
"simple_returns",
"(",
")"
] | https://github.com/trailofbits/manticore/blob/b050fdf0939f6c63f503cdf87ec0ab159dd41159/manticore/platforms/linux_syscall_stubs.py#L602-L604 | |
apachecn/AiLearning | 228b62a905a2a9bf6066f65c16d53056b10ec610 | src/py2.x/dl/bp.py | python | Node.append_upstream_connection | (self, conn) | Desc:
添加此节点的上游节点的连接
Args:
conn ---- 当前节点的上游节点的连接的 list
Returns:
None | Desc:
添加此节点的上游节点的连接
Args:
conn ---- 当前节点的上游节点的连接的 list
Returns:
None | [
"Desc",
":",
"添加此节点的上游节点的连接",
"Args",
":",
"conn",
"----",
"当前节点的上游节点的连接的",
"list",
"Returns",
":",
"None"
] | def append_upstream_connection(self, conn):
'''
Desc:
添加此节点的上游节点的连接
Args:
conn ---- 当前节点的上游节点的连接的 list
Returns:
None
'''
# 使用 list 的 append 方法来将 conn 中的节点添加到 upstream 中
self.upstream.append(conn) | [
"def",
"append_upstream_connection",
"(",
"self",
",",
"conn",
")",
":",
"# 使用 list 的 append 方法来将 conn 中的节点添加到 upstream 中",
"self",
".",
"upstream",
".",
"append",
"(",
"conn",
")"
] | https://github.com/apachecn/AiLearning/blob/228b62a905a2a9bf6066f65c16d53056b10ec610/src/py2.x/dl/bp.py#L73-L83 | ||
deepchem/deepchem | 054eb4b2b082e3df8e1a8e77f36a52137ae6e375 | deepchem/models/seqtoseq.py | python | SeqToSeq.fit_sequences | (self,
sequences,
max_checkpoints_to_keep=5,
checkpoint_interval=1000,
restore=False) | Train this model on a set of sequences
Parameters
----------
sequences: iterable
the training samples to fit to. Each sample should be
represented as a tuple of the form (input_sequence, output_sequence).
max_checkpoints_to_keep: int
the maximum number of checkpoints to keep. Older ... | Train this model on a set of sequences | [
"Train",
"this",
"model",
"on",
"a",
"set",
"of",
"sequences"
] | def fit_sequences(self,
sequences,
max_checkpoints_to_keep=5,
checkpoint_interval=1000,
restore=False):
"""Train this model on a set of sequences
Parameters
----------
sequences: iterable
the training samples to fit t... | [
"def",
"fit_sequences",
"(",
"self",
",",
"sequences",
",",
"max_checkpoints_to_keep",
"=",
"5",
",",
"checkpoint_interval",
"=",
"1000",
",",
"restore",
"=",
"False",
")",
":",
"self",
".",
"fit_generator",
"(",
"self",
".",
"_generate_batches",
"(",
"sequenc... | https://github.com/deepchem/deepchem/blob/054eb4b2b082e3df8e1a8e77f36a52137ae6e375/deepchem/models/seqtoseq.py#L222-L246 | ||
angr/angr | 4b04d56ace135018083d36d9083805be8146688b | angr/analyses/decompiler/condition_processor.py | python | ConditionProcessor.remove_claripy_bool_asts | (self, node, memo=None) | [] | def remove_claripy_bool_asts(self, node, memo=None):
# Convert claripy Bool ASTs to AIL expressions
if memo is None:
memo = {}
if isinstance(node, SequenceNode):
new_nodes = [ ]
for n in node.nodes:
new_node = self.remove_claripy_bool_asts(n... | [
"def",
"remove_claripy_bool_asts",
"(",
"self",
",",
"node",
",",
"memo",
"=",
"None",
")",
":",
"# Convert claripy Bool ASTs to AIL expressions",
"if",
"memo",
"is",
"None",
":",
"memo",
"=",
"{",
"}",
"if",
"isinstance",
"(",
"node",
",",
"SequenceNode",
")"... | https://github.com/angr/angr/blob/4b04d56ace135018083d36d9083805be8146688b/angr/analyses/decompiler/condition_processor.py#L220-L296 | ||||
Foair/course-crawler | 78aa42c4688070b96eb76a5ecbbc61bcd48128e6 | mooc/icourse163.py | python | get_resource | (term_id) | 获取各种资源 | 获取各种资源 | [
"获取各种资源"
] | def get_resource(term_id):
"""获取各种资源"""
outline = Outline()
counter = Counter()
video_list = []
pdf_list = []
rich_text_list = []
post_data = {'callCount': '1', 'scriptSessionId': '${scriptSessionId}190', 'c0-scriptName': 'CourseBean',
'c0-methodName': 'getMocTermDto', 'c... | [
"def",
"get_resource",
"(",
"term_id",
")",
":",
"outline",
"=",
"Outline",
"(",
")",
"counter",
"=",
"Counter",
"(",
")",
"video_list",
"=",
"[",
"]",
"pdf_list",
"=",
"[",
"]",
"rich_text_list",
"=",
"[",
"]",
"post_data",
"=",
"{",
"'callCount'",
":... | https://github.com/Foair/course-crawler/blob/78aa42c4688070b96eb76a5ecbbc61bcd48128e6/mooc/icourse163.py#L82-L159 | ||
pyparallel/pyparallel | 11e8c6072d48c8f13641925d17b147bf36ee0ba3 | Lib/socket.py | python | socket.accept | (self) | return sock, addr | accept() -> (socket object, address info)
Wait for an incoming connection. Return a new socket
representing the connection, and the address of the client.
For IP sockets, the address info is a pair (hostaddr, port). | accept() -> (socket object, address info) | [
"accept",
"()",
"-",
">",
"(",
"socket",
"object",
"address",
"info",
")"
] | def accept(self):
"""accept() -> (socket object, address info)
Wait for an incoming connection. Return a new socket
representing the connection, and the address of the client.
For IP sockets, the address info is a pair (hostaddr, port).
"""
fd, addr = self._accept()
... | [
"def",
"accept",
"(",
"self",
")",
":",
"fd",
",",
"addr",
"=",
"self",
".",
"_accept",
"(",
")",
"sock",
"=",
"socket",
"(",
"self",
".",
"family",
",",
"self",
".",
"type",
",",
"self",
".",
"proto",
",",
"fileno",
"=",
"fd",
")",
"# Issue #799... | https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/socket.py#L128-L142 | |
gevent/gevent | ae2cb5aeb2aea8987efcb90a4c50ca4e1ee12c31 | src/gevent/hub.py | python | Hub.join | (self, timeout=None) | return False | Wait for the event loop to finish. Exits only when there
are no more spawned greenlets, started servers, active
timeouts or watchers.
.. caution:: This doesn't clean up all resources associated
with the hub. For that, see :meth:`destroy`.
:param float timeout: If *timeout* i... | Wait for the event loop to finish. Exits only when there
are no more spawned greenlets, started servers, active
timeouts or watchers. | [
"Wait",
"for",
"the",
"event",
"loop",
"to",
"finish",
".",
"Exits",
"only",
"when",
"there",
"are",
"no",
"more",
"spawned",
"greenlets",
"started",
"servers",
"active",
"timeouts",
"or",
"watchers",
"."
] | def join(self, timeout=None):
"""
Wait for the event loop to finish. Exits only when there
are no more spawned greenlets, started servers, active
timeouts or watchers.
.. caution:: This doesn't clean up all resources associated
with the hub. For that, see :meth:`destr... | [
"def",
"join",
"(",
"self",
",",
"timeout",
"=",
"None",
")",
":",
"assert",
"getcurrent",
"(",
")",
"is",
"self",
".",
"parent",
",",
"\"only possible from the MAIN greenlet\"",
"if",
"self",
".",
"dead",
":",
"return",
"True",
"waiter",
"=",
"Waiter",
"(... | https://github.com/gevent/gevent/blob/ae2cb5aeb2aea8987efcb90a4c50ca4e1ee12c31/src/gevent/hub.py#L709-L759 | |
grnet/synnefo | d06ec8c7871092131cdaabf6b03ed0b504c93e43 | snf-tools/synnefo_tools/burnin/cyclades_common.py | python | CycladesTests._insist_on_tcp_connection | (self, family, host, port) | return self._try_until_timeout_expires(opmsg, check_fun) | Insist on tcp connection | Insist on tcp connection | [
"Insist",
"on",
"tcp",
"connection"
] | def _insist_on_tcp_connection(self, family, host, port):
"""Insist on tcp connection"""
def check_fun():
"""Get a connected socket from the specified family to host:port"""
sock = None
for res in socket.getaddrinfo(host, port, family,
... | [
"def",
"_insist_on_tcp_connection",
"(",
"self",
",",
"family",
",",
"host",
",",
"port",
")",
":",
"def",
"check_fun",
"(",
")",
":",
"\"\"\"Get a connected socket from the specified family to host:port\"\"\"",
"sock",
"=",
"None",
"for",
"res",
"in",
"socket",
"."... | https://github.com/grnet/synnefo/blob/d06ec8c7871092131cdaabf6b03ed0b504c93e43/snf-tools/synnefo_tools/burnin/cyclades_common.py#L479-L507 | |
LexPredict/lexpredict-contraxsuite | 1d5a2540d31f8f3f1adc442cfa13a7c007319899 | sdk/python/sdk/openapi_client/model/set_project_documents_status_request.py | python | SetProjectDocumentsStatusRequest._from_openapi_data | (cls, *args, **kwargs) | return self | SetProjectDocumentsStatusRequest - a model defined in OpenAPI
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
... | SetProjectDocumentsStatusRequest - a model defined in OpenAPI | [
"SetProjectDocumentsStatusRequest",
"-",
"a",
"model",
"defined",
"in",
"OpenAPI"
] | def _from_openapi_data(cls, *args, **kwargs): # noqa: E501
"""SetProjectDocumentsStatusRequest - a model defined in OpenAPI
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
... | [
"def",
"_from_openapi_data",
"(",
"cls",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# noqa: E501",
"_check_type",
"=",
"kwargs",
".",
"pop",
"(",
"'_check_type'",
",",
"True",
")",
"_spec_property_naming",
"=",
"kwargs",
".",
"pop",
"(",
"'_spec... | https://github.com/LexPredict/lexpredict-contraxsuite/blob/1d5a2540d31f8f3f1adc442cfa13a7c007319899/sdk/python/sdk/openapi_client/model/set_project_documents_status_request.py#L109-L182 | |
IronLanguages/ironpython3 | 7a7bb2a872eeab0d1009fc8a6e24dca43f65b693 | Src/StdLib/Lib/xml/dom/xmlbuilder.py | python | DOMBuilder.setFeature | (self, name, state) | [] | def setFeature(self, name, state):
if self.supportsFeature(name):
state = state and 1 or 0
try:
settings = self._settings[(_name_xform(name), state)]
except KeyError:
raise xml.dom.NotSupportedErr(
"unsupported feature: %r" ... | [
"def",
"setFeature",
"(",
"self",
",",
"name",
",",
"state",
")",
":",
"if",
"self",
".",
"supportsFeature",
"(",
"name",
")",
":",
"state",
"=",
"state",
"and",
"1",
"or",
"0",
"try",
":",
"settings",
"=",
"self",
".",
"_settings",
"[",
"(",
"_nam... | https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/xml/dom/xmlbuilder.py#L75-L87 | ||||
beer-garden/beer-garden | 7b1b7dd64ab1f19f370451c9438362d11f3a06e4 | src/app/beer_garden/local_plugins/manager.py | python | PluginManager.get_runners | (self) | return [the_runner.state() for the_runner in self._runners] | Get a representation of current runners. | Get a representation of current runners. | [
"Get",
"a",
"representation",
"of",
"current",
"runners",
"."
] | def get_runners(self) -> List[Runner]:
"""Get a representation of current runners."""
return [the_runner.state() for the_runner in self._runners] | [
"def",
"get_runners",
"(",
"self",
")",
"->",
"List",
"[",
"Runner",
"]",
":",
"return",
"[",
"the_runner",
".",
"state",
"(",
")",
"for",
"the_runner",
"in",
"self",
".",
"_runners",
"]"
] | https://github.com/beer-garden/beer-garden/blob/7b1b7dd64ab1f19f370451c9438362d11f3a06e4/src/app/beer_garden/local_plugins/manager.py#L239-L241 | |
JacquesLucke/animation_nodes | b1e3ace8dcb0a771fd882fc3ac4e490b009fa0d1 | animation_nodes/sockets/info.py | python | hasAllowedInputDataTypes | (input) | return len(_socketInfo.allowedInputDataTypes[input]) > 0 | [] | def hasAllowedInputDataTypes(input):
return len(_socketInfo.allowedInputDataTypes[input]) > 0 | [
"def",
"hasAllowedInputDataTypes",
"(",
"input",
")",
":",
"return",
"len",
"(",
"_socketInfo",
".",
"allowedInputDataTypes",
"[",
"input",
"]",
")",
">",
"0"
] | https://github.com/JacquesLucke/animation_nodes/blob/b1e3ace8dcb0a771fd882fc3ac4e490b009fa0d1/animation_nodes/sockets/info.py#L166-L167 | |||
xtiankisutsa/MARA_Framework | ac4ac88bfd38f33ae8780a606ed09ab97177c562 | tools/androguard/androguard/core/analysis/analysis.py | python | BasicBlocks.get | (self) | :rtype: return each basic block (:class:`DVMBasicBlock` object) | :rtype: return each basic block (:class:`DVMBasicBlock` object) | [
":",
"rtype",
":",
"return",
"each",
"basic",
"block",
"(",
":",
"class",
":",
"DVMBasicBlock",
"object",
")"
] | def get(self):
"""
:rtype: return each basic block (:class:`DVMBasicBlock` object)
"""
for i in self.bb:
yield i | [
"def",
"get",
"(",
"self",
")",
":",
"for",
"i",
"in",
"self",
".",
"bb",
":",
"yield",
"i"
] | https://github.com/xtiankisutsa/MARA_Framework/blob/ac4ac88bfd38f33ae8780a606ed09ab97177c562/tools/androguard/androguard/core/analysis/analysis.py#L301-L306 | ||
thiagopena/djangoSIGE | e32186b27bfd8acf21b0fa400e699cb5c73e5433 | djangosige/apps/compras/views/compras.py | python | EditarCompraView.get_context_data | (self, **kwargs) | return self.view_context(context) | [] | def get_context_data(self, **kwargs):
context = super(EditarCompraView, self).get_context_data(**kwargs)
return self.view_context(context) | [
"def",
"get_context_data",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"context",
"=",
"super",
"(",
"EditarCompraView",
",",
"self",
")",
".",
"get_context_data",
"(",
"*",
"*",
"kwargs",
")",
"return",
"self",
".",
"view_context",
"(",
"context",
"... | https://github.com/thiagopena/djangoSIGE/blob/e32186b27bfd8acf21b0fa400e699cb5c73e5433/djangosige/apps/compras/views/compras.py#L220-L222 | |||
osmr/imgclsmob | f2993d3ce73a2f7ddba05da3891defb08547d504 | gluon/gluoncv2/models/icnet.py | python | icnet_resnetd50b_cityscapes | (pretrained_backbone=False, classes=19, aux=True, **kwargs) | return get_icnet(backbones=backbones, backbones_out_channels=backbones_out_channels, classes=classes, aux=aux,
model_name="icnet_resnetd50b_cityscapes", **kwargs) | ICNet model on the base of ResNet(D)-50b for Cityscapes from 'ICNet for Real-Time Semantic Segmentation on
High-Resolution Images,' https://arxiv.org/abs/1704.08545.
Parameters:
----------
pretrained_backbone : bool, default False
Whether to load the pretrained weights for feature extractor.
... | ICNet model on the base of ResNet(D)-50b for Cityscapes from 'ICNet for Real-Time Semantic Segmentation on
High-Resolution Images,' https://arxiv.org/abs/1704.08545. | [
"ICNet",
"model",
"on",
"the",
"base",
"of",
"ResNet",
"(",
"D",
")",
"-",
"50b",
"for",
"Cityscapes",
"from",
"ICNet",
"for",
"Real",
"-",
"Time",
"Semantic",
"Segmentation",
"on",
"High",
"-",
"Resolution",
"Images",
"https",
":",
"//",
"arxiv",
".",
... | def icnet_resnetd50b_cityscapes(pretrained_backbone=False, classes=19, aux=True, **kwargs):
"""
ICNet model on the base of ResNet(D)-50b for Cityscapes from 'ICNet for Real-Time Semantic Segmentation on
High-Resolution Images,' https://arxiv.org/abs/1704.08545.
Parameters:
----------
pretrained... | [
"def",
"icnet_resnetd50b_cityscapes",
"(",
"pretrained_backbone",
"=",
"False",
",",
"classes",
"=",
"19",
",",
"aux",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"backbone",
"=",
"resnetd50b",
"(",
"pretrained",
"=",
"pretrained_backbone",
",",
"ordinary_... | https://github.com/osmr/imgclsmob/blob/f2993d3ce73a2f7ddba05da3891defb08547d504/gluon/gluoncv2/models/icnet.py#L367-L391 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/celery/fixups/django.py | python | DjangoWorkerFixup.on_task_prerun | (self, sender, **kwargs) | Called before every task. | Called before every task. | [
"Called",
"before",
"every",
"task",
"."
] | def on_task_prerun(self, sender, **kwargs):
"""Called before every task."""
if not getattr(sender.request, 'is_eager', False):
self.close_database() | [
"def",
"on_task_prerun",
"(",
"self",
",",
"sender",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"getattr",
"(",
"sender",
".",
"request",
",",
"'is_eager'",
",",
"False",
")",
":",
"self",
".",
"close_database",
"(",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/celery/fixups/django.py#L163-L166 | ||
BrewPi/brewpi-script | 85f693ab5e3395cd10cc2d991ebcddc933c7d5cd | expandLogMessage.py | python | getVersion | () | return 0 | [] | def getVersion():
hFile = open(logMessagesFile)
for line in hFile:
if 'BREWPI_LOG_MESSAGES_VERSION ' in line:
splitLine = line.split('BREWPI_LOG_MESSAGES_VERSION')
return int(splitLine[1]) # return version number
print "ERROR: could not find version number in log messages he... | [
"def",
"getVersion",
"(",
")",
":",
"hFile",
"=",
"open",
"(",
"logMessagesFile",
")",
"for",
"line",
"in",
"hFile",
":",
"if",
"'BREWPI_LOG_MESSAGES_VERSION '",
"in",
"line",
":",
"splitLine",
"=",
"line",
".",
"split",
"(",
"'BREWPI_LOG_MESSAGES_VERSION'",
"... | https://github.com/BrewPi/brewpi-script/blob/85f693ab5e3395cd10cc2d991ebcddc933c7d5cd/expandLogMessage.py#L53-L60 | |||
LikeLy-Journey/SegmenTron | 4bc605eedde7d680314f63d329277b73f83b1c5f | segmentron/models/fpenet.py | python | conv3x3 | (in_planes, out_planes, stride=1, padding=1, dilation=1, groups=1, bias=False) | return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=padding, dilation=dilation, groups=groups,bias=bias) | 3x3 convolution with padding | 3x3 convolution with padding | [
"3x3",
"convolution",
"with",
"padding"
] | def conv3x3(in_planes, out_planes, stride=1, padding=1, dilation=1, groups=1, bias=False):
"""3x3 convolution with padding"""
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=padding, dilation=dilation, groups=groups,bias=bias) | [
"def",
"conv3x3",
"(",
"in_planes",
",",
"out_planes",
",",
"stride",
"=",
"1",
",",
"padding",
"=",
"1",
",",
"dilation",
"=",
"1",
",",
"groups",
"=",
"1",
",",
"bias",
"=",
"False",
")",
":",
"return",
"nn",
".",
"Conv2d",
"(",
"in_planes",
",",... | https://github.com/LikeLy-Journey/SegmenTron/blob/4bc605eedde7d680314f63d329277b73f83b1c5f/segmentron/models/fpenet.py#L121-L124 | |
jiangxinyang227/NLP-Project | b11f67d8962f40e17990b4fc4551b0ea5496881c | dialogue_generator/conv_seq2seq/train.py | python | Trainer.create_model | (self) | return model | 根据config文件选择对应的模型,并初始化
:return: | 根据config文件选择对应的模型,并初始化
:return: | [
"根据config文件选择对应的模型,并初始化",
":",
"return",
":"
] | def create_model(self):
"""
根据config文件选择对应的模型,并初始化
:return:
"""
model = Seq2SeqConv(config=self.config, vocab_size=self.vocab_size,
word_vectors=self.word_vectors)
return model | [
"def",
"create_model",
"(",
"self",
")",
":",
"model",
"=",
"Seq2SeqConv",
"(",
"config",
"=",
"self",
".",
"config",
",",
"vocab_size",
"=",
"self",
".",
"vocab_size",
",",
"word_vectors",
"=",
"self",
".",
"word_vectors",
")",
"return",
"model"
] | https://github.com/jiangxinyang227/NLP-Project/blob/b11f67d8962f40e17990b4fc4551b0ea5496881c/dialogue_generator/conv_seq2seq/train.py#L42-L51 | |
HonglinChu/SiamTrackers | 8471660b14f970578a43f077b28207d44a27e867 | SiamFCpp/SiamFCpp-video_analyst/bin/docs/TEMPLATES/contrib_module/contrib_module_base.py | python | ContribModuleBase.update_params | (self) | r"""
an interface for update params | r"""
an interface for update params | [
"r",
"an",
"interface",
"for",
"update",
"params"
] | def update_params(self) -> None:
r"""
an interface for update params
""" | [
"def",
"update_params",
"(",
"self",
")",
"->",
"None",
":"
] | https://github.com/HonglinChu/SiamTrackers/blob/8471660b14f970578a43f077b28207d44a27e867/SiamFCpp/SiamFCpp-video_analyst/bin/docs/TEMPLATES/contrib_module/contrib_module_base.py#L62-L65 | ||
zaiweizhang/H3DNet | e69f2855634807b37ae12e6db5963c924e64d3e7 | models/ap_helper.py | python | flip_axis_to_camera | (pc) | return pc2 | Flip X-right,Y-forward,Z-up to X-right,Y-down,Z-forward
Input and output are both (N,3) array | Flip X-right,Y-forward,Z-up to X-right,Y-down,Z-forward
Input and output are both (N,3) array | [
"Flip",
"X",
"-",
"right",
"Y",
"-",
"forward",
"Z",
"-",
"up",
"to",
"X",
"-",
"right",
"Y",
"-",
"down",
"Z",
"-",
"forward",
"Input",
"and",
"output",
"are",
"both",
"(",
"N",
"3",
")",
"array"
] | def flip_axis_to_camera(pc):
''' Flip X-right,Y-forward,Z-up to X-right,Y-down,Z-forward
Input and output are both (N,3) array
'''
pc2 = np.copy(pc)
pc2[...,[0,1,2]] = pc2[...,[0,2,1]] # cam X,Y,Z = depth X,-Z,Y
pc2[...,1] *= -1
return pc2 | [
"def",
"flip_axis_to_camera",
"(",
"pc",
")",
":",
"pc2",
"=",
"np",
".",
"copy",
"(",
"pc",
")",
"pc2",
"[",
"...",
",",
"[",
"0",
",",
"1",
",",
"2",
"]",
"]",
"=",
"pc2",
"[",
"...",
",",
"[",
"0",
",",
"2",
",",
"1",
"]",
"]",
"# cam ... | https://github.com/zaiweizhang/H3DNet/blob/e69f2855634807b37ae12e6db5963c924e64d3e7/models/ap_helper.py#L22-L29 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.