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
dcsync/pycobalt
d3a630bfadaeeb6c99aad28f226abe48f6b4acca
pycobalt/aggressor.py
python
insert_component
(*args, fork=None, sync=True)
return engine.call('insert_component', args, fork=fork, sync=sync)
r""" Documentation from https://www.cobaltstrike.com/aggressor-script/functions.html: Add a javax.swing.JComponent object to the menu tree Arguments $1 - the component to add
r""" Documentation from https://www.cobaltstrike.com/aggressor-script/functions.html:
[ "r", "Documentation", "from", "https", ":", "//", "www", ".", "cobaltstrike", ".", "com", "/", "aggressor", "-", "script", "/", "functions", ".", "html", ":" ]
def insert_component(*args, fork=None, sync=True): r""" Documentation from https://www.cobaltstrike.com/aggressor-script/functions.html: Add a javax.swing.JComponent object to the menu tree Arguments $1 - the component to add """ return engine.call('insert_component', args, for...
[ "def", "insert_component", "(", "*", "args", ",", "fork", "=", "None", ",", "sync", "=", "True", ")", ":", "return", "engine", ".", "call", "(", "'insert_component'", ",", "args", ",", "fork", "=", "fork", ",", "sync", "=", "sync", ")" ]
https://github.com/dcsync/pycobalt/blob/d3a630bfadaeeb6c99aad28f226abe48f6b4acca/pycobalt/aggressor.py#L4437-L4446
pythonanywhere/dirigible-spreadsheet
c771e9a391708f3b219248bf9974e05b1582fdd0
dirigible/sheet/parser/grammar.py
python
p_test
(p)
test : and_test | and_test _or_and_tests | lambdef
test : and_test | and_test _or_and_tests | lambdef
[ "test", ":", "and_test", "|", "and_test", "_or_and_tests", "|", "lambdef" ]
def p_test(p): """test : and_test | and_test _or_and_tests | lambdef""" if len(p) == 2: p[0] = Test([p[1]]) else: p[0] = Test([p[1]] + p[2])
[ "def", "p_test", "(", "p", ")", ":", "if", "len", "(", "p", ")", "==", "2", ":", "p", "[", "0", "]", "=", "Test", "(", "[", "p", "[", "1", "]", "]", ")", "else", ":", "p", "[", "0", "]", "=", "Test", "(", "[", "p", "[", "1", "]", "]...
https://github.com/pythonanywhere/dirigible-spreadsheet/blob/c771e9a391708f3b219248bf9974e05b1582fdd0/dirigible/sheet/parser/grammar.py#L161-L168
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/xlrd-2.0.1/xlrd/sheet.py
python
Sheet.col_values
(self, colx, start_rowx=0, end_rowx=None)
return [ self._cell_values[rowx][colx] for rowx in xrange(start_rowx, end_rowx) ]
Returns a slice of the values of the cells in the given column.
Returns a slice of the values of the cells in the given column.
[ "Returns", "a", "slice", "of", "the", "values", "of", "the", "cells", "in", "the", "given", "column", "." ]
def col_values(self, colx, start_rowx=0, end_rowx=None): """ Returns a slice of the values of the cells in the given column. """ nr = self.nrows if start_rowx < 0: start_rowx += nr if start_rowx < 0: start_rowx = 0 if end_rowx is No...
[ "def", "col_values", "(", "self", ",", "colx", ",", "start_rowx", "=", "0", ",", "end_rowx", "=", "None", ")", ":", "nr", "=", "self", ".", "nrows", "if", "start_rowx", "<", "0", ":", "start_rowx", "+=", "nr", "if", "start_rowx", "<", "0", ":", "st...
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/xlrd-2.0.1/xlrd/sheet.py#L553-L569
oaubert/python-vlc
908ffdbd0844dc1849728c456e147788798c99da
generated/3.0/vlc.py
python
libvlc_free
(ptr)
return f(ptr)
Frees an heap allocation returned by a LibVLC function. If you know you're using the same underlying C run-time as the LibVLC implementation, then you can call ANSI C free() directly instead. @param ptr: the pointer.
Frees an heap allocation returned by a LibVLC function. If you know you're using the same underlying C run-time as the LibVLC implementation, then you can call ANSI C free() directly instead.
[ "Frees", "an", "heap", "allocation", "returned", "by", "a", "LibVLC", "function", ".", "If", "you", "know", "you", "re", "using", "the", "same", "underlying", "C", "run", "-", "time", "as", "the", "LibVLC", "implementation", "then", "you", "can", "call", ...
def libvlc_free(ptr): '''Frees an heap allocation returned by a LibVLC function. If you know you're using the same underlying C run-time as the LibVLC implementation, then you can call ANSI C free() directly instead. @param ptr: the pointer. ''' f = _Cfunctions.get('libvlc_free', None) or \ ...
[ "def", "libvlc_free", "(", "ptr", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_free'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_free'", ",", "(", "(", "1", ",", ")", ",", ")", ",", "None", ",", "None", ",", "ctypes", ".",...
https://github.com/oaubert/python-vlc/blob/908ffdbd0844dc1849728c456e147788798c99da/generated/3.0/vlc.py#L5062-L5071
hzlzh/AlfredWorkflow.com
7055f14f6922c80ea5943839eb0caff11ae57255
Sources/Workflows/delicious/alp/request/requests/cookies.py
python
RequestsCookieJar.set
(self, name, value, **kwargs)
return c
Dict-like set() that also supports optional domain and path args in order to resolve naming collisions from using one cookie jar over multiple domains.
Dict-like set() that also supports optional domain and path args in order to resolve naming collisions from using one cookie jar over multiple domains.
[ "Dict", "-", "like", "set", "()", "that", "also", "supports", "optional", "domain", "and", "path", "args", "in", "order", "to", "resolve", "naming", "collisions", "from", "using", "one", "cookie", "jar", "over", "multiple", "domains", "." ]
def set(self, name, value, **kwargs): """Dict-like set() that also supports optional domain and path args in order to resolve naming collisions from using one cookie jar over multiple domains.""" # support client code that unsets cookies by assignment of a None value: if value is...
[ "def", "set", "(", "self", ",", "name", ",", "value", ",", "*", "*", "kwargs", ")", ":", "# support client code that unsets cookies by assignment of a None value:", "if", "value", "is", "None", ":", "remove_cookie_by_name", "(", "self", ",", "name", ",", "domain",...
https://github.com/hzlzh/AlfredWorkflow.com/blob/7055f14f6922c80ea5943839eb0caff11ae57255/Sources/Workflows/delicious/alp/request/requests/cookies.py#L166-L180
suurjaak/Skyperious
6a4f264dbac8d326c2fa8aeb5483dbca987860bf
skyperious/gui.py
python
ChatContentSTC.OnUrl
(self, event)
Handler for clicking a link in chat history, opens URLs in system browser, starts file links, and handles internal links.
Handler for clicking a link in chat history, opens URLs in system browser, starts file links, and handles internal links.
[ "Handler", "for", "clicking", "a", "link", "in", "chat", "history", "opens", "URLs", "in", "system", "browser", "starts", "file", "links", "and", "handles", "internal", "links", "." ]
def OnUrl(self, event): """ Handler for clicking a link in chat history, opens URLs in system browser, starts file links, and handles internal links. """ stc = event.EventObject styles_link = [self._styles["link"], self._styles["boldlink"]] if stc.GetStyleAt(event...
[ "def", "OnUrl", "(", "self", ",", "event", ")", ":", "stc", "=", "event", ".", "EventObject", "styles_link", "=", "[", "self", ".", "_styles", "[", "\"link\"", "]", ",", "self", ".", "_styles", "[", "\"boldlink\"", "]", "]", "if", "stc", ".", "GetSty...
https://github.com/suurjaak/Skyperious/blob/6a4f264dbac8d326c2fa8aeb5483dbca987860bf/skyperious/gui.py#L7514-L7548
andreikop/enki
3170059e5cb46dcc77d7fb1457c38a8a5f13af66
enki/core/locator.py
python
_LocatorDialog._parseCurrentCommand
(self)
Parse text and try to get (command, completable word index) Return None if failed to parse
Parse text and try to get (command, completable word index) Return None if failed to parse
[ "Parse", "text", "and", "try", "to", "get", "(", "command", "completable", "word", "index", ")", "Return", "None", "if", "failed", "to", "parse" ]
def _parseCurrentCommand(self): """ Parse text and try to get (command, completable word index) Return None if failed to parse """ # Split line text = self._edit.commandText() words = splitLine(text) if not words: return None # Find command ...
[ "def", "_parseCurrentCommand", "(", "self", ")", ":", "# Split line", "text", "=", "self", ".", "_edit", ".", "commandText", "(", ")", "words", "=", "splitLine", "(", "text", ")", "if", "not", "words", ":", "return", "None", "# Find command", "cmdClass", "...
https://github.com/andreikop/enki/blob/3170059e5cb46dcc77d7fb1457c38a8a5f13af66/enki/core/locator.py#L842-L866
ambakick/Person-Detection-and-Tracking
f925394ac29b5cf321f1ce89a71b193381519a0b
models/ssd_resnet_v1_fpn_feature_extractor.py
python
_SSDResnetV1FpnFeatureExtractor.extract_features
(self, preprocessed_inputs)
return [fpn_features['top_down_block2'], fpn_features['top_down_block3'], fpn_features['top_down_block4'], coarse_features['bottom_up_block5'], coarse_features['bottom_up_block6']]
Extract features from preprocessed inputs. Args: preprocessed_inputs: a [batch, height, width, channels] float tensor representing a batch of images. Returns: feature_maps: a list of tensors where the ith tensor has shape [batch, height_i, width_i, depth_i] Raises: Value...
Extract features from preprocessed inputs.
[ "Extract", "features", "from", "preprocessed", "inputs", "." ]
def extract_features(self, preprocessed_inputs): """Extract features from preprocessed inputs. Args: preprocessed_inputs: a [batch, height, width, channels] float tensor representing a batch of images. Returns: feature_maps: a list of tensors where the ith tensor has shape [bat...
[ "def", "extract_features", "(", "self", ",", "preprocessed_inputs", ")", ":", "if", "self", ".", "_depth_multiplier", "!=", "1.0", ":", "raise", "ValueError", "(", "'Depth multiplier not supported.'", ")", "preprocessed_inputs", "=", "shape_utils", ".", "check_min_ima...
https://github.com/ambakick/Person-Detection-and-Tracking/blob/f925394ac29b5cf321f1ce89a71b193381519a0b/models/ssd_resnet_v1_fpn_feature_extractor.py#L115-L173
ring04h/wyportmap
c4201e2313504e780a7f25238eba2a2d3223e739
sqlalchemy/orm/util.py
python
with_polymorphic
(base, classes, selectable=False, flat=False, polymorphic_on=None, aliased=False, innerjoin=False, _use_mapper_path=False)
return AliasedClass(base, selectable, with_polymorphic_mappers=mappers, with_polymorphic_discriminator=polymorphic_on, use_mapper_path=_use_mapper_path)
Produce an :class:`.AliasedClass` construct which specifies columns for descendant mappers of the given base. .. versionadded:: 0.8 :func:`.orm.with_polymorphic` is in addition to the existing :class:`.Query` method :meth:`.Query.with_polymorphic`, which has the same purpose but is not ...
Produce an :class:`.AliasedClass` construct which specifies columns for descendant mappers of the given base.
[ "Produce", "an", ":", "class", ":", ".", "AliasedClass", "construct", "which", "specifies", "columns", "for", "descendant", "mappers", "of", "the", "given", "base", "." ]
def with_polymorphic(base, classes, selectable=False, flat=False, polymorphic_on=None, aliased=False, innerjoin=False, _use_mapper_path=False): """Produce an :class:`.AliasedClass` construct which specifies columns for descendant mappers of the give...
[ "def", "with_polymorphic", "(", "base", ",", "classes", ",", "selectable", "=", "False", ",", "flat", "=", "False", ",", "polymorphic_on", "=", "None", ",", "aliased", "=", "False", ",", "innerjoin", "=", "False", ",", "_use_mapper_path", "=", "False", ")"...
https://github.com/ring04h/wyportmap/blob/c4201e2313504e780a7f25238eba2a2d3223e739/sqlalchemy/orm/util.py#L641-L718
brightmart/ai_law
33fdcfa20d2b98937f28722b25a263da8a218301
predictor/model.py
python
HierarchicalAttention.dpcnn_pooling_two_conv
(self, conv, layer_index)
return conv
pooling followed with two layers of conv, used by deep pyramid cnn. pooling-->conv-->conv-->skip connection conv:[batch_size,total_sequence_length,embed_size,hpcnn_number_filters] :return:[batch_size,total_sequence_length/2,embed_size/2,hpcnn_number_filters]
pooling followed with two layers of conv, used by deep pyramid cnn. pooling-->conv-->conv-->skip connection conv:[batch_size,total_sequence_length,embed_size,hpcnn_number_filters] :return:[batch_size,total_sequence_length/2,embed_size/2,hpcnn_number_filters]
[ "pooling", "followed", "with", "two", "layers", "of", "conv", "used", "by", "deep", "pyramid", "cnn", ".", "pooling", "--", ">", "conv", "--", ">", "conv", "--", ">", "skip", "connection", "conv", ":", "[", "batch_size", "total_sequence_length", "embed_size"...
def dpcnn_pooling_two_conv(self, conv, layer_index): """ pooling followed with two layers of conv, used by deep pyramid cnn. pooling-->conv-->conv-->skip connection conv:[batch_size,total_sequence_length,embed_size,hpcnn_number_filters] :return:[batch_size,total_sequence_length/2...
[ "def", "dpcnn_pooling_two_conv", "(", "self", ",", "conv", ",", "layer_index", ")", ":", "with", "tf", ".", "variable_scope", "(", "\"pooling_two_conv_\"", "+", "str", "(", "layer_index", ")", ")", ":", "# 1. pooling:max-pooling with size 3 and stride 2==>reduce shape t...
https://github.com/brightmart/ai_law/blob/33fdcfa20d2b98937f28722b25a263da8a218301/predictor/model.py#L296-L316
playframework/play1
0ecac3bc2421ae2dbec27a368bf671eda1c9cba5
python/Lib/pipes.py
python
Template.open_r
(self, file)
return os.popen(cmd, 'r')
t.open_r(file) and t.open_w(file) implement t.open(file, 'r') and t.open(file, 'w') respectively.
t.open_r(file) and t.open_w(file) implement t.open(file, 'r') and t.open(file, 'w') respectively.
[ "t", ".", "open_r", "(", "file", ")", "and", "t", ".", "open_w", "(", "file", ")", "implement", "t", ".", "open", "(", "file", "r", ")", "and", "t", ".", "open", "(", "file", "w", ")", "respectively", "." ]
def open_r(self, file): """t.open_r(file) and t.open_w(file) implement t.open(file, 'r') and t.open(file, 'w') respectively.""" if not self.steps: return open(file, 'r') if self.steps[-1][1] == SINK: raise ValueError, \ 'Template.open_r: pipeline...
[ "def", "open_r", "(", "self", ",", "file", ")", ":", "if", "not", "self", ".", "steps", ":", "return", "open", "(", "file", ",", "'r'", ")", "if", "self", ".", "steps", "[", "-", "1", "]", "[", "1", "]", "==", "SINK", ":", "raise", "ValueError"...
https://github.com/playframework/play1/blob/0ecac3bc2421ae2dbec27a368bf671eda1c9cba5/python/Lib/pipes.py#L162-L171
GoogleCloudPlatform/python-docs-samples
937297c6a31bf4e598c660169d4fb6265eef565a
iot/api-client/codelabs/gateway.py
python
on_message
(unused_client, unused_userdata, message)
Callback when the device receives a message on a subscription.
Callback when the device receives a message on a subscription.
[ "Callback", "when", "the", "device", "receives", "a", "message", "on", "a", "subscription", "." ]
def on_message(unused_client, unused_userdata, message): """Callback when the device receives a message on a subscription.""" payload = message.payload qos = message.qos print('Received message \'{}\' on topic \'{}\' with Qos {}'.format( payload.decode("utf-8"), message.topic, qos)) try:...
[ "def", "on_message", "(", "unused_client", ",", "unused_userdata", ",", "message", ")", ":", "payload", "=", "message", ".", "payload", "qos", "=", "message", ".", "qos", "print", "(", "'Received message \\'{}\\' on topic \\'{}\\' with Qos {}'", ".", "format", "(", ...
https://github.com/GoogleCloudPlatform/python-docs-samples/blob/937297c6a31bf4e598c660169d4fb6265eef565a/iot/api-client/codelabs/gateway.py#L155-L166
Source-Python-Dev-Team/Source.Python
d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb
addons/source-python/Python3/cgi.py
python
FieldStorage.__getitem__
(self, key)
Dictionary style indexing.
Dictionary style indexing.
[ "Dictionary", "style", "indexing", "." ]
def __getitem__(self, key): """Dictionary style indexing.""" if self.list is None: raise TypeError("not indexable") found = [] for item in self.list: if item.name == key: found.append(item) if not found: raise KeyError(key) if len(found...
[ "def", "__getitem__", "(", "self", ",", "key", ")", ":", "if", "self", ".", "list", "is", "None", ":", "raise", "TypeError", "(", "\"not indexable\"", ")", "found", "=", "[", "]", "for", "item", "in", "self", ".", "list", ":", "if", "item", ".", "n...
https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/Python3/cgi.py#L596-L608
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/PIL/OleFileIO.py
python
filetime2datetime
(filetime)
return _FILETIME_null_date + datetime.timedelta(microseconds=filetime//10)
convert FILETIME (64 bits int) to Python datetime.datetime
convert FILETIME (64 bits int) to Python datetime.datetime
[ "convert", "FILETIME", "(", "64", "bits", "int", ")", "to", "Python", "datetime", ".", "datetime" ]
def filetime2datetime(filetime): """ convert FILETIME (64 bits int) to Python datetime.datetime """ # TODO: manage exception when microseconds is too large # inspired from http://code.activestate.com/recipes/511425-filetime-to-datetime/ _FILETIME_null_date = datetime.datetime(1601, 1, 1, 0, 0, 0...
[ "def", "filetime2datetime", "(", "filetime", ")", ":", "# TODO: manage exception when microseconds is too large", "# inspired from http://code.activestate.com/recipes/511425-filetime-to-datetime/", "_FILETIME_null_date", "=", "datetime", ".", "datetime", "(", "1601", ",", "1", ",",...
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/PIL/OleFileIO.py#L511-L519
hzlzh/AlfredWorkflow.com
7055f14f6922c80ea5943839eb0caff11ae57255
Sources/Workflows/SearchKippt/alp/request/bs4/element.py
python
PageElement.find_parent
(self, name=None, attrs={}, **kwargs)
return r
Returns the closest parent of this Tag that matches the given criteria.
Returns the closest parent of this Tag that matches the given criteria.
[ "Returns", "the", "closest", "parent", "of", "this", "Tag", "that", "matches", "the", "given", "criteria", "." ]
def find_parent(self, name=None, attrs={}, **kwargs): """Returns the closest parent of this Tag that matches the given criteria.""" # NOTE: We can't use _find_one because findParents takes a different # set of arguments. r = None l = self.find_parents(name, attrs, 1) ...
[ "def", "find_parent", "(", "self", ",", "name", "=", "None", ",", "attrs", "=", "{", "}", ",", "*", "*", "kwargs", ")", ":", "# NOTE: We can't use _find_one because findParents takes a different", "# set of arguments.", "r", "=", "None", "l", "=", "self", ".", ...
https://github.com/hzlzh/AlfredWorkflow.com/blob/7055f14f6922c80ea5943839eb0caff11ae57255/Sources/Workflows/SearchKippt/alp/request/bs4/element.py#L363-L372
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/vod/v20180717/models.py
python
MediaInputInfo.__init__
(self)
r""" :param Url: 视频 URL。 :type Url: str :param Name: 视频名称。 :type Name: str :param Id: 视频自定义 ID。 :type Id: str
r""" :param Url: 视频 URL。 :type Url: str :param Name: 视频名称。 :type Name: str :param Id: 视频自定义 ID。 :type Id: str
[ "r", ":", "param", "Url", ":", "视频", "URL。", ":", "type", "Url", ":", "str", ":", "param", "Name", ":", "视频名称。", ":", "type", "Name", ":", "str", ":", "param", "Id", ":", "视频自定义", "ID。", ":", "type", "Id", ":", "str" ]
def __init__(self): r""" :param Url: 视频 URL。 :type Url: str :param Name: 视频名称。 :type Name: str :param Id: 视频自定义 ID。 :type Id: str """ self.Url = None self.Name = None self.Id = None
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "Url", "=", "None", "self", ".", "Name", "=", "None", "self", ".", "Id", "=", "None" ]
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/vod/v20180717/models.py#L13670-L13681
buke/GreenOdoo
3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df
runtime/python/lib/python2.7/site-packages/python_ldap-2.4.10-py2.7-linux-x86_64.egg/ldap/dn.py
python
escape_dn_chars
(s)
return s
Escape all DN special characters found in s with a back-slash (see RFC 4514, section 2.4)
Escape all DN special characters found in s with a back-slash (see RFC 4514, section 2.4)
[ "Escape", "all", "DN", "special", "characters", "found", "in", "s", "with", "a", "back", "-", "slash", "(", "see", "RFC", "4514", "section", "2", ".", "4", ")" ]
def escape_dn_chars(s): """ Escape all DN special characters found in s with a back-slash (see RFC 4514, section 2.4) """ if s: s = s.replace('\\','\\\\') s = s.replace(',' ,'\\,') s = s.replace('+' ,'\\+') s = s.replace('"' ,'\\"') s = s.replace('<' ,'\\<') s = s.replace('>' ,'\\>') ...
[ "def", "escape_dn_chars", "(", "s", ")", ":", "if", "s", ":", "s", "=", "s", ".", "replace", "(", "'\\\\'", ",", "'\\\\\\\\'", ")", "s", "=", "s", ".", "replace", "(", "','", ",", "'\\\\,'", ")", "s", "=", "s", ".", "replace", "(", "'+'", ",", ...
https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/site-packages/python_ldap-2.4.10-py2.7-linux-x86_64.egg/ldap/dn.py#L20-L39
francisck/DanderSpritz_docs
86bb7caca5a957147f120b18bb5c31f299914904
Python/Core/Lib/xml/sax/handler.py
python
ErrorHandler.fatalError
(self, exception)
Handle a non-recoverable error.
Handle a non-recoverable error.
[ "Handle", "a", "non", "-", "recoverable", "error", "." ]
def fatalError(self, exception): """Handle a non-recoverable error.""" raise exception
[ "def", "fatalError", "(", "self", ",", "exception", ")", ":", "raise", "exception" ]
https://github.com/francisck/DanderSpritz_docs/blob/86bb7caca5a957147f120b18bb5c31f299914904/Python/Core/Lib/xml/sax/handler.py#L32-L34
lxdock/lxdock
f71006d130bc8b53603eea36a546003495437493
lxdock/project.py
python
Project.__init__
(self, name, homedir, client, containers, provisioning_steps)
[]
def __init__(self, name, homedir, client, containers, provisioning_steps): self.name = name self.homedir = homedir self.client = client self.containers = containers self.provisioning_steps = provisioning_steps
[ "def", "__init__", "(", "self", ",", "name", ",", "homedir", ",", "client", ",", "containers", ",", "provisioning_steps", ")", ":", "self", ".", "name", "=", "name", "self", ".", "homedir", "=", "homedir", "self", ".", "client", "=", "client", "self", ...
https://github.com/lxdock/lxdock/blob/f71006d130bc8b53603eea36a546003495437493/lxdock/project.py#L20-L25
wxWidgets/Phoenix
b2199e299a6ca6d866aa6f3d0888499136ead9d6
wx/lib/docview.py
python
DocPrintout.GetView
(self)
return self._printoutView
Returns the DocPrintout's view.
Returns the DocPrintout's view.
[ "Returns", "the", "DocPrintout", "s", "view", "." ]
def GetView(self): """ Returns the DocPrintout's view. """ return self._printoutView
[ "def", "GetView", "(", "self", ")", ":", "return", "self", ".", "_printoutView" ]
https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/docview.py#L2887-L2891
catap/namebench
9913a7a1a7955a3759eb18cbe73b421441a7a00f
nb_third_party/jinja2/utils.py
python
Markup.striptags
(self)
return Markup(stripped).unescape()
r"""Unescape markup into an unicode string and strip all tags. This also resolves known HTML4 and XHTML entities. Whitespace is normalized to one: >>> Markup("Main &raquo; <em>About</em>").striptags() u'Main \xbb About'
r"""Unescape markup into an unicode string and strip all tags. This also resolves known HTML4 and XHTML entities. Whitespace is normalized to one:
[ "r", "Unescape", "markup", "into", "an", "unicode", "string", "and", "strip", "all", "tags", ".", "This", "also", "resolves", "known", "HTML4", "and", "XHTML", "entities", ".", "Whitespace", "is", "normalized", "to", "one", ":" ]
def striptags(self): r"""Unescape markup into an unicode string and strip all tags. This also resolves known HTML4 and XHTML entities. Whitespace is normalized to one: >>> Markup("Main &raquo; <em>About</em>").striptags() u'Main \xbb About' """ stripped = u' '...
[ "def", "striptags", "(", "self", ")", ":", "stripped", "=", "u' '", ".", "join", "(", "_striptags_re", ".", "sub", "(", "''", ",", "self", ")", ".", "split", "(", ")", ")", "return", "Markup", "(", "stripped", ")", ".", "unescape", "(", ")" ]
https://github.com/catap/namebench/blob/9913a7a1a7955a3759eb18cbe73b421441a7a00f/nb_third_party/jinja2/utils.py#L474-L483
KalleHallden/AutoTimer
2d954216700c4930baa154e28dbddc34609af7ce
env/lib/python2.7/site-packages/pip/_vendor/urllib3/connectionpool.py
python
HTTPConnectionPool._raise_timeout
(self, err, url, timeout_value)
Is the error actually a timeout? Will raise a ReadTimeout or pass
Is the error actually a timeout? Will raise a ReadTimeout or pass
[ "Is", "the", "error", "actually", "a", "timeout?", "Will", "raise", "a", "ReadTimeout", "or", "pass" ]
def _raise_timeout(self, err, url, timeout_value): """Is the error actually a timeout? Will raise a ReadTimeout or pass""" if isinstance(err, SocketTimeout): raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value) # See the above comment about EAGAIN ...
[ "def", "_raise_timeout", "(", "self", ",", "err", ",", "url", ",", "timeout_value", ")", ":", "if", "isinstance", "(", "err", ",", "SocketTimeout", ")", ":", "raise", "ReadTimeoutError", "(", "self", ",", "url", ",", "\"Read timed out. (read timeout=%s)\"", "%...
https://github.com/KalleHallden/AutoTimer/blob/2d954216700c4930baa154e28dbddc34609af7ce/env/lib/python2.7/site-packages/pip/_vendor/urllib3/connectionpool.py#L303-L318
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/chdfs/v20190718/models.py
python
DescribeResourceTagsRequest.__init__
(self)
r""" :param FileSystemId: 文件系统ID :type FileSystemId: str
r""" :param FileSystemId: 文件系统ID :type FileSystemId: str
[ "r", ":", "param", "FileSystemId", ":", "文件系统ID", ":", "type", "FileSystemId", ":", "str" ]
def __init__(self): r""" :param FileSystemId: 文件系统ID :type FileSystemId: str """ self.FileSystemId = None
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "FileSystemId", "=", "None" ]
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/chdfs/v20190718/models.py#L1028-L1033
openbmc/openbmc
5f4109adae05f4d6925bfe960007d52f98c61086
poky/scripts/contrib/oe-build-perf-report-email.py
python
parse_args
(argv)
return args
Parse command line arguments
Parse command line arguments
[ "Parse", "command", "line", "arguments" ]
def parse_args(argv): """Parse command line arguments""" description = """Email build perf test report""" parser = argparse.ArgumentParser( formatter_class=argparse.ArgumentDefaultsHelpFormatter, description=description) parser.add_argument('--debug', '-d', action='store_true', ...
[ "def", "parse_args", "(", "argv", ")", ":", "description", "=", "\"\"\"Email build perf test report\"\"\"", "parser", "=", "argparse", ".", "ArgumentParser", "(", "formatter_class", "=", "argparse", ".", "ArgumentDefaultsHelpFormatter", ",", "description", "=", "descrip...
https://github.com/openbmc/openbmc/blob/5f4109adae05f4d6925bfe960007d52f98c61086/poky/scripts/contrib/oe-build-perf-report-email.py#L56-L90
facebookresearch/FixRes
c9be6acc7a6b32f896e62c28a97c20c2348327d3
imnet_finetune/Res.py
python
conv1x1
(in_planes, out_planes, stride=1)
return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride, bias=False)
1x1 convolution
1x1 convolution
[ "1x1", "convolution" ]
def conv1x1(in_planes, out_planes, stride=1): """1x1 convolution""" return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride, bias=False)
[ "def", "conv1x1", "(", "in_planes", ",", "out_planes", ",", "stride", "=", "1", ")", ":", "return", "nn", ".", "Conv2d", "(", "in_planes", ",", "out_planes", ",", "kernel_size", "=", "1", ",", "stride", "=", "stride", ",", "bias", "=", "False", ")" ]
https://github.com/facebookresearch/FixRes/blob/c9be6acc7a6b32f896e62c28a97c20c2348327d3/imnet_finetune/Res.py#L36-L38
OpenEndedGroup/Field
4f7c8edfb01bb0ccc927b78d3c500f018a4ae37c
Contents/lib/python/getpass.py
python
getuser
()
return pwd.getpwuid(os.getuid())[0]
Get the username from the environment or password database. First try various environment variables, then the password database. This works on Windows as long as USERNAME is set.
Get the username from the environment or password database.
[ "Get", "the", "username", "from", "the", "environment", "or", "password", "database", "." ]
def getuser(): """Get the username from the environment or password database. First try various environment variables, then the password database. This works on Windows as long as USERNAME is set. """ for name in ('LOGNAME', 'USER', 'LNAME', 'USERNAME'): user = os.environ.get(name) ...
[ "def", "getuser", "(", ")", ":", "for", "name", "in", "(", "'LOGNAME'", ",", "'USER'", ",", "'LNAME'", ",", "'USERNAME'", ")", ":", "user", "=", "os", ".", "environ", ".", "get", "(", "name", ")", "if", "user", ":", "return", "user", "# If this fails...
https://github.com/OpenEndedGroup/Field/blob/4f7c8edfb01bb0ccc927b78d3c500f018a4ae37c/Contents/lib/python/getpass.py#L121-L136
oilshell/oil
94388e7d44a9ad879b12615f6203b38596b5a2d3
Python-2.7.13/Lib/xmlrpclib.py
python
ServerProxy.__repr__
(self)
return ( "<ServerProxy for %s%s>" % (self.__host, self.__handler) )
[]
def __repr__(self): return ( "<ServerProxy for %s%s>" % (self.__host, self.__handler) )
[ "def", "__repr__", "(", "self", ")", ":", "return", "(", "\"<ServerProxy for %s%s>\"", "%", "(", "self", ".", "__host", ",", "self", ".", "__handler", ")", ")" ]
https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/xmlrpclib.py#L1610-L1614
ethereum/research
f64776763a8687cbe220421e292e6e45db3d9172
verkle_trie_eip/verkle_trie.py
python
make_ipa_multiproof
(Cs, fs, zs, ys, display_times=True)
return D.serialize(), ipa_proof
Computes an IPA multiproof according to the schema described here: https://dankradfeist.de/ethereum/2021/06/18/pcs-multiproofs.html This proof makes the assumption that the domain is the integers 0, 1, 2, ... WIDTH - 1
Computes an IPA multiproof according to the schema described here: https://dankradfeist.de/ethereum/2021/06/18/pcs-multiproofs.html
[ "Computes", "an", "IPA", "multiproof", "according", "to", "the", "schema", "described", "here", ":", "https", ":", "//", "dankradfeist", ".", "de", "/", "ethereum", "/", "2021", "/", "06", "/", "18", "/", "pcs", "-", "multiproofs", ".", "html" ]
def make_ipa_multiproof(Cs, fs, zs, ys, display_times=True): """ Computes an IPA multiproof according to the schema described here: https://dankradfeist.de/ethereum/2021/06/18/pcs-multiproofs.html This proof makes the assumption that the domain is the integers 0, 1, 2, ... WIDTH - 1 """ # Step...
[ "def", "make_ipa_multiproof", "(", "Cs", ",", "fs", ",", "zs", ",", "ys", ",", "display_times", "=", "True", ")", ":", "# Step 1: Construct g(X) polynomial in evaluation form", "r", "=", "ipa_utils", ".", "hash_to_field", "(", "Cs", "+", "zs", "+", "ys", ")", ...
https://github.com/ethereum/research/blob/f64776763a8687cbe220421e292e6e45db3d9172/verkle_trie_eip/verkle_trie.py#L406-L466
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/Python-2.7.9/Lib/ssl.py
python
SSLSocket._real_connect
(self, addr, connect_ex)
[]
def _real_connect(self, addr, connect_ex): if self.server_side: raise ValueError("can't connect in server-side mode") # Here we assume that the socket is client-side, and not # connected at the time of the call. We connect it, then wrap it. if self._connected: ra...
[ "def", "_real_connect", "(", "self", ",", "addr", ",", "connect_ex", ")", ":", "if", "self", ".", "server_side", ":", "raise", "ValueError", "(", "\"can't connect in server-side mode\"", ")", "# Here we assume that the socket is client-side, and not", "# connected at the ti...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/ssl.py#L798-L819
google-research/sound-separation
0b23ae22123b041b9538295f32a92151cb77bff9
models/train/data_meeting_io.py
python
_read_meeting_list
(meeting_list, meeting_length_type)
return (num_meetings, max_num_spk_per_meeting, max_num_utt_per_spk, max_dia_seg_per_utt, max_utt_length, meeting_length, speaker_ids)
Reads meeting list from json file to get necessary information. Args: meeting_list: A meeting list read from a json file. meeting_length_type: One of 'maximum', 'minimum' or 'average'. Since typically meeting lengths are not fixed, we can set the training/eval length to the maximum, minimum or av...
Reads meeting list from json file to get necessary information.
[ "Reads", "meeting", "list", "from", "json", "file", "to", "get", "necessary", "information", "." ]
def _read_meeting_list(meeting_list, meeting_length_type): """Reads meeting list from json file to get necessary information. Args: meeting_list: A meeting list read from a json file. meeting_length_type: One of 'maximum', 'minimum' or 'average'. Since typically meeting lengths are not fixed, we can ...
[ "def", "_read_meeting_list", "(", "meeting_list", ",", "meeting_length_type", ")", ":", "max_num_spk_per_meeting", "=", "0", "max_num_utt_per_meeting", "=", "0", "meeting_lengths", "=", "[", "]", "speaker_id_to_count", "=", "collections", ".", "defaultdict", "(", "int...
https://github.com/google-research/sound-separation/blob/0b23ae22123b041b9538295f32a92151cb77bff9/models/train/data_meeting_io.py#L91-L166
git-cola/git-cola
b48b8028e0c3baf47faf7b074b9773737358163d
cola/widgets/standard.py
python
WidgetMixin.init_size
(self, parent=None, settings=None, width=0, height=0)
[]
def init_size(self, parent=None, settings=None, width=0, height=0): if not width: width = defs.dialog_w if not height: height = defs.dialog_h self.init_state(settings, self.resize_to_parent, parent, width, height)
[ "def", "init_size", "(", "self", ",", "parent", "=", "None", ",", "settings", "=", "None", ",", "width", "=", "0", ",", "height", "=", "0", ")", ":", "if", "not", "width", ":", "width", "=", "defs", ".", "dialog_w", "if", "not", "height", ":", "h...
https://github.com/git-cola/git-cola/blob/b48b8028e0c3baf47faf7b074b9773737358163d/cola/widgets/standard.py#L126-L131
ConsenSys/mythril
d00152f8e4d925c7749d63b533152a937e1dd516
mythril/support/signatures.py
python
SQLiteDB.__enter__
(self)
return self.cursor
:return:
[]
def __enter__(self): """ :return: """ self.conn = sqlite3.connect(self.path) self.cursor = self.conn.cursor() return self.cursor
[ "def", "__enter__", "(", "self", ")", ":", "self", ".", "conn", "=", "sqlite3", ".", "connect", "(", "self", ".", "path", ")", "self", ".", "cursor", "=", "self", ".", "conn", ".", "cursor", "(", ")", "return", "self", ".", "cursor" ]
https://github.com/ConsenSys/mythril/blob/d00152f8e4d925c7749d63b533152a937e1dd516/mythril/support/signatures.py#L91-L98
Pyomo/pyomo
dbd4faee151084f343b893cc2b0c04cf2b76fd92
pyomo/contrib/viewer/residual_table.py
python
ResidualDataModel.headerData
(self, i, orientation, role=QtCore.Qt.DisplayRole)
return None
Return the column headings for the horizontal header and index numbers for the vertical header.
Return the column headings for the horizontal header and index numbers for the vertical header.
[ "Return", "the", "column", "headings", "for", "the", "horizontal", "header", "and", "index", "numbers", "for", "the", "vertical", "header", "." ]
def headerData(self, i, orientation, role=QtCore.Qt.DisplayRole): ''' Return the column headings for the horizontal header and index numbers for the vertical header. ''' if orientation == QtCore.Qt.Horizontal and role == QtCore.Qt.DisplayRole: return self.colu...
[ "def", "headerData", "(", "self", ",", "i", ",", "orientation", ",", "role", "=", "QtCore", ".", "Qt", ".", "DisplayRole", ")", ":", "if", "orientation", "==", "QtCore", ".", "Qt", ".", "Horizontal", "and", "role", "==", "QtCore", ".", "Qt", ".", "Di...
https://github.com/Pyomo/pyomo/blob/dbd4faee151084f343b893cc2b0c04cf2b76fd92/pyomo/contrib/viewer/residual_table.py#L114-L121
reddit-archive/reddit
753b17407e9a9dca09558526805922de24133d53
r2/r2/controllers/front.py
python
FrontController.GET_rules
(self)
return ModToolsPage( title=title_string, content=content, extra_js_config=extra_js_config, ).render()
Get the rules for the current subreddit
Get the rules for the current subreddit
[ "Get", "the", "rules", "for", "the", "current", "subreddit" ]
def GET_rules(self): """Get the rules for the current subreddit""" if not feature.is_enabled("subreddit_rules", subreddit=c.site.name): abort(404) if isinstance(c.site, FakeSubreddit): abort(404) kind_labels = { "all": _("Posts & Comments"), ...
[ "def", "GET_rules", "(", "self", ")", ":", "if", "not", "feature", ".", "is_enabled", "(", "\"subreddit_rules\"", ",", "subreddit", "=", "c", ".", "site", ".", "name", ")", ":", "abort", "(", "404", ")", "if", "isinstance", "(", "c", ".", "site", ","...
https://github.com/reddit-archive/reddit/blob/753b17407e9a9dca09558526805922de24133d53/r2/r2/controllers/front.py#L962-L984
thu-ml/zhusuan
4386b2a12ae4f4ed8e694e504e51d7dcdfd6f22a
zhusuan/evaluation.py
python
is_loglikelihood
(meta_bn, observed, latent=None, axis=None, proposal=None)
return ImportanceWeightedObjective( meta_bn, observed, latent=latent, axis=axis, variational=proposal).tensor
Marginal log likelihood (:math:`\log p(x)`) estimates using self-normalized importance sampling. :param meta_bn: A :class:`~zhusuan.framework.meta_bn.MetaBayesianNet` instance or a log joint probability function. For the latter, it must accepts a dictionary argument of ``(string, Tensor...
Marginal log likelihood (:math:`\log p(x)`) estimates using self-normalized importance sampling.
[ "Marginal", "log", "likelihood", "(", ":", "math", ":", "\\", "log", "p", "(", "x", ")", ")", "estimates", "using", "self", "-", "normalized", "importance", "sampling", "." ]
def is_loglikelihood(meta_bn, observed, latent=None, axis=None, proposal=None): """ Marginal log likelihood (:math:`\log p(x)`) estimates using self-normalized importance sampling. :param meta_bn: A :class:`~zhusuan.framework.meta_bn.MetaBayesianNet` instance or a log joint...
[ "def", "is_loglikelihood", "(", "meta_bn", ",", "observed", ",", "latent", "=", "None", ",", "axis", "=", "None", ",", "proposal", "=", "None", ")", ":", "return", "ImportanceWeightedObjective", "(", "meta_bn", ",", "observed", ",", "latent", "=", "latent", ...
https://github.com/thu-ml/zhusuan/blob/4386b2a12ae4f4ed8e694e504e51d7dcdfd6f22a/zhusuan/evaluation.py#L22-L54
twilio/twilio-python
6e1e811ea57a1edfadd5161ace87397c563f6915
twilio/rest/autopilot/v1/assistant/defaults.py
python
DefaultsContext.update
(self, defaults=values.unset)
return DefaultsInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], )
Update the DefaultsInstance :param dict defaults: A JSON string that describes the default task links. :returns: The updated DefaultsInstance :rtype: twilio.rest.autopilot.v1.assistant.defaults.DefaultsInstance
Update the DefaultsInstance
[ "Update", "the", "DefaultsInstance" ]
def update(self, defaults=values.unset): """ Update the DefaultsInstance :param dict defaults: A JSON string that describes the default task links. :returns: The updated DefaultsInstance :rtype: twilio.rest.autopilot.v1.assistant.defaults.DefaultsInstance """ da...
[ "def", "update", "(", "self", ",", "defaults", "=", "values", ".", "unset", ")", ":", "data", "=", "values", ".", "of", "(", "{", "'Defaults'", ":", "serialize", ".", "object", "(", "defaults", ")", ",", "}", ")", "payload", "=", "self", ".", "_ver...
https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/autopilot/v1/assistant/defaults.py#L139-L152
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/tablib-0.12.1/tablib/packages/dbfpy/fields.py
python
DbfFieldDef.encodeValue
(self, value)
Return str object containing encoded field value. This is an abstract method and it must be overriden in child classes.
Return str object containing encoded field value.
[ "Return", "str", "object", "containing", "encoded", "field", "value", "." ]
def encodeValue(self, value): """Return str object containing encoded field value. This is an abstract method and it must be overriden in child classes. """ raise NotImplementedError
[ "def", "encodeValue", "(", "self", ",", "value", ")", ":", "raise", "NotImplementedError" ]
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/tablib-0.12.1/tablib/packages/dbfpy/fields.py#L190-L195
SciTools/iris
a12d0b15bab3377b23a148e891270b13a0419c38
lib/iris/fileformats/pp.py
python
PPField3.t2
(self)
return self._t2
A cftime.datetime object consisting of the lbyrd, lbmond, lbdatd, lbhrd, lbmind, and lbsecd attributes.
A cftime.datetime object consisting of the lbyrd, lbmond, lbdatd, lbhrd, lbmind, and lbsecd attributes.
[ "A", "cftime", ".", "datetime", "object", "consisting", "of", "the", "lbyrd", "lbmond", "lbdatd", "lbhrd", "lbmind", "and", "lbsecd", "attributes", "." ]
def t2(self): """ A cftime.datetime object consisting of the lbyrd, lbmond, lbdatd, lbhrd, lbmind, and lbsecd attributes. """ if not hasattr(self, "_t2"): has_year_zero = self.lbyrd == 0 calendar = ( None if self.lbmond == 0 or self.lbdatd...
[ "def", "t2", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "\"_t2\"", ")", ":", "has_year_zero", "=", "self", ".", "lbyrd", "==", "0", "calendar", "=", "(", "None", "if", "self", ".", "lbmond", "==", "0", "or", "self", ".", "lb...
https://github.com/SciTools/iris/blob/a12d0b15bab3377b23a148e891270b13a0419c38/lib/iris/fileformats/pp.py#L1587-L1608
yask123/all_leetcode_questions
e1d35cc4b5d0938e69f33562cd8b6cc13ac2a5d1
export_all_questions.py
python
update_question_links
(question_links)
[]
def update_question_links(question_links): with open('question_links.txt') as f: links = f.read() links = links.split('\n') for each in links: if '/problems/' in each: question_links.append(each)
[ "def", "update_question_links", "(", "question_links", ")", ":", "with", "open", "(", "'question_links.txt'", ")", "as", "f", ":", "links", "=", "f", ".", "read", "(", ")", "links", "=", "links", ".", "split", "(", "'\\n'", ")", "for", "each", "in", "l...
https://github.com/yask123/all_leetcode_questions/blob/e1d35cc4b5d0938e69f33562cd8b6cc13ac2a5d1/export_all_questions.py#L5-L14
lbryio/lbry-sdk
f78e3825ca0f130834d3876a824f9d380501ced8
lbry/extras/daemon/daemon.py
python
Daemon.jsonrpc_purchase_create
( self, claim_id=None, url=None, wallet_id=None, funding_account_ids=None, allow_duplicate_purchase=False, override_max_key_fee=False, preview=False, blocking=False)
return tx
Purchase a claim. Usage: purchase_create (--claim_id=<claim_id> | --url=<url>) [--wallet_id=<wallet_id>] [--funding_account_ids=<funding_account_ids>...] [--allow_duplicate_purchase] [--override_max_key_fee] [--preview] [--blocking] Options: ...
Purchase a claim.
[ "Purchase", "a", "claim", "." ]
async def jsonrpc_purchase_create( self, claim_id=None, url=None, wallet_id=None, funding_account_ids=None, allow_duplicate_purchase=False, override_max_key_fee=False, preview=False, blocking=False): """ Purchase a claim. Usage: purchase_create (--claim_id=<c...
[ "async", "def", "jsonrpc_purchase_create", "(", "self", ",", "claim_id", "=", "None", ",", "url", "=", "None", ",", "wallet_id", "=", "None", ",", "funding_account_ids", "=", "None", ",", "allow_duplicate_purchase", "=", "False", ",", "override_max_key_fee", "="...
https://github.com/lbryio/lbry-sdk/blob/f78e3825ca0f130834d3876a824f9d380501ced8/lbry/extras/daemon/daemon.py#L2274-L2327
githubmaidou/tools
d957a0d333a2c6febed02cfa99ec405d64a1352d
dnsbrute.py
python
dnsbrute.check_cdn
(self,domain)
return True
检测是否有泛解析
检测是否有泛解析
[ "检测是否有泛解析" ]
def check_cdn(self,domain): """检测是否有泛解析""" if not self.gethostbyname('x1x2x3x4dns',domain): return False return True
[ "def", "check_cdn", "(", "self", ",", "domain", ")", ":", "if", "not", "self", ".", "gethostbyname", "(", "'x1x2x3x4dns'", ",", "domain", ")", ":", "return", "False", "return", "True" ]
https://github.com/githubmaidou/tools/blob/d957a0d333a2c6febed02cfa99ec405d64a1352d/dnsbrute.py#L54-L58
IronLanguages/ironpython3
7a7bb2a872eeab0d1009fc8a6e24dca43f65b693
Src/Scripts/make_meta1.py
python
Class.make_invoke_method
(self, nargs)
return ret
[]
def make_invoke_method(self, nargs): params = ["PyString name"] args = ["name"] for i in range(nargs): params.append("PyObject arg%d" % i) args.append("arg%d" % i) ret = ["public override PyObject invoke(%s) {" % ", ".join(params)] ret.append(" if (name...
[ "def", "make_invoke_method", "(", "self", ",", "nargs", ")", ":", "params", "=", "[", "\"PyString name\"", "]", "args", "=", "[", "\"name\"", "]", "for", "i", "in", "range", "(", "nargs", ")", ":", "params", ".", "append", "(", "\"PyObject arg%d\"", "%",...
https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/Scripts/make_meta1.py#L159-L182
google/rekall
55d1925f2df9759a989b35271b4fa48fc54a1c86
rekall-core/rekall/plugins/windows/gui/win32k_core.py
python
tagTHREADINFO.hooks
(self)
Generator for tagHOOK info.
Generator for tagHOOK info.
[ "Generator", "for", "tagHOOK", "info", "." ]
def hooks(self): """Generator for tagHOOK info.""" fsHooks = self.fsHooks for pos, (name, value) in enumerate(constants.MESSAGE_TYPES): # Is the bit for this message type WH_* value set ? if fsHooks & (1 << value + 1): for hook in self.aphkStart[pos].walk...
[ "def", "hooks", "(", "self", ")", ":", "fsHooks", "=", "self", ".", "fsHooks", "for", "pos", ",", "(", "name", ",", "value", ")", "in", "enumerate", "(", "constants", ".", "MESSAGE_TYPES", ")", ":", "# Is the bit for this message type WH_* value set ?", "if", ...
https://github.com/google/rekall/blob/55d1925f2df9759a989b35271b4fa48fc54a1c86/rekall-core/rekall/plugins/windows/gui/win32k_core.py#L666-L674
numba/numba
bf480b9e0da858a65508c2b17759a72ee6a44c51
numba/np/npdatetime.py
python
timedelta_add_impl
(context, builder, sig, args)
return impl_ret_untracked(context, builder, sig.return_type, res)
[]
def timedelta_add_impl(context, builder, sig, args): [va, vb] = args [ta, tb] = sig.args ret = alloc_timedelta_result(builder) with cgutils.if_likely(builder, are_not_nat(builder, [va, vb])): va = scale_timedelta(context, builder, va, ta, sig.return_type) vb = scale_timedelta(context, bu...
[ "def", "timedelta_add_impl", "(", "context", ",", "builder", ",", "sig", ",", "args", ")", ":", "[", "va", ",", "vb", "]", "=", "args", "[", "ta", ",", "tb", "]", "=", "sig", ".", "args", "ret", "=", "alloc_timedelta_result", "(", "builder", ")", "...
https://github.com/numba/numba/blob/bf480b9e0da858a65508c2b17759a72ee6a44c51/numba/np/npdatetime.py#L185-L194
TurboGears/tg2
f40a82d016d70ce560002593b4bb8f83b57f87b3
tg/renderers/genshi.py
python
GenshiRenderer.__call__
(self, template_name, template_vars, **kwargs)
return cached_template(template_name, render_template, ns_options=('doctype', 'method'), **kwargs)
Render the template_vars with the Genshi template. If you don't pass a doctype or pass 'auto' as the doctype, then the doctype will be automatically determined. If you pass a doctype of None, then no doctype will be injected. If you don't pass a method or pass 'auto' as the method, ...
Render the template_vars with the Genshi template.
[ "Render", "the", "template_vars", "with", "the", "Genshi", "template", "." ]
def __call__(self, template_name, template_vars, **kwargs): """Render the template_vars with the Genshi template. If you don't pass a doctype or pass 'auto' as the doctype, then the doctype will be automatically determined. If you pass a doctype of None, then no doctype will be injected...
[ "def", "__call__", "(", "self", ",", "template_name", ",", "template_vars", ",", "*", "*", "kwargs", ")", ":", "response", "=", "tg", ".", "response", ".", "_current_obj", "(", ")", "template_vars", ".", "update", "(", "self", ".", "genshi_functions", ")",...
https://github.com/TurboGears/tg2/blob/f40a82d016d70ce560002593b4bb8f83b57f87b3/tg/renderers/genshi.py#L174-L220
LinOTP/LinOTP
bb3940bbaccea99550e6c063ff824f258dd6d6d7
linotp/controllers/selfservice.py
python
SelfserviceController.getotp
(self)
return render("/selfservice/getotp.mako")
In this form, the user can retrieve OTP values
In this form, the user can retrieve OTP values
[ "In", "this", "form", "the", "user", "can", "retrieve", "OTP", "values" ]
def getotp(self): """ In this form, the user can retrieve OTP values """ return render("/selfservice/getotp.mako")
[ "def", "getotp", "(", "self", ")", ":", "return", "render", "(", "\"/selfservice/getotp.mako\"", ")" ]
https://github.com/LinOTP/LinOTP/blob/bb3940bbaccea99550e6c063ff824f258dd6d6d7/linotp/controllers/selfservice.py#L478-L482
AndrewAnnex/SpiceyPy
9f8b626338f119bacd39ef2ba94a6f71bd6341c0
src/spiceypy/spiceypy.py
python
kplfrm
(frmcls: int, out_cell: Optional[SpiceCell] = None)
return out_cell
Return a SPICE set containing the frame IDs of all reference frames of a given class having specifications in the kernel pool. https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/kplfrm_c.html :param frmcls: Frame class. :param out_cell: Optional output Spice Int Cell :return: Set of ID codes...
Return a SPICE set containing the frame IDs of all reference frames of a given class having specifications in the kernel pool.
[ "Return", "a", "SPICE", "set", "containing", "the", "frame", "IDs", "of", "all", "reference", "frames", "of", "a", "given", "class", "having", "specifications", "in", "the", "kernel", "pool", "." ]
def kplfrm(frmcls: int, out_cell: Optional[SpiceCell] = None) -> SpiceCell: """ Return a SPICE set containing the frame IDs of all reference frames of a given class having specifications in the kernel pool. https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/kplfrm_c.html :param frmcls: Frame...
[ "def", "kplfrm", "(", "frmcls", ":", "int", ",", "out_cell", ":", "Optional", "[", "SpiceCell", "]", "=", "None", ")", "->", "SpiceCell", ":", "if", "not", "out_cell", ":", "out_cell", "=", "stypes", ".", "SPICEINT_CELL", "(", "1000", ")", "frmcls", "=...
https://github.com/AndrewAnnex/SpiceyPy/blob/9f8b626338f119bacd39ef2ba94a6f71bd6341c0/src/spiceypy/spiceypy.py#L7914-L7929
vita-epfl/monoloco
f5e82c48e8ee5af352f2c9b1690050f4e02fc1b6
monoloco/utils/camera.py
python
xyz_from_distance
(distances, xy_centers)
return xy_centers * distances / torch.sqrt(1 + xy_centers[:, 0:1].pow(2) + xy_centers[:, 1:2].pow(2))
From distances and normalized image coordinates (z=1), extract the real world position xyz distances --> tensor (m,1) or (m) or float xy_centers --> tensor(m,3) or (3)
From distances and normalized image coordinates (z=1), extract the real world position xyz distances --> tensor (m,1) or (m) or float xy_centers --> tensor(m,3) or (3)
[ "From", "distances", "and", "normalized", "image", "coordinates", "(", "z", "=", "1", ")", "extract", "the", "real", "world", "position", "xyz", "distances", "--", ">", "tensor", "(", "m", "1", ")", "or", "(", "m", ")", "or", "float", "xy_centers", "--...
def xyz_from_distance(distances, xy_centers): """ From distances and normalized image coordinates (z=1), extract the real world position xyz distances --> tensor (m,1) or (m) or float xy_centers --> tensor(m,3) or (3) """ if isinstance(distances, float): distances = torch.tensor(distanc...
[ "def", "xyz_from_distance", "(", "distances", ",", "xy_centers", ")", ":", "if", "isinstance", "(", "distances", ",", "float", ")", ":", "distances", "=", "torch", ".", "tensor", "(", "distances", ")", ".", "unsqueeze", "(", "0", ")", "if", "len", "(", ...
https://github.com/vita-epfl/monoloco/blob/f5e82c48e8ee5af352f2c9b1690050f4e02fc1b6/monoloco/utils/camera.py#L161-L177
thiagopena/djangoSIGE
e32186b27bfd8acf21b0fa400e699cb5c73e5433
djangosige/apps/vendas/views/vendas.py
python
AdicionarVendaView.get
(self, request, form_class, *args, **kwargs)
return self.render_to_response(self.get_context_data(form=form, produtos_form=produtos_form, pagamento_form=pagamento_form))
[]
def get(self, request, form_class, *args, **kwargs): self.object = None form = self.get_form(form_class) form.initial['vendedor'] = request.user.first_name or request.user form.initial['data_emissao'] = datetime.today().strftime('%d/%m/%Y') produtos_form = ItensVendaFormSet(pre...
[ "def", "get", "(", "self", ",", "request", ",", "form_class", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "object", "=", "None", "form", "=", "self", ".", "get_form", "(", "form_class", ")", "form", ".", "initial", "[", "'vend...
https://github.com/thiagopena/djangoSIGE/blob/e32186b27bfd8acf21b0fa400e699cb5c73e5433/djangosige/apps/vendas/views/vendas.py#L31-L43
micahhausler/container-transform
68223fae98f30b8bb2ce0f02ba9e58afbc80f196
container_transform/marathon.py
python
MarathonTransformer.ingest_memory
(self, memory)
return memory << 20
[]
def ingest_memory(self, memory): return memory << 20
[ "def", "ingest_memory", "(", "self", ",", "memory", ")", ":", "return", "memory", "<<", "20" ]
https://github.com/micahhausler/container-transform/blob/68223fae98f30b8bb2ce0f02ba9e58afbc80f196/container_transform/marathon.py#L281-L282
SteveDoyle2/pyNastran
eda651ac2d4883d95a34951f8a002ff94f642a1a
pyNastran/bdf/bdf.py
python
BDF_.get_displacement_index
(self)
return nids_all, nids_transform, icd_transform
Get index and transformation matricies for nodes with their output in coordinate systems other than the global. Used in combination with ``OP2.transform_displacements_to_global`` Returns ------- nids_all : (nnodes,) int ndarray the GRID/SPOINT/EPOINT ids nids...
Get index and transformation matricies for nodes with their output in coordinate systems other than the global. Used in combination with ``OP2.transform_displacements_to_global``
[ "Get", "index", "and", "transformation", "matricies", "for", "nodes", "with", "their", "output", "in", "coordinate", "systems", "other", "than", "the", "global", ".", "Used", "in", "combination", "with", "OP2", ".", "transform_displacements_to_global" ]
def get_displacement_index(self) -> Tuple[Any, Any, Dict[int, Any]]: """ Get index and transformation matricies for nodes with their output in coordinate systems other than the global. Used in combination with ``OP2.transform_displacements_to_global`` Returns ------- ...
[ "def", "get_displacement_index", "(", "self", ")", "->", "Tuple", "[", "Any", ",", "Any", ",", "Dict", "[", "int", ",", "Any", "]", "]", ":", "nids_transform", "=", "defaultdict", "(", "list", ")", "icd_transform", "=", "{", "}", "if", "len", "(", "s...
https://github.com/SteveDoyle2/pyNastran/blob/eda651ac2d4883d95a34951f8a002ff94f642a1a/pyNastran/bdf/bdf.py#L3881-L3931
wummel/linkchecker
c2ce810c3fb00b895a841a7be6b2e78c64e7b042
linkcheck/configuration/confparse.py
python
LCConfigParser.check_password_readable
(self, section, fields)
Check if there is a readable configuration file and print a warning.
Check if there is a readable configuration file and print a warning.
[ "Check", "if", "there", "is", "a", "readable", "configuration", "file", "and", "print", "a", "warning", "." ]
def check_password_readable(self, section, fields): """Check if there is a readable configuration file and print a warning.""" if not fields: return # The information which of the configuration files # included which option is not available. To avoid false positives, ...
[ "def", "check_password_readable", "(", "self", ",", "section", ",", "fields", ")", ":", "if", "not", "fields", ":", "return", "# The information which of the configuration files", "# included which option is not available. To avoid false positives,", "# a warning is only printed i...
https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/linkcheck/configuration/confparse.py#L192-L207
aws-samples/aws-kube-codesuite
ab4e5ce45416b83bffb947ab8d234df5437f4fca
src/kubernetes/client/models/v1beta1_controller_revision.py
python
V1beta1ControllerRevision.kind
(self, kind)
Sets the kind of this V1beta1ControllerRevision. Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#t...
Sets the kind of this V1beta1ControllerRevision. Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#t...
[ "Sets", "the", "kind", "of", "this", "V1beta1ControllerRevision", ".", "Kind", "is", "a", "string", "value", "representing", "the", "REST", "resource", "this", "object", "represents", ".", "Servers", "may", "infer", "this", "from", "the", "endpoint", "the", "c...
def kind(self, kind): """ Sets the kind of this V1beta1ControllerRevision. Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/communi...
[ "def", "kind", "(", "self", ",", "kind", ")", ":", "self", ".", "_kind", "=", "kind" ]
https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/kubernetes/client/models/v1beta1_controller_revision.py#L113-L122
ChineseGLUE/ChineseGLUE
1591b85cf5427c2ff60f718d359ecb71d2b44879
baselines/models/bert_wwm_ext/create_pretraining_data.py
python
main
(_)
[]
def main(_): tf.logging.set_verbosity(tf.logging.INFO) tokenizer = tokenization.FullTokenizer( vocab_file=FLAGS.vocab_file, do_lower_case=FLAGS.do_lower_case) input_files = [] for input_pattern in FLAGS.input_file.split(","): input_files.extend(tf.gfile.Glob(input_pattern)) tf.logging.info("*** R...
[ "def", "main", "(", "_", ")", ":", "tf", ".", "logging", ".", "set_verbosity", "(", "tf", ".", "logging", ".", "INFO", ")", "tokenizer", "=", "tokenization", ".", "FullTokenizer", "(", "vocab_file", "=", "FLAGS", ".", "vocab_file", ",", "do_lower_case", ...
https://github.com/ChineseGLUE/ChineseGLUE/blob/1591b85cf5427c2ff60f718d359ecb71d2b44879/baselines/models/bert_wwm_ext/create_pretraining_data.py#L436-L462
openedx/edx-platform
68dd185a0ab45862a2a61e0f803d7e03d2be71b5
common/djangoapps/entitlements/models.py
python
CourseEntitlement.is_entitlement_regainable
(self)
return self.policy.is_entitlement_regainable(self)
Returns a boolean as to whether or not the entitlement can be regained based on the entitlement's policy
Returns a boolean as to whether or not the entitlement can be regained based on the entitlement's policy
[ "Returns", "a", "boolean", "as", "to", "whether", "or", "not", "the", "entitlement", "can", "be", "regained", "based", "on", "the", "entitlement", "s", "policy" ]
def is_entitlement_regainable(self): """ Returns a boolean as to whether or not the entitlement can be regained based on the entitlement's policy """ return self.policy.is_entitlement_regainable(self)
[ "def", "is_entitlement_regainable", "(", "self", ")", ":", "return", "self", ".", "policy", ".", "is_entitlement_regainable", "(", "self", ")" ]
https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/common/djangoapps/entitlements/models.py#L237-L241
websauna/websauna
a57de54fb8a3fae859f24f373f0292e1e4b3c344
websauna/system/form/sqlalchemy.py
python
ForeignKeyValue.query_item
(self, node: colander.SchemaNode, dbsession: Session, model: type, match_column: Column, value: set)
return dbsession.query(model).filter(match_column == value).first() if value else value
Query the actual model to get the concrete SQLAlchemy objects.
Query the actual model to get the concrete SQLAlchemy objects.
[ "Query", "the", "actual", "model", "to", "get", "the", "concrete", "SQLAlchemy", "objects", "." ]
def query_item(self, node: colander.SchemaNode, dbsession: Session, model: type, match_column: Column, value: set) -> t.List[object]: """Query the actual model to get the concrete SQLAlchemy objects.""" # Empty IN queries are not allowed return dbsession.query(model).filter(match_column == value...
[ "def", "query_item", "(", "self", ",", "node", ":", "colander", ".", "SchemaNode", ",", "dbsession", ":", "Session", ",", "model", ":", "type", ",", "match_column", ":", "Column", ",", "value", ":", "set", ")", "->", "t", ".", "List", "[", "object", ...
https://github.com/websauna/websauna/blob/a57de54fb8a3fae859f24f373f0292e1e4b3c344/websauna/system/form/sqlalchemy.py#L111-L114
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/apps/reports/views.py
python
close_case_view
(request, domain, case_id)
return HttpResponseRedirect(reverse('case_data', args=[domain, case_id]))
[]
def close_case_view(request, domain, case_id): case = safely_get_case(request, domain, case_id) if case.closed: messages.info(request, 'Case {} is already closed.'.format(case.name)) else: device_id = __name__ + ".close_case_view" form_id = close_case(case_id, domain, request.couch_u...
[ "def", "close_case_view", "(", "request", ",", "domain", ",", "case_id", ")", ":", "case", "=", "safely_get_case", "(", "request", ",", "domain", ",", "case_id", ")", "if", "case", ".", "closed", ":", "messages", ".", "info", "(", "request", ",", "'Case ...
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/reports/views.py#L1445-L1461
PySimpleGUI/PySimpleGUI
6c0d1fb54f493d45e90180b322fbbe70f7a5af3c
HowDoI/PySimpleGUI-HowDoI.py
python
HowDoI
()
Make and show a window (PySimpleGUI form) that takes user input and sends to the HowDoI web oracle Excellent example of 2 GUI concepts 1. Output Element that will show text in a scrolled window 2. Non-Window-Closing Buttons - These buttons will cause the form to return with the form's values, but do...
Make and show a window (PySimpleGUI form) that takes user input and sends to the HowDoI web oracle Excellent example of 2 GUI concepts 1. Output Element that will show text in a scrolled window 2. Non-Window-Closing Buttons - These buttons will cause the form to return with the form's values, but do...
[ "Make", "and", "show", "a", "window", "(", "PySimpleGUI", "form", ")", "that", "takes", "user", "input", "and", "sends", "to", "the", "HowDoI", "web", "oracle", "Excellent", "example", "of", "2", "GUI", "concepts", "1", ".", "Output", "Element", "that", ...
def HowDoI(): ''' Make and show a window (PySimpleGUI form) that takes user input and sends to the HowDoI web oracle Excellent example of 2 GUI concepts 1. Output Element that will show text in a scrolled window 2. Non-Window-Closing Buttons - These buttons will cause the form to return with...
[ "def", "HowDoI", "(", ")", ":", "# ------- Make a new Window ------- #", "sg", ".", "ChangeLookAndFeel", "(", "'GreenTan'", ")", "# give our form a spiffy set of colors", "layout", "=", "[", "[", "sg", ".", "Text", "(", "'Ask and your answer will appear here....'", ",",...
https://github.com/PySimpleGUI/PySimpleGUI/blob/6c0d1fb54f493d45e90180b322fbbe70f7a5af3c/HowDoI/PySimpleGUI-HowDoI.py#L16-L69
simons-public/protonfixes
24ecb378bc4e99bfe698090661d255dcbb5b677f
protonfixes/gamefixes/475150.py
python
main
()
Set OS to Windows XP to pass the black menu screen
Set OS to Windows XP to pass the black menu screen
[ "Set", "OS", "to", "Windows", "XP", "to", "pass", "the", "black", "menu", "screen" ]
def main(): """ Set OS to Windows XP to pass the black menu screen """ util.protontricks('winxp')
[ "def", "main", "(", ")", ":", "util", ".", "protontricks", "(", "'winxp'", ")" ]
https://github.com/simons-public/protonfixes/blob/24ecb378bc4e99bfe698090661d255dcbb5b677f/protonfixes/gamefixes/475150.py#L9-L13
ilius/pyglossary
d599b3beda3ae17642af5debd83bb991148e6425
pyglossary/entry_base.py
python
BaseEntry.defiFormat
(self, defiFormat: str)
[]
def defiFormat(self, defiFormat: str) -> None: # TODO: type: Literal["m", "h", "x", "b"] raise NotImplementedError
[ "def", "defiFormat", "(", "self", ",", "defiFormat", ":", "str", ")", "->", "None", ":", "# TODO: type: Literal[\"m\", \"h\", \"x\", \"b\"]", "raise", "NotImplementedError" ]
https://github.com/ilius/pyglossary/blob/d599b3beda3ae17642af5debd83bb991148e6425/pyglossary/entry_base.py#L64-L66
grow/grow
97fc21730b6a674d5d33948d94968e79447ce433
grow/rendering/render_controller.py
python
RenderStaticDocumentController.render
(self, jinja_env=None, request=None)
return rendered_doc
Read the static file.
Read the static file.
[ "Read", "the", "static", "file", "." ]
def render(self, jinja_env=None, request=None): """Read the static file.""" timer = self.pod.profile.timer( 'RenderStaticDocumentController.render', label=self.serving_path, meta={'path': self.serving_path}).start_timer() if not self.pod_path or not self.pod.file_exists(...
[ "def", "render", "(", "self", ",", "jinja_env", "=", "None", ",", "request", "=", "None", ")", ":", "timer", "=", "self", ".", "pod", ".", "profile", ".", "timer", "(", "'RenderStaticDocumentController.render'", ",", "label", "=", "self", ".", "serving_pat...
https://github.com/grow/grow/blob/97fc21730b6a674d5d33948d94968e79447ce433/grow/rendering/render_controller.py#L527-L546
mozilla/kitsune
7c7cf9baed57aa776547aea744243ccad6ca91fb
kitsune/wiki/views.py
python
doc_page_cache
(view)
return _doc_page_cache_view
Decorator that caches the document page HTML.
Decorator that caches the document page HTML.
[ "Decorator", "that", "caches", "the", "document", "page", "HTML", "." ]
def doc_page_cache(view): """Decorator that caches the document page HTML.""" @wraps(view) def _doc_page_cache_view(request, document_slug, *args, **kwargs): # We skip caching for authed users or if redirect=no # is in the query string or if we show the aaq widget if ( r...
[ "def", "doc_page_cache", "(", "view", ")", ":", "@", "wraps", "(", "view", ")", "def", "_doc_page_cache_view", "(", "request", ",", "document_slug", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# We skip caching for authed users or if redirect=no", "# i...
https://github.com/mozilla/kitsune/blob/7c7cf9baed57aa776547aea744243ccad6ca91fb/kitsune/wiki/views.py#L75-L107
OCA/l10n-brazil
6faefc04c7b0de3de3810a7ab137493d933fb579
payment_cielo/models/payment_acquirer.py
python
PaymentAcquirerCielo._get_cielo_api_url
(self)
Get cielo API URLs used in all s2s communication Takes environment in consideration.
Get cielo API URLs used in all s2s communication
[ "Get", "cielo", "API", "URLs", "used", "in", "all", "s2s", "communication" ]
def _get_cielo_api_url(self): """Get cielo API URLs used in all s2s communication Takes environment in consideration. """ if self.environment == 'test': return 'apisandbox.cieloecommerce.cielo.com.br' if self.environment == 'prod': return 'api.cieloecomm...
[ "def", "_get_cielo_api_url", "(", "self", ")", ":", "if", "self", ".", "environment", "==", "'test'", ":", "return", "'apisandbox.cieloecommerce.cielo.com.br'", "if", "self", ".", "environment", "==", "'prod'", ":", "return", "'api.cieloecommerce.cielo.com.br'" ]
https://github.com/OCA/l10n-brazil/blob/6faefc04c7b0de3de3810a7ab137493d933fb579/payment_cielo/models/payment_acquirer.py#L53-L62
threatexpress/domainhunter
c185116414660061afb9730a28384ac7e4975fde
domainhunter.py
python
checkMXToolbox
(domain)
Checks the MXToolbox service for Google SafeBrowsing and PhishTank information. Currently broken
Checks the MXToolbox service for Google SafeBrowsing and PhishTank information. Currently broken
[ "Checks", "the", "MXToolbox", "service", "for", "Google", "SafeBrowsing", "and", "PhishTank", "information", ".", "Currently", "broken" ]
def checkMXToolbox(domain): """ Checks the MXToolbox service for Google SafeBrowsing and PhishTank information. Currently broken""" url = 'https://mxtoolbox.com/Public/Tools/BrandReputation.aspx' headers = {'User-Agent':useragent, 'Origin':url, 'Referer':url} print('[*] Google...
[ "def", "checkMXToolbox", "(", "domain", ")", ":", "url", "=", "'https://mxtoolbox.com/Public/Tools/BrandReputation.aspx'", "headers", "=", "{", "'User-Agent'", ":", "useragent", ",", "'Origin'", ":", "url", ",", "'Referer'", ":", "url", "}", "print", "(", "'[*] Go...
https://github.com/threatexpress/domainhunter/blob/c185116414660061afb9730a28384ac7e4975fde/domainhunter.py#L230-L288
joke2k/faker
0ebe46fc9b9793fe315cf0fce430258ce74df6f8
faker/providers/bank/__init__.py
python
Provider.swift11
(self, primary: bool = False, use_dataset: bool = False)
return self.swift(length=11, primary=primary, use_dataset=use_dataset)
Generate an 11-digit SWIFT code. This method uses |swift| under the hood with the ``length`` argument set to ``11``. If ``primary`` is set to ``True``, the SWIFT code will always end with ``'XXX'``. All 11-digit SWIFT codes use this convention to refer to the primary branch/office. ...
Generate an 11-digit SWIFT code.
[ "Generate", "an", "11", "-", "digit", "SWIFT", "code", "." ]
def swift11(self, primary: bool = False, use_dataset: bool = False) -> str: """Generate an 11-digit SWIFT code. This method uses |swift| under the hood with the ``length`` argument set to ``11``. If ``primary`` is set to ``True``, the SWIFT code will always end with ``'XXX'``. All 11-di...
[ "def", "swift11", "(", "self", ",", "primary", ":", "bool", "=", "False", ",", "use_dataset", ":", "bool", "=", "False", ")", "->", "str", ":", "return", "self", ".", "swift", "(", "length", "=", "11", ",", "primary", "=", "primary", ",", "use_datase...
https://github.com/joke2k/faker/blob/0ebe46fc9b9793fe315cf0fce430258ce74df6f8/faker/providers/bank/__init__.py#L79-L90
ldx/python-iptables
542efdb739b4e3ef6f28274d23b506bf0027eec2
iptc/xtables.py
python
xtables._get_initfn_from_lib
(self, name, lib)
return initfn
[]
def _get_initfn_from_lib(self, name, lib): try: initfn = getattr(lib, "libxt_%s_init" % (name)) except AttributeError: prefix = self._get_prefix() initfn = getattr(lib, "%s%s_init" % (prefix, name), None) if initfn is None and not self.no_alias_check: ...
[ "def", "_get_initfn_from_lib", "(", "self", ",", "name", ",", "lib", ")", ":", "try", ":", "initfn", "=", "getattr", "(", "lib", ",", "\"libxt_%s_init\"", "%", "(", "name", ")", ")", "except", "AttributeError", ":", "prefix", "=", "self", ".", "_get_pref...
https://github.com/ldx/python-iptables/blob/542efdb739b4e3ef6f28274d23b506bf0027eec2/iptc/xtables.py#L965-L975
deanishe/alfred-vpn-manager
f5d0dd1433ea69b1517d4866a12b1118097057b9
src/workflow/workflow.py
python
Workflow.cached_data_fresh
(self, name, max_age)
return age < max_age
Whether cache `name` is less than `max_age` seconds old. :param name: name of datastore :param max_age: maximum age of data in seconds :type max_age: ``int`` :returns: ``True`` if data is less than ``max_age`` old, else ``False``
Whether cache `name` is less than `max_age` seconds old.
[ "Whether", "cache", "name", "is", "less", "than", "max_age", "seconds", "old", "." ]
def cached_data_fresh(self, name, max_age): """Whether cache `name` is less than `max_age` seconds old. :param name: name of datastore :param max_age: maximum age of data in seconds :type max_age: ``int`` :returns: ``True`` if data is less than ``max_age`` old, else ...
[ "def", "cached_data_fresh", "(", "self", ",", "name", ",", "max_age", ")", ":", "age", "=", "self", ".", "cached_data_age", "(", "name", ")", "if", "not", "age", ":", "return", "False", "return", "age", "<", "max_age" ]
https://github.com/deanishe/alfred-vpn-manager/blob/f5d0dd1433ea69b1517d4866a12b1118097057b9/src/workflow/workflow.py#L1732-L1747
deepgram/kur
fd0c120e50815c1e5be64e5dde964dcd47234556
kur/sources/text.py
python
RawText.default_chunk_size
(cls)
return 256
Returns the default chunk size for this source.
Returns the default chunk size for this source.
[ "Returns", "the", "default", "chunk", "size", "for", "this", "source", "." ]
def default_chunk_size(cls): """ Returns the default chunk size for this source. """ return 256
[ "def", "default_chunk_size", "(", "cls", ")", ":", "return", "256" ]
https://github.com/deepgram/kur/blob/fd0c120e50815c1e5be64e5dde964dcd47234556/kur/sources/text.py#L108-L111
saltstack/salt
fae5bc757ad0f1716483ce7ae180b451545c2058
salt/spm/__init__.py
python
SPMClient._local
(self, args)
Process local commands
Process local commands
[ "Process", "local", "commands" ]
def _local(self, args): """ Process local commands """ args.pop(0) command = args[0] if command == "install": self._local_install(args) elif command == "files": self._local_list_files(args) elif command == "info": self._...
[ "def", "_local", "(", "self", ",", "args", ")", ":", "args", ".", "pop", "(", "0", ")", "command", "=", "args", "[", "0", "]", "if", "command", "==", "\"install\"", ":", "self", ".", "_local_install", "(", "args", ")", "elif", "command", "==", "\"f...
https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/spm/__init__.py#L172-L185
openai/weightnorm
3503e68b84d27ac69f33e26517f2a5036153999c
tensorflow/nn.py
python
conv2d
(x, num_filters, filter_size=[3,3], stride=[1,1], pad='SAME', nonlinearity=None, init_scale=1., counters={}, init=False, ema=None, **kwargs)
convolutional layer
convolutional layer
[ "convolutional", "layer" ]
def conv2d(x, num_filters, filter_size=[3,3], stride=[1,1], pad='SAME', nonlinearity=None, init_scale=1., counters={}, init=False, ema=None, **kwargs): ''' convolutional layer ''' name = get_name('conv2d', counters) with tf.variable_scope(name): if init: # data based initialization of pa...
[ "def", "conv2d", "(", "x", ",", "num_filters", ",", "filter_size", "=", "[", "3", ",", "3", "]", ",", "stride", "=", "[", "1", ",", "1", "]", ",", "pad", "=", "'SAME'", ",", "nonlinearity", "=", "None", ",", "init_scale", "=", "1.", ",", "counter...
https://github.com/openai/weightnorm/blob/3503e68b84d27ac69f33e26517f2a5036153999c/tensorflow/nn.py#L177-L208
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.py
python
SQLiteDialect.get_schema_names
(self, connection, **kw)
return [db[1] for db in dl if db[1] != "temp"]
[]
def get_schema_names(self, connection, **kw): s = "PRAGMA database_list" dl = connection.execute(s) return [db[1] for db in dl if db[1] != "temp"]
[ "def", "get_schema_names", "(", "self", ",", "connection", ",", "*", "*", "kw", ")", ":", "s", "=", "\"PRAGMA database_list\"", "dl", "=", "connection", ".", "execute", "(", "s", ")", "return", "[", "db", "[", "1", "]", "for", "db", "in", "dl", "if",...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.py#L1145-L1149
onaio/onadata
89ad16744e8f247fb748219476f6ac295869a95f
onadata/libs/utils/csv_import.py
python
failed_import
(rollback_uuids, xform, exception, status_message)
return async_status(FAILED, status_message)
Report a failed import. :param rollback_uuids: The rollback UUIDs :param xform: The XForm that failed to import to :param exception: The exception object :return: The async_status result
Report a failed import. :param rollback_uuids: The rollback UUIDs :param xform: The XForm that failed to import to :param exception: The exception object :return: The async_status result
[ "Report", "a", "failed", "import", ".", ":", "param", "rollback_uuids", ":", "The", "rollback", "UUIDs", ":", "param", "xform", ":", "The", "XForm", "that", "failed", "to", "import", "to", ":", "param", "exception", ":", "The", "exception", "object", ":", ...
def failed_import(rollback_uuids, xform, exception, status_message): """ Report a failed import. :param rollback_uuids: The rollback UUIDs :param xform: The XForm that failed to import to :param exception: The exception object :return: The async_status result """ Instance.objects.filter(uuid...
[ "def", "failed_import", "(", "rollback_uuids", ",", "xform", ",", "exception", ",", "status_message", ")", ":", "Instance", ".", "objects", ".", "filter", "(", "uuid__in", "=", "rollback_uuids", ",", "xform", "=", "xform", ")", ".", "delete", "(", ")", "xf...
https://github.com/onaio/onadata/blob/89ad16744e8f247fb748219476f6ac295869a95f/onadata/libs/utils/csv_import.py#L157-L170
huggingface/transformers
623b4f7c63f60cce917677ee704d6c93ee960b4b
src/transformers/keras_callbacks.py
python
KerasMetricCallback._concatenate_batches
(batches)
return [sample for batch in batches for sample in batch]
[]
def _concatenate_batches(batches): # Flattens Numpy array batches into a list of single samples, where each sample is still np.ndarray return [sample for batch in batches for sample in batch]
[ "def", "_concatenate_batches", "(", "batches", ")", ":", "# Flattens Numpy array batches into a list of single samples, where each sample is still np.ndarray", "return", "[", "sample", "for", "batch", "in", "batches", "for", "sample", "in", "batch", "]" ]
https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/keras_callbacks.py#L132-L134
tensorflow/models
6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3
official/vision/beta/evaluation/coco_evaluator.py
python
COCOEvaluator._retrieve_per_category_metrics
(self, coco_eval, prefix='')
return metrics_dict
Retrieves and per-category metrics and retuns them in a dict. Args: coco_eval: a cocoeval.COCOeval object containing evaluation data. prefix: str, A string used to prefix metric names. Returns: metrics_dict: A dictionary with per category metrics.
Retrieves and per-category metrics and retuns them in a dict.
[ "Retrieves", "and", "per", "-", "category", "metrics", "and", "retuns", "them", "in", "a", "dict", "." ]
def _retrieve_per_category_metrics(self, coco_eval, prefix=''): """Retrieves and per-category metrics and retuns them in a dict. Args: coco_eval: a cocoeval.COCOeval object containing evaluation data. prefix: str, A string used to prefix metric names. Returns: metrics_dict: A dictionary ...
[ "def", "_retrieve_per_category_metrics", "(", "self", ",", "coco_eval", ",", "prefix", "=", "''", ")", ":", "metrics_dict", "=", "{", "}", "if", "prefix", ":", "prefix", "=", "prefix", "+", "' '", "if", "hasattr", "(", "coco_eval", ",", "'category_stats'", ...
https://github.com/tensorflow/models/blob/6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3/official/vision/beta/evaluation/coco_evaluator.py#L176-L237
Blizzard/heroprotocol
3d36eaf44fc4c8ff3331c2ae2f1dc08a94535f1c
heroprotocol/versions/protocol85551.py
python
decode_replay_header
(contents)
return decoder.instance(replay_header_typeid)
Decodes and return the replay header from the contents byte string.
Decodes and return the replay header from the contents byte string.
[ "Decodes", "and", "return", "the", "replay", "header", "from", "the", "contents", "byte", "string", "." ]
def decode_replay_header(contents): """Decodes and return the replay header from the contents byte string.""" decoder = VersionedDecoder(contents, typeinfos) return decoder.instance(replay_header_typeid)
[ "def", "decode_replay_header", "(", "contents", ")", ":", "decoder", "=", "VersionedDecoder", "(", "contents", ",", "typeinfos", ")", "return", "decoder", ".", "instance", "(", "replay_header_typeid", ")" ]
https://github.com/Blizzard/heroprotocol/blob/3d36eaf44fc4c8ff3331c2ae2f1dc08a94535f1c/heroprotocol/versions/protocol85551.py#L435-L438
trevp/tlslite
cd82fadb6bb958522b7457c5ed95890283437a4f
tlslite/session.py
python
Session.getCipherName
(self)
return CipherSuite.canonicalCipherName(self.cipherSuite)
Get the name of the cipher used with this connection. @rtype: str @return: The name of the cipher used with this connection.
Get the name of the cipher used with this connection.
[ "Get", "the", "name", "of", "the", "cipher", "used", "with", "this", "connection", "." ]
def getCipherName(self): """Get the name of the cipher used with this connection. @rtype: str @return: The name of the cipher used with this connection. """ return CipherSuite.canonicalCipherName(self.cipherSuite)
[ "def", "getCipherName", "(", "self", ")", ":", "return", "CipherSuite", ".", "canonicalCipherName", "(", "self", ".", "cipherSuite", ")" ]
https://github.com/trevp/tlslite/blob/cd82fadb6bb958522b7457c5ed95890283437a4f/tlslite/session.py#L112-L118
saltstack/salt
fae5bc757ad0f1716483ce7ae180b451545c2058
salt/modules/napalm_mod.py
python
pyeapi_run_commands
(*commands, **kwargs)
return __salt__["pyeapi.run_commands"](*commands, **pyeapi_kwargs)
Execute a list of commands on the Arista switch, via the ``pyeapi`` library. This function forwards the existing connection details to the :mod:`pyeapi.run_commands <salt.module.arista_pyeapi.run_commands>` execution function. commands A list of commands to execute. encoding: ``json`` ...
Execute a list of commands on the Arista switch, via the ``pyeapi`` library. This function forwards the existing connection details to the :mod:`pyeapi.run_commands <salt.module.arista_pyeapi.run_commands>` execution function.
[ "Execute", "a", "list", "of", "commands", "on", "the", "Arista", "switch", "via", "the", "pyeapi", "library", ".", "This", "function", "forwards", "the", "existing", "connection", "details", "to", "the", ":", "mod", ":", "pyeapi", ".", "run_commands", "<salt...
def pyeapi_run_commands(*commands, **kwargs): """ Execute a list of commands on the Arista switch, via the ``pyeapi`` library. This function forwards the existing connection details to the :mod:`pyeapi.run_commands <salt.module.arista_pyeapi.run_commands>` execution function. commands A...
[ "def", "pyeapi_run_commands", "(", "*", "commands", ",", "*", "*", "kwargs", ")", ":", "pyeapi_kwargs", "=", "pyeapi_nxos_api_args", "(", "*", "*", "kwargs", ")", "return", "__salt__", "[", "\"pyeapi.run_commands\"", "]", "(", "*", "commands", ",", "*", "*",...
https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/napalm_mod.py#L1026-L1048
buffer/thug
96ccd5bb1a45375ad665dfb8fb975978bf4659cb
thug/DOM/Window.py
python
Window.navigator
(self)
return self._navigator
the Navigator object for the window
the Navigator object for the window
[ "the", "Navigator", "object", "for", "the", "window" ]
def navigator(self): """the Navigator object for the window""" return self._navigator
[ "def", "navigator", "(", "self", ")", ":", "return", "self", ".", "_navigator" ]
https://github.com/buffer/thug/blob/96ccd5bb1a45375ad665dfb8fb975978bf4659cb/thug/DOM/Window.py#L295-L297
bayespy/bayespy
0e6e6130c888a4295cc9421d61d4ad27b2960ebb
bayespy/plot.py
python
matrixplot
(A, colorbar=False, axes=None)
[]
def matrixplot(A, colorbar=False, axes=None): if axes is None: axes = plt.gca() if sp.issparse(A): A = A.toarray() axes.imshow(A, interpolation='nearest') if colorbar: plt.colorbar(ax=axes)
[ "def", "matrixplot", "(", "A", ",", "colorbar", "=", "False", ",", "axes", "=", "None", ")", ":", "if", "axes", "is", "None", ":", "axes", "=", "plt", ".", "gca", "(", ")", "if", "sp", ".", "issparse", "(", "A", ")", ":", "A", "=", "A", ".", ...
https://github.com/bayespy/bayespy/blob/0e6e6130c888a4295cc9421d61d4ad27b2960ebb/bayespy/plot.py#L1218-L1226
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/apps/users/management/commands/migrate_reprs.py
python
Command.handle
(self, **options)
[]
def handle(self, **options): records = UserHistory.objects.filter(Q(user_repr__isnull=True) | Q(changed_by_repr__isnull=True)) for user_history in with_progress_bar(queryset_to_iterator(records, UserHistory), records.count()): try: migrate(user_history) except Ex...
[ "def", "handle", "(", "self", ",", "*", "*", "options", ")", ":", "records", "=", "UserHistory", ".", "objects", ".", "filter", "(", "Q", "(", "user_repr__isnull", "=", "True", ")", "|", "Q", "(", "changed_by_repr__isnull", "=", "True", ")", ")", "for"...
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/users/management/commands/migrate_reprs.py#L16-L23
gwpy/gwpy
82becd78d166a32985cb657a54d0d39f6a207739
gwpy/plot/text.py
python
default_unit_label
(axis, unit)
return label.get_text()
Set default label for an axis from a `~astropy.units.Unit` If the axis already has a label, this function does nothing. Parameters ---------- axis : `~matplotlib.axis.Axis` the axis to manipulate unit : `~astropy.units.Unit` the unit to use for the label Returns ------- ...
Set default label for an axis from a `~astropy.units.Unit`
[ "Set", "default", "label", "for", "an", "axis", "from", "a", "~astropy", ".", "units", ".", "Unit" ]
def default_unit_label(axis, unit): """Set default label for an axis from a `~astropy.units.Unit` If the axis already has a label, this function does nothing. Parameters ---------- axis : `~matplotlib.axis.Axis` the axis to manipulate unit : `~astropy.units.Unit` the unit to u...
[ "def", "default_unit_label", "(", "axis", ",", "unit", ")", ":", "if", "not", "axis", ".", "isDefault_label", ":", "return", "label", "=", "axis", ".", "set_label_text", "(", "unit", ".", "to_string", "(", "'latex_inline_dimensional'", ")", ")", "axis", ".",...
https://github.com/gwpy/gwpy/blob/82becd78d166a32985cb657a54d0d39f6a207739/gwpy/plot/text.py#L46-L68
dickreuter/Poker
b7642f0277e267e1a44eab957c4c7d1d8f50f4ee
poker/vboxapi/__init__.py
python
PlatformWEBSERVICE.connect
(self, url, user, passwd)
return self.vbox
[]
def connect(self, url, user, passwd): if self.vbox is not None: self.disconnect() from VirtualBox_wrappers import IWebsessionManager2 if url is None: url = "" self.url = url if user is None: user = "" self.user = user if passwd...
[ "def", "connect", "(", "self", ",", "url", ",", "user", ",", "passwd", ")", ":", "if", "self", ".", "vbox", "is", "not", "None", ":", "self", ".", "disconnect", "(", ")", "from", "VirtualBox_wrappers", "import", "IWebsessionManager2", "if", "url", "is", ...
https://github.com/dickreuter/Poker/blob/b7642f0277e267e1a44eab957c4c7d1d8f50f4ee/poker/vboxapi/__init__.py#L966-L984
yuanming-hu/fc4
fc86df1ce82308b7dda28d71d705c25d6edd8251
datasets.py
python
DataSet.regenerate_image_packs
(self)
[]
def regenerate_image_packs(self): meta_data = self.load_meta_data() print 'Dumping image packs...' print '%s folds found' % len(meta_data) for f, m in enumerate(meta_data): self.regenerate_image_pack(m, f)
[ "def", "regenerate_image_packs", "(", "self", ")", ":", "meta_data", "=", "self", ".", "load_meta_data", "(", ")", "print", "'Dumping image packs...'", "print", "'%s folds found'", "%", "len", "(", "meta_data", ")", "for", "f", ",", "m", "in", "enumerate", "("...
https://github.com/yuanming-hu/fc4/blob/fc86df1ce82308b7dda28d71d705c25d6edd8251/datasets.py#L105-L110
samuelclay/NewsBlur
2c45209df01a1566ea105e04d499367f32ac9ad2
apps/social/views.py
python
remove_like_comment
(request)
[]
def remove_like_comment(request): code = 1 feed_id = int(request.POST['story_feed_id']) story_id = request.POST['story_id'] comment_user_id = request.POST['comment_user_id'] format = request.POST.get('format', 'json') shared_story = MSharedStory.objects.get(user_id=comment_user_id, ...
[ "def", "remove_like_comment", "(", "request", ")", ":", "code", "=", "1", "feed_id", "=", "int", "(", "request", ".", "POST", "[", "'story_feed_id'", "]", ")", "story_id", "=", "request", ".", "POST", "[", "'story_id'", "]", "comment_user_id", "=", "reques...
https://github.com/samuelclay/NewsBlur/blob/2c45209df01a1566ea105e04d499367f32ac9ad2/apps/social/views.py#L1301-L1329
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/zmq/sugar/poll.py
python
Poller.register
(self, socket, flags=POLLIN|POLLOUT)
p.register(socket, flags=POLLIN|POLLOUT) Register a 0MQ socket or native fd for I/O monitoring. register(s,0) is equivalent to unregister(s). Parameters ---------- socket : zmq.Socket or native socket A zmq.Socket or any Python object having a ``fileno()`` ...
p.register(socket, flags=POLLIN|POLLOUT)
[ "p", ".", "register", "(", "socket", "flags", "=", "POLLIN|POLLOUT", ")" ]
def register(self, socket, flags=POLLIN|POLLOUT): """p.register(socket, flags=POLLIN|POLLOUT) Register a 0MQ socket or native fd for I/O monitoring. register(s,0) is equivalent to unregister(s). Parameters ---------- socket : zmq.Socket or native socket ...
[ "def", "register", "(", "self", ",", "socket", ",", "flags", "=", "POLLIN", "|", "POLLOUT", ")", ":", "if", "flags", ":", "if", "socket", "in", "self", ".", "_map", ":", "idx", "=", "self", ".", "_map", "[", "socket", "]", "self", ".", "sockets", ...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/zmq/sugar/poll.py#L28-L57
loli/medpy
39131b94f0ab5328ab14a874229320efc2f74d98
doc/numpydoc/numpydoc/docscrape.py
python
dedent_lines
(lines)
return textwrap.dedent("\n".join(lines)).split("\n")
Deindent a list of lines maximally
Deindent a list of lines maximally
[ "Deindent", "a", "list", "of", "lines", "maximally" ]
def dedent_lines(lines): """Deindent a list of lines maximally""" return textwrap.dedent("\n".join(lines)).split("\n")
[ "def", "dedent_lines", "(", "lines", ")", ":", "return", "textwrap", ".", "dedent", "(", "\"\\n\"", ".", "join", "(", "lines", ")", ")", ".", "split", "(", "\"\\n\"", ")" ]
https://github.com/loli/medpy/blob/39131b94f0ab5328ab14a874229320efc2f74d98/doc/numpydoc/numpydoc/docscrape.py#L414-L416
numba/numba
bf480b9e0da858a65508c2b17759a72ee6a44c51
numba/typed/typeddict.py
python
_from_meminfo_ptr
(ptr, dicttype)
return d
[]
def _from_meminfo_ptr(ptr, dicttype): d = Dict(meminfo=ptr, dcttype=dicttype) return d
[ "def", "_from_meminfo_ptr", "(", "ptr", ",", "dicttype", ")", ":", "d", "=", "Dict", "(", "meminfo", "=", "ptr", ",", "dcttype", "=", "dicttype", ")", "return", "d" ]
https://github.com/numba/numba/blob/bf480b9e0da858a65508c2b17759a72ee6a44c51/numba/typed/typeddict.py#L76-L78
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-windows/x86/idna/core.py
python
alabel
(label)
return label
[]
def alabel(label): try: label = label.encode('ascii') ulabel(label) if not valid_label_length(label): raise IDNAError('Label too long') return label except UnicodeEncodeError: pass if not label: raise IDNAError('No Input') label = unicode(la...
[ "def", "alabel", "(", "label", ")", ":", "try", ":", "label", "=", "label", ".", "encode", "(", "'ascii'", ")", "ulabel", "(", "label", ")", "if", "not", "valid_label_length", "(", "label", ")", ":", "raise", "IDNAError", "(", "'Label too long'", ")", ...
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-windows/x86/idna/core.py#L266-L288
saltstack/salt
fae5bc757ad0f1716483ce7ae180b451545c2058
salt/pillar/ec2_pillar.py
python
__virtual__
()
return True
Check for required version of boto and make this pillar available depending on outcome.
Check for required version of boto and make this pillar available depending on outcome.
[ "Check", "for", "required", "version", "of", "boto", "and", "make", "this", "pillar", "available", "depending", "on", "outcome", "." ]
def __virtual__(): """ Check for required version of boto and make this pillar available depending on outcome. """ if not HAS_BOTO: return False boto_version = _StrictVersion(boto.__version__) required_boto_version = _StrictVersion("2.8.0") if boto_version < required_boto_version...
[ "def", "__virtual__", "(", ")", ":", "if", "not", "HAS_BOTO", ":", "return", "False", "boto_version", "=", "_StrictVersion", "(", "boto", ".", "__version__", ")", "required_boto_version", "=", "_StrictVersion", "(", "\"2.8.0\"", ")", "if", "boto_version", "<", ...
https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/pillar/ec2_pillar.py#L78-L95
mesalock-linux/mesapy
ed546d59a21b36feb93e2309d5c6b75aa0ad95c9
lib-python/2.7/logging/__init__.py
python
Formatter.formatTime
(self, record, datefmt=None)
return s
Return the creation time of the specified LogRecord as formatted text. This method should be called from format() by a formatter which wants to make use of a formatted time. This method can be overridden in formatters to provide for any specific requirement, but the basic behaviour is a...
Return the creation time of the specified LogRecord as formatted text.
[ "Return", "the", "creation", "time", "of", "the", "specified", "LogRecord", "as", "formatted", "text", "." ]
def formatTime(self, record, datefmt=None): """ Return the creation time of the specified LogRecord as formatted text. This method should be called from format() by a formatter which wants to make use of a formatted time. This method can be overridden in formatters to provide fo...
[ "def", "formatTime", "(", "self", ",", "record", ",", "datefmt", "=", "None", ")", ":", "ct", "=", "self", ".", "converter", "(", "record", ".", "created", ")", "if", "datefmt", ":", "s", "=", "time", ".", "strftime", "(", "datefmt", ",", "ct", ")"...
https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/lib-python/2.7/logging/__init__.py#L418-L442
007gzs/dingtalk-sdk
7979da2e259fdbc571728cae2425a04dbc65850a
dingtalk/client/api/taobao.py
python
TbDingDing.dingtalk_oapi_im_chat_servicegroup_create
( self, title, owner_userid, org_inner_group='false' )
return self._top_request( "dingtalk.oapi.im.chat.servicegroup.create", { "title": title, "owner_userid": owner_userid, "org_inner_group": org_inner_group } )
创建服务群 创建一个服务群 文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=42043 :param title: 群标题 :param owner_userid: 群主在钉钉组织内的userid :param org_inner_group: 是否企业内部服务群
创建服务群 创建一个服务群 文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=42043
[ "创建服务群", "创建一个服务群", "文档地址:https", ":", "//", "open", "-", "doc", ".", "dingtalk", ".", "com", "/", "docs", "/", "api", ".", "htm?apiId", "=", "42043" ]
def dingtalk_oapi_im_chat_servicegroup_create( self, title, owner_userid, org_inner_group='false' ): """ 创建服务群 创建一个服务群 文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=42043 :param title: 群标题 :param owner_userid: 群...
[ "def", "dingtalk_oapi_im_chat_servicegroup_create", "(", "self", ",", "title", ",", "owner_userid", ",", "org_inner_group", "=", "'false'", ")", ":", "return", "self", ".", "_top_request", "(", "\"dingtalk.oapi.im.chat.servicegroup.create\"", ",", "{", "\"title\"", ":",...
https://github.com/007gzs/dingtalk-sdk/blob/7979da2e259fdbc571728cae2425a04dbc65850a/dingtalk/client/api/taobao.py#L7548-L7570
AppScale/gts
46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9
AppServer/lib/django-0.96/django/dispatch/saferef.py
python
BoundMethodWeakref.__cmp__
( self, other )
return cmp( self.key, other.key)
Compare with another reference
Compare with another reference
[ "Compare", "with", "another", "reference" ]
def __cmp__( self, other ): """Compare with another reference""" if not isinstance (other,self.__class__): return cmp( self.__class__, type(other) ) return cmp( self.key, other.key)
[ "def", "__cmp__", "(", "self", ",", "other", ")", ":", "if", "not", "isinstance", "(", "other", ",", "self", ".", "__class__", ")", ":", "return", "cmp", "(", "self", ".", "__class__", ",", "type", "(", "other", ")", ")", "return", "cmp", "(", "sel...
https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-0.96/django/dispatch/saferef.py#L144-L148
Esri/ArcREST
ab240fde2b0200f61d4a5f6df033516e53f2f416
src/arcrest/manageorg/_content.py
python
UserItem.avgRating
(self)
return self._avgRating
gets the property value for avgRating
gets the property value for avgRating
[ "gets", "the", "property", "value", "for", "avgRating" ]
def avgRating(self): '''gets the property value for avgRating''' if self._avgRating is None: self.__init() return self._avgRating
[ "def", "avgRating", "(", "self", ")", ":", "if", "self", ".", "_avgRating", "is", "None", ":", "self", ".", "__init", "(", ")", "return", "self", ".", "_avgRating" ]
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_content.py#L1349-L1353
IronLanguages/ironpython3
7a7bb2a872eeab0d1009fc8a6e24dca43f65b693
Src/StdLib/Lib/tkinter/__init__.py
python
PhotoImage.blank
(self)
Display a transparent image.
Display a transparent image.
[ "Display", "a", "transparent", "image", "." ]
def blank(self): """Display a transparent image.""" self.tk.call(self.name, 'blank')
[ "def", "blank", "(", "self", ")", ":", "self", ".", "tk", ".", "call", "(", "self", ".", "name", ",", "'blank'", ")" ]
https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/tkinter/__init__.py#L3422-L3424
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/whoosh/lang/porter2.py
python
step_3
(word, r1, r2)
return word
[]
def step_3(word, r1, r2): for trip in s3_triples: attempt = step_3_helper(word, r1, r2, trip[0], trip[1], trip[2]) if attempt: return attempt return word
[ "def", "step_3", "(", "word", ",", "r1", ",", "r2", ")", ":", "for", "trip", "in", "s3_triples", ":", "attempt", "=", "step_3_helper", "(", "word", ",", "r1", ",", "r2", ",", "trip", "[", "0", "]", ",", "trip", "[", "1", "]", ",", "trip", "[", ...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/whoosh/lang/porter2.py#L218-L223
oddt/oddt
8cf555820d97a692ade81c101ebe10e28bcb3722
oddt/toolkits/extras/rdkit/fixer.py
python
ExtractPocketAndLigand
(mol, cutoff=12., expandResidues=True, ligand_residue=None, ligand_residue_blacklist=None, append_residues=None)
return pocket, ligand
Function extracting a ligand (the largest HETATM residue) and the protein pocket within certain cutoff. The selection of pocket atoms can be expanded to contain whole residues. The single atom HETATM residues are attributed to pocket (metals and waters) Parameters ---------- mol: rdkit.Chem...
Function extracting a ligand (the largest HETATM residue) and the protein pocket within certain cutoff. The selection of pocket atoms can be expanded to contain whole residues. The single atom HETATM residues are attributed to pocket (metals and waters)
[ "Function", "extracting", "a", "ligand", "(", "the", "largest", "HETATM", "residue", ")", "and", "the", "protein", "pocket", "within", "certain", "cutoff", ".", "The", "selection", "of", "pocket", "atoms", "can", "be", "expanded", "to", "contain", "whole", "...
def ExtractPocketAndLigand(mol, cutoff=12., expandResidues=True, ligand_residue=None, ligand_residue_blacklist=None, append_residues=None): """Function extracting a ligand (the largest HETATM residue) and the protein pocket within certain cutoff. The selecti...
[ "def", "ExtractPocketAndLigand", "(", "mol", ",", "cutoff", "=", "12.", ",", "expandResidues", "=", "True", ",", "ligand_residue", "=", "None", ",", "ligand_residue_blacklist", "=", "None", ",", "append_residues", "=", "None", ")", ":", "# Get heteroatom residues ...
https://github.com/oddt/oddt/blob/8cf555820d97a692ade81c101ebe10e28bcb3722/oddt/toolkits/extras/rdkit/fixer.py#L166-L272
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/combinat/crystals/fast_crystals.py
python
FastCrystal.__init__
(self, ct, shape, format)
EXAMPLES:: sage: C = crystals.FastRankTwo(['A',2],shape=[4,1]); C The fast crystal for A2 with shape [4,1] sage: TestSuite(C).run()
EXAMPLES::
[ "EXAMPLES", "::" ]
def __init__(self, ct, shape, format): """ EXAMPLES:: sage: C = crystals.FastRankTwo(['A',2],shape=[4,1]); C The fast crystal for A2 with shape [4,1] sage: TestSuite(C).run() """ Parent.__init__(self, category = ClassicalCrystals()) # super(Fas...
[ "def", "__init__", "(", "self", ",", "ct", ",", "shape", ",", "format", ")", ":", "Parent", ".", "__init__", "(", "self", ",", "category", "=", "ClassicalCrystals", "(", ")", ")", "# super(FastCrystal, self).__init__(category = FiniteEnumeratedSets())", "self...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/crystals/fast_crystals.py#L110-L173
kuri65536/python-for-android
26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891
python-modules/twisted/twisted/internet/iocpreactor/udp.py
python
Port.connectionLost
(self, reason=None)
Cleans up my socket.
Cleans up my socket.
[ "Cleans", "up", "my", "socket", "." ]
def connectionLost(self, reason=None): """ Cleans up my socket. """ log.msg('(Port %s Closed)' % self._realPortNumber) self._realPortNumber = None self.stopReading() if hasattr(self, "protocol"): # we won't have attribute in ConnectedPort, in cases ...
[ "def", "connectionLost", "(", "self", ",", "reason", "=", "None", ")", ":", "log", ".", "msg", "(", "'(Port %s Closed)'", "%", "self", ".", "_realPortNumber", ")", "self", ".", "_realPortNumber", "=", "None", "self", ".", "stopReading", "(", ")", "if", "...
https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python-modules/twisted/twisted/internet/iocpreactor/udp.py#L246-L264
oddt/oddt
8cf555820d97a692ade81c101ebe10e28bcb3722
oddt/utils.py
python
check_molecule
(mol, force_protein=False, force_coords=False, non_zero_atoms=False)
Universal validator of molecule objects. Usage of positional arguments is allowed only for molecule object, otherwise it is prohibitted (i.e. the order of arguments **will** change). Desired properties of molecule are validated based on specified arguments. By default only the object type is checked. In...
Universal validator of molecule objects. Usage of positional arguments is allowed only for molecule object, otherwise it is prohibitted (i.e. the order of arguments **will** change). Desired properties of molecule are validated based on specified arguments. By default only the object type is checked. In...
[ "Universal", "validator", "of", "molecule", "objects", ".", "Usage", "of", "positional", "arguments", "is", "allowed", "only", "for", "molecule", "object", "otherwise", "it", "is", "prohibitted", "(", "i", ".", "e", ".", "the", "order", "of", "arguments", "*...
def check_molecule(mol, force_protein=False, force_coords=False, non_zero_atoms=False): """Universal validator of molecule objects. Usage of positional arguments is allowed only for molecule object, otherwise it is prohibitted (i.e. the order of argum...
[ "def", "check_molecule", "(", "mol", ",", "force_protein", "=", "False", ",", "force_coords", "=", "False", ",", "non_zero_atoms", "=", "False", ")", ":", "# TODO 2to3 force only one positional argument by adding * to args", "if", "not", "is_molecule", "(", "mol", ")"...
https://github.com/oddt/oddt/blob/8cf555820d97a692ade81c101ebe10e28bcb3722/oddt/utils.py#L35-L79
Nuitka/Nuitka
39262276993757fa4e299f497654065600453fc9
nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Platform/virtualenv.py
python
Virtualenv
()
return None
Returns path to the virtualenv home if scons is executing within a virtualenv or None, if not.
Returns path to the virtualenv home if scons is executing within a virtualenv or None, if not.
[ "Returns", "path", "to", "the", "virtualenv", "home", "if", "scons", "is", "executing", "within", "a", "virtualenv", "or", "None", "if", "not", "." ]
def Virtualenv(): """Returns path to the virtualenv home if scons is executing within a virtualenv or None, if not.""" if _running_in_virtualenv(): return sys.prefix return None
[ "def", "Virtualenv", "(", ")", ":", "if", "_running_in_virtualenv", "(", ")", ":", "return", "sys", ".", "prefix", "return", "None" ]
https://github.com/Nuitka/Nuitka/blob/39262276993757fa4e299f497654065600453fc9/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Platform/virtualenv.py#L102-L107