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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
jgirardet/sublack | 5b76fbce293ad3402547ed9f101291dff8a749a5 | sublack/checker.py | python | Checker.watch | (self) | [] | def watch(self):
while True:
time.sleep(self.interval)
if not self.is_running():
return | [
"def",
"watch",
"(",
"self",
")",
":",
"while",
"True",
":",
"time",
".",
"sleep",
"(",
"self",
".",
"interval",
")",
"if",
"not",
"self",
".",
"is_running",
"(",
")",
":",
"return"
] | https://github.com/jgirardet/sublack/blob/5b76fbce293ad3402547ed9f101291dff8a749a5/sublack/checker.py#L118-L123 | ||||
kennethreitz-archive/requests3 | 69eb662703b40db58fdc6c095d0fe130c56649bb | requests3/core/_http/_backends/trio_backend.py | python | TrioSocket.send_and_receive_for_a_while | (self, produce_bytes, consume_bytes) | [] | async def send_and_receive_for_a_while(self, produce_bytes, consume_bytes):
async def sender():
while True:
outgoing = await produce_bytes()
if outgoing is None:
break
await self._stream.send_all(outgoing)
async def receiver():
while True:
incoming = await self._stream.receive_some(BUFSIZE)
consume_bytes(incoming)
try:
async with trio.open_nursery() as nursery:
nursery.start_soon(sender)
nursery.start_soon(receiver)
except LoopAbort:
pass | [
"async",
"def",
"send_and_receive_for_a_while",
"(",
"self",
",",
"produce_bytes",
",",
"consume_bytes",
")",
":",
"async",
"def",
"sender",
"(",
")",
":",
"while",
"True",
":",
"outgoing",
"=",
"await",
"produce_bytes",
"(",
")",
"if",
"outgoing",
"is",
"No... | https://github.com/kennethreitz-archive/requests3/blob/69eb662703b40db58fdc6c095d0fe130c56649bb/requests3/core/_http/_backends/trio_backend.py#L53-L72 | ||||
ahmetcemturan/SFACT | 7576e29ba72b33e5058049b77b7b558875542747 | fabmetheus_utilities/gcodec.py | python | getFirstWord | (splitLine) | return '' | Get the first word of a split line. | Get the first word of a split line. | [
"Get",
"the",
"first",
"word",
"of",
"a",
"split",
"line",
"."
] | def getFirstWord(splitLine):
'Get the first word of a split line.'
if len(splitLine) > 0:
return splitLine[0]
return '' | [
"def",
"getFirstWord",
"(",
"splitLine",
")",
":",
"if",
"len",
"(",
"splitLine",
")",
">",
"0",
":",
"return",
"splitLine",
"[",
"0",
"]",
"return",
"''"
] | https://github.com/ahmetcemturan/SFACT/blob/7576e29ba72b33e5058049b77b7b558875542747/fabmetheus_utilities/gcodec.py#L102-L106 | |
beeware/ouroboros | a29123c6fab6a807caffbb7587cf548e0c370296 | ouroboros/ast.py | python | iter_fields | (node) | Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields``
that is present on *node*. | Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields``
that is present on *node*. | [
"Yield",
"a",
"tuple",
"of",
"(",
"fieldname",
"value",
")",
"for",
"each",
"field",
"in",
"node",
".",
"_fields",
"that",
"is",
"present",
"on",
"*",
"node",
"*",
"."
] | def iter_fields(node):
"""
Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields``
that is present on *node*.
"""
for field in node._fields:
try:
yield field, getattr(node, field)
except AttributeError:
pass | [
"def",
"iter_fields",
"(",
"node",
")",
":",
"for",
"field",
"in",
"node",
".",
"_fields",
":",
"try",
":",
"yield",
"field",
",",
"getattr",
"(",
"node",
",",
"field",
")",
"except",
"AttributeError",
":",
"pass"
] | https://github.com/beeware/ouroboros/blob/a29123c6fab6a807caffbb7587cf548e0c370296/ouroboros/ast.py#L165-L174 | ||
frappe/erpnext | 9d36e30ef7043b391b5ed2523b8288bf46c45d18 | erpnext/accounts/doctype/sales_invoice/sales_invoice.py | python | SalesInvoice.set_against_income_account | (self) | Set against account for debit to account | Set against account for debit to account | [
"Set",
"against",
"account",
"for",
"debit",
"to",
"account"
] | def set_against_income_account(self):
"""Set against account for debit to account"""
against_acc = []
for d in self.get('items'):
if d.income_account and d.income_account not in against_acc:
against_acc.append(d.income_account)
self.against_income_account = ','.join(against_acc) | [
"def",
"set_against_income_account",
"(",
"self",
")",
":",
"against_acc",
"=",
"[",
"]",
"for",
"d",
"in",
"self",
".",
"get",
"(",
"'items'",
")",
":",
"if",
"d",
".",
"income_account",
"and",
"d",
".",
"income_account",
"not",
"in",
"against_acc",
":"... | https://github.com/frappe/erpnext/blob/9d36e30ef7043b391b5ed2523b8288bf46c45d18/erpnext/accounts/doctype/sales_invoice/sales_invoice.py#L614-L620 | ||
openedx/edx-platform | 68dd185a0ab45862a2a61e0f803d7e03d2be71b5 | openedx/core/djangoapps/embargo/forms.py | python | IPFilterForm._is_valid_ip | (self, address) | return True | Whether or not address is a valid ipv4 address or ipv6 address | Whether or not address is a valid ipv4 address or ipv6 address | [
"Whether",
"or",
"not",
"address",
"is",
"a",
"valid",
"ipv4",
"address",
"or",
"ipv6",
"address"
] | def _is_valid_ip(self, address):
"""Whether or not address is a valid ipv4 address or ipv6 address"""
try:
# Is this an valid ip address?
ipaddress.ip_network(address)
except ValueError:
return False
return True | [
"def",
"_is_valid_ip",
"(",
"self",
",",
"address",
")",
":",
"try",
":",
"# Is this an valid ip address?",
"ipaddress",
".",
"ip_network",
"(",
"address",
")",
"except",
"ValueError",
":",
"return",
"False",
"return",
"True"
] | https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/openedx/core/djangoapps/embargo/forms.py#L66-L73 | |
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-linux/x64/ldap3/operation/bind.py | python | bind_operation | (version,
authentication,
name='',
password=None,
sasl_mechanism=None,
sasl_credentials=None,
auto_encode=False) | return request | [] | def bind_operation(version,
authentication,
name='',
password=None,
sasl_mechanism=None,
sasl_credentials=None,
auto_encode=False):
# BindRequest ::= [APPLICATION 0] SEQUENCE {
# version INTEGER (1 .. 127),
# name LDAPDN,
# authentication AuthenticationChoice }
request = BindRequest()
request['version'] = Version(version)
if name is None:
name = ''
if isinstance(name, STRING_TYPES):
request['name'] = to_unicode(name) if auto_encode else name
if authentication == SIMPLE:
if not name:
raise LDAPUserNameIsMandatoryError('user name is mandatory in simple bind')
if password:
request['authentication'] = AuthenticationChoice().setComponentByName('simple', Simple(validate_simple_password(password)))
else:
raise LDAPPasswordIsMandatoryError('password is mandatory in simple bind')
elif authentication == SASL:
sasl_creds = SaslCredentials()
sasl_creds['mechanism'] = sasl_mechanism
if sasl_credentials is not None:
sasl_creds['credentials'] = sasl_credentials
# else:
# sasl_creds['credentials'] = None
request['authentication'] = AuthenticationChoice().setComponentByName('sasl', sasl_creds)
elif authentication == ANONYMOUS:
if name:
raise LDAPUserNameNotAllowedError('user name not allowed in anonymous bind')
request['name'] = ''
request['authentication'] = AuthenticationChoice().setComponentByName('simple', Simple(''))
elif authentication == 'SICILY_PACKAGE_DISCOVERY': # https://msdn.microsoft.com/en-us/library/cc223501.aspx
request['name'] = ''
request['authentication'] = AuthenticationChoice().setComponentByName('sicilyPackageDiscovery', SicilyPackageDiscovery(''))
elif authentication == 'SICILY_NEGOTIATE_NTLM': # https://msdn.microsoft.com/en-us/library/cc223501.aspx
request['name'] = 'NTLM'
request['authentication'] = AuthenticationChoice().setComponentByName('sicilyNegotiate', SicilyNegotiate(name.create_negotiate_message())) # ntlm client in self.name
elif authentication == 'SICILY_RESPONSE_NTLM': # https://msdn.microsoft.com/en-us/library/cc223501.aspx
name.parse_challenge_message(password) # server_creds returned by server in password
server_creds = name.create_authenticate_message()
if server_creds:
request['name'] = ''
request['authentication'] = AuthenticationChoice().setComponentByName('sicilyResponse', SicilyResponse(server_creds))
else:
request = None
else:
raise LDAPUnknownAuthenticationMethodError('unknown authentication method')
return request | [
"def",
"bind_operation",
"(",
"version",
",",
"authentication",
",",
"name",
"=",
"''",
",",
"password",
"=",
"None",
",",
"sasl_mechanism",
"=",
"None",
",",
"sasl_credentials",
"=",
"None",
",",
"auto_encode",
"=",
"False",
")",
":",
"# BindRequest ::= [APPL... | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-linux/x64/ldap3/operation/bind.py#L36-L90 | |||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/IPython/lib/inputhook.py | python | InputHookManager.get_pyos_inputhook | (self) | return ctypes.c_void_p.in_dll(ctypes.pythonapi,"PyOS_InputHook") | DEPRECATED since IPython 5.0
Return the current PyOS_InputHook as a ctypes.c_void_p. | DEPRECATED since IPython 5.0 | [
"DEPRECATED",
"since",
"IPython",
"5",
".",
"0"
] | def get_pyos_inputhook(self):
"""DEPRECATED since IPython 5.0
Return the current PyOS_InputHook as a ctypes.c_void_p."""
warn("`get_pyos_inputhook` is deprecated since IPython 5.0 and will be removed in future versions.",
DeprecationWarning, stacklevel=2)
return ctypes.c_void_p.in_dll(ctypes.pythonapi,"PyOS_InputHook") | [
"def",
"get_pyos_inputhook",
"(",
"self",
")",
":",
"warn",
"(",
"\"`get_pyos_inputhook` is deprecated since IPython 5.0 and will be removed in future versions.\"",
",",
"DeprecationWarning",
",",
"stacklevel",
"=",
"2",
")",
"return",
"ctypes",
".",
"c_void_p",
".",
"in_dl... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/IPython/lib/inputhook.py#L132-L138 | |
codelucas/newspaper | f622011177f6c2e95e48d6076561e21c016f08c3 | newspaper/urls.py | python | prepare_url | (url, source_url=None) | return proper_url | Operations that purify a url, removes arguments,
redirects, and merges relatives with absolutes. | Operations that purify a url, removes arguments,
redirects, and merges relatives with absolutes. | [
"Operations",
"that",
"purify",
"a",
"url",
"removes",
"arguments",
"redirects",
"and",
"merges",
"relatives",
"with",
"absolutes",
"."
] | def prepare_url(url, source_url=None):
"""
Operations that purify a url, removes arguments,
redirects, and merges relatives with absolutes.
"""
try:
if source_url is not None:
source_domain = urlparse(source_url).netloc
proper_url = urljoin(source_url, url)
proper_url = redirect_back(proper_url, source_domain)
# proper_url = remove_args(proper_url)
else:
# proper_url = remove_args(url)
proper_url = url
except ValueError as e:
log.critical('url %s failed on err %s' % (url, str(e)))
proper_url = ''
return proper_url | [
"def",
"prepare_url",
"(",
"url",
",",
"source_url",
"=",
"None",
")",
":",
"try",
":",
"if",
"source_url",
"is",
"not",
"None",
":",
"source_domain",
"=",
"urlparse",
"(",
"source_url",
")",
".",
"netloc",
"proper_url",
"=",
"urljoin",
"(",
"source_url",
... | https://github.com/codelucas/newspaper/blob/f622011177f6c2e95e48d6076561e21c016f08c3/newspaper/urls.py#L81-L99 | |
smokeleeteveryday/CTF_WRITEUPS | 4683f0d41c92c4ed407cc3dd3b1760c68a05943f | 2015/AIVD_CYBERCHALLENGE/solution/check_crack.py | python | reverse_fc | ( y ) | return solutionsx | [] | def reverse_fc( y ):
solutionsx = []
for i in xrange(0,6):
candidate = (((max_intval * i) + y ) - 2236067977 )
if candidate % 5 != 0:
continue
candidate /= 5
if candidate > 0 and (candidate % 4) == 2:
solutionsx.append(candidate)
return solutionsx | [
"def",
"reverse_fc",
"(",
"y",
")",
":",
"solutionsx",
"=",
"[",
"]",
"for",
"i",
"in",
"xrange",
"(",
"0",
",",
"6",
")",
":",
"candidate",
"=",
"(",
"(",
"(",
"max_intval",
"*",
"i",
")",
"+",
"y",
")",
"-",
"2236067977",
")",
"if",
"candidat... | https://github.com/smokeleeteveryday/CTF_WRITEUPS/blob/4683f0d41c92c4ed407cc3dd3b1760c68a05943f/2015/AIVD_CYBERCHALLENGE/solution/check_crack.py#L35-L47 | |||
netbox-community/netbox | 50309d3ab3da2212343e1d9feaf47e497df9c3cb | netbox/extras/reports.py | python | Report.log | (self, message) | Log a message which is not associated with a particular object. | Log a message which is not associated with a particular object. | [
"Log",
"a",
"message",
"which",
"is",
"not",
"associated",
"with",
"a",
"particular",
"object",
"."
] | def log(self, message):
"""
Log a message which is not associated with a particular object.
"""
self._log(None, message, level=LogLevelChoices.LOG_DEFAULT)
self.logger.info(message) | [
"def",
"log",
"(",
"self",
",",
"message",
")",
":",
"self",
".",
"_log",
"(",
"None",
",",
"message",
",",
"level",
"=",
"LogLevelChoices",
".",
"LOG_DEFAULT",
")",
"self",
".",
"logger",
".",
"info",
"(",
"message",
")"
] | https://github.com/netbox-community/netbox/blob/50309d3ab3da2212343e1d9feaf47e497df9c3cb/netbox/extras/reports.py#L180-L185 | ||
PaddlePaddle/PaddleSpeech | 26524031d242876b7fdb71582b0b3a7ea45c7d9d | paddlespeech/t2s/modules/losses.py | python | weighted_mean | (input, weight) | return paddle.sum(input * weight) / (paddle.sum(weight) * broadcast_ratio) | Weighted mean. It can also be used as masked mean.
Parameters
-----------
input : Tensor
The input tensor.
weight : Tensor
The weight tensor with broadcastable shape with the input.
Returns
----------
Tensor [shape=(1,)]
Weighted mean tensor with the same dtype as input. | Weighted mean. It can also be used as masked mean. | [
"Weighted",
"mean",
".",
"It",
"can",
"also",
"be",
"used",
"as",
"masked",
"mean",
"."
] | def weighted_mean(input, weight):
"""Weighted mean. It can also be used as masked mean.
Parameters
-----------
input : Tensor
The input tensor.
weight : Tensor
The weight tensor with broadcastable shape with the input.
Returns
----------
Tensor [shape=(1,)]
Weighted mean tensor with the same dtype as input.
"""
weight = paddle.cast(weight, input.dtype)
broadcast_ratio = input.size / weight.size
return paddle.sum(input * weight) / (paddle.sum(weight) * broadcast_ratio) | [
"def",
"weighted_mean",
"(",
"input",
",",
"weight",
")",
":",
"weight",
"=",
"paddle",
".",
"cast",
"(",
"weight",
",",
"input",
".",
"dtype",
")",
"broadcast_ratio",
"=",
"input",
".",
"size",
"/",
"weight",
".",
"size",
"return",
"paddle",
".",
"sum... | https://github.com/PaddlePaddle/PaddleSpeech/blob/26524031d242876b7fdb71582b0b3a7ea45c7d9d/paddlespeech/t2s/modules/losses.py#L420-L437 | |
jdf/processing.py | 76e48ac855fd34169a7576a5cbc396bda698e781 | mode/formatter/pep8.py | python | python_3000_not_equal | (logical_line) | r"""New code should always use != instead of <>.
The older syntax is removed in Python 3.
Okay: if a != 'no':
W603: if a <> 'no': | r"""New code should always use != instead of <>. | [
"r",
"New",
"code",
"should",
"always",
"use",
"!",
"=",
"instead",
"of",
"<",
">",
"."
] | def python_3000_not_equal(logical_line):
r"""New code should always use != instead of <>.
The older syntax is removed in Python 3.
Okay: if a != 'no':
W603: if a <> 'no':
"""
pos = logical_line.find('<>')
if pos > -1:
yield pos, "W603 '<>' is deprecated, use '!='" | [
"def",
"python_3000_not_equal",
"(",
"logical_line",
")",
":",
"pos",
"=",
"logical_line",
".",
"find",
"(",
"'<>'",
")",
"if",
"pos",
">",
"-",
"1",
":",
"yield",
"pos",
",",
"\"W603 '<>' is deprecated, use '!='\""
] | https://github.com/jdf/processing.py/blob/76e48ac855fd34169a7576a5cbc396bda698e781/mode/formatter/pep8.py#L1016-L1026 | ||
frankban/django-endless-pagination | 4814fe7cf81277efe35e96b88f57cc260a771255 | endless_pagination/views.py | python | MultipleObjectMixin.get_context_data | (self, **kwargs) | return context | Get the context for this view.
Also adds the *page_template* variable in the context.
If the *page_template* is not given as a kwarg of the *as_view*
method then it is generated using app label, model name
(obviously if the list is a queryset), *self.template_name_suffix*
and *self.page_template_suffix*.
For instance, if the list is a queryset of *blog.Entry*,
the template will be ``blog/entry_list_page.html``. | Get the context for this view. | [
"Get",
"the",
"context",
"for",
"this",
"view",
"."
] | def get_context_data(self, **kwargs):
"""Get the context for this view.
Also adds the *page_template* variable in the context.
If the *page_template* is not given as a kwarg of the *as_view*
method then it is generated using app label, model name
(obviously if the list is a queryset), *self.template_name_suffix*
and *self.page_template_suffix*.
For instance, if the list is a queryset of *blog.Entry*,
the template will be ``blog/entry_list_page.html``.
"""
queryset = kwargs.pop('object_list')
page_template = kwargs.pop('page_template', None)
context_object_name = self.get_context_object_name(queryset)
context = {'object_list': queryset, 'view': self}
context.update(kwargs)
if context_object_name is not None:
context[context_object_name] = queryset
if page_template is None:
if hasattr(queryset, 'model'):
page_template = self.get_page_template(**kwargs)
else:
raise ImproperlyConfigured(
'AjaxListView requires a page_template')
context['page_template'] = self.page_template = page_template
return context | [
"def",
"get_context_data",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"queryset",
"=",
"kwargs",
".",
"pop",
"(",
"'object_list'",
")",
"page_template",
"=",
"kwargs",
".",
"pop",
"(",
"'page_template'",
",",
"None",
")",
"context_object_name",
"=",
"... | https://github.com/frankban/django-endless-pagination/blob/4814fe7cf81277efe35e96b88f57cc260a771255/endless_pagination/views.py#L63-L93 | |
gaasedelen/lighthouse | 7245a2d2c4e84351cd259ed81dafa4263167909a | plugins/lighthouse/ui/coverage_overview.py | python | CoverageOverview._ui_init_toolbar | (self) | Initialize the coverage toolbar. | Initialize the coverage toolbar. | [
"Initialize",
"the",
"coverage",
"toolbar",
"."
] | def _ui_init_toolbar(self):
"""
Initialize the coverage toolbar.
"""
# initialize child elements to go on the toolbar
self._ui_init_toolbar_elements()
self._ui_init_settings()
#
# create the 'toolbar', and customize its style. specifically, we are
# interested in tweaking the separator and padding between elements.
#
self._toolbar = QtWidgets.QToolBar()
self._toolbar.setStyle(QtWidgets.QStyleFactory.create("Windows"))
self._toolbar.setStyleSheet('QToolBar{padding:0;margin:0;}')
# populate the toolbar with all our subordinates
self._toolbar.addWidget(self._shell_elements)
self._toolbar.addWidget(self._settings_button) | [
"def",
"_ui_init_toolbar",
"(",
"self",
")",
":",
"# initialize child elements to go on the toolbar",
"self",
".",
"_ui_init_toolbar_elements",
"(",
")",
"self",
".",
"_ui_init_settings",
"(",
")",
"#",
"# create the 'toolbar', and customize its style. specifically, we are",
"#... | https://github.com/gaasedelen/lighthouse/blob/7245a2d2c4e84351cd259ed81dafa4263167909a/plugins/lighthouse/ui/coverage_overview.py#L99-L119 | ||
n374/dmusic-plugin-NeteaseCloudMusic | 503701ce6c2c4d94f1fcd40a158c7a0077861793 | neteasecloudmusic/netease_music_playlist.py | python | MusicPlaylist.save | (self, *args) | [] | def save(self, *args):
if Player.get_source() == self.playing_list_item.song_view:
current_playing_item = 'playing_list'
elif Player.get_source() == self.personal_fm_item.song_view:
current_playing_item = 'personal_fm'
else:
current_playing_item = None
playing_list_songs = self.playing_list_item.song_view.dump_songs()
try:
playing_list_song = self.playing_list_item.song_view.current_song.get_dict()
except:
playing_list_song = None
personal_fm_songs = self.personal_fm_item.song_view.dump_songs()
try:
personal_fm_song = self.personal_fm_item.song_view.current_song.get_dict()
except:
personal_fm_song = None
utils.save_db((current_playing_item,
(playing_list_song, playing_list_songs),
(personal_fm_song, personal_fm_songs)),
self.listen_db_file) | [
"def",
"save",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"Player",
".",
"get_source",
"(",
")",
"==",
"self",
".",
"playing_list_item",
".",
"song_view",
":",
"current_playing_item",
"=",
"'playing_list'",
"elif",
"Player",
".",
"get_source",
"(",
")"... | https://github.com/n374/dmusic-plugin-NeteaseCloudMusic/blob/503701ce6c2c4d94f1fcd40a158c7a0077861793/neteasecloudmusic/netease_music_playlist.py#L224-L247 | ||||
wistbean/learn_python3_spider | 73c873f4845f4385f097e5057407d03dd37a117b | stackoverflow/venv/lib/python3.6/site-packages/twisted/web/microdom.py | python | getElementsByTagName | (iNode, name) | return matches | Return a list of all child elements of C{iNode} with a name matching
C{name}.
Note that this implementation does not conform to the DOM Level 1 Core
specification because it may return C{iNode}.
@param iNode: An element at which to begin searching. If C{iNode} has a
name matching C{name}, it will be included in the result.
@param name: A C{str} giving the name of the elements to return.
@return: A C{list} of direct or indirect child elements of C{iNode} with
the name C{name}. This may include C{iNode}. | Return a list of all child elements of C{iNode} with a name matching
C{name}. | [
"Return",
"a",
"list",
"of",
"all",
"child",
"elements",
"of",
"C",
"{",
"iNode",
"}",
"with",
"a",
"name",
"matching",
"C",
"{",
"name",
"}",
"."
] | def getElementsByTagName(iNode, name):
"""
Return a list of all child elements of C{iNode} with a name matching
C{name}.
Note that this implementation does not conform to the DOM Level 1 Core
specification because it may return C{iNode}.
@param iNode: An element at which to begin searching. If C{iNode} has a
name matching C{name}, it will be included in the result.
@param name: A C{str} giving the name of the elements to return.
@return: A C{list} of direct or indirect child elements of C{iNode} with
the name C{name}. This may include C{iNode}.
"""
matches = []
matches_append = matches.append # faster lookup. don't do this at home
slice = [iNode]
while len(slice) > 0:
c = slice.pop(0)
if c.nodeName == name:
matches_append(c)
slice[:0] = c.childNodes
return matches | [
"def",
"getElementsByTagName",
"(",
"iNode",
",",
"name",
")",
":",
"matches",
"=",
"[",
"]",
"matches_append",
"=",
"matches",
".",
"append",
"# faster lookup. don't do this at home",
"slice",
"=",
"[",
"iNode",
"]",
"while",
"len",
"(",
"slice",
")",
">",
... | https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/twisted/web/microdom.py#L32-L56 | |
canonical/cloud-init | dc1aabfca851e520693c05322f724bd102c76364 | cloudinit/sources/DataSourceMAAS.py | python | read_maas_seed_url | (
seed_url,
read_file_or_url=None,
timeout=None,
version=MD_VERSION,
paths=None,
retries=None,
) | return check_seed_contents(md, seed_url) | Read the maas datasource at seed_url.
read_file_or_url is a method that should provide an interface
like util.read_file_or_url
Expected format of seed_url is are the following files:
* <seed_url>/<version>/meta-data/instance-id
* <seed_url>/<version>/meta-data/local-hostname
* <seed_url>/<version>/user-data
If version is None, then <version>/ will not be used. | Read the maas datasource at seed_url.
read_file_or_url is a method that should provide an interface
like util.read_file_or_url | [
"Read",
"the",
"maas",
"datasource",
"at",
"seed_url",
".",
"read_file_or_url",
"is",
"a",
"method",
"that",
"should",
"provide",
"an",
"interface",
"like",
"util",
".",
"read_file_or_url"
] | def read_maas_seed_url(
seed_url,
read_file_or_url=None,
timeout=None,
version=MD_VERSION,
paths=None,
retries=None,
):
"""
Read the maas datasource at seed_url.
read_file_or_url is a method that should provide an interface
like util.read_file_or_url
Expected format of seed_url is are the following files:
* <seed_url>/<version>/meta-data/instance-id
* <seed_url>/<version>/meta-data/local-hostname
* <seed_url>/<version>/user-data
If version is None, then <version>/ will not be used.
"""
if read_file_or_url is None:
read_file_or_url = url_helper.read_file_or_url
if seed_url.endswith("/"):
seed_url = seed_url[:-1]
md = {}
for path, _dictname, binary, optional in DS_FIELDS:
if version is None:
url = "%s/%s" % (seed_url, path)
else:
url = "%s/%s/%s" % (seed_url, version, path)
try:
ssl_details = util.fetch_ssl_details(paths)
resp = read_file_or_url(
url, retries=retries, timeout=timeout, ssl_details=ssl_details
)
if resp.ok():
if binary:
md[path] = resp.contents
else:
md[path] = util.decode_binary(resp.contents)
else:
LOG.warning(
"Fetching from %s resulted in an invalid http code %s",
url,
resp.code,
)
except url_helper.UrlError as e:
if e.code == 404 and not optional:
raise MAASSeedDirMalformed(
"Missing required %s: %s" % (path, e)
) from e
elif e.code != 404:
raise e
return check_seed_contents(md, seed_url) | [
"def",
"read_maas_seed_url",
"(",
"seed_url",
",",
"read_file_or_url",
"=",
"None",
",",
"timeout",
"=",
"None",
",",
"version",
"=",
"MD_VERSION",
",",
"paths",
"=",
"None",
",",
"retries",
"=",
"None",
",",
")",
":",
"if",
"read_file_or_url",
"is",
"None... | https://github.com/canonical/cloud-init/blob/dc1aabfca851e520693c05322f724bd102c76364/cloudinit/sources/DataSourceMAAS.py#L196-L251 | |
neuropsychology/NeuroKit | d01111b9b82364d28da01c002e6cbfc45d9493d9 | neurokit2/hrv/hrv_rsa.py | python | _hrv_rsa_cycles | (signals) | return {
"RSP_Inspiration_Onsets": inspiration_onsets,
"RSP_Expiration_Onsets": expiration_onsets,
"RSP_Cycles_Length": cycles_length,
} | Extract respiratory cycles. | Extract respiratory cycles. | [
"Extract",
"respiratory",
"cycles",
"."
] | def _hrv_rsa_cycles(signals):
"""Extract respiratory cycles."""
inspiration_onsets = np.intersect1d(
np.where(signals["RSP_Phase"] == 1)[0],
np.where(signals["RSP_Phase_Completion"] == 0)[0],
assume_unique=True,
)
expiration_onsets = np.intersect1d(
np.where(signals["RSP_Phase"] == 0)[0],
np.where(signals["RSP_Phase_Completion"] == 0)[0],
assume_unique=True,
)
cycles_length = np.diff(inspiration_onsets)
return {
"RSP_Inspiration_Onsets": inspiration_onsets,
"RSP_Expiration_Onsets": expiration_onsets,
"RSP_Cycles_Length": cycles_length,
} | [
"def",
"_hrv_rsa_cycles",
"(",
"signals",
")",
":",
"inspiration_onsets",
"=",
"np",
".",
"intersect1d",
"(",
"np",
".",
"where",
"(",
"signals",
"[",
"\"RSP_Phase\"",
"]",
"==",
"1",
")",
"[",
"0",
"]",
",",
"np",
".",
"where",
"(",
"signals",
"[",
... | https://github.com/neuropsychology/NeuroKit/blob/d01111b9b82364d28da01c002e6cbfc45d9493d9/neurokit2/hrv/hrv_rsa.py#L503-L523 | |
compas-dev/compas | 0b33f8786481f710115fb1ae5fe79abc2a9a5175 | src/compas/geometry/shapes/capsule.py | python | Capsule.transform | (self, transformation) | Transform this `Capsule` using a given transformation.
Parameters
----------
transformation : :class:`compas.geometry.Transformation`
The transformation used to transform the capsule.
Returns
-------
None | Transform this `Capsule` using a given transformation. | [
"Transform",
"this",
"Capsule",
"using",
"a",
"given",
"transformation",
"."
] | def transform(self, transformation):
"""Transform this `Capsule` using a given transformation.
Parameters
----------
transformation : :class:`compas.geometry.Transformation`
The transformation used to transform the capsule.
Returns
-------
None
"""
self.line.transform(transformation) | [
"def",
"transform",
"(",
"self",
",",
"transformation",
")",
":",
"self",
".",
"line",
".",
"transform",
"(",
"transformation",
")"
] | https://github.com/compas-dev/compas/blob/0b33f8786481f710115fb1ae5fe79abc2a9a5175/src/compas/geometry/shapes/capsule.py#L283-L296 | ||
glouppe/info8006-introduction-to-ai | 8360cc9a8c418559e402be1454ec885b6c1062d7 | projects/project0/pacman_module/util.py | python | Stack.isEmpty | (self) | return len(self.list) == 0 | Returns true if the stack is empty | Returns true if the stack is empty | [
"Returns",
"true",
"if",
"the",
"stack",
"is",
"empty"
] | def isEmpty(self):
"Returns true if the stack is empty"
return len(self.list) == 0 | [
"def",
"isEmpty",
"(",
"self",
")",
":",
"return",
"len",
"(",
"self",
".",
"list",
")",
"==",
"0"
] | https://github.com/glouppe/info8006-introduction-to-ai/blob/8360cc9a8c418559e402be1454ec885b6c1062d7/projects/project0/pacman_module/util.py#L151-L153 | |
hzlzh/AlfredWorkflow.com | 7055f14f6922c80ea5943839eb0caff11ae57255 | Sources/Workflows/KindleBookstore/PyAl/Request/requests/auth.py | python | HTTPDigestAuth.handle_401 | (self, r) | return r | Takes the given response and tries digest-auth, if needed. | Takes the given response and tries digest-auth, if needed. | [
"Takes",
"the",
"given",
"response",
"and",
"tries",
"digest",
"-",
"auth",
"if",
"needed",
"."
] | def handle_401(self, r):
"""Takes the given response and tries digest-auth, if needed."""
num_401_calls = r.request.hooks['response'].count(self.handle_401)
s_auth = r.headers.get('www-authenticate', '')
if 'digest' in s_auth.lower() and num_401_calls < 2:
self.chal = parse_dict_header(s_auth.replace('Digest ', ''))
# Consume content and release the original connection
# to allow our new request to reuse the same one.
r.content
r.raw.release_conn()
r.request.headers['Authorization'] = self.build_digest_header(r.request.method, r.request.url)
r.request.send(anyway=True)
_r = r.request.response
_r.history.append(r)
return _r
return r | [
"def",
"handle_401",
"(",
"self",
",",
"r",
")",
":",
"num_401_calls",
"=",
"r",
".",
"request",
".",
"hooks",
"[",
"'response'",
"]",
".",
"count",
"(",
"self",
".",
"handle_401",
")",
"s_auth",
"=",
"r",
".",
"headers",
".",
"get",
"(",
"'www-authe... | https://github.com/hzlzh/AlfredWorkflow.com/blob/7055f14f6922c80ea5943839eb0caff11ae57255/Sources/Workflows/KindleBookstore/PyAl/Request/requests/auth.py#L229-L252 | |
ayoolaolafenwa/PixelLib | ae56003c416a98780141a1170c9d888fe9a31317 | pixellib/torchbackend/instance/utils/visualizer.py | python | Visualizer.draw_circle | (self, circle_coord, color, radius=3) | return self.output | Args:
circle_coord (list(int) or tuple(int)): contains the x and y coordinates
of the center of the circle.
color: color of the polygon. Refer to `matplotlib.colors` for a full list of
formats that are accepted.
radius (int): radius of the circle.
Returns:
output (VisImage): image object with box drawn. | Args:
circle_coord (list(int) or tuple(int)): contains the x and y coordinates
of the center of the circle.
color: color of the polygon. Refer to `matplotlib.colors` for a full list of
formats that are accepted.
radius (int): radius of the circle. | [
"Args",
":",
"circle_coord",
"(",
"list",
"(",
"int",
")",
"or",
"tuple",
"(",
"int",
"))",
":",
"contains",
"the",
"x",
"and",
"y",
"coordinates",
"of",
"the",
"center",
"of",
"the",
"circle",
".",
"color",
":",
"color",
"of",
"the",
"polygon",
".",... | def draw_circle(self, circle_coord, color, radius=3):
"""
Args:
circle_coord (list(int) or tuple(int)): contains the x and y coordinates
of the center of the circle.
color: color of the polygon. Refer to `matplotlib.colors` for a full list of
formats that are accepted.
radius (int): radius of the circle.
Returns:
output (VisImage): image object with box drawn.
"""
x, y = circle_coord
self.output.ax.add_patch(
mpl.patches.Circle(circle_coord, radius=radius, fill=True, color=color)
)
return self.output | [
"def",
"draw_circle",
"(",
"self",
",",
"circle_coord",
",",
"color",
",",
"radius",
"=",
"3",
")",
":",
"x",
",",
"y",
"=",
"circle_coord",
"self",
".",
"output",
".",
"ax",
".",
"add_patch",
"(",
"mpl",
".",
"patches",
".",
"Circle",
"(",
"circle_c... | https://github.com/ayoolaolafenwa/PixelLib/blob/ae56003c416a98780141a1170c9d888fe9a31317/pixellib/torchbackend/instance/utils/visualizer.py#L986-L1002 | |
joe42/CloudFusion | c4b94124e74a81e0634578c7754d62160081f7a1 | cloudfusion/store/transparent_store.py | python | TransparentStore.get_dirty_files | (self) | return [] | Get a list of file paths to files that are not already synchronized with the store | Get a list of file paths to files that are not already synchronized with the store | [
"Get",
"a",
"list",
"of",
"file",
"paths",
"to",
"files",
"that",
"are",
"not",
"already",
"synchronized",
"with",
"the",
"store"
] | def get_dirty_files(self):
"""Get a list of file paths to files that are not already synchronized with the store"""
return [] | [
"def",
"get_dirty_files",
"(",
"self",
")",
":",
"return",
"[",
"]"
] | https://github.com/joe42/CloudFusion/blob/c4b94124e74a81e0634578c7754d62160081f7a1/cloudfusion/store/transparent_store.py#L56-L58 | |
Sprytile/Sprytile | 6b68d0069aef5bfed6ab40d1d5a94a3382b41619 | rx/linq/observable/min.py | python | min | (self, comparer=None) | return self.min_by(identity, comparer).map(first_only) | Returns the minimum element in an observable sequence according to
the optional comparer else a default greater than less than check.
Example
res = source.min()
res = source.min(lambda x, y: x.value - y.value)
comparer -- {Function} [Optional] Comparer used to compare elements.
Returns an observable sequence {Observable} containing a single element
with the minimum element in the source sequence. | Returns the minimum element in an observable sequence according to
the optional comparer else a default greater than less than check. | [
"Returns",
"the",
"minimum",
"element",
"in",
"an",
"observable",
"sequence",
"according",
"to",
"the",
"optional",
"comparer",
"else",
"a",
"default",
"greater",
"than",
"less",
"than",
"check",
"."
] | def min(self, comparer=None):
"""Returns the minimum element in an observable sequence according to
the optional comparer else a default greater than less than check.
Example
res = source.min()
res = source.min(lambda x, y: x.value - y.value)
comparer -- {Function} [Optional] Comparer used to compare elements.
Returns an observable sequence {Observable} containing a single element
with the minimum element in the source sequence.
"""
return self.min_by(identity, comparer).map(first_only) | [
"def",
"min",
"(",
"self",
",",
"comparer",
"=",
"None",
")",
":",
"return",
"self",
".",
"min_by",
"(",
"identity",
",",
"comparer",
")",
".",
"map",
"(",
"first_only",
")"
] | https://github.com/Sprytile/Sprytile/blob/6b68d0069aef5bfed6ab40d1d5a94a3382b41619/rx/linq/observable/min.py#L15-L29 | |
cortex-lab/phy | 9a330b9437a3d0b40a37a201d147224e6e7fb462 | phy/cluster/views/raster.py | python | RasterView.update_color | (self) | Update the color of the spikes, depending on the selected clusters. | Update the color of the spikes, depending on the selected clusters. | [
"Update",
"the",
"color",
"of",
"the",
"spikes",
"depending",
"on",
"the",
"selected",
"clusters",
"."
] | def update_color(self):
"""Update the color of the spikes, depending on the selected clusters."""
box_index = self._get_box_index()
color = self._get_color(box_index, selected_clusters=self.cluster_ids)
self.visual.set_color(color)
self.canvas.update() | [
"def",
"update_color",
"(",
"self",
")",
":",
"box_index",
"=",
"self",
".",
"_get_box_index",
"(",
")",
"color",
"=",
"self",
".",
"_get_color",
"(",
"box_index",
",",
"selected_clusters",
"=",
"self",
".",
"cluster_ids",
")",
"self",
".",
"visual",
".",
... | https://github.com/cortex-lab/phy/blob/9a330b9437a3d0b40a37a201d147224e6e7fb462/phy/cluster/views/raster.py#L142-L147 | ||
pyvista/pyvista | 012dbb95a9aae406c3cd4cd94fc8c477f871e426 | pyvista/utilities/parametric_objects.py | python | KochanekSpline | (points, tension=None, bias=None, continuity=None, n_points=None) | return spline.compute_arc_length() | Create a Kochanek spline from points.
Parameters
----------
points : sequence
Array of points to build a Kochanek spline out of. Array must
be 3D and directionally ordered.
tension : sequence, optional
Changes the length of the tangent vector. Defaults to ``[0.0,
0.0, 0.0]``.
bias : sequence, optional
Primarily changes the direction of the tangent vector.
Defaults to ``[0.0, 0.0, 0.0]``.
continuity : sequence, optional
Changes the sharpness in change between tangents. Defaults to
``[0.0, 0.0, 0.0]``.
n_points : int, optional
Number of points on the spline. Defaults to the number of
points in ``points``.
Returns
-------
pyvista.PolyData
Kochanek spline.
Examples
--------
Construct a Kochanek spline.
>>> import numpy as np
>>> import pyvista as pv
>>> theta = np.linspace(-4 * np.pi, 4 * np.pi, 100)
>>> z = np.linspace(-2, 2, 100)
>>> r = z ** 2 + 1
>>> x = r * np.sin(theta)
>>> y = r * np.cos(theta)
>>> points = np.column_stack((x, y, z))
>>> kochanek_spline = pv.KochanekSpline(points, n_points=6)
>>> kochanek_spline.plot(line_width=4, color="k")
See :ref:`create_kochanek_spline_example` for an additional example. | Create a Kochanek spline from points. | [
"Create",
"a",
"Kochanek",
"spline",
"from",
"points",
"."
] | def KochanekSpline(points, tension=None, bias=None, continuity=None, n_points=None):
"""Create a Kochanek spline from points.
Parameters
----------
points : sequence
Array of points to build a Kochanek spline out of. Array must
be 3D and directionally ordered.
tension : sequence, optional
Changes the length of the tangent vector. Defaults to ``[0.0,
0.0, 0.0]``.
bias : sequence, optional
Primarily changes the direction of the tangent vector.
Defaults to ``[0.0, 0.0, 0.0]``.
continuity : sequence, optional
Changes the sharpness in change between tangents. Defaults to
``[0.0, 0.0, 0.0]``.
n_points : int, optional
Number of points on the spline. Defaults to the number of
points in ``points``.
Returns
-------
pyvista.PolyData
Kochanek spline.
Examples
--------
Construct a Kochanek spline.
>>> import numpy as np
>>> import pyvista as pv
>>> theta = np.linspace(-4 * np.pi, 4 * np.pi, 100)
>>> z = np.linspace(-2, 2, 100)
>>> r = z ** 2 + 1
>>> x = r * np.sin(theta)
>>> y = r * np.cos(theta)
>>> points = np.column_stack((x, y, z))
>>> kochanek_spline = pv.KochanekSpline(points, n_points=6)
>>> kochanek_spline.plot(line_width=4, color="k")
See :ref:`create_kochanek_spline_example` for an additional example.
"""
if tension is None:
tension = np.array([0.0, 0.0, 0.0])
check_valid_vector(tension, "tension")
if not np.all(np.abs(tension) <= 1.0):
raise ValueError("The absolute value of all values of the tension array elements must be <= 1.0 ")
if bias is None:
bias = np.array([0.0, 0.0, 0.0])
check_valid_vector(bias, "bias")
if not np.all(np.abs(bias) <= 1.0):
raise ValueError("The absolute value of all values of the bias array elements must be <= 1.0 ")
if continuity is None:
continuity = np.array([0.0, 0.0, 0.0])
check_valid_vector(continuity, "continuity")
if not np.all(np.abs(continuity) <= 1.0):
raise ValueError(
"The absolute value of all values continuity array elements must be <= 1.0 "
)
spline_function = _vtk.vtkParametricSpline()
spline_function.SetPoints(pyvista.vtk_points(points, False))
# set Kochanek spline for each direction
xspline = _vtk.vtkKochanekSpline()
yspline = _vtk.vtkKochanekSpline()
zspline = _vtk.vtkKochanekSpline()
xspline.SetDefaultBias(bias[0])
yspline.SetDefaultBias(bias[1])
zspline.SetDefaultBias(bias[2])
xspline.SetDefaultTension(tension[0])
yspline.SetDefaultTension(tension[1])
zspline.SetDefaultTension(tension[2])
xspline.SetDefaultContinuity(continuity[0])
yspline.SetDefaultContinuity(continuity[1])
zspline.SetDefaultContinuity(continuity[2])
spline_function.SetXSpline(xspline)
spline_function.SetYSpline(yspline)
spline_function.SetZSpline(zspline)
# get interpolation density
u_res = n_points
if u_res is None:
u_res = points.shape[0]
u_res -= 1
spline = surface_from_para(spline_function, u_res)
return spline.compute_arc_length() | [
"def",
"KochanekSpline",
"(",
"points",
",",
"tension",
"=",
"None",
",",
"bias",
"=",
"None",
",",
"continuity",
"=",
"None",
",",
"n_points",
"=",
"None",
")",
":",
"if",
"tension",
"is",
"None",
":",
"tension",
"=",
"np",
".",
"array",
"(",
"[",
... | https://github.com/pyvista/pyvista/blob/012dbb95a9aae406c3cd4cd94fc8c477f871e426/pyvista/utilities/parametric_objects.py#L60-L155 | |
golismero/golismero | 7d605b937e241f51c1ca4f47b20f755eeefb9d76 | tools/sqlmap/lib/utils/hash.py | python | oracle_old_passwd | (password, username, uppercase=True) | return retVal.upper() if uppercase else retVal.lower() | Reference(s):
http://www.notesbit.com/index.php/scripts-oracle/oracle-11g-new-password-algorithm-is-revealed-by-seclistsorg/
>>> oracle_old_passwd(password='tiger', username='scott', uppercase=True)
'F894844C34402B67' | Reference(s):
http://www.notesbit.com/index.php/scripts-oracle/oracle-11g-new-password-algorithm-is-revealed-by-seclistsorg/ | [
"Reference",
"(",
"s",
")",
":",
"http",
":",
"//",
"www",
".",
"notesbit",
".",
"com",
"/",
"index",
".",
"php",
"/",
"scripts",
"-",
"oracle",
"/",
"oracle",
"-",
"11g",
"-",
"new",
"-",
"password",
"-",
"algorithm",
"-",
"is",
"-",
"revealed",
... | def oracle_old_passwd(password, username, uppercase=True): # prior to version '11g'
"""
Reference(s):
http://www.notesbit.com/index.php/scripts-oracle/oracle-11g-new-password-algorithm-is-revealed-by-seclistsorg/
>>> oracle_old_passwd(password='tiger', username='scott', uppercase=True)
'F894844C34402B67'
"""
IV, pad = "\0" * 8, "\0"
if isinstance(username, unicode):
username = unicode.encode(username, UNICODE_ENCODING) # pyDes has issues with unicode strings
unistr = "".join("\0%s" % c for c in (username + password).upper())
cipher = des(hexdecode("0123456789ABCDEF"), CBC, IV, pad)
encrypted = cipher.encrypt(unistr)
cipher = des(encrypted[-8:], CBC, IV, pad)
encrypted = cipher.encrypt(unistr)
retVal = hexencode(encrypted[-8:])
return retVal.upper() if uppercase else retVal.lower() | [
"def",
"oracle_old_passwd",
"(",
"password",
",",
"username",
",",
"uppercase",
"=",
"True",
")",
":",
"# prior to version '11g'",
"IV",
",",
"pad",
"=",
"\"\\0\"",
"*",
"8",
",",
"\"\\0\"",
"if",
"isinstance",
"(",
"username",
",",
"unicode",
")",
":",
"u... | https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/tools/sqlmap/lib/utils/hash.py#L194-L217 | |
enthought/chaco | 0907d1dedd07a499202efbaf2fe2a4e51b4c8e5f | chaco/examples/demo/hyetograph.py | python | Hyetograph.calculate_intensity | (self) | The Hyetograph calculations. | The Hyetograph calculations. | [
"The",
"Hyetograph",
"calculations",
"."
] | def calculate_intensity(self):
""" The Hyetograph calculations. """
# Assigning A, B, and C values based on year, storm, and county
year = YEARS[self.year_storm]
value = COUNTIES[self.county]
a, b, c = year[value], year[value+1], year[value+2]
self.timeline = [i for i in range(2, self.duration + 1, 2)]
intensity = a / (self.timeline * 60 + b)**c
cumulative_depth = intensity * self.timeline
temp = cumulative_depth[0]
result = []
for i in cumulative_depth[1:]:
result.append(i-temp)
temp = i
result.insert(0, cumulative_depth[0])
# Alternating block method implementation.
result.reverse()
switch = True
o, e = [], []
for i in result:
if switch:
o.append(i)
else:
e.append(i)
switch = not switch
e.reverse()
result = o + e
self.intensity = result | [
"def",
"calculate_intensity",
"(",
"self",
")",
":",
"# Assigning A, B, and C values based on year, storm, and county",
"year",
"=",
"YEARS",
"[",
"self",
".",
"year_storm",
"]",
"value",
"=",
"COUNTIES",
"[",
"self",
".",
"county",
"]",
"a",
",",
"b",
",",
"c",... | https://github.com/enthought/chaco/blob/0907d1dedd07a499202efbaf2fe2a4e51b4c8e5f/chaco/examples/demo/hyetograph.py#L71-L101 | ||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/lxml-4.4.2-py3.7-macosx-10.9-x86_64.egg/lxml/html/__init__.py | python | HtmlMixin.drop_tree | (self) | Removes this element from the tree, including its children and
text. The tail text is joined to the previous element or
parent. | Removes this element from the tree, including its children and
text. The tail text is joined to the previous element or
parent. | [
"Removes",
"this",
"element",
"from",
"the",
"tree",
"including",
"its",
"children",
"and",
"text",
".",
"The",
"tail",
"text",
"is",
"joined",
"to",
"the",
"previous",
"element",
"or",
"parent",
"."
] | def drop_tree(self):
"""
Removes this element from the tree, including its children and
text. The tail text is joined to the previous element or
parent.
"""
parent = self.getparent()
assert parent is not None
if self.tail:
previous = self.getprevious()
if previous is None:
parent.text = (parent.text or '') + self.tail
else:
previous.tail = (previous.tail or '') + self.tail
parent.remove(self) | [
"def",
"drop_tree",
"(",
"self",
")",
":",
"parent",
"=",
"self",
".",
"getparent",
"(",
")",
"assert",
"parent",
"is",
"not",
"None",
"if",
"self",
".",
"tail",
":",
"previous",
"=",
"self",
".",
"getprevious",
"(",
")",
"if",
"previous",
"is",
"Non... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/lxml-4.4.2-py3.7-macosx-10.9-x86_64.egg/lxml/html/__init__.py#L332-L346 | ||
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/benchmarks/src/benchmarks/sympy/sympy/mpmath/matrices/eigen.py | python | hessenberg_reduce_0 | (ctx, A, T) | This routine computes the (upper) Hessenberg decomposition of a square matrix A.
Given A, an unitary matrix Q is calculated such that
Q' A Q = H and Q' Q = Q Q' = 1
where H is an upper Hessenberg matrix, meaning that it only contains zeros
below the first subdiagonal. Here ' denotes the hermitian transpose (i.e.
transposition and conjugation).
parameters:
A (input/output) On input, A contains the square matrix A of
dimension (n,n). On output, A contains a compressed representation
of Q and H.
T (output) An array of length n containing the first elements of
the Householder reflectors. | This routine computes the (upper) Hessenberg decomposition of a square matrix A.
Given A, an unitary matrix Q is calculated such that | [
"This",
"routine",
"computes",
"the",
"(",
"upper",
")",
"Hessenberg",
"decomposition",
"of",
"a",
"square",
"matrix",
"A",
".",
"Given",
"A",
"an",
"unitary",
"matrix",
"Q",
"is",
"calculated",
"such",
"that"
] | def hessenberg_reduce_0(ctx, A, T):
"""
This routine computes the (upper) Hessenberg decomposition of a square matrix A.
Given A, an unitary matrix Q is calculated such that
Q' A Q = H and Q' Q = Q Q' = 1
where H is an upper Hessenberg matrix, meaning that it only contains zeros
below the first subdiagonal. Here ' denotes the hermitian transpose (i.e.
transposition and conjugation).
parameters:
A (input/output) On input, A contains the square matrix A of
dimension (n,n). On output, A contains a compressed representation
of Q and H.
T (output) An array of length n containing the first elements of
the Householder reflectors.
"""
# internally we work with householder reflections from the right.
# let u be a row vector (i.e. u[i]=A[i,:i]). then
# Q is build up by reflectors of the type (1-v'v) where v is a suitable
# modification of u. these reflectors are applyed to A from the right.
# because we work with reflectors from the right we have to start with
# the bottom row of A and work then upwards (this corresponds to
# some kind of RQ decomposition).
# the first part of the vectors v (i.e. A[i,:(i-1)]) are stored as row vectors
# in the lower left part of A (excluding the diagonal and subdiagonal).
# the last entry of v is stored in T.
# the upper right part of A (including diagonal and subdiagonal) becomes H.
n = A.rows
if n <= 2: return
for i in xrange(n-1, 1, -1):
# scale the vector
scale = 0
for k in xrange(0, i):
scale += abs(ctx.re(A[i,k])) + abs(ctx.im(A[i,k]))
scale_inv = 0
if scale != 0:
scale_inv = 1 / scale
if scale == 0 or ctx.isinf(scale_inv):
# sadly there are floating point numbers not equal to zero whose reciprocal is infinity
T[i] = 0
A[i,i-1] = 0
continue
# calculate parameters for housholder transformation
H = 0
for k in xrange(0, i):
A[i,k] *= scale_inv
rr = ctx.re(A[i,k])
ii = ctx.im(A[i,k])
H += rr * rr + ii * ii
F = A[i,i-1]
f = abs(F)
G = ctx.sqrt(H)
A[i,i-1] = - G * scale
if f == 0:
T[i] = G
else:
ff = F / f
T[i] = F + G * ff
A[i,i-1] *= ff
H += G * f
H = 1 / ctx.sqrt(H)
T[i] *= H
for k in xrange(0, i - 1):
A[i,k] *= H
for j in xrange(0, i):
# apply housholder transformation (from right)
G = ctx.conj(T[i]) * A[j,i-1]
for k in xrange(0, i-1):
G += ctx.conj(A[i,k]) * A[j,k]
A[j,i-1] -= G * T[i]
for k in xrange(0, i-1):
A[j,k] -= G * A[i,k]
for j in xrange(0, n):
# apply housholder transformation (from left)
G = T[i] * A[i-1,j]
for k in xrange(0, i-1):
G += A[i,k] * A[k,j]
A[i-1,j] -= G * ctx.conj(T[i])
for k in xrange(0, i-1):
A[k,j] -= G * ctx.conj(A[i,k]) | [
"def",
"hessenberg_reduce_0",
"(",
"ctx",
",",
"A",
",",
"T",
")",
":",
"# internally we work with householder reflections from the right.",
"# let u be a row vector (i.e. u[i]=A[i,:i]). then",
"# Q is build up by reflectors of the type (1-v'v) where v is a suitable",
"# modification of u.... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/mpmath/matrices/eigen.py#L44-L145 | ||
dhtech/swboot | b741e8f90f3941a7619e12addf337bed1d299204 | http/server.py | python | HTTPServer.server_bind | (self) | Override server_bind to store the server name. | Override server_bind to store the server name. | [
"Override",
"server_bind",
"to",
"store",
"the",
"server",
"name",
"."
] | def server_bind(self):
"""Override server_bind to store the server name."""
socketserver.TCPServer.server_bind(self)
host, port = self.server_address[:2]
self.server_name = socket.getfqdn(host)
self.server_port = port | [
"def",
"server_bind",
"(",
"self",
")",
":",
"socketserver",
".",
"TCPServer",
".",
"server_bind",
"(",
"self",
")",
"host",
",",
"port",
"=",
"self",
".",
"server_address",
"[",
":",
"2",
"]",
"self",
".",
"server_name",
"=",
"socket",
".",
"getfqdn",
... | https://github.com/dhtech/swboot/blob/b741e8f90f3941a7619e12addf337bed1d299204/http/server.py#L135-L140 | ||
scikit-hep/scikit-hep | 506149b352eeb2291f24aef3f40691b5f6be2da7 | skhep/math/vectors.py | python | LorentzVector.copy | (self) | return LorentzVector(self[0], self[1], self[2], self[3]) | Get a copy of the LorentzVector.
Example
-------
>>> v = ...
>>> v1 = v.copy() | Get a copy of the LorentzVector. | [
"Get",
"a",
"copy",
"of",
"the",
"LorentzVector",
"."
] | def copy(self):
"""Get a copy of the LorentzVector.
Example
-------
>>> v = ...
>>> v1 = v.copy()
"""
return LorentzVector(self[0], self[1], self[2], self[3]) | [
"def",
"copy",
"(",
"self",
")",
":",
"return",
"LorentzVector",
"(",
"self",
"[",
"0",
"]",
",",
"self",
"[",
"1",
"]",
",",
"self",
"[",
"2",
"]",
",",
"self",
"[",
"3",
"]",
")"
] | https://github.com/scikit-hep/scikit-hep/blob/506149b352eeb2291f24aef3f40691b5f6be2da7/skhep/math/vectors.py#L896-L904 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/zwave/lock.py | python | get_device | (node, values, **kwargs) | return ZwaveLock(values) | Create Z-Wave entity device. | Create Z-Wave entity device. | [
"Create",
"Z",
"-",
"Wave",
"entity",
"device",
"."
] | def get_device(node, values, **kwargs):
"""Create Z-Wave entity device."""
return ZwaveLock(values) | [
"def",
"get_device",
"(",
"node",
",",
"values",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"ZwaveLock",
"(",
"values",
")"
] | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/zwave/lock.py#L247-L249 | |
wger-project/wger | 3a17a2cf133d242d1f8c357faa53cf675a7b3223 | wger/measurements/api/views.py | python | CategoryViewSet.perform_create | (self, serializer) | Set the owner | Set the owner | [
"Set",
"the",
"owner"
] | def perform_create(self, serializer):
"""
Set the owner
"""
serializer.save(user=self.request.user) | [
"def",
"perform_create",
"(",
"self",
",",
"serializer",
")",
":",
"serializer",
".",
"save",
"(",
"user",
"=",
"self",
".",
"request",
".",
"user",
")"
] | https://github.com/wger-project/wger/blob/3a17a2cf133d242d1f8c357faa53cf675a7b3223/wger/measurements/api/views.py#L56-L60 | ||
robotlearn/pyrobolearn | 9cd7c060723fda7d2779fa255ac998c2c82b8436 | pyrobolearn/simulators/raisim.py | python | Raisim.get_joint_state | (self, body_id, joint_id) | Get the joint state.
Args:
body_id (int): unique body id.
joint_id (int): joint index in range [0..num_joints(body_id)]
Returns:
float: The position value of this joint.
float: The velocity value of this joint.
np.array[float[6]]: These are the joint reaction forces, if a torque sensor is enabled for this joint it is
[Fx, Fy, Fz, Mx, My, Mz]. Without torque sensor, it is [0, 0, 0, 0, 0, 0].
float: This is the motor torque applied during the last stepSimulation. Note that this only applies in
VELOCITY_CONTROL and POSITION_CONTROL. If you use TORQUE_CONTROL then the applied joint motor torque
is exactly what you provide, so there is no need to report it separately. | Get the joint state. | [
"Get",
"the",
"joint",
"state",
"."
] | def get_joint_state(self, body_id, joint_id):
"""
Get the joint state.
Args:
body_id (int): unique body id.
joint_id (int): joint index in range [0..num_joints(body_id)]
Returns:
float: The position value of this joint.
float: The velocity value of this joint.
np.array[float[6]]: These are the joint reaction forces, if a torque sensor is enabled for this joint it is
[Fx, Fy, Fz, Mx, My, Mz]. Without torque sensor, it is [0, 0, 0, 0, 0, 0].
float: This is the motor torque applied during the last stepSimulation. Note that this only applies in
VELOCITY_CONTROL and POSITION_CONTROL. If you use TORQUE_CONTROL then the applied joint motor torque
is exactly what you provide, so there is no need to report it separately.
"""
pass | [
"def",
"get_joint_state",
"(",
"self",
",",
"body_id",
",",
"joint_id",
")",
":",
"pass"
] | https://github.com/robotlearn/pyrobolearn/blob/9cd7c060723fda7d2779fa255ac998c2c82b8436/pyrobolearn/simulators/raisim.py#L1306-L1323 | ||
Urinx/WeixinBot | d9edcd2c9203fe7dd203b22b71bbc48a31e9492b | wxbot_project_py2.7/db/mysql_db.py | python | MysqlDB.close | (self) | @brief close connection to database | [] | def close(self):
"""
@brief close connection to database
"""
Log.debug('DB -> close')
# 关闭数据库连接
self.conn.close() | [
"def",
"close",
"(",
"self",
")",
":",
"Log",
".",
"debug",
"(",
"'DB -> close'",
")",
"# 关闭数据库连接",
"self",
".",
"conn",
".",
"close",
"(",
")"
] | https://github.com/Urinx/WeixinBot/blob/d9edcd2c9203fe7dd203b22b71bbc48a31e9492b/wxbot_project_py2.7/db/mysql_db.py#L192-L198 | |||
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter8-Regression/venv/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/html5lib/treewalkers/base.py | python | TreeWalker.entity | (self, name) | return {"type": "Entity", "name": name} | [] | def entity(self, name):
return {"type": "Entity", "name": name} | [
"def",
"entity",
"(",
"self",
",",
"name",
")",
":",
"return",
"{",
"\"type\"",
":",
"\"Entity\"",
",",
"\"name\"",
":",
"name",
"}"
] | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter8-Regression/venv/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/html5lib/treewalkers/base.py#L71-L72 | |||
onnx/onnx-coreml | 141fc33d7217674ea8bda36494fa8089a543a3f3 | onnx_coreml/_operators.py | python | _is_input_shape_mapping_defined | (node, graph) | [] | def _is_input_shape_mapping_defined(node, graph): # type: (Node, Graph) -> Bool
if node.inputs[0] in graph.onnx_coreml_shape_mapping:
return True
else:
return False | [
"def",
"_is_input_shape_mapping_defined",
"(",
"node",
",",
"graph",
")",
":",
"# type: (Node, Graph) -> Bool",
"if",
"node",
".",
"inputs",
"[",
"0",
"]",
"in",
"graph",
".",
"onnx_coreml_shape_mapping",
":",
"return",
"True",
"else",
":",
"return",
"False"
] | https://github.com/onnx/onnx-coreml/blob/141fc33d7217674ea8bda36494fa8089a543a3f3/onnx_coreml/_operators.py#L28-L32 | ||||
aws-samples/aws-kube-codesuite | ab4e5ce45416b83bffb947ab8d234df5437f4fca | src/networkx/algorithms/coloring/greedy_coloring.py | python | strategy_random_sequential | (G, colors) | return nodes | Returns a random permutation of the nodes of ``G`` as a list.
``G`` is a NetworkX graph. ``colors`` is ignored. | Returns a random permutation of the nodes of ``G`` as a list. | [
"Returns",
"a",
"random",
"permutation",
"of",
"the",
"nodes",
"of",
"G",
"as",
"a",
"list",
"."
] | def strategy_random_sequential(G, colors):
"""Returns a random permutation of the nodes of ``G`` as a list.
``G`` is a NetworkX graph. ``colors`` is ignored.
"""
nodes = list(G)
random.shuffle(nodes)
return nodes | [
"def",
"strategy_random_sequential",
"(",
"G",
",",
"colors",
")",
":",
"nodes",
"=",
"list",
"(",
"G",
")",
"random",
".",
"shuffle",
"(",
"nodes",
")",
"return",
"nodes"
] | https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/networkx/algorithms/coloring/greedy_coloring.py#L37-L45 | |
voxpupuli/puppetboard | f3d38384cd0cd940c22bc7661e98a7f56304ea2a | puppetboard/app.py | python | metric | (env, metric) | return render_template(
'metric.html',
name=name,
metric=sorted(metric.items()),
envs=envs,
current_env=env) | Lists all information about the metric of the given name.
:param env: While this parameter serves no function purpose it is required
for the environments template block
:type env: :obj:`string` | Lists all information about the metric of the given name. | [
"Lists",
"all",
"information",
"about",
"the",
"metric",
"of",
"the",
"given",
"name",
"."
] | def metric(env, metric):
"""Lists all information about the metric of the given name.
:param env: While this parameter serves no function purpose it is required
for the environments template block
:type env: :obj:`string`
"""
envs = environments()
check_env(env, envs)
db_version = get_db_version(puppetdb)
query_type, metric_version = metric_params(db_version)
name = unquote(metric)
metric = get_or_abort(puppetdb.metric, metric, version=metric_version)
return render_template(
'metric.html',
name=name,
metric=sorted(metric.items()),
envs=envs,
current_env=env) | [
"def",
"metric",
"(",
"env",
",",
"metric",
")",
":",
"envs",
"=",
"environments",
"(",
")",
"check_env",
"(",
"env",
",",
"envs",
")",
"db_version",
"=",
"get_db_version",
"(",
"puppetdb",
")",
"query_type",
",",
"metric_version",
"=",
"metric_params",
"(... | https://github.com/voxpupuli/puppetboard/blob/f3d38384cd0cd940c22bc7661e98a7f56304ea2a/puppetboard/app.py#L946-L966 | |
giampaolo/psutil | 55161bd4850986359a029f1c9a81bcf66f37afa8 | psutil/_pslinux.py | python | cpu_count_logical | () | Return the number of logical CPUs in the system. | Return the number of logical CPUs in the system. | [
"Return",
"the",
"number",
"of",
"logical",
"CPUs",
"in",
"the",
"system",
"."
] | def cpu_count_logical():
"""Return the number of logical CPUs in the system."""
try:
return os.sysconf("SC_NPROCESSORS_ONLN")
except ValueError:
# as a second fallback we try to parse /proc/cpuinfo
num = 0
with open_binary('%s/cpuinfo' % get_procfs_path()) as f:
for line in f:
if line.lower().startswith(b'processor'):
num += 1
# unknown format (e.g. amrel/sparc architectures), see:
# https://github.com/giampaolo/psutil/issues/200
# try to parse /proc/stat as a last resort
if num == 0:
search = re.compile(r'cpu\d')
with open_text('%s/stat' % get_procfs_path()) as f:
for line in f:
line = line.split(' ')[0]
if search.match(line):
num += 1
if num == 0:
# mimic os.cpu_count()
return None
return num | [
"def",
"cpu_count_logical",
"(",
")",
":",
"try",
":",
"return",
"os",
".",
"sysconf",
"(",
"\"SC_NPROCESSORS_ONLN\"",
")",
"except",
"ValueError",
":",
"# as a second fallback we try to parse /proc/cpuinfo",
"num",
"=",
"0",
"with",
"open_binary",
"(",
"'%s/cpuinfo'"... | https://github.com/giampaolo/psutil/blob/55161bd4850986359a029f1c9a81bcf66f37afa8/psutil/_pslinux.py#L612-L638 | ||
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Lib/rfc822.py | python | dump_address_pair | (pair) | Dump a (name, address) pair in a canonicalized form. | Dump a (name, address) pair in a canonicalized form. | [
"Dump",
"a",
"(",
"name",
"address",
")",
"pair",
"in",
"a",
"canonicalized",
"form",
"."
] | def dump_address_pair(pair):
"""Dump a (name, address) pair in a canonicalized form."""
if pair[0]:
return '"' + pair[0] + '" <' + pair[1] + '>'
else:
return pair[1] | [
"def",
"dump_address_pair",
"(",
"pair",
")",
":",
"if",
"pair",
"[",
"0",
"]",
":",
"return",
"'\"'",
"+",
"pair",
"[",
"0",
"]",
"+",
"'\" <'",
"+",
"pair",
"[",
"1",
"]",
"+",
"'>'",
"else",
":",
"return",
"pair",
"[",
"1",
"]"
] | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/rfc822.py#L825-L830 | ||
GoogleCloudPlatform/PerfKitBenchmarker | 6e3412d7d5e414b8ca30ed5eaf970cef1d919a67 | perfkitbenchmarker/providers/rackspace/rackspace_virtual_machine.py | python | RackspaceVirtualMachine._FindBootBlockDevice | (self, blk_devices, boot_blk_device) | Helper method to search for backing block device of a partition. | Helper method to search for backing block device of a partition. | [
"Helper",
"method",
"to",
"search",
"for",
"backing",
"block",
"device",
"of",
"a",
"partition",
"."
] | def _FindBootBlockDevice(self, blk_devices, boot_blk_device):
"""Helper method to search for backing block device of a partition."""
blk_device_name = boot_blk_device['name'].rstrip('0123456789')
for dev in blk_devices:
if dev['type'] == 'disk' and dev['name'] == blk_device_name:
boot_blk_device = dev
return boot_blk_device | [
"def",
"_FindBootBlockDevice",
"(",
"self",
",",
"blk_devices",
",",
"boot_blk_device",
")",
":",
"blk_device_name",
"=",
"boot_blk_device",
"[",
"'name'",
"]",
".",
"rstrip",
"(",
"'0123456789'",
")",
"for",
"dev",
"in",
"blk_devices",
":",
"if",
"dev",
"[",
... | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/6e3412d7d5e414b8ca30ed5eaf970cef1d919a67/perfkitbenchmarker/providers/rackspace/rackspace_virtual_machine.py#L502-L508 | ||
IronLanguages/ironpython2 | 51fdedeeda15727717fb8268a805f71b06c0b9f1 | Src/StdLib/Lib/chunk.py | python | Chunk.getsize | (self) | return self.chunksize | Return the size of the current chunk. | Return the size of the current chunk. | [
"Return",
"the",
"size",
"of",
"the",
"current",
"chunk",
"."
] | def getsize(self):
"""Return the size of the current chunk."""
return self.chunksize | [
"def",
"getsize",
"(",
"self",
")",
":",
"return",
"self",
".",
"chunksize"
] | https://github.com/IronLanguages/ironpython2/blob/51fdedeeda15727717fb8268a805f71b06c0b9f1/Src/StdLib/Lib/chunk.py#L82-L84 | |
binaryage/drydrop | 2f27e15befd247255d89f9120eeee44851b82c4a | dryapp/drydrop/app/core/controller.py | python | AbstractController.redirect_to | (self, url) | Redirects to a specified url | Redirects to a specified url | [
"Redirects",
"to",
"a",
"specified",
"url"
] | def redirect_to(self, url):
"""Redirects to a specified url"""
# self.handler.redirect(url)
# self.emited = True
# raise PageRedirect, (url)
# mrizka delala problemy pri claimovani openid
m = re.match(r'^(.*)#.*?$', url)
if m: url = m.group(1)
logging.info("Redirecting to: %s" % url)
# send the redirect! we use a meta because appengine bombs out sometimes with long redirect urls
self.response.out.write("<html><head><meta http-equiv=\"refresh\" content=\"0;url=%s\"></head><body></body></html>" % (url,))
self.emited = True
raise PageRedirect, (url) | [
"def",
"redirect_to",
"(",
"self",
",",
"url",
")",
":",
"# self.handler.redirect(url)",
"# self.emited = True",
"# raise PageRedirect, (url)",
"# mrizka delala problemy pri claimovani openid",
"m",
"=",
"re",
".",
"match",
"(",
"r'^(.*)#.*?$'",
",",
"url",
")",
"if",
"... | https://github.com/binaryage/drydrop/blob/2f27e15befd247255d89f9120eeee44851b82c4a/dryapp/drydrop/app/core/controller.py#L81-L96 | ||
nvbn/py-backwards | fd2d89ad972148024ee667eff5b9f19ac91d98ad | py_backwards/conf.py | python | init_settings | (args: Namespace) | [] | def init_settings(args: Namespace) -> None:
if args.debug:
settings.debug = True | [
"def",
"init_settings",
"(",
"args",
":",
"Namespace",
")",
"->",
"None",
":",
"if",
"args",
".",
"debug",
":",
"settings",
".",
"debug",
"=",
"True"
] | https://github.com/nvbn/py-backwards/blob/fd2d89ad972148024ee667eff5b9f19ac91d98ad/py_backwards/conf.py#L12-L14 | ||||
luyanger1799/Amazing-Semantic-Segmentation | 686ff29b1c97f93bc20e3bd8e8cb0e72a730de82 | models/fcn.py | python | FCN.__init__ | (self, num_classes, version='FCN-8s', base_model='VGG16', **kwargs) | The initialization of FCN-8s/16s/32s.
:param num_classes: the number of predicted classes.
:param version: 'FCN-8s', 'FCN-16s' or 'FCN-32s'.
:param base_model: the backbone model
:param kwargs: other parameters | The initialization of FCN-8s/16s/32s.
:param num_classes: the number of predicted classes.
:param version: 'FCN-8s', 'FCN-16s' or 'FCN-32s'.
:param base_model: the backbone model
:param kwargs: other parameters | [
"The",
"initialization",
"of",
"FCN",
"-",
"8s",
"/",
"16s",
"/",
"32s",
".",
":",
"param",
"num_classes",
":",
"the",
"number",
"of",
"predicted",
"classes",
".",
":",
"param",
"version",
":",
"FCN",
"-",
"8s",
"FCN",
"-",
"16s",
"or",
"FCN",
"-",
... | def __init__(self, num_classes, version='FCN-8s', base_model='VGG16', **kwargs):
"""
The initialization of FCN-8s/16s/32s.
:param num_classes: the number of predicted classes.
:param version: 'FCN-8s', 'FCN-16s' or 'FCN-32s'.
:param base_model: the backbone model
:param kwargs: other parameters
"""
fcn = {'FCN-8s': self._fcn_8s,
'FCN-16s': self._fcn_16s,
'FCN-32s': self._fcn_32s}
base_model = 'VGG16' if base_model is None else base_model
assert version in fcn
self.fcn = fcn[version]
super(FCN, self).__init__(num_classes, version, base_model, **kwargs) | [
"def",
"__init__",
"(",
"self",
",",
"num_classes",
",",
"version",
"=",
"'FCN-8s'",
",",
"base_model",
"=",
"'VGG16'",
",",
"*",
"*",
"kwargs",
")",
":",
"fcn",
"=",
"{",
"'FCN-8s'",
":",
"self",
".",
"_fcn_8s",
",",
"'FCN-16s'",
":",
"self",
".",
"... | https://github.com/luyanger1799/Amazing-Semantic-Segmentation/blob/686ff29b1c97f93bc20e3bd8e8cb0e72a730de82/models/fcn.py#L18-L33 | ||
krintoxi/NoobSec-Toolkit | 38738541cbc03cedb9a3b3ed13b629f781ad64f6 | NoobSecToolkit - MAC OSX/scripts/nextpenbox.py | python | doork | () | [] | def doork():
print("doork is a open-source passive vulnerability auditor tool that automates the process of searching on Google information about specific website based on dorks. ")
doorkchice = raw_input("Continue Y / N: ")
if doorkchice in yes:
os.system("pip install beautifulsoup4 && pip install requests")
os.system("git clone https://github.com/AeonDave/doork")
clearScr()
doorkt = raw_input("Target : ")
os.system("cd doork && python doork.py -t %s -o log.log"%doorkt) | [
"def",
"doork",
"(",
")",
":",
"print",
"(",
"\"doork is a open-source passive vulnerability auditor tool that automates the process of searching on Google information about specific website based on dorks. \"",
")",
"doorkchice",
"=",
"raw_input",
"(",
"\"Continue Y / N: \"",
")",
"if... | https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit - MAC OSX/scripts/nextpenbox.py#L153-L161 | ||||
QUVA-Lab/artemis | 84d3b1daf0de363cc823d99f978e2861ed400b5b | artemis/general/display.py | python | truncate_string | (string, truncation, message = '') | Truncate a string to a given length. Optionally add a message at the end
explaining the truncation
:param string: A string
:param truncation: An int
:param message: A message, e.g. '...<truncated>'
:return: A new string no longer than truncation | Truncate a string to a given length. Optionally add a message at the end
explaining the truncation
:param string: A string
:param truncation: An int
:param message: A message, e.g. '...<truncated>'
:return: A new string no longer than truncation | [
"Truncate",
"a",
"string",
"to",
"a",
"given",
"length",
".",
"Optionally",
"add",
"a",
"message",
"at",
"the",
"end",
"explaining",
"the",
"truncation",
":",
"param",
"string",
":",
"A",
"string",
":",
"param",
"truncation",
":",
"An",
"int",
":",
"para... | def truncate_string(string, truncation, message = ''):
"""
Truncate a string to a given length. Optionally add a message at the end
explaining the truncation
:param string: A string
:param truncation: An int
:param message: A message, e.g. '...<truncated>'
:return: A new string no longer than truncation
"""
if truncation is None:
return string
assert isinstance(truncation, int)
if len(string)>truncation:
return string[:truncation-len(message)]+message
else:
return string | [
"def",
"truncate_string",
"(",
"string",
",",
"truncation",
",",
"message",
"=",
"''",
")",
":",
"if",
"truncation",
"is",
"None",
":",
"return",
"string",
"assert",
"isinstance",
"(",
"truncation",
",",
"int",
")",
"if",
"len",
"(",
"string",
")",
">",
... | https://github.com/QUVA-Lab/artemis/blob/84d3b1daf0de363cc823d99f978e2861ed400b5b/artemis/general/display.py#L320-L335 | ||
mesalock-linux/mesapy | ed546d59a21b36feb93e2309d5c6b75aa0ad95c9 | lib_pypy/datetime.py | python | date.ctime | (self) | return "%s %s %2d 00:00:00 %04d" % (
_DAYNAMES[weekday],
_MONTHNAMES[self._month],
self._day, self._year) | Return ctime() style string. | Return ctime() style string. | [
"Return",
"ctime",
"()",
"style",
"string",
"."
] | def ctime(self):
"Return ctime() style string."
weekday = self.toordinal() % 7 or 7
return "%s %s %2d 00:00:00 %04d" % (
_DAYNAMES[weekday],
_MONTHNAMES[self._month],
self._day, self._year) | [
"def",
"ctime",
"(",
"self",
")",
":",
"weekday",
"=",
"self",
".",
"toordinal",
"(",
")",
"%",
"7",
"or",
"7",
"return",
"\"%s %s %2d 00:00:00 %04d\"",
"%",
"(",
"_DAYNAMES",
"[",
"weekday",
"]",
",",
"_MONTHNAMES",
"[",
"self",
".",
"_month",
"]",
",... | https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/lib_pypy/datetime.py#L773-L779 | |
Teichlab/cellphonedb | dca1c26555b012df30af0f2521cd4df317cf4600 | cellphonedb/src/app/app_config.py | python | AppConfig._merge_configs | (self, config_base, new_config) | return config | [] | def _merge_configs(self, config_base, new_config):
config = {**config_base, **new_config}
for key in config_base:
if isinstance(config_base[key], dict) and key in new_config:
config[key] = self._merge_configs(config_base[key], new_config[key])
return config | [
"def",
"_merge_configs",
"(",
"self",
",",
"config_base",
",",
"new_config",
")",
":",
"config",
"=",
"{",
"*",
"*",
"config_base",
",",
"*",
"*",
"new_config",
"}",
"for",
"key",
"in",
"config_base",
":",
"if",
"isinstance",
"(",
"config_base",
"[",
"ke... | https://github.com/Teichlab/cellphonedb/blob/dca1c26555b012df30af0f2521cd4df317cf4600/cellphonedb/src/app/app_config.py#L92-L98 | |||
triaquae/triaquae | bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9 | TriAquae/models/Ubuntu_13/rsa/cli.py | python | EncryptBigfileOperation.perform_operation | (self, infile, outfile, pub_key, cli_args=None) | return rsa.bigfile.encrypt_bigfile(infile, outfile, pub_key) | Encrypts files to VARBLOCK. | Encrypts files to VARBLOCK. | [
"Encrypts",
"files",
"to",
"VARBLOCK",
"."
] | def perform_operation(self, infile, outfile, pub_key, cli_args=None):
'''Encrypts files to VARBLOCK.'''
return rsa.bigfile.encrypt_bigfile(infile, outfile, pub_key) | [
"def",
"perform_operation",
"(",
"self",
",",
"infile",
",",
"outfile",
",",
"pub_key",
",",
"cli_args",
"=",
"None",
")",
":",
"return",
"rsa",
".",
"bigfile",
".",
"encrypt_bigfile",
"(",
"infile",
",",
"outfile",
",",
"pub_key",
")"
] | https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/Ubuntu_13/rsa/cli.py#L351-L354 | |
tensorflow/lattice | 784eca50cbdfedf39f183cc7d298c9fe376b69c0 | tensorflow_lattice/python/lattice_layer.py | python | LaplacianRegularizer.__init__ | (self, lattice_sizes, l1=0.0, l2=0.0) | Initializes an instance of `LaplacianRegularizer`.
Args:
lattice_sizes: Lattice sizes of `tfl.layers.Lattice` to regularize.
l1: l1 regularization amount. Either single float or list or tuple of
floats to specify different regularization amount per dimension.
l2: l2 regularization amount. Either single float or list or tuple of
floats to specify different regularization amount per dimension.
Raises:
ValueError: If provided input does not correspond to `lattice_sizes`. | Initializes an instance of `LaplacianRegularizer`. | [
"Initializes",
"an",
"instance",
"of",
"LaplacianRegularizer",
"."
] | def __init__(self, lattice_sizes, l1=0.0, l2=0.0):
"""Initializes an instance of `LaplacianRegularizer`.
Args:
lattice_sizes: Lattice sizes of `tfl.layers.Lattice` to regularize.
l1: l1 regularization amount. Either single float or list or tuple of
floats to specify different regularization amount per dimension.
l2: l2 regularization amount. Either single float or list or tuple of
floats to specify different regularization amount per dimension.
Raises:
ValueError: If provided input does not correspond to `lattice_sizes`.
"""
lattice_lib.verify_hyperparameters(
lattice_sizes=lattice_sizes,
regularization_amount=l1,
regularization_info="l1")
lattice_lib.verify_hyperparameters(
lattice_sizes=lattice_sizes,
regularization_amount=l2,
regularization_info="l2")
self.lattice_sizes = lattice_sizes
self.l1 = l1
self.l2 = l2 | [
"def",
"__init__",
"(",
"self",
",",
"lattice_sizes",
",",
"l1",
"=",
"0.0",
",",
"l2",
"=",
"0.0",
")",
":",
"lattice_lib",
".",
"verify_hyperparameters",
"(",
"lattice_sizes",
"=",
"lattice_sizes",
",",
"regularization_amount",
"=",
"l1",
",",
"regularizatio... | https://github.com/tensorflow/lattice/blob/784eca50cbdfedf39f183cc7d298c9fe376b69c0/tensorflow_lattice/python/lattice_layer.py#L1026-L1049 | ||
metabrainz/picard | 535bf8c7d9363ffc7abb3f69418ec11823c38118 | picard/util/bitreader.py | python | LSBBitReader._lsb | (self, count) | return value | [] | def _lsb(self, count):
value = self._buffer & 0xff >> (8 - count)
self._buffer = self._buffer >> count
self._bits -= count
return value | [
"def",
"_lsb",
"(",
"self",
",",
"count",
")",
":",
"value",
"=",
"self",
".",
"_buffer",
"&",
"0xff",
">>",
"(",
"8",
"-",
"count",
")",
"self",
".",
"_buffer",
"=",
"self",
".",
"_buffer",
">>",
"count",
"self",
".",
"_bits",
"-=",
"count",
"re... | https://github.com/metabrainz/picard/blob/535bf8c7d9363ffc7abb3f69418ec11823c38118/picard/util/bitreader.py#L135-L139 | |||
pyqt/examples | 843bb982917cecb2350b5f6d7f42c9b7fb142ec1 | src/pyqt-official/qml/referenceexamples/default.py | python | BirthdayParty.host | (self, host) | [] | def host(self, host):
self._host = host | [
"def",
"host",
"(",
"self",
",",
"host",
")",
":",
"self",
".",
"_host",
"=",
"host"
] | https://github.com/pyqt/examples/blob/843bb982917cecb2350b5f6d7f42c9b7fb142ec1/src/pyqt-official/qml/referenceexamples/default.py#L115-L116 | ||||
i3visio/osrframework | e02a6e9b1346ab5a01244c0d19bcec8232bf1a37 | osrframework/utils/general.py | python | osrf_to_png_export | (d, file_path) | Workaround to export to a png file.
Args:
d: Data to export.
file_path: File path for the output file. | Workaround to export to a png file. | [
"Workaround",
"to",
"export",
"to",
"a",
"png",
"file",
"."
] | def osrf_to_png_export(d, file_path):
"""Workaround to export to a png file.
Args:
d: Data to export.
file_path: File path for the output file.
"""
newGraph = _generate_graph_data(d)
import matplotlib.pyplot as plt
# Writing the png file
nx.draw(newGraph)
plt.savefig(file_path) | [
"def",
"osrf_to_png_export",
"(",
"d",
",",
"file_path",
")",
":",
"newGraph",
"=",
"_generate_graph_data",
"(",
"d",
")",
"import",
"matplotlib",
".",
"pyplot",
"as",
"plt",
"# Writing the png file",
"nx",
".",
"draw",
"(",
"newGraph",
")",
"plt",
".",
"sav... | https://github.com/i3visio/osrframework/blob/e02a6e9b1346ab5a01244c0d19bcec8232bf1a37/osrframework/utils/general.py#L587-L599 | ||
Pagure/pagure | 512f23f5cd1f965276969747792edeb1215cba68 | pagure/lib/git.py | python | _create_project_repo | (project, region, templ, ignore_existing, repotype) | Creates a single specific git repository on disk or repoSpanner
Args:
project (Project): Project to create repos for
region (string or None): repoSpanner region to create the repos in
templ (string): Template directory, only valid for non-repoSpanner
ignore_existing (bool): Whether a repo already existing is fatal
repotype (string): Repotype to create
Returns: (string or None): Directory created | Creates a single specific git repository on disk or repoSpanner | [
"Creates",
"a",
"single",
"specific",
"git",
"repository",
"on",
"disk",
"or",
"repoSpanner"
] | def _create_project_repo(project, region, templ, ignore_existing, repotype):
"""Creates a single specific git repository on disk or repoSpanner
Args:
project (Project): Project to create repos for
region (string or None): repoSpanner region to create the repos in
templ (string): Template directory, only valid for non-repoSpanner
ignore_existing (bool): Whether a repo already existing is fatal
repotype (string): Repotype to create
Returns: (string or None): Directory created
"""
if region:
# repoSpanner creation
regioninfo = pagure_config["REPOSPANNER_REGIONS"][region]
# First create the repository on the repoSpanner region
_log.debug("Creating repotype %s", repotype)
data = {
"Reponame": project._repospanner_repo_name(repotype, region),
"Public": False,
}
resp = requests.post(
"%s/admin/createrepo" % regioninfo["url"],
json=data,
verify=regioninfo["ca"],
cert=(
regioninfo["admin_cert"]["cert"],
regioninfo["admin_cert"]["key"],
),
)
resp.raise_for_status()
resp = resp.json()
_log.debug("Response json: %s", resp)
if not resp["Success"]:
if "already exists" in resp["Error"]:
if ignore_existing:
return None
else:
raise pagure.exceptions.RepoExistsException(resp["Error"])
raise Exception(
"Error in repoSpanner API call: %s" % resp["Error"]
)
return None
else:
# local repo
repodir = project.repopath(repotype)
if repodir is None:
# This repo type is disabled
return None
if os.path.exists(repodir):
if not ignore_existing:
raise pagure.exceptions.RepoExistsException(
"The %s repo %s already exists" % (repotype, project.path)
)
else:
return None
if repotype == "main":
pygit2.init_repository(repodir, bare=True, template_path=templ)
if not project.private:
# Make the repo exportable via apache
http_clone_file = os.path.join(repodir, "git-daemon-export-ok")
if not os.path.exists(http_clone_file):
with open(http_clone_file, "w"):
pass
else:
pygit2.init_repository(
repodir,
bare=True,
mode=pygit2.C.GIT_REPOSITORY_INIT_SHARED_GROUP,
)
return repodir | [
"def",
"_create_project_repo",
"(",
"project",
",",
"region",
",",
"templ",
",",
"ignore_existing",
",",
"repotype",
")",
":",
"if",
"region",
":",
"# repoSpanner creation",
"regioninfo",
"=",
"pagure_config",
"[",
"\"REPOSPANNER_REGIONS\"",
"]",
"[",
"region",
"]... | https://github.com/Pagure/pagure/blob/512f23f5cd1f965276969747792edeb1215cba68/pagure/lib/git.py#L2819-L2893 | ||
naftaliharris/tauthon | 5587ceec329b75f7caf6d65a036db61ac1bae214 | Lib/copy_reg.py | python | _slotnames | (cls) | return names | Return a list of slot names for a given class.
This needs to find slots defined by the class and its bases, so we
can't simply return the __slots__ attribute. We must walk down
the Method Resolution Order and concatenate the __slots__ of each
class found there. (This assumes classes don't modify their
__slots__ attribute to misrepresent their slots after the class is
defined.) | Return a list of slot names for a given class. | [
"Return",
"a",
"list",
"of",
"slot",
"names",
"for",
"a",
"given",
"class",
"."
] | def _slotnames(cls):
"""Return a list of slot names for a given class.
This needs to find slots defined by the class and its bases, so we
can't simply return the __slots__ attribute. We must walk down
the Method Resolution Order and concatenate the __slots__ of each
class found there. (This assumes classes don't modify their
__slots__ attribute to misrepresent their slots after the class is
defined.)
"""
# Get the value from a cache in the class if possible
names = cls.__dict__.get("__slotnames__")
if names is not None:
return names
# Not cached -- calculate the value
names = []
if not hasattr(cls, "__slots__"):
# This class has no slots
pass
else:
# Slots found -- gather slot names from all base classes
for c in cls.__mro__:
if "__slots__" in c.__dict__:
slots = c.__dict__['__slots__']
# if class has a single slot, it can be given as a string
if isinstance(slots, basestring):
slots = (slots,)
for name in slots:
# special descriptors
if name in ("__dict__", "__weakref__"):
continue
# mangled names
elif name.startswith('__') and not name.endswith('__'):
stripped = c.__name__.lstrip('_')
if stripped:
names.append('_%s%s' % (stripped, name))
else:
names.append(name)
else:
names.append(name)
# Cache the outcome in the class if at all possible
try:
cls.__slotnames__ = names
except:
pass # But don't die if we can't
return names | [
"def",
"_slotnames",
"(",
"cls",
")",
":",
"# Get the value from a cache in the class if possible",
"names",
"=",
"cls",
".",
"__dict__",
".",
"get",
"(",
"\"__slotnames__\"",
")",
"if",
"names",
"is",
"not",
"None",
":",
"return",
"names",
"# Not cached -- calculat... | https://github.com/naftaliharris/tauthon/blob/5587ceec329b75f7caf6d65a036db61ac1bae214/Lib/copy_reg.py#L95-L144 | |
braincorp/PVM | 3de2683634f372d2ac5aaa8b19e8ff23420d94d1 | PVM_models/demo04_run.py | python | Manager.running | (self) | return self._running | While returning True the simulation will keep going. | While returning True the simulation will keep going. | [
"While",
"returning",
"True",
"the",
"simulation",
"will",
"keep",
"going",
"."
] | def running(self):
"""
While returning True the simulation will keep going.
"""
return self._running | [
"def",
"running",
"(",
"self",
")",
":",
"return",
"self",
".",
"_running"
] | https://github.com/braincorp/PVM/blob/3de2683634f372d2ac5aaa8b19e8ff23420d94d1/PVM_models/demo04_run.py#L104-L108 | |
nameko/nameko | 17ecee2bcfa90cb0f3a2f3328c5004f48e4e02a3 | nameko/messaging.py | python | QueueConsumer.start | (self) | [] | def start(self):
if not self._starting:
self._starting = True
_log.debug('starting %s', self)
self._gt = self.container.spawn_managed_thread(self.run)
self._gt.link(self._handle_thread_exited)
try:
_log.debug('waiting for consumer ready %s', self)
self._consumers_ready.wait()
except QueueConsumerStopped:
_log.debug('consumer was stopped before it started %s', self)
except Exception as exc:
_log.debug('consumer failed to start %s (%s)', self, exc)
else:
_log.debug('started %s', self) | [
"def",
"start",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_starting",
":",
"self",
".",
"_starting",
"=",
"True",
"_log",
".",
"debug",
"(",
"'starting %s'",
",",
"self",
")",
"self",
".",
"_gt",
"=",
"self",
".",
"container",
".",
"spawn_man... | https://github.com/nameko/nameko/blob/17ecee2bcfa90cb0f3a2f3328c5004f48e4e02a3/nameko/messaging.py#L224-L239 | ||||
TheHive-Project/Cortex-Analyzers | 2a16d0ed86af13c318d488f5ad994ef43940e6ba | analyzers/MISP/mispclient.py | python | MISPClient.__mispdomaintypes | () | return ['domain', 'hostname', 'domain|ip', 'email-src', 'email-dst', 'url', 'link', 'named pipe',
'target-email', 'uri', 'whois-registrant-email', 'dns-soa-email', 'hostname|port', 'jabber-id'] | Just for better readability, all __misp*type methods return just a list of misp data types
:returns: data types containing domains
:rtype: list | Just for better readability, all __misp*type methods return just a list of misp data types | [
"Just",
"for",
"better",
"readability",
"all",
"__misp",
"*",
"type",
"methods",
"return",
"just",
"a",
"list",
"of",
"misp",
"data",
"types"
] | def __mispdomaintypes():
"""Just for better readability, all __misp*type methods return just a list of misp data types
:returns: data types containing domains
:rtype: list
"""
return ['domain', 'hostname', 'domain|ip', 'email-src', 'email-dst', 'url', 'link', 'named pipe',
'target-email', 'uri', 'whois-registrant-email', 'dns-soa-email', 'hostname|port', 'jabber-id'] | [
"def",
"__mispdomaintypes",
"(",
")",
":",
"return",
"[",
"'domain'",
",",
"'hostname'",
",",
"'domain|ip'",
",",
"'email-src'",
",",
"'email-dst'",
",",
"'url'",
",",
"'link'",
",",
"'named pipe'",
",",
"'target-email'",
",",
"'uri'",
",",
"'whois-registrant-em... | https://github.com/TheHive-Project/Cortex-Analyzers/blob/2a16d0ed86af13c318d488f5ad994ef43940e6ba/analyzers/MISP/mispclient.py#L101-L108 | |
aneisch/home-assistant-config | 86e381fde9609cb8871c439c433c12989e4e225d | custom_components/localtuya/pytuya/__init__.py | python | ContextualLogger.error | (self, msg, *args) | return self._logger.log(logging.ERROR, msg, *args) | Error level log. | Error level log. | [
"Error",
"level",
"log",
"."
] | def error(self, msg, *args):
"""Error level log."""
return self._logger.log(logging.ERROR, msg, *args) | [
"def",
"error",
"(",
"self",
",",
"msg",
",",
"*",
"args",
")",
":",
"return",
"self",
".",
"_logger",
".",
"log",
"(",
"logging",
".",
"ERROR",
",",
"msg",
",",
"*",
"args",
")"
] | https://github.com/aneisch/home-assistant-config/blob/86e381fde9609cb8871c439c433c12989e4e225d/custom_components/localtuya/pytuya/__init__.py#L141-L143 | |
microsoft/debugpy | be8dd607f6837244e0b565345e497aff7a0c08bf | src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/thread.py | python | _ThreadContainer.__add_created_thread | (self, event) | Private method to automatically add new thread objects from debug events.
@type event: L{Event}
@param event: Event object. | Private method to automatically add new thread objects from debug events. | [
"Private",
"method",
"to",
"automatically",
"add",
"new",
"thread",
"objects",
"from",
"debug",
"events",
"."
] | def __add_created_thread(self, event):
"""
Private method to automatically add new thread objects from debug events.
@type event: L{Event}
@param event: Event object.
"""
dwThreadId = event.get_tid()
hThread = event.get_thread_handle()
## if not self.has_thread(dwThreadId): # XXX this would trigger a scan
if not self._has_thread_id(dwThreadId):
aThread = Thread(dwThreadId, hThread, self)
teb_ptr = event.get_teb() # remember the TEB pointer
if teb_ptr:
aThread._teb_ptr = teb_ptr
self._add_thread(aThread) | [
"def",
"__add_created_thread",
"(",
"self",
",",
"event",
")",
":",
"dwThreadId",
"=",
"event",
".",
"get_tid",
"(",
")",
"hThread",
"=",
"event",
".",
"get_thread_handle",
"(",
")",
"## if not self.has_thread(dwThreadId): # XXX this would trigger a scan",
"if"... | https://github.com/microsoft/debugpy/blob/be8dd607f6837244e0b565345e497aff7a0c08bf/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/thread.py#L2057-L2072 | ||
hyperledger/sawtooth-core | 704cd5837c21f53642c06ffc97ba7978a77940b0 | validator/sawtooth_validator/state/identity_view.py | python | IdentityView.get_policies | (self) | return sorted(policies, key=lambda p: p.name) | Returns all the Policies under the Identity namespace.
Returns:
(list): A list containing all the Policies under the Identity
namespace. | Returns all the Policies under the Identity namespace. | [
"Returns",
"all",
"the",
"Policies",
"under",
"the",
"Identity",
"namespace",
"."
] | def get_policies(self):
"""Returns all the Policies under the Identity namespace.
Returns:
(list): A list containing all the Policies under the Identity
namespace.
"""
prefix = _IDENTITY_NS + _POLICY_NS
policylist_list = [
_create_from_bytes(d, identity_pb2.PolicyList)
for _, d in self._state_view.leaves(prefix=prefix)
]
policies = []
for policy_list in policylist_list:
for policy in policy_list.policies:
policies.append(policy)
return sorted(policies, key=lambda p: p.name) | [
"def",
"get_policies",
"(",
"self",
")",
":",
"prefix",
"=",
"_IDENTITY_NS",
"+",
"_POLICY_NS",
"policylist_list",
"=",
"[",
"_create_from_bytes",
"(",
"d",
",",
"identity_pb2",
".",
"PolicyList",
")",
"for",
"_",
",",
"d",
"in",
"self",
".",
"_state_view",
... | https://github.com/hyperledger/sawtooth-core/blob/704cd5837c21f53642c06ffc97ba7978a77940b0/validator/sawtooth_validator/state/identity_view.py#L156-L173 | |
jthsieh/DDPAE-video-prediction | 219e68301d24615410260c3d33c80ae74f6f2dc3 | utils/metrics.py | python | VelocityMetrics.update | (self, gt, pose, n_frames_input) | [] | def update(self, gt, pose, n_frames_input):
pred = utils.calculate_positions(pose.view(-1, pose.size(-1))).view_as(gt)
pred = utils.to_numpy(pred)
gt = utils.to_numpy(gt)
self.pred_positions.append(pred)
self.gt_positions.append(gt)
self.calculate_metrics(pred, gt, n_frames_input) | [
"def",
"update",
"(",
"self",
",",
"gt",
",",
"pose",
",",
"n_frames_input",
")",
":",
"pred",
"=",
"utils",
".",
"calculate_positions",
"(",
"pose",
".",
"view",
"(",
"-",
"1",
",",
"pose",
".",
"size",
"(",
"-",
"1",
")",
")",
")",
".",
"view_a... | https://github.com/jthsieh/DDPAE-video-prediction/blob/219e68301d24615410260c3d33c80ae74f6f2dc3/utils/metrics.py#L64-L70 | ||||
O365/python-o365 | 7f77005c3cee8177d0141e79b8eda8a7b60c5124 | O365/excel.py | python | WorkBook.get_worksheet | (self, id_or_name) | return self.worksheet_constructor(parent=self, **{self._cloud_data_key: response.json()}) | Gets a specific worksheet by id or name | Gets a specific worksheet by id or name | [
"Gets",
"a",
"specific",
"worksheet",
"by",
"id",
"or",
"name"
] | def get_worksheet(self, id_or_name):
""" Gets a specific worksheet by id or name """
url = self.build_url(self._endpoints.get('get_worksheet').format(id=quote(id_or_name)))
response = self.session.get(url)
if not response:
return None
return self.worksheet_constructor(parent=self, **{self._cloud_data_key: response.json()}) | [
"def",
"get_worksheet",
"(",
"self",
",",
"id_or_name",
")",
":",
"url",
"=",
"self",
".",
"build_url",
"(",
"self",
".",
"_endpoints",
".",
"get",
"(",
"'get_worksheet'",
")",
".",
"format",
"(",
"id",
"=",
"quote",
"(",
"id_or_name",
")",
")",
")",
... | https://github.com/O365/python-o365/blob/7f77005c3cee8177d0141e79b8eda8a7b60c5124/O365/excel.py#L1835-L1841 | |
ethereum/research | f64776763a8687cbe220421e292e6e45db3d9172 | verkle_trie_pedersen/verkle_trie.py | python | check_verkle_proof | (trie, keys, values, proof, display_times=True) | return check_ipa_multiproof(Cs, indices, ys, [D_serialized, ipa_proof], display_times) | Checks Verkle tree proof according to
https://notes.ethereum.org/nrQqhVpQRi6acQckwm1Ryg?both | Checks Verkle tree proof according to
https://notes.ethereum.org/nrQqhVpQRi6acQckwm1Ryg?both | [
"Checks",
"Verkle",
"tree",
"proof",
"according",
"to",
"https",
":",
"//",
"notes",
".",
"ethereum",
".",
"org",
"/",
"nrQqhVpQRi6acQckwm1Ryg?both"
] | def check_verkle_proof(trie, keys, values, proof, display_times=True):
"""
Checks Verkle tree proof according to
https://notes.ethereum.org/nrQqhVpQRi6acQckwm1Ryg?both
"""
start_logging_time_if_eligible(" Starting proof check", display_times)
# Unpack the proof
depths, commitments_sorted_by_index_serialized, D_serialized, ipa_proof = proof
commitments_sorted_by_index = [Point().deserialize(trie)] + [Point().deserialize(x) for x in commitments_sorted_by_index_serialized]
all_indices = set()
all_indices_and_subindices = set()
leaf_values_by_index_and_subindex = {}
# Find all required indices
for key, value, depth in zip(keys, values, depths):
verkle_indices = get_verkle_indices(key)
for i in range(depth):
all_indices.add(verkle_indices[:i])
all_indices_and_subindices.add((verkle_indices[:i], verkle_indices[i]))
commitment = ipa_utils.pedersen_commit_sparse({0: 1,
1: int.from_bytes(key[:31], "little"),
2: int.from_bytes(value[:16], "little"),
3: int.from_bytes(value[16:], "little")})
leaf_values_by_index_and_subindex[(verkle_indices[:depth - 1], verkle_indices[depth - 1])] = \
int.from_bytes(commitment.serialize(), "little") % MODULUS
all_indices = sorted(all_indices)
all_indices_and_subindices = sorted(all_indices_and_subindices)
log_time_if_eligible(" Computed indices", 30, display_times)
# Step 0: recreate the commitment list sorted by indices
commitments_by_index = {index: commitment for index, commitment in zip(all_indices, commitments_sorted_by_index)}
commitments_by_index_and_subindex = {index_and_subindex: commitments_by_index[index_and_subindex[0]]
for index_and_subindex in all_indices_and_subindices}
subhashes_by_index_and_subindex = {}
for index_and_subindex in all_indices_and_subindices:
full_subindex = index_and_subindex[0] + (index_and_subindex[1],)
if full_subindex in commitments_by_index:
subhashes_by_index_and_subindex[index_and_subindex] = int.from_bytes(commitments_by_index[full_subindex].serialize(), "little") % MODULUS
else:
subhashes_by_index_and_subindex[index_and_subindex] = leaf_values_by_index_and_subindex[index_and_subindex]
Cs = list(map(lambda x: x[1], sorted(commitments_by_index_and_subindex.items())))
indices = list(map(lambda x: x[1], sorted(all_indices_and_subindices)))
ys = list(map(lambda x: x[1], sorted(subhashes_by_index_and_subindex.items())))
log_time_if_eligible(" Recreated commitment lists", 30, display_times)
return check_ipa_multiproof(Cs, indices, ys, [D_serialized, ipa_proof], display_times) | [
"def",
"check_verkle_proof",
"(",
"trie",
",",
"keys",
",",
"values",
",",
"proof",
",",
"display_times",
"=",
"True",
")",
":",
"start_logging_time_if_eligible",
"(",
"\" Starting proof check\"",
",",
"display_times",
")",
"# Unpack the proof",
"depths",
",",
"co... | https://github.com/ethereum/research/blob/f64776763a8687cbe220421e292e6e45db3d9172/verkle_trie_pedersen/verkle_trie.py#L504-L560 | |
cyberark/KubiScan | cb2afebde8080ad6de458f9e013003d9da10278e | api/api_client_temp.py | python | ApiClientTemp.__deserialize_file | (self, response) | return path | Saves response body into a file in a temporary folder,
using the filename from the `Content-Disposition` header if provided.
:param response: RESTResponse.
:return: file path. | Saves response body into a file in a temporary folder,
using the filename from the `Content-Disposition` header if provided. | [
"Saves",
"response",
"body",
"into",
"a",
"file",
"in",
"a",
"temporary",
"folder",
"using",
"the",
"filename",
"from",
"the",
"Content",
"-",
"Disposition",
"header",
"if",
"provided",
"."
] | def __deserialize_file(self, response):
"""
Saves response body into a file in a temporary folder,
using the filename from the `Content-Disposition` header if provided.
:param response: RESTResponse.
:return: file path.
"""
fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path)
os.close(fd)
os.remove(path)
content_disposition = response.getheader("Content-Disposition")
if content_disposition:
filename = re. \
search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', content_disposition). \
group(1)
path = os.path.join(os.path.dirname(path), filename)
with open(path, "w") as f:
f.write(response.data)
return path | [
"def",
"__deserialize_file",
"(",
"self",
",",
"response",
")",
":",
"fd",
",",
"path",
"=",
"tempfile",
".",
"mkstemp",
"(",
"dir",
"=",
"self",
".",
"configuration",
".",
"temp_folder_path",
")",
"os",
".",
"close",
"(",
"fd",
")",
"os",
".",
"remove... | https://github.com/cyberark/KubiScan/blob/cb2afebde8080ad6de458f9e013003d9da10278e/api/api_client_temp.py#L517-L539 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/fibaro/light.py | python | FibaroLight.async_update | (self) | Update the state. | Update the state. | [
"Update",
"the",
"state",
"."
] | async def async_update(self):
"""Update the state."""
async with self._update_lock:
await self.hass.async_add_executor_job(self._update) | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"async",
"with",
"self",
".",
"_update_lock",
":",
"await",
"self",
".",
"hass",
".",
"async_add_executor_job",
"(",
"self",
".",
"_update",
")"
] | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/fibaro/light.py#L201-L204 | ||
mdiazcl/fuzzbunch-debian | 2b76c2249ade83a389ae3badb12a1bd09901fd2c | windows/Resources/Python/Core/Lib/lib2to3/fixes/fix_metaclass.py | python | fixup_parse_tree | (cls_node) | one-line classes don't get a suite in the parse tree so we add
one to normalize the tree | one-line classes don't get a suite in the parse tree so we add
one to normalize the tree | [
"one",
"-",
"line",
"classes",
"don",
"t",
"get",
"a",
"suite",
"in",
"the",
"parse",
"tree",
"so",
"we",
"add",
"one",
"to",
"normalize",
"the",
"tree"
] | def fixup_parse_tree(cls_node):
""" one-line classes don't get a suite in the parse tree so we add
one to normalize the tree
"""
for node in cls_node.children:
if node.type == syms.suite:
return
for i, node in enumerate(cls_node.children):
if node.type == token.COLON:
break
else:
raise ValueError("No class suite and no ':'!")
suite = Node(syms.suite, [])
while cls_node.children[i + 1:]:
move_node = cls_node.children[i + 1]
suite.append_child(move_node.clone())
move_node.remove()
cls_node.append_child(suite)
node = suite | [
"def",
"fixup_parse_tree",
"(",
"cls_node",
")",
":",
"for",
"node",
"in",
"cls_node",
".",
"children",
":",
"if",
"node",
".",
"type",
"==",
"syms",
".",
"suite",
":",
"return",
"for",
"i",
",",
"node",
"in",
"enumerate",
"(",
"cls_node",
".",
"childr... | https://github.com/mdiazcl/fuzzbunch-debian/blob/2b76c2249ade83a389ae3badb12a1bd09901fd2c/windows/Resources/Python/Core/Lib/lib2to3/fixes/fix_metaclass.py#L46-L67 | ||
lordmauve/pgzero | 46a889fb918ccd606d39ba63680386d7f8fcbc5a | pgzero/screen.py | python | SurfacePainter.filled_rect | (self, rect, color) | Draw a filled rectangle. | Draw a filled rectangle. | [
"Draw",
"a",
"filled",
"rectangle",
"."
] | def filled_rect(self, rect, color):
"""Draw a filled rectangle."""
if not isinstance(rect, RECT_CLASSES):
raise TypeError("screen.draw.filled_rect() requires a rect to draw")
pygame.draw.rect(self._surf, make_color(color), rect, 0) | [
"def",
"filled_rect",
"(",
"self",
",",
"rect",
",",
"color",
")",
":",
"if",
"not",
"isinstance",
"(",
"rect",
",",
"RECT_CLASSES",
")",
":",
"raise",
"TypeError",
"(",
"\"screen.draw.filled_rect() requires a rect to draw\"",
")",
"pygame",
".",
"draw",
".",
... | https://github.com/lordmauve/pgzero/blob/46a889fb918ccd606d39ba63680386d7f8fcbc5a/pgzero/screen.py#L99-L103 | ||
colour-science/colour | 38782ac059e8ddd91939f3432bf06811c16667f0 | colour/contrast/__init__.py | python | contrast_sensitivity_function | (method='Barten 1999', **kwargs) | return S | Returns the contrast sensitivity :math:`S` of the human eye according to
the contrast sensitivity function (CSF) described by given method.
Parameters
----------
method : str, optional
**{'Barten 1999'}**,
Computation method.
Other Parameters
----------------
E : numeric or array_like, optional
{:func:`colour.contrast.contrast_sensitivity_function_Barten1999`},
Retinal illuminance :math:`E` in Trolands.
N_max : numeric or array_like, optional
{:func:`colour.contrast.contrast_sensitivity_function_Barten1999`},
Maximum number of cycles :math:`N_{max}` over which the eye can
integrate the information.
T : numeric or array_like, optional
{:func:`colour.contrast.contrast_sensitivity_function_Barten1999`},
Integration time :math:`T` in seconds of the eye.
X_0 : numeric or array_like, optional
{:func:`colour.contrast.contrast_sensitivity_function_Barten1999`},
Angular size :math:`X_0` in degrees of the object in the x direction.
Y_0 : numeric or array_like, optional
{:func:`colour.contrast.contrast_sensitivity_function_Barten1999`},
Angular size :math:`Y_0` in degrees of the object in the y direction.
X_max : numeric or array_like, optional
{:func:`colour.contrast.contrast_sensitivity_function_Barten1999`},
Maximum angular size :math:`X_{max}` in degrees of the integration
area in the x direction.
Y_max : numeric or array_like, optional
{:func:`colour.contrast.contrast_sensitivity_function_Barten1999`},
Maximum angular size :math:`Y_{max}` in degrees of the integration
area in the y direction.
k : numeric or array_like, optional
{:func:`colour.contrast.contrast_sensitivity_function_Barten1999`},
Signal-to-noise (SNR) ratio :math:`k`.
n : numeric or array_like, optional
{:func:`colour.contrast.contrast_sensitivity_function_Barten1999`},
Quantum efficiency of the eye :math:`n`.
p : numeric or array_like, optional
{:func:`colour.contrast.contrast_sensitivity_function_Barten1999`},
Photon conversion factor :math:`p` in
:math:`photons\\div seconds\\div degrees^2\\div Trolands` that
depends on the light source.
phi_0 : numeric or array_like, optional
{:func:`colour.contrast.contrast_sensitivity_function_Barten1999`},
Spectral density :math:`\\phi_0` in :math:`seconds degrees^2` of the
neural noise.
sigma : numeric or array_like, optional
{:func:`colour.contrast.contrast_sensitivity_function_Barten1999`},
Standard deviation :math:`\\sigma` of the line-spread function
resulting from the convolution of the different elements of the
convolution process.
u : numeric
{:func:`colour.contrast.contrast_sensitivity_function_Barten1999`},
Spatial frequency :math:`u`, the cycles per degree.
u_0 : numeric or array_like, optional
{:func:`colour.contrast.contrast_sensitivity_function_Barten1999`},
Spatial frequency :math:`u_0` in :math:`cycles\\div degrees` above
which the lateral inhibition ceases.
Returns
-------
ndarray
Contrast sensitivity :math:`S`.
References
----------
:cite:`Barten1999`, :cite:`Barten2003`, :cite:`Cowan2004`,
:cite:`InternationalTelecommunicationUnion2015`,
Examples
--------
>>> contrast_sensitivity_function(u=4) # doctest: +ELLIPSIS
360.8691122...
>>> contrast_sensitivity_function('Barten 1999', u=4) # doctest: +ELLIPSIS
360.8691122... | Returns the contrast sensitivity :math:`S` of the human eye according to
the contrast sensitivity function (CSF) described by given method. | [
"Returns",
"the",
"contrast",
"sensitivity",
":",
"math",
":",
"S",
"of",
"the",
"human",
"eye",
"according",
"to",
"the",
"contrast",
"sensitivity",
"function",
"(",
"CSF",
")",
"described",
"by",
"given",
"method",
"."
] | def contrast_sensitivity_function(method='Barten 1999', **kwargs):
"""
Returns the contrast sensitivity :math:`S` of the human eye according to
the contrast sensitivity function (CSF) described by given method.
Parameters
----------
method : str, optional
**{'Barten 1999'}**,
Computation method.
Other Parameters
----------------
E : numeric or array_like, optional
{:func:`colour.contrast.contrast_sensitivity_function_Barten1999`},
Retinal illuminance :math:`E` in Trolands.
N_max : numeric or array_like, optional
{:func:`colour.contrast.contrast_sensitivity_function_Barten1999`},
Maximum number of cycles :math:`N_{max}` over which the eye can
integrate the information.
T : numeric or array_like, optional
{:func:`colour.contrast.contrast_sensitivity_function_Barten1999`},
Integration time :math:`T` in seconds of the eye.
X_0 : numeric or array_like, optional
{:func:`colour.contrast.contrast_sensitivity_function_Barten1999`},
Angular size :math:`X_0` in degrees of the object in the x direction.
Y_0 : numeric or array_like, optional
{:func:`colour.contrast.contrast_sensitivity_function_Barten1999`},
Angular size :math:`Y_0` in degrees of the object in the y direction.
X_max : numeric or array_like, optional
{:func:`colour.contrast.contrast_sensitivity_function_Barten1999`},
Maximum angular size :math:`X_{max}` in degrees of the integration
area in the x direction.
Y_max : numeric or array_like, optional
{:func:`colour.contrast.contrast_sensitivity_function_Barten1999`},
Maximum angular size :math:`Y_{max}` in degrees of the integration
area in the y direction.
k : numeric or array_like, optional
{:func:`colour.contrast.contrast_sensitivity_function_Barten1999`},
Signal-to-noise (SNR) ratio :math:`k`.
n : numeric or array_like, optional
{:func:`colour.contrast.contrast_sensitivity_function_Barten1999`},
Quantum efficiency of the eye :math:`n`.
p : numeric or array_like, optional
{:func:`colour.contrast.contrast_sensitivity_function_Barten1999`},
Photon conversion factor :math:`p` in
:math:`photons\\div seconds\\div degrees^2\\div Trolands` that
depends on the light source.
phi_0 : numeric or array_like, optional
{:func:`colour.contrast.contrast_sensitivity_function_Barten1999`},
Spectral density :math:`\\phi_0` in :math:`seconds degrees^2` of the
neural noise.
sigma : numeric or array_like, optional
{:func:`colour.contrast.contrast_sensitivity_function_Barten1999`},
Standard deviation :math:`\\sigma` of the line-spread function
resulting from the convolution of the different elements of the
convolution process.
u : numeric
{:func:`colour.contrast.contrast_sensitivity_function_Barten1999`},
Spatial frequency :math:`u`, the cycles per degree.
u_0 : numeric or array_like, optional
{:func:`colour.contrast.contrast_sensitivity_function_Barten1999`},
Spatial frequency :math:`u_0` in :math:`cycles\\div degrees` above
which the lateral inhibition ceases.
Returns
-------
ndarray
Contrast sensitivity :math:`S`.
References
----------
:cite:`Barten1999`, :cite:`Barten2003`, :cite:`Cowan2004`,
:cite:`InternationalTelecommunicationUnion2015`,
Examples
--------
>>> contrast_sensitivity_function(u=4) # doctest: +ELLIPSIS
360.8691122...
>>> contrast_sensitivity_function('Barten 1999', u=4) # doctest: +ELLIPSIS
360.8691122...
"""
method = validate_method(method, CONTRAST_SENSITIVITY_METHODS)
function = CONTRAST_SENSITIVITY_METHODS[method]
S = function(**filter_kwargs(function, **kwargs))
return S | [
"def",
"contrast_sensitivity_function",
"(",
"method",
"=",
"'Barten 1999'",
",",
"*",
"*",
"kwargs",
")",
":",
"method",
"=",
"validate_method",
"(",
"method",
",",
"CONTRAST_SENSITIVITY_METHODS",
")",
"function",
"=",
"CONTRAST_SENSITIVITY_METHODS",
"[",
"method",
... | https://github.com/colour-science/colour/blob/38782ac059e8ddd91939f3432bf06811c16667f0/colour/contrast/__init__.py#L60-L149 | |
urwid/urwid | e2423b5069f51d318ea1ac0f355a0efe5448f7eb | urwid/main_loop.py | python | SelectEventLoop.enter_idle | (self, callback) | return self._idle_handle | Add a callback for entering idle.
Returns a handle that may be passed to remove_idle() | Add a callback for entering idle. | [
"Add",
"a",
"callback",
"for",
"entering",
"idle",
"."
] | def enter_idle(self, callback):
"""
Add a callback for entering idle.
Returns a handle that may be passed to remove_idle()
"""
self._idle_handle += 1
self._idle_callbacks[self._idle_handle] = callback
return self._idle_handle | [
"def",
"enter_idle",
"(",
"self",
",",
"callback",
")",
":",
"self",
".",
"_idle_handle",
"+=",
"1",
"self",
".",
"_idle_callbacks",
"[",
"self",
".",
"_idle_handle",
"]",
"=",
"callback",
"return",
"self",
".",
"_idle_handle"
] | https://github.com/urwid/urwid/blob/e2423b5069f51d318ea1ac0f355a0efe5448f7eb/urwid/main_loop.py#L752-L760 | |
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Lib/_pyio.py | python | TextIOBase.encoding | (self) | return None | Subclasses should override. | Subclasses should override. | [
"Subclasses",
"should",
"override",
"."
] | def encoding(self):
"""Subclasses should override."""
return None | [
"def",
"encoding",
"(",
"self",
")",
":",
"return",
"None"
] | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/_pyio.py#L1347-L1349 | |
cuthbertLab/music21 | bd30d4663e52955ed922c10fdf541419d8c67671 | music21/humdrum/questions.py | python | Test.xtest009 | (self) | Are lower pitches likely to be shorter and higher pitches likely to be longer? | Are lower pitches likely to be shorter and higher pitches likely to be longer? | [
"Are",
"lower",
"pitches",
"likely",
"to",
"be",
"shorter",
"and",
"higher",
"pitches",
"likely",
"to",
"be",
"longer?"
] | def xtest009(self):
'''Are lower pitches likely to be shorter and higher pitches likely to be longer?'''
partStream = music21.converter.parse('dichterliebe1.xml')
unused_noteStream = partStream['notes'] | [
"def",
"xtest009",
"(",
"self",
")",
":",
"partStream",
"=",
"music21",
".",
"converter",
".",
"parse",
"(",
"'dichterliebe1.xml'",
")",
"unused_noteStream",
"=",
"partStream",
"[",
"'notes'",
"]"
] | https://github.com/cuthbertLab/music21/blob/bd30d4663e52955ed922c10fdf541419d8c67671/music21/humdrum/questions.py#L217-L221 | ||
juefeix/pnn.pytorch.update | b9513ff372e89f3c26278e7796a38965592d3428 | models.py | python | PerturbBasicBlock.forward | (self, x) | return y | [] | def forward(self, x):
residual = x
y = self.layers(x)
if self.shortcut:
residual = self.shortcut(x)
y += residual
y = F.relu(y)
return y | [
"def",
"forward",
"(",
"self",
",",
"x",
")",
":",
"residual",
"=",
"x",
"y",
"=",
"self",
".",
"layers",
"(",
"x",
")",
"if",
"self",
".",
"shortcut",
":",
"residual",
"=",
"self",
".",
"shortcut",
"(",
"x",
")",
"y",
"+=",
"residual",
"y",
"=... | https://github.com/juefeix/pnn.pytorch.update/blob/b9513ff372e89f3c26278e7796a38965592d3428/models.py#L221-L228 | |||
home-assistant/supervisor | 69c2517d5211b483fdfe968b0a2b36b672ee7ab2 | supervisor/discovery/__init__.py | python | Discovery.get | (self, uuid: str) | return self.message_obj.get(uuid) | Return discovery message. | Return discovery message. | [
"Return",
"discovery",
"message",
"."
] | def get(self, uuid: str) -> Message | None:
"""Return discovery message."""
return self.message_obj.get(uuid) | [
"def",
"get",
"(",
"self",
",",
"uuid",
":",
"str",
")",
"->",
"Message",
"|",
"None",
":",
"return",
"self",
".",
"message_obj",
".",
"get",
"(",
"uuid",
")"
] | https://github.com/home-assistant/supervisor/blob/69c2517d5211b483fdfe968b0a2b36b672ee7ab2/supervisor/discovery/__init__.py#L67-L69 | |
SickChill/SickChill | 01020f3636d01535f60b83464d8127ea0efabfc7 | sickchill/adba/aniDBresponses.py | python | NotifygetMessageResponse.__init__ | (self, cmd, restag, rescode, resstr, datalines) | attributes:
data:
nid - notify id
uid - from user id
uname - from username
date - date
type - type
title - title
body - body | attributes: | [
"attributes",
":"
] | def __init__(self, cmd, restag, rescode, resstr, datalines):
"""
attributes:
data:
nid - notify id
uid - from user id
uname - from username
date - date
type - type
title - title
body - body
"""
super().__init__(cmd, restag, rescode, resstr, datalines)
self.codestr = "NOTIFYGET_MESSAGE"
self.codehead = ()
self.codetail = ("nid", "uid", "uname", "date", "type", "title", "body")
self.coderep = () | [
"def",
"__init__",
"(",
"self",
",",
"cmd",
",",
"restag",
",",
"rescode",
",",
"resstr",
",",
"datalines",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"cmd",
",",
"restag",
",",
"rescode",
",",
"resstr",
",",
"datalines",
")",
"self",
".",
... | https://github.com/SickChill/SickChill/blob/01020f3636d01535f60b83464d8127ea0efabfc7/sickchill/adba/aniDBresponses.py#L1015-L1033 | ||
flow-project/flow | a511c41c48e6b928bb2060de8ad1ef3c3e3d9554 | flow/envs/traffic_light_grid.py | python | TrafficLightGridTestEnv._apply_rl_actions | (self, rl_actions) | See class definition. | See class definition. | [
"See",
"class",
"definition",
"."
] | def _apply_rl_actions(self, rl_actions):
"""See class definition."""
pass | [
"def",
"_apply_rl_actions",
"(",
"self",
",",
"rl_actions",
")",
":",
"pass"
] | https://github.com/flow-project/flow/blob/a511c41c48e6b928bb2060de8ad1ef3c3e3d9554/flow/envs/traffic_light_grid.py#L753-L755 | ||
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/benchmarks/src/benchmarks/sympy/sympy/solvers/bivariate.py | python | _linab | (arg, symbol) | return a, b, x | Return ``a, b, X`` assuming ``arg`` can be written as ``a*X + b``
where ``X`` is a symbol-dependent factor and ``a`` and ``b`` are
independent of ``symbol``.
Examples
========
>>> from sympy.functions.elementary.exponential import exp
>>> from sympy.solvers.bivariate import _linab
>>> from sympy.abc import x, y
>>> from sympy import S
>>> _linab(S(2), x)
(2, 0, 1)
>>> _linab(2*x, x)
(2, 0, x)
>>> _linab(y + y*x + 2*x, x)
(y + 2, y, x)
>>> _linab(3 + 2*exp(x), x)
(2, 3, exp(x)) | Return ``a, b, X`` assuming ``arg`` can be written as ``a*X + b``
where ``X`` is a symbol-dependent factor and ``a`` and ``b`` are
independent of ``symbol``. | [
"Return",
"a",
"b",
"X",
"assuming",
"arg",
"can",
"be",
"written",
"as",
"a",
"*",
"X",
"+",
"b",
"where",
"X",
"is",
"a",
"symbol",
"-",
"dependent",
"factor",
"and",
"a",
"and",
"b",
"are",
"independent",
"of",
"symbol",
"."
] | def _linab(arg, symbol):
"""Return ``a, b, X`` assuming ``arg`` can be written as ``a*X + b``
where ``X`` is a symbol-dependent factor and ``a`` and ``b`` are
independent of ``symbol``.
Examples
========
>>> from sympy.functions.elementary.exponential import exp
>>> from sympy.solvers.bivariate import _linab
>>> from sympy.abc import x, y
>>> from sympy import S
>>> _linab(S(2), x)
(2, 0, 1)
>>> _linab(2*x, x)
(2, 0, x)
>>> _linab(y + y*x + 2*x, x)
(y + 2, y, x)
>>> _linab(3 + 2*exp(x), x)
(2, 3, exp(x))
"""
arg = arg.expand()
ind, dep = arg.as_independent(symbol)
if not arg.is_Add:
b = 0
a, x = ind, dep
else:
b = ind
a, x = separatevars(dep).as_independent(symbol, as_Add=False)
if x.could_extract_minus_sign():
a = -a
x = -x
return a, b, x | [
"def",
"_linab",
"(",
"arg",
",",
"symbol",
")",
":",
"arg",
"=",
"arg",
".",
"expand",
"(",
")",
"ind",
",",
"dep",
"=",
"arg",
".",
"as_independent",
"(",
"symbol",
")",
"if",
"not",
"arg",
".",
"is_Add",
":",
"b",
"=",
"0",
"a",
",",
"x",
... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/solvers/bivariate.py#L77-L110 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/manifolds/differentiable/tensorfield.py | python | TensorField.divergence | (self, metric=None) | return resu | r"""
Return the divergence of ``self`` (with respect to a given
metric).
The divergence is taken on the *last* index: if
``self`` is a tensor field `t` of type `(k,0)` with `k\geq 1`, the
divergence of `t` with respect to the metric `g` is the tensor field
of type `(k-1,0)` defined by
.. MATH::
(\mathrm{div}\, t)^{a_1\ldots a_{k-1}} =
\nabla_i t^{a_1\ldots a_{k-1} i} =
(\nabla t)^{a_1\ldots a_{k-1} i}_{\phantom{a_1\ldots a_{k-1} i}\, i},
where `\nabla` is the Levi-Civita connection of `g` (cf.
:class:`~sage.manifolds.differentiable.levi_civita_connection.LeviCivitaConnection`).
This definition is extended to tensor fields of type `(k,l)` with
`k\geq 0` and `l\geq 1`, by raising the last index with the metric `g`:
`\mathrm{div}\, t` is then the tensor field of type `(k,l-1)` defined by
.. MATH::
(\mathrm{div}\, t)^{a_1\ldots a_k}_{\phantom{a_1\ldots a_k}\, b_1
\ldots b_{l-1}} = \nabla_i (g^{ij} t^{a_1\ldots a_k}_{\phantom{a_1
\ldots a_k}\, b_1\ldots b_{l-1} j})
= (\nabla t^\sharp)^{a_1\ldots a_k i}_{\phantom{a_1\ldots a_k i}\,
b_1\ldots b_{l-1} i},
where `t^\sharp` is the tensor field deduced from `t` by raising the
last index with the metric `g` (see :meth:`up`).
INPUT:
- ``metric`` -- (default: ``None``) the pseudo-Riemannian metric `g`
involved in the definition of the divergence; if none is provided,
the domain of ``self`` is supposed to be endowed with a default
metric (i.e. is supposed to be pseudo-Riemannian manifold, see
:class:`~sage.manifolds.differentiable.pseudo_riemannian.PseudoRiemannianManifold`)
and the latter is used to define the divergence.
OUTPUT:
- instance of either
:class:`~sage.manifolds.differentiable.scalarfield.DiffScalarField`
if `(k,l)=(1,0)` (``self`` is a vector field) or `(k,l)=(0,1)`
(``self`` is a 1-form) or of :class:`TensorField` if `k+l\geq 2`
representing the divergence of ``self`` with respect to ``metric``
EXAMPLES:
Divergence of a vector field in the Euclidean plane::
sage: M.<x,y> = EuclideanSpace()
sage: v = M.vector_field(x, y, name='v')
sage: s = v.divergence(); s
Scalar field div(v) on the Euclidean plane E^2
sage: s.display()
div(v): E^2 → ℝ
(x, y) ↦ 2
A shortcut alias of ``divergence`` is ``div``::
sage: v.div() == s
True
The function :func:`~sage.manifolds.operators.div` from the
:mod:`~sage.manifolds.operators` module can be used instead of the
method :meth:`divergence`::
sage: from sage.manifolds.operators import div
sage: div(v) == s
True
The divergence can be taken with respect to a metric tensor that is
not the default one::
sage: h = M.lorentzian_metric('h')
sage: h[1,1], h[2,2] = -1, 1/(1+x^2+y^2)
sage: s = v.div(h); s
Scalar field div_h(v) on the Euclidean plane E^2
sage: s.display()
div_h(v): E^2 → ℝ
(x, y) ↦ (x^2 + y^2 + 2)/(x^2 + y^2 + 1)
The standard formula
.. MATH::
\mathrm{div}_h \, v = \frac{1}{\sqrt{|\det h|}}
\frac{\partial}{\partial x^i} \left( \sqrt{|\det h|} \, v^i \right)
is checked as follows::
sage: sqrth = h.sqrt_abs_det().expr(); sqrth
1/sqrt(x^2 + y^2 + 1)
sage: s == 1/sqrth * sum( (sqrth*v[i]).diff(i) for i in M.irange())
True
A divergence-free vector::
sage: w = M.vector_field(-y, x, name='w')
sage: w.div().display()
div(w): E^2 → ℝ
(x, y) ↦ 0
sage: w.div(h).display()
div_h(w): E^2 → ℝ
(x, y) ↦ 0
Divergence of a type-``(2,0)`` tensor field::
sage: t = v*w; t
Tensor field v⊗w of type (2,0) on the Euclidean plane E^2
sage: s = t.div(); s
Vector field div(v⊗w) on the Euclidean plane E^2
sage: s.display()
div(v⊗w) = -y e_x + x e_y | r"""
Return the divergence of ``self`` (with respect to a given
metric). | [
"r",
"Return",
"the",
"divergence",
"of",
"self",
"(",
"with",
"respect",
"to",
"a",
"given",
"metric",
")",
"."
] | def divergence(self, metric=None):
r"""
Return the divergence of ``self`` (with respect to a given
metric).
The divergence is taken on the *last* index: if
``self`` is a tensor field `t` of type `(k,0)` with `k\geq 1`, the
divergence of `t` with respect to the metric `g` is the tensor field
of type `(k-1,0)` defined by
.. MATH::
(\mathrm{div}\, t)^{a_1\ldots a_{k-1}} =
\nabla_i t^{a_1\ldots a_{k-1} i} =
(\nabla t)^{a_1\ldots a_{k-1} i}_{\phantom{a_1\ldots a_{k-1} i}\, i},
where `\nabla` is the Levi-Civita connection of `g` (cf.
:class:`~sage.manifolds.differentiable.levi_civita_connection.LeviCivitaConnection`).
This definition is extended to tensor fields of type `(k,l)` with
`k\geq 0` and `l\geq 1`, by raising the last index with the metric `g`:
`\mathrm{div}\, t` is then the tensor field of type `(k,l-1)` defined by
.. MATH::
(\mathrm{div}\, t)^{a_1\ldots a_k}_{\phantom{a_1\ldots a_k}\, b_1
\ldots b_{l-1}} = \nabla_i (g^{ij} t^{a_1\ldots a_k}_{\phantom{a_1
\ldots a_k}\, b_1\ldots b_{l-1} j})
= (\nabla t^\sharp)^{a_1\ldots a_k i}_{\phantom{a_1\ldots a_k i}\,
b_1\ldots b_{l-1} i},
where `t^\sharp` is the tensor field deduced from `t` by raising the
last index with the metric `g` (see :meth:`up`).
INPUT:
- ``metric`` -- (default: ``None``) the pseudo-Riemannian metric `g`
involved in the definition of the divergence; if none is provided,
the domain of ``self`` is supposed to be endowed with a default
metric (i.e. is supposed to be pseudo-Riemannian manifold, see
:class:`~sage.manifolds.differentiable.pseudo_riemannian.PseudoRiemannianManifold`)
and the latter is used to define the divergence.
OUTPUT:
- instance of either
:class:`~sage.manifolds.differentiable.scalarfield.DiffScalarField`
if `(k,l)=(1,0)` (``self`` is a vector field) or `(k,l)=(0,1)`
(``self`` is a 1-form) or of :class:`TensorField` if `k+l\geq 2`
representing the divergence of ``self`` with respect to ``metric``
EXAMPLES:
Divergence of a vector field in the Euclidean plane::
sage: M.<x,y> = EuclideanSpace()
sage: v = M.vector_field(x, y, name='v')
sage: s = v.divergence(); s
Scalar field div(v) on the Euclidean plane E^2
sage: s.display()
div(v): E^2 → ℝ
(x, y) ↦ 2
A shortcut alias of ``divergence`` is ``div``::
sage: v.div() == s
True
The function :func:`~sage.manifolds.operators.div` from the
:mod:`~sage.manifolds.operators` module can be used instead of the
method :meth:`divergence`::
sage: from sage.manifolds.operators import div
sage: div(v) == s
True
The divergence can be taken with respect to a metric tensor that is
not the default one::
sage: h = M.lorentzian_metric('h')
sage: h[1,1], h[2,2] = -1, 1/(1+x^2+y^2)
sage: s = v.div(h); s
Scalar field div_h(v) on the Euclidean plane E^2
sage: s.display()
div_h(v): E^2 → ℝ
(x, y) ↦ (x^2 + y^2 + 2)/(x^2 + y^2 + 1)
The standard formula
.. MATH::
\mathrm{div}_h \, v = \frac{1}{\sqrt{|\det h|}}
\frac{\partial}{\partial x^i} \left( \sqrt{|\det h|} \, v^i \right)
is checked as follows::
sage: sqrth = h.sqrt_abs_det().expr(); sqrth
1/sqrt(x^2 + y^2 + 1)
sage: s == 1/sqrth * sum( (sqrth*v[i]).diff(i) for i in M.irange())
True
A divergence-free vector::
sage: w = M.vector_field(-y, x, name='w')
sage: w.div().display()
div(w): E^2 → ℝ
(x, y) ↦ 0
sage: w.div(h).display()
div_h(w): E^2 → ℝ
(x, y) ↦ 0
Divergence of a type-``(2,0)`` tensor field::
sage: t = v*w; t
Tensor field v⊗w of type (2,0) on the Euclidean plane E^2
sage: s = t.div(); s
Vector field div(v⊗w) on the Euclidean plane E^2
sage: s.display()
div(v⊗w) = -y e_x + x e_y
"""
n_con = self._tensor_type[0] # number of contravariant indices = k
n_cov = self._tensor_type[1] # number of covariant indices = l
default_metric = metric is None
if default_metric:
metric = self._domain.metric()
nabla = metric.connection()
if n_cov == 0:
resu = nabla(self).trace(n_con-1, n_con)
else:
tup = self.up(metric, self._tensor_rank-1)
resu = nabla(tup).trace(n_con, self._tensor_rank)
if self._name is not None:
if default_metric:
resu._name = "div({})".format(self._name)
resu._latex_name = r"\mathrm{div}\left(" + self._latex_name + \
r"\right)"
else:
resu._name = "div_{}({})".format(metric._name, self._name)
resu._latex_name = r"\mathrm{div}_{" + metric._latex_name + \
r"}\left(" + self._latex_name + r"\right)"
# The name is propagated to possible restrictions of self:
for restrict in resu._restrictions.values():
restrict.set_name(resu._name, latex_name=resu._latex_name)
return resu | [
"def",
"divergence",
"(",
"self",
",",
"metric",
"=",
"None",
")",
":",
"n_con",
"=",
"self",
".",
"_tensor_type",
"[",
"0",
"]",
"# number of contravariant indices = k",
"n_cov",
"=",
"self",
".",
"_tensor_type",
"[",
"1",
"]",
"# number of covariant indices = ... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/manifolds/differentiable/tensorfield.py#L4001-L4145 | |
librahfacebook/Detection | 84504d086634950224716f4de0e4c8a684493c34 | object_detection/utils/shape_utils.py | python | combined_static_and_dynamic_shape | (tensor) | return combined_shape | Returns a list containing static and dynamic values for the dimensions.
Returns a list of static and dynamic values for shape dimensions. This is
useful to preserve static shapes when available in reshape operation.
Args:
tensor: A tensor of any type.
Returns:
A list of size tensor.shape.ndims containing integers or a scalar tensor. | Returns a list containing static and dynamic values for the dimensions. | [
"Returns",
"a",
"list",
"containing",
"static",
"and",
"dynamic",
"values",
"for",
"the",
"dimensions",
"."
] | def combined_static_and_dynamic_shape(tensor):
"""Returns a list containing static and dynamic values for the dimensions.
Returns a list of static and dynamic values for shape dimensions. This is
useful to preserve static shapes when available in reshape operation.
Args:
tensor: A tensor of any type.
Returns:
A list of size tensor.shape.ndims containing integers or a scalar tensor.
"""
static_tensor_shape = tensor.shape.as_list()
dynamic_tensor_shape = tf.shape(tensor)
combined_shape = []
for index, dim in enumerate(static_tensor_shape):
if dim is not None:
combined_shape.append(dim)
else:
combined_shape.append(dynamic_tensor_shape[index])
return combined_shape | [
"def",
"combined_static_and_dynamic_shape",
"(",
"tensor",
")",
":",
"static_tensor_shape",
"=",
"tensor",
".",
"shape",
".",
"as_list",
"(",
")",
"dynamic_tensor_shape",
"=",
"tf",
".",
"shape",
"(",
"tensor",
")",
"combined_shape",
"=",
"[",
"]",
"for",
"ind... | https://github.com/librahfacebook/Detection/blob/84504d086634950224716f4de0e4c8a684493c34/object_detection/utils/shape_utils.py#L154-L174 | |
JiYou/openstack | 8607dd488bde0905044b303eb6e52bdea6806923 | packages/source/quantum/quantum/agent/linux/iptables_manager.py | python | IptablesManager._apply | (self) | Apply the current in-memory set of iptables rules.
This will blow away any rules left over from previous runs of the
same component of Nova, and replace them with our current set of
rules. This happens atomically, thanks to iptables-restore. | Apply the current in-memory set of iptables rules. | [
"Apply",
"the",
"current",
"in",
"-",
"memory",
"set",
"of",
"iptables",
"rules",
"."
] | def _apply(self):
"""Apply the current in-memory set of iptables rules.
This will blow away any rules left over from previous runs of the
same component of Nova, and replace them with our current set of
rules. This happens atomically, thanks to iptables-restore.
"""
s = [('iptables', self.ipv4)]
if self.use_ipv6:
s += [('ip6tables', self.ipv6)]
for cmd, tables in s:
for table in tables:
args = ['%s-save' % cmd, '-t', table]
if self.namespace:
args = ['ip', 'netns', 'exec', self.namespace] + args
current_table = (self.execute(args,
root_helper=self.root_helper))
current_lines = current_table.split('\n')
new_filter = self._modify_rules(current_lines,
tables[table])
args = ['%s-restore' % (cmd)]
if self.namespace:
args = ['ip', 'netns', 'exec', self.namespace] + args
self.execute(args,
process_input='\n'.join(new_filter),
root_helper=self.root_helper)
LOG.debug(_("IPTablesManager.apply completed with success")) | [
"def",
"_apply",
"(",
"self",
")",
":",
"s",
"=",
"[",
"(",
"'iptables'",
",",
"self",
".",
"ipv4",
")",
"]",
"if",
"self",
".",
"use_ipv6",
":",
"s",
"+=",
"[",
"(",
"'ip6tables'",
",",
"self",
".",
"ipv6",
")",
"]",
"for",
"cmd",
",",
"tables... | https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/quantum/quantum/agent/linux/iptables_manager.py#L313-L341 | ||
tristanguigue/dynamic-programming | eacfe883c55c77acf20a9028e7fad9c079ff481a | partition_string/recursion.py | python | cost | (word) | Evaluate the cost of a given word. 0 if the word is in the dictionary,
the number of characters otherwise
Args:
word (string): a string whose cost need to be evaluated
Returns:
The cost of the word (int) | Evaluate the cost of a given word. 0 if the word is in the dictionary,
the number of characters otherwise | [
"Evaluate",
"the",
"cost",
"of",
"a",
"given",
"word",
".",
"0",
"if",
"the",
"word",
"is",
"in",
"the",
"dictionary",
"the",
"number",
"of",
"characters",
"otherwise"
] | def cost(word):
"""Evaluate the cost of a given word. 0 if the word is in the dictionary,
the number of characters otherwise
Args:
word (string): a string whose cost need to be evaluated
Returns:
The cost of the word (int)
"""
if word in dictionary:
return 0
else:
return len(word) | [
"def",
"cost",
"(",
"word",
")",
":",
"if",
"word",
"in",
"dictionary",
":",
"return",
"0",
"else",
":",
"return",
"len",
"(",
"word",
")"
] | https://github.com/tristanguigue/dynamic-programming/blob/eacfe883c55c77acf20a9028e7fad9c079ff481a/partition_string/recursion.py#L19-L32 | ||
triaquae/triaquae | bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9 | TriAquae/models/Ubuntu_12/ecdsa/ecdsa.py | python | digest_integer | ( m ) | return string_to_int( sha1( int_to_string( m ) ).digest() ) | Convert an integer into a string of bytes, compute
its SHA-1 hash, and convert the result to an integer. | Convert an integer into a string of bytes, compute
its SHA-1 hash, and convert the result to an integer. | [
"Convert",
"an",
"integer",
"into",
"a",
"string",
"of",
"bytes",
"compute",
"its",
"SHA",
"-",
"1",
"hash",
"and",
"convert",
"the",
"result",
"to",
"an",
"integer",
"."
] | def digest_integer( m ):
"""Convert an integer into a string of bytes, compute
its SHA-1 hash, and convert the result to an integer."""
#
# I don't expect this function to be used much. I wrote
# it in order to be able to duplicate the examples
# in ECDSAVS.
#
from hashlib import sha1
return string_to_int( sha1( int_to_string( m ) ).digest() ) | [
"def",
"digest_integer",
"(",
"m",
")",
":",
"#",
"# I don't expect this function to be used much. I wrote",
"# it in order to be able to duplicate the examples",
"# in ECDSAVS.",
"#",
"from",
"hashlib",
"import",
"sha1",
"return",
"string_to_int",
"(",
"sha1",
"(",
"int_to_s... | https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/Ubuntu_12/ecdsa/ecdsa.py#L178-L187 | |
bendmorris/static-python | 2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473 | Lib/decimal.py | python | Decimal.as_tuple | (self) | return DecimalTuple(self._sign, tuple(map(int, self._int)), self._exp) | Represents the number as a triple tuple.
To show the internals exactly as they are. | Represents the number as a triple tuple. | [
"Represents",
"the",
"number",
"as",
"a",
"triple",
"tuple",
"."
] | def as_tuple(self):
"""Represents the number as a triple tuple.
To show the internals exactly as they are.
"""
return DecimalTuple(self._sign, tuple(map(int, self._int)), self._exp) | [
"def",
"as_tuple",
"(",
"self",
")",
":",
"return",
"DecimalTuple",
"(",
"self",
".",
"_sign",
",",
"tuple",
"(",
"map",
"(",
"int",
",",
"self",
".",
"_int",
")",
")",
",",
"self",
".",
"_exp",
")"
] | https://github.com/bendmorris/static-python/blob/2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473/Lib/decimal.py#L1008-L1013 | |
andresriancho/w3af | cd22e5252243a87aaa6d0ddea47cf58dacfe00a9 | w3af/plugins/attack/db/sqlmap/lib/core/common.py | python | getPageWordSet | (page) | return retVal | Returns word set used in page content
>>> sorted(getPageWordSet(u'<html><title>foobar</title><body>test</body></html>'))
[u'foobar', u'test'] | Returns word set used in page content | [
"Returns",
"word",
"set",
"used",
"in",
"page",
"content"
] | def getPageWordSet(page):
"""
Returns word set used in page content
>>> sorted(getPageWordSet(u'<html><title>foobar</title><body>test</body></html>'))
[u'foobar', u'test']
"""
retVal = set()
# only if the page's charset has been successfully identified
if isinstance(page, unicode):
retVal = set(_.group(0) for _ in re.finditer(r"\w+", getFilteredPageContent(page)))
return retVal | [
"def",
"getPageWordSet",
"(",
"page",
")",
":",
"retVal",
"=",
"set",
"(",
")",
"# only if the page's charset has been successfully identified",
"if",
"isinstance",
"(",
"page",
",",
"unicode",
")",
":",
"retVal",
"=",
"set",
"(",
"_",
".",
"group",
"(",
"0",
... | https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/plugins/attack/db/sqlmap/lib/core/common.py#L1831-L1845 | |
quodlibet/quodlibet | e3099c89f7aa6524380795d325cc14630031886c | quodlibet/formats/_image.py | python | APICType.sort_key | (cls, value) | Sorts picture types, most important picture is the lowest.
Important is defined as most representative of an album release, ymmv. | Sorts picture types, most important picture is the lowest.
Important is defined as most representative of an album release, ymmv. | [
"Sorts",
"picture",
"types",
"most",
"important",
"picture",
"is",
"the",
"lowest",
".",
"Important",
"is",
"defined",
"as",
"most",
"representative",
"of",
"an",
"album",
"release",
"ymmv",
"."
] | def sort_key(cls, value):
"""Sorts picture types, most important picture is the lowest.
Important is defined as most representative of an album release, ymmv.
"""
# index value -> important
important = [
cls.LEAFLET_PAGE, cls.MEDIA,
cls.COVER_BACK, cls.COVER_FRONT
]
try:
return -important.index(value)
except ValueError:
if value < cls.COVER_FRONT:
return 100 - value
else:
return value | [
"def",
"sort_key",
"(",
"cls",
",",
"value",
")",
":",
"# index value -> important",
"important",
"=",
"[",
"cls",
".",
"LEAFLET_PAGE",
",",
"cls",
".",
"MEDIA",
",",
"cls",
".",
"COVER_BACK",
",",
"cls",
".",
"COVER_FRONT",
"]",
"try",
":",
"return",
"-... | https://github.com/quodlibet/quodlibet/blob/e3099c89f7aa6524380795d325cc14630031886c/quodlibet/formats/_image.py#L139-L156 | ||
numenta/numenta-apps | 02903b0062c89c2c259b533eea2df6e8bb44eaf3 | taurus_metric_collectors/taurus_metric_collectors/delete_companies.py | python | deleteCompanies | (tickerSymbols,
engineServer,
engineApiKey,
warnAboutDestructiveAction=True,
warningTimeout=_DEFAULT_WARNING_PROMPT_TIMEOUT_SEC) | Delete companies from Taurus Collector and their metrics/models from
Taurus Engine.
:param sequence tickerSymbols: stock ticker symbols of companies to be
deleted
:param str engineServer: dns name of ip addres of Taurus API server
:param str engineApiKey: API Key of Taurus HTM Engine
:param bool warnAboutDestructiveAction: whether to warn about destructive
action; defaults to True.
:param float warningTimeout: Timeout for the warning prompt; ignored if
warnAboutDestructiveAction is False
:raises WarningPromptTimeout: if warning prompt timed out
:raises UserAbortedOperation: if user chose to abort the operation
:raises FlusherMetricNotFound: | Delete companies from Taurus Collector and their metrics/models from
Taurus Engine. | [
"Delete",
"companies",
"from",
"Taurus",
"Collector",
"and",
"their",
"metrics",
"/",
"models",
"from",
"Taurus",
"Engine",
"."
] | def deleteCompanies(tickerSymbols,
engineServer,
engineApiKey,
warnAboutDestructiveAction=True,
warningTimeout=_DEFAULT_WARNING_PROMPT_TIMEOUT_SEC):
"""Delete companies from Taurus Collector and their metrics/models from
Taurus Engine.
:param sequence tickerSymbols: stock ticker symbols of companies to be
deleted
:param str engineServer: dns name of ip addres of Taurus API server
:param str engineApiKey: API Key of Taurus HTM Engine
:param bool warnAboutDestructiveAction: whether to warn about destructive
action; defaults to True.
:param float warningTimeout: Timeout for the warning prompt; ignored if
warnAboutDestructiveAction is False
:raises WarningPromptTimeout: if warning prompt timed out
:raises UserAbortedOperation: if user chose to abort the operation
:raises FlusherMetricNotFound:
"""
tickerSymbols = tuple(symbol.upper() for symbol in tickerSymbols)
# Check for duplicate symbols
repeatedSymbols = set(sym for sym in tickerSymbols
if tickerSymbols.count(sym) > 1)
if repeatedSymbols:
raise ValueError("{numRepeats} symbol(s) are present more than once in "
"tickerSymbols arg: {repeats}"
.format(numRepeats=len(repeatedSymbols),
repeats=repeatedSymbols))
# Set will be handier going forward
tickerSymbols = set(tickerSymbols)
if warnAboutDestructiveAction:
_warnAboutDestructiveAction(timeout=warningTimeout,
tickerSymbols=tickerSymbols,
engineServer=engineServer)
# If any of the ticker symbols still appear in the collector's metrics config,
# abort the operation as a precautionary measure.
allSymbols = set(security[0].upper() for security in
metric_utils.getAllMetricSecurities())
problemSymbols = tickerSymbols & allSymbols
assert not problemSymbols, (
"Can't delete - {numProblem} of the specified companies [{symbols}] are "
"in active metrics configuration".format(numProblem=len(problemSymbols),
symbols=problemSymbols))
# First, we need to synchronize with Taurus Engine's metric data path.
# If any of the data still in the pipeline is for any of the companies being
# deleted, then the metrics may be re-created in the Engine after we delete
# them. This is an yet unresolved subtlety with custom metrics in htmengine.
_flushTaurusEngineMetricDataPath(engineServer, engineApiKey)
# NOTE: We must query custom metrics after flushing the metric data path,
# since metrics may get created as a side-effect of processing metric data.
allMetricsMap = {
obj["name"] : obj
for obj in
metric_utils.getAllCustomMetrics(host=engineServer, apiKey=engineApiKey)
}
allMetricNames = allMetricsMap.keys()
for symbolNum, symbol in enumerate(tickerSymbols, 1):
# Delete corresponding metrics from Taurus Engine
metricNamesToDelete = metric_utils.filterCompanyMetricNamesBySymbol(
allMetricNames,
symbol)
if not metricNamesToDelete:
g_log.info("No metrics to delete for symbol=%s (%d of %d)", symbol,
symbolNum, len(tickerSymbols))
continue
g_log.info("Deleting metrics and models for ticker symbol=%s from Taurus "
"Engine=%s (%d of %d)", symbol, engineServer,
symbolNum, len(tickerSymbols))
for metricName in metricNamesToDelete:
metric_utils.deleteMetric(host=engineServer,
apiKey=engineApiKey,
metricName=metricName)
g_log.info("Deleted metric name=%s, uid=%s", metricName,
allMetricsMap[metricName]["uid"])
# Delete the symbol from xignite_security table last; this cascades to
# delete related rows in other tables via cascading delete relationship.
#
# NOTE: garbage collection from other tables not tied to xiginte_security
# symbols presently depends on aging of the rows (e.g., twitter tables).
# After ENG-83, all company-specific rows from all tables will be
# cleaned up and THIS NOTE SHOULD THEN BE REMOVED
with collectorsdb.engineFactory().begin() as conn:
numDeleted = (
conn.execute(
collectorsdb.schema.xigniteSecurity # pylint: disable=E1120
.delete()
.where(collectorsdb.schema.xigniteSecurity.c.symbol == symbol))
).rowcount
if numDeleted:
g_log.info("Deleted row=%s from table=%s", symbol,
collectorsdb.schema.xigniteSecurity)
else:
g_log.warning(
"Couldn't delete security row=%s: not found in table=%s",
symbol, collectorsdb.schema.xigniteSecurity) | [
"def",
"deleteCompanies",
"(",
"tickerSymbols",
",",
"engineServer",
",",
"engineApiKey",
",",
"warnAboutDestructiveAction",
"=",
"True",
",",
"warningTimeout",
"=",
"_DEFAULT_WARNING_PROMPT_TIMEOUT_SEC",
")",
":",
"tickerSymbols",
"=",
"tuple",
"(",
"symbol",
".",
"u... | https://github.com/numenta/numenta-apps/blob/02903b0062c89c2c259b533eea2df6e8bb44eaf3/taurus_metric_collectors/taurus_metric_collectors/delete_companies.py#L81-L195 | ||
Shikhargupta/Spiking-Neural-Network | de3e24da2806f0a7006b37f395ed055497727ae6 | multi_layer/reconstruct.py | python | reconst_weights | (weights, num, layer, reshape_x, reshape_y) | return img | [] | def reconst_weights(weights, num, layer, reshape_x, reshape_y):
weights = np.array(weights)
weights = np.reshape(weights, (reshape_x, reshape_y))
img = np.zeros((reshape_x, reshape_y))
for i in range(reshape_x):
for j in range(reshape_y):
img[i][j] = int(interp(weights[i][j], [par.w_min, par.w_max], [0, 255]))
img = np.resize(img, (28, 28))
cv2.imwrite('weights/layer_' + str(layer) + '_neuron_' + str(num) + '.png', img)
return img | [
"def",
"reconst_weights",
"(",
"weights",
",",
"num",
",",
"layer",
",",
"reshape_x",
",",
"reshape_y",
")",
":",
"weights",
"=",
"np",
".",
"array",
"(",
"weights",
")",
"weights",
"=",
"np",
".",
"reshape",
"(",
"weights",
",",
"(",
"reshape_x",
",",... | https://github.com/Shikhargupta/Spiking-Neural-Network/blob/de3e24da2806f0a7006b37f395ed055497727ae6/multi_layer/reconstruct.py#L13-L23 | |||
BirdAPI/Google-Search-API | e091df9b0bd399fbb249b5eec78479ec27cd942d | BeautifulSoup.py | python | PageElement.toEncoding | (self, s, encoding=None) | return s | Encodes an object to a string in some encoding, or to Unicode.
. | Encodes an object to a string in some encoding, or to Unicode.
. | [
"Encodes",
"an",
"object",
"to",
"a",
"string",
"in",
"some",
"encoding",
"or",
"to",
"Unicode",
".",
"."
] | def toEncoding(self, s, encoding=None):
"""Encodes an object to a string in some encoding, or to Unicode.
."""
if isinstance(s, unicode):
if encoding:
s = s.encode(encoding)
elif isinstance(s, str):
if encoding:
s = s.encode(encoding)
else:
s = unicode(s)
else:
if encoding:
s = self.toEncoding(str(s), encoding)
else:
s = unicode(s)
return s | [
"def",
"toEncoding",
"(",
"self",
",",
"s",
",",
"encoding",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"s",
",",
"unicode",
")",
":",
"if",
"encoding",
":",
"s",
"=",
"s",
".",
"encode",
"(",
"encoding",
")",
"elif",
"isinstance",
"(",
"s",
... | https://github.com/BirdAPI/Google-Search-API/blob/e091df9b0bd399fbb249b5eec78479ec27cd942d/BeautifulSoup.py#L406-L422 | |
chaoss/grimoirelab-perceval | ba19bfd5e40bffdd422ca8e68526326b47f97491 | perceval/backends/core/nntp.py | python | NNTTPClient.article | (self, article_id) | return self._fetch("article", article_id) | Fetch article data
:param article_id: id of the article to fetch | Fetch article data | [
"Fetch",
"article",
"data"
] | def article(self, article_id):
"""Fetch article data
:param article_id: id of the article to fetch
"""
return self._fetch("article", article_id) | [
"def",
"article",
"(",
"self",
",",
"article_id",
")",
":",
"return",
"self",
".",
"_fetch",
"(",
"\"article\"",
",",
"article_id",
")"
] | https://github.com/chaoss/grimoirelab-perceval/blob/ba19bfd5e40bffdd422ca8e68526326b47f97491/perceval/backends/core/nntp.py#L295-L300 | |
pyscf/pyscf | 0adfb464333f5ceee07b664f291d4084801bae64 | pyscf/gw/ugw_ac.py | python | UGWAC.kernel | (self, mo_energy=None, mo_coeff=None, Lpq=None, orbs=None, nw=100, vhf_df=False) | return self.mo_energy | Input:
orbs: self-energy orbs
nw: grid number
vhf_df: whether using density fitting for HF exchange
Output:
mo_energy: GW quasiparticle energy | Input:
orbs: self-energy orbs
nw: grid number
vhf_df: whether using density fitting for HF exchange
Output:
mo_energy: GW quasiparticle energy | [
"Input",
":",
"orbs",
":",
"self",
"-",
"energy",
"orbs",
"nw",
":",
"grid",
"number",
"vhf_df",
":",
"whether",
"using",
"density",
"fitting",
"for",
"HF",
"exchange",
"Output",
":",
"mo_energy",
":",
"GW",
"quasiparticle",
"energy"
] | def kernel(self, mo_energy=None, mo_coeff=None, Lpq=None, orbs=None, nw=100, vhf_df=False):
"""
Input:
orbs: self-energy orbs
nw: grid number
vhf_df: whether using density fitting for HF exchange
Output:
mo_energy: GW quasiparticle energy
"""
if mo_coeff is None:
mo_coeff = _mo_without_core(self, self._scf.mo_coeff)
if mo_energy is None:
mo_energy = _mo_energy_without_core(self, self._scf.mo_energy)
cput0 = (logger.process_clock(), logger.perf_counter())
self.dump_flags()
self.converged, self.mo_energy, self.mo_coeff = \
kernel(self, mo_energy, mo_coeff,
Lpq=Lpq, orbs=orbs, nw=nw, vhf_df=vhf_df, verbose=self.verbose)
logger.warn(self, 'GW QP energies may not be sorted from min to max')
logger.timer(self, 'GW', *cput0)
return self.mo_energy | [
"def",
"kernel",
"(",
"self",
",",
"mo_energy",
"=",
"None",
",",
"mo_coeff",
"=",
"None",
",",
"Lpq",
"=",
"None",
",",
"orbs",
"=",
"None",
",",
"nw",
"=",
"100",
",",
"vhf_df",
"=",
"False",
")",
":",
"if",
"mo_coeff",
"is",
"None",
":",
"mo_c... | https://github.com/pyscf/pyscf/blob/0adfb464333f5ceee07b664f291d4084801bae64/pyscf/gw/ugw_ac.py#L453-L475 | |
toxinu/Sublimall | 58eb7bc624234720003ad4df82d13ce23d70e4e1 | sublimall/commands/command.py | python | CommandWithStatus.set_message | (self, message) | Set a message | Set a message | [
"Set",
"a",
"message"
] | def set_message(self, message):
""" Set a message """
self._messageStatus.set_message(message)
if not self._messageStatus.is_running:
self._messageStatus.is_running = True
self._messageStatus.run() | [
"def",
"set_message",
"(",
"self",
",",
"message",
")",
":",
"self",
".",
"_messageStatus",
".",
"set_message",
"(",
"message",
")",
"if",
"not",
"self",
".",
"_messageStatus",
".",
"is_running",
":",
"self",
".",
"_messageStatus",
".",
"is_running",
"=",
... | https://github.com/toxinu/Sublimall/blob/58eb7bc624234720003ad4df82d13ce23d70e4e1/sublimall/commands/command.py#L45-L50 | ||
neurolib-dev/neurolib | 8d8ed2ceb422e9a1367193495a7e2df96cf4e4a3 | neurolib/utils/signal.py | python | Signal.apply | (self, func, inplace=True) | Apply func for each timeseries.
:param func: function to be applied for each 1D timeseries
:type func: callable
:param inplace: whether to do the operation in place or return
:type inplace: bool | Apply func for each timeseries. | [
"Apply",
"func",
"for",
"each",
"timeseries",
"."
] | def apply(self, func, inplace=True):
"""
Apply func for each timeseries.
:param func: function to be applied for each 1D timeseries
:type func: callable
:param inplace: whether to do the operation in place or return
:type inplace: bool
"""
assert callable(func)
try:
# this will work for element-wise function that does not reduces dimensions
processed = xr.apply_ufunc(func, self.data, input_core_dims=[["time"]], output_core_dims=[["time"]])
add_steps = [f"apply `{func.__name__}` function over time dim"]
if inplace:
self.data = processed
self.process_steps += add_steps
else:
return self.__constructor__(processed).__finalize__(self, add_steps)
except ValueError:
# this works for functions that reduce time dimension
processed = xr.apply_ufunc(func, self.data, input_core_dims=[["time"]])
logging.warning(
f"Shape changed after operation! Old shape: {self.shape}, new "
f"shape: {processed.shape}; Cannot cast to Signal class, "
"returing as `xr.DataArray`"
)
return processed | [
"def",
"apply",
"(",
"self",
",",
"func",
",",
"inplace",
"=",
"True",
")",
":",
"assert",
"callable",
"(",
"func",
")",
"try",
":",
"# this will work for element-wise function that does not reduces dimensions",
"processed",
"=",
"xr",
".",
"apply_ufunc",
"(",
"fu... | https://github.com/neurolib-dev/neurolib/blob/8d8ed2ceb422e9a1367193495a7e2df96cf4e4a3/neurolib/utils/signal.py#L671-L698 | ||
tartiflette/tartiflette | e292c28ed4fa279ecedb8980fc3741965bd28c87 | tartiflette/language/ast/values.py | python | EnumValueNode.__init__ | (
self, value: str, location: Optional["Location"] = None
) | :param value: value of the enum value
:param location: location of the enum value in the query/SDL
:type value: str
:type location: Optional[Location] | :param value: value of the enum value
:param location: location of the enum value in the query/SDL
:type value: str
:type location: Optional[Location] | [
":",
"param",
"value",
":",
"value",
"of",
"the",
"enum",
"value",
":",
"param",
"location",
":",
"location",
"of",
"the",
"enum",
"value",
"in",
"the",
"query",
"/",
"SDL",
":",
"type",
"value",
":",
"str",
":",
"type",
"location",
":",
"Optional",
... | def __init__(
self, value: str, location: Optional["Location"] = None
) -> None:
"""
:param value: value of the enum value
:param location: location of the enum value in the query/SDL
:type value: str
:type location: Optional[Location]
"""
self.value = value
self.location = location | [
"def",
"__init__",
"(",
"self",
",",
"value",
":",
"str",
",",
"location",
":",
"Optional",
"[",
"\"Location\"",
"]",
"=",
"None",
")",
"->",
"None",
":",
"self",
".",
"value",
"=",
"value",
"self",
".",
"location",
"=",
"location"
] | https://github.com/tartiflette/tartiflette/blob/e292c28ed4fa279ecedb8980fc3741965bd28c87/tartiflette/language/ast/values.py#L78-L88 | ||
mrJean1/PyGeodesy | 7da5ca71aa3edb7bc49e219e0b8190686e1a7965 | pygeodesy/basics.py | python | _xcopy | (inst, deep=False) | return _deepcopy(inst) if deep else _copy(inst) | (INTERNAL) Copy an object, shallow or deep.
@arg inst: The object to copy (any C{type}).
@kwarg deep: If C{True} make a deep, otherwise
a shallow copy (C{bool}).
@return: The copy of B{C{inst}}. | (INTERNAL) Copy an object, shallow or deep. | [
"(",
"INTERNAL",
")",
"Copy",
"an",
"object",
"shallow",
"or",
"deep",
"."
] | def _xcopy(inst, deep=False):
'''(INTERNAL) Copy an object, shallow or deep.
@arg inst: The object to copy (any C{type}).
@kwarg deep: If C{True} make a deep, otherwise
a shallow copy (C{bool}).
@return: The copy of B{C{inst}}.
'''
return _deepcopy(inst) if deep else _copy(inst) | [
"def",
"_xcopy",
"(",
"inst",
",",
"deep",
"=",
"False",
")",
":",
"return",
"_deepcopy",
"(",
"inst",
")",
"if",
"deep",
"else",
"_copy",
"(",
"inst",
")"
] | https://github.com/mrJean1/PyGeodesy/blob/7da5ca71aa3edb7bc49e219e0b8190686e1a7965/pygeodesy/basics.py#L475-L484 | |
UCL-INGI/INGInious | 60f10cb4c375ce207471043e76bd813220b95399 | inginious/frontend/course_factory.py | python | CourseFactory.delete_course | (self, courseid) | Erase the content of the course folder
:param courseid: the course id of the course
:raise: InvalidNameException or CourseNotFoundException | Erase the content of the course folder
:param courseid: the course id of the course
:raise: InvalidNameException or CourseNotFoundException | [
"Erase",
"the",
"content",
"of",
"the",
"course",
"folder",
":",
"param",
"courseid",
":",
"the",
"course",
"id",
"of",
"the",
"course",
":",
"raise",
":",
"InvalidNameException",
"or",
"CourseNotFoundException"
] | def delete_course(self, courseid):
"""
Erase the content of the course folder
:param courseid: the course id of the course
:raise: InvalidNameException or CourseNotFoundException
"""
if not id_checker(courseid):
raise InvalidNameException("Course with invalid name: " + courseid)
course_fs = self.get_course_fs(courseid)
if not course_fs.exists():
raise CourseNotFoundException()
course_fs.delete()
get_course_logger(courseid).info("Course %s erased from the factory.", courseid) | [
"def",
"delete_course",
"(",
"self",
",",
"courseid",
")",
":",
"if",
"not",
"id_checker",
"(",
"courseid",
")",
":",
"raise",
"InvalidNameException",
"(",
"\"Course with invalid name: \"",
"+",
"courseid",
")",
"course_fs",
"=",
"self",
".",
"get_course_fs",
"(... | https://github.com/UCL-INGI/INGInious/blob/60f10cb4c375ce207471043e76bd813220b95399/inginious/frontend/course_factory.py#L165-L181 | ||
knownsec/Pocsuite | 877d1b1604629b8dcd6e53b167c3c98249e5e94f | pocsuite/thirdparty/oset/_abc.py | python | abstractmethod | (funcobj) | return funcobj | A decorator indicating abstract methods.
Requires that the metaclass is ABCMeta or derived from it. A
class that has a metaclass derived from ABCMeta cannot be
instantiated unless all of its abstract methods are overridden.
The abstract methods can be called using any of the normal
'super' call mechanisms.
Usage:
class C:
__metaclass__ = ABCMeta
@abstractmethod
def my_abstract_method(self, ...):
... | A decorator indicating abstract methods. | [
"A",
"decorator",
"indicating",
"abstract",
"methods",
"."
] | def abstractmethod(funcobj):
"""A decorator indicating abstract methods.
Requires that the metaclass is ABCMeta or derived from it. A
class that has a metaclass derived from ABCMeta cannot be
instantiated unless all of its abstract methods are overridden.
The abstract methods can be called using any of the normal
'super' call mechanisms.
Usage:
class C:
__metaclass__ = ABCMeta
@abstractmethod
def my_abstract_method(self, ...):
...
"""
funcobj.__isabstractmethod__ = True
return funcobj | [
"def",
"abstractmethod",
"(",
"funcobj",
")",
":",
"funcobj",
".",
"__isabstractmethod__",
"=",
"True",
"return",
"funcobj"
] | https://github.com/knownsec/Pocsuite/blob/877d1b1604629b8dcd6e53b167c3c98249e5e94f/pocsuite/thirdparty/oset/_abc.py#L22-L40 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.