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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
VainF/DeepLabV3Plus-Pytorch | e0ee4769d676e093d56b2ddad963300c4b61c0b1 | network/backbone/hrnetv2.py | python | Bottleneck.forward | (self, x) | return out | [] | def forward(self, x):
identity = x
out = self.conv1(x)
out = self.bn1(out)
out = self.relu(out)
out = self.conv2(out)
out = self.bn2(out)
out = self.relu(out)
out = self.conv3(out)
out = self.bn3(out)
if self.downsample is not None:
... | [
"def",
"forward",
"(",
"self",
",",
"x",
")",
":",
"identity",
"=",
"x",
"out",
"=",
"self",
".",
"conv1",
"(",
"x",
")",
"out",
"=",
"self",
".",
"bn1",
"(",
"out",
")",
"out",
"=",
"self",
".",
"relu",
"(",
"out",
")",
"out",
"=",
"self",
... | https://github.com/VainF/DeepLabV3Plus-Pytorch/blob/e0ee4769d676e093d56b2ddad963300c4b61c0b1/network/backbone/hrnetv2.py#L33-L51 | |||
enthought/traitsui | b7c38c7a47bf6ae7971f9ddab70c8a358647dd25 | traitsui/value_tree.py | python | SingleValueTreeNodeObject.tno_set_label | (self, node, label) | Sets the label for a specified object. | Sets the label for a specified object. | [
"Sets",
"the",
"label",
"for",
"a",
"specified",
"object",
"."
] | def tno_set_label(self, node, label):
"""Sets the label for a specified object."""
if label == "?":
label = ""
self.label = label | [
"def",
"tno_set_label",
"(",
"self",
",",
"node",
",",
"label",
")",
":",
"if",
"label",
"==",
"\"?\"",
":",
"label",
"=",
"\"\"",
"self",
".",
"label",
"=",
"label"
] | https://github.com/enthought/traitsui/blob/b7c38c7a47bf6ae7971f9ddab70c8a358647dd25/traitsui/value_tree.py#L94-L98 | ||
edisonlz/fastor | 342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3 | base/site-packages/django/contrib/sessions/backends/base.py | python | SessionBase.exists | (self, session_key) | Returns True if the given session_key already exists. | Returns True if the given session_key already exists. | [
"Returns",
"True",
"if",
"the",
"given",
"session_key",
"already",
"exists",
"."
] | def exists(self, session_key):
"""
Returns True if the given session_key already exists.
"""
raise NotImplementedError | [
"def",
"exists",
"(",
"self",
",",
"session_key",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/django/contrib/sessions/backends/base.py#L283-L287 | ||
tipam/pi3d | 1f1c822dc3ac58344ad2d5468978d62e51710df4 | pi3d/Shape.py | python | Shape.set_material | (self, material) | Wrapper for setting material shade in each Buffer object.
Arguments:
*material*
tuple (rgb) if any values > 1 then assume scale 0-255. If passed (rgba)
then set alpha for this shape. | Wrapper for setting material shade in each Buffer object. | [
"Wrapper",
"for",
"setting",
"material",
"shade",
"in",
"each",
"Buffer",
"object",
"."
] | def set_material(self, material):
"""Wrapper for setting material shade in each Buffer object.
Arguments:
*material*
tuple (rgb) if any values > 1 then assume scale 0-255. If passed (rgba)
then set alpha for this shape.
"""
if any((v > 1 for v in material)):
material = tup... | [
"def",
"set_material",
"(",
"self",
",",
"material",
")",
":",
"if",
"any",
"(",
"(",
"v",
">",
"1",
"for",
"v",
"in",
"material",
")",
")",
":",
"material",
"=",
"tuple",
"(",
"v",
"/",
"255.0",
"for",
"v",
"in",
"material",
")",
"if",
"len",
... | https://github.com/tipam/pi3d/blob/1f1c822dc3ac58344ad2d5468978d62e51710df4/pi3d/Shape.py#L292-L305 | ||
F8LEFT/DecLLVM | d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c | python/idaapi.py | python | as_int32 | (v) | return -((~v & 0xffffffff)+1) | Returns a number as a signed int32 number | Returns a number as a signed int32 number | [
"Returns",
"a",
"number",
"as",
"a",
"signed",
"int32",
"number"
] | def as_int32(v):
"""
Returns a number as a signed int32 number
"""
return -((~v & 0xffffffff)+1) | [
"def",
"as_int32",
"(",
"v",
")",
":",
"return",
"-",
"(",
"(",
"~",
"v",
"&",
"0xffffffff",
")",
"+",
"1",
")"
] | https://github.com/F8LEFT/DecLLVM/blob/d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c/python/idaapi.py#L497-L501 | |
googleads/google-ads-python | 2a1d6062221f6aad1992a6bcca0e7e4a93d2db86 | google/ads/googleads/v9/services/services/campaign_extension_setting_service/client.py | python | CampaignExtensionSettingServiceClient.parse_campaign_extension_setting_path | (path: str) | return m.groupdict() if m else {} | Parse a campaign_extension_setting path into its component segments. | Parse a campaign_extension_setting path into its component segments. | [
"Parse",
"a",
"campaign_extension_setting",
"path",
"into",
"its",
"component",
"segments",
"."
] | def parse_campaign_extension_setting_path(path: str) -> Dict[str, str]:
"""Parse a campaign_extension_setting path into its component segments."""
m = re.match(
r"^customers/(?P<customer_id>.+?)/campaignExtensionSettings/(?P<campaign_id>.+?)~(?P<extension_type>.+?)$",
path,
... | [
"def",
"parse_campaign_extension_setting_path",
"(",
"path",
":",
"str",
")",
"->",
"Dict",
"[",
"str",
",",
"str",
"]",
":",
"m",
"=",
"re",
".",
"match",
"(",
"r\"^customers/(?P<customer_id>.+?)/campaignExtensionSettings/(?P<campaign_id>.+?)~(?P<extension_type>.+?)$\"",
... | https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v9/services/services/campaign_extension_setting_service/client.py#L210-L216 | |
srusskih/SublimeJEDI | 8a5054f0a053c8a8170c06c56216245240551d54 | dependencies/jedi/parser_utils.py | python | clean_scope_docstring | (scope_node) | return '' | Returns a cleaned version of the docstring token. | Returns a cleaned version of the docstring token. | [
"Returns",
"a",
"cleaned",
"version",
"of",
"the",
"docstring",
"token",
"."
] | def clean_scope_docstring(scope_node):
""" Returns a cleaned version of the docstring token. """
node = scope_node.get_doc_node()
if node is not None:
# TODO We have to check next leaves until there are no new
# leaves anymore that might be part of the docstring. A
# docstring can al... | [
"def",
"clean_scope_docstring",
"(",
"scope_node",
")",
":",
"node",
"=",
"scope_node",
".",
"get_doc_node",
"(",
")",
"if",
"node",
"is",
"not",
"None",
":",
"# TODO We have to check next leaves until there are no new",
"# leaves anymore that might be part of the docstring. ... | https://github.com/srusskih/SublimeJEDI/blob/8a5054f0a053c8a8170c06c56216245240551d54/dependencies/jedi/parser_utils.py#L97-L109 | |
reddit-archive/reddit | 753b17407e9a9dca09558526805922de24133d53 | r2/r2/controllers/api.py | python | ApiController.POST_set_subreddit_sticky | (self, form, jquery, thing, state, num,
timeout) | Set or unset a Link as the sticky in its subreddit.
`state` is a boolean that indicates whether to sticky or unsticky
this post - true to sticky, false to unsticky.
The `num` argument is optional, and only used when stickying a post.
It allows specifying a particular "slot" to ... | Set or unset a Link as the sticky in its subreddit.
`state` is a boolean that indicates whether to sticky or unsticky
this post - true to sticky, false to unsticky. | [
"Set",
"or",
"unset",
"a",
"Link",
"as",
"the",
"sticky",
"in",
"its",
"subreddit",
".",
"state",
"is",
"a",
"boolean",
"that",
"indicates",
"whether",
"to",
"sticky",
"or",
"unsticky",
"this",
"post",
"-",
"true",
"to",
"sticky",
"false",
"to",
"unstick... | def POST_set_subreddit_sticky(self, form, jquery, thing, state, num,
timeout):
"""Set or unset a Link as the sticky in its subreddit.
`state` is a boolean that indicates whether to sticky or unsticky
this post - true to sticky, false to unsticky.
The `num` argument ... | [
"def",
"POST_set_subreddit_sticky",
"(",
"self",
",",
"form",
",",
"jquery",
",",
"thing",
",",
"state",
",",
"num",
",",
"timeout",
")",
":",
"if",
"not",
"isinstance",
"(",
"thing",
",",
"Link",
")",
":",
"return",
"sr",
"=",
"thing",
".",
"subreddit... | https://github.com/reddit-archive/reddit/blob/753b17407e9a9dca09558526805922de24133d53/r2/r2/controllers/api.py#L1638-L1671 | ||
uwdata/termite-data-server | 1085571407c627bdbbd21c352e793fed65d09599 | web2py/gluon/contrib/aes.py | python | AES.mix_columns | (self, block) | MixColumns step. Mixes the values in each column | MixColumns step. Mixes the values in each column | [
"MixColumns",
"step",
".",
"Mixes",
"the",
"values",
"in",
"each",
"column"
] | def mix_columns(self, block):
"""MixColumns step. Mixes the values in each column"""
# Cache global multiplication tables (see below)
mul_by_2 = gf_mul_by_2
mul_by_3 = gf_mul_by_3
# Since we're dealing with a transposed matrix, columns are already
# sequential
f... | [
"def",
"mix_columns",
"(",
"self",
",",
"block",
")",
":",
"# Cache global multiplication tables (see below)",
"mul_by_2",
"=",
"gf_mul_by_2",
"mul_by_3",
"=",
"gf_mul_by_3",
"# Since we're dealing with a transposed matrix, columns are already",
"# sequential",
"for",
"i",
"in"... | https://github.com/uwdata/termite-data-server/blob/1085571407c627bdbbd21c352e793fed65d09599/web2py/gluon/contrib/aes.py#L213-L232 | ||
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/numpy/lib/mixins.py | python | _unary_method | (ufunc, name) | return func | Implement a unary special method with a ufunc. | Implement a unary special method with a ufunc. | [
"Implement",
"a",
"unary",
"special",
"method",
"with",
"a",
"ufunc",
"."
] | def _unary_method(ufunc, name):
"""Implement a unary special method with a ufunc."""
def func(self):
return ufunc(self)
func.__name__ = '__{}__'.format(name)
return func | [
"def",
"_unary_method",
"(",
"ufunc",
",",
"name",
")",
":",
"def",
"func",
"(",
"self",
")",
":",
"return",
"ufunc",
"(",
"self",
")",
"func",
".",
"__name__",
"=",
"'__{}__'",
".",
"format",
"(",
"name",
")",
"return",
"func"
] | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/numpy/lib/mixins.py#L55-L60 | |
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/video/v1/composition/__init__.py | python | CompositionContext.delete | (self) | return self._version.delete(method='DELETE', uri=self._uri, ) | Deletes the CompositionInstance
:returns: True if delete succeeds, False otherwise
:rtype: bool | Deletes the CompositionInstance | [
"Deletes",
"the",
"CompositionInstance"
] | def delete(self):
"""
Deletes the CompositionInstance
:returns: True if delete succeeds, False otherwise
:rtype: bool
"""
return self._version.delete(method='DELETE', uri=self._uri, ) | [
"def",
"delete",
"(",
"self",
")",
":",
"return",
"self",
".",
"_version",
".",
"delete",
"(",
"method",
"=",
"'DELETE'",
",",
"uri",
"=",
"self",
".",
"_uri",
",",
")"
] | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/video/v1/composition/__init__.py#L287-L294 | |
limodou/ulipad | 4c7d590234f39cac80bb1d36dca095b646e287fb | packages/winpdb/rpdb2.py | python | CConsole.__init__ | (
self,
session_manager,
stdin = None,
stdout = None,
fSplit = False
) | Constructor of CConsole
session_manager - session manager object.
stdin, stdout - redirection for IO.
fsplit - Set flag to True when Input and Ouput belong to different
panes. For example take a look at Winpdb. | Constructor of CConsole | [
"Constructor",
"of",
"CConsole"
] | def __init__(
self,
session_manager,
stdin = None,
stdout = None,
fSplit = False
):
"""
Constructor of CConsole
session_manager - session manager object.
stdin, stdout - redirection for IO.
... | [
"def",
"__init__",
"(",
"self",
",",
"session_manager",
",",
"stdin",
"=",
"None",
",",
"stdout",
"=",
"None",
",",
"fSplit",
"=",
"False",
")",
":",
"self",
".",
"m_ci",
"=",
"CConsoleInternal",
"(",
"session_manager",
",",
"stdin",
",",
"stdout",
",",
... | https://github.com/limodou/ulipad/blob/4c7d590234f39cac80bb1d36dca095b646e287fb/packages/winpdb/rpdb2.py#L1418-L1440 | ||
mesalock-linux/mesapy | ed546d59a21b36feb93e2309d5c6b75aa0ad95c9 | pypy/module/posix/interp_posix.py | python | pipe | (space) | return space.newtuple([space.newint(fd1), space.newint(fd2)]) | Create a pipe. Returns (read_end, write_end). | Create a pipe. Returns (read_end, write_end). | [
"Create",
"a",
"pipe",
".",
"Returns",
"(",
"read_end",
"write_end",
")",
"."
] | def pipe(space):
"Create a pipe. Returns (read_end, write_end)."
try:
fd1, fd2 = os.pipe()
except OSError as e:
raise wrap_oserror(space, e)
return space.newtuple([space.newint(fd1), space.newint(fd2)]) | [
"def",
"pipe",
"(",
"space",
")",
":",
"try",
":",
"fd1",
",",
"fd2",
"=",
"os",
".",
"pipe",
"(",
")",
"except",
"OSError",
"as",
"e",
":",
"raise",
"wrap_oserror",
"(",
"space",
",",
"e",
")",
"return",
"space",
".",
"newtuple",
"(",
"[",
"spac... | https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/pypy/module/posix/interp_posix.py#L605-L611 | |
larryhastings/gilectomy | 4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a | Lib/_pydecimal.py | python | Context.is_zero | (self, a) | return a.is_zero() | Return True if the operand is a zero; otherwise return False.
>>> ExtendedContext.is_zero(Decimal('0'))
True
>>> ExtendedContext.is_zero(Decimal('2.50'))
False
>>> ExtendedContext.is_zero(Decimal('-0E+2'))
True
>>> ExtendedContext.is_zero(1)
False
... | Return True if the operand is a zero; otherwise return False. | [
"Return",
"True",
"if",
"the",
"operand",
"is",
"a",
"zero",
";",
"otherwise",
"return",
"False",
"."
] | def is_zero(self, a):
"""Return True if the operand is a zero; otherwise return False.
>>> ExtendedContext.is_zero(Decimal('0'))
True
>>> ExtendedContext.is_zero(Decimal('2.50'))
False
>>> ExtendedContext.is_zero(Decimal('-0E+2'))
True
>>> ExtendedContext... | [
"def",
"is_zero",
"(",
"self",
",",
"a",
")",
":",
"a",
"=",
"_convert_other",
"(",
"a",
",",
"raiseit",
"=",
"True",
")",
"return",
"a",
".",
"is_zero",
"(",
")"
] | https://github.com/larryhastings/gilectomy/blob/4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a/Lib/_pydecimal.py#L4683-L4698 | |
wistbean/learn_python3_spider | 73c873f4845f4385f097e5057407d03dd37a117b | stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/_signals.py | python | isDefaultHandler | () | return signal.getsignal(signal.SIGCHLD) == signal.SIG_DFL | Determine whether the I{SIGCHLD} handler is the default or not. | Determine whether the I{SIGCHLD} handler is the default or not. | [
"Determine",
"whether",
"the",
"I",
"{",
"SIGCHLD",
"}",
"handler",
"is",
"the",
"default",
"or",
"not",
"."
] | def isDefaultHandler():
"""
Determine whether the I{SIGCHLD} handler is the default or not.
"""
return signal.getsignal(signal.SIGCHLD) == signal.SIG_DFL | [
"def",
"isDefaultHandler",
"(",
")",
":",
"return",
"signal",
".",
"getsignal",
"(",
"signal",
".",
"SIGCHLD",
")",
"==",
"signal",
".",
"SIG_DFL"
] | https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/_signals.py#L64-L68 | |
triaquae/triaquae | bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9 | TriAquae/models/django/utils/datastructures.py | python | MultiValueDict.setlist | (self, key, list_) | [] | def setlist(self, key, list_):
super(MultiValueDict, self).__setitem__(key, list_) | [
"def",
"setlist",
"(",
"self",
",",
"key",
",",
"list_",
")",
":",
"super",
"(",
"MultiValueDict",
",",
"self",
")",
".",
"__setitem__",
"(",
"key",
",",
"list_",
")"
] | https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/django/utils/datastructures.py#L356-L357 | ||||
sethmlarson/virtualbox-python | 984a6e2cb0e8996f4df40f4444c1528849f1c70d | virtualbox/library.py | python | IMachineDebugger.query_os_kernel_log | (self, max_messages) | return dmesg | Tries to get the kernel log (dmesg) of the guest OS.
in max_messages of type int
Max number of messages to return, counting from the end of the
log. If 0, there is no limit.
return dmesg of type str
The kernel log. | Tries to get the kernel log (dmesg) of the guest OS. | [
"Tries",
"to",
"get",
"the",
"kernel",
"log",
"(",
"dmesg",
")",
"of",
"the",
"guest",
"OS",
"."
] | def query_os_kernel_log(self, max_messages):
"""Tries to get the kernel log (dmesg) of the guest OS.
in max_messages of type int
Max number of messages to return, counting from the end of the
log. If 0, there is no limit.
return dmesg of type str
The kernel... | [
"def",
"query_os_kernel_log",
"(",
"self",
",",
"max_messages",
")",
":",
"if",
"not",
"isinstance",
"(",
"max_messages",
",",
"baseinteger",
")",
":",
"raise",
"TypeError",
"(",
"\"max_messages can only be an instance of type baseinteger\"",
")",
"dmesg",
"=",
"self"... | https://github.com/sethmlarson/virtualbox-python/blob/984a6e2cb0e8996f4df40f4444c1528849f1c70d/virtualbox/library.py#L30144-L30158 | |
xhochy/fletcher | 39ce11d71e4ac1e95725d46be21bb38f3ea04349 | fletcher/algorithms/utils/chunking.py | python | _combined_in_chunk_offsets | (
a: pa.ChunkedArray, b: pa.ChunkedArray
) | return in_a_offsets, in_b_offsets | [] | def _combined_in_chunk_offsets(
a: pa.ChunkedArray, b: pa.ChunkedArray
) -> Tuple[List[Tuple[int, int, int]], List[Tuple[int, int, int]]]:
offsets_a = _calculate_chunk_offsets(a)
offsets_b = _calculate_chunk_offsets(b)
offsets = sorted(set(list(offsets_a) + list(offsets_b)))
in_a_offsets = _in_chunk... | [
"def",
"_combined_in_chunk_offsets",
"(",
"a",
":",
"pa",
".",
"ChunkedArray",
",",
"b",
":",
"pa",
".",
"ChunkedArray",
")",
"->",
"Tuple",
"[",
"List",
"[",
"Tuple",
"[",
"int",
",",
"int",
",",
"int",
"]",
"]",
",",
"List",
"[",
"Tuple",
"[",
"i... | https://github.com/xhochy/fletcher/blob/39ce11d71e4ac1e95725d46be21bb38f3ea04349/fletcher/algorithms/utils/chunking.py#L55-L63 | |||
jgilhutton/PyxieWPS | ba590343a73db98f898bda8b56b43928ac90947f | Version-1.1/pyxiewps-EN.py | python | Config.data_file | (self, data) | Saves the data into a file | Saves the data into a file | [
"Saves",
"the",
"data",
"into",
"a",
"file"
] | def data_file(self, data):
"""
Saves the data into a file
"""
system('echo INFORMATION >> %s' %OUTPUT_FILE)
with open(OUTPUT_FILE, 'a+') as f:
date = str(datetime.datetime.now())
f.write(date+'\n')
f.writelines(data)
print INFO + "All data were saved into %s" %OUTPUT_FILE | [
"def",
"data_file",
"(",
"self",
",",
"data",
")",
":",
"system",
"(",
"'echo INFORMATION >> %s'",
"%",
"OUTPUT_FILE",
")",
"with",
"open",
"(",
"OUTPUT_FILE",
",",
"'a+'",
")",
"as",
"f",
":",
"date",
"=",
"str",
"(",
"datetime",
".",
"datetime",
".",
... | https://github.com/jgilhutton/PyxieWPS/blob/ba590343a73db98f898bda8b56b43928ac90947f/Version-1.1/pyxiewps-EN.py#L691-L701 | ||
DataDog/integrations-core | 934674b29d94b70ccc008f76ea172d0cdae05e1e | datadog_checks_dev/datadog_checks/dev/tooling/trello.py | python | TrelloClient.__init__ | (self, config) | [] | def __init__(self, config):
self.auth = {'key': config['trello']['key'] or None, 'token': config['trello']['token'] or None}
# Maps the trello team label to the trello column ID (idList)
self.team_list_map = {
'Containers': '5ae1cab495edd80852396c71',
'Container App': '5... | [
"def",
"__init__",
"(",
"self",
",",
"config",
")",
":",
"self",
".",
"auth",
"=",
"{",
"'key'",
":",
"config",
"[",
"'trello'",
"]",
"[",
"'key'",
"]",
"or",
"None",
",",
"'token'",
":",
"config",
"[",
"'trello'",
"]",
"[",
"'token'",
"]",
"or",
... | https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/datadog_checks_dev/datadog_checks/dev/tooling/trello.py#L21-L104 | ||||
JiYou/openstack | 8607dd488bde0905044b303eb6e52bdea6806923 | packages/source/cinder/cinder/volume/drivers/netapp/iscsi.py | python | NetAppDirect7modeISCSIDriver._check_clone_status | (self, clone_id, vol_uuid, name, new_name) | Checks for the job till completed. | Checks for the job till completed. | [
"Checks",
"for",
"the",
"job",
"till",
"completed",
"."
] | def _check_clone_status(self, clone_id, vol_uuid, name, new_name):
"""Checks for the job till completed."""
clone_status = NaElement('clone-list-status')
cl_id = NaElement('clone-id')
clone_status.add_child_elem(cl_id)
cl_id.add_node_with_children(
'clone-id-info',
... | [
"def",
"_check_clone_status",
"(",
"self",
",",
"clone_id",
",",
"vol_uuid",
",",
"name",
",",
"new_name",
")",
":",
"clone_status",
"=",
"NaElement",
"(",
"'clone-list-status'",
")",
"cl_id",
"=",
"NaElement",
"(",
"'clone-id'",
")",
"clone_status",
".",
"add... | https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/cinder/cinder/volume/drivers/netapp/iscsi.py#L2464-L2498 | ||
pantsbuild/pex | 473c6ac732ed4bc338b4b20a9ec930d1d722c9b4 | pex/vendor/_vendored/attrs/attr/_make.py | python | _ClassBuilder.__init__ | (
self,
cls,
these,
slots,
frozen,
weakref_slot,
getstate_setstate,
auto_attribs,
kw_only,
cache_hash,
is_exc,
collect_by_mro,
on_setattr,
has_custom_setattr,
field_transformer,
) | [] | def __init__(
self,
cls,
these,
slots,
frozen,
weakref_slot,
getstate_setstate,
auto_attribs,
kw_only,
cache_hash,
is_exc,
collect_by_mro,
on_setattr,
has_custom_setattr,
field_transformer,
):
... | [
"def",
"__init__",
"(",
"self",
",",
"cls",
",",
"these",
",",
"slots",
",",
"frozen",
",",
"weakref_slot",
",",
"getstate_setstate",
",",
"auto_attribs",
",",
"kw_only",
",",
"cache_hash",
",",
"is_exc",
",",
"collect_by_mro",
",",
"on_setattr",
",",
"has_c... | https://github.com/pantsbuild/pex/blob/473c6ac732ed4bc338b4b20a9ec930d1d722c9b4/pex/vendor/_vendored/attrs/attr/_make.py#L661-L718 | ||||
CJWorkbench/cjworkbench | e0b878d8ff819817fa049a4126efcbfcec0b50e6 | cjwstate/models/module_registry.py | python | _is_basename_python_code | (key: str) | return key.endswith(".py") | True iff the given filename is a module's Python code file.
>>> _is_basename_python_code('filter.py')
True
>>> _is_basename_python_code('filter.json') # not Python
True
>>> _is_basename_python_code('setup.py') # setup.py is an exception
False
>>> _is_basename_python_code('test_filter.py')... | True iff the given filename is a module's Python code file. | [
"True",
"iff",
"the",
"given",
"filename",
"is",
"a",
"module",
"s",
"Python",
"code",
"file",
"."
] | def _is_basename_python_code(key: str) -> bool:
"""True iff the given filename is a module's Python code file.
>>> _is_basename_python_code('filter.py')
True
>>> _is_basename_python_code('filter.json') # not Python
True
>>> _is_basename_python_code('setup.py') # setup.py is an exception
F... | [
"def",
"_is_basename_python_code",
"(",
"key",
":",
"str",
")",
"->",
"bool",
":",
"if",
"key",
"==",
"\"setup.py\"",
":",
"return",
"False",
"if",
"key",
".",
"startswith",
"(",
"\"test_\"",
")",
":",
"return",
"False",
"return",
"key",
".",
"endswith",
... | https://github.com/CJWorkbench/cjworkbench/blob/e0b878d8ff819817fa049a4126efcbfcec0b50e6/cjwstate/models/module_registry.py#L144-L160 | |
bokeh/bokeh | a00e59da76beb7b9f83613533cfd3aced1df5f06 | bokeh/embed/standalone.py | python | components | (models: Model | Sequence[Model] | Dict[str, Model], wrap_script: bool = True,
wrap_plot_info: bool = True, theme: ThemeLike = None) | return script, result | Return HTML components to embed a Bokeh plot. The data for the plot is
stored directly in the returned HTML.
An example can be found in examples/embed/embed_multiple.py
The returned components assume that BokehJS resources are **already loaded**.
The html template in which they will be embedded needs ... | Return HTML components to embed a Bokeh plot. The data for the plot is
stored directly in the returned HTML. | [
"Return",
"HTML",
"components",
"to",
"embed",
"a",
"Bokeh",
"plot",
".",
"The",
"data",
"for",
"the",
"plot",
"is",
"stored",
"directly",
"in",
"the",
"returned",
"HTML",
"."
] | def components(models: Model | Sequence[Model] | Dict[str, Model], wrap_script: bool = True,
wrap_plot_info: bool = True, theme: ThemeLike = None) -> Tuple[str, Any]:
''' Return HTML components to embed a Bokeh plot. The data for the plot is
stored directly in the returned HTML.
An example c... | [
"def",
"components",
"(",
"models",
":",
"Model",
"|",
"Sequence",
"[",
"Model",
"]",
"|",
"Dict",
"[",
"str",
",",
"Model",
"]",
",",
"wrap_script",
":",
"bool",
"=",
"True",
",",
"wrap_plot_info",
":",
"bool",
"=",
"True",
",",
"theme",
":",
"Theme... | https://github.com/bokeh/bokeh/blob/a00e59da76beb7b9f83613533cfd3aced1df5f06/bokeh/embed/standalone.py#L161-L293 | |
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/google/appengine/_internal/django/utils/translation/trans_real.py | python | catalog | () | return _default | Returns the current active catalog for further processing.
This can be used if you need to modify the catalog or want to access the
whole message catalog instead of just translating one string. | Returns the current active catalog for further processing.
This can be used if you need to modify the catalog or want to access the
whole message catalog instead of just translating one string. | [
"Returns",
"the",
"current",
"active",
"catalog",
"for",
"further",
"processing",
".",
"This",
"can",
"be",
"used",
"if",
"you",
"need",
"to",
"modify",
"the",
"catalog",
"or",
"want",
"to",
"access",
"the",
"whole",
"message",
"catalog",
"instead",
"of",
... | def catalog():
"""
Returns the current active catalog for further processing.
This can be used if you need to modify the catalog or want to access the
whole message catalog instead of just translating one string.
"""
global _default, _active
t = _active.get(currentThread(), None)
if t is... | [
"def",
"catalog",
"(",
")",
":",
"global",
"_default",
",",
"_active",
"t",
"=",
"_active",
".",
"get",
"(",
"currentThread",
"(",
")",
",",
"None",
")",
"if",
"t",
"is",
"not",
"None",
":",
"return",
"t",
"if",
"_default",
"is",
"None",
":",
"from... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/google/appengine/_internal/django/utils/translation/trans_real.py#L236-L249 | |
geometalab/Vector-Tiles-Reader-QGIS-Plugin | a31ae86959c8f3b7d6f332f84191cd7ca4683e1d | ext-libs/google/protobuf/internal/decoder.py | python | _SkipLengthDelimited | (buffer, pos, end) | return pos | Skip a length-delimited value. Returns the new position. | Skip a length-delimited value. Returns the new position. | [
"Skip",
"a",
"length",
"-",
"delimited",
"value",
".",
"Returns",
"the",
"new",
"position",
"."
] | def _SkipLengthDelimited(buffer, pos, end):
"""Skip a length-delimited value. Returns the new position."""
(size, pos) = _DecodeVarint(buffer, pos)
pos += size
if pos > end:
raise _DecodeError('Truncated message.')
return pos | [
"def",
"_SkipLengthDelimited",
"(",
"buffer",
",",
"pos",
",",
"end",
")",
":",
"(",
"size",
",",
"pos",
")",
"=",
"_DecodeVarint",
"(",
"buffer",
",",
"pos",
")",
"pos",
"+=",
"size",
"if",
"pos",
">",
"end",
":",
"raise",
"_DecodeError",
"(",
"'Tru... | https://github.com/geometalab/Vector-Tiles-Reader-QGIS-Plugin/blob/a31ae86959c8f3b7d6f332f84191cd7ca4683e1d/ext-libs/google/protobuf/internal/decoder.py#L785-L792 | |
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/django-1.5/django/template/defaulttags.py | python | autoescape | (parser, token) | return AutoEscapeControlNode((arg == 'on'), nodelist) | Force autoescape behavior for this block. | Force autoescape behavior for this block. | [
"Force",
"autoescape",
"behavior",
"for",
"this",
"block",
"."
] | def autoescape(parser, token):
"""
Force autoescape behavior for this block.
"""
args = token.contents.split()
if len(args) != 2:
raise TemplateSyntaxError("'autoescape' tag requires exactly one argument.")
arg = args[1]
if arg not in ('on', 'off'):
raise TemplateSyntaxError(... | [
"def",
"autoescape",
"(",
"parser",
",",
"token",
")",
":",
"args",
"=",
"token",
".",
"contents",
".",
"split",
"(",
")",
"if",
"len",
"(",
"args",
")",
"!=",
"2",
":",
"raise",
"TemplateSyntaxError",
"(",
"\"'autoescape' tag requires exactly one argument.\""... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.5/django/template/defaulttags.py#L488-L500 | |
mcfletch/pyopengl | 02d11dad9ff18e50db10e975c4756e17bf198464 | src/get_gles_extensions.py | python | gles | () | Create the GLES 2 and 3 modules | Create the GLES 2 and 3 modules | [
"Create",
"the",
"GLES",
"2",
"and",
"3",
"modules"
] | def gles():
"""Create the GLES 2 and 3 modules"""
for es_version in (2,3):
target_dir = os.path.join( HERE, '..', 'OpenGL','es%(es_version)s'%locals() )
target_module = os.path.join( target_dir, '__init__.py' )
headers = [ h%locals() for h in [
'gl%(es_version)s.h','gl%(es_ve... | [
"def",
"gles",
"(",
")",
":",
"for",
"es_version",
"in",
"(",
"2",
",",
"3",
")",
":",
"target_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"HERE",
",",
"'..'",
",",
"'OpenGL'",
",",
"'es%(es_version)s'",
"%",
"locals",
"(",
")",
")",
"target_mo... | https://github.com/mcfletch/pyopengl/blob/02d11dad9ff18e50db10e975c4756e17bf198464/src/get_gles_extensions.py#L190-L205 | ||
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/asuswrt/router.py | python | AsusWrtDevInfo.is_connected | (self) | return self._connected | Return connected status. | Return connected status. | [
"Return",
"connected",
"status",
"."
] | def is_connected(self):
"""Return connected status."""
return self._connected | [
"def",
"is_connected",
"(",
"self",
")",
":",
"return",
"self",
".",
"_connected"
] | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/asuswrt/router.py#L191-L193 | |
timonwong/OmniMarkupPreviewer | 21921ac7a99d2b5924a2219b33679a5b53621392 | OmniMarkupLib/Renderers/libs/python2/docutils/core.py | python | publish_cmdline | (reader=None, reader_name='standalone',
parser=None, parser_name='restructuredtext',
writer=None, writer_name='pseudoxml',
settings=None, settings_spec=None,
settings_overrides=None, config_section=None,
enable_exit_stat... | return output | Set up & run a `Publisher` for command-line-based file I/O (input and
output file paths taken automatically from the command line). Return the
encoded string output also.
Parameters: see `publish_programmatically` for the remainder.
- `argv`: Command-line argument list to use instead of ``sys.argv[1:... | Set up & run a `Publisher` for command-line-based file I/O (input and
output file paths taken automatically from the command line). Return the
encoded string output also. | [
"Set",
"up",
"&",
"run",
"a",
"Publisher",
"for",
"command",
"-",
"line",
"-",
"based",
"file",
"I",
"/",
"O",
"(",
"input",
"and",
"output",
"file",
"paths",
"taken",
"automatically",
"from",
"the",
"command",
"line",
")",
".",
"Return",
"the",
"encod... | def publish_cmdline(reader=None, reader_name='standalone',
parser=None, parser_name='restructuredtext',
writer=None, writer_name='pseudoxml',
settings=None, settings_spec=None,
settings_overrides=None, config_section=None,
... | [
"def",
"publish_cmdline",
"(",
"reader",
"=",
"None",
",",
"reader_name",
"=",
"'standalone'",
",",
"parser",
"=",
"None",
",",
"parser_name",
"=",
"'restructuredtext'",
",",
"writer",
"=",
"None",
",",
"writer_name",
"=",
"'pseudoxml'",
",",
"settings",
"=",
... | https://github.com/timonwong/OmniMarkupPreviewer/blob/21921ac7a99d2b5924a2219b33679a5b53621392/OmniMarkupLib/Renderers/libs/python2/docutils/core.py#L328-L353 | |
stopstalk/stopstalk-deployment | 10c3ab44c4ece33ae515f6888c15033db2004bb1 | aws_lambda/spoj_aws_lambda_function/lambda_code/pip/_vendor/urllib3/connectionpool.py | python | HTTPConnectionPool._get_conn | (self, timeout=None) | return conn or self._new_conn() | Get a connection. Will return a pooled connection if one is available.
If no connections are available and :prop:`.block` is ``False``, then a
fresh connection is returned.
:param timeout:
Seconds to wait before giving up and raising
:class:`urllib3.exceptions.EmptyPool... | Get a connection. Will return a pooled connection if one is available. | [
"Get",
"a",
"connection",
".",
"Will",
"return",
"a",
"pooled",
"connection",
"if",
"one",
"is",
"available",
"."
] | def _get_conn(self, timeout=None):
"""
Get a connection. Will return a pooled connection if one is available.
If no connections are available and :prop:`.block` is ``False``, then a
fresh connection is returned.
:param timeout:
Seconds to wait before giving up and r... | [
"def",
"_get_conn",
"(",
"self",
",",
"timeout",
"=",
"None",
")",
":",
"conn",
"=",
"None",
"try",
":",
"conn",
"=",
"self",
".",
"pool",
".",
"get",
"(",
"block",
"=",
"self",
".",
"block",
",",
"timeout",
"=",
"timeout",
")",
"except",
"Attribut... | https://github.com/stopstalk/stopstalk-deployment/blob/10c3ab44c4ece33ae515f6888c15033db2004bb1/aws_lambda/spoj_aws_lambda_function/lambda_code/pip/_vendor/urllib3/connectionpool.py#L212-L248 | |
mylar3/mylar3 | fce4771c5b627f8de6868dd4ab6bc53f7b22d303 | lib/rtorrent/__init__.py | python | RTorrent.get_torrents | (self, view="main") | return(self.torrents) | Get list of all torrents in specified view
@return: list of L{Torrent} instances
@rtype: list
@todo: add validity check for specified view | Get list of all torrents in specified view | [
"Get",
"list",
"of",
"all",
"torrents",
"in",
"specified",
"view"
] | def get_torrents(self, view="main"):
"""Get list of all torrents in specified view
@return: list of L{Torrent} instances
@rtype: list
@todo: add validity check for specified view
"""
self.torrents = []
if self.client_version >= (0, 9, 7):
logger.deb... | [
"def",
"get_torrents",
"(",
"self",
",",
"view",
"=",
"\"main\"",
")",
":",
"self",
".",
"torrents",
"=",
"[",
"]",
"if",
"self",
".",
"client_version",
">=",
"(",
"0",
",",
"9",
",",
"7",
")",
":",
"logger",
".",
"debug",
"(",
"'RTORRENT: Building m... | https://github.com/mylar3/mylar3/blob/fce4771c5b627f8de6868dd4ab6bc53f7b22d303/lib/rtorrent/__init__.py#L73-L119 | |
tensorflow/tfx | b4a6b83269815ed12ba9df9e9154c7376fef2ea0 | tfx/examples/penguin/experimental/penguin_pipeline_sklearn_local.py | python | _create_pipeline | (
pipeline_name: str,
pipeline_root: str,
data_root: str,
trainer_module_file: str,
evaluator_module_file: str,
serving_model_dir: str,
metadata_path: str,
beam_pipeline_args: List[str],
) | return tfx.dsl.Pipeline(
pipeline_name=pipeline_name,
pipeline_root=pipeline_root,
components=[
example_gen,
statistics_gen,
schema_gen,
example_validator,
trainer,
model_resolver,
evaluator,
pusher,
],
enable_... | Implements the Penguin pipeline with TFX. | Implements the Penguin pipeline with TFX. | [
"Implements",
"the",
"Penguin",
"pipeline",
"with",
"TFX",
"."
] | def _create_pipeline(
pipeline_name: str,
pipeline_root: str,
data_root: str,
trainer_module_file: str,
evaluator_module_file: str,
serving_model_dir: str,
metadata_path: str,
beam_pipeline_args: List[str],
) -> tfx.dsl.Pipeline:
"""Implements the Penguin pipeline with TFX."""
# Brin... | [
"def",
"_create_pipeline",
"(",
"pipeline_name",
":",
"str",
",",
"pipeline_root",
":",
"str",
",",
"data_root",
":",
"str",
",",
"trainer_module_file",
":",
"str",
",",
"evaluator_module_file",
":",
"str",
",",
"serving_model_dir",
":",
"str",
",",
"metadata_pa... | https://github.com/tensorflow/tfx/blob/b4a6b83269815ed12ba9df9e9154c7376fef2ea0/tfx/examples/penguin/experimental/penguin_pipeline_sklearn_local.py#L66-L162 | |
holoviz/holoviews | cc6b27f01710402fdfee2aeef1507425ca78c91f | holoviews/core/tree.py | python | AttrTree._propagate | (self, path, val) | Propagate the value up to the root node. | Propagate the value up to the root node. | [
"Propagate",
"the",
"value",
"up",
"to",
"the",
"root",
"node",
"."
] | def _propagate(self, path, val):
"""
Propagate the value up to the root node.
"""
if val == '_DELETE':
if path in self.data:
del self.data[path]
else:
items = [(key, v) for key, v in self.data.items()
if not... | [
"def",
"_propagate",
"(",
"self",
",",
"path",
",",
"val",
")",
":",
"if",
"val",
"==",
"'_DELETE'",
":",
"if",
"path",
"in",
"self",
".",
"data",
":",
"del",
"self",
".",
"data",
"[",
"path",
"]",
"else",
":",
"items",
"=",
"[",
"(",
"key",
",... | https://github.com/holoviz/holoviews/blob/cc6b27f01710402fdfee2aeef1507425ca78c91f/holoviews/core/tree.py#L150-L164 | ||
PySimpleGUI/PySimpleGUI | 6c0d1fb54f493d45e90180b322fbbe70f7a5af3c | DemoPrograms/Demo_Uno_Card_Game.py | python | Card.getValue | (self) | return self.value | Returns card's value. | Returns card's value. | [
"Returns",
"card",
"s",
"value",
"."
] | def getValue(self):
'''Returns card's value.'''
return self.value | [
"def",
"getValue",
"(",
"self",
")",
":",
"return",
"self",
".",
"value"
] | https://github.com/PySimpleGUI/PySimpleGUI/blob/6c0d1fb54f493d45e90180b322fbbe70f7a5af3c/DemoPrograms/Demo_Uno_Card_Game.py#L2141-L2143 | |
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/artist.py | python | ArtistInspector.pprint_setters | (self, prop=None, leadingspace=2) | return lines | If *prop* is *None*, return a list of strings of all settable
properties and their valid values.
If *prop* is not *None*, it is a valid property name and that
property will be returned as a string of property : valid
values. | If *prop* is *None*, return a list of strings of all settable
properties and their valid values. | [
"If",
"*",
"prop",
"*",
"is",
"*",
"None",
"*",
"return",
"a",
"list",
"of",
"strings",
"of",
"all",
"settable",
"properties",
"and",
"their",
"valid",
"values",
"."
] | def pprint_setters(self, prop=None, leadingspace=2):
"""
If *prop* is *None*, return a list of strings of all settable
properties and their valid values.
If *prop* is not *None*, it is a valid property name and that
property will be returned as a string of property : valid
... | [
"def",
"pprint_setters",
"(",
"self",
",",
"prop",
"=",
"None",
",",
"leadingspace",
"=",
"2",
")",
":",
"if",
"leadingspace",
":",
"pad",
"=",
"' '",
"*",
"leadingspace",
"else",
":",
"pad",
"=",
"''",
"if",
"prop",
"is",
"not",
"None",
":",
"accept... | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/artist.py#L1268-L1294 | |
open-mmlab/mmcv | 48419395e3220af5b6df78346d6ce58991e8ba90 | mmcv/runner/hooks/lr_updater.py | python | annealing_linear | (start, end, factor) | return start + (end - start) * factor | Calculate annealing linear learning rate.
Linear anneal from `start` to `end` as percentage goes from 0.0 to 1.0.
Args:
start (float): The starting learning rate of the linear annealing.
end (float): The ending learing rate of the linear annealing.
factor (float): The coefficient of `p... | Calculate annealing linear learning rate. | [
"Calculate",
"annealing",
"linear",
"learning",
"rate",
"."
] | def annealing_linear(start, end, factor):
"""Calculate annealing linear learning rate.
Linear anneal from `start` to `end` as percentage goes from 0.0 to 1.0.
Args:
start (float): The starting learning rate of the linear annealing.
end (float): The ending learing rate of the linear anneali... | [
"def",
"annealing_linear",
"(",
"start",
",",
"end",
",",
"factor",
")",
":",
"return",
"start",
"+",
"(",
"end",
"-",
"start",
")",
"*",
"factor"
] | https://github.com/open-mmlab/mmcv/blob/48419395e3220af5b6df78346d6ce58991e8ba90/mmcv/runner/hooks/lr_updater.py#L645-L656 | |
hirofumi0810/tensorflow_end2end_speech_recognition | 65b9728089d5e92b25b92384a67419d970399a64 | examples/librispeech/training/train_ctc.py | python | do_train | (model, params, gpu_indices) | Run CTC training.
Args:
model: the model to train
params (dict): A dictionary of parameters
gpu_indices (list): GPU indices | Run CTC training.
Args:
model: the model to train
params (dict): A dictionary of parameters
gpu_indices (list): GPU indices | [
"Run",
"CTC",
"training",
".",
"Args",
":",
"model",
":",
"the",
"model",
"to",
"train",
"params",
"(",
"dict",
")",
":",
"A",
"dictionary",
"of",
"parameters",
"gpu_indices",
"(",
"list",
")",
":",
"GPU",
"indices"
] | def do_train(model, params, gpu_indices):
"""Run CTC training.
Args:
model: the model to train
params (dict): A dictionary of parameters
gpu_indices (list): GPU indices
"""
# Load dataset
train_data = Dataset(
data_type='train', train_data_size=params['train_data_size... | [
"def",
"do_train",
"(",
"model",
",",
"params",
",",
"gpu_indices",
")",
":",
"# Load dataset",
"train_data",
"=",
"Dataset",
"(",
"data_type",
"=",
"'train'",
",",
"train_data_size",
"=",
"params",
"[",
"'train_data_size'",
"]",
",",
"label_type",
"=",
"param... | https://github.com/hirofumi0810/tensorflow_end2end_speech_recognition/blob/65b9728089d5e92b25b92384a67419d970399a64/examples/librispeech/training/train_ctc.py#L30-L448 | ||
largelymfs/topical_word_embeddings | 1ae3d15d0afcd3fcd39cc81eec4ad9463413a9f6 | TWE-3/gensim/corpora/dictionary.py | python | Dictionary.add_documents | (self, documents) | Build dictionary from a collection of documents. Each document is a list
of tokens = **tokenized and normalized** utf-8 encoded strings.
This is only a convenience wrapper for calling `doc2bow` on each document
with `allow_update=True`.
>>> print(Dictionary(["máma mele maso".split(), "... | Build dictionary from a collection of documents. Each document is a list
of tokens = **tokenized and normalized** utf-8 encoded strings. | [
"Build",
"dictionary",
"from",
"a",
"collection",
"of",
"documents",
".",
"Each",
"document",
"is",
"a",
"list",
"of",
"tokens",
"=",
"**",
"tokenized",
"and",
"normalized",
"**",
"utf",
"-",
"8",
"encoded",
"strings",
"."
] | def add_documents(self, documents):
"""
Build dictionary from a collection of documents. Each document is a list
of tokens = **tokenized and normalized** utf-8 encoded strings.
This is only a convenience wrapper for calling `doc2bow` on each document
with `allow_update=True`.
... | [
"def",
"add_documents",
"(",
"self",
",",
"documents",
")",
":",
"for",
"docno",
",",
"document",
"in",
"enumerate",
"(",
"documents",
")",
":",
"if",
"docno",
"%",
"10000",
"==",
"0",
":",
"logger",
".",
"info",
"(",
"\"adding document #%i to %s\"",
"%",
... | https://github.com/largelymfs/topical_word_embeddings/blob/1ae3d15d0afcd3fcd39cc81eec4ad9463413a9f6/TWE-3/gensim/corpora/dictionary.py#L103-L119 | ||
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/tarfile.py | python | TarFile._dbg | (self, level, msg) | Write debugging output to sys.stderr. | Write debugging output to sys.stderr. | [
"Write",
"debugging",
"output",
"to",
"sys",
".",
"stderr",
"."
] | def _dbg(self, level, msg):
"""Write debugging output to sys.stderr.
"""
if level <= self.debug:
print(msg, file=sys.stderr) | [
"def",
"_dbg",
"(",
"self",
",",
"level",
",",
"msg",
")",
":",
"if",
"level",
"<=",
"self",
".",
"debug",
":",
"print",
"(",
"msg",
",",
"file",
"=",
"sys",
".",
"stderr",
")"
] | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/tarfile.py#L2419-L2423 | ||
CLUEbenchmark/CLUE | 5bd39732734afecb490cf18a5212e692dbf2c007 | baselines/models/roberta_wwm_large_ext/run_classifier.py | python | file_based_convert_examples_to_features_for_inews | (
examples, label_list, max_seq_length, tokenizer, output_file) | Convert a set of `InputExample`s to a TFRecord file. | Convert a set of `InputExample`s to a TFRecord file. | [
"Convert",
"a",
"set",
"of",
"InputExample",
"s",
"to",
"a",
"TFRecord",
"file",
"."
] | def file_based_convert_examples_to_features_for_inews(
examples, label_list, max_seq_length, tokenizer, output_file):
"""Convert a set of `InputExample`s to a TFRecord file."""
writer = tf.python_io.TFRecordWriter(output_file)
num_example = 0
for (ex_index, example) in enumerate(examples):
if ex_in... | [
"def",
"file_based_convert_examples_to_features_for_inews",
"(",
"examples",
",",
"label_list",
",",
"max_seq_length",
",",
"tokenizer",
",",
"output_file",
")",
":",
"writer",
"=",
"tf",
".",
"python_io",
".",
"TFRecordWriter",
"(",
"output_file",
")",
"num_example",... | https://github.com/CLUEbenchmark/CLUE/blob/5bd39732734afecb490cf18a5212e692dbf2c007/baselines/models/roberta_wwm_large_ext/run_classifier.py#L274-L304 | ||
log2timeline/dfvfs | 4ca7bf06b15cdc000297a7122a065f0ca71de544 | dfvfs/vfs/data_range_file_entry.py | python | DataRangeFileEntry.__init__ | (
self, resolver_context, file_system, path_spec, is_root=False,
is_virtual=False) | Initializes a file entry.
Args:
resolver_context (Context): resolver context.
file_system (FileSystem): file system.
path_spec (PathSpec): path specification.
is_root (Optional[bool]): True if the file entry is the root file entry
of the corresponding file system.
is_virtual... | Initializes a file entry. | [
"Initializes",
"a",
"file",
"entry",
"."
] | def __init__(
self, resolver_context, file_system, path_spec, is_root=False,
is_virtual=False):
"""Initializes a file entry.
Args:
resolver_context (Context): resolver context.
file_system (FileSystem): file system.
path_spec (PathSpec): path specification.
is_root (Optional... | [
"def",
"__init__",
"(",
"self",
",",
"resolver_context",
",",
"file_system",
",",
"path_spec",
",",
"is_root",
"=",
"False",
",",
"is_virtual",
"=",
"False",
")",
":",
"super",
"(",
"DataRangeFileEntry",
",",
"self",
")",
".",
"__init__",
"(",
"resolver_cont... | https://github.com/log2timeline/dfvfs/blob/4ca7bf06b15cdc000297a7122a065f0ca71de544/dfvfs/vfs/data_range_file_entry.py#L13-L34 | ||
clinton-hall/nzbToMedia | 27669389216902d1085660167e7bda0bd8527ecf | libs/common/beets/ui/commands.py | python | _do_query | (lib, query, album, also_items=True) | return items, albums | For commands that operate on matched items, performs a query
and returns a list of matching items and a list of matching
albums. (The latter is only nonempty when album is True.) Raises
a UserError if no items match. also_items controls whether, when
fetching albums, the associated items should be fetch... | For commands that operate on matched items, performs a query
and returns a list of matching items and a list of matching
albums. (The latter is only nonempty when album is True.) Raises
a UserError if no items match. also_items controls whether, when
fetching albums, the associated items should be fetch... | [
"For",
"commands",
"that",
"operate",
"on",
"matched",
"items",
"performs",
"a",
"query",
"and",
"returns",
"a",
"list",
"of",
"matching",
"items",
"and",
"a",
"list",
"of",
"matching",
"albums",
".",
"(",
"The",
"latter",
"is",
"only",
"nonempty",
"when",... | def _do_query(lib, query, album, also_items=True):
"""For commands that operate on matched items, performs a query
and returns a list of matching items and a list of matching
albums. (The latter is only nonempty when album is True.) Raises
a UserError if no items match. also_items controls whether, when... | [
"def",
"_do_query",
"(",
"lib",
",",
"query",
",",
"album",
",",
"also_items",
"=",
"True",
")",
":",
"if",
"album",
":",
"albums",
"=",
"list",
"(",
"lib",
".",
"albums",
"(",
"query",
")",
")",
"items",
"=",
"[",
"]",
"if",
"also_items",
":",
"... | https://github.com/clinton-hall/nzbToMedia/blob/27669389216902d1085660167e7bda0bd8527ecf/libs/common/beets/ui/commands.py#L59-L82 | |
tree-branch/house | 6c6c3c8ffa92f84192b2c3346b294e9a25b7d008 | source/tongcheng.py | python | TongchengParser.handle_starttag | (self, tag, attrs) | [] | def handle_starttag(self, tag, attrs):
if tag == "span":
self.flag.append("span")
elif tag == "a" and ("tongji_label", "listclick") in attrs:
self.flag.append("houseName")
for attr in attrs:
if attr[0] == "href":
self.houseLink.appe... | [
"def",
"handle_starttag",
"(",
"self",
",",
"tag",
",",
"attrs",
")",
":",
"if",
"tag",
"==",
"\"span\"",
":",
"self",
".",
"flag",
".",
"append",
"(",
"\"span\"",
")",
"elif",
"tag",
"==",
"\"a\"",
"and",
"(",
"\"tongji_label\"",
",",
"\"listclick\"",
... | https://github.com/tree-branch/house/blob/6c6c3c8ffa92f84192b2c3346b294e9a25b7d008/source/tongcheng.py#L43-L70 | ||||
jtesta/ssh-audit | 5fbcb1b90f28e84c96bef4eb02f5a652604486a4 | src/ssh_audit/outputbuffer.py | python | OutputBuffer.d | (self, s: str, write_now: bool = False) | return self | Prints a message if verbose output is enabled. | Prints a message if verbose output is enabled. | [
"Prints",
"a",
"message",
"if",
"verbose",
"output",
"is",
"enabled",
"."
] | def d(self, s: str, write_now: bool = False) -> 'OutputBuffer':
'''Prints a message if verbose output is enabled.'''
if self.debug:
self.info(s)
if write_now:
self.write()
return self | [
"def",
"d",
"(",
"self",
",",
"s",
":",
"str",
",",
"write_now",
":",
"bool",
"=",
"False",
")",
"->",
"'OutputBuffer'",
":",
"if",
"self",
".",
"debug",
":",
"self",
".",
"info",
"(",
"s",
")",
"if",
"write_now",
":",
"self",
".",
"write",
"(",
... | https://github.com/jtesta/ssh-audit/blob/5fbcb1b90f28e84c96bef4eb02f5a652604486a4/src/ssh_audit/outputbuffer.py#L178-L185 | |
oaubert/python-vlc | 908ffdbd0844dc1849728c456e147788798c99da | generated/dev/vlc.py | python | libvlc_video_set_deinterlace | (p_mi, deinterlace, psz_mode) | return f(p_mi, deinterlace, psz_mode) | Enable or disable deinterlace filter.
@param p_mi: libvlc media player.
@param deinterlace: state -1: auto (default), 0: disabled, 1: enabled.
@param psz_mode: type of deinterlace filter, None for current/default filter.
@version: LibVLC 4.0.0 and later. | Enable or disable deinterlace filter. | [
"Enable",
"or",
"disable",
"deinterlace",
"filter",
"."
] | def libvlc_video_set_deinterlace(p_mi, deinterlace, psz_mode):
'''Enable or disable deinterlace filter.
@param p_mi: libvlc media player.
@param deinterlace: state -1: auto (default), 0: disabled, 1: enabled.
@param psz_mode: type of deinterlace filter, None for current/default filter.
@version: Lib... | [
"def",
"libvlc_video_set_deinterlace",
"(",
"p_mi",
",",
"deinterlace",
",",
"psz_mode",
")",
":",
"f",
"=",
"_Cfunctions",
".",
"get",
"(",
"'libvlc_video_set_deinterlace'",
",",
"None",
")",
"or",
"_Cfunction",
"(",
"'libvlc_video_set_deinterlace'",
",",
"(",
"(... | https://github.com/oaubert/python-vlc/blob/908ffdbd0844dc1849728c456e147788798c99da/generated/dev/vlc.py#L7391-L7401 | |
vatlab/sos | 5f4dd45cc1b2f244354de2e23ea6f47011e2db31 | src/sos/dag.py | python | SoS_DAG.build | (self) | Connect nodes according to status of targets | Connect nodes according to status of targets | [
"Connect",
"nodes",
"according",
"to",
"status",
"of",
"targets"
] | def build(self):
'''Connect nodes according to status of targets'''
# right now we do not worry about status of nodes
# connecting the output to the input of other nodes
#
# NOTE: This is implemented in the least efficient way just for
# testing. It has to be re-implement... | [
"def",
"build",
"(",
"self",
")",
":",
"# right now we do not worry about status of nodes",
"# connecting the output to the input of other nodes",
"#",
"# NOTE: This is implemented in the least efficient way just for",
"# testing. It has to be re-implemented.",
"#",
"# refer to http://stacko... | https://github.com/vatlab/sos/blob/5f4dd45cc1b2f244354de2e23ea6f47011e2db31/src/sos/dag.py#L329-L385 | ||
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/chat/v2/service/user/__init__.py | python | UserPage.get_instance | (self, payload) | return UserInstance(self._version, payload, service_sid=self._solution['service_sid'], ) | Build an instance of UserInstance
:param dict payload: Payload response from the API
:returns: twilio.rest.chat.v2.service.user.UserInstance
:rtype: twilio.rest.chat.v2.service.user.UserInstance | Build an instance of UserInstance | [
"Build",
"an",
"instance",
"of",
"UserInstance"
] | def get_instance(self, payload):
"""
Build an instance of UserInstance
:param dict payload: Payload response from the API
:returns: twilio.rest.chat.v2.service.user.UserInstance
:rtype: twilio.rest.chat.v2.service.user.UserInstance
"""
return UserInstance(self._... | [
"def",
"get_instance",
"(",
"self",
",",
"payload",
")",
":",
"return",
"UserInstance",
"(",
"self",
".",
"_version",
",",
"payload",
",",
"service_sid",
"=",
"self",
".",
"_solution",
"[",
"'service_sid'",
"]",
",",
")"
] | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/chat/v2/service/user/__init__.py#L190-L199 | |
dadadel/pyment | 2c10b1c64093adbce8db369a3db4321e6c3c7c32 | pyment/docstring.py | python | DocToolsBase.__iter__ | (self) | return self.opt.__iter__() | [] | def __iter__(self):
return self.opt.__iter__() | [
"def",
"__iter__",
"(",
"self",
")",
":",
"return",
"self",
".",
"opt",
".",
"__iter__",
"(",
")"
] | https://github.com/dadadel/pyment/blob/2c10b1c64093adbce8db369a3db4321e6c3c7c32/pyment/docstring.py#L119-L120 | |||
openhatch/oh-mainline | ce29352a034e1223141dcc2f317030bbc3359a51 | vendor/packages/twisted/twisted/words/xish/utility.py | python | EventDispatcher.addOnetimeObserver | (self, event, observerfn, priority=0, *args, **kwargs) | Register a one-time observer for an event.
Like L{addObserver}, but is only triggered at most once. See there
for a description of the parameters. | Register a one-time observer for an event. | [
"Register",
"a",
"one",
"-",
"time",
"observer",
"for",
"an",
"event",
"."
] | def addOnetimeObserver(self, event, observerfn, priority=0, *args, **kwargs):
"""
Register a one-time observer for an event.
Like L{addObserver}, but is only triggered at most once. See there
for a description of the parameters.
"""
self._addObserver(True, event, observe... | [
"def",
"addOnetimeObserver",
"(",
"self",
",",
"event",
",",
"observerfn",
",",
"priority",
"=",
"0",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_addObserver",
"(",
"True",
",",
"event",
",",
"observerfn",
",",
"priority",
",",
... | https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/twisted/twisted/words/xish/utility.py#L192-L199 | ||
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/apps/api/es.py | python | DateRangeParams.__init__ | (self, param, term=None) | [] | def __init__(self, param, term=None):
self.term = term or param
self.start_param = '{}_start'.format(param)
self.end_param = '{}_end'.format(param) | [
"def",
"__init__",
"(",
"self",
",",
"param",
",",
"term",
"=",
"None",
")",
":",
"self",
".",
"term",
"=",
"term",
"or",
"param",
"self",
".",
"start_param",
"=",
"'{}_start'",
".",
"format",
"(",
"param",
")",
"self",
".",
"end_param",
"=",
"'{}_en... | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/api/es.py#L443-L446 | ||||
davidbau/ganseeing | 93cea2c8f391aef001ddf9dcb35c43990681a47c | seeing/pbar.py | python | VerboseContextManager.__init__ | (self, v, entered=False) | [] | def __init__(self, v, entered=False):
self.v, self.entered, self.saved = v, False, []
if entered:
self.__enter__()
self.entered = True | [
"def",
"__init__",
"(",
"self",
",",
"v",
",",
"entered",
"=",
"False",
")",
":",
"self",
".",
"v",
",",
"self",
".",
"entered",
",",
"self",
".",
"saved",
"=",
"v",
",",
"False",
",",
"[",
"]",
"if",
"entered",
":",
"self",
".",
"__enter__",
"... | https://github.com/davidbau/ganseeing/blob/93cea2c8f391aef001ddf9dcb35c43990681a47c/seeing/pbar.py#L142-L146 | ||||
rochacbruno/dynaconf | 88adc159d5f5c8ba0d314915f8c9f001e849e2d5 | dynaconf/vendor_src/click/_termui_impl.py | python | _pipepager | (generator, cmd, color) | Page through text by feeding it to another program. Invoking a
pager through this might support colors. | Page through text by feeding it to another program. Invoking a
pager through this might support colors. | [
"Page",
"through",
"text",
"by",
"feeding",
"it",
"to",
"another",
"program",
".",
"Invoking",
"a",
"pager",
"through",
"this",
"might",
"support",
"colors",
"."
] | def _pipepager(generator, cmd, color):
"""Page through text by feeding it to another program. Invoking a
pager through this might support colors.
"""
import subprocess
env = dict(os.environ)
# If we're piping to less we might support colors under the
# condition that
cmd_detail = cmd.... | [
"def",
"_pipepager",
"(",
"generator",
",",
"cmd",
",",
"color",
")",
":",
"import",
"subprocess",
"env",
"=",
"dict",
"(",
"os",
".",
"environ",
")",
"# If we're piping to less we might support colors under the",
"# condition that",
"cmd_detail",
"=",
"cmd",
".",
... | https://github.com/rochacbruno/dynaconf/blob/88adc159d5f5c8ba0d314915f8c9f001e849e2d5/dynaconf/vendor_src/click/_termui_impl.py#L361-L407 | ||
jettify/pytorch-optimizer | 910b414565427f0a66e20040475e7e4385e066a5 | torch_optimizer/qhadam.py | python | QHAdam.step | (self, closure: OptLossClosure = None) | return loss | Performs a single optimization step.
Arguments:
closure: A closure that reevaluates the model and returns the loss. | Performs a single optimization step. | [
"Performs",
"a",
"single",
"optimization",
"step",
"."
] | def step(self, closure: OptLossClosure = None) -> OptFloat:
"""Performs a single optimization step.
Arguments:
closure: A closure that reevaluates the model and returns the loss.
"""
loss = None
if closure is not None:
loss = closure()
for group ... | [
"def",
"step",
"(",
"self",
",",
"closure",
":",
"OptLossClosure",
"=",
"None",
")",
"->",
"OptFloat",
":",
"loss",
"=",
"None",
"if",
"closure",
"is",
"not",
"None",
":",
"loss",
"=",
"closure",
"(",
")",
"for",
"group",
"in",
"self",
".",
"param_gr... | https://github.com/jettify/pytorch-optimizer/blob/910b414565427f0a66e20040475e7e4385e066a5/torch_optimizer/qhadam.py#L78-L153 | |
chipmuenk/pyfda | 665310b8548a940a575c0e5ff4bba94608d9ac26 | pyfda/libs/pyfda_io_lib.py | python | CSV_option_box._load_settings | (self) | Load settings of CSV options widget from ``pyfda_rc.params``. | Load settings of CSV options widget from ``pyfda_rc.params``. | [
"Load",
"settings",
"of",
"CSV",
"options",
"widget",
"from",
"pyfda_rc",
".",
"params",
"."
] | def _load_settings(self):
"""
Load settings of CSV options widget from ``pyfda_rc.params``.
"""
try:
qset_cmb_box(self.cmbDelimiter, params['CSV']['delimiter'], data=True)
qset_cmb_box(self.cmbLineTerminator, params['CSV']['lineterminator'],
... | [
"def",
"_load_settings",
"(",
"self",
")",
":",
"try",
":",
"qset_cmb_box",
"(",
"self",
".",
"cmbDelimiter",
",",
"params",
"[",
"'CSV'",
"]",
"[",
"'delimiter'",
"]",
",",
"data",
"=",
"True",
")",
"qset_cmb_box",
"(",
"self",
".",
"cmbLineTerminator",
... | https://github.com/chipmuenk/pyfda/blob/665310b8548a940a575c0e5ff4bba94608d9ac26/pyfda/libs/pyfda_io_lib.py#L161-L175 | ||
lazyprogrammer/machine_learning_examples | 8c022d46763ab09b4b4e0e32e8960a470093c162 | rl3/a2c/atari_wrappers.py | python | MaxAndSkipEnv.step | (self, action) | return max_frame, total_reward, done, info | Repeat action, sum reward, and max over last observations. | Repeat action, sum reward, and max over last observations. | [
"Repeat",
"action",
"sum",
"reward",
"and",
"max",
"over",
"last",
"observations",
"."
] | def step(self, action):
"""Repeat action, sum reward, and max over last observations."""
total_reward = 0.0
done = None
for i in range(self._skip):
obs, reward, done, info = self.env.step(action)
if i == self._skip - 2:
self._obs_buffer[0] = obs
... | [
"def",
"step",
"(",
"self",
",",
"action",
")",
":",
"total_reward",
"=",
"0.0",
"done",
"=",
"None",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"_skip",
")",
":",
"obs",
",",
"reward",
",",
"done",
",",
"info",
"=",
"self",
".",
"env",
".",
... | https://github.com/lazyprogrammer/machine_learning_examples/blob/8c022d46763ab09b4b4e0e32e8960a470093c162/rl3/a2c/atari_wrappers.py#L105-L122 | |
IronLanguages/ironpython3 | 7a7bb2a872eeab0d1009fc8a6e24dca43f65b693 | Src/StdLib/Lib/xml/etree/ElementTree.py | python | _serialize_html | (write, elem, qnames, namespaces, **kwargs) | [] | def _serialize_html(write, elem, qnames, namespaces, **kwargs):
tag = elem.tag
text = elem.text
if tag is Comment:
write("<!--%s-->" % _escape_cdata(text))
elif tag is ProcessingInstruction:
write("<?%s?>" % _escape_cdata(text))
else:
tag = qnames[tag]
if tag is None:... | [
"def",
"_serialize_html",
"(",
"write",
",",
"elem",
",",
"qnames",
",",
"namespaces",
",",
"*",
"*",
"kwargs",
")",
":",
"tag",
"=",
"elem",
".",
"tag",
"text",
"=",
"elem",
".",
"text",
"if",
"tag",
"is",
"Comment",
":",
"write",
"(",
"\"<!--%s-->\... | https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/xml/etree/ElementTree.py#L957-L1005 | ||||
WerWolv/EdiZon_CheatsConfigsAndScripts | d16d36c7509c01dca770f402babd83ff2e9ae6e7 | Scripts/lib/python3.5/pprint.py | python | pprint | (object, stream=None, indent=1, width=80, depth=None, *,
compact=False) | Pretty-print a Python object to a stream [default is sys.stdout]. | Pretty-print a Python object to a stream [default is sys.stdout]. | [
"Pretty",
"-",
"print",
"a",
"Python",
"object",
"to",
"a",
"stream",
"[",
"default",
"is",
"sys",
".",
"stdout",
"]",
"."
] | def pprint(object, stream=None, indent=1, width=80, depth=None, *,
compact=False):
"""Pretty-print a Python object to a stream [default is sys.stdout]."""
printer = PrettyPrinter(
stream=stream, indent=indent, width=width, depth=depth,
compact=compact)
printer.pprint(object) | [
"def",
"pprint",
"(",
"object",
",",
"stream",
"=",
"None",
",",
"indent",
"=",
"1",
",",
"width",
"=",
"80",
",",
"depth",
"=",
"None",
",",
"*",
",",
"compact",
"=",
"False",
")",
":",
"printer",
"=",
"PrettyPrinter",
"(",
"stream",
"=",
"stream"... | https://github.com/WerWolv/EdiZon_CheatsConfigsAndScripts/blob/d16d36c7509c01dca770f402babd83ff2e9ae6e7/Scripts/lib/python3.5/pprint.py#L47-L53 | ||
Defense-Cyber-Crime-Center/DC3-MWCP | 92f4be12e73d60673a5e9fa59694e75cc27b4edf | mwcp/file_object.py | python | FileObject.md5 | (self) | return self._md5 | Returns md5 hash of file.
:return: hash of the file as a hex string | Returns md5 hash of file.
:return: hash of the file as a hex string | [
"Returns",
"md5",
"hash",
"of",
"file",
".",
":",
"return",
":",
"hash",
"of",
"the",
"file",
"as",
"a",
"hex",
"string"
] | def md5(self):
"""
Returns md5 hash of file.
:return: hash of the file as a hex string
"""
if not self._md5:
self._md5 = hashlib.md5(self.data).hexdigest()
return self._md5 | [
"def",
"md5",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_md5",
":",
"self",
".",
"_md5",
"=",
"hashlib",
".",
"md5",
"(",
"self",
".",
"data",
")",
".",
"hexdigest",
"(",
")",
"return",
"self",
".",
"_md5"
] | https://github.com/Defense-Cyber-Crime-Center/DC3-MWCP/blob/92f4be12e73d60673a5e9fa59694e75cc27b4edf/mwcp/file_object.py#L268-L275 | |
nose-devs/nose | 7c26ad1e6b7d308cafa328ad34736d34028c122a | nose/plugins/cover.py | python | Coverage.beforeTest | (self, *args, **kwargs) | Begin recording coverage information. | Begin recording coverage information. | [
"Begin",
"recording",
"coverage",
"information",
"."
] | def beforeTest(self, *args, **kwargs):
"""
Begin recording coverage information.
"""
if self.coverInstance.is_worker:
self.coverInstance.load()
self.coverInstance.start() | [
"def",
"beforeTest",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"coverInstance",
".",
"is_worker",
":",
"self",
".",
"coverInstance",
".",
"load",
"(",
")",
"self",
".",
"coverInstance",
".",
"start",
"(",
")... | https://github.com/nose-devs/nose/blob/7c26ad1e6b7d308cafa328ad34736d34028c122a/nose/plugins/cover.py#L174-L181 | ||
NVIDIA/runx | bc36ab3d13314d0b00eb73c366f9bad87639e67e | runx/logx.py | python | LogX.initialize | (self, logdir=None, coolname=False, hparams=None,
tensorboard=False, no_timestamp=False, global_rank=0,
eager_flush=True) | Initialize logx
inputs
- logdir - where to write logfiles
- tensorboard - whether to write to tensorboard file
- global_rank - must set this if using distributed training, so we only
log from rank 0
- coolname - generate a unique directory name underneath logdir, else
... | Initialize logx | [
"Initialize",
"logx"
] | def initialize(self, logdir=None, coolname=False, hparams=None,
tensorboard=False, no_timestamp=False, global_rank=0,
eager_flush=True):
'''
Initialize logx
inputs
- logdir - where to write logfiles
- tensorboard - whether to write to tensor... | [
"def",
"initialize",
"(",
"self",
",",
"logdir",
"=",
"None",
",",
"coolname",
"=",
"False",
",",
"hparams",
"=",
"None",
",",
"tensorboard",
"=",
"False",
",",
"no_timestamp",
"=",
"False",
",",
"global_rank",
"=",
"0",
",",
"eager_flush",
"=",
"True",
... | https://github.com/NVIDIA/runx/blob/bc36ab3d13314d0b00eb73c366f9bad87639e67e/runx/logx.py#L79-L176 | ||
salabim/salabim | e0de846b042daf2dc71aaf43d8adc6486b57f376 | salabim.py | python | _i | (p, v0, v1) | return (1 - p) * v0 + p * v1 | [] | def _i(p, v0, v1):
if v0 == v1:
return v0 # avoid rounding problems
if (v0 is None) or (v1 is None):
return None
return (1 - p) * v0 + p * v1 | [
"def",
"_i",
"(",
"p",
",",
"v0",
",",
"v1",
")",
":",
"if",
"v0",
"==",
"v1",
":",
"return",
"v0",
"# avoid rounding problems",
"if",
"(",
"v0",
"is",
"None",
")",
"or",
"(",
"v1",
"is",
"None",
")",
":",
"return",
"None",
"return",
"(",
"1",
... | https://github.com/salabim/salabim/blob/e0de846b042daf2dc71aaf43d8adc6486b57f376/salabim.py#L18334-L18339 | |||
fronzbot/blinkpy | 21f29ad302072d16efdc8205aaba826013e69176 | blinkpy/auth.py | python | Auth.prepare_request | (self, url, headers, data, reqtype) | return req.prepare() | Prepare a request. | Prepare a request. | [
"Prepare",
"a",
"request",
"."
] | def prepare_request(self, url, headers, data, reqtype):
"""Prepare a request."""
req = Request(reqtype.upper(), url, headers=headers, data=data)
return req.prepare() | [
"def",
"prepare_request",
"(",
"self",
",",
"url",
",",
"headers",
",",
"data",
",",
"reqtype",
")",
":",
"req",
"=",
"Request",
"(",
"reqtype",
".",
"upper",
"(",
")",
",",
"url",
",",
"headers",
"=",
"headers",
",",
"data",
"=",
"data",
")",
"ret... | https://github.com/fronzbot/blinkpy/blob/21f29ad302072d16efdc8205aaba826013e69176/blinkpy/auth.py#L88-L91 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/insteon/insteon_entity.py | python | InsteonEntity._async_read_aldb | (self, reload) | Call device load process and print to log. | Call device load process and print to log. | [
"Call",
"device",
"load",
"process",
"and",
"print",
"to",
"log",
"."
] | async def _async_read_aldb(self, reload):
"""Call device load process and print to log."""
await self._insteon_device.aldb.async_load(refresh=reload)
self._print_aldb()
async_dispatcher_send(self.hass, SIGNAL_SAVE_DEVICES) | [
"async",
"def",
"_async_read_aldb",
"(",
"self",
",",
"reload",
")",
":",
"await",
"self",
".",
"_insteon_device",
".",
"aldb",
".",
"async_load",
"(",
"refresh",
"=",
"reload",
")",
"self",
".",
"_print_aldb",
"(",
")",
"async_dispatcher_send",
"(",
"self",... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/insteon/insteon_entity.py#L144-L148 | ||
IronLanguages/main | a949455434b1fda8c783289e897e78a9a0caabb5 | External.LCA_RESTRICTED/Languages/CPython/27/Lib/logging/__init__.py | python | _addHandlerRef | (handler) | Add a handler to the internal cleanup list using a weak reference. | Add a handler to the internal cleanup list using a weak reference. | [
"Add",
"a",
"handler",
"to",
"the",
"internal",
"cleanup",
"list",
"using",
"a",
"weak",
"reference",
"."
] | def _addHandlerRef(handler):
"""
Add a handler to the internal cleanup list using a weak reference.
"""
_acquireLock()
try:
_handlerList.append(weakref.ref(handler, _removeHandlerRef))
finally:
_releaseLock() | [
"def",
"_addHandlerRef",
"(",
"handler",
")",
":",
"_acquireLock",
"(",
")",
"try",
":",
"_handlerList",
".",
"append",
"(",
"weakref",
".",
"ref",
"(",
"handler",
",",
"_removeHandlerRef",
")",
")",
"finally",
":",
"_releaseLock",
"(",
")"
] | https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/CPython/27/Lib/logging/__init__.py#L631-L639 | ||
apple/ccs-calendarserver | 13c706b985fb728b9aab42dc0fef85aae21921c3 | txdav/caldav/datastore/scheduling/implicit.py | python | ImplicitScheduler.extractAttendees | (self) | Extract details about the attendees from the new calendar data. We do this
in its own method because we might need to refresh this information if the attendee
list changes after a test_X call but before scheduling itself needs to happen. That
can occur when group attendee reconciliation occurs. | Extract details about the attendees from the new calendar data. We do this
in its own method because we might need to refresh this information if the attendee
list changes after a test_X call but before scheduling itself needs to happen. That
can occur when group attendee reconciliation occurs. | [
"Extract",
"details",
"about",
"the",
"attendees",
"from",
"the",
"new",
"calendar",
"data",
".",
"We",
"do",
"this",
"in",
"its",
"own",
"method",
"because",
"we",
"might",
"need",
"to",
"refresh",
"this",
"information",
"if",
"the",
"attendee",
"list",
"... | def extractAttendees(self):
"""
Extract details about the attendees from the new calendar data. We do this
in its own method because we might need to refresh this information if the attendee
list changes after a test_X call but before scheduling itself needs to happen. That
can o... | [
"def",
"extractAttendees",
"(",
"self",
")",
":",
"# Coerce any local with SCHEDULE-AGENT=CLIENT",
"yield",
"self",
".",
"coerceAttendeeScheduleAgent",
"(",
")",
"# Get the ATTENDEEs",
"self",
".",
"attendeesByInstance",
"=",
"self",
".",
"calendar",
".",
"getAttendeesByI... | https://github.com/apple/ccs-calendarserver/blob/13c706b985fb728b9aab42dc0fef85aae21921c3/txdav/caldav/datastore/scheduling/implicit.py#L556-L570 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/pygments/formatters/img.py | python | ImageFormatter._get_line_height | (self) | return self.fonth + self.line_pad | Get the height of a line. | Get the height of a line. | [
"Get",
"the",
"height",
"of",
"a",
"line",
"."
] | def _get_line_height(self):
"""
Get the height of a line.
"""
return self.fonth + self.line_pad | [
"def",
"_get_line_height",
"(",
"self",
")",
":",
"return",
"self",
".",
"fonth",
"+",
"self",
".",
"line_pad"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/pygments/formatters/img.py#L390-L394 | |
googleapis/oauth2client | 50d20532a748f18e53f7d24ccbe6647132c979a9 | oauth2client/_pkce.py | python | code_verifier | (n_bytes=64) | Generates a 'code_verifier' as described in section 4.1 of RFC 7636.
This is a 'high-entropy cryptographic random string' that will be
impractical for an attacker to guess.
Args:
n_bytes: integer between 31 and 96, inclusive. default: 64
number of bytes of entropy to include in verifie... | Generates a 'code_verifier' as described in section 4.1 of RFC 7636. | [
"Generates",
"a",
"code_verifier",
"as",
"described",
"in",
"section",
"4",
".",
"1",
"of",
"RFC",
"7636",
"."
] | def code_verifier(n_bytes=64):
"""
Generates a 'code_verifier' as described in section 4.1 of RFC 7636.
This is a 'high-entropy cryptographic random string' that will be
impractical for an attacker to guess.
Args:
n_bytes: integer between 31 and 96, inclusive. default: 64
numbe... | [
"def",
"code_verifier",
"(",
"n_bytes",
"=",
"64",
")",
":",
"verifier",
"=",
"base64",
".",
"urlsafe_b64encode",
"(",
"os",
".",
"urandom",
"(",
"n_bytes",
")",
")",
".",
"rstrip",
"(",
"b'='",
")",
"# https://tools.ietf.org/html/rfc7636#section-4.1",
"# minimu... | https://github.com/googleapis/oauth2client/blob/50d20532a748f18e53f7d24ccbe6647132c979a9/oauth2client/_pkce.py#L27-L49 | ||
nneonneo/eqgrp-free-file | 49e457d7ac870d5e00f5a247b94476cd5643f3ba | Firewall/EXPLOITS/EXBA/scapy/plist.py | python | PacketList.replace | (self, *args, **kargs) | return x | lst.replace(<field>,[<oldvalue>,]<newvalue>)
lst.replace( (fld,[ov],nv),(fld,[ov,]nv),...)
if ov is None, all values are replaced
ex:
lst.replace( IP.src, "192.168.1.1", "10.0.0.1" )
lst.replace( IP.ttl, 64 )
lst.replace( (IP.ttl, 64), (TCP.sport, 666, 777), ) | lst.replace(<field>,[<oldvalue>,]<newvalue>)
lst.replace( (fld,[ov],nv),(fld,[ov,]nv),...)
if ov is None, all values are replaced
ex:
lst.replace( IP.src, "192.168.1.1", "10.0.0.1" )
lst.replace( IP.ttl, 64 )
lst.replace( (IP.ttl, 64), (TCP.sport, 666, 777), ) | [
"lst",
".",
"replace",
"(",
"<field",
">",
"[",
"<oldvalue",
">",
"]",
"<newvalue",
">",
")",
"lst",
".",
"replace",
"(",
"(",
"fld",
"[",
"ov",
"]",
"nv",
")",
"(",
"fld",
"[",
"ov",
"]",
"nv",
")",
"...",
")",
"if",
"ov",
"is",
"None",
"all... | def replace(self, *args, **kargs):
"""
lst.replace(<field>,[<oldvalue>,]<newvalue>)
lst.replace( (fld,[ov],nv),(fld,[ov,]nv),...)
if ov is None, all values are replaced
ex:
lst.replace( IP.src, "192.168.1.1", "10.0.0.1" )
lst.replace( IP.ttl, 64 )
... | [
"def",
"replace",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kargs",
")",
":",
"delete_checksums",
"=",
"kargs",
".",
"get",
"(",
"\"delete_checksums\"",
",",
"False",
")",
"x",
"=",
"PacketList",
"(",
"name",
"=",
"\"Replaced %s\"",
"%",
"self",
"... | https://github.com/nneonneo/eqgrp-free-file/blob/49e457d7ac870d5e00f5a247b94476cd5643f3ba/Firewall/EXPLOITS/EXBA/scapy/plist.py#L436-L467 | |
sfepy/sfepy | 02ec7bb2ab39ee1dfe1eb4cd509f0ffb7dcc8b25 | sfepy/discrete/iga/iga.py | python | compute_bezier_extraction_1d | (knots, degree) | return nm.asarray(cs, dtype=nm.float64) | Compute local (element) Bezier extraction operators for a 1D B-spline
parametric domain.
Parameters
----------
knots : array
The knot vector.
degree : int
The curve degree.
Returns
-------
cs : array of 2D arrays (3D array)
The element extraction operators. | Compute local (element) Bezier extraction operators for a 1D B-spline
parametric domain. | [
"Compute",
"local",
"(",
"element",
")",
"Bezier",
"extraction",
"operators",
"for",
"a",
"1D",
"B",
"-",
"spline",
"parametric",
"domain",
"."
] | def compute_bezier_extraction_1d(knots, degree):
"""
Compute local (element) Bezier extraction operators for a 1D B-spline
parametric domain.
Parameters
----------
knots : array
The knot vector.
degree : int
The curve degree.
Returns
-------
cs : array of 2D arr... | [
"def",
"compute_bezier_extraction_1d",
"(",
"knots",
",",
"degree",
")",
":",
"knots",
"=",
"nm",
".",
"asarray",
"(",
"knots",
",",
"dtype",
"=",
"nm",
".",
"float64",
")",
"n_knots",
"=",
"knots",
".",
"shape",
"[",
"0",
"]",
"a",
"=",
"degree",
"b... | https://github.com/sfepy/sfepy/blob/02ec7bb2ab39ee1dfe1eb4cd509f0ffb7dcc8b25/sfepy/discrete/iga/iga.py#L65-L131 | |
phimpme/phimpme-generator | ba6d11190b9016238f27672e1ad55e6a875b74a0 | Phimpme/site-packages/nose/plugins/base.py | python | IPluginInterface.startTest | (self, test) | Called before each test is run. DO NOT return a value unless
you want to stop other plugins from seeing the test start.
:param test: the test case
:type test: :class:`nose.case.Test` | Called before each test is run. DO NOT return a value unless
you want to stop other plugins from seeing the test start. | [
"Called",
"before",
"each",
"test",
"is",
"run",
".",
"DO",
"NOT",
"return",
"a",
"value",
"unless",
"you",
"want",
"to",
"stop",
"other",
"plugins",
"from",
"seeing",
"the",
"test",
"start",
"."
] | def startTest(self, test):
"""Called before each test is run. DO NOT return a value unless
you want to stop other plugins from seeing the test start.
:param test: the test case
:type test: :class:`nose.case.Test`
"""
pass | [
"def",
"startTest",
"(",
"self",
",",
"test",
")",
":",
"pass"
] | https://github.com/phimpme/phimpme-generator/blob/ba6d11190b9016238f27672e1ad55e6a875b74a0/Phimpme/site-packages/nose/plugins/base.py#L627-L634 | ||
EiNSTeiN-/decompiler | f7923b54233d5aa2118686d99ba93380063993ed | src/ir/generic.py | python | ir_base.next_instruction_ea | (self, ea) | return the address of the next instruction. | return the address of the next instruction. | [
"return",
"the",
"address",
"of",
"the",
"next",
"instruction",
"."
] | def next_instruction_ea(self, ea):
""" return the address of the next instruction. """
raise NotImplemented('base class must override this method') | [
"def",
"next_instruction_ea",
"(",
"self",
",",
"ea",
")",
":",
"raise",
"NotImplemented",
"(",
"'base class must override this method'",
")"
] | https://github.com/EiNSTeiN-/decompiler/blob/f7923b54233d5aa2118686d99ba93380063993ed/src/ir/generic.py#L22-L24 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/wagtail_bak/wagtailimages/image_operations.py | python | FillOperation.run | (self, willow, image, env) | return willow | [] | def run(self, willow, image, env):
image_width, image_height = willow.get_size()
focal_point = image.get_focal_point()
# Get crop aspect ratio
crop_aspect_ratio = self.width / self.height
# Get crop max
crop_max_scale = min(image_width, image_height * crop_aspect_ratio)... | [
"def",
"run",
"(",
"self",
",",
"willow",
",",
"image",
",",
"env",
")",
":",
"image_width",
",",
"image_height",
"=",
"willow",
".",
"get_size",
"(",
")",
"focal_point",
"=",
"image",
".",
"get_focal_point",
"(",
")",
"# Get crop aspect ratio",
"crop_aspect... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/wagtail_bak/wagtailimages/image_operations.py#L66-L144 | |||
conjure-up/conjure-up | d2bf8ab8e71ff01321d0e691a8d3e3833a047678 | conjureup/bundle.py | python | SnapBundleApplicationFragment.confinement | (self) | return self._confinement | Get confinment | Get confinment | [
"Get",
"confinment"
] | def confinement(self):
""" Get confinment
"""
return self._confinement | [
"def",
"confinement",
"(",
"self",
")",
":",
"return",
"self",
".",
"_confinement"
] | https://github.com/conjure-up/conjure-up/blob/d2bf8ab8e71ff01321d0e691a8d3e3833a047678/conjureup/bundle.py#L120-L123 | |
scour-project/scour | 0609c596766ec98e4e2092b49bd03b802702ba1a | scour/scour.py | python | create_groups_for_common_attributes | (elem, stats) | Creates <g> elements to contain runs of 3 or more
consecutive child elements having at least one common attribute.
Common attributes are not promoted to the <g> by this function.
This is handled by moveCommonAttributesToParentGroup.
If all children have a common attribute, an extra <g> is not created.... | Creates <g> elements to contain runs of 3 or more
consecutive child elements having at least one common attribute. | [
"Creates",
"<g",
">",
"elements",
"to",
"contain",
"runs",
"of",
"3",
"or",
"more",
"consecutive",
"child",
"elements",
"having",
"at",
"least",
"one",
"common",
"attribute",
"."
] | def create_groups_for_common_attributes(elem, stats):
"""
Creates <g> elements to contain runs of 3 or more
consecutive child elements having at least one common attribute.
Common attributes are not promoted to the <g> by this function.
This is handled by moveCommonAttributesToParentGroup.
If ... | [
"def",
"create_groups_for_common_attributes",
"(",
"elem",
",",
"stats",
")",
":",
"# TODO perhaps all of the Presentation attributes in http://www.w3.org/TR/SVG/struct.html#GElement",
"# could be added here",
"# Cyn: These attributes are the same as in moveAttributesToParentGroup, and must alwa... | https://github.com/scour-project/scour/blob/0609c596766ec98e4e2092b49bd03b802702ba1a/scour/scour.py#L1217-L1338 | ||
skorch-dev/skorch | cf6615be4e62a16af6f8d83a47e8b59b5c48a58c | skorch/net.py | python | NeuralNet.evaluation_step | (self, batch, training=False) | Perform a forward step to produce the output used for
prediction and scoring.
Therefore, the module is set to evaluation mode by default
beforehand which can be overridden to re-enable features
like dropout by setting ``training=True``.
Parameters
----------
bat... | Perform a forward step to produce the output used for
prediction and scoring. | [
"Perform",
"a",
"forward",
"step",
"to",
"produce",
"the",
"output",
"used",
"for",
"prediction",
"and",
"scoring",
"."
] | def evaluation_step(self, batch, training=False):
"""Perform a forward step to produce the output used for
prediction and scoring.
Therefore, the module is set to evaluation mode by default
beforehand which can be overridden to re-enable features
like dropout by setting ``traini... | [
"def",
"evaluation_step",
"(",
"self",
",",
"batch",
",",
"training",
"=",
"False",
")",
":",
"self",
".",
"check_is_fitted",
"(",
")",
"Xi",
",",
"_",
"=",
"unpack_data",
"(",
"batch",
")",
"with",
"torch",
".",
"set_grad_enabled",
"(",
"training",
")",... | https://github.com/skorch-dev/skorch/blob/cf6615be4e62a16af6f8d83a47e8b59b5c48a58c/skorch/net.py#L1010-L1036 | ||
bikalims/bika.lims | 35e4bbdb5a3912cae0b5eb13e51097c8b0486349 | bika/lims/exportimport/setupdata/__init__.py | python | Reference_Samples.Import | (self) | [] | def Import(self):
bsc = getToolByName(self.context, 'bika_setup_catalog')
for row in self.get_rows(3):
if not row['id']:
continue
supplier = bsc(portal_type='Supplier',
getName=row.get('Supplier_title', ''))[0].getObject()
ob... | [
"def",
"Import",
"(",
"self",
")",
":",
"bsc",
"=",
"getToolByName",
"(",
"self",
".",
"context",
",",
"'bika_setup_catalog'",
")",
"for",
"row",
"in",
"self",
".",
"get_rows",
"(",
"3",
")",
":",
"if",
"not",
"row",
"[",
"'id'",
"]",
":",
"continue"... | https://github.com/bikalims/bika.lims/blob/35e4bbdb5a3912cae0b5eb13e51097c8b0486349/bika/lims/exportimport/setupdata/__init__.py#L2082-L2113 | ||||
hakril/PythonForWindows | 61e027a678d5b87aa64fcf8a37a6661a86236589 | windows/security.py | python | ObjectRelatedACE.inherited_object_type | (self) | return self.ObjectType | The ``InheritedObjectType`` described in the ACE. ``None`` if `ACE`` has no ``InheritedObjectType``
:type: :class:`~windows.generated_def.winstructs.PSID` or ``None`` | The ``InheritedObjectType`` described in the ACE. ``None`` if `ACE`` has no ``InheritedObjectType`` | [
"The",
"InheritedObjectType",
"described",
"in",
"the",
"ACE",
".",
"None",
"if",
"ACE",
"has",
"no",
"InheritedObjectType"
] | def inherited_object_type(self):
"""The ``InheritedObjectType`` described in the ACE. ``None`` if `ACE`` has no ``InheritedObjectType``
:type: :class:`~windows.generated_def.winstructs.PSID` or ``None``
"""
if not self.Flags & gdef.ACE_INHERITED_OBJECT_TYPE_PRESENT:
return N... | [
"def",
"inherited_object_type",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"Flags",
"&",
"gdef",
".",
"ACE_INHERITED_OBJECT_TYPE_PRESENT",
":",
"return",
"None",
"if",
"self",
".",
"Flags",
"&",
"gdef",
".",
"ACE_OBJECT_TYPE_PRESENT",
":",
"# There is an O... | https://github.com/hakril/PythonForWindows/blob/61e027a678d5b87aa64fcf8a37a6661a86236589/windows/security.py#L422-L434 | |
taers232c/GAMADV-XTD3 | 3097d6c24b7377037c746317908fcaff8404d88a | src/gam/gdata/tlslite/utils/RSAKey.py | python | RSAKey.decrypt | (self, encBytes) | return decBytes[x+1:] | Decrypt the passed-in bytes.
This requires the key to have a private component. It performs
PKCS1 decryption of the passed-in data.
@type encBytes: L{array.array} of unsigned bytes
@param encBytes: The value which will be decrypted.
@rtype: L{array.array} of unsigned bytes or... | Decrypt the passed-in bytes. | [
"Decrypt",
"the",
"passed",
"-",
"in",
"bytes",
"."
] | def decrypt(self, encBytes):
"""Decrypt the passed-in bytes.
This requires the key to have a private component. It performs
PKCS1 decryption of the passed-in data.
@type encBytes: L{array.array} of unsigned bytes
@param encBytes: The value which will be decrypted.
@rt... | [
"def",
"decrypt",
"(",
"self",
",",
"encBytes",
")",
":",
"if",
"not",
"self",
".",
"hasPrivateKey",
"(",
")",
":",
"raise",
"AssertionError",
"(",
")",
"c",
"=",
"bytesToNumber",
"(",
"encBytes",
")",
"if",
"c",
">=",
"self",
".",
"n",
":",
"return"... | https://github.com/taers232c/GAMADV-XTD3/blob/3097d6c24b7377037c746317908fcaff8404d88a/src/gam/gdata/tlslite/utils/RSAKey.py#L164-L193 | |
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/matrices/dense.py | python | MutableDenseMatrix.col_swap | (self, i, j) | Swap the two given columns of the matrix in-place.
Examples
========
>>> from sympy.matrices import Matrix
>>> M = Matrix([[1, 0], [1, 0]])
>>> M
Matrix([
[1, 0],
[1, 0]])
>>> M.col_swap(0, 1)
>>> M
Matrix([
[0, 1],
... | Swap the two given columns of the matrix in-place. | [
"Swap",
"the",
"two",
"given",
"columns",
"of",
"the",
"matrix",
"in",
"-",
"place",
"."
] | def col_swap(self, i, j):
"""Swap the two given columns of the matrix in-place.
Examples
========
>>> from sympy.matrices import Matrix
>>> M = Matrix([[1, 0], [1, 0]])
>>> M
Matrix([
[1, 0],
[1, 0]])
>>> M.col_swap(0, 1)
>>> M
... | [
"def",
"col_swap",
"(",
"self",
",",
"i",
",",
"j",
")",
":",
"for",
"k",
"in",
"range",
"(",
"0",
",",
"self",
".",
"rows",
")",
":",
"self",
"[",
"k",
",",
"i",
"]",
",",
"self",
"[",
"k",
",",
"j",
"]",
"=",
"self",
"[",
"k",
",",
"j... | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/matrices/dense.py#L846-L871 | ||
SheffieldML/GPy | bb1bc5088671f9316bc92a46d356734e34c2d5c0 | GPy/util/misc.py | python | blockify_dhess_dtheta | (func) | return wrapper_func | [] | def blockify_dhess_dtheta(func):
def wrapper_func(self, *args, **kwargs):
# Invoke the wrapped function first
retval = func(self, *args, **kwargs)
# Now do something here with retval and/or action
if self.not_block_really and (len(retval.shape) < 3):
num_data = retval.sha... | [
"def",
"blockify_dhess_dtheta",
"(",
"func",
")",
":",
"def",
"wrapper_func",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Invoke the wrapped function first",
"retval",
"=",
"func",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"k... | https://github.com/SheffieldML/GPy/blob/bb1bc5088671f9316bc92a46d356734e34c2d5c0/GPy/util/misc.py#L165-L180 | |||
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/asn1crypto-0.24.0/asn1crypto/algos.py | python | EncryptionAlgorithm.encryption_block_size | (self) | Returns the block size of the encryption cipher, in bytes.
:return:
An integer that is the block size in bytes | Returns the block size of the encryption cipher, in bytes. | [
"Returns",
"the",
"block",
"size",
"of",
"the",
"encryption",
"cipher",
"in",
"bytes",
"."
] | def encryption_block_size(self):
"""
Returns the block size of the encryption cipher, in bytes.
:return:
An integer that is the block size in bytes
"""
encryption_algo = self['algorithm'].native
if encryption_algo[0:7] in set(['aes128_', 'aes192_', 'aes256_... | [
"def",
"encryption_block_size",
"(",
"self",
")",
":",
"encryption_algo",
"=",
"self",
"[",
"'algorithm'",
"]",
".",
"native",
"if",
"encryption_algo",
"[",
"0",
":",
"7",
"]",
"in",
"set",
"(",
"[",
"'aes128_'",
",",
"'aes192_'",
",",
"'aes256_'",
"]",
... | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/asn1crypto-0.24.0/asn1crypto/algos.py#L985-L1033 | ||
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/preview/understand/assistant/task/field.py | python | FieldInstance.unique_name | (self) | return self._properties['unique_name'] | :returns: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long.
:rtype: unicode | :returns: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long.
:rtype: unicode | [
":",
"returns",
":",
"A",
"user",
"-",
"provided",
"string",
"that",
"uniquely",
"identifies",
"this",
"resource",
"as",
"an",
"alternative",
"to",
"the",
"sid",
".",
"Unique",
"up",
"to",
"64",
"characters",
"long",
".",
":",
"rtype",
":",
"unicode"
] | def unique_name(self):
"""
:returns: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long.
:rtype: unicode
"""
return self._properties['unique_name'] | [
"def",
"unique_name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_properties",
"[",
"'unique_name'",
"]"
] | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/preview/understand/assistant/task/field.py#L397-L402 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/sqlalchemy/sql/selectable.py | python | CompoundSelect._create_union_all | (cls, *selects, **kwargs) | return CompoundSelect(CompoundSelect.UNION_ALL, *selects, **kwargs) | r"""Return a ``UNION ALL`` of multiple selectables.
The returned object is an instance of
:class:`.CompoundSelect`.
A similar :func:`union_all()` method is available on all
:class:`.FromClause` subclasses.
\*selects
a list of :class:`.Select` instances.
\**k... | r"""Return a ``UNION ALL`` of multiple selectables. | [
"r",
"Return",
"a",
"UNION",
"ALL",
"of",
"multiple",
"selectables",
"."
] | def _create_union_all(cls, *selects, **kwargs):
r"""Return a ``UNION ALL`` of multiple selectables.
The returned object is an instance of
:class:`.CompoundSelect`.
A similar :func:`union_all()` method is available on all
:class:`.FromClause` subclasses.
\*selects
... | [
"def",
"_create_union_all",
"(",
"cls",
",",
"*",
"selects",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"CompoundSelect",
"(",
"CompoundSelect",
".",
"UNION_ALL",
",",
"*",
"selects",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/sqlalchemy/sql/selectable.py#L2317-L2334 | |
maraoz/proofofexistence | 10703675824e989f59a8d36fd8c06394e71a2c25 | babel/messages/jslexer.py | python | unquote_string | (string) | return u''.join(result) | Unquote a string with JavaScript rules. The string has to start with
string delimiters (``'`` or ``"``.) | Unquote a string with JavaScript rules. The string has to start with
string delimiters (``'`` or ``"``.) | [
"Unquote",
"a",
"string",
"with",
"JavaScript",
"rules",
".",
"The",
"string",
"has",
"to",
"start",
"with",
"string",
"delimiters",
"(",
"or",
".",
")"
] | def unquote_string(string):
"""Unquote a string with JavaScript rules. The string has to start with
string delimiters (``'`` or ``"``.)
"""
assert string and string[0] == string[-1] and string[0] in '"\'', \
'string provided is not properly delimited'
string = line_join_re.sub('\\1', string... | [
"def",
"unquote_string",
"(",
"string",
")",
":",
"assert",
"string",
"and",
"string",
"[",
"0",
"]",
"==",
"string",
"[",
"-",
"1",
"]",
"and",
"string",
"[",
"0",
"]",
"in",
"'\"\\''",
",",
"'string provided is not properly delimited'",
"string",
"=",
"l... | https://github.com/maraoz/proofofexistence/blob/10703675824e989f59a8d36fd8c06394e71a2c25/babel/messages/jslexer.py#L74-L127 | |
triaquae/triaquae | bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9 | TriAquae/models/django/views/generic/edit.py | python | ModelFormMixin.form_valid | (self, form) | return super(ModelFormMixin, self).form_valid(form) | If the form is valid, save the associated model. | If the form is valid, save the associated model. | [
"If",
"the",
"form",
"is",
"valid",
"save",
"the",
"associated",
"model",
"."
] | def form_valid(self, form):
"""
If the form is valid, save the associated model.
"""
self.object = form.save()
return super(ModelFormMixin, self).form_valid(form) | [
"def",
"form_valid",
"(",
"self",
",",
"form",
")",
":",
"self",
".",
"object",
"=",
"form",
".",
"save",
"(",
")",
"return",
"super",
"(",
"ModelFormMixin",
",",
"self",
")",
".",
"form_valid",
"(",
"form",
")"
] | https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/django/views/generic/edit.py#L123-L128 | |
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | bin/x86/Debug/scripting_engine/Lib/lib2to3/pytree.py | python | LeafPattern.match | (self, node, results=None) | return BasePattern.match(self, node, results) | Override match() to insist on a leaf node. | Override match() to insist on a leaf node. | [
"Override",
"match",
"()",
"to",
"insist",
"on",
"a",
"leaf",
"node",
"."
] | def match(self, node, results=None):
"""Override match() to insist on a leaf node."""
if not isinstance(node, Leaf):
return False
return BasePattern.match(self, node, results) | [
"def",
"match",
"(",
"self",
",",
"node",
",",
"results",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"node",
",",
"Leaf",
")",
":",
"return",
"False",
"return",
"BasePattern",
".",
"match",
"(",
"self",
",",
"node",
",",
"results",
")"
] | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/bin/x86/Debug/scripting_engine/Lib/lib2to3/pytree.py#L556-L560 | |
mrkipling/maraschino | c6be9286937783ae01df2d6d8cebfc8b2734a7d7 | lib/sqlalchemy/dialects/mysql/oursql.py | python | MySQLDialect_oursql._compat_fetchall | (self, rp, charset=None) | return rp.fetchall() | oursql isn't super-broken like MySQLdb, yaaay. | oursql isn't super-broken like MySQLdb, yaaay. | [
"oursql",
"isn",
"t",
"super",
"-",
"broken",
"like",
"MySQLdb",
"yaaay",
"."
] | def _compat_fetchall(self, rp, charset=None):
"""oursql isn't super-broken like MySQLdb, yaaay."""
return rp.fetchall() | [
"def",
"_compat_fetchall",
"(",
"self",
",",
"rp",
",",
"charset",
"=",
"None",
")",
":",
"return",
"rp",
".",
"fetchall",
"(",
")"
] | https://github.com/mrkipling/maraschino/blob/c6be9286937783ae01df2d6d8cebfc8b2734a7d7/lib/sqlalchemy/dialects/mysql/oursql.py#L255-L257 | |
googleads/google-ads-python | 2a1d6062221f6aad1992a6bcca0e7e4a93d2db86 | google/ads/googleads/v7/services/services/billing_setup_service/client.py | python | BillingSetupServiceClient.parse_common_project_path | (path: str) | return m.groupdict() if m else {} | Parse a project path into its component segments. | Parse a project path into its component segments. | [
"Parse",
"a",
"project",
"path",
"into",
"its",
"component",
"segments",
"."
] | def parse_common_project_path(path: str) -> Dict[str, str]:
"""Parse a project path into its component segments."""
m = re.match(r"^projects/(?P<project>.+?)$", path)
return m.groupdict() if m else {} | [
"def",
"parse_common_project_path",
"(",
"path",
":",
"str",
")",
"->",
"Dict",
"[",
"str",
",",
"str",
"]",
":",
"m",
"=",
"re",
".",
"match",
"(",
"r\"^projects/(?P<project>.+?)$\"",
",",
"path",
")",
"return",
"m",
".",
"groupdict",
"(",
")",
"if",
... | https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v7/services/services/billing_setup_service/client.py#L243-L246 | |
snarfed/bridgy | abe88af0fcea875e1803c0e1379ee89e469bbcef | mastodon.py | python | Mastodon.is_private | (self) | return json_loads(self.auth_entity.get().user_json).get('locked') | Returns True if this Mastodon account is protected.
https://docs.joinmastodon.org/user/preferences/#misc
https://docs.joinmastodon.org/entities/account/ | Returns True if this Mastodon account is protected. | [
"Returns",
"True",
"if",
"this",
"Mastodon",
"account",
"is",
"protected",
"."
] | def is_private(self):
"""Returns True if this Mastodon account is protected.
https://docs.joinmastodon.org/user/preferences/#misc
https://docs.joinmastodon.org/entities/account/
"""
return json_loads(self.auth_entity.get().user_json).get('locked') | [
"def",
"is_private",
"(",
"self",
")",
":",
"return",
"json_loads",
"(",
"self",
".",
"auth_entity",
".",
"get",
"(",
")",
".",
"user_json",
")",
".",
"get",
"(",
"'locked'",
")"
] | https://github.com/snarfed/bridgy/blob/abe88af0fcea875e1803c0e1379ee89e469bbcef/mastodon.py#L132-L138 | |
sendgrid/sendgrid-python | df13b78b0cdcb410b4516f6761c4d3138edd4b2d | sendgrid/helpers/mail/tracking_settings.py | python | TrackingSettings.open_tracking | (self) | return self._open_tracking | Allows you to track whether a recipient opened your email.
:rtype: OpenTracking | Allows you to track whether a recipient opened your email. | [
"Allows",
"you",
"to",
"track",
"whether",
"a",
"recipient",
"opened",
"your",
"email",
"."
] | def open_tracking(self):
"""Allows you to track whether a recipient opened your email.
:rtype: OpenTracking
"""
return self._open_tracking | [
"def",
"open_tracking",
"(",
"self",
")",
":",
"return",
"self",
".",
"_open_tracking"
] | https://github.com/sendgrid/sendgrid-python/blob/df13b78b0cdcb410b4516f6761c4d3138edd4b2d/sendgrid/helpers/mail/tracking_settings.py#L66-L71 | |
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/pip/models/index.py | python | Index.__init__ | (self, url) | [] | def __init__(self, url):
self.url = url
self.netloc = urllib_parse.urlsplit(url).netloc
self.simple_url = self.url_to_path('simple')
self.pypi_url = self.url_to_path('pypi')
self.pip_json_url = self.url_to_path('pypi/pip/json') | [
"def",
"__init__",
"(",
"self",
",",
"url",
")",
":",
"self",
".",
"url",
"=",
"url",
"self",
".",
"netloc",
"=",
"urllib_parse",
".",
"urlsplit",
"(",
"url",
")",
".",
"netloc",
"self",
".",
"simple_url",
"=",
"self",
".",
"url_to_path",
"(",
"'simp... | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/pip/models/index.py#L5-L10 | ||||
bigmlcom/python | 35f69d2f3121f1b3dde43495cf145d4992796ad5 | bigml/association.py | python | Association.rules_csv | (self, file_name, **kwargs) | Stores the rules in CSV format in the user-given file. The rules
can be previously selected using the arguments in get_rules | Stores the rules in CSV format in the user-given file. The rules
can be previously selected using the arguments in get_rules | [
"Stores",
"the",
"rules",
"in",
"CSV",
"format",
"in",
"the",
"user",
"-",
"given",
"file",
".",
"The",
"rules",
"can",
"be",
"previously",
"selected",
"using",
"the",
"arguments",
"in",
"get_rules"
] | def rules_csv(self, file_name, **kwargs):
"""Stores the rules in CSV format in the user-given file. The rules
can be previously selected using the arguments in get_rules
"""
rules = self.get_rules(**kwargs)
rules = [self.describe(rule.to_csv()) for rule in rules]
if f... | [
"def",
"rules_csv",
"(",
"self",
",",
"file_name",
",",
"*",
"*",
"kwargs",
")",
":",
"rules",
"=",
"self",
".",
"get_rules",
"(",
"*",
"*",
"kwargs",
")",
"rules",
"=",
"[",
"self",
".",
"describe",
"(",
"rule",
".",
"to_csv",
"(",
")",
")",
"fo... | https://github.com/bigmlcom/python/blob/35f69d2f3121f1b3dde43495cf145d4992796ad5/bigml/association.py#L400-L415 | ||
tensorflow/tfx | b4a6b83269815ed12ba9df9e9154c7376fef2ea0 | tfx/extensions/google_cloud_ai_platform/runner.py | python | get_service_name_and_api_version | (
ai_platform_serving_args: Dict[str, Any]) | return ('ml', _DEFAULT_API_VERSION) | Gets service name and api version from ai_platform_serving_args.
Args:
ai_platform_serving_args: Dictionary containing arguments for pushing to AI
Platform.
Returns:
Service name and API version. | Gets service name and api version from ai_platform_serving_args. | [
"Gets",
"service",
"name",
"and",
"api",
"version",
"from",
"ai_platform_serving_args",
"."
] | def get_service_name_and_api_version(
ai_platform_serving_args: Dict[str, Any]): # -> Tuple[Text, Text]
"""Gets service name and api version from ai_platform_serving_args.
Args:
ai_platform_serving_args: Dictionary containing arguments for pushing to AI
Platform.
Returns:
Service name and API... | [
"def",
"get_service_name_and_api_version",
"(",
"ai_platform_serving_args",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
")",
":",
"# -> Tuple[Text, Text]",
"del",
"ai_platform_serving_args",
"return",
"(",
"'ml'",
",",
"_DEFAULT_API_VERSION",
")"
] | https://github.com/tensorflow/tfx/blob/b4a6b83269815ed12ba9df9e9154c7376fef2ea0/tfx/extensions/google_cloud_ai_platform/runner.py#L208-L220 | |
pydicom/pynetdicom | f57d8214c82b63c8e76638af43ce331f584a80fa | pynetdicom/pdu_primitives.py | python | A_ABORT.abort_source | (self) | return self._abort_source | Get or set the *Abort Source*.
Parameters
----------
value : int or None
The abort source, one of:
* ``0``: Upper layer service user
* ``1``: Reserved
* ``2``: Upper layer service provider | Get or set the *Abort Source*. | [
"Get",
"or",
"set",
"the",
"*",
"Abort",
"Source",
"*",
"."
] | def abort_source(self) -> Optional[int]:
"""Get or set the *Abort Source*.
Parameters
----------
value : int or None
The abort source, one of:
* ``0``: Upper layer service user
* ``1``: Reserved
* ``2``: Upper layer service provider
... | [
"def",
"abort_source",
"(",
"self",
")",
"->",
"Optional",
"[",
"int",
"]",
":",
"if",
"self",
".",
"_abort_source",
"is",
"None",
":",
"LOGGER",
".",
"error",
"(",
"\"A_ABORT.abort_source value not set\"",
")",
"raise",
"ValueError",
"(",
"\"A_ABORT.abort_sourc... | https://github.com/pydicom/pynetdicom/blob/f57d8214c82b63c8e76638af43ce331f584a80fa/pynetdicom/pdu_primitives.py#L811-L827 | |
mikf/gallery-dl | 58a7921b5c990f5072e2b55b4644d0574512d3e1 | gallery_dl/extractor/warosu.py | python | WarosuThreadExtractor.parse | (self, post) | return data | Build post-object by extracting data from an HTML post | Build post-object by extracting data from an HTML post | [
"Build",
"post",
"-",
"object",
"by",
"extracting",
"data",
"from",
"an",
"HTML",
"post"
] | def parse(self, post):
"""Build post-object by extracting data from an HTML post"""
data = self._extract_post(post)
if "<span>File:" in post:
self._extract_image(post, data)
part = data["image"].rpartition("/")[2]
data["tim"], _, data["extension"] = part.parti... | [
"def",
"parse",
"(",
"self",
",",
"post",
")",
":",
"data",
"=",
"self",
".",
"_extract_post",
"(",
"post",
")",
"if",
"\"<span>File:\"",
"in",
"post",
":",
"self",
".",
"_extract_image",
"(",
"post",
",",
"data",
")",
"part",
"=",
"data",
"[",
"\"im... | https://github.com/mikf/gallery-dl/blob/58a7921b5c990f5072e2b55b4644d0574512d3e1/gallery_dl/extractor/warosu.py#L75-L83 | |
ahmetcemturan/SFACT | 7576e29ba72b33e5058049b77b7b558875542747 | fabmetheus_utilities/settings.py | python | getEachWordCapitalized | ( name ) | return ' '.join( capitalizedStrings ) | Get the capitalized name. | Get the capitalized name. | [
"Get",
"the",
"capitalized",
"name",
"."
] | def getEachWordCapitalized( name ):
"Get the capitalized name."
withSpaces = name.lower().replace('_', ' ')
words = withSpaces.split(' ')
capitalizedStrings = []
for word in words:
capitalizedStrings.append( word.capitalize() )
return ' '.join( capitalizedStrings ) | [
"def",
"getEachWordCapitalized",
"(",
"name",
")",
":",
"withSpaces",
"=",
"name",
".",
"lower",
"(",
")",
".",
"replace",
"(",
"'_'",
",",
"' '",
")",
"words",
"=",
"withSpaces",
".",
"split",
"(",
"' '",
")",
"capitalizedStrings",
"=",
"[",
"]",
"for... | https://github.com/ahmetcemturan/SFACT/blob/7576e29ba72b33e5058049b77b7b558875542747/fabmetheus_utilities/settings.py#L215-L222 | |
kanzure/nanoengineer | 874e4c9f8a9190f093625b267f9767e19f82e6c4 | cad/src/exprs/widget_env.py | python | widget_env._e_eval | (self, expr, ipath) | return canon_expr(expr)._e_eval( self, ipath) | evaluate an expr (or constant) in this env, with given ipath | evaluate an expr (or constant) in this env, with given ipath | [
"evaluate",
"an",
"expr",
"(",
"or",
"constant",
")",
"in",
"this",
"env",
"with",
"given",
"ipath"
] | def _e_eval(self, expr, ipath):#070131
"evaluate an expr (or constant) in this env, with given ipath"
return canon_expr(expr)._e_eval( self, ipath) | [
"def",
"_e_eval",
"(",
"self",
",",
"expr",
",",
"ipath",
")",
":",
"#070131",
"return",
"canon_expr",
"(",
"expr",
")",
".",
"_e_eval",
"(",
"self",
",",
"ipath",
")"
] | https://github.com/kanzure/nanoengineer/blob/874e4c9f8a9190f093625b267f9767e19f82e6c4/cad/src/exprs/widget_env.py#L172-L174 | |
puddletag/puddletag | e5fb85c34ff2e699ca35274298d1921f2598be98 | source/puddlestuff/audioinfo/util.py | python | parse_image | (image, keys=None) | return dict((k, _image_defaults[k](image)) for k in keys) | Get default values for the image if they don't exist. | Get default values for the image if they don't exist. | [
"Get",
"default",
"values",
"for",
"the",
"image",
"if",
"they",
"don",
"t",
"exist",
"."
] | def parse_image(image, keys=None):
"""Get default values for the image if they don't exist."""
if keys is None:
keys = [DATA, MIMETYPE, DESCRIPTION, IMAGETYPE]
return dict((k, _image_defaults[k](image)) for k in keys) | [
"def",
"parse_image",
"(",
"image",
",",
"keys",
"=",
"None",
")",
":",
"if",
"keys",
"is",
"None",
":",
"keys",
"=",
"[",
"DATA",
",",
"MIMETYPE",
",",
"DESCRIPTION",
",",
"IMAGETYPE",
"]",
"return",
"dict",
"(",
"(",
"k",
",",
"_image_defaults",
"[... | https://github.com/puddletag/puddletag/blob/e5fb85c34ff2e699ca35274298d1921f2598be98/source/puddlestuff/audioinfo/util.py#L452-L456 | |
tenzir/threatbus | a26096e7b61b3eddf25c445d40a6cd2ea4420558 | apps/suricata/suricata_threatbus/suricata.py | python | update_suricata_rules | (indicator_queue: asyncio.Queue, rules_file: str) | Updates the Suricata `threatbus.rules` with the received STIX-2 Indicator.
@param indicator_queue The queue to receive IoCs from
@param rules_file The file to update with new rules. | Updates the Suricata `threatbus.rules` with the received STIX-2 Indicator. | [
"Updates",
"the",
"Suricata",
"threatbus",
".",
"rules",
"with",
"the",
"received",
"STIX",
"-",
"2",
"Indicator",
"."
] | async def update_suricata_rules(indicator_queue: asyncio.Queue, rules_file: str):
"""
Updates the Suricata `threatbus.rules` with the received STIX-2 Indicator.
@param indicator_queue The queue to receive IoCs from
@param rules_file The file to update with new rules.
"""
global last_rule_file_up... | [
"async",
"def",
"update_suricata_rules",
"(",
"indicator_queue",
":",
"asyncio",
".",
"Queue",
",",
"rules_file",
":",
"str",
")",
":",
"global",
"last_rule_file_update",
"while",
"True",
":",
"msg",
"=",
"await",
"indicator_queue",
".",
"get",
"(",
")",
"indi... | https://github.com/tenzir/threatbus/blob/a26096e7b61b3eddf25c445d40a6cd2ea4420558/apps/suricata/suricata_threatbus/suricata.py#L290-L339 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.