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
gnuradio/pybombs
17044241bf835b93571026b112f179f2db7448a4
pybombs/commands/recipes.py
python
Recipes.run_update
(self)
pybombs recipes update [alias]
pybombs recipes update [alias]
[ "pybombs", "recipes", "update", "[", "alias", "]" ]
def run_update(self): """ pybombs recipes update [alias] """ # TODO allow directories aliases_to_update = self.args.alias or self.cfg.get_named_recipe_sources().keys() if not all([self.update_recipe_repo(x) for x in aliases_to_update]): return -1
[ "def", "run_update", "(", "self", ")", ":", "# TODO allow directories", "aliases_to_update", "=", "self", ".", "args", ".", "alias", "or", "self", ".", "cfg", ".", "get_named_recipe_sources", "(", ")", ".", "keys", "(", ")", "if", "not", "all", "(", "[", ...
https://github.com/gnuradio/pybombs/blob/17044241bf835b93571026b112f179f2db7448a4/pybombs/commands/recipes.py#L190-L197
rhinstaller/anaconda
63edc8680f1b05cbfe11bef28703acba808c5174
pyanaconda/core/kickstart/addon.py
python
AddonData.handle_line
(self, line, line_number=None)
Handle one line of the section. :param line: a line to parse :param line_number: a line number :raise: KickstartParseError for invalid lines
Handle one line of the section.
[ "Handle", "one", "line", "of", "the", "section", "." ]
def handle_line(self, line, line_number=None): """Handle one line of the section. :param line: a line to parse :param line_number: a line number :raise: KickstartParseError for invalid lines """ pass
[ "def", "handle_line", "(", "self", ",", "line", ",", "line_number", "=", "None", ")", ":", "pass" ]
https://github.com/rhinstaller/anaconda/blob/63edc8680f1b05cbfe11bef28703acba808c5174/pyanaconda/core/kickstart/addon.py#L70-L77
picklepete/pyicloud
bab549a593b1f2554de8d0eefa0b053c18e09f6f
pyicloud/services/photos.py
python
PhotoAsset.filename
(self)
return base64.b64decode( self._master_record["fields"]["filenameEnc"]["value"] ).decode("utf-8")
Gets the photo file name.
Gets the photo file name.
[ "Gets", "the", "photo", "file", "name", "." ]
def filename(self): """Gets the photo file name.""" return base64.b64decode( self._master_record["fields"]["filenameEnc"]["value"] ).decode("utf-8")
[ "def", "filename", "(", "self", ")", ":", "return", "base64", ".", "b64decode", "(", "self", ".", "_master_record", "[", "\"fields\"", "]", "[", "\"filenameEnc\"", "]", "[", "\"value\"", "]", ")", ".", "decode", "(", "\"utf-8\"", ")" ]
https://github.com/picklepete/pyicloud/blob/bab549a593b1f2554de8d0eefa0b053c18e09f6f/pyicloud/services/photos.py#L519-L523
rhinstaller/anaconda
63edc8680f1b05cbfe11bef28703acba808c5174
pyanaconda/ui/gui/spokes/__init__.py
python
NormalSpoke.clear_info
(self)
Clear the last set warning message and call the ancestors method.
Clear the last set warning message and call the ancestors method.
[ "Clear", "the", "last", "set", "warning", "message", "and", "call", "the", "ancestors", "method", "." ]
def clear_info(self): """Clear the last set warning message and call the ancestors method.""" self._current_warning_message = "" super().clear_info()
[ "def", "clear_info", "(", "self", ")", ":", "self", ".", "_current_warning_message", "=", "\"\"", "super", "(", ")", ".", "clear_info", "(", ")" ]
https://github.com/rhinstaller/anaconda/blob/63edc8680f1b05cbfe11bef28703acba808c5174/pyanaconda/ui/gui/spokes/__init__.py#L75-L78
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/iotvideo/v20191126/models.py
python
CreateAnonymousAccessTokenRequest.__init__
(self)
r""" :param TtlMinutes: Token的TTL(time to alive)分钟数,最大值1440(即24小时) :type TtlMinutes: int :param Tid: 设备ID。创建Token时, 此参数为必须项 :type Tid: str :param OldAccessToken: 旧的AccessToken。续期Token时,此参数为必须 :type OldAccessToken: str
r""" :param TtlMinutes: Token的TTL(time to alive)分钟数,最大值1440(即24小时) :type TtlMinutes: int :param Tid: 设备ID。创建Token时, 此参数为必须项 :type Tid: str :param OldAccessToken: 旧的AccessToken。续期Token时,此参数为必须 :type OldAccessToken: str
[ "r", ":", "param", "TtlMinutes", ":", "Token的TTL", "(", "time", "to", "alive", ")", "分钟数", "最大值1440", "(", "即24小时", ")", ":", "type", "TtlMinutes", ":", "int", ":", "param", "Tid", ":", "设备ID。创建Token时", "此参数为必须项", ":", "type", "Tid", ":", "str", ":", ...
def __init__(self): r""" :param TtlMinutes: Token的TTL(time to alive)分钟数,最大值1440(即24小时) :type TtlMinutes: int :param Tid: 设备ID。创建Token时, 此参数为必须项 :type Tid: str :param OldAccessToken: 旧的AccessToken。续期Token时,此参数为必须 :type OldAccessToken: str """ self.T...
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "TtlMinutes", "=", "None", "self", ".", "Tid", "=", "None", "self", ".", "OldAccessToken", "=", "None" ]
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/iotvideo/v20191126/models.py#L172-L183
DataDog/integrations-core
934674b29d94b70ccc008f76ea172d0cdae05e1e
vertica/datadog_checks/vertica/config_models/defaults.py
python
instance_tls_validate_hostname
(field, value)
return True
[]
def instance_tls_validate_hostname(field, value): return True
[ "def", "instance_tls_validate_hostname", "(", "field", ",", "value", ")", ":", "return", "True" ]
https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/vertica/datadog_checks/vertica/config_models/defaults.py#L101-L102
numba/numba
bf480b9e0da858a65508c2b17759a72ee6a44c51
numba/cpython/heapq.py
python
_siftup_max
(heap, pos)
[]
def _siftup_max(heap, pos): endpos = len(heap) startpos = pos newitem = heap[pos] childpos = 2 * pos + 1 while childpos < endpos: rightpos = childpos + 1 if rightpos < endpos and not heap[rightpos] < heap[childpos]: childpos = rightpos heap[pos] = heap[childpos...
[ "def", "_siftup_max", "(", "heap", ",", "pos", ")", ":", "endpos", "=", "len", "(", "heap", ")", "startpos", "=", "pos", "newitem", "=", "heap", "[", "pos", "]", "childpos", "=", "2", "*", "pos", "+", "1", "while", "childpos", "<", "endpos", ":", ...
https://github.com/numba/numba/blob/bf480b9e0da858a65508c2b17759a72ee6a44c51/numba/cpython/heapq.py#L64-L81
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/Django/django/db/backends/postgresql_psycopg2/version.py
python
get_version
(connection)
Returns an integer representing the major, minor and revision number of the server. Format is the one used for the return value of libpq PQServerVersion()/``server_version`` connection attribute (available in newer psycopg2 versions.) For example, 80304 for 8.3.4. The last two digits will be 00 in the ...
Returns an integer representing the major, minor and revision number of the server. Format is the one used for the return value of libpq PQServerVersion()/``server_version`` connection attribute (available in newer psycopg2 versions.)
[ "Returns", "an", "integer", "representing", "the", "major", "minor", "and", "revision", "number", "of", "the", "server", ".", "Format", "is", "the", "one", "used", "for", "the", "return", "value", "of", "libpq", "PQServerVersion", "()", "/", "server_version", ...
def get_version(connection): """ Returns an integer representing the major, minor and revision number of the server. Format is the one used for the return value of libpq PQServerVersion()/``server_version`` connection attribute (available in newer psycopg2 versions.) For example, 80304 for 8.3....
[ "def", "get_version", "(", "connection", ")", ":", "if", "hasattr", "(", "connection", ",", "'server_version'", ")", ":", "return", "connection", ".", "server_version", "else", ":", "cursor", "=", "connection", ".", "cursor", "(", ")", "cursor", ".", "execut...
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/Django/django/db/backends/postgresql_psycopg2/version.py#L24-L43
django-parler/django-parler
577ca2f4a80713a9272c48db30e914a4d9332358
parler/views.py
python
LanguageChoiceMixin.get_default_language
(self, object=None)
return None
Return the default language to use, if no language parameter is given. By default, it uses the default parler-language.
Return the default language to use, if no language parameter is given. By default, it uses the default parler-language.
[ "Return", "the", "default", "language", "to", "use", "if", "no", "language", "parameter", "is", "given", ".", "By", "default", "it", "uses", "the", "default", "parler", "-", "language", "." ]
def get_default_language(self, object=None): """ Return the default language to use, if no language parameter is given. By default, it uses the default parler-language. """ # Some users may want to override this, to return get_language() return None
[ "def", "get_default_language", "(", "self", ",", "object", "=", "None", ")", ":", "# Some users may want to override this, to return get_language()", "return", "None" ]
https://github.com/django-parler/django-parler/blob/577ca2f4a80713a9272c48db30e914a4d9332358/parler/views.py#L225-L231
kanzure/nanoengineer
874e4c9f8a9190f093625b267f9767e19f82e6c4
cad/src/dna/model/ChainAtomMarker.py
python
ChainAtomMarker.writemmp
(self, mapping)
return Jig.writemmp(self, mapping)
[extends superclass method]
[extends superclass method]
[ "[", "extends", "superclass", "method", "]" ]
def writemmp(self, mapping): """ [extends superclass method] """ # check a few things, then call superclass method try: assert not self.is_homeless() # redundant as of 080111, that's ok assert len(self.atoms) in (1, _NUMBER_OF_MARKER_ATOMS) sel...
[ "def", "writemmp", "(", "self", ",", "mapping", ")", ":", "# check a few things, then call superclass method", "try", ":", "assert", "not", "self", ".", "is_homeless", "(", ")", "# redundant as of 080111, that's ok", "assert", "len", "(", "self", ".", "atoms", ")", ...
https://github.com/kanzure/nanoengineer/blob/874e4c9f8a9190f093625b267f9767e19f82e6c4/cad/src/dna/model/ChainAtomMarker.py#L164-L183
cloud-custodian/cloud-custodian
1ce1deb2d0f0832d6eb8839ef74b4c9e397128de
tools/dev/dockerpkg.py
python
cli
()
Custodian Docker Packaging Tool slices, dices, and blends :-)
Custodian Docker Packaging Tool
[ "Custodian", "Docker", "Packaging", "Tool" ]
def cli(): """Custodian Docker Packaging Tool slices, dices, and blends :-) """ logging.basicConfig( level=logging.INFO, format="%(asctime)s:%(levelname)s %(message)s" ) logging.getLogger("docker").setLevel(logging.INFO) logging.getLogger("urllib3").setLevel(logging.INFO) for n...
[ "def", "cli", "(", ")", ":", "logging", ".", "basicConfig", "(", "level", "=", "logging", ".", "INFO", ",", "format", "=", "\"%(asctime)s:%(levelname)s %(message)s\"", ")", "logging", ".", "getLogger", "(", "\"docker\"", ")", ".", "setLevel", "(", "logging", ...
https://github.com/cloud-custodian/cloud-custodian/blob/1ce1deb2d0f0832d6eb8839ef74b4c9e397128de/tools/dev/dockerpkg.py#L240-L259
IntelLabs/nlp-architect
60afd0dd1bfd74f01b4ac8f613cb484777b80284
examples/sparse_gnmt/train.py
python
add_info_summaries
(summary_writer, global_step, info)
Add stuffs in info to summaries.
Add stuffs in info to summaries.
[ "Add", "stuffs", "in", "info", "to", "summaries", "." ]
def add_info_summaries(summary_writer, global_step, info): """Add stuffs in info to summaries.""" excluded_list = ["learning_rate"] for key in info: if key not in excluded_list: utils.add_summary(summary_writer, global_step, key, info[key])
[ "def", "add_info_summaries", "(", "summary_writer", ",", "global_step", ",", "info", ")", ":", "excluded_list", "=", "[", "\"learning_rate\"", "]", "for", "key", "in", "info", ":", "if", "key", "not", "in", "excluded_list", ":", "utils", ".", "add_summary", ...
https://github.com/IntelLabs/nlp-architect/blob/60afd0dd1bfd74f01b4ac8f613cb484777b80284/examples/sparse_gnmt/train.py#L462-L467
msracver/Deep-Exemplar-based-Colorization
964026106bb51171a3c58be58d5c117e2f62bb4c
similarity_subnet/scripts/cpp_lint.py
python
RemoveMultiLineCommentsFromRange
(lines, begin, end)
Clears a range of lines for multi-line comments.
Clears a range of lines for multi-line comments.
[ "Clears", "a", "range", "of", "lines", "for", "multi", "-", "line", "comments", "." ]
def RemoveMultiLineCommentsFromRange(lines, begin, end): """Clears a range of lines for multi-line comments.""" # Having // dummy comments makes the lines non-empty, so we will not get # unnecessary blank line warnings later in the code. for i in range(begin, end): lines[i] = '// dummy'
[ "def", "RemoveMultiLineCommentsFromRange", "(", "lines", ",", "begin", ",", "end", ")", ":", "# Having // dummy comments makes the lines non-empty, so we will not get", "# unnecessary blank line warnings later in the code.", "for", "i", "in", "range", "(", "begin", ",", "end", ...
https://github.com/msracver/Deep-Exemplar-based-Colorization/blob/964026106bb51171a3c58be58d5c117e2f62bb4c/similarity_subnet/scripts/cpp_lint.py#L1143-L1148
dropbox/dropbox-sdk-python
015437429be224732990041164a21a0501235db1
dropbox/team_log.py
python
EventType.team_merge_request_sent_shown_to_secondary_team
(cls, val)
return cls('team_merge_request_sent_shown_to_secondary_team', val)
Create an instance of this class set to the ``team_merge_request_sent_shown_to_secondary_team`` tag with value ``val``. :param TeamMergeRequestSentShownToSecondaryTeamType val: :rtype: EventType
Create an instance of this class set to the ``team_merge_request_sent_shown_to_secondary_team`` tag with value ``val``.
[ "Create", "an", "instance", "of", "this", "class", "set", "to", "the", "team_merge_request_sent_shown_to_secondary_team", "tag", "with", "value", "val", "." ]
def team_merge_request_sent_shown_to_secondary_team(cls, val): """ Create an instance of this class set to the ``team_merge_request_sent_shown_to_secondary_team`` tag with value ``val``. :param TeamMergeRequestSentShownToSecondaryTeamType val: :rtype: EventType "...
[ "def", "team_merge_request_sent_shown_to_secondary_team", "(", "cls", ",", "val", ")", ":", "return", "cls", "(", "'team_merge_request_sent_shown_to_secondary_team'", ",", "val", ")" ]
https://github.com/dropbox/dropbox-sdk-python/blob/015437429be224732990041164a21a0501235db1/dropbox/team_log.py#L28390-L28399
brendano/tweetmotif
1b0b1e3a941745cd5a26eba01f554688b7c4b27e
everything_else/djfrontend/django-1.0.2/utils/_decimal.py
python
Decimal.__mul__
(self, other, context=None)
return ans
Return self * other. (+-) INF * 0 (or its reverse) raise InvalidOperation.
Return self * other.
[ "Return", "self", "*", "other", "." ]
def __mul__(self, other, context=None): """Return self * other. (+-) INF * 0 (or its reverse) raise InvalidOperation. """ other = _convert_other(other) if other is NotImplemented: return other if context is None: context = getcontext() r...
[ "def", "__mul__", "(", "self", ",", "other", ",", "context", "=", "None", ")", ":", "other", "=", "_convert_other", "(", "other", ")", "if", "other", "is", "NotImplemented", ":", "return", "other", "if", "context", "is", "None", ":", "context", "=", "g...
https://github.com/brendano/tweetmotif/blob/1b0b1e3a941745cd5a26eba01f554688b7c4b27e/everything_else/djfrontend/django-1.0.2/utils/_decimal.py#L1076-L1135
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/dts/v20180330/models.py
python
ErrorInfo.__init__
(self)
r""" :param ErrorLog: 具体的报错日志, 包含错误码和错误信息 :type ErrorLog: str :param HelpDoc: 报错对应的帮助文档Ur :type HelpDoc: str
r""" :param ErrorLog: 具体的报错日志, 包含错误码和错误信息 :type ErrorLog: str :param HelpDoc: 报错对应的帮助文档Ur :type HelpDoc: str
[ "r", ":", "param", "ErrorLog", ":", "具体的报错日志", "包含错误码和错误信息", ":", "type", "ErrorLog", ":", "str", ":", "param", "HelpDoc", ":", "报错对应的帮助文档Ur", ":", "type", "HelpDoc", ":", "str" ]
def __init__(self): r""" :param ErrorLog: 具体的报错日志, 包含错误码和错误信息 :type ErrorLog: str :param HelpDoc: 报错对应的帮助文档Ur :type HelpDoc: str """ self.ErrorLog = None self.HelpDoc = None
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "ErrorLog", "=", "None", "self", ".", "HelpDoc", "=", "None" ]
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/dts/v20180330/models.py#L960-L968
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/sympy/combinatorics/pc_groups.py
python
Collector.constructive_membership_test
(self, ipcgs, g)
return False
Return the exponent vector for induced pcgs.
Return the exponent vector for induced pcgs.
[ "Return", "the", "exponent", "vector", "for", "induced", "pcgs", "." ]
def constructive_membership_test(self, ipcgs, g): """ Return the exponent vector for induced pcgs. """ e = [0]*len(ipcgs) h = g d = self.depth(h) for i, gen in enumerate(ipcgs): while self.depth(gen) == d: f = self.leading_exponent(h)*s...
[ "def", "constructive_membership_test", "(", "self", ",", "ipcgs", ",", "g", ")", ":", "e", "=", "[", "0", "]", "*", "len", "(", "ipcgs", ")", "h", "=", "g", "d", "=", "self", ".", "depth", "(", "h", ")", "for", "i", ",", "gen", "in", "enumerate...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/sympy/combinatorics/pc_groups.py#L656-L672
IJDykeman/wangTiles
7c1ee2095ebdf7f72bce07d94c6484915d5cae8b
experimental_code/venv/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py
python
HTTPConnectionPool.close
(self)
Close all pooled connections and disable the pool.
Close all pooled connections and disable the pool.
[ "Close", "all", "pooled", "connections", "and", "disable", "the", "pool", "." ]
def close(self): """ Close all pooled connections and disable the pool. """ # Disable access to the pool old_pool, self.pool = self.pool, None try: while True: conn = old_pool.get(block=False) if conn: conn....
[ "def", "close", "(", "self", ")", ":", "# Disable access to the pool", "old_pool", ",", "self", ".", "pool", "=", "self", ".", "pool", ",", "None", "try", ":", "while", "True", ":", "conn", "=", "old_pool", ".", "get", "(", "block", "=", "False", ")", ...
https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/venv/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py#L367-L381
marinho/geraldo
868ebdce67176d9b6205cddc92476f642c783fff
site/newsite/site-geraldo/django/utils/translation/trans_real.py
python
blankout
(src, char)
return dot_re.sub(char, src)
Changes every non-whitespace character to the given char. Used in the templatize function.
Changes every non-whitespace character to the given char. Used in the templatize function.
[ "Changes", "every", "non", "-", "whitespace", "character", "to", "the", "given", "char", ".", "Used", "in", "the", "templatize", "function", "." ]
def blankout(src, char): """ Changes every non-whitespace character to the given char. Used in the templatize function. """ return dot_re.sub(char, src)
[ "def", "blankout", "(", "src", ",", "char", ")", ":", "return", "dot_re", ".", "sub", "(", "char", ",", "src", ")" ]
https://github.com/marinho/geraldo/blob/868ebdce67176d9b6205cddc92476f642c783fff/site/newsite/site-geraldo/django/utils/translation/trans_real.py#L430-L435
beeware/ouroboros
a29123c6fab6a807caffbb7587cf548e0c370296
ouroboros/logging/config.py
python
BaseConfigurator.resolve
(self, s)
Resolve strings to objects using standard import and attribute syntax.
Resolve strings to objects using standard import and attribute syntax.
[ "Resolve", "strings", "to", "objects", "using", "standard", "import", "and", "attribute", "syntax", "." ]
def resolve(self, s): """ Resolve strings to objects using standard import and attribute syntax. """ name = s.split('.') used = name.pop(0) try: found = self.importer(used) for frag in name: used += '.' + frag ...
[ "def", "resolve", "(", "self", ",", "s", ")", ":", "name", "=", "s", ".", "split", "(", "'.'", ")", "used", "=", "name", ".", "pop", "(", "0", ")", "try", ":", "found", "=", "self", ".", "importer", "(", "used", ")", "for", "frag", "in", "nam...
https://github.com/beeware/ouroboros/blob/a29123c6fab6a807caffbb7587cf548e0c370296/ouroboros/logging/config.py#L369-L390
fluentpython/notebooks
0f6e1e8d1686743dacd9281df7c5b5921812010a
attic/sequences/sentence_slice.py
python
SentenceSlice._handle_defaults
(self, position)
return start, stop + 1
handle missing or overflow/underflow start/stop
handle missing or overflow/underflow start/stop
[ "handle", "missing", "or", "overflow", "/", "underflow", "start", "/", "stop" ]
def _handle_defaults(self, position): """handle missing or overflow/underflow start/stop""" if position.start is None: # missing start = 0 elif position.start >= len(self.word_index): # overflow start = len(self.tokens) else: start = self.word_index[...
[ "def", "_handle_defaults", "(", "self", ",", "position", ")", ":", "if", "position", ".", "start", "is", "None", ":", "# missing", "start", "=", "0", "elif", "position", ".", "start", ">=", "len", "(", "self", ".", "word_index", ")", ":", "# overflow", ...
https://github.com/fluentpython/notebooks/blob/0f6e1e8d1686743dacd9281df7c5b5921812010a/attic/sequences/sentence_slice.py#L41-L54
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
ansible/roles/lib_oa_openshift/library/oc_user.py
python
Utils.openshift_installed
()
return rpmquery.count() > 0
check if openshift is installed
check if openshift is installed
[ "check", "if", "openshift", "is", "installed" ]
def openshift_installed(): ''' check if openshift is installed ''' import rpm transaction_set = rpm.TransactionSet() rpmquery = transaction_set.dbMatch("name", "atomic-openshift") return rpmquery.count() > 0
[ "def", "openshift_installed", "(", ")", ":", "import", "rpm", "transaction_set", "=", "rpm", ".", "TransactionSet", "(", ")", "rpmquery", "=", "transaction_set", ".", "dbMatch", "(", "\"name\"", ",", "\"atomic-openshift\"", ")", "return", "rpmquery", ".", "count...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/ansible/roles/lib_oa_openshift/library/oc_user.py#L1372-L1379
joosthoeks/jhTAlib
4931a34829d966ccc973fb29d767a359d6e94b44
jhtalib/behavioral_techniques/behavioral_techniques.py
python
ATL
(df, price='Low')
return atl_dict
All Time Low Returns: dict of lists of floats = jhta.ATL(df, price='Low')
All Time Low Returns: dict of lists of floats = jhta.ATL(df, price='Low')
[ "All", "Time", "Low", "Returns", ":", "dict", "of", "lists", "of", "floats", "=", "jhta", ".", "ATL", "(", "df", "price", "=", "Low", ")" ]
def ATL(df, price='Low'): """ All Time Low Returns: dict of lists of floats = jhta.ATL(df, price='Low') """ atl_dict = {'atl': [], 'atl_index': []} for i in range(len(df[price])): df_part_list = df[price][0:i+1] atl = min(df_part_list) atl_dict['atl'].append(atl) ...
[ "def", "ATL", "(", "df", ",", "price", "=", "'Low'", ")", ":", "atl_dict", "=", "{", "'atl'", ":", "[", "]", ",", "'atl_index'", ":", "[", "]", "}", "for", "i", "in", "range", "(", "len", "(", "df", "[", "price", "]", ")", ")", ":", "df_part_...
https://github.com/joosthoeks/jhTAlib/blob/4931a34829d966ccc973fb29d767a359d6e94b44/jhtalib/behavioral_techniques/behavioral_techniques.py#L25-L37
shidenggui/easytrader
dbb166564c6c73da3446588a19d2692ad52716cb
easytrader/joinquant_follower.py
python
JoinQuantFollower.follow
( self, users, strategies, track_interval=1, trade_cmd_expire_seconds=120, cmd_cache=True, entrust_prop="limit", send_interval=0, )
跟踪joinquant对应的模拟交易,支持多用户多策略 :param users: 支持easytrader的用户对象,支持使用 [] 指定多个用户 :param strategies: joinquant 的模拟交易地址,支持使用 [] 指定多个模拟交易, 地址类似 https://www.joinquant.com/algorithm/live/index?backtestId=xxx :param track_interval: 轮训模拟交易时间,单位为秒 :param trade_cmd_expire_seconds: 交易指令过期时间,...
跟踪joinquant对应的模拟交易,支持多用户多策略 :param users: 支持easytrader的用户对象,支持使用 [] 指定多个用户 :param strategies: joinquant 的模拟交易地址,支持使用 [] 指定多个模拟交易, 地址类似 https://www.joinquant.com/algorithm/live/index?backtestId=xxx :param track_interval: 轮训模拟交易时间,单位为秒 :param trade_cmd_expire_seconds: 交易指令过期时间,...
[ "跟踪joinquant对应的模拟交易,支持多用户多策略", ":", "param", "users", ":", "支持easytrader的用户对象,支持使用", "[]", "指定多个用户", ":", "param", "strategies", ":", "joinquant", "的模拟交易地址,支持使用", "[]", "指定多个模拟交易", "地址类似", "https", ":", "//", "www", ".", "joinquant", ".", "com", "/", "algorithm", ...
def follow( self, users, strategies, track_interval=1, trade_cmd_expire_seconds=120, cmd_cache=True, entrust_prop="limit", send_interval=0, ): """跟踪joinquant对应的模拟交易,支持多用户多策略 :param users: 支持easytrader的用户对...
[ "def", "follow", "(", "self", ",", "users", ",", "strategies", ",", "track_interval", "=", "1", ",", "trade_cmd_expire_seconds", "=", "120", ",", "cmd_cache", "=", "True", ",", "entrust_prop", "=", "\"limit\"", ",", "send_interval", "=", "0", ",", ")", ":"...
https://github.com/shidenggui/easytrader/blob/dbb166564c6c73da3446588a19d2692ad52716cb/easytrader/joinquant_follower.py#L33-L80
mvanveen/hncrawl
1ff4d3aa945db37f0840916b38ea7c5f58c1c017
news/spiders/beautiful_soup.py
python
Tag.__str__
(self, encoding=DEFAULT_OUTPUT_ENCODING, prettyPrint=False, indentLevel=0)
return s
Returns a string or Unicode representation of this tag and its contents. To get Unicode, pass None for encoding. NOTE: since Python's HTML parser consumes whitespace, this method is not certain to reproduce the whitespace present in the original string.
Returns a string or Unicode representation of this tag and its contents. To get Unicode, pass None for encoding.
[ "Returns", "a", "string", "or", "Unicode", "representation", "of", "this", "tag", "and", "its", "contents", ".", "To", "get", "Unicode", "pass", "None", "for", "encoding", "." ]
def __str__(self, encoding=DEFAULT_OUTPUT_ENCODING, prettyPrint=False, indentLevel=0): """Returns a string or Unicode representation of this tag and its contents. To get Unicode, pass None for encoding. NOTE: since Python's HTML parser consumes whitespace, this method is...
[ "def", "__str__", "(", "self", ",", "encoding", "=", "DEFAULT_OUTPUT_ENCODING", ",", "prettyPrint", "=", "False", ",", "indentLevel", "=", "0", ")", ":", "encodedName", "=", "self", ".", "toEncoding", "(", "self", ".", "name", ",", "encoding", ")", "attrs"...
https://github.com/mvanveen/hncrawl/blob/1ff4d3aa945db37f0840916b38ea7c5f58c1c017/news/spiders/beautiful_soup.py#L693-L776
django-oscar/django-oscar
ffcc530844d40283b6b1552778a140536b904f5f
src/oscar/apps/dashboard/menu.py
python
get_nodes
(user)
return visible_nodes
Return the visible navigation nodes for the passed user
Return the visible navigation nodes for the passed user
[ "Return", "the", "visible", "navigation", "nodes", "for", "the", "passed", "user" ]
def get_nodes(user): """ Return the visible navigation nodes for the passed user """ all_nodes = create_menu(settings.OSCAR_DASHBOARD_NAVIGATION) visible_nodes = [] for node in all_nodes: filtered_node = node.filter(user) # don't append headings without children if filter...
[ "def", "get_nodes", "(", "user", ")", ":", "all_nodes", "=", "create_menu", "(", "settings", ".", "OSCAR_DASHBOARD_NAVIGATION", ")", "visible_nodes", "=", "[", "]", "for", "node", "in", "all_nodes", ":", "filtered_node", "=", "node", ".", "filter", "(", "use...
https://github.com/django-oscar/django-oscar/blob/ffcc530844d40283b6b1552778a140536b904f5f/src/oscar/apps/dashboard/menu.py#L10-L22
caiiiac/Machine-Learning-with-Python
1a26c4467da41ca4ebc3d5bd789ea942ef79422f
MachineLearning/venv/lib/python3.5/site-packages/pyparsing.py
python
ParserElement.__rsub__
(self, other )
return other - self
Implementation of - operator when left operand is not a C{L{ParserElement}}
Implementation of - operator when left operand is not a C{L{ParserElement}}
[ "Implementation", "of", "-", "operator", "when", "left", "operand", "is", "not", "a", "C", "{", "L", "{", "ParserElement", "}}" ]
def __rsub__(self, other ): """ Implementation of - operator when left operand is not a C{L{ParserElement}} """ if isinstance( other, basestring ): other = ParserElement._literalStringClass( other ) if not isinstance( other, ParserElement ): warnings.warn(...
[ "def", "__rsub__", "(", "self", ",", "other", ")", ":", "if", "isinstance", "(", "other", ",", "basestring", ")", ":", "other", "=", "ParserElement", ".", "_literalStringClass", "(", "other", ")", "if", "not", "isinstance", "(", "other", ",", "ParserElemen...
https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/pyparsing.py#L1843-L1853
henkelis/sonospy
841f52010fd6e1e932d8f1a8896ad4e5a0667b8a
sonospy/control_point_sonos.py
python
ControlPointSonos.search
(self, container_id, search_criteria, filter, starting_index, requested_count, sort_criteria, device=None)
return search_response
Search items in Media Server. This method search items with search_criteria key in the container_id of current media server. @param container_id: unique identifier of the container in which to begin searching. @param search_criteria: search criteria ...
Search items in Media Server.
[ "Search", "items", "in", "Media", "Server", "." ]
def search(self, container_id, search_criteria, filter, starting_index, requested_count, sort_criteria, device=None): """ Search items in Media Server. This method search items with search_criteria key in the container_id of current media server. @param container_id: uni...
[ "def", "search", "(", "self", ",", "container_id", ",", "search_criteria", ",", "filter", ",", "starting_index", ",", "requested_count", ",", "sort_criteria", ",", "device", "=", "None", ")", ":", "service", "=", "self", ".", "get_cd_service", "(", "device", ...
https://github.com/henkelis/sonospy/blob/841f52010fd6e1e932d8f1a8896ad4e5a0667b8a/sonospy/control_point_sonos.py#L581-L650
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/proxy/camera.py
python
ImageOpts.__bool__
(self)
return bool(self.max_width or self.quality)
Bool evaluation rules.
Bool evaluation rules.
[ "Bool", "evaluation", "rules", "." ]
def __bool__(self): """Bool evaluation rules.""" return bool(self.max_width or self.quality)
[ "def", "__bool__", "(", "self", ")", ":", "return", "bool", "(", "self", ".", "max_width", "or", "self", ".", "quality", ")" ]
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/proxy/camera.py#L190-L192
ywangd/stash
773d15b8fb3853a65c15fe160bf5584c99437170
system/shstreams.py
python
ShStream.dispatch
(self, event, *args, **kwargs)
Dispatches an event. If any of the attached listeners throws an exception, the subsequent callbacks are be aborted. :param str event: event to dispatch. :param list args: arguments to pass to event handlers.
Dispatches an event.
[ "Dispatches", "an", "event", "." ]
def dispatch(self, event, *args, **kwargs): """Dispatches an event. If any of the attached listeners throws an exception, the subsequent callbacks are be aborted. :param str event: event to dispatch. :param list args: arguments to pass to event handlers. """ ...
[ "def", "dispatch", "(", "self", ",", "event", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# noinspection PyCallingNonCallable", "try", ":", "handler", "=", "getattr", "(", "self", ".", "main_screen", ",", "event", ")", "handler", "(", "*", "arg...
https://github.com/ywangd/stash/blob/773d15b8fb3853a65c15fe160bf5584c99437170/system/shstreams.py#L391-L409
schodet/nxt-python
b434303f098d13677bceb664810f03e8c5057c82
nxt/sensor/hitechnic.py
python
Compass.is_in_range
(self,minval,maxval)
return bool(inverted) ^ bool(in_range)
This deserves a little explanation: if max > min, it's straightforward, but if min > max, it switches the values of max and min and returns true if heading is NOT between the new max and min
This deserves a little explanation: if max > min, it's straightforward, but if min > max, it switches the values of max and min and returns true if heading is NOT between the new max and min
[ "This", "deserves", "a", "little", "explanation", ":", "if", "max", ">", "min", "it", "s", "straightforward", "but", "if", "min", ">", "max", "it", "switches", "the", "values", "of", "max", "and", "min", "and", "returns", "true", "if", "heading", "is", ...
def is_in_range(self,minval,maxval): """This deserves a little explanation: if max > min, it's straightforward, but if min > max, it switches the values of max and min and returns true if heading is NOT between the new max and min """ if minval > maxval: (maxval,minval) = (minval,max...
[ "def", "is_in_range", "(", "self", ",", "minval", ",", "maxval", ")", ":", "if", "minval", ">", "maxval", ":", "(", "maxval", ",", "minval", ")", "=", "(", "minval", ",", "maxval", ")", "inverted", "=", "True", "else", ":", "inverted", "=", "False", ...
https://github.com/schodet/nxt-python/blob/b434303f098d13677bceb664810f03e8c5057c82/nxt/sensor/hitechnic.py#L54-L71
pypa/setuptools
9f37366aab9cd8f6baa23e6a77cfdb8daf97757e
setuptools/_distutils/_msvccompiler.py
python
MSVCCompiler.library_dir_option
(self, dir)
return "/LIBPATH:" + dir
[]
def library_dir_option(self, dir): return "/LIBPATH:" + dir
[ "def", "library_dir_option", "(", "self", ",", "dir", ")", ":", "return", "\"/LIBPATH:\"", "+", "dir" ]
https://github.com/pypa/setuptools/blob/9f37366aab9cd8f6baa23e6a77cfdb8daf97757e/setuptools/_distutils/_msvccompiler.py#L537-L538
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-linux/x64/mako/ext/autohandler.py
python
_file_exists
(lookup, path)
[]
def _file_exists(lookup, path): psub = re.sub(r"^/", "", path) for d in lookup.directories: if os.path.exists(d + "/" + psub): return True else: return False
[ "def", "_file_exists", "(", "lookup", ",", "path", ")", ":", "psub", "=", "re", ".", "sub", "(", "r\"^/\"", ",", "\"\"", ",", "path", ")", "for", "d", "in", "lookup", ".", "directories", ":", "if", "os", ".", "path", ".", "exists", "(", "d", "+",...
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-linux/x64/mako/ext/autohandler.py#L64-L70
igraph/python-igraph
e9f83e8af08f24ea025596e745917197d8b44d94
src/igraph/datatypes.py
python
Matrix.Fill
(cls, value, *args)
return cls(mtrx)
Creates a matrix filled with the given value @param value: the value to be used @keyword shape: the shape of the matrix. Can be a single integer, two integers or a tuple. If a single integer is given here, the matrix is assumed to be square-shaped.
Creates a matrix filled with the given value
[ "Creates", "a", "matrix", "filled", "with", "the", "given", "value" ]
def Fill(cls, value, *args): """Creates a matrix filled with the given value @param value: the value to be used @keyword shape: the shape of the matrix. Can be a single integer, two integers or a tuple. If a single integer is given here, the matrix is assumed to be square-sh...
[ "def", "Fill", "(", "cls", ",", "value", ",", "*", "args", ")", ":", "if", "len", "(", "args", ")", "<", "1", ":", "raise", "TypeError", "(", "\"expected an integer or a tuple\"", ")", "if", "len", "(", "args", ")", "==", "1", ":", "if", "hasattr", ...
https://github.com/igraph/python-igraph/blob/e9f83e8af08f24ea025596e745917197d8b44d94/src/igraph/datatypes.py#L29-L47
doorstop-dev/doorstop
03aa287e5069e29da6979274e1cb6714ee450d3a
doorstop/server/main.py
python
main
(args=None)
Process command-line arguments and run the program.
Process command-line arguments and run the program.
[ "Process", "command", "-", "line", "arguments", "and", "run", "the", "program", "." ]
def main(args=None): """Process command-line arguments and run the program.""" from doorstop import SERVER, VERSION # Shared options debug = argparse.ArgumentParser(add_help=False) debug.add_argument('-V', '--version', action='version', version=VERSION) debug.add_argument( '--debug', ac...
[ "def", "main", "(", "args", "=", "None", ")", ":", "from", "doorstop", "import", "SERVER", ",", "VERSION", "# Shared options", "debug", "=", "argparse", ".", "ArgumentParser", "(", "add_help", "=", "False", ")", "debug", ".", "add_argument", "(", "'-V'", "...
https://github.com/doorstop-dev/doorstop/blob/03aa287e5069e29da6979274e1cb6714ee450d3a/doorstop/server/main.py#L28-L83
tracim/tracim
a0e9746fde5a4c45b4e0f0bfa2caf9522b8c4e21
backend/tracim_backend/lib/rq/__init__.py
python
get_rq_queue
( redis_connection: redis.Redis, queue_name: RqQueueName = RqQueueName.DEFAULT, is_async: bool = True, )
return rq.Queue(name=queue_name.value, connection=redis_connection, is_async=is_async)
:param queue_name: name of queue :return: wanted queue
:param queue_name: name of queue :return: wanted queue
[ ":", "param", "queue_name", ":", "name", "of", "queue", ":", "return", ":", "wanted", "queue" ]
def get_rq_queue( redis_connection: redis.Redis, queue_name: RqQueueName = RqQueueName.DEFAULT, is_async: bool = True, ) -> rq.Queue: """ :param queue_name: name of queue :return: wanted queue """ return rq.Queue(name=queue_name.value, connection=redis_connection, is_async=is_async)
[ "def", "get_rq_queue", "(", "redis_connection", ":", "redis", ".", "Redis", ",", "queue_name", ":", "RqQueueName", "=", "RqQueueName", ".", "DEFAULT", ",", "is_async", ":", "bool", "=", "True", ",", ")", "->", "rq", ".", "Queue", ":", "return", "rq", "."...
https://github.com/tracim/tracim/blob/a0e9746fde5a4c45b4e0f0bfa2caf9522b8c4e21/backend/tracim_backend/lib/rq/__init__.py#L29-L39
jesolem/PCV
376d5975a033a7bde0102fa4b8fc29750d7fc98b
pcv_book/harris.py
python
match
(desc1,desc2,threshold=0.5)
return matchscores
For each corner point descriptor in the first image, select its match to second image using normalized cross correlation.
For each corner point descriptor in the first image, select its match to second image using normalized cross correlation.
[ "For", "each", "corner", "point", "descriptor", "in", "the", "first", "image", "select", "its", "match", "to", "second", "image", "using", "normalized", "cross", "correlation", "." ]
def match(desc1,desc2,threshold=0.5): """ For each corner point descriptor in the first image, select its match to second image using normalized cross correlation. """ n = len(desc1[0]) # pair-wise distances d = -ones((len(desc1),len(desc2))) for i in range(len(desc1)): ...
[ "def", "match", "(", "desc1", ",", "desc2", ",", "threshold", "=", "0.5", ")", ":", "n", "=", "len", "(", "desc1", "[", "0", "]", ")", "# pair-wise distances", "d", "=", "-", "ones", "(", "(", "len", "(", "desc1", ")", ",", "len", "(", "desc2", ...
https://github.com/jesolem/PCV/blob/376d5975a033a7bde0102fa4b8fc29750d7fc98b/pcv_book/harris.py#L87-L107
pengchenglin/ATX-Test
fb3354b210934726af6a369746d6bdf6359f268d
Public/maxim_monkey.py
python
Maxim.run_monkey
(cls, monkey_shell, actions=False, widget_black=False)
清理旧的配置文件并运行monkey,等待运行时间后pull log文件到电脑 :param monkey_shell: shell命令 uiautomatortroy 时 max.xpath.selector文件需要配置正确 :param actions: 特殊事件序列 max.xpath.actions文件需要配置正确 :param widget_black: 黑控件 黑区域屏蔽 max.widget.black文件需要配置正确 :return:
清理旧的配置文件并运行monkey,等待运行时间后pull log文件到电脑 :param monkey_shell: shell命令 uiautomatortroy 时 max.xpath.selector文件需要配置正确 :param actions: 特殊事件序列 max.xpath.actions文件需要配置正确 :param widget_black: 黑控件 黑区域屏蔽 max.widget.black文件需要配置正确 :return:
[ "清理旧的配置文件并运行monkey,等待运行时间后pull", "log文件到电脑", ":", "param", "monkey_shell", ":", "shell命令", "uiautomatortroy", "时", "max", ".", "xpath", ".", "selector文件需要配置正确", ":", "param", "actions", ":", "特殊事件序列", "max", ".", "xpath", ".", "actions文件需要配置正确", ":", "param", "wid...
def run_monkey(cls, monkey_shell, actions=False, widget_black=False): ''' 清理旧的配置文件并运行monkey,等待运行时间后pull log文件到电脑 :param monkey_shell: shell命令 uiautomatortroy 时 max.xpath.selector文件需要配置正确 :param actions: 特殊事件序列 max.xpath.actions文件需要配置正确 :param widget_black: 黑控件 黑区域屏蔽 max.widget.bl...
[ "def", "run_monkey", "(", "cls", ",", "monkey_shell", ",", "actions", "=", "False", ",", "widget_black", "=", "False", ")", ":", "log", ".", "i", "(", "'MONKEY_SHELL:%s'", "%", "monkey_shell", ")", "cls", ".", "clear_env", "(", ")", "cls", ".", "push_jar...
https://github.com/pengchenglin/ATX-Test/blob/fb3354b210934726af6a369746d6bdf6359f268d/Public/maxim_monkey.py#L88-L118
Blizzard/heroprotocol
3d36eaf44fc4c8ff3331c2ae2f1dc08a94535f1c
heroprotocol/versions/protocol39271.py
python
decode_replay_header
(contents)
return decoder.instance(replay_header_typeid)
Decodes and return the replay header from the contents byte string.
Decodes and return the replay header from the contents byte string.
[ "Decodes", "and", "return", "the", "replay", "header", "from", "the", "contents", "byte", "string", "." ]
def decode_replay_header(contents): """Decodes and return the replay header from the contents byte string.""" decoder = VersionedDecoder(contents, typeinfos) return decoder.instance(replay_header_typeid)
[ "def", "decode_replay_header", "(", "contents", ")", ":", "decoder", "=", "VersionedDecoder", "(", "contents", ",", "typeinfos", ")", "return", "decoder", ".", "instance", "(", "replay_header_typeid", ")" ]
https://github.com/Blizzard/heroprotocol/blob/3d36eaf44fc4c8ff3331c2ae2f1dc08a94535f1c/heroprotocol/versions/protocol39271.py#L446-L449
WerWolv/EdiZon_CheatsConfigsAndScripts
d16d36c7509c01dca770f402babd83ff2e9ae6e7
Scripts/lib/python3.5/email/parser.py
python
BytesParser.__init__
(self, *args, **kw)
Parser of binary RFC 2822 and MIME email messages. Creates an in-memory object tree representing the email message, which can then be manipulated and turned over to a Generator to return the textual representation of the message. The input must be formatted as a block of RFC 2822 heade...
Parser of binary RFC 2822 and MIME email messages.
[ "Parser", "of", "binary", "RFC", "2822", "and", "MIME", "email", "messages", "." ]
def __init__(self, *args, **kw): """Parser of binary RFC 2822 and MIME email messages. Creates an in-memory object tree representing the email message, which can then be manipulated and turned over to a Generator to return the textual representation of the message. The input mu...
[ "def", "__init__", "(", "self", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "self", ".", "parser", "=", "Parser", "(", "*", "args", ",", "*", "*", "kw", ")" ]
https://github.com/WerWolv/EdiZon_CheatsConfigsAndScripts/blob/d16d36c7509c01dca770f402babd83ff2e9ae6e7/Scripts/lib/python3.5/email/parser.py#L82-L98
suurjaak/Skyperious
6a4f264dbac8d326c2fa8aeb5483dbca987860bf
skyperious/lib/util.py
python
start_file
(filepath)
return success, error
Tries to open the specified file in the operating system. @return (success, error message)
Tries to open the specified file in the operating system.
[ "Tries", "to", "open", "the", "specified", "file", "in", "the", "operating", "system", "." ]
def start_file(filepath): """ Tries to open the specified file in the operating system. @return (success, error message) """ success, error = True, "" try: if "nt" == os.name: try: os.startfile(filepath) except WindowsError as e: if 1155 == e.win...
[ "def", "start_file", "(", "filepath", ")", ":", "success", ",", "error", "=", "True", ",", "\"\"", "try", ":", "if", "\"nt\"", "==", "os", ".", "name", ":", "try", ":", "os", ".", "startfile", "(", "filepath", ")", "except", "WindowsError", "as", "e"...
https://github.com/suurjaak/Skyperious/blob/6a4f264dbac8d326c2fa8aeb5483dbca987860bf/skyperious/lib/util.py#L303-L324
qutip/qutip
52d01da181a21b810c3407812c670f35fdc647e8
qutip/eseries.py
python
eseries.tidyup
(self, *args)
return self
Returns a tidier version of exponential series.
Returns a tidier version of exponential series.
[ "Returns", "a", "tidier", "version", "of", "exponential", "series", "." ]
def tidyup(self, *args): """ Returns a tidier version of exponential series. """ # # combine duplicate entries (same rate) # rate_tol = 1e-10 ampl_tol = 1e-10 ampl_dict = {} unique_rates = {} ur_len = 0 for r_idx in range(len(self...
[ "def", "tidyup", "(", "self", ",", "*", "args", ")", ":", "#", "# combine duplicate entries (same rate)", "#", "rate_tol", "=", "1e-10", "ampl_tol", "=", "1e-10", "ampl_dict", "=", "{", "}", "unique_rates", "=", "{", "}", "ur_len", "=", "0", "for", "r_idx"...
https://github.com/qutip/qutip/blob/52d01da181a21b810c3407812c670f35fdc647e8/qutip/eseries.py#L277-L323
phantomcyber/playbooks
9e850ecc44cb98c5dde53784744213a1ed5799bd
malware_hunt_and_contain.py
python
join_filter_2
(action=None, success=None, container=None, results=None, handle=None, filtered_artifacts=None, filtered_results=None, custom_function=None)
return
[]
def join_filter_2(action=None, success=None, container=None, results=None, handle=None, filtered_artifacts=None, filtered_results=None, custom_function=None): phantom.debug('join_filter_2() called') # check if all connected incoming playbooks, actions, or custom functions are done i.e. have succeeded or failed...
[ "def", "join_filter_2", "(", "action", "=", "None", ",", "success", "=", "None", ",", "container", "=", "None", ",", "results", "=", "None", ",", "handle", "=", "None", ",", "filtered_artifacts", "=", "None", ",", "filtered_results", "=", "None", ",", "c...
https://github.com/phantomcyber/playbooks/blob/9e850ecc44cb98c5dde53784744213a1ed5799bd/malware_hunt_and_contain.py#L132-L141
MachineLP/OCR_Keras
9b9a1826b18697acdce2a37c48a81542b4922b64
ocr_lib/crnn.py
python
CRNN.model_cnn
(self, width)
return base_model, conv_shape
[]
def model_cnn(self, width): self.input_tensor = Input((self._height, width, 3)) x = self.input_tensor for i, n_cnn in enumerate([3, 4, 6]): for j in range(n_cnn): x = Conv2D(32*2**i, (3, 3), padding='same', kernel_initializer='he_uniform', ...
[ "def", "model_cnn", "(", "self", ",", "width", ")", ":", "self", ".", "input_tensor", "=", "Input", "(", "(", "self", ".", "_height", ",", "width", ",", "3", ")", ")", "x", "=", "self", ".", "input_tensor", "for", "i", ",", "n_cnn", "in", "enumerat...
https://github.com/MachineLP/OCR_Keras/blob/9b9a1826b18697acdce2a37c48a81542b4922b64/ocr_lib/crnn.py#L172-L202
tomplus/kubernetes_asyncio
f028cc793e3a2c519be6a52a49fb77ff0b014c9b
kubernetes_asyncio/client/models/v1_storage_class_list.py
python
V1StorageClassList.__repr__
(self)
return self.to_str()
For `print` and `pprint`
For `print` and `pprint`
[ "For", "print", "and", "pprint" ]
def __repr__(self): """For `print` and `pprint`""" return self.to_str()
[ "def", "__repr__", "(", "self", ")", ":", "return", "self", ".", "to_str", "(", ")" ]
https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/models/v1_storage_class_list.py#L189-L191
golismero/golismero
7d605b937e241f51c1ca4f47b20f755eeefb9d76
tools/sqlmap/lib/core/common.py
python
parseFilePaths
(page)
Detects (possible) absolute system paths inside the provided page content
Detects (possible) absolute system paths inside the provided page content
[ "Detects", "(", "possible", ")", "absolute", "system", "paths", "inside", "the", "provided", "page", "content" ]
def parseFilePaths(page): """ Detects (possible) absolute system paths inside the provided page content """ if page: for regex in (r" in <b>(?P<result>.*?)</b> on line", r"(?:>|\s)(?P<result>[A-Za-z]:[\\/][\w.\\/]*)", r"(?:>|\s)(?P<result>/\w[/\w.]+)"): for match in re.finditer(rege...
[ "def", "parseFilePaths", "(", "page", ")", ":", "if", "page", ":", "for", "regex", "in", "(", "r\" in <b>(?P<result>.*?)</b> on line\"", ",", "r\"(?:>|\\s)(?P<result>[A-Za-z]:[\\\\/][\\w.\\\\/]*)\"", ",", "r\"(?:>|\\s)(?P<result>/\\w[/\\w.]+)\"", ")", ":", "for", "match", ...
https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/tools/sqlmap/lib/core/common.py#L1334-L1349
PyCQA/pylint
3fc855f9d0fa8e6410be5a23cf954ffd5471b4eb
pylint/extensions/overlapping_exceptions.py
python
OverlappingExceptionsChecker.visit_tryexcept
(self, node: nodes.TryExcept)
check for empty except
check for empty except
[ "check", "for", "empty", "except" ]
def visit_tryexcept(self, node: nodes.TryExcept) -> None: """check for empty except""" for handler in node.handlers: if handler.type is None: continue if isinstance(handler.type, astroid.BoolOp): continue try: excs = lis...
[ "def", "visit_tryexcept", "(", "self", ",", "node", ":", "nodes", ".", "TryExcept", ")", "->", "None", ":", "for", "handler", "in", "node", ".", "handlers", ":", "if", "handler", ".", "type", "is", "None", ":", "continue", "if", "isinstance", "(", "han...
https://github.com/PyCQA/pylint/blob/3fc855f9d0fa8e6410be5a23cf954ffd5471b4eb/pylint/extensions/overlapping_exceptions.py#L39-L85
pyparallel/pyparallel
11e8c6072d48c8f13641925d17b147bf36ee0ba3
Lib/site-packages/pip-7.1.2-py3.3.egg/pip/_vendor/requests/utils.py
python
from_key_val_list
(value)
return OrderedDict(value)
Take an object and test to see if it can be represented as a dictionary. Unless it can not be represented as such, return an OrderedDict, e.g., :: >>> from_key_val_list([('key', 'val')]) OrderedDict([('key', 'val')]) >>> from_key_val_list('string') ValueError: need more tha...
Take an object and test to see if it can be represented as a dictionary. Unless it can not be represented as such, return an OrderedDict, e.g.,
[ "Take", "an", "object", "and", "test", "to", "see", "if", "it", "can", "be", "represented", "as", "a", "dictionary", ".", "Unless", "it", "can", "not", "be", "represented", "as", "such", "return", "an", "OrderedDict", "e", ".", "g", "." ]
def from_key_val_list(value): """Take an object and test to see if it can be represented as a dictionary. Unless it can not be represented as such, return an OrderedDict, e.g., :: >>> from_key_val_list([('key', 'val')]) OrderedDict([('key', 'val')]) >>> from_key_val_list('strin...
[ "def", "from_key_val_list", "(", "value", ")", ":", "if", "value", "is", "None", ":", "return", "None", "if", "isinstance", "(", "value", ",", "(", "str", ",", "bytes", ",", "bool", ",", "int", ")", ")", ":", "raise", "ValueError", "(", "'cannot encode...
https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/pip-7.1.2-py3.3.egg/pip/_vendor/requests/utils.py#L124-L144
lisa-lab/pylearn2
af81e5c362f0df4df85c3e54e23b2adeec026055
pylearn2/rbm_tools.py
python
AIS.run
(self, n_steps=1)
Performs the grunt-work, implementing .. math:: log\:w^{(i)} += \mathcal{F}_{k-1}(v_{k-1}) - \mathcal{F}_{k}(v_{k-1}) recursively for all temperatures. Parameters ---------- n_steps : int, optional WRITEME
Performs the grunt-work, implementing
[ "Performs", "the", "grunt", "-", "work", "implementing" ]
def run(self, n_steps=1): """ Performs the grunt-work, implementing .. math:: log\:w^{(i)} += \mathcal{F}_{k-1}(v_{k-1}) - \mathcal{F}_{k}(v_{k-1}) recursively for all temperatures. Parameters ---------- n_steps : int, optional WRITEME ...
[ "def", "run", "(", "self", ",", "n_steps", "=", "1", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'betas'", ")", ":", "self", ".", "set_betas", "(", ")", "self", ".", "std_ais_w", "=", "[", "]", "# used to log std of log_ais_w regularly", "self",...
https://github.com/lisa-lab/pylearn2/blob/af81e5c362f0df4df85c3e54e23b2adeec026055/pylearn2/rbm_tools.py#L459-L513
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/motech/auth.py
python
OAuth2PasswordGrantManager.__init__
( self, base_url: str, username: str, password: str, client_id: str, client_secret: str, token_url: str, refresh_url: str, pass_credentials_in_header: bool, connection_settings: 'ConnectionSettings', )
[]
def __init__( self, base_url: str, username: str, password: str, client_id: str, client_secret: str, token_url: str, refresh_url: str, pass_credentials_in_header: bool, connection_settings: 'ConnectionSettings', ): self.base_url...
[ "def", "__init__", "(", "self", ",", "base_url", ":", "str", ",", "username", ":", "str", ",", "password", ":", "str", ",", "client_id", ":", "str", ",", "client_secret", ":", "str", ",", "token_url", ":", "str", ",", "refresh_url", ":", "str", ",", ...
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/motech/auth.py#L270-L290
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/full/importlib/_bootstrap.py
python
BuiltinImporter.is_package
(cls, fullname)
return False
Return False as built-in modules are never packages.
Return False as built-in modules are never packages.
[ "Return", "False", "as", "built", "-", "in", "modules", "are", "never", "packages", "." ]
def is_package(cls, fullname): """Return False as built-in modules are never packages.""" return False
[ "def", "is_package", "(", "cls", ",", "fullname", ")", ":", "return", "False" ]
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/importlib/_bootstrap.py#L797-L799
openedx/edx-platform
68dd185a0ab45862a2a61e0f803d7e03d2be71b5
common/djangoapps/split_modulestore_django/migrations/0002_data_migration.py
python
reverse_func
(apps, schema_editor)
Reversing the data migration is a no-op, because edX.org used a migration path path that started with writing to both MySQL+MongoDB while still reading from MongoDB, then later executed this data migration, then later cut over to reading from MySQL only. If we reversed this by deleting all entries, it would und...
Reversing the data migration is a no-op, because edX.org used a migration path path that started with writing to both MySQL+MongoDB while still reading from MongoDB, then later executed this data migration, then later cut over to reading from MySQL only. If we reversed this by deleting all entries, it would und...
[ "Reversing", "the", "data", "migration", "is", "a", "no", "-", "op", "because", "edX", ".", "org", "used", "a", "migration", "path", "path", "that", "started", "with", "writing", "to", "both", "MySQL", "+", "MongoDB", "while", "still", "reading", "from", ...
def reverse_func(apps, schema_editor): """ Reversing the data migration is a no-op, because edX.org used a migration path path that started with writing to both MySQL+MongoDB while still reading from MongoDB, then later executed this data migration, then later cut over to reading from MySQL only. If we ...
[ "def", "reverse_func", "(", "apps", ",", "schema_editor", ")", ":", "pass" ]
https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/common/djangoapps/split_modulestore_django/migrations/0002_data_migration.py#L62-L69
Patrowl/PatrowlEngines
61dce987b662177396fa2f914ae07fd651179daf
engines/openvas/engine-openvas-omp.py
python
create_task
(target_name, target_id)
return task_id
This function creates a task_id in OpenVAS and returns its task_id
This function creates a task_id in OpenVAS and returns its task_id
[ "This", "function", "creates", "a", "task_id", "in", "OpenVAS", "and", "returns", "its", "task_id" ]
def create_task(target_name, target_id): """ This function creates a task_id in OpenVAS and returns its task_id """ result = omp_cmd(["-C", "-c", engine.scanner["scan_config"], "--name", target_name, "--target", target_id]).split("\n") task_id = result[0] if not is_uuid(task_id): return ...
[ "def", "create_task", "(", "target_name", ",", "target_id", ")", ":", "result", "=", "omp_cmd", "(", "[", "\"-C\"", ",", "\"-c\"", ",", "engine", ".", "scanner", "[", "\"scan_config\"", "]", ",", "\"--name\"", ",", "target_name", ",", "\"--target\"", ",", ...
https://github.com/Patrowl/PatrowlEngines/blob/61dce987b662177396fa2f914ae07fd651179daf/engines/openvas/engine-openvas-omp.py#L179-L187
dbt-labs/dbt-core
e943b9fc842535e958ef4fd0b8703adc91556bc6
core/dbt/parser/manifest.py
python
ManifestLoader.load_and_parse_macros
(self, project_parser_files)
[]
def load_and_parse_macros(self, project_parser_files): for project in self.all_projects.values(): if project.project_name not in project_parser_files: continue parser_files = project_parser_files[project.project_name] if 'MacroParser' in parser_files: ...
[ "def", "load_and_parse_macros", "(", "self", ",", "project_parser_files", ")", ":", "for", "project", "in", "self", ".", "all_projects", ".", "values", "(", ")", ":", "if", "project", ".", "project_name", "not", "in", "project_parser_files", ":", "continue", "...
https://github.com/dbt-labs/dbt-core/blob/e943b9fc842535e958ef4fd0b8703adc91556bc6/core/dbt/parser/manifest.py#L393-L417
deepgram/kur
fd0c120e50815c1e5be64e5dde964dcd47234556
kur/model/model.py
python
Model.register_provider
(self, provider)
Let's the model know which data provider we are using. This allows the model to do shape inference for layers.
Let's the model know which data provider we are using.
[ "Let", "s", "the", "model", "know", "which", "data", "provider", "we", "are", "using", "." ]
def register_provider(self, provider): """ Let's the model know which data provider we are using. This allows the model to do shape inference for layers. """ self.provider = provider
[ "def", "register_provider", "(", "self", ",", "provider", ")", ":", "self", ".", "provider", "=", "provider" ]
https://github.com/deepgram/kur/blob/fd0c120e50815c1e5be64e5dde964dcd47234556/kur/model/model.py#L102-L107
larryhastings/gilectomy
4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a
Lib/idlelib/configHandler.py
python
IdleUserConfParser.RemoveEmptySections
(self)
Remove any sections that have no options.
Remove any sections that have no options.
[ "Remove", "any", "sections", "that", "have", "no", "options", "." ]
def RemoveEmptySections(self): "Remove any sections that have no options." for section in self.sections(): if not self.GetOptionList(section): self.remove_section(section)
[ "def", "RemoveEmptySections", "(", "self", ")", ":", "for", "section", "in", "self", ".", "sections", "(", ")", ":", "if", "not", "self", ".", "GetOptionList", "(", "section", ")", ":", "self", ".", "remove_section", "(", "section", ")" ]
https://github.com/larryhastings/gilectomy/blob/4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a/Lib/idlelib/configHandler.py#L82-L86
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/reportlab/graphics/charts/barcharts.py
python
BarChart._drawFinish
(self)
return g
finalize the drawing of a barchart
finalize the drawing of a barchart
[ "finalize", "the", "drawing", "of", "a", "barchart" ]
def _drawFinish(self): '''finalize the drawing of a barchart''' cA = self.categoryAxis vA = self.valueAxis cA.configure(self._configureData) self.calcBarPositions() g = Group() zIndex = getattr(self,'zIndexOverrides',None) if not zIndex: g.add...
[ "def", "_drawFinish", "(", "self", ")", ":", "cA", "=", "self", ".", "categoryAxis", "vA", "=", "self", ".", "valueAxis", "cA", ".", "configure", "(", "self", ".", "_configureData", ")", "self", ".", "calcBarPositions", "(", ")", "g", "=", "Group", "("...
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/reportlab/graphics/charts/barcharts.py#L201-L271
pandas-dev/pandas
5ba7d714014ae8feaccc0dd4a98890828cf2832d
pandas/core/indexes/base.py
python
Index._intersection
(self, other: Index, sort=False)
return res_values
intersection specialized to the case with matching dtypes.
intersection specialized to the case with matching dtypes.
[ "intersection", "specialized", "to", "the", "case", "with", "matching", "dtypes", "." ]
def _intersection(self, other: Index, sort=False): """ intersection specialized to the case with matching dtypes. """ if self.is_monotonic and other.is_monotonic and self._can_use_libjoin: try: result = self._inner_indexer(other)[0] except TypeErro...
[ "def", "_intersection", "(", "self", ",", "other", ":", "Index", ",", "sort", "=", "False", ")", ":", "if", "self", ".", "is_monotonic", "and", "other", ".", "is_monotonic", "and", "self", ".", "_can_use_libjoin", ":", "try", ":", "result", "=", "self", ...
https://github.com/pandas-dev/pandas/blob/5ba7d714014ae8feaccc0dd4a98890828cf2832d/pandas/core/indexes/base.py#L3333-L3350
DataDog/integrations-core
934674b29d94b70ccc008f76ea172d0cdae05e1e
oracle/datadog_checks/oracle/config_models/shared.py
python
SharedConfig._ensure_defaults
(cls, v, field)
return getattr(defaults, f'shared_{field.name}')(field, v)
[]
def _ensure_defaults(cls, v, field): if v is not None or field.required: return v return getattr(defaults, f'shared_{field.name}')(field, v)
[ "def", "_ensure_defaults", "(", "cls", ",", "v", ",", "field", ")", ":", "if", "v", "is", "not", "None", "or", "field", ".", "required", ":", "return", "v", "return", "getattr", "(", "defaults", ",", "f'shared_{field.name}'", ")", "(", "field", ",", "v...
https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/oracle/datadog_checks/oracle/config_models/shared.py#L34-L38
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/lib-python/3/poplib.py
python
POP3.getwelcome
(self)
return self.welcome
[]
def getwelcome(self): return self.welcome
[ "def", "getwelcome", "(", "self", ")", ":", "return", "self", ".", "welcome" ]
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/poplib.py#L167-L168
jinfagang/alfred
dd7420d1410f82f9dadf07a30b6fad5a71168001
alfred/modules/data/voc2yolo.py
python
voc2yolo
(img_dir, xml_dir, class_txt)
[]
def voc2yolo(img_dir, xml_dir, class_txt): classes_names = None if class_txt: classes_names = [i.strip() for i in open(class_txt, 'r').readlines()] labels_target = os.path.join(os.path.dirname(xml_dir.rstrip('/')), 'yolo_converted_from_voc') print('labels dir to save: {}'.format(labels_target))...
[ "def", "voc2yolo", "(", "img_dir", ",", "xml_dir", ",", "class_txt", ")", ":", "classes_names", "=", "None", "if", "class_txt", ":", "classes_names", "=", "[", "i", ".", "strip", "(", ")", "for", "i", "in", "open", "(", "class_txt", ",", "'r'", ")", ...
https://github.com/jinfagang/alfred/blob/dd7420d1410f82f9dadf07a30b6fad5a71168001/alfred/modules/data/voc2yolo.py#L50-L64
pyparallel/pyparallel
11e8c6072d48c8f13641925d17b147bf36ee0ba3
Tools/scripts/highlight.py
python
ansi_highlight
(classified_text, colors=default_ansi)
return ''.join(result)
Add syntax highlighting to source code using ANSI escape sequences
Add syntax highlighting to source code using ANSI escape sequences
[ "Add", "syntax", "highlighting", "to", "source", "code", "using", "ANSI", "escape", "sequences" ]
def ansi_highlight(classified_text, colors=default_ansi): 'Add syntax highlighting to source code using ANSI escape sequences' # http://en.wikipedia.org/wiki/ANSI_escape_code result = [] for kind, text in classified_text: opener, closer = colors.get(kind, ('', '')) result += [opener, tex...
[ "def", "ansi_highlight", "(", "classified_text", ",", "colors", "=", "default_ansi", ")", ":", "# http://en.wikipedia.org/wiki/ANSI_escape_code", "result", "=", "[", "]", "for", "kind", ",", "text", "in", "classified_text", ":", "opener", ",", "closer", "=", "colo...
https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Tools/scripts/highlight.py#L87-L94
saltstack/salt
fae5bc757ad0f1716483ce7ae180b451545c2058
salt/modules/github.py
python
is_team_member
(name, team_name, profile="github")
return name.lower() in list_team_members(team_name, profile=profile)
Returns True if the github user is in the team with team_name, or False otherwise. name The name of the user whose membership to check. team_name The name of the team to check membership in. profile The name of the profile configuration to use. Defaults to ``github``. CLI...
Returns True if the github user is in the team with team_name, or False otherwise.
[ "Returns", "True", "if", "the", "github", "user", "is", "in", "the", "team", "with", "team_name", "or", "False", "otherwise", "." ]
def is_team_member(name, team_name, profile="github"): """ Returns True if the github user is in the team with team_name, or False otherwise. name The name of the user whose membership to check. team_name The name of the team to check membership in. profile The name of...
[ "def", "is_team_member", "(", "name", ",", "team_name", ",", "profile", "=", "\"github\"", ")", ":", "return", "name", ".", "lower", "(", ")", "in", "list_team_members", "(", "team_name", ",", "profile", "=", "profile", ")" ]
https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/github.py#L1495-L1517
Tencent/bk-sops
2a6bd1573b7b42812cb8a5b00929e98ab916b18d
gcloud/template_base/domains/template_manager.py
python
TemplateManager.update
( self, template: object, editor: str, name: str = "", pipeline_tree: str = None, description: str = "", )
return data
更新 template 层模板 :param template: template 对象 :type template: object :param editor: 编辑者 :type editor: str :param name: 模板名, defaults to "" :type name: str, optional :param pipeline_tree: 模板结构, defaults to None :type pipeline_tree: str, optional :pa...
更新 template 层模板
[ "更新", "template", "层模板" ]
def update( self, template: object, editor: str, name: str = "", pipeline_tree: str = None, description: str = "", ) -> dict: """ 更新 template 层模板 :param template: template 对象 :type template: object :param editor: 编辑者 :type editor: str :param name: 模板名...
[ "def", "update", "(", "self", ",", "template", ":", "object", ",", "editor", ":", "str", ",", "name", ":", "str", "=", "\"\"", ",", "pipeline_tree", ":", "str", "=", "None", ",", "description", ":", "str", "=", "\"\"", ",", ")", "->", "dict", ":", ...
https://github.com/Tencent/bk-sops/blob/2a6bd1573b7b42812cb8a5b00929e98ab916b18d/gcloud/template_base/domains/template_manager.py#L200-L230
twke18/Adaptive_Affinity_Fields
8488aa6ad16022ab4b89fb8626386997559cb951
network/common/resnet_v1.py
python
resnet_v1_101
(x, name, is_training, use_global_status, reuse=False)
return resnet_v1(x, name=name, filters=[64,128,256,512], num_blocks=[3,4,23,3], strides=[2,1,1,1], dilations=[None, None, 2, 4], is_training=is_training, use_global_status=use_global_stat...
Builds ResNet101 v1. Args: x: A tensor of size [batch_size, height_in, width_in, channels]. name: The prefix of tensorflow variables defined in this network. is_training: If the tensorflow variables defined in this layer would be used for training. use_global_status: enable/disable use_global_...
Builds ResNet101 v1.
[ "Builds", "ResNet101", "v1", "." ]
def resnet_v1_101(x, name, is_training, use_global_status, reuse=False): """Builds ResNet101 v1. Args: x: A tensor of size [batch_size, height_in, width_in, channels]. name: The prefix of tensorflow variables defined in this network. ...
[ "def", "resnet_v1_101", "(", "x", ",", "name", ",", "is_training", ",", "use_global_status", ",", "reuse", "=", "False", ")", ":", "return", "resnet_v1", "(", "x", ",", "name", "=", "name", ",", "filters", "=", "[", "64", ",", "128", ",", "256", ",",...
https://github.com/twke18/Adaptive_Affinity_Fields/blob/8488aa6ad16022ab4b89fb8626386997559cb951/network/common/resnet_v1.py#L208-L237
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/python-oauth2/oauth2/__init__.py
python
Server.build_authenticate_header
(self, realm='')
return {'WWW-Authenticate': 'OAuth realm="%s"' % realm}
Optional support for the authenticate header.
Optional support for the authenticate header.
[ "Optional", "support", "for", "the", "authenticate", "header", "." ]
def build_authenticate_header(self, realm=''): """Optional support for the authenticate header.""" return {'WWW-Authenticate': 'OAuth realm="%s"' % realm}
[ "def", "build_authenticate_header", "(", "self", ",", "realm", "=", "''", ")", ":", "return", "{", "'WWW-Authenticate'", ":", "'OAuth realm=\"%s\"'", "%", "realm", "}" ]
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/python-oauth2/oauth2/__init__.py#L713-L715
Yelp/paasta
6c08c04a577359509575c794b973ea84d72accf9
paasta_tools/utils.py
python
InstanceConfig.get_cpu_quota
(self)
return (self.get_cpus() + cpu_burst_add) * self.get_cpu_period()
Gets the --cpu-quota option to be passed to docker Calculation: (cpus + cpus_burst_add) * cfs_period_us :returns: The number to be passed to the --cpu-quota docker flag
Gets the --cpu-quota option to be passed to docker
[ "Gets", "the", "--", "cpu", "-", "quota", "option", "to", "be", "passed", "to", "docker" ]
def get_cpu_quota(self) -> float: """Gets the --cpu-quota option to be passed to docker Calculation: (cpus + cpus_burst_add) * cfs_period_us :returns: The number to be passed to the --cpu-quota docker flag""" cpu_burst_add = self.get_cpu_burst_add() return (self.get_cpus() + cp...
[ "def", "get_cpu_quota", "(", "self", ")", "->", "float", ":", "cpu_burst_add", "=", "self", ".", "get_cpu_burst_add", "(", ")", "return", "(", "self", ".", "get_cpus", "(", ")", "+", "cpu_burst_add", ")", "*", "self", ".", "get_cpu_period", "(", ")" ]
https://github.com/Yelp/paasta/blob/6c08c04a577359509575c794b973ea84d72accf9/paasta_tools/utils.py#L468-L475
dominno/django-moderation
6909b01dbdeee5cf40bf399394da0ceadf9dd702
moderation/diff.py
python
get_diff_operations
(a, b)
return operations
[]
def get_diff_operations(a, b): operations = [] a_words = re.split(r'(\W+)', a) b_words = re.split(r'(\W+)', b) sequence_matcher = difflib.SequenceMatcher(None, a_words, b_words) for opcode in sequence_matcher.get_opcodes(): operation, start_a, end_a, start_b, end_b = opcode deleted ...
[ "def", "get_diff_operations", "(", "a", ",", "b", ")", ":", "operations", "=", "[", "]", "a_words", "=", "re", ".", "split", "(", "r'(\\W+)'", ",", "a", ")", "b_words", "=", "re", ".", "split", "(", "r'(\\W+)'", ",", "b", ")", "sequence_matcher", "="...
https://github.com/dominno/django-moderation/blob/6909b01dbdeee5cf40bf399394da0ceadf9dd702/moderation/diff.py#L99-L113
LexPredict/lexpredict-contraxsuite
1d5a2540d31f8f3f1adc442cfa13a7c007319899
sdk/python/sdk/openapi_client/model/document_type_import_response.py
python
DocumentTypeImportResponse.__init__
(self, task_id, *args, **kwargs)
DocumentTypeImportResponse - a model defined in OpenAPI Args: task_id (str): Keyword Args: _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if ...
DocumentTypeImportResponse - a model defined in OpenAPI
[ "DocumentTypeImportResponse", "-", "a", "model", "defined", "in", "OpenAPI" ]
def __init__(self, task_id, *args, **kwargs): # noqa: E501 """DocumentTypeImportResponse - a model defined in OpenAPI Args: task_id (str): Keyword Args: _check_type (bool): if True, values for parameters in openapi_types will be type che...
[ "def", "__init__", "(", "self", ",", "task_id", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "_check_type", "=", "kwargs", ".", "pop", "(", "'_check_type'", ",", "True", ")", "_spec_property_naming", "=", "kwargs", ".", "pop", "("...
https://github.com/LexPredict/lexpredict-contraxsuite/blob/1d5a2540d31f8f3f1adc442cfa13a7c007319899/sdk/python/sdk/openapi_client/model/document_type_import_response.py#L188-L261
bastula/dicompyler
2643e0ee145cb7c699b3d36e3e4f07ac9dc7b1f2
dicompyler/baseplugins/2dview.py
python
plugin2DView.OnDestroy
(self, evt)
Unbind to all events before the plugin is destroyed.
Unbind to all events before the plugin is destroyed.
[ "Unbind", "to", "all", "events", "before", "the", "plugin", "is", "destroyed", "." ]
def OnDestroy(self, evt): """Unbind to all events before the plugin is destroyed.""" pub.unsubscribe(self.OnUpdatePatient, 'patient.updated.parsed_data') pub.unsubscribe(self.OnStructureCheck, 'structures.checked') pub.unsubscribe(self.OnIsodoseCheck, 'isodoses.checked') pub.uns...
[ "def", "OnDestroy", "(", "self", ",", "evt", ")", ":", "pub", ".", "unsubscribe", "(", "self", ".", "OnUpdatePatient", ",", "'patient.updated.parsed_data'", ")", "pub", ".", "unsubscribe", "(", "self", ".", "OnStructureCheck", ",", "'structures.checked'", ")", ...
https://github.com/bastula/dicompyler/blob/2643e0ee145cb7c699b3d36e3e4f07ac9dc7b1f2/dicompyler/baseplugins/2dview.py#L200-L207
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/sqlalchemy/engine/interfaces.py
python
ExecutionContext.handle_dbapi_exception
(self, e)
Receive a DBAPI exception which occurred upon execute, result fetch, etc.
Receive a DBAPI exception which occurred upon execute, result fetch, etc.
[ "Receive", "a", "DBAPI", "exception", "which", "occurred", "upon", "execute", "result", "fetch", "etc", "." ]
def handle_dbapi_exception(self, e): """Receive a DBAPI exception which occurred upon execute, result fetch, etc.""" raise NotImplementedError()
[ "def", "handle_dbapi_exception", "(", "self", ",", "e", ")", ":", "raise", "NotImplementedError", "(", ")" ]
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/sqlalchemy/engine/interfaces.py#L787-L791
osmr/imgclsmob
f2993d3ce73a2f7ddba05da3891defb08547d504
chainer_/chainercv2/models/irevnet.py
python
get_irevnet
(blocks, model_name=None, pretrained=False, root=os.path.join("~", ".chainer", "models"), **kwargs)
return net
Create i-RevNet model with specific parameters. Parameters: ---------- blocks : int Number of blocks. model_name : str or None, default None Model name for loading pretrained model. pretrained : bool, default False Whether to load the pretrained weights for model. root :...
Create i-RevNet model with specific parameters.
[ "Create", "i", "-", "RevNet", "model", "with", "specific", "parameters", "." ]
def get_irevnet(blocks, model_name=None, pretrained=False, root=os.path.join("~", ".chainer", "models"), **kwargs): """ Create i-RevNet model with specific parameters. Parameters: ---------- blocks : int Number of blocks. m...
[ "def", "get_irevnet", "(", "blocks", ",", "model_name", "=", "None", ",", "pretrained", "=", "False", ",", "root", "=", "os", ".", "path", ".", "join", "(", "\"~\"", ",", "\".chainer\"", ",", "\"models\"", ")", ",", "*", "*", "kwargs", ")", ":", "if"...
https://github.com/osmr/imgclsmob/blob/f2993d3ce73a2f7ddba05da3891defb08547d504/chainer_/chainercv2/models/irevnet.py#L387-L436
radlab/sparrow
afb8efadeb88524f1394d1abe4ea66c6fd2ac744
simulation/simulation_hacked.py
python
StatsManager.output_load_versus_launch_time
(self)
Outputs the predicted load and launch time for each task. This information is intended to help evaluate the staleness of the load information from the probe. If the information is quite stale, we'd expect to see little correlation between the load and the launch time of the tas...
Outputs the predicted load and launch time for each task. This information is intended to help evaluate the staleness of the load information from the probe. If the information is quite stale, we'd expect to see little correlation between the load and the launch time of the tas...
[ "Outputs", "the", "predicted", "load", "and", "launch", "time", "for", "each", "task", ".", "This", "information", "is", "intended", "to", "help", "evaluate", "the", "staleness", "of", "the", "load", "information", "from", "the", "probe", ".", "If", "the", ...
def output_load_versus_launch_time(self): """ Outputs the predicted load and launch time for each task. This information is intended to help evaluate the staleness of the load information from the probe. If the information is quite stale, we'd expect to see little correlation b...
[ "def", "output_load_versus_launch_time", "(", "self", ")", ":", "results_dirname", "=", "get_param", "(", "\"results_dir\"", ")", "per_task_filename", "=", "os", ".", "path", ".", "join", "(", "results_dirname", ",", "\"%s_task_load_vs_wait\"", "%", "get_param", "("...
https://github.com/radlab/sparrow/blob/afb8efadeb88524f1394d1abe4ea66c6fd2ac744/simulation/simulation_hacked.py#L805-L840
pyparsing/pyparsing
1ccf846394a055924b810faaf9628dac53633848
examples/pymicko.py
python
SymbolTable.insert_function
(self, fname, ftype)
return index
Inserts a new function
Inserts a new function
[ "Inserts", "a", "new", "function" ]
def insert_function(self, fname, ftype): "Inserts a new function" index = self.insert_id( fname, SharedData.KINDS.FUNCTION, [SharedData.KINDS.GLOBAL_VAR, SharedData.KINDS.FUNCTION], ftype, ) self.table[index].set_attribute("Params", 0) ...
[ "def", "insert_function", "(", "self", ",", "fname", ",", "ftype", ")", ":", "index", "=", "self", ".", "insert_id", "(", "fname", ",", "SharedData", ".", "KINDS", ".", "FUNCTION", ",", "[", "SharedData", ".", "KINDS", ".", "GLOBAL_VAR", ",", "SharedData...
https://github.com/pyparsing/pyparsing/blob/1ccf846394a055924b810faaf9628dac53633848/examples/pymicko.py#L523-L532
ACCLAB/DABEST-python
3ac87685a6c0859f731e9c9107bef8f32e39a61d
dabest/_classes.py
python
TwoGroupsEffectSize.__init__
(self, control, test, effect_size, is_paired=False, ci=95, resamples=5000, permutation_count=5000, random_seed=12345)
Compute the effect size between two groups. Parameters ---------- control : array-like test : array-like These should be numerical iterables. effect_size : string. Any one of the following are accepted inputs: 'mean_diff', 'median_diff', 'cohe...
Compute the effect size between two groups.
[ "Compute", "the", "effect", "size", "between", "two", "groups", "." ]
def __init__(self, control, test, effect_size, is_paired=False, ci=95, resamples=5000, permutation_count=5000, random_seed=12345): """ Compute the effect size between two groups. Parameters ---------- control...
[ "def", "__init__", "(", "self", ",", "control", ",", "test", ",", "effect_size", ",", "is_paired", "=", "False", ",", "ci", "=", "95", ",", "resamples", "=", "5000", ",", "permutation_count", "=", "5000", ",", "random_seed", "=", "12345", ")", ":", "im...
https://github.com/ACCLAB/DABEST-python/blob/3ac87685a6c0859f731e9c9107bef8f32e39a61d/dabest/_classes.py#L557-L900
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/shelly/entity.py
python
ShellyBlockEntity.should_poll
(self)
return False
If device should be polled.
If device should be polled.
[ "If", "device", "should", "be", "polled", "." ]
def should_poll(self) -> bool: """If device should be polled.""" return False
[ "def", "should_poll", "(", "self", ")", "->", "bool", ":", "return", "False" ]
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/shelly/entity.py#L292-L294
TengXiaoDai/DistributedCrawling
f5c2439e6ce68dd9b49bde084d76473ff9ed4963
Lib/site-packages/pkg_resources/__init__.py
python
IResourceProvider.resource_isdir
(resource_name)
Is the named resource a directory? (like ``os.path.isdir()``)
Is the named resource a directory? (like ``os.path.isdir()``)
[ "Is", "the", "named", "resource", "a", "directory?", "(", "like", "os", ".", "path", ".", "isdir", "()", ")" ]
def resource_isdir(resource_name): """Is the named resource a directory? (like ``os.path.isdir()``)"""
[ "def", "resource_isdir", "(", "resource_name", ")", ":" ]
https://github.com/TengXiaoDai/DistributedCrawling/blob/f5c2439e6ce68dd9b49bde084d76473ff9ed4963/Lib/site-packages/pkg_resources/__init__.py#L617-L618
rstacruz/sparkup
d400a570bf64b0c216aa7c8e1795820b911a7404
sparkup.py
python
Element._populate
(self)
Expands with default items. This is called when the [[populate]] flag is turned on.
Expands with default items.
[ "Expands", "with", "default", "items", "." ]
def _populate(self): """Expands with default items. This is called when the [[populate]] flag is turned on. """ if self.name == 'ul': elements = [Element(name='li', parent=self, parser=self.parser)] elif self.name == 'dl': elements = [ E...
[ "def", "_populate", "(", "self", ")", ":", "if", "self", ".", "name", "==", "'ul'", ":", "elements", "=", "[", "Element", "(", "name", "=", "'li'", ",", "parent", "=", "self", ",", "parser", "=", "self", ".", "parser", ")", "]", "elif", "self", "...
https://github.com/rstacruz/sparkup/blob/d400a570bf64b0c216aa7c8e1795820b911a7404/sparkup.py#L784-L808
MultiAgentLearning/playground
8c06a21da5758b570b708e9dd3337e1fa1e67e71
pommerman/agents/simple_agent.py
python
SimpleAgent._near_enemy
(cls, my_position, items, dist, prev, enemies, radius)
return cls._get_direction_towards_position(my_position, nearest_enemy_position, prev)
[]
def _near_enemy(cls, my_position, items, dist, prev, enemies, radius): nearest_enemy_position = cls._nearest_position(dist, enemies, items, radius) return cls._get_direction_towards_position(my_position, ...
[ "def", "_near_enemy", "(", "cls", ",", "my_position", ",", "items", ",", "dist", ",", "prev", ",", "enemies", ",", "radius", ")", ":", "nearest_enemy_position", "=", "cls", ".", "_nearest_position", "(", "dist", ",", "enemies", ",", "items", ",", "radius",...
https://github.com/MultiAgentLearning/playground/blob/8c06a21da5758b570b708e9dd3337e1fa1e67e71/pommerman/agents/simple_agent.py#L386-L390
mar10/wsgidav
b7ce6ce47c7f42b8f7eed0258b89fea4c1951233
wsgidav/dc/base_dc.py
python
BaseDomainController.supports_http_digest_auth
(self)
Signal if this DC instance supports the HTTP digest authentication theme. If true, `HTTPAuthenticator` will call `dc.digest_auth_user()`, so this method must be implemented as well. Returns: bool
Signal if this DC instance supports the HTTP digest authentication theme.
[ "Signal", "if", "this", "DC", "instance", "supports", "the", "HTTP", "digest", "authentication", "theme", "." ]
def supports_http_digest_auth(self): """Signal if this DC instance supports the HTTP digest authentication theme. If true, `HTTPAuthenticator` will call `dc.digest_auth_user()`, so this method must be implemented as well. Returns: bool """ raise NotImplement...
[ "def", "supports_http_digest_auth", "(", "self", ")", ":", "raise", "NotImplementedError" ]
https://github.com/mar10/wsgidav/blob/b7ce6ce47c7f42b8f7eed0258b89fea4c1951233/wsgidav/dc/base_dc.py#L169-L178
CedricGuillemet/Imogen
ee417b42747ed5b46cb11b02ef0c3630000085b3
bin/Lib/inspect.py
python
_main
()
Logic for inspecting an object given at command line
Logic for inspecting an object given at command line
[ "Logic", "for", "inspecting", "an", "object", "given", "at", "command", "line" ]
def _main(): """ Logic for inspecting an object given at command line """ import argparse import importlib parser = argparse.ArgumentParser() parser.add_argument( 'object', help="The object to be analysed. " "It supports the 'module:qualname' syntax") parser.add_a...
[ "def", "_main", "(", ")", ":", "import", "argparse", "import", "importlib", "parser", "=", "argparse", ".", "ArgumentParser", "(", ")", "parser", ".", "add_argument", "(", "'object'", ",", "help", "=", "\"The object to be analysed. \"", "\"It supports the 'module:qu...
https://github.com/CedricGuillemet/Imogen/blob/ee417b42747ed5b46cb11b02ef0c3630000085b3/bin/Lib/inspect.py#L3078-L3133
KhronosGroup/OpenXR-SDK-Source
76756e2e7849b15466d29bee7d80cada92865550
external/python/jinja2/environment.py
python
Environment._compile
(self, source, filename)
return compile(source, filename, 'exec')
Internal hook that can be overridden to hook a different compile method in. .. versionadded:: 2.5
Internal hook that can be overridden to hook a different compile method in.
[ "Internal", "hook", "that", "can", "be", "overridden", "to", "hook", "a", "different", "compile", "method", "in", "." ]
def _compile(self, source, filename): """Internal hook that can be overridden to hook a different compile method in. .. versionadded:: 2.5 """ return compile(source, filename, 'exec')
[ "def", "_compile", "(", "self", ",", "source", ",", "filename", ")", ":", "return", "compile", "(", "source", ",", "filename", ",", "'exec'", ")" ]
https://github.com/KhronosGroup/OpenXR-SDK-Source/blob/76756e2e7849b15466d29bee7d80cada92865550/external/python/jinja2/environment.py#L545-L551
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_utils/library/openshift_cert_expiry.py
python
FakeOpenSSLCertificate.get_subject
(self)
return self.subject
Subjects must implement get_components() and return dicts or tuples. An 'openssl x509 -in CERT.cert -text' with 'Subject': Subject: Subject: O=system:nodes, CN=system:node:m01.example.com might return: [('O=system', 'nodes'), ('CN=system', 'node:m01.example.com')]
Subjects must implement get_components() and return dicts or tuples. An 'openssl x509 -in CERT.cert -text' with 'Subject':
[ "Subjects", "must", "implement", "get_components", "()", "and", "return", "dicts", "or", "tuples", ".", "An", "openssl", "x509", "-", "in", "CERT", ".", "cert", "-", "text", "with", "Subject", ":" ]
def get_subject(self): """Subjects must implement get_components() and return dicts or tuples. An 'openssl x509 -in CERT.cert -text' with 'Subject': Subject: Subject: O=system:nodes, CN=system:node:m01.example.com might return: [('O=system', 'nodes'), ('CN=system', 'node:m01.example.com')] """ ...
[ "def", "get_subject", "(", "self", ")", ":", "return", "self", ".", "subject" ]
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_utils/library/openshift_cert_expiry.py#L163-L171
dump247/aws-mock-metadata
ec85bc8c6f41afa8fa624898d6ba1ee5315ebcc2
metadata/otp.py
python
Totp.generate
(self, at=None)
return code % 10 ** self.digits
Generate a new OTP code. Parameters: at (datetime): timestamp to generate the code for or None to use current time Returns: (int): generated code
Generate a new OTP code.
[ "Generate", "a", "new", "OTP", "code", "." ]
def generate(self, at=None): """ Generate a new OTP code. Parameters: at (datetime): timestamp to generate the code for or None to use current time Returns: (int): generated code """ timecode = self.__timecode(at or datetime.now()) hmac_hash = ...
[ "def", "generate", "(", "self", ",", "at", "=", "None", ")", ":", "timecode", "=", "self", ".", "__timecode", "(", "at", "or", "datetime", ".", "now", "(", ")", ")", "hmac_hash", "=", "hmac", ".", "new", "(", "self", ".", "secret", ",", "timecode",...
https://github.com/dump247/aws-mock-metadata/blob/ec85bc8c6f41afa8fa624898d6ba1ee5315ebcc2/metadata/otp.py#L26-L45
certsocietegenerale/fame
6bb758063b1ac5de6792fd3316a4635d1ffecfd1
fame/core/module.py
python
ProcessingModule.add_probable_name
(self, probable_name)
Add a probable name to the analysis. Args: probable_name (string): probable name of the malware.
Add a probable name to the analysis.
[ "Add", "a", "probable", "name", "to", "the", "analysis", "." ]
def add_probable_name(self, probable_name): """Add a probable name to the analysis. Args: probable_name (string): probable name of the malware. """ self._analysis.add_probable_name(probable_name)
[ "def", "add_probable_name", "(", "self", ",", "probable_name", ")", ":", "self", ".", "_analysis", ".", "add_probable_name", "(", "probable_name", ")" ]
https://github.com/certsocietegenerale/fame/blob/6bb758063b1ac5de6792fd3316a4635d1ffecfd1/fame/core/module.py#L374-L380
openstack/keystone
771c943ad2116193e7bb118c74993c829d93bd71
keystone/receipt/receipt_formatters.py
python
ReceiptFormatter.crypto
(self)
return fernet.MultiFernet(fernet_instances)
Return a cryptography instance. You can extend this class with a custom crypto @property to provide your own receipt encoding / decoding. For example, using a different cryptography library (e.g. ``python-keyczar``) or to meet arbitrary security requirements. This @property jus...
Return a cryptography instance.
[ "Return", "a", "cryptography", "instance", "." ]
def crypto(self): """Return a cryptography instance. You can extend this class with a custom crypto @property to provide your own receipt encoding / decoding. For example, using a different cryptography library (e.g. ``python-keyczar``) or to meet arbitrary security requirements...
[ "def", "crypto", "(", "self", ")", ":", "fernet_utils", "=", "utils", ".", "FernetUtils", "(", "CONF", ".", "fernet_receipts", ".", "key_repository", ",", "CONF", ".", "fernet_receipts", ".", "max_active_keys", ",", "'fernet_receipts'", ")", "keys", "=", "fern...
https://github.com/openstack/keystone/blob/771c943ad2116193e7bb118c74993c829d93bd71/keystone/receipt/receipt_formatters.py#L46-L69
openedx/edx-platform
68dd185a0ab45862a2a61e0f803d7e03d2be71b5
common/djangoapps/pipeline_mako/__init__.py
python
render_require_js_path_overrides
(path_overrides)
return html.format(overrides=',\n'.join(new_paths))
Render JavaScript to override default RequireJS paths. The Django pipeline appends a hash to JavaScript files, so if the JS asset isn't included in the bundle for the page, we need to tell RequireJS where to look. For example: "js/vendor/jquery.js" --> "js/vendor/jquery.abcd1234" To achi...
Render JavaScript to override default RequireJS paths.
[ "Render", "JavaScript", "to", "override", "default", "RequireJS", "paths", "." ]
def render_require_js_path_overrides(path_overrides): """Render JavaScript to override default RequireJS paths. The Django pipeline appends a hash to JavaScript files, so if the JS asset isn't included in the bundle for the page, we need to tell RequireJS where to look. For example: "js/v...
[ "def", "render_require_js_path_overrides", "(", "path_overrides", ")", ":", "# Render the <script> tag that overrides the paths", "# Note: We don't use a Mako template to render this because Mako apparently", "# acquires a lock when loading templates, which can lead to a deadlock if", "# this func...
https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/common/djangoapps/pipeline_mako/__init__.py#L88-L145
IronLanguages/main
a949455434b1fda8c783289e897e78a9a0caabb5
Hosts/MerlinWeb/examples/Global.py
python
Application_Error
(app, e)
Code that runs when an unhandled error occurs
Code that runs when an unhandled error occurs
[ "Code", "that", "runs", "when", "an", "unhandled", "error", "occurs" ]
def Application_Error(app, e): ' Code that runs when an unhandled error occurs' pass
[ "def", "Application_Error", "(", "app", ",", "e", ")", ":", "pass" ]
https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/Hosts/MerlinWeb/examples/Global.py#L19-L21
travitch/whole-program-llvm
c66344231720b4a0780c5bed4219cb5314bbcad5
wllvm/compilers.py
python
ClangBuilder.getBitcodeGenerationFlags
(self)
return []
[]
def getBitcodeGenerationFlags(self): # iam: If the environment variable LLVM_BITCODE_GENERATION_FLAGS is set we will add them to the # bitcode generation step bitcodeFLAGS = os.getenv('LLVM_BITCODE_GENERATION_FLAGS') if bitcodeFLAGS: return bitcodeFLAGS.split() retur...
[ "def", "getBitcodeGenerationFlags", "(", "self", ")", ":", "# iam: If the environment variable LLVM_BITCODE_GENERATION_FLAGS is set we will add them to the", "# bitcode generation step", "bitcodeFLAGS", "=", "os", ".", "getenv", "(", "'LLVM_BITCODE_GENERATION_FLAGS'", ")", "if", "b...
https://github.com/travitch/whole-program-llvm/blob/c66344231720b4a0780c5bed4219cb5314bbcad5/wllvm/compilers.py#L205-L211
sqlalchemy/sqlalchemy
eb716884a4abcabae84a6aaba105568e925b7d27
lib/sqlalchemy/engine/events.py
python
DialectEvents.do_setinputsizes
( self, inputsizes, cursor, statement, parameters, context )
Receive the setinputsizes dictionary for possible modification. This event is emitted in the case where the dialect makes use of the DBAPI ``cursor.setinputsizes()`` method which passes information about parameter binding for a particular statement. The given ``inputsizes`` dictionary...
Receive the setinputsizes dictionary for possible modification.
[ "Receive", "the", "setinputsizes", "dictionary", "for", "possible", "modification", "." ]
def do_setinputsizes( self, inputsizes, cursor, statement, parameters, context ): """Receive the setinputsizes dictionary for possible modification. This event is emitted in the case where the dialect makes use of the DBAPI ``cursor.setinputsizes()`` method which passes information ...
[ "def", "do_setinputsizes", "(", "self", ",", "inputsizes", ",", "cursor", ",", "statement", ",", "parameters", ",", "context", ")", ":", "pass" ]
https://github.com/sqlalchemy/sqlalchemy/blob/eb716884a4abcabae84a6aaba105568e925b7d27/lib/sqlalchemy/engine/events.py#L773-L820
geopandas/geopandas
8e7133aef9e6c0d2465e07e92d954e95dedd3881
geopandas/base.py
python
GeoPandasBase.simplify
(self, *args, **kwargs)
return _delegate_geo_method("simplify", self, *args, **kwargs)
Returns a ``GeoSeries`` containing a simplified representation of each geometry. The algorithm (Douglas-Peucker) recursively splits the original line into smaller parts and connects these parts’ endpoints by a straight line. Then, it removes all points whose distance to the stra...
Returns a ``GeoSeries`` containing a simplified representation of each geometry.
[ "Returns", "a", "GeoSeries", "containing", "a", "simplified", "representation", "of", "each", "geometry", "." ]
def simplify(self, *args, **kwargs): """Returns a ``GeoSeries`` containing a simplified representation of each geometry. The algorithm (Douglas-Peucker) recursively splits the original line into smaller parts and connects these parts’ endpoints by a straight line. Then, it remov...
[ "def", "simplify", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_delegate_geo_method", "(", "\"simplify\"", ",", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/geopandas/geopandas/blob/8e7133aef9e6c0d2465e07e92d954e95dedd3881/geopandas/base.py#L2727-L2775
bendmorris/static-python
2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473
Lib/numbers.py
python
Complex.__radd__
(self, other)
other + self
other + self
[ "other", "+", "self" ]
def __radd__(self, other): """other + self""" raise NotImplementedError
[ "def", "__radd__", "(", "self", ",", "other", ")", ":", "raise", "NotImplementedError" ]
https://github.com/bendmorris/static-python/blob/2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473/Lib/numbers.py#L77-L79
caiiiac/Machine-Learning-with-Python
1a26c4467da41ca4ebc3d5bd789ea942ef79422f
MachineLearning/venv/lib/python3.5/site-packages/scipy/signal/filter_design.py
python
zpk2tf
(z, p, k)
return b, a
Return polynomial transfer function representation from zeros and poles Parameters ---------- z : array_like Zeros of the transfer function. p : array_like Poles of the transfer function. k : float System gain. Returns ------- b : ndarray Numerator polyn...
Return polynomial transfer function representation from zeros and poles
[ "Return", "polynomial", "transfer", "function", "representation", "from", "zeros", "and", "poles" ]
def zpk2tf(z, p, k): """ Return polynomial transfer function representation from zeros and poles Parameters ---------- z : array_like Zeros of the transfer function. p : array_like Poles of the transfer function. k : float System gain. Returns ------- b ...
[ "def", "zpk2tf", "(", "z", ",", "p", ",", "k", ")", ":", "z", "=", "atleast_1d", "(", "z", ")", "k", "=", "atleast_1d", "(", "k", ")", "if", "len", "(", "z", ".", "shape", ")", ">", "1", ":", "temp", "=", "poly", "(", "z", "[", "0", "]", ...
https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/scipy/signal/filter_design.py#L907-L963
ni/nidaqmx-python
62fc6b48cbbb330fe1bcc9aedadc86610a1269b6
nidaqmx/_task_modules/channels/ci_channel.py
python
CIChannel.ci_count_edges_count_dir_dig_fltr_timebase_rate
(self)
[]
def ci_count_edges_count_dir_dig_fltr_timebase_rate(self): cfunc = (lib_importer.windll. DAQmxResetCICountEdgesCountDirDigFltrTimebaseRate) if cfunc.argtypes is None: with cfunc.arglock: if cfunc.argtypes is None: cfunc.argtypes = [ ...
[ "def", "ci_count_edges_count_dir_dig_fltr_timebase_rate", "(", "self", ")", ":", "cfunc", "=", "(", "lib_importer", ".", "windll", ".", "DAQmxResetCICountEdgesCountDirDigFltrTimebaseRate", ")", "if", "cfunc", ".", "argtypes", "is", "None", ":", "with", "cfunc", ".", ...
https://github.com/ni/nidaqmx-python/blob/62fc6b48cbbb330fe1bcc9aedadc86610a1269b6/nidaqmx/_task_modules/channels/ci_channel.py#L396-L407
wwqgtxx/wwqLyParse
33136508e52821babd9294fdecffbdf02d73a6fc
wwqLyParse/lib/flask_lib/werkzeug/urls.py
python
BytesURL.encode_netloc
(self)
return self.netloc
Returns the netloc unchanged as bytes.
Returns the netloc unchanged as bytes.
[ "Returns", "the", "netloc", "unchanged", "as", "bytes", "." ]
def encode_netloc(self): """Returns the netloc unchanged as bytes.""" return self.netloc
[ "def", "encode_netloc", "(", "self", ")", ":", "return", "self", ".", "netloc" ]
https://github.com/wwqgtxx/wwqLyParse/blob/33136508e52821babd9294fdecffbdf02d73a6fc/wwqLyParse/lib/flask_lib/werkzeug/urls.py#L344-L346
triaquae/triaquae
bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9
TriAquae/models/Centos_5.9/paramiko/sftp_client.py
python
SFTPClient.stat
(self, path)
return SFTPAttributes._from_msg(msg)
Retrieve information about a file on the remote system. The return value is an object whose attributes correspond to the attributes of python's C{stat} structure as returned by C{os.stat}, except that it contains fewer fields. An SFTP server may return as much or as little info as it w...
Retrieve information about a file on the remote system. The return value is an object whose attributes correspond to the attributes of python's C{stat} structure as returned by C{os.stat}, except that it contains fewer fields. An SFTP server may return as much or as little info as it w...
[ "Retrieve", "information", "about", "a", "file", "on", "the", "remote", "system", ".", "The", "return", "value", "is", "an", "object", "whose", "attributes", "correspond", "to", "the", "attributes", "of", "python", "s", "C", "{", "stat", "}", "structure", ...
def stat(self, path): """ Retrieve information about a file on the remote system. The return value is an object whose attributes correspond to the attributes of python's C{stat} structure as returned by C{os.stat}, except that it contains fewer fields. An SFTP server may return...
[ "def", "stat", "(", "self", ",", "path", ")", ":", "path", "=", "self", ".", "_adjust_cwd", "(", "path", ")", "self", ".", "_log", "(", "DEBUG", ",", "'stat(%r)'", "%", "path", ")", "t", ",", "msg", "=", "self", ".", "_request", "(", "CMD_STAT", ...
https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/Centos_5.9/paramiko/sftp_client.py#L316-L340
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/Python-2.7.9/Demo/curses/life.py
python
main
(stdscr)
[]
def main(stdscr): keyloop(stdscr)
[ "def", "main", "(", "stdscr", ")", ":", "keyloop", "(", "stdscr", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Demo/curses/life.py#L211-L212
mautrix/telegram
9f48eca5a6654bc38012cb761ecaaaf416aabdd0
mautrix_telegram/portal.py
python
Portal._photo_size_key
(photo: TypePhotoSize)
[]
def _photo_size_key(photo: TypePhotoSize) -> int: if isinstance(photo, PhotoSize): return photo.size elif isinstance(photo, PhotoSizeProgressive): return max(photo.sizes) elif isinstance(photo, PhotoSizeEmpty): return 0 else: return len(pho...
[ "def", "_photo_size_key", "(", "photo", ":", "TypePhotoSize", ")", "->", "int", ":", "if", "isinstance", "(", "photo", ",", "PhotoSize", ")", ":", "return", "photo", ".", "size", "elif", "isinstance", "(", "photo", ",", "PhotoSizeProgressive", ")", ":", "r...
https://github.com/mautrix/telegram/blob/9f48eca5a6654bc38012cb761ecaaaf416aabdd0/mautrix_telegram/portal.py#L3125-L3133
giampaolo/psutil
55161bd4850986359a029f1c9a81bcf66f37afa8
psutil/_common.py
python
memoize
(fun)
return wrapper
A simple memoize decorator for functions supporting (hashable) positional arguments. It also provides a cache_clear() function for clearing the cache: >>> @memoize ... def foo() ... return 1 ... >>> foo() 1 >>> foo.cache_clear() >>>
A simple memoize decorator for functions supporting (hashable) positional arguments. It also provides a cache_clear() function for clearing the cache:
[ "A", "simple", "memoize", "decorator", "for", "functions", "supporting", "(", "hashable", ")", "positional", "arguments", ".", "It", "also", "provides", "a", "cache_clear", "()", "function", "for", "clearing", "the", "cache", ":" ]
def memoize(fun): """A simple memoize decorator for functions supporting (hashable) positional arguments. It also provides a cache_clear() function for clearing the cache: >>> @memoize ... def foo() ... return 1 ... >>> foo() 1 >>> foo.cache_clear() >>> """ @...
[ "def", "memoize", "(", "fun", ")", ":", "@", "functools", ".", "wraps", "(", "fun", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "key", "=", "(", "args", ",", "frozenset", "(", "sorted", "(", "kwargs", ".", "items",...
https://github.com/giampaolo/psutil/blob/55161bd4850986359a029f1c9a81bcf66f37afa8/psutil/_common.py#L383-L412
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_openshift/library/oc_edit.py
python
Utils._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. ''' with open(filename, 'w') as sfd: sfd.write(str(contents))
[ "def", "_write", "(", "filename", ",", "contents", ")", ":", "with", "open", "(", "filename", ",", "'w'", ")", "as", "sfd", ":", "sfd", ".", "write", "(", "str", "(", "contents", ")", ")" ]
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_openshift/library/oc_edit.py#L1213-L1217