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
Grunny/zap-cli
d58d4850ecfc5467badfac5e5bcc841d064bd419
zapcli/commands/scripts.py
python
remove_script
(zap_helper, script_name)
Remove a script.
Remove a script.
[ "Remove", "a", "script", "." ]
def remove_script(zap_helper, script_name): """Remove a script.""" with zap_error_handler(): console.debug('Removing script "{0}"'.format(script_name)) result = zap_helper.zap.script.remove(script_name) if result != 'OK': raise ZAPError('Error removing script: {0}'.format(re...
[ "def", "remove_script", "(", "zap_helper", ",", "script_name", ")", ":", "with", "zap_error_handler", "(", ")", ":", "console", ".", "debug", "(", "'Removing script \"{0}\"'", ".", "format", "(", "script_name", ")", ")", "result", "=", "zap_helper", ".", "zap"...
https://github.com/Grunny/zap-cli/blob/d58d4850ecfc5467badfac5e5bcc841d064bd419/zapcli/commands/scripts.py#L83-L92
codemeta/codemeta
22cf4c2b836a0026565792b5d1b3c5ff6c1fc82b
scripts/aggregate.py
python
list_crosswalks
()
Returns the list of crosswalk files. If USE_OLD_ORDER, returns OLD_ORDER. Otherwise, auto-discovers them from the crosswalk/ directory.
Returns the list of crosswalk files. If USE_OLD_ORDER, returns OLD_ORDER. Otherwise, auto-discovers them from the crosswalk/ directory.
[ "Returns", "the", "list", "of", "crosswalk", "files", ".", "If", "USE_OLD_ORDER", "returns", "OLD_ORDER", ".", "Otherwise", "auto", "-", "discovers", "them", "from", "the", "crosswalk", "/", "directory", "." ]
def list_crosswalks(): """Returns the list of crosswalk files. If USE_OLD_ORDER, returns OLD_ORDER. Otherwise, auto-discovers them from the crosswalk/ directory.""" if USE_OLD_ORDER: return OLD_ORDER else: return sorted(os.listdir(SOURCE_DIR))
[ "def", "list_crosswalks", "(", ")", ":", "if", "USE_OLD_ORDER", ":", "return", "OLD_ORDER", "else", ":", "return", "sorted", "(", "os", ".", "listdir", "(", "SOURCE_DIR", ")", ")" ]
https://github.com/codemeta/codemeta/blob/22cf4c2b836a0026565792b5d1b3c5ff6c1fc82b/scripts/aggregate.py#L82-L89
beeware/briefcase
4cbb0ba9ad5ffac4323ab6e1a65d22fde6eb67ec
src/briefcase/platforms/macOS/__init__.py
python
macOSPackageMixin.select_identity
(self, identity=None)
return identity
Get the codesigning identity to use. :param identity: A pre-specified identity (either the 40-digit hex checksum, or the string name of the identity). If provided, it will be validated against the list of available identities to confirm that it is a valid codesigning identit...
Get the codesigning identity to use.
[ "Get", "the", "codesigning", "identity", "to", "use", "." ]
def select_identity(self, identity=None): """ Get the codesigning identity to use. :param identity: A pre-specified identity (either the 40-digit hex checksum, or the string name of the identity). If provided, it will be validated against the list of available identities...
[ "def", "select_identity", "(", "self", ",", "identity", "=", "None", ")", ":", "# Obtain the valid codesigning identities.", "identities", "=", "self", ".", "get_identities", "(", "self", ",", "'codesigning'", ")", "if", "identity", ":", "try", ":", "# Try to look...
https://github.com/beeware/briefcase/blob/4cbb0ba9ad5ffac4323ab6e1a65d22fde6eb67ec/src/briefcase/platforms/macOS/__init__.py#L123-L165
Rockhopper-Technologies/enlighten
e98ea52b4aebd9a8f458c98a54453c385f4867dc
examples/multicolored.py
python
Node._state
(self, variable, num)
return False
Generic method to randomly determine if state is reached
Generic method to randomly determine if state is reached
[ "Generic", "method", "to", "randomly", "determine", "if", "state", "is", "reached" ]
def _state(self, variable, num): """ Generic method to randomly determine if state is reached """ value = getattr(self, variable) if value is None: return False if value is True: return True if random.randint(1, num) == num: ...
[ "def", "_state", "(", "self", ",", "variable", ",", "num", ")", ":", "value", "=", "getattr", "(", "self", ",", "variable", ")", "if", "value", "is", "None", ":", "return", "False", "if", "value", "is", "True", ":", "return", "True", "if", "random", ...
https://github.com/Rockhopper-Technologies/enlighten/blob/e98ea52b4aebd9a8f458c98a54453c385f4867dc/examples/multicolored.py#L64-L81
openfisca/openfisca-france
207a58191be6830716693f94d37846f1e5037b51
openfisca_france/model/prelevements_obligatoires/impot_revenu/ir.py
python
rag.formula
(individu, period, parameters)
return ( frag_exon + frag_impo + mrag_exon + mrag_impo + arag_exon + arag_impg - arag_defi + nrag_exon + nrag_impg - nrag_defi + nrag_ajag )
Revenus agricoles
Revenus agricoles
[ "Revenus", "agricoles" ]
def formula(individu, period, parameters): ''' Revenus agricoles ''' frag_exon = individu('frag_exon', period) frag_impo = individu('frag_impo', period) mrag_exon = individu('mrag_exon', period) mrag_impo = individu('mrag_impo', period) arag_exon = individ...
[ "def", "formula", "(", "individu", ",", "period", ",", "parameters", ")", ":", "frag_exon", "=", "individu", "(", "'frag_exon'", ",", "period", ")", "frag_impo", "=", "individu", "(", "'frag_impo'", ",", "period", ")", "mrag_exon", "=", "individu", "(", "'...
https://github.com/openfisca/openfisca-france/blob/207a58191be6830716693f94d37846f1e5037b51/openfisca_france/model/prelevements_obligatoires/impot_revenu/ir.py#L2519-L2540
mozilla-services/autopush
87e273c4581af88478d9e2658aa51d8c82a6d630
autopush/websocket.py
python
PushServerProtocol._sendAutoPing
(self)
return WebSocketServerProtocol._sendAutoPing(self)
Override for sanity checking during auto-ping interval
Override for sanity checking during auto-ping interval
[ "Override", "for", "sanity", "checking", "during", "auto", "-", "ping", "interval" ]
def _sendAutoPing(self): """Override for sanity checking during auto-ping interval""" # Note: it's possible (but tracking information has yet to prove) that # a websocket connection could persist longer than the message record # expiration time (~30d), which might cause some problems. Mo...
[ "def", "_sendAutoPing", "(", "self", ")", ":", "# Note: it's possible (but tracking information has yet to prove) that", "# a websocket connection could persist longer than the message record", "# expiration time (~30d), which might cause some problems. Most", "# websocket connections time out far...
https://github.com/mozilla-services/autopush/blob/87e273c4581af88478d9e2658aa51d8c82a6d630/autopush/websocket.py#L422-L435
spectacles/CodeComplice
8ca8ee4236f72b58caa4209d2fbd5fa56bd31d62
libs/codeintel2/lang_javascript.py
python
JSObject.toElementTree
(self, cixelement)
return cixobject
[]
def toElementTree(self, cixelement): if not self.name: log.debug("%s has no name, line: %d, ignoring it.", self.cixname, self.line) return None if self.cixname == "function": cixobject = createCixFunction(cixelement, self.name) elif self.c...
[ "def", "toElementTree", "(", "self", ",", "cixelement", ")", ":", "if", "not", "self", ".", "name", ":", "log", ".", "debug", "(", "\"%s has no name, line: %d, ignoring it.\"", ",", "self", ".", "cixname", ",", "self", ".", "line", ")", "return", "None", "...
https://github.com/spectacles/CodeComplice/blob/8ca8ee4236f72b58caa4209d2fbd5fa56bd31d62/libs/codeintel2/lang_javascript.py#L1297-L1429
CvvT/dumpDex
92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1
python/idaapi.py
python
strvec_t.erase
(self, *args)
return _idaapi.strvec_t_erase(self, *args)
erase(self, it) -> simpleline_t erase(self, first, last) -> simpleline_t
erase(self, it) -> simpleline_t erase(self, first, last) -> simpleline_t
[ "erase", "(", "self", "it", ")", "-", ">", "simpleline_t", "erase", "(", "self", "first", "last", ")", "-", ">", "simpleline_t" ]
def erase(self, *args): """ erase(self, it) -> simpleline_t erase(self, first, last) -> simpleline_t """ return _idaapi.strvec_t_erase(self, *args)
[ "def", "erase", "(", "self", ",", "*", "args", ")", ":", "return", "_idaapi", ".", "strvec_t_erase", "(", "self", ",", "*", "args", ")" ]
https://github.com/CvvT/dumpDex/blob/92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1/python/idaapi.py#L2127-L2132
mahmoudimus/nose-timer
472d8b514c4acc1824827ea193b686d75524a252
nosetimer/plugin.py
python
TimerPlugin._parse_filter
(value)
return value.split(',') if value is not None else None
Parse timer filters.
Parse timer filters.
[ "Parse", "timer", "filters", "." ]
def _parse_filter(value): """Parse timer filters.""" return value.split(',') if value is not None else None
[ "def", "_parse_filter", "(", "value", ")", ":", "return", "value", ".", "split", "(", "','", ")", "if", "value", "is", "not", "None", "else", "None" ]
https://github.com/mahmoudimus/nose-timer/blob/472d8b514c4acc1824827ea193b686d75524a252/nosetimer/plugin.py#L139-L141
wechatpy/wechatpy
5f693a7e90156786c2540ad3c941d12cdf6d88ef
wechatpy/work/client/api/appchat.py
python
WeChatAppChat._build_msg_content
(self, msgtype="text", **kwargs)
return data
构造消息内容 :param content: 消息内容,最长不超过2048个字节 :param msgtype: 消息类型,可以为text/image/voice/video/file/textcard/news/mpnews/markdown :param kwargs: 具体消息类型的扩展参数 :return:
构造消息内容
[ "构造消息内容" ]
def _build_msg_content(self, msgtype="text", **kwargs): """ 构造消息内容 :param content: 消息内容,最长不超过2048个字节 :param msgtype: 消息类型,可以为text/image/voice/video/file/textcard/news/mpnews/markdown :param kwargs: 具体消息类型的扩展参数 :return: """ data = {"msgtype": msgtype} ...
[ "def", "_build_msg_content", "(", "self", ",", "msgtype", "=", "\"text\"", ",", "*", "*", "kwargs", ")", ":", "data", "=", "{", "\"msgtype\"", ":", "msgtype", "}", "if", "msgtype", "==", "\"text\"", ":", "data", "[", "msgtype", "]", "=", "{", "\"conten...
https://github.com/wechatpy/wechatpy/blob/5f693a7e90156786c2540ad3c941d12cdf6d88ef/wechatpy/work/client/api/appchat.py#L104-L177
minio/minio-py
b3ba3bf99fe6b9ff2b28855550d6ab5345c134e3
minio/datatypes.py
python
Object.owner_name
(self)
return self._owner_name
Get owner name.
Get owner name.
[ "Get", "owner", "name", "." ]
def owner_name(self): """Get owner name.""" return self._owner_name
[ "def", "owner_name", "(", "self", ")", ":", "return", "self", ".", "_owner_name" ]
https://github.com/minio/minio-py/blob/b3ba3bf99fe6b9ff2b28855550d6ab5345c134e3/minio/datatypes.py#L184-L186
haiwen/seafile-docker
2d2461d4c8cab3458ec9832611c419d47506c300
cluster/scripts/setup-seafile-mysql.py
python
NewDBConfigurator.ask_db_name
(self, program, default)
return Utils.ask_question(question, key=key, default=default, validate=self.validate_db_name)
[]
def ask_db_name(self, program, default): question = 'Enter the database name for %s:' % program key = '%s database' % program return Utils.ask_question(question, key=key, default=default, valida...
[ "def", "ask_db_name", "(", "self", ",", "program", ",", "default", ")", ":", "question", "=", "'Enter the database name for %s:'", "%", "program", "key", "=", "'%s database'", "%", "program", "return", "Utils", ".", "ask_question", "(", "question", ",", "key", ...
https://github.com/haiwen/seafile-docker/blob/2d2461d4c8cab3458ec9832611c419d47506c300/cluster/scripts/setup-seafile-mysql.py#L633-L639
tensorflow/quantum
864f9ce0774d7e58fb3b4c7d0b12d810042a2dbd
tensorflow_quantum/python/differentiators/differentiator.py
python
Differentiator.get_gradient_circuits
(self, programs, symbol_names, symbol_values)
Return circuits to compute gradients for given forward pass circuits. Prepares (but does not execute) all intermediate circuits needed to calculate the gradients for the given forward pass circuits specified by `programs`, `symbol_names`, and `symbol_values`. The returned `tf.Tensor` ob...
Return circuits to compute gradients for given forward pass circuits.
[ "Return", "circuits", "to", "compute", "gradients", "for", "given", "forward", "pass", "circuits", "." ]
def get_gradient_circuits(self, programs, symbol_names, symbol_values): """Return circuits to compute gradients for given forward pass circuits. Prepares (but does not execute) all intermediate circuits needed to calculate the gradients for the given forward pass circuits specified by `...
[ "def", "get_gradient_circuits", "(", "self", ",", "programs", ",", "symbol_names", ",", "symbol_values", ")", ":" ]
https://github.com/tensorflow/quantum/blob/864f9ce0774d7e58fb3b4c7d0b12d810042a2dbd/tensorflow_quantum/python/differentiators/differentiator.py#L212-L325
IJDykeman/wangTiles
7c1ee2095ebdf7f72bce07d94c6484915d5cae8b
experimental_code/tiles_3d/venv_mac_py3/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.py
python
Wheel.is_mountable
(self)
return True
Determine if a wheel is asserted as mountable by its metadata.
Determine if a wheel is asserted as mountable by its metadata.
[ "Determine", "if", "a", "wheel", "is", "asserted", "as", "mountable", "by", "its", "metadata", "." ]
def is_mountable(self): """ Determine if a wheel is asserted as mountable by its metadata. """ return True
[ "def", "is_mountable", "(", "self", ")", ":", "return", "True" ]
https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/tiles_3d/venv_mac_py3/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.py#L713-L717
sqlalchemy/alembic
85152025ddba1dbeb51b467f40eb36b795d2ca37
alembic/autogenerate/api.py
python
AutogenContext.sorted_tables
(self)
return result
Return an aggregate of the :attr:`.MetaData.sorted_tables` collection(s). For a sequence of :class:`.MetaData` objects, this concatenates the :attr:`.MetaData.sorted_tables` collection for each individual :class:`.MetaData` in the order of the sequence. It does **not** collate the sor...
Return an aggregate of the :attr:`.MetaData.sorted_tables` collection(s).
[ "Return", "an", "aggregate", "of", "the", ":", "attr", ":", ".", "MetaData", ".", "sorted_tables", "collection", "(", "s", ")", "." ]
def sorted_tables(self): """Return an aggregate of the :attr:`.MetaData.sorted_tables` collection(s). For a sequence of :class:`.MetaData` objects, this concatenates the :attr:`.MetaData.sorted_tables` collection for each individual :class:`.MetaData` in the order of the sequen...
[ "def", "sorted_tables", "(", "self", ")", ":", "result", "=", "[", "]", "for", "m", "in", "util", ".", "to_list", "(", "self", ".", "metadata", ")", ":", "result", ".", "extend", "(", "m", ".", "sorted_tables", ")", "return", "result" ]
https://github.com/sqlalchemy/alembic/blob/85152025ddba1dbeb51b467f40eb36b795d2ca37/alembic/autogenerate/api.py#L431-L443
cogitas3d/OrtogOnBlender
881e93f5beb2263e44c270974dd0e81deca44762
CompareTools.py
python
B_point_soft_real_pt.poll
(cls, context)
[]
def poll(cls, context): found = 'B point soft real' in bpy.data.objects if found == False: return True else: if found == True: return False
[ "def", "poll", "(", "cls", ",", "context", ")", ":", "found", "=", "'B point soft real'", "in", "bpy", ".", "data", ".", "objects", "if", "found", "==", "False", ":", "return", "True", "else", ":", "if", "found", "==", "True", ":", "return", "False" ]
https://github.com/cogitas3d/OrtogOnBlender/blob/881e93f5beb2263e44c270974dd0e81deca44762/CompareTools.py#L792-L800
kubernetes-client/python
47b9da9de2d02b2b7a34fbe05afb44afd130d73a
kubernetes/client/models/v1_subject_rules_review_status.py
python
V1SubjectRulesReviewStatus.__eq__
(self, other)
return self.to_dict() == other.to_dict()
Returns true if both objects are equal
Returns true if both objects are equal
[ "Returns", "true", "if", "both", "objects", "are", "equal" ]
def __eq__(self, other): """Returns true if both objects are equal""" if not isinstance(other, V1SubjectRulesReviewStatus): return False return self.to_dict() == other.to_dict()
[ "def", "__eq__", "(", "self", ",", "other", ")", ":", "if", "not", "isinstance", "(", "other", ",", "V1SubjectRulesReviewStatus", ")", ":", "return", "False", "return", "self", ".", "to_dict", "(", ")", "==", "other", ".", "to_dict", "(", ")" ]
https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/v1_subject_rules_review_status.py#L197-L202
chribsen/simple-machine-learning-examples
dc94e52a4cebdc8bb959ff88b81ff8cfeca25022
venv/lib/python2.7/site-packages/pandas/stats/ols.py
python
MovingOLS._df_raw
(self)
return self._rank_raw
Returns the degrees of freedom.
Returns the degrees of freedom.
[ "Returns", "the", "degrees", "of", "freedom", "." ]
def _df_raw(self): """Returns the degrees of freedom.""" return self._rank_raw
[ "def", "_df_raw", "(", "self", ")", ":", "return", "self", ".", "_rank_raw" ]
https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/pandas/stats/ols.py#L928-L930
unias/docklet
70c089a6a5bb186dc3f898127af84d79b4dfab2d
src/master/userManager.py
python
userManager.__init__
(self, username = 'root', password = None)
Try to create the database when there is none initialize 'root' user and 'root' & 'primary' group
Try to create the database when there is none initialize 'root' user and 'root' & 'primary' group
[ "Try", "to", "create", "the", "database", "when", "there", "is", "none", "initialize", "root", "user", "and", "root", "&", "primary", "group" ]
def __init__(self, username = 'root', password = None): ''' Try to create the database when there is none initialize 'root' user and 'root' & 'primary' group ''' try: User.query.all() except: db.create_all() if password == None: ...
[ "def", "__init__", "(", "self", ",", "username", "=", "'root'", ",", "password", "=", "None", ")", ":", "try", ":", "User", ".", "query", ".", "all", "(", ")", "except", ":", "db", ".", "create_all", "(", ")", "if", "password", "==", "None", ":", ...
https://github.com/unias/docklet/blob/70c089a6a5bb186dc3f898127af84d79b4dfab2d/src/master/userManager.py#L140-L207
pymedusa/Medusa
1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38
ext/boto/cloudfront/invalidation.py
python
InvalidationBatch.add
(self, path)
return self.paths.append(path)
Add another path to this invalidation request
Add another path to this invalidation request
[ "Add", "another", "path", "to", "this", "invalidation", "request" ]
def add(self, path): """Add another path to this invalidation request""" return self.paths.append(path)
[ "def", "add", "(", "self", ",", "path", ")", ":", "return", "self", ".", "paths", ".", "append", "(", "path", ")" ]
https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/ext/boto/cloudfront/invalidation.py#L53-L55
posativ/acrylamid
222e2eb7b33924138498ff8186dff9f0aeb78cea
acrylamid/readers.py
python
MetadataMixin.month
(self)
return '%02d' % self.imonth
entry's month as zero padded string
entry's month as zero padded string
[ "entry", "s", "month", "as", "zero", "padded", "string" ]
def month(self): """entry's month as zero padded string""" return '%02d' % self.imonth
[ "def", "month", "(", "self", ")", ":", "return", "'%02d'", "%", "self", ".", "imonth" ]
https://github.com/posativ/acrylamid/blob/222e2eb7b33924138498ff8186dff9f0aeb78cea/acrylamid/readers.py#L423-L425
PaddlePaddle/PGL
e48545f2814523c777b8a9a9188bf5a7f00d6e52
examples/kddcup2021/PCQM4M/utils/config.py
python
save_files
(config)
Save config file so that we can know the config when we look back
Save config file so that we can know the config when we look back
[ "Save", "config", "file", "so", "that", "we", "can", "know", "the", "config", "when", "we", "look", "back" ]
def save_files(config): """Save config file so that we can know the config when we look back """ filelist = config.files2saved targetpath = config.log_dir if filelist is not None: for file_or_dir in filelist: if os.path.isdir(file_or_dir): last_name = get_last_di...
[ "def", "save_files", "(", "config", ")", ":", "filelist", "=", "config", ".", "files2saved", "targetpath", "=", "config", ".", "log_dir", "if", "filelist", "is", "not", "None", ":", "for", "file_or_dir", "in", "filelist", ":", "if", "os", ".", "path", "....
https://github.com/PaddlePaddle/PGL/blob/e48545f2814523c777b8a9a9188bf5a7f00d6e52/examples/kddcup2021/PCQM4M/utils/config.py#L84-L106
uqfoundation/multiprocess
028cc73f02655e6451d92e5147d19d8c10aebe50
py3.3/multiprocess/managers.py
python
BaseManager._number_of_objects
(self)
Return the number of shared objects
Return the number of shared objects
[ "Return", "the", "number", "of", "shared", "objects" ]
def _number_of_objects(self): ''' Return the number of shared objects ''' conn = self._Client(self._address, authkey=self._authkey) try: return dispatch(conn, None, 'number_of_objects') finally: conn.close()
[ "def", "_number_of_objects", "(", "self", ")", ":", "conn", "=", "self", ".", "_Client", "(", "self", ".", "_address", ",", "authkey", "=", "self", ".", "_authkey", ")", "try", ":", "return", "dispatch", "(", "conn", ",", "None", ",", "'number_of_objects...
https://github.com/uqfoundation/multiprocess/blob/028cc73f02655e6451d92e5147d19d8c10aebe50/py3.3/multiprocess/managers.py#L553-L561
iclavera/learning_to_adapt
bd7d99ba402521c96631e7d09714128f549db0f1
learning_to_adapt/mujoco_py/mjtypes.py
python
MjModelWrapper.light_cutoff
(self)
return arr
[]
def light_cutoff(self): arr = np.reshape(np.fromiter(self._wrapped.contents.light_cutoff, dtype=np.float, count=(self.nlight*1)), (self.nlight, 1, )) arr.setflags(write=False) return arr
[ "def", "light_cutoff", "(", "self", ")", ":", "arr", "=", "np", ".", "reshape", "(", "np", ".", "fromiter", "(", "self", ".", "_wrapped", ".", "contents", ".", "light_cutoff", ",", "dtype", "=", "np", ".", "float", ",", "count", "=", "(", "self", "...
https://github.com/iclavera/learning_to_adapt/blob/bd7d99ba402521c96631e7d09714128f549db0f1/learning_to_adapt/mujoco_py/mjtypes.py#L4755-L4758
amanusk/s-tui
d7a9ee4efbfc6f56b373a16dcd578881c534b2ce
s_tui/sturwid/complex_bar_graph.py
python
LabeledBarGraphVector.set_title
(self, title)
[]
def set_title(self, title): if not title: return title_text_w = urwid.Text(title, align="center") list_w = urwid.SimpleFocusListWalker([title_text_w]) self.title.original_widget = urwid.ListBox(list_w)
[ "def", "set_title", "(", "self", ",", "title", ")", ":", "if", "not", "title", ":", "return", "title_text_w", "=", "urwid", ".", "Text", "(", "title", ",", "align", "=", "\"center\"", ")", "list_w", "=", "urwid", ".", "SimpleFocusListWalker", "(", "[", ...
https://github.com/amanusk/s-tui/blob/d7a9ee4efbfc6f56b373a16dcd578881c534b2ce/s_tui/sturwid/complex_bar_graph.py#L109-L114
kubeflow/pipelines
bea751c9259ff0ae85290f873170aae89284ba8e
backend/api/python_http_client/kfp_server_api/models/api_list_jobs_response.py
python
ApiListJobsResponse.total_size
(self)
return self._total_size
Gets the total_size of this ApiListJobsResponse. # noqa: E501 The total number of jobs for the given query. # noqa: E501 :return: The total_size of this ApiListJobsResponse. # noqa: E501 :rtype: int
Gets the total_size of this ApiListJobsResponse. # noqa: E501
[ "Gets", "the", "total_size", "of", "this", "ApiListJobsResponse", ".", "#", "noqa", ":", "E501" ]
def total_size(self): """Gets the total_size of this ApiListJobsResponse. # noqa: E501 The total number of jobs for the given query. # noqa: E501 :return: The total_size of this ApiListJobsResponse. # noqa: E501 :rtype: int """ return self._total_size
[ "def", "total_size", "(", "self", ")", ":", "return", "self", ".", "_total_size" ]
https://github.com/kubeflow/pipelines/blob/bea751c9259ff0ae85290f873170aae89284ba8e/backend/api/python_http_client/kfp_server_api/models/api_list_jobs_response.py#L89-L97
ywangd/stash
773d15b8fb3853a65c15fe160bf5584c99437170
system/shio.py
python
ShIO.close
(self)
This IO object cannot be closed.
This IO object cannot be closed.
[ "This", "IO", "object", "cannot", "be", "closed", "." ]
def close(self): """ This IO object cannot be closed. """ pass
[ "def", "close", "(", "self", ")", ":", "pass" ]
https://github.com/ywangd/stash/blob/773d15b8fb3853a65c15fe160bf5584c99437170/system/shio.py#L41-L45
ethereum/lahja
f51c0b738a7dfd8b2b08a021cb31849792422625
lahja/base.py
python
EndpointAPI.wait_until_all_endpoints_subscribed_to
( self, event: Type[BaseEvent], *, include_self: bool = True )
Block until all currently connected remote endpoints are subscribed to the specified event type from this endpoint.
Block until all currently connected remote endpoints are subscribed to the specified event type from this endpoint.
[ "Block", "until", "all", "currently", "connected", "remote", "endpoints", "are", "subscribed", "to", "the", "specified", "event", "type", "from", "this", "endpoint", "." ]
async def wait_until_all_endpoints_subscribed_to( self, event: Type[BaseEvent], *, include_self: bool = True ) -> None: """ Block until all currently connected remote endpoints are subscribed to the specified event type from this endpoint. """ ...
[ "async", "def", "wait_until_all_endpoints_subscribed_to", "(", "self", ",", "event", ":", "Type", "[", "BaseEvent", "]", ",", "*", ",", "include_self", ":", "bool", "=", "True", ")", "->", "None", ":", "..." ]
https://github.com/ethereum/lahja/blob/f51c0b738a7dfd8b2b08a021cb31849792422625/lahja/base.py#L579-L586
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/benchmarks/src/benchmarks/sympy/sympy/mpmath/libmp/libmpc.py
python
mpc_exp
(z, prec, rnd=round_fast)
return re, im
Complex exponential function. We use the direct formula exp(a+bi) = exp(a) * (cos(b) + sin(b)*i) for the computation. This formula is very nice because it is pefectly stable; since we just do real multiplications, the only numerical errors that can creep in are single-ulp rounding errors. The form...
Complex exponential function.
[ "Complex", "exponential", "function", "." ]
def mpc_exp(z, prec, rnd=round_fast): """ Complex exponential function. We use the direct formula exp(a+bi) = exp(a) * (cos(b) + sin(b)*i) for the computation. This formula is very nice because it is pefectly stable; since we just do real multiplications, the only numerical errors that can cree...
[ "def", "mpc_exp", "(", "z", ",", "prec", ",", "rnd", "=", "round_fast", ")", ":", "a", ",", "b", "=", "z", "if", "a", "==", "fzero", ":", "return", "mpf_cos_sin", "(", "b", ",", "prec", ",", "rnd", ")", "if", "b", "==", "fzero", ":", "return", ...
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/mpmath/libmp/libmpc.py#L417-L442
SteveDoyle2/pyNastran
eda651ac2d4883d95a34951f8a002ff94f642a1a
pyNastran/gui/utils/qt/qtreeview2.py
python
get_many_cases
(data)
return cases
Get the result case ids that are a subset of the data/form list data = [ (u'Element Checks', None, [ (u'ElementDim', 5, []), (u'Min Edge Length', 6, []), (u'Min Interior Angle', 7, []), (u'Max Interior Angle', 8, [])], ), ] >>> get_many_cases(...
Get the result case ids that are a subset of the data/form list
[ "Get", "the", "result", "case", "ids", "that", "are", "a", "subset", "of", "the", "data", "/", "form", "list" ]
def get_many_cases(data): """ Get the result case ids that are a subset of the data/form list data = [ (u'Element Checks', None, [ (u'ElementDim', 5, []), (u'Min Edge Length', 6, []), (u'Min Interior Angle', 7, []), (u'Max Interior Angle', 8, [])], ...
[ "def", "get_many_cases", "(", "data", ")", ":", "unused_name", ",", "case", ",", "rows", "=", "data", "if", "case", "is", "None", ":", "# remove many results", "# (Geometry, None, [results...])", "cases", "=", "[", "]", "for", "unused_irow", ",", "row", "in", ...
https://github.com/SteveDoyle2/pyNastran/blob/eda651ac2d4883d95a34951f8a002ff94f642a1a/pyNastran/gui/utils/qt/qtreeview2.py#L432-L461
imageio/imageio
51f552ba5ed4aa771f205a2798e1fd3859fb2942
imageio/plugins/_tifffile.py
python
TiffFile.nih_metadata
(self)
return self.pages[0].tags["NIHImageHeader"].value
Return NIH Image metadata from NIHImageHeader tag as dict.
Return NIH Image metadata from NIHImageHeader tag as dict.
[ "Return", "NIH", "Image", "metadata", "from", "NIHImageHeader", "tag", "as", "dict", "." ]
def nih_metadata(self): """Return NIH Image metadata from NIHImageHeader tag as dict.""" if not self.is_nih: return return self.pages[0].tags["NIHImageHeader"].value
[ "def", "nih_metadata", "(", "self", ")", ":", "if", "not", "self", ".", "is_nih", ":", "return", "return", "self", ".", "pages", "[", "0", "]", ".", "tags", "[", "\"NIHImageHeader\"", "]", ".", "value" ]
https://github.com/imageio/imageio/blob/51f552ba5ed4aa771f205a2798e1fd3859fb2942/imageio/plugins/_tifffile.py#L2844-L2848
PaddlePaddle/Research
2da0bd6c72d60e9df403aff23a7802779561c4a1
NLP/MRQA2019-D-NET/server/ernie_server/task_reader/tokenization.py
python
_is_whitespace
(char)
return False
Checks whether `chars` is a whitespace character.
Checks whether `chars` is a whitespace character.
[ "Checks", "whether", "chars", "is", "a", "whitespace", "character", "." ]
def _is_whitespace(char): """Checks whether `chars` is a whitespace character.""" # \t, \n, and \r are technically contorl characters but we treat them # as whitespace since they are generally considered as such. if char == " " or char == "\t" or char == "\n" or char == "\r": return True cat...
[ "def", "_is_whitespace", "(", "char", ")", ":", "# \\t, \\n, and \\r are technically contorl characters but we treat them", "# as whitespace since they are generally considered as such.", "if", "char", "==", "\" \"", "or", "char", "==", "\"\\t\"", "or", "char", "==", "\"\\n\"",...
https://github.com/PaddlePaddle/Research/blob/2da0bd6c72d60e9df403aff23a7802779561c4a1/NLP/MRQA2019-D-NET/server/ernie_server/task_reader/tokenization.py#L337-L346
earwig/mwparserfromhell
abcf6298aa53f536f6626be1d8fd4a863afed878
src/mwparserfromhell/nodes/extras/attribute.py
python
Attribute._set_padding
(self, attr, value)
Setter for the value of a padding attribute.
Setter for the value of a padding attribute.
[ "Setter", "for", "the", "value", "of", "a", "padding", "attribute", "." ]
def _set_padding(self, attr, value): """Setter for the value of a padding attribute.""" if not value: setattr(self, attr, "") else: value = str(value) if not value.isspace(): raise ValueError("padding must be entirely whitespace") s...
[ "def", "_set_padding", "(", "self", ",", "attr", ",", "value", ")", ":", "if", "not", "value", ":", "setattr", "(", "self", ",", "attr", ",", "\"\"", ")", "else", ":", "value", "=", "str", "(", "value", ")", "if", "not", "value", ".", "isspace", ...
https://github.com/earwig/mwparserfromhell/blob/abcf6298aa53f536f6626be1d8fd4a863afed878/src/mwparserfromhell/nodes/extras/attribute.py#L77-L85
google-research/tf-slim
e00575ad39d19112a4b1342930825258316cf233
tf_slim/data/parallel_reader.py
python
single_pass_read
(data_sources, reader_class, reader_kwargs=None, scope=None)
Reads sequentially the data_sources using the reader, doing a single pass. Args: data_sources: a list/tuple of files or the location of the data, i.e. /path/to/train@128, /path/to/train* or /tmp/.../train* reader_class: one of the io_ops.ReaderBase subclasses ex: TFRecordReader. reader_kwargs: an o...
Reads sequentially the data_sources using the reader, doing a single pass.
[ "Reads", "sequentially", "the", "data_sources", "using", "the", "reader", "doing", "a", "single", "pass", "." ]
def single_pass_read(data_sources, reader_class, reader_kwargs=None, scope=None): """Reads sequentially the data_sources using the reader, doing a single pass. Args: data_sources: a list/tuple of files or the location of the data, i.e. /path/to/train@128, /path/to/train* or /tmp/.../...
[ "def", "single_pass_read", "(", "data_sources", ",", "reader_class", ",", "reader_kwargs", "=", "None", ",", "scope", "=", "None", ")", ":", "data_files", "=", "get_data_files", "(", "data_sources", ")", "with", "ops", ".", "name_scope", "(", "scope", ",", "...
https://github.com/google-research/tf-slim/blob/e00575ad39d19112a4b1342930825258316cf233/tf_slim/data/parallel_reader.py#L273-L292
Esri/ArcREST
ab240fde2b0200f61d4a5f6df033516e53f2f416
src/arcrest/manageags/parameters.py
python
Extension.properties
(self)
return self._properties
gets/sets the extension properties
gets/sets the extension properties
[ "gets", "/", "sets", "the", "extension", "properties" ]
def properties(self): """gets/sets the extension properties""" return self._properties
[ "def", "properties", "(", "self", ")", ":", "return", "self", ".", "_properties" ]
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageags/parameters.py#L34-L36
DataDog/integrations-core
934674b29d94b70ccc008f76ea172d0cdae05e1e
twistlock/datadog_checks/twistlock/config_models/defaults.py
python
instance_proxy
(field, value)
return get_default_field_value(field, value)
[]
def instance_proxy(field, value): return get_default_field_value(field, value)
[ "def", "instance_proxy", "(", "field", ",", "value", ")", ":", "return", "get_default_field_value", "(", "field", ",", "value", ")" ]
https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/twistlock/datadog_checks/twistlock/config_models/defaults.py#L125-L126
PaddlePaddle/PaddleX
2bab73f81ab54e328204e7871e6ae4a82e719f5d
paddlex/ppdet/modeling/losses/varifocal_loss.py
python
varifocal_loss
(pred, target, alpha=0.75, gamma=2.0, iou_weighted=True, use_sigmoid=True)
return loss
`Varifocal Loss <https://arxiv.org/abs/2008.13367>`_ Args: pred (Tensor): The prediction with shape (N, C), C is the number of classes target (Tensor): The learning target of the iou-aware classification score with shape (N, C), C is the number of classes. alpha (flo...
`Varifocal Loss <https://arxiv.org/abs/2008.13367>`_
[ "Varifocal", "Loss", "<https", ":", "//", "arxiv", ".", "org", "/", "abs", "/", "2008", ".", "13367", ">", "_" ]
def varifocal_loss(pred, target, alpha=0.75, gamma=2.0, iou_weighted=True, use_sigmoid=True): """`Varifocal Loss <https://arxiv.org/abs/2008.13367>`_ Args: pred (Tensor): The prediction with shape (N, C), C i...
[ "def", "varifocal_loss", "(", "pred", ",", "target", ",", "alpha", "=", "0.75", ",", "gamma", "=", "2.0", ",", "iou_weighted", "=", "True", ",", "use_sigmoid", "=", "True", ")", ":", "# pred and target should be of the same size", "assert", "pred", ".", "shape...
https://github.com/PaddlePaddle/PaddleX/blob/2bab73f81ab54e328204e7871e6ae4a82e719f5d/paddlex/ppdet/modeling/losses/varifocal_loss.py#L31-L75
horazont/aioxmpp
c701e6399c90a6bb9bec0349018a03bd7b644cde
aioxmpp/security_layer.py
python
security_layer
(tls_provider, sasl_providers)
return result
.. deprecated:: 0.6 Replaced by :class:`SecurityLayer`. Return a configured :class:`SecurityLayer`. `tls_provider` must be a :class:`STARTTLSProvider`. The return value can be passed to the constructor of :class:`~.node.Client`. Some very basic checking on the input is also performed.
.. deprecated:: 0.6
[ "..", "deprecated", "::", "0", ".", "6" ]
def security_layer(tls_provider, sasl_providers): """ .. deprecated:: 0.6 Replaced by :class:`SecurityLayer`. Return a configured :class:`SecurityLayer`. `tls_provider` must be a :class:`STARTTLSProvider`. The return value can be passed to the constructor of :class:`~.node.Client`. ...
[ "def", "security_layer", "(", "tls_provider", ",", "sasl_providers", ")", ":", "sasl_providers", "=", "tuple", "(", "sasl_providers", ")", "if", "not", "sasl_providers", ":", "raise", "ValueError", "(", "\"At least one SASL provider must be given.\"", ")", "for", "sas...
https://github.com/horazont/aioxmpp/blob/c701e6399c90a6bb9bec0349018a03bd7b644cde/aioxmpp/security_layer.py#L1203-L1232
khamidou/kite
c049faf8522c8346c22c70f2a35a35db6b4a155d
src/back/kite/users.py
python
get_username_from_folder
(email_path)
return os.path.basename(os.path.normpath(os.path.abspath(os.path.join(os.path.dirname(email_path), os.path.pardir))))
This function get the username from a maildir. ex: get_username_from_folder("/home/kite/Maildirs/testuser/new/1234563.mail") => "testuser"
This function get the username from a maildir. ex: get_username_from_folder("/home/kite/Maildirs/testuser/new/1234563.mail") => "testuser"
[ "This", "function", "get", "the", "username", "from", "a", "maildir", ".", "ex", ":", "get_username_from_folder", "(", "/", "home", "/", "kite", "/", "Maildirs", "/", "testuser", "/", "new", "/", "1234563", ".", "mail", ")", "=", ">", "testuser" ]
def get_username_from_folder(email_path): """This function get the username from a maildir. ex: get_username_from_folder("/home/kite/Maildirs/testuser/new/1234563.mail") => "testuser" """ # FIXME: refactor this monstrosity return os.path.basename(os.path.normpath(os.path.abspath(os.path.join(os.path.dir...
[ "def", "get_username_from_folder", "(", "email_path", ")", ":", "# FIXME: refactor this monstrosity", "return", "os", ".", "path", ".", "basename", "(", "os", ".", "path", ".", "normpath", "(", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", ...
https://github.com/khamidou/kite/blob/c049faf8522c8346c22c70f2a35a35db6b4a155d/src/back/kite/users.py#L10-L14
qiucheng025/zao-
3a5edf3607b3a523f95746bc69b688090c76d89a
plugins/convert/writer/_base.py
python
Output.output_filename
(self, filename)
return out_filename
Return the output filename with the correct folder and extension NB: The plugin must have a config item 'format' that contains the file extension to use this method
Return the output filename with the correct folder and extension NB: The plugin must have a config item 'format' that contains the file extension to use this method
[ "Return", "the", "output", "filename", "with", "the", "correct", "folder", "and", "extension", "NB", ":", "The", "plugin", "must", "have", "a", "config", "item", "format", "that", "contains", "the", "file", "extension", "to", "use", "this", "method" ]
def output_filename(self, filename): """ Return the output filename with the correct folder and extension NB: The plugin must have a config item 'format' that contains the file extension to use this method """ filename = os.path.splitext(os.path.basename(filename))[0] ...
[ "def", "output_filename", "(", "self", ",", "filename", ")", ":", "filename", "=", "os", ".", "path", ".", "splitext", "(", "os", ".", "path", ".", "basename", "(", "filename", ")", ")", "[", "0", "]", "out_filename", "=", "\"{}.{}\"", ".", "format", ...
https://github.com/qiucheng025/zao-/blob/3a5edf3607b3a523f95746bc69b688090c76d89a/plugins/convert/writer/_base.py#L41-L49
riptideio/pymodbus
c5772b35ae3f29d1947f3ab453d8d00df846459f
pymodbus/datastore/context.py
python
ModbusServerContext.__contains__
(self, slave)
Check if the given slave is in this list :param slave: slave The slave to check for existence :returns: True if the slave exists, False otherwise
Check if the given slave is in this list
[ "Check", "if", "the", "given", "slave", "is", "in", "this", "list" ]
def __contains__(self, slave): ''' Check if the given slave is in this list :param slave: slave The slave to check for existence :returns: True if the slave exists, False otherwise ''' if self.single and self._slaves: return True else: return slav...
[ "def", "__contains__", "(", "self", ",", "slave", ")", ":", "if", "self", ".", "single", "and", "self", ".", "_slaves", ":", "return", "True", "else", ":", "return", "slave", "in", "self", ".", "_slaves" ]
https://github.com/riptideio/pymodbus/blob/c5772b35ae3f29d1947f3ab453d8d00df846459f/pymodbus/datastore/context.py#L132-L141
yuzhoujr/leetcode
6a2ad1fc11225db18f68bfadd21a7419d2cb52a4
stack_queue/minStack.py
python
MinStack.pop
(self)
[]
def pop(self): self.minstack.pop() self.stack.pop()
[ "def", "pop", "(", "self", ")", ":", "self", ".", "minstack", ".", "pop", "(", ")", "self", ".", "stack", ".", "pop", "(", ")" ]
https://github.com/yuzhoujr/leetcode/blob/6a2ad1fc11225db18f68bfadd21a7419d2cb52a4/stack_queue/minStack.py#L40-L42
sahana/eden
1696fa50e90ce967df69f66b571af45356cc18da
controllers/org.py
python
booking_mode
()
return s3_rest_controller()
RESTful CRUD controller
RESTful CRUD controller
[ "RESTful", "CRUD", "controller" ]
def booking_mode(): """ RESTful CRUD controller """ return s3_rest_controller()
[ "def", "booking_mode", "(", ")", ":", "return", "s3_rest_controller", "(", ")" ]
https://github.com/sahana/eden/blob/1696fa50e90ce967df69f66b571af45356cc18da/controllers/org.py#L453-L456
tensorflow/datasets
2e496976d7d45550508395fb2f35cf958c8a3414
tensorflow_datasets/core/utils/py_utils.py
python
rgetattr
(obj, attr, *args)
return functools.reduce(_getattr, [obj] + attr.split('.'))
Get attr that handles dots in attr name.
Get attr that handles dots in attr name.
[ "Get", "attr", "that", "handles", "dots", "in", "attr", "name", "." ]
def rgetattr(obj, attr, *args): """Get attr that handles dots in attr name.""" def _getattr(obj, attr): return getattr(obj, attr, *args) return functools.reduce(_getattr, [obj] + attr.split('.'))
[ "def", "rgetattr", "(", "obj", ",", "attr", ",", "*", "args", ")", ":", "def", "_getattr", "(", "obj", ",", "attr", ")", ":", "return", "getattr", "(", "obj", ",", "attr", ",", "*", "args", ")", "return", "functools", ".", "reduce", "(", "_getattr"...
https://github.com/tensorflow/datasets/blob/2e496976d7d45550508395fb2f35cf958c8a3414/tensorflow_datasets/core/utils/py_utils.py#L402-L408
AXErunners/electrum-axe
7ef05088c0edaf0688fb167df353d6da619ebf2f
electrum_axe/commands.py
python
Commands.getseed
(self, password=None)
return s
Get seed phrase. Print the generation seed of your wallet.
Get seed phrase. Print the generation seed of your wallet.
[ "Get", "seed", "phrase", ".", "Print", "the", "generation", "seed", "of", "your", "wallet", "." ]
def getseed(self, password=None): """Get seed phrase. Print the generation seed of your wallet.""" s = self.wallet.get_seed(password) return s
[ "def", "getseed", "(", "self", ",", "password", "=", "None", ")", ":", "s", "=", "self", ".", "wallet", ".", "get_seed", "(", "password", ")", "return", "s" ]
https://github.com/AXErunners/electrum-axe/blob/7ef05088c0edaf0688fb167df353d6da619ebf2f/electrum_axe/commands.py#L413-L416
jpadilla/pyjwt
77d791681fa3d0ba65a648de42dd3d671138cb95
jwt/api_jwk.py
python
PyJWKSet.from_dict
(obj)
return PyJWKSet(keys)
[]
def from_dict(obj): keys = obj.get("keys", []) return PyJWKSet(keys)
[ "def", "from_dict", "(", "obj", ")", ":", "keys", "=", "obj", ".", "get", "(", "\"keys\"", ",", "[", "]", ")", "return", "PyJWKSet", "(", "keys", ")" ]
https://github.com/jpadilla/pyjwt/blob/77d791681fa3d0ba65a648de42dd3d671138cb95/jwt/api_jwk.py#L90-L92
stephenmcd/cartridge
1f2feb5e3d3d246b604b8c2c885161eb29af9bce
cartridge/shop/views.py
python
cart
(request, template="shop/cart.html", cart_formset_class=CartItemFormSet, discount_form_class=DiscountForm, extra_context=None)
return TemplateResponse(request, template, context)
Display cart and handle removing items from the cart.
Display cart and handle removing items from the cart.
[ "Display", "cart", "and", "handle", "removing", "items", "from", "the", "cart", "." ]
def cart(request, template="shop/cart.html", cart_formset_class=CartItemFormSet, discount_form_class=DiscountForm, extra_context=None): """ Display cart and handle removing items from the cart. """ cart_formset = cart_formset_class(instance=request.cart) discount_form = di...
[ "def", "cart", "(", "request", ",", "template", "=", "\"shop/cart.html\"", ",", "cart_formset_class", "=", "CartItemFormSet", ",", "discount_form_class", "=", "DiscountForm", ",", "extra_context", "=", "None", ")", ":", "cart_formset", "=", "cart_formset_class", "("...
https://github.com/stephenmcd/cartridge/blob/1f2feb5e3d3d246b604b8c2c885161eb29af9bce/cartridge/shop/views.py#L156-L209
DingGuodong/LinuxBashShellScriptForOps
d5727b985f920292a10698a3c9751d5dff5fc1a3
projects/WeChatOps/WXBizMsgCrypt/WXBizMsgCrypt.py
python
XMLParse.extract
(xmltext)
提取出xml数据包中的加密消息 @param xmltext: 待提取的xml字符串 @return: 提取出的加密消息字符串
提取出xml数据包中的加密消息
[ "提取出xml数据包中的加密消息" ]
def extract(xmltext): """提取出xml数据包中的加密消息 @param xmltext: 待提取的xml字符串 @return: 提取出的加密消息字符串 """ try: xml_tree = ET.fromstring(xmltext) encrypt = xml_tree.find("Encrypt") touser_name = xml_tree.find("ToUserName") # 开发者微信号 return WXBizM...
[ "def", "extract", "(", "xmltext", ")", ":", "try", ":", "xml_tree", "=", "ET", ".", "fromstring", "(", "xmltext", ")", "encrypt", "=", "xml_tree", ".", "find", "(", "\"Encrypt\"", ")", "touser_name", "=", "xml_tree", ".", "find", "(", "\"ToUserName\"", "...
https://github.com/DingGuodong/LinuxBashShellScriptForOps/blob/d5727b985f920292a10698a3c9751d5dff5fc1a3/projects/WeChatOps/WXBizMsgCrypt/WXBizMsgCrypt.py#L118-L130
mtianyan/OnlineMooc
51a910e27c8d2808a8a5198b4db31f463e646bf6
tyadmin_api/auto_serializers.py
python
ChapterListSerializer.get_ty_options_display_txt
(obj)
return str(obj)
[]
def get_ty_options_display_txt(obj): return str(obj)
[ "def", "get_ty_options_display_txt", "(", "obj", ")", ":", "return", "str", "(", "obj", ")" ]
https://github.com/mtianyan/OnlineMooc/blob/51a910e27c8d2808a8a5198b4db31f463e646bf6/tyadmin_api/auto_serializers.py#L1837-L1838
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
ansible/roles/lib_git/build/lib/ssh_agent.py
python
SshAgent.add_key
(self, key)
Add a key to the running agent. Note: This function can be called any number of times to add multiple keys. Args: key (str): A string containing the ssh private key to be added (the actual key data, not the filename of a key) Raises: SshA...
Add a key to the running agent.
[ "Add", "a", "key", "to", "the", "running", "agent", "." ]
def add_key(self, key): """Add a key to the running agent. Note: This function can be called any number of times to add multiple keys. Args: key (str): A string containing the ssh private key to be added (the actual key data, not the filename of a ke...
[ "def", "add_key", "(", "self", ",", "key", ")", ":", "#if self.ssh_agent.poll() is None:", "# raise SshAgentException(\"Unable to add ssh key. Did agent die?\")", "named_pipe_path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "ssh_auth_sock_dir", ",", "\"key...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/ansible/roles/lib_git/build/lib/ssh_agent.py#L95-L130
golismero/golismero
7d605b937e241f51c1ca4f47b20f755eeefb9d76
tools/sqlmap/thirdparty/oset/_abc.py
python
ABCMeta._dump_registry
(cls, file=None)
Debug helper to print the ABC registry.
Debug helper to print the ABC registry.
[ "Debug", "helper", "to", "print", "the", "ABC", "registry", "." ]
def _dump_registry(cls, file=None): """Debug helper to print the ABC registry.""" print >> file, "Class: %s.%s" % (cls.__module__, cls.__name__) print >> file, "Inv.counter: %s" % ABCMeta._abc_invalidation_counter for name in sorted(cls.__dict__.keys()): if name.startswith("_...
[ "def", "_dump_registry", "(", "cls", ",", "file", "=", "None", ")", ":", "print", ">>", "file", ",", "\"Class: %s.%s\"", "%", "(", "cls", ".", "__module__", ",", "cls", ".", "__name__", ")", "print", ">>", "file", ",", "\"Inv.counter: %s\"", "%", "ABCMet...
https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/tools/sqlmap/thirdparty/oset/_abc.py#L97-L104
pwnieexpress/pwn_plug_sources
1a23324f5dc2c3de20f9c810269b6a29b2758cad
src/metagoofil/hachoir_parser/container/swf.py
python
parseExport
(parent, size)
[]
def parseExport(parent, size): yield UInt16(parent, "count") for index in xrange(parent["count"].value): yield Export(parent, "export[]")
[ "def", "parseExport", "(", "parent", ",", "size", ")", ":", "yield", "UInt16", "(", "parent", ",", "\"count\"", ")", "for", "index", "in", "xrange", "(", "parent", "[", "\"count\"", "]", ".", "value", ")", ":", "yield", "Export", "(", "parent", ",", ...
https://github.com/pwnieexpress/pwn_plug_sources/blob/1a23324f5dc2c3de20f9c810269b6a29b2758cad/src/metagoofil/hachoir_parser/container/swf.py#L204-L207
swz30/CycleISP
76a52aa1d0c45f41aa7cdaa7deebecb10530c748
utils/dataset_utils.py
python
bayer_unify
(raw: np.ndarray, rgb: np.ndarray, input_pattern: str, target_pattern: str, mode: str)
return out1, out2
Convert a bayer raw image from one bayer pattern to another. Parameters ---------- raw : np.ndarray in shape (H, W) Bayer raw image to be unified. input_pattern : {"RGGB", "BGGR", "GRBG", "GBRG"} The bayer pattern of the input image. target_pattern : {"RGGB", "BGGR", "GRBG", "GBRG"}...
Convert a bayer raw image from one bayer pattern to another.
[ "Convert", "a", "bayer", "raw", "image", "from", "one", "bayer", "pattern", "to", "another", "." ]
def bayer_unify(raw: np.ndarray, rgb: np.ndarray, input_pattern: str, target_pattern: str, mode: str) -> np.ndarray: """ Convert a bayer raw image from one bayer pattern to another. Parameters ---------- raw : np.ndarray in shape (H, W) Bayer raw image to be unified. input_pattern : {"R...
[ "def", "bayer_unify", "(", "raw", ":", "np", ".", "ndarray", ",", "rgb", ":", "np", ".", "ndarray", ",", "input_pattern", ":", "str", ",", "target_pattern", ":", "str", ",", "mode", ":", "str", ")", "->", "np", ".", "ndarray", ":", "if", "input_patte...
https://github.com/swz30/CycleISP/blob/76a52aa1d0c45f41aa7cdaa7deebecb10530c748/utils/dataset_utils.py#L8-L61
googleads/google-ads-python
2a1d6062221f6aad1992a6bcca0e7e4a93d2db86
google/ads/googleads/v9/services/services/shared_criterion_service/client.py
python
SharedCriterionServiceClient.parse_common_location_path
(path: str)
return m.groupdict() if m else {}
Parse a location path into its component segments.
Parse a location path into its component segments.
[ "Parse", "a", "location", "path", "into", "its", "component", "segments", "." ]
def parse_common_location_path(path: str) -> Dict[str, str]: """Parse a location path into its component segments.""" m = re.match( r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)$", path ) return m.groupdict() if m else {}
[ "def", "parse_common_location_path", "(", "path", ":", "str", ")", "->", "Dict", "[", "str", ",", "str", "]", ":", "m", "=", "re", ".", "match", "(", "r\"^projects/(?P<project>.+?)/locations/(?P<location>.+?)$\"", ",", "path", ")", "return", "m", ".", "groupdi...
https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v9/services/services/shared_criterion_service/client.py#L268-L273
pulb/mailnag
7ef91050cf3ccea2eeca13aefdbac29716806487
Mailnag/common/imaplib2.py
python
IMAP4.store
(self, message_set, command, flags, **kw)
return self._simple_command('STORE', message_set, command, flags, **kw)
(typ, [data]) = store(message_set, command, flags) Alters flag dispositions for messages in mailbox.
(typ, [data]) = store(message_set, command, flags) Alters flag dispositions for messages in mailbox.
[ "(", "typ", "[", "data", "]", ")", "=", "store", "(", "message_set", "command", "flags", ")", "Alters", "flag", "dispositions", "for", "messages", "in", "mailbox", "." ]
def store(self, message_set, command, flags, **kw): """(typ, [data]) = store(message_set, command, flags) Alters flag dispositions for messages in mailbox.""" if (flags[0],flags[-1]) != ('(',')'): flags = '(%s)' % flags # Avoid quoting the flags kw['untagged_response'] = 'F...
[ "def", "store", "(", "self", ",", "message_set", ",", "command", ",", "flags", ",", "*", "*", "kw", ")", ":", "if", "(", "flags", "[", "0", "]", ",", "flags", "[", "-", "1", "]", ")", "!=", "(", "'('", ",", "')'", ")", ":", "flags", "=", "'...
https://github.com/pulb/mailnag/blob/7ef91050cf3ccea2eeca13aefdbac29716806487/Mailnag/common/imaplib2.py#L1169-L1176
foamliu/InsightFace-v2
e07b738adecb69b81ac9b8750db964cee673e175
optimizer.py
python
InsightFaceOptimizer.zero_grad
(self)
[]
def zero_grad(self): self.optimizer.zero_grad()
[ "def", "zero_grad", "(", "self", ")", ":", "self", ".", "optimizer", ".", "zero_grad", "(", ")" ]
https://github.com/foamliu/InsightFace-v2/blob/e07b738adecb69b81ac9b8750db964cee673e175/optimizer.py#L9-L10
debian-calibre/calibre
020fc81d3936a64b2ac51459ecb796666ab6a051
src/calibre/ebooks/rtf2xml/colors.py
python
Colors.__default_color_func
(self, line)
Requires: line Returns: nothing Logic: get the hex number from the line and add it to the color string.
Requires: line Returns: nothing Logic: get the hex number from the line and add it to the color string.
[ "Requires", ":", "line", "Returns", ":", "nothing", "Logic", ":", "get", "the", "hex", "number", "from", "the", "line", "and", "add", "it", "to", "the", "color", "string", "." ]
def __default_color_func(self, line): """ Requires: line Returns: nothing Logic: get the hex number from the line and add it to the color string. """ hex_num = line[-3:-1] self.__color_string += hex_num
[ "def", "__default_color_func", "(", "self", ",", "line", ")", ":", "hex_num", "=", "line", "[", "-", "3", ":", "-", "1", "]", "self", ".", "__color_string", "+=", "hex_num" ]
https://github.com/debian-calibre/calibre/blob/020fc81d3936a64b2ac51459ecb796666ab6a051/src/calibre/ebooks/rtf2xml/colors.py#L84-L94
DataDog/integrations-core
934674b29d94b70ccc008f76ea172d0cdae05e1e
ambari/datadog_checks/ambari/config_models/defaults.py
python
instance_aws_service
(field, value)
return get_default_field_value(field, value)
[]
def instance_aws_service(field, value): return get_default_field_value(field, value)
[ "def", "instance_aws_service", "(", "field", ",", "value", ")", ":", "return", "get_default_field_value", "(", "field", ",", "value", ")" ]
https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/ambari/datadog_checks/ambari/config_models/defaults.py#L57-L58
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/misc/prandom.py
python
gammavariate
(alpha, beta)
return _pyrand().gammavariate(alpha, beta)
r""" Gamma distribution. Not the gamma function! Conditions on the parameters are alpha > 0 and beta > 0. EXAMPLES:: sage: sample = gammavariate(1.0, 3.0); sample # random 6.58282586130638 sage: sample > 0 True sage: sample = gammavariate(3.0, 1.0); sample # ran...
r""" Gamma distribution. Not the gamma function!
[ "r", "Gamma", "distribution", ".", "Not", "the", "gamma", "function!" ]
def gammavariate(alpha, beta): r""" Gamma distribution. Not the gamma function! Conditions on the parameters are alpha > 0 and beta > 0. EXAMPLES:: sage: sample = gammavariate(1.0, 3.0); sample # random 6.58282586130638 sage: sample > 0 True sage: sample = ga...
[ "def", "gammavariate", "(", "alpha", ",", "beta", ")", ":", "return", "_pyrand", "(", ")", ".", "gammavariate", "(", "alpha", ",", "beta", ")" ]
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/misc/prandom.py#L285-L302
ConvLab/ConvLab
a04582a77537c1a706fbf64715baa9ad0be1301a
convlab/lib/util.py
python
get_ts
(pattern=FILE_TS_FORMAT)
return ts
Get current ts, defaults to format used for filename @param {str} pattern To format the ts @returns {str} ts @example util.get_ts() # => '2017_10_17_084739'
Get current ts, defaults to format used for filename @param {str} pattern To format the ts @returns {str} ts @example
[ "Get", "current", "ts", "defaults", "to", "format", "used", "for", "filename", "@param", "{", "str", "}", "pattern", "To", "format", "the", "ts", "@returns", "{", "str", "}", "ts", "@example" ]
def get_ts(pattern=FILE_TS_FORMAT): ''' Get current ts, defaults to format used for filename @param {str} pattern To format the ts @returns {str} ts @example util.get_ts() # => '2017_10_17_084739' ''' ts_obj = datetime.now() ts = ts_obj.strftime(pattern) assert RE_FILE_TS.se...
[ "def", "get_ts", "(", "pattern", "=", "FILE_TS_FORMAT", ")", ":", "ts_obj", "=", "datetime", ".", "now", "(", ")", "ts", "=", "ts_obj", ".", "strftime", "(", "pattern", ")", "assert", "RE_FILE_TS", ".", "search", "(", "ts", ")", "return", "ts" ]
https://github.com/ConvLab/ConvLab/blob/a04582a77537c1a706fbf64715baa9ad0be1301a/convlab/lib/util.py#L233-L246
JimmXinu/FanFicFare
bc149a2deb2636320fe50a3e374af6eef8f61889
fanficfare/fetcher.py
python
BasicCache.set_autosave
(self,autosave=False,filename=None)
[]
def set_autosave(self,autosave=False,filename=None): self.autosave = autosave self.filename = filename
[ "def", "set_autosave", "(", "self", ",", "autosave", "=", "False", ",", "filename", "=", "None", ")", ":", "self", ".", "autosave", "=", "autosave", "self", ".", "filename", "=", "filename" ]
https://github.com/JimmXinu/FanFicFare/blob/bc149a2deb2636320fe50a3e374af6eef8f61889/fanficfare/fetcher.py#L175-L177
mandiant/flare-ida
b5b3993bdd224b7d6d7bd524045195550c156c44
examples/argtracker_example1.py
python
getFunctionArgumentCount
(ea)
return argCount
Bit of a hack, since IDA doesn't seem to have a good way to get this information. Gets the frame for a given function, and counts named members following the 'r' member. Note: IDA won't create a frame member for an unreferenced function arg... so you've been warned.
Bit of a hack, since IDA doesn't seem to have a good way to get this information. Gets the frame for a given function, and counts named members following the 'r' member. Note: IDA won't create a frame member for an unreferenced function arg... so you've been warned.
[ "Bit", "of", "a", "hack", "since", "IDA", "doesn", "t", "seem", "to", "have", "a", "good", "way", "to", "get", "this", "information", ".", "Gets", "the", "frame", "for", "a", "given", "function", "and", "counts", "named", "members", "following", "the", ...
def getFunctionArgumentCount(ea): ''' Bit of a hack, since IDA doesn't seem to have a good way to get this information. Gets the frame for a given function, and counts named members following the 'r' member. Note: IDA won't create a frame member for an unreferenced function arg... so you've been...
[ "def", "getFunctionArgumentCount", "(", "ea", ")", ":", "rFound", "=", "False", "argCount", "=", "0", "sid", "=", "idc", ".", "GetFrame", "(", "ea", ")", "midx", "=", "idc", ".", "GetFirstMember", "(", "sid", ")", "while", "midx", "!=", "idc", ".", "...
https://github.com/mandiant/flare-ida/blob/b5b3993bdd224b7d6d7bd524045195550c156c44/examples/argtracker_example1.py#L51-L75
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/ipykernel/gui/gtkembed.py
python
GTKEmbed._wire_kernel
(self)
return False
Initializes the kernel inside GTK. This is meant to run only once at startup, so it does its job and returns False to ensure it doesn't get run again by GTK.
Initializes the kernel inside GTK.
[ "Initializes", "the", "kernel", "inside", "GTK", "." ]
def _wire_kernel(self): """Initializes the kernel inside GTK. This is meant to run only once at startup, so it does its job and returns False to ensure it doesn't get run again by GTK. """ self.gtk_main, self.gtk_main_quit = self._hijack_gtk() gobject.timeout_add(int(100...
[ "def", "_wire_kernel", "(", "self", ")", ":", "self", ".", "gtk_main", ",", "self", ".", "gtk_main_quit", "=", "self", ".", "_hijack_gtk", "(", ")", "gobject", ".", "timeout_add", "(", "int", "(", "1000", "*", "self", ".", "kernel", ".", "_poll_interval"...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/ipykernel/gui/gtkembed.py#L40-L49
w3h/isf
6faf0a3df185465ec17369c90ccc16e2a03a1870
lib/thirdparty/scapy/contrib/gsm_um.py
python
holdReject
()
return packet
HOLD REJECT Section 9.3.12
HOLD REJECT Section 9.3.12
[ "HOLD", "REJECT", "Section", "9", ".", "3", ".", "12" ]
def holdReject(): """HOLD REJECT Section 9.3.12""" a = TpPd(pd=0x3) b = MessageType(mesType=0x1a) # 00011010 c = Cause() packet = a / b / c return packet
[ "def", "holdReject", "(", ")", ":", "a", "=", "TpPd", "(", "pd", "=", "0x3", ")", "b", "=", "MessageType", "(", "mesType", "=", "0x1a", ")", "# 00011010", "c", "=", "Cause", "(", ")", "packet", "=", "a", "/", "b", "/", "c", "return", "packet" ]
https://github.com/w3h/isf/blob/6faf0a3df185465ec17369c90ccc16e2a03a1870/lib/thirdparty/scapy/contrib/gsm_um.py#L1811-L1817
keiffster/program-y
8c99b56f8c32f01a7b9887b5daae9465619d0385
src/programy/security/linking/accountlinker.py
python
BasicAccountLinkerService.__init__
(self, storage_engine)
[]
def __init__(self, storage_engine): self._storage_engine = storage_engine
[ "def", "__init__", "(", "self", ",", "storage_engine", ")", ":", "self", ".", "_storage_engine", "=", "storage_engine" ]
https://github.com/keiffster/program-y/blob/8c99b56f8c32f01a7b9887b5daae9465619d0385/src/programy/security/linking/accountlinker.py#L68-L69
JiYou/openstack
8607dd488bde0905044b303eb6e52bdea6806923
packages/source/cinder/cinder/volume/drivers/storwize_svc.py
python
StorwizeSVCDriver._get_chap_secret_for_host
(self, host_name)
return chap_secret
Return the CHAP secret for the given host.
Return the CHAP secret for the given host.
[ "Return", "the", "CHAP", "secret", "for", "the", "given", "host", "." ]
def _get_chap_secret_for_host(self, host_name): """Return the CHAP secret for the given host.""" LOG.debug(_('enter: _get_chap_secret_for_host: host name %s') % host_name) ssh_cmd = 'lsiscsiauth -delim !' out, err = self._run_ssh(ssh_cmd) if not len(out.strip...
[ "def", "_get_chap_secret_for_host", "(", "self", ",", "host_name", ")", ":", "LOG", ".", "debug", "(", "_", "(", "'enter: _get_chap_secret_for_host: host name %s'", ")", "%", "host_name", ")", "ssh_cmd", "=", "'lsiscsiauth -delim !'", "out", ",", "err", "=", "self...
https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/cinder/cinder/volume/drivers/storwize_svc.py#L352-L395
Asana/python-asana
9b54ab99423208bd6aa87dbfaa628c069430b127
asana/resources/gen/goals.py
python
_Goals.update_goal
(self, goal_gid, params=None, **options)
return self.client.put(path, params, **options)
Update a goal :param str goal_gid: (required) Globally unique identifier for the goal. :param Object params: Parameters for the request :param **options - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve...
Update a goal :param str goal_gid: (required) Globally unique identifier for the goal. :param Object params: Parameters for the request :param **options - opt_fields {list[str]}: Defines fields to return. Some requests return *compact* representations of objects in order to conserve...
[ "Update", "a", "goal", ":", "param", "str", "goal_gid", ":", "(", "required", ")", "Globally", "unique", "identifier", "for", "the", "goal", ".", ":", "param", "Object", "params", ":", "Parameters", "for", "the", "request", ":", "param", "**", "options", ...
def update_goal(self, goal_gid, params=None, **options): """Update a goal :param str goal_gid: (required) Globally unique identifier for the goal. :param Object params: Parameters for the request :param **options - opt_fields {list[str]}: Defines fields to return. Some reque...
[ "def", "update_goal", "(", "self", ",", "goal_gid", ",", "params", "=", "None", ",", "*", "*", "options", ")", ":", "if", "params", "is", "None", ":", "params", "=", "{", "}", "path", "=", "\"/goals/{goal_gid}\"", ".", "replace", "(", "\"{goal_gid}\"", ...
https://github.com/Asana/python-asana/blob/9b54ab99423208bd6aa87dbfaa628c069430b127/asana/resources/gen/goals.py#L201-L213
Emptyset110/dHydra
8ec44994ff4dda8bf1ec40e38dd068b757945933
dHydra/Vendor/SinaL2/Sina/Vendor.py
python
Vendor.__init__
(self, logLevel=logging.INFO)
[]
def __init__(self, logLevel=logging.INFO): self.logger = self.get_logger()
[ "def", "__init__", "(", "self", ",", "logLevel", "=", "logging", ".", "INFO", ")", ":", "self", ".", "logger", "=", "self", ".", "get_logger", "(", ")" ]
https://github.com/Emptyset110/dHydra/blob/8ec44994ff4dda8bf1ec40e38dd068b757945933/dHydra/Vendor/SinaL2/Sina/Vendor.py#L7-L8
fake-name/ReadableWebProxy
ed5c7abe38706acc2684a1e6cd80242a03c5f010
WebMirror/management/rss_parser_funcs/feed_parse_extractAswTenanBlogspotCom.py
python
extractAswTenanBlogspotCom
(item)
return False
Parser for 'asw-tenan.blogspot.com'
Parser for 'asw-tenan.blogspot.com'
[ "Parser", "for", "asw", "-", "tenan", ".", "blogspot", ".", "com" ]
def extractAswTenanBlogspotCom(item): ''' Parser for 'asw-tenan.blogspot.com' ''' if 'English' not in item['tags']: return None if 'Bahasa Indonesia' in item['tags']: return None vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or "preview" in item['title'].lower...
[ "def", "extractAswTenanBlogspotCom", "(", "item", ")", ":", "if", "'English'", "not", "in", "item", "[", "'tags'", "]", ":", "return", "None", "if", "'Bahasa Indonesia'", "in", "item", "[", "'tags'", "]", ":", "return", "None", "vol", ",", "chp", ",", "f...
https://github.com/fake-name/ReadableWebProxy/blob/ed5c7abe38706acc2684a1e6cd80242a03c5f010/WebMirror/management/rss_parser_funcs/feed_parse_extractAswTenanBlogspotCom.py#L1-L26
Ha0Tang/SelectionGAN
80aa7ad9f79f643c28633c40c621f208f3fb0121
selectiongan_v2/data/image_folder.py
python
ImageFolder.__len__
(self)
return len(self.imgs)
[]
def __len__(self): return len(self.imgs)
[ "def", "__len__", "(", "self", ")", ":", "return", "len", "(", "self", ".", "imgs", ")" ]
https://github.com/Ha0Tang/SelectionGAN/blob/80aa7ad9f79f643c28633c40c621f208f3fb0121/selectiongan_v2/data/image_folder.py#L67-L68
glitchdotcom/WebPutty
4f5da5eb2b4668cbf3c15cf002feacd1d95d2ef7
ziplibs/BeautifulSoup.py
python
Tag._getAttrMap
(self)
return self.attrMap
Initializes a map representation of this tag's attributes, if not already initialized.
Initializes a map representation of this tag's attributes, if not already initialized.
[ "Initializes", "a", "map", "representation", "of", "this", "tag", "s", "attributes", "if", "not", "already", "initialized", "." ]
def _getAttrMap(self): """Initializes a map representation of this tag's attributes, if not already initialized.""" if not getattr(self, 'attrMap'): self.attrMap = {} for (key, value) in self.attrs: self.attrMap[key] = value return self.attrMap
[ "def", "_getAttrMap", "(", "self", ")", ":", "if", "not", "getattr", "(", "self", ",", "'attrMap'", ")", ":", "self", ".", "attrMap", "=", "{", "}", "for", "(", "key", ",", "value", ")", "in", "self", ".", "attrs", ":", "self", ".", "attrMap", "[...
https://github.com/glitchdotcom/WebPutty/blob/4f5da5eb2b4668cbf3c15cf002feacd1d95d2ef7/ziplibs/BeautifulSoup.py#L861-L868
biolab/orange3
41685e1c7b1d1babe680113685a2d44bcc9fec0b
Orange/widgets/data/utils/pythoneditor/editor.py
python
LineNumberArea.setVisible
(self, val)
Override the QWidget::setVisible(bool) method to properly recalculate the editor viewport.
Override the QWidget::setVisible(bool) method to properly recalculate the editor viewport.
[ "Override", "the", "QWidget", "::", "setVisible", "(", "bool", ")", "method", "to", "properly", "recalculate", "the", "editor", "viewport", "." ]
def setVisible(self, val): """Override the QWidget::setVisible(bool) method to properly recalculate the editor viewport. """ if val != self.isVisible(): if val: super().setVisible(True) else: super().setVisible(False) ...
[ "def", "setVisible", "(", "self", ",", "val", ")", ":", "if", "val", "!=", "self", ".", "isVisible", "(", ")", ":", "if", "val", ":", "super", "(", ")", ".", "setVisible", "(", "True", ")", "else", ":", "super", "(", ")", ".", "setVisible", "(", ...
https://github.com/biolab/orange3/blob/41685e1c7b1d1babe680113685a2d44bcc9fec0b/Orange/widgets/data/utils/pythoneditor/editor.py#L1806-L1815
craftGBD/craftGBD
96d70519fbd02a86c3b5e0ddbedb2d67b5b6a99a
evaluation/lib/tmp/rpn/generate_anchors.py
python
_whctrs
(anchor)
return w, h, x_ctr, y_ctr
Return width, height, x center, and y center for an anchor (window).
Return width, height, x center, and y center for an anchor (window).
[ "Return", "width", "height", "x", "center", "and", "y", "center", "for", "an", "anchor", "(", "window", ")", "." ]
def _whctrs(anchor): """ Return width, height, x center, and y center for an anchor (window). """ w = anchor[2] - anchor[0] + 1 h = anchor[3] - anchor[1] + 1 x_ctr = anchor[0] + 0.5 * (w - 1) y_ctr = anchor[1] + 0.5 * (h - 1) return w, h, x_ctr, y_ctr
[ "def", "_whctrs", "(", "anchor", ")", ":", "w", "=", "anchor", "[", "2", "]", "-", "anchor", "[", "0", "]", "+", "1", "h", "=", "anchor", "[", "3", "]", "-", "anchor", "[", "1", "]", "+", "1", "x_ctr", "=", "anchor", "[", "0", "]", "+", "...
https://github.com/craftGBD/craftGBD/blob/96d70519fbd02a86c3b5e0ddbedb2d67b5b6a99a/evaluation/lib/tmp/rpn/generate_anchors.py#L50-L59
HewlettPackard/dlcookbook-dlbs
863ac1d7e72ad2fcafc78d8a13f67d35bc00c235
python/tf_cnn_benchmarks/allreduce.py
python
contains_any
(haystack, needles)
return False
Tests if any needle is a substring of haystack. Args: haystack: a string needles: list of strings Returns: True if any element of needles is a substring of haystack, False otherwise.
Tests if any needle is a substring of haystack.
[ "Tests", "if", "any", "needle", "is", "a", "substring", "of", "haystack", "." ]
def contains_any(haystack, needles): """Tests if any needle is a substring of haystack. Args: haystack: a string needles: list of strings Returns: True if any element of needles is a substring of haystack, False otherwise. """ for n in needles: if n in haystack: return True ret...
[ "def", "contains_any", "(", "haystack", ",", "needles", ")", ":", "for", "n", "in", "needles", ":", "if", "n", "in", "haystack", ":", "return", "True", "return", "False" ]
https://github.com/HewlettPackard/dlcookbook-dlbs/blob/863ac1d7e72ad2fcafc78d8a13f67d35bc00c235/python/tf_cnn_benchmarks/allreduce.py#L264-L278
librosa/librosa
76029d35ce4c76a7475f07aab67fe2df3f73c25c
librosa/util/_nnls.py
python
_nnls_obj
(x, shape, A, B)
return value, grad.flatten()
Compute the objective and gradient for NNLS
Compute the objective and gradient for NNLS
[ "Compute", "the", "objective", "and", "gradient", "for", "NNLS" ]
def _nnls_obj(x, shape, A, B): """Compute the objective and gradient for NNLS""" # Scipy's lbfgs flattens all arrays, so we first reshape # the iterate x x = x.reshape(shape) # Compute the difference matrix diff = np.einsum("mf,...ft->...mt", A, x, optimize=True) - B # Compute the objecti...
[ "def", "_nnls_obj", "(", "x", ",", "shape", ",", "A", ",", "B", ")", ":", "# Scipy's lbfgs flattens all arrays, so we first reshape", "# the iterate x", "x", "=", "x", ".", "reshape", "(", "shape", ")", "# Compute the difference matrix", "diff", "=", "np", ".", ...
https://github.com/librosa/librosa/blob/76029d35ce4c76a7475f07aab67fe2df3f73c25c/librosa/util/_nnls.py#L20-L37
rubik/xenon
2991cb8a4b0a2a9242ccc3ebc4ee316293e58bc2
xenon/core.py
python
find_infractions
(args, logger, results)
return infractions
Analyze the results and find if the thresholds are surpassed. *args* and *logger* are the same as in :func:`~xenon.core.analyze`, while *results* is a dictionary holding the results of the complexity analysis. The number of infractions with respect to the threshold values is returned.
Analyze the results and find if the thresholds are surpassed.
[ "Analyze", "the", "results", "and", "find", "if", "the", "thresholds", "are", "surpassed", "." ]
def find_infractions(args, logger, results): '''Analyze the results and find if the thresholds are surpassed. *args* and *logger* are the same as in :func:`~xenon.core.analyze`, while *results* is a dictionary holding the results of the complexity analysis. The number of infractions with respect to th...
[ "def", "find_infractions", "(", "args", ",", "logger", ",", "results", ")", ":", "infractions", "=", "0", "module_averages", "=", "[", "]", "total_cc", "=", "0.", "total_blocks", "=", "0", "for", "module", ",", "blocks", "in", "results", ".", "items", "(...
https://github.com/rubik/xenon/blob/2991cb8a4b0a2a9242ccc3ebc4ee316293e58bc2/xenon/core.py#L47-L90
Trusted-AI/AIX360
36459f2a585d0e2a2e8582562bf226d4402b57d6
aix360/algorithms/lime/lime_wrapper.py
python
LimeTextExplainer.set_params
(self, *argv, **kwargs)
Optionally, set parameters for the explainer.
Optionally, set parameters for the explainer.
[ "Optionally", "set", "parameters", "for", "the", "explainer", "." ]
def set_params(self, *argv, **kwargs): """ Optionally, set parameters for the explainer. """ pass
[ "def", "set_params", "(", "self", ",", "*", "argv", ",", "*", "*", "kwargs", ")", ":", "pass" ]
https://github.com/Trusted-AI/AIX360/blob/36459f2a585d0e2a2e8582562bf226d4402b57d6/aix360/algorithms/lime/lime_wrapper.py#L23-L27
mrlesmithjr/Ansible
d44f0dc0d942bdf3bf7334b307e6048f0ee16e36
roles/ansible-vsphere-management/scripts/pdns/lib/python2.7/site-packages/urllib3/packages/six.py
python
add_metaclass
(metaclass)
return wrapper
Class decorator for creating a class with a metaclass.
Class decorator for creating a class with a metaclass.
[ "Class", "decorator", "for", "creating", "a", "class", "with", "a", "metaclass", "." ]
def add_metaclass(metaclass): """Class decorator for creating a class with a metaclass.""" def wrapper(cls): orig_vars = cls.__dict__.copy() slots = orig_vars.get('__slots__') if slots is not None: if isinstance(slots, str): slots = [slots] for slo...
[ "def", "add_metaclass", "(", "metaclass", ")", ":", "def", "wrapper", "(", "cls", ")", ":", "orig_vars", "=", "cls", ".", "__dict__", ".", "copy", "(", ")", "slots", "=", "orig_vars", ".", "get", "(", "'__slots__'", ")", "if", "slots", "is", "not", "...
https://github.com/mrlesmithjr/Ansible/blob/d44f0dc0d942bdf3bf7334b307e6048f0ee16e36/roles/ansible-vsphere-management/scripts/pdns/lib/python2.7/site-packages/urllib3/packages/six.py#L812-L825
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/turtle.py
python
TPen.pencolor
(self, *args)
Return or set the pencolor. Arguments: Four input formats are allowed: - pencolor() Return the current pencolor as color specification string, possibly in hex-number format (see example). May be used as input to another color/pencolor/fillcolor call. ...
Return or set the pencolor.
[ "Return", "or", "set", "the", "pencolor", "." ]
def pencolor(self, *args): """ Return or set the pencolor. Arguments: Four input formats are allowed: - pencolor() Return the current pencolor as color specification string, possibly in hex-number format (see example). May be used as input to anothe...
[ "def", "pencolor", "(", "self", ",", "*", "args", ")", ":", "if", "args", ":", "color", "=", "self", ".", "_colorstr", "(", "args", ")", "if", "color", "==", "self", ".", "_pencolor", ":", "return", "self", ".", "pen", "(", "pencolor", "=", "color"...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/turtle.py#L2222-L2257
zetaops/ulakbus
bcc05abf17bbd6dbeec93809e4ad30885e94e83e
ulakbus/views/ders_programi/derslik_sinav_programlari.py
python
DerslikSinavProgramlari.bilgi_ver
(self)
Yayınlananmış sınavlar yok ise bilgi mesajı ekrana basılır.
Yayınlananmış sınavlar yok ise bilgi mesajı ekrana basılır.
[ "Yayınlananmış", "sınavlar", "yok", "ise", "bilgi", "mesajı", "ekrana", "basılır", "." ]
def bilgi_ver(self): """ Yayınlananmış sınavlar yok ise bilgi mesajı ekrana basılır. """ self.current.output['msgbox'] = { 'type': 'info', "title": _(u'Yayınlanmamış Sınavlar'), 'msg': _(u"Yayınlanmış sınavlar bulunmamaktadır.") }
[ "def", "bilgi_ver", "(", "self", ")", ":", "self", ".", "current", ".", "output", "[", "'msgbox'", "]", "=", "{", "'type'", ":", "'info'", ",", "\"title\"", ":", "_", "(", "u'Yayınlanmamış Sınavlar'),", "", "", "'msg'", ":", "_", "(", "u\"Yayınlanmış sın...
https://github.com/zetaops/ulakbus/blob/bcc05abf17bbd6dbeec93809e4ad30885e94e83e/ulakbus/views/ders_programi/derslik_sinav_programlari.py#L58-L66
windelbouwman/ppci
915c069e0667042c085ec42c78e9e3c9a5295324
ppci/arch/arch_info.py
python
ArchInfo.get_register
(self, name)
return self._registers_by_name[name]
Retrieve the machine register by name.
Retrieve the machine register by name.
[ "Retrieve", "the", "machine", "register", "by", "name", "." ]
def get_register(self, name): """ Retrieve the machine register by name. """ return self._registers_by_name[name]
[ "def", "get_register", "(", "self", ",", "name", ")", ":", "return", "self", ".", "_registers_by_name", "[", "name", "]" ]
https://github.com/windelbouwman/ppci/blob/915c069e0667042c085ec42c78e9e3c9a5295324/ppci/arch/arch_info.py#L60-L62
open-io/oio-sds
16041950b6056a55d5ce7ca77795defe6dfa6c61
oio/common/green.py
python
eventlet_yield
()
Swith to another eventlet coroutine.
Swith to another eventlet coroutine.
[ "Swith", "to", "another", "eventlet", "coroutine", "." ]
def eventlet_yield(): """Swith to another eventlet coroutine.""" sleep(0)
[ "def", "eventlet_yield", "(", ")", ":", "sleep", "(", "0", ")" ]
https://github.com/open-io/oio-sds/blob/16041950b6056a55d5ce7ca77795defe6dfa6c61/oio/common/green.py#L73-L75
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/nose-1.3.7/nose/plugins/logcapture.py
python
LogCapture.afterTest
(self, test)
Clear buffers after test.
Clear buffers after test.
[ "Clear", "buffers", "after", "test", "." ]
def afterTest(self, test): """Clear buffers after test. """ self.handler.truncate()
[ "def", "afterTest", "(", "self", ",", "test", ")", ":", "self", ".", "handler", ".", "truncate", "(", ")" ]
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/nose-1.3.7/nose/plugins/logcapture.py#L219-L222
PaddlePaddle/ERNIE
15eddb022ce1beb281777e9ab8807a1bdfa7a76e
propeller/paddle/train/monitored_executor.py
python
RunState.__repr__
(self)
return repr(self.state_dict())
doc
doc
[ "doc" ]
def __repr__(self): """doc""" return repr(self.state_dict())
[ "def", "__repr__", "(", "self", ")", ":", "return", "repr", "(", "self", ".", "state_dict", "(", ")", ")" ]
https://github.com/PaddlePaddle/ERNIE/blob/15eddb022ce1beb281777e9ab8807a1bdfa7a76e/propeller/paddle/train/monitored_executor.py#L99-L101
jantman/awslimitchecker
411ad9e734ddb16d87720ff5b994f19f47b8b098
awslimitchecker/services/apigateway.py
python
_ApigatewayService._find_usage_vpc_links
(self)
Find usage on VPC Links. Update `self.limits`.
Find usage on VPC Links. Update `self.limits`.
[ "Find", "usage", "on", "VPC", "Links", ".", "Update", "self", ".", "limits", "." ]
def _find_usage_vpc_links(self): """ Find usage on VPC Links. Update `self.limits`. """ logger.debug('Finding usage for VPC Links') link_count = 0 paginator = self.conn.get_paginator('get_vpc_links') for resp in paginator.paginate(): link_count += len(...
[ "def", "_find_usage_vpc_links", "(", "self", ")", ":", "logger", ".", "debug", "(", "'Finding usage for VPC Links'", ")", "link_count", "=", "0", "paginator", "=", "self", ".", "conn", ".", "get_paginator", "(", "'get_vpc_links'", ")", "for", "resp", "in", "pa...
https://github.com/jantman/awslimitchecker/blob/411ad9e734ddb16d87720ff5b994f19f47b8b098/awslimitchecker/services/apigateway.py#L180-L191
fake-name/ReadableWebProxy
ed5c7abe38706acc2684a1e6cd80242a03c5f010
WebMirror/management/rss_parser_funcs/feed_parse_extractRosynightWordpressCom.py
python
extractRosynightWordpressCom
(item)
return False
Parser for 'rosynight.wordpress.com'
Parser for 'rosynight.wordpress.com'
[ "Parser", "for", "rosynight", ".", "wordpress", ".", "com" ]
def extractRosynightWordpressCom(item): ''' Parser for 'rosynight.wordpress.com' ''' vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or "preview" in item['title'].lower(): return None tagmap = [ ('CC', 'Cāi Cāi', 'translated'), ('...
[ "def", "extractRosynightWordpressCom", "(", "item", ")", ":", "vol", ",", "chp", ",", "frag", ",", "postfix", "=", "extractVolChapterFragmentPostfix", "(", "item", "[", "'title'", "]", ")", "if", "not", "(", "chp", "or", "vol", ")", "or", "\"preview\"", "i...
https://github.com/fake-name/ReadableWebProxy/blob/ed5c7abe38706acc2684a1e6cd80242a03c5f010/WebMirror/management/rss_parser_funcs/feed_parse_extractRosynightWordpressCom.py#L1-L22
onaio/onadata
89ad16744e8f247fb748219476f6ac295869a95f
onadata/apps/logger/models/submission_review.py
python
SubmissionReview.set_deleted
(self, deleted_at=timezone.now(), user=None)
Sets the deleted_at and deleted_by fields
Sets the deleted_at and deleted_by fields
[ "Sets", "the", "deleted_at", "and", "deleted_by", "fields" ]
def set_deleted(self, deleted_at=timezone.now(), user=None): """ Sets the deleted_at and deleted_by fields """ if user: self.deleted_by = user self.deleted_at = deleted_at self.save()
[ "def", "set_deleted", "(", "self", ",", "deleted_at", "=", "timezone", ".", "now", "(", ")", ",", "user", "=", "None", ")", ":", "if", "user", ":", "self", ".", "deleted_by", "=", "user", "self", ".", "deleted_at", "=", "deleted_at", "self", ".", "sa...
https://github.com/onaio/onadata/blob/89ad16744e8f247fb748219476f6ac295869a95f/onadata/apps/logger/models/submission_review.py#L80-L87
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-linux/x64/tornado/web.py
python
StaticFileHandler.get
(self, path: str, include_body: bool = True)
[]
async def get(self, path: str, include_body: bool = True) -> None: # Set up our path instance variables. self.path = self.parse_url_path(path) del path # make sure we don't refer to path instead of self.path again absolute_path = self.get_absolute_path(self.root, self.path) self...
[ "async", "def", "get", "(", "self", ",", "path", ":", "str", ",", "include_body", ":", "bool", "=", "True", ")", "->", "None", ":", "# Set up our path instance variables.", "self", ".", "path", "=", "self", ".", "parse_url_path", "(", "path", ")", "del", ...
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-linux/x64/tornado/web.py#L2576-L2657
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_openshift/library/oc_obj.py
python
Yedit._write
(filename, contents)
Actually write the file contents to disk. This helps with mocking.
Actually write the file contents to disk. This helps with mocking.
[ "Actually", "write", "the", "file", "contents", "to", "disk", ".", "This", "helps", "with", "mocking", "." ]
def _write(filename, contents): ''' Actually write the file contents to disk. This helps with mocking. ''' tmp_filename = filename + '.yedit' with open(tmp_filename, 'w') as yfd: fcntl.flock(yfd, fcntl.LOCK_EX | fcntl.LOCK_NB) yfd.write(contents) fcntl.flock...
[ "def", "_write", "(", "filename", ",", "contents", ")", ":", "tmp_filename", "=", "filename", "+", "'.yedit'", "with", "open", "(", "tmp_filename", ",", "'w'", ")", "as", "yfd", ":", "fcntl", ".", "flock", "(", "yfd", ",", "fcntl", ".", "LOCK_EX", "|",...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_openshift/library/oc_obj.py#L361-L371
tobegit3hub/deep_image_model
8a53edecd9e00678b278bb10f6fb4bdb1e4ee25e
java_predict_client/src/main/proto/tensorflow/python/ops/linalg_grad.py
python
_CholeskyGrad
(op, grad)
return linalg_ops.cholesky_grad(op.outputs[0], grad)
Gradient for Cholesky.
Gradient for Cholesky.
[ "Gradient", "for", "Cholesky", "." ]
def _CholeskyGrad(op, grad): """Gradient for Cholesky.""" return linalg_ops.cholesky_grad(op.outputs[0], grad)
[ "def", "_CholeskyGrad", "(", "op", ",", "grad", ")", ":", "return", "linalg_ops", ".", "cholesky_grad", "(", "op", ".", "outputs", "[", "0", "]", ",", "grad", ")" ]
https://github.com/tobegit3hub/deep_image_model/blob/8a53edecd9e00678b278bb10f6fb4bdb1e4ee25e/java_predict_client/src/main/proto/tensorflow/python/ops/linalg_grad.py#L58-L60
aws-samples/aws-kube-codesuite
ab4e5ce45416b83bffb947ab8d234df5437f4fca
src/kubernetes/client/apis/apiregistration_v1beta1_api.py
python
ApiregistrationV1beta1Api.get_api_resources
(self, **kwargs)
get available resources This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> ...
get available resources This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> ...
[ "get", "available", "resources", "This", "method", "makes", "a", "synchronous", "HTTP", "request", "by", "default", ".", "To", "make", "an", "asynchronous", "HTTP", "request", "please", "define", "a", "callback", "function", "to", "be", "invoked", "when", "rec...
def get_api_resources(self, **kwargs): """ get available resources This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(respo...
[ "def", "get_api_resources", "(", "self", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'callback'", ")", ":", "return", "self", ".", "get_api_resources_with_http_info", "(", ...
https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/kubernetes/client/apis/apiregistration_v1beta1_api.py#L406-L428
twisted/twisted
dee676b040dd38b847ea6fb112a712cb5e119490
src/twisted/conch/ssh/connection.py
python
SSHConnection.ssh_CHANNEL_OPEN_FAILURE
(self, packet)
The other side did not accept our MSG_CHANNEL_OPEN request. Payload:: uint32 local channel number uint32 reason code string reason description Find the channel using the local channel number and notify it by calling its openFailed() method.
The other side did not accept our MSG_CHANNEL_OPEN request. Payload:: uint32 local channel number uint32 reason code string reason description
[ "The", "other", "side", "did", "not", "accept", "our", "MSG_CHANNEL_OPEN", "request", ".", "Payload", "::", "uint32", "local", "channel", "number", "uint32", "reason", "code", "string", "reason", "description" ]
def ssh_CHANNEL_OPEN_FAILURE(self, packet): """ The other side did not accept our MSG_CHANNEL_OPEN request. Payload:: uint32 local channel number uint32 reason code string reason description Find the channel using the local channel number and notify it by...
[ "def", "ssh_CHANNEL_OPEN_FAILURE", "(", "self", ",", "packet", ")", ":", "localChannel", ",", "reasonCode", "=", "struct", ".", "unpack", "(", "\">2L\"", ",", "packet", "[", ":", "8", "]", ")", "reasonDesc", "=", "common", ".", "getNS", "(", "packet", "[...
https://github.com/twisted/twisted/blob/dee676b040dd38b847ea6fb112a712cb5e119490/src/twisted/conch/ssh/connection.py#L207-L223
PennyLaneAI/pennylane
1275736f790ced1d778858ed383448d4a43a4cdd
pennylane/devices/default_gaussian.py
python
squeezed_cov
(r, phi, hbar=2)
return R @ cov @ R.T
r"""Returns the squeezed covariance matrix of a squeezed state. Args: r (float): the squeezing magnitude p (float): the squeezing phase :math:`\phi` hbar (float): (default 2) the value of :math:`\hbar` in the commutation relation :math:`[\x,\p]=i\hbar` Returns: array...
r"""Returns the squeezed covariance matrix of a squeezed state.
[ "r", "Returns", "the", "squeezed", "covariance", "matrix", "of", "a", "squeezed", "state", "." ]
def squeezed_cov(r, phi, hbar=2): r"""Returns the squeezed covariance matrix of a squeezed state. Args: r (float): the squeezing magnitude p (float): the squeezing phase :math:`\phi` hbar (float): (default 2) the value of :math:`\hbar` in the commutation relation :math:`[\x,...
[ "def", "squeezed_cov", "(", "r", ",", "phi", ",", "hbar", "=", "2", ")", ":", "cov", "=", "np", ".", "array", "(", "[", "[", "math", ".", "exp", "(", "-", "2", "*", "r", ")", ",", "0", "]", ",", "[", "0", ",", "math", ".", "exp", "(", "...
https://github.com/PennyLaneAI/pennylane/blob/1275736f790ced1d778858ed383448d4a43a4cdd/pennylane/devices/default_gaussian.py#L332-L347
dropbox/dropbox-sdk-python
015437429be224732990041164a21a0501235db1
dropbox/base_team.py
python
DropboxTeamBase.file_properties_templates_list_for_team
(self)
return r
Get the template identifiers for a team. To get the schema of each template use :meth:`file_properties_templates_get_for_team`. :rtype: :class:`dropbox.file_properties.ListTemplateResult` :raises: :class:`.exceptions.ApiError` If this raises, ApiError will contain: :class:`...
Get the template identifiers for a team. To get the schema of each template use :meth:`file_properties_templates_get_for_team`.
[ "Get", "the", "template", "identifiers", "for", "a", "team", ".", "To", "get", "the", "schema", "of", "each", "template", "use", ":", "meth", ":", "file_properties_templates_get_for_team", "." ]
def file_properties_templates_list_for_team(self): """ Get the template identifiers for a team. To get the schema of each template use :meth:`file_properties_templates_get_for_team`. :rtype: :class:`dropbox.file_properties.ListTemplateResult` :raises: :class:`.exceptions.ApiErro...
[ "def", "file_properties_templates_list_for_team", "(", "self", ")", ":", "arg", "=", "None", "r", "=", "self", ".", "request", "(", "file_properties", ".", "templates_list_for_team", ",", "'file_properties'", ",", "arg", ",", "None", ",", ")", "return", "r" ]
https://github.com/dropbox/dropbox-sdk-python/blob/015437429be224732990041164a21a0501235db1/dropbox/base_team.py#L101-L119
smart-mobile-software/gitstack
d9fee8f414f202143eb6e620529e8e5539a2af56
python/Lib/site-packages/django/db/backends/__init__.py
python
BaseDatabaseOperations.value_to_db_decimal
(self, value, max_digits, decimal_places)
return util.format_number(value, max_digits, decimal_places)
Transform a decimal.Decimal value to an object compatible with what is expected by the backend driver for decimal (numeric) columns.
Transform a decimal.Decimal value to an object compatible with what is expected by the backend driver for decimal (numeric) columns.
[ "Transform", "a", "decimal", ".", "Decimal", "value", "to", "an", "object", "compatible", "with", "what", "is", "expected", "by", "the", "backend", "driver", "for", "decimal", "(", "numeric", ")", "columns", "." ]
def value_to_db_decimal(self, value, max_digits, decimal_places): """ Transform a decimal.Decimal value to an object compatible with what is expected by the backend driver for decimal (numeric) columns. """ if value is None: return None return util.format_numb...
[ "def", "value_to_db_decimal", "(", "self", ",", "value", ",", "max_digits", ",", "decimal_places", ")", ":", "if", "value", "is", "None", ":", "return", "None", "return", "util", ".", "format_number", "(", "value", ",", "max_digits", ",", "decimal_places", "...
https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/site-packages/django/db/backends/__init__.py#L802-L809
apache/tvm
6eb4ed813ebcdcd9558f0906a1870db8302ff1e0
python/tvm/auto_scheduler/relay_integration.py
python
exit_layout_rewrite
()
Exit layout rewrite tracing environment
Exit layout rewrite tracing environment
[ "Exit", "layout", "rewrite", "tracing", "environment" ]
def exit_layout_rewrite(): """Exit layout rewrite tracing environment""" env = TracingEnvironment.current env.__exit__(None, None, None)
[ "def", "exit_layout_rewrite", "(", ")", ":", "env", "=", "TracingEnvironment", ".", "current", "env", ".", "__exit__", "(", "None", ",", "None", ",", "None", ")" ]
https://github.com/apache/tvm/blob/6eb4ed813ebcdcd9558f0906a1870db8302ff1e0/python/tvm/auto_scheduler/relay_integration.py#L249-L252
meiqua/6DPose
619be5790448b4cd13290cf7727b35f1265e69e0
cxxLCHF/setup.py
python
CMakeBuild.build_extension
(self, ext)
[]
def build_extension(self, ext): extdir = os.path.abspath(os.path.dirname(self.get_ext_fullpath(ext.name))) cmake_args = ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + extdir, '-DPYTHON_EXECUTABLE=' + sys.executable] cfg = 'Debug' if self.debug else 'Release' build_args = [...
[ "def", "build_extension", "(", "self", ",", "ext", ")", ":", "extdir", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "dirname", "(", "self", ".", "get_ext_fullpath", "(", "ext", ".", "name", ")", ")", ")", "cmake_args", "=", ...
https://github.com/meiqua/6DPose/blob/619be5790448b4cd13290cf7727b35f1265e69e0/cxxLCHF/setup.py#L35-L61
JacquesLucke/animation_nodes
b1e3ace8dcb0a771fd882fc3ac4e490b009fa0d1
animation_nodes/nodes/object/object_id_key.py
python
ObjectIDKeyNode.getExecutionCode_Base
(self, keyName, required)
[]
def getExecutionCode_Base(self, keyName, required): dataType = self.keyDataType if "exists" in required: yield "exists = _key.exists(object, %s)" % keyName yield "data = _key.get(object, %s)" % keyName if dataType == "Transforms": yield "location, rotation, sca...
[ "def", "getExecutionCode_Base", "(", "self", ",", "keyName", ",", "required", ")", ":", "dataType", "=", "self", ".", "keyDataType", "if", "\"exists\"", "in", "required", ":", "yield", "\"exists = _key.exists(object, %s)\"", "%", "keyName", "yield", "\"data = _key.g...
https://github.com/JacquesLucke/animation_nodes/blob/b1e3ace8dcb0a771fd882fc3ac4e490b009fa0d1/animation_nodes/nodes/object/object_id_key.py#L87-L102
crossbario/crossbar
ed350b7ba1c8421f3640b9c2e94a21ed4cfdff64
crossbar/router/broker.py
python
Broker.detach
(self, session)
Implements :func:`crossbar.router.interfaces.IBroker.detach`
Implements :func:`crossbar.router.interfaces.IBroker.detach`
[ "Implements", ":", "func", ":", "crossbar", ".", "router", ".", "interfaces", ".", "IBroker", ".", "detach" ]
def detach(self, session): """ Implements :func:`crossbar.router.interfaces.IBroker.detach` """ if session in self._session_to_subscriptions: for subscription in self._session_to_subscriptions[session]: was_subscribed, was_last_subscriber = self._subscriptio...
[ "def", "detach", "(", "self", ",", "session", ")", ":", "if", "session", "in", "self", ".", "_session_to_subscriptions", ":", "for", "subscription", "in", "self", ".", "_session_to_subscriptions", "[", "session", "]", ":", "was_subscribed", ",", "was_last_subscr...
https://github.com/crossbario/crossbar/blob/ed350b7ba1c8421f3640b9c2e94a21ed4cfdff64/crossbar/router/broker.py#L119-L174
CGATOxford/cgat
326aad4694bdfae8ddc194171bb5d73911243947
CGAT/Bed.py
python
Bed.fromIntervals
(self, intervals)
Fill co-ordinates from list of intervals. If multiple intervals are provided and entry is BED12 then the blocks are automatically set. Arguments --------- intervals : list List of tuples (start, end) with block coordinates.
Fill co-ordinates from list of intervals.
[ "Fill", "co", "-", "ordinates", "from", "list", "of", "intervals", "." ]
def fromIntervals(self, intervals): """Fill co-ordinates from list of intervals. If multiple intervals are provided and entry is BED12 then the blocks are automatically set. Arguments --------- intervals : list List of tuples (start, end) with block coordinat...
[ "def", "fromIntervals", "(", "self", ",", "intervals", ")", ":", "intervals", "=", "sorted", "(", "intervals", ")", "self", ".", "start", "=", "intervals", "[", "0", "]", "[", "0", "]", "self", ".", "end", "=", "intervals", "[", "-", "1", "]", "[",...
https://github.com/CGATOxford/cgat/blob/326aad4694bdfae8ddc194171bb5d73911243947/CGAT/Bed.py#L167-L199