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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ansible-collections/community.general | 3faffe8f47968a2400ba3c896c8901c03001a194 | plugins/modules/system/osx_defaults.py | python | OSXDefaults._convert_type | (data_type, value) | Converts value to given type | Converts value to given type | [
"Converts",
"value",
"to",
"given",
"type"
] | def _convert_type(data_type, value):
""" Converts value to given type """
if data_type == "string":
return str(value)
elif data_type in ["bool", "boolean"]:
if isinstance(value, (binary_type, text_type)):
value = value.lower()
if value in [True... | [
"def",
"_convert_type",
"(",
"data_type",
",",
"value",
")",
":",
"if",
"data_type",
"==",
"\"string\"",
":",
"return",
"str",
"(",
"value",
")",
"elif",
"data_type",
"in",
"[",
"\"bool\"",
",",
"\"boolean\"",
"]",
":",
"if",
"isinstance",
"(",
"value",
... | https://github.com/ansible-collections/community.general/blob/3faffe8f47968a2400ba3c896c8901c03001a194/plugins/modules/system/osx_defaults.py#L181-L215 | ||
aerkalov/ebooklib | c8cb21f31c2769b1ce1052e18df49852f96de1b9 | ebooklib/epub.py | python | EpubNav.is_chapter | (self) | return False | Returns if this document is chapter or not.
:Returns:
Returns book value. | Returns if this document is chapter or not. | [
"Returns",
"if",
"this",
"document",
"is",
"chapter",
"or",
"not",
"."
] | def is_chapter(self):
"""
Returns if this document is chapter or not.
:Returns:
Returns book value.
"""
return False | [
"def",
"is_chapter",
"(",
"self",
")",
":",
"return",
"False"
] | https://github.com/aerkalov/ebooklib/blob/c8cb21f31c2769b1ce1052e18df49852f96de1b9/ebooklib/epub.py#L501-L509 | |
baidu/Senta | e5294c00a6ffc4b1284f38000f0fbf24d6554c22 | senta/models/model.py | python | Model.parse_predict_result | (self, predict_result) | parse_predict_result | parse_predict_result | [
"parse_predict_result"
] | def parse_predict_result(self, predict_result):
"""
parse_predict_result
"""
raise NotImplementedError | [
"def",
"parse_predict_result",
"(",
"self",
",",
"predict_result",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/baidu/Senta/blob/e5294c00a6ffc4b1284f38000f0fbf24d6554c22/senta/models/model.py#L39-L43 | ||
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/lib-python/3/plat-freebsd7/IN.py | python | IN6_IS_ADDR_LINKLOCAL | (a) | return | [] | def IN6_IS_ADDR_LINKLOCAL(a): return | [
"def",
"IN6_IS_ADDR_LINKLOCAL",
"(",
"a",
")",
":",
"return"
] | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/plat-freebsd7/IN.py#L433-L433 | |||
nortikin/sverchok | 7b460f01317c15f2681bfa3e337c5e7346f3711b | utils/surface/data.py | python | SurfaceCurvatureCalculator.calc | (self, need_values=True, need_directions=True, need_uv_directions = False, need_gauss=True, need_mean=True, need_matrix = True) | return data | Calculate curvature information.
Return value: SurfaceCurvatureData instance. | Calculate curvature information.
Return value: SurfaceCurvatureData instance. | [
"Calculate",
"curvature",
"information",
".",
"Return",
"value",
":",
"SurfaceCurvatureData",
"instance",
"."
] | def calc(self, need_values=True, need_directions=True, need_uv_directions = False, need_gauss=True, need_mean=True, need_matrix = True):
"""
Calculate curvature information.
Return value: SurfaceCurvatureData instance.
"""
# We try to do as less calculations as possible,
... | [
"def",
"calc",
"(",
"self",
",",
"need_values",
"=",
"True",
",",
"need_directions",
"=",
"True",
",",
"need_uv_directions",
"=",
"False",
",",
"need_gauss",
"=",
"True",
",",
"need_mean",
"=",
"True",
",",
"need_matrix",
"=",
"True",
")",
":",
"# We try t... | https://github.com/nortikin/sverchok/blob/7b460f01317c15f2681bfa3e337c5e7346f3711b/utils/surface/data.py#L239-L283 | |
ricklupton/floweaver | 1b2c66a3c41f77b7f165176d516ff6507bb1b34f | floweaver/color_scales.py | python | rgb2hex | (rgb) | Given an rgb or rgba sequence of 0-1 floats, return the hex string | Given an rgb or rgba sequence of 0-1 floats, return the hex string | [
"Given",
"an",
"rgb",
"or",
"rgba",
"sequence",
"of",
"0",
"-",
"1",
"floats",
"return",
"the",
"hex",
"string"
] | def rgb2hex(rgb):
'Given an rgb or rgba sequence of 0-1 floats, return the hex string'
if isinstance(rgb, str):
return rgb
else:
return '#%02x%02x%02x' % tuple([int(np.round(val * 255)) for val in rgb[:3]]) | [
"def",
"rgb2hex",
"(",
"rgb",
")",
":",
"if",
"isinstance",
"(",
"rgb",
",",
"str",
")",
":",
"return",
"rgb",
"else",
":",
"return",
"'#%02x%02x%02x'",
"%",
"tuple",
"(",
"[",
"int",
"(",
"np",
".",
"round",
"(",
"val",
"*",
"255",
")",
")",
"fo... | https://github.com/ricklupton/floweaver/blob/1b2c66a3c41f77b7f165176d516ff6507bb1b34f/floweaver/color_scales.py#L11-L16 | ||
spectacles/CodeComplice | 8ca8ee4236f72b58caa4209d2fbd5fa56bd31d62 | libs/codeintel2/indexer.py | python | ScanRequest.__init__ | (self, buf, priority, force=False, mtime=None, on_complete=None) | [] | def __init__(self, buf, priority, force=False, mtime=None, on_complete=None):
if _xpcom_:
buf = UnwrapObject(buf)
self.buf = buf
self.id = buf.path
self.priority = priority
self.force = force
if mtime is None:
self.mtime = time.time()
else:... | [
"def",
"__init__",
"(",
"self",
",",
"buf",
",",
"priority",
",",
"force",
"=",
"False",
",",
"mtime",
"=",
"None",
",",
"on_complete",
"=",
"None",
")",
":",
"if",
"_xpcom_",
":",
"buf",
"=",
"UnwrapObject",
"(",
"buf",
")",
"self",
".",
"buf",
"=... | https://github.com/spectacles/CodeComplice/blob/8ca8ee4236f72b58caa4209d2fbd5fa56bd31d62/libs/codeintel2/indexer.py#L328-L340 | ||||
BigBrotherBot/big-brother-bot | 848823c71413c86e7f1ff9584f43e08d40a7f2c0 | b3/plugins/poweradminbf3/__init__.py | python | Poweradminbf3Plugin.onGameRoundPlayerScores | (self, event) | Handle EVT_GAME_ROUND_PLAYER_SCORES | Handle EVT_GAME_ROUND_PLAYER_SCORES | [
"Handle",
"EVT_GAME_ROUND_PLAYER_SCORES"
] | def onGameRoundPlayerScores(self, event):
"""
Handle EVT_GAME_ROUND_PLAYER_SCORES
"""
self._scrambler.onRoundOverTeamScores(event.data) | [
"def",
"onGameRoundPlayerScores",
"(",
"self",
",",
"event",
")",
":",
"self",
".",
"_scrambler",
".",
"onRoundOverTeamScores",
"(",
"event",
".",
"data",
")"
] | https://github.com/BigBrotherBot/big-brother-bot/blob/848823c71413c86e7f1ff9584f43e08d40a7f2c0/b3/plugins/poweradminbf3/__init__.py#L432-L436 | ||
ambujraj/hacktoberfest2018 | 53df2cac8b3404261131a873352ec4f2ffa3544d | MAC_changer/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/requests/utils.py | python | set_environ | (env_name, value) | Set the environment variable 'env_name' to 'value'
Save previous value, yield, and then restore the previous value stored in
the environment variable 'env_name'.
If 'value' is None, do nothing | Set the environment variable 'env_name' to 'value' | [
"Set",
"the",
"environment",
"variable",
"env_name",
"to",
"value"
] | def set_environ(env_name, value):
"""Set the environment variable 'env_name' to 'value'
Save previous value, yield, and then restore the previous value stored in
the environment variable 'env_name'.
If 'value' is None, do nothing"""
value_changed = value is not None
if value_changed:
o... | [
"def",
"set_environ",
"(",
"env_name",
",",
"value",
")",
":",
"value_changed",
"=",
"value",
"is",
"not",
"None",
"if",
"value_changed",
":",
"old_value",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"env_name",
")",
"os",
".",
"environ",
"[",
"env_name"... | https://github.com/ambujraj/hacktoberfest2018/blob/53df2cac8b3404261131a873352ec4f2ffa3544d/MAC_changer/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/requests/utils.py#L608-L626 | ||
nanoporetech/medaka | 2b83074fe3b6a6ec971614bfc6804f543fe1e5f0 | medaka/__init__.py | python | report_binaries | () | Print a report of versions of required programs.
The program will exit with status 1 if a bad version is found. | Print a report of versions of required programs. | [
"Print",
"a",
"report",
"of",
"versions",
"of",
"required",
"programs",
"."
] | def report_binaries():
"""Print a report of versions of required programs.
The program will exit with status 1 if a bad version is found.
"""
versions = {prog: get_version[prog]() for prog in required_version.keys()}
width = 9
cols = "Program Version Required Pass".split()
print(' '.join... | [
"def",
"report_binaries",
"(",
")",
":",
"versions",
"=",
"{",
"prog",
":",
"get_version",
"[",
"prog",
"]",
"(",
")",
"for",
"prog",
"in",
"required_version",
".",
"keys",
"(",
")",
"}",
"width",
"=",
"9",
"cols",
"=",
"\"Program Version Required Pass\"",... | https://github.com/nanoporetech/medaka/blob/2b83074fe3b6a6ec971614bfc6804f543fe1e5f0/medaka/__init__.py#L75-L98 | ||
riverloopsec/tumblerf | ad79f9dbbfee0612433be3d71c859d6918395f10 | tumblerf/interfaces/base.py | python | BaseInterface.process_cli | (self, parser, argv) | Parses available options at the command line and uses them to update internal options.
:param parser: argparse.ArgumentParser object
:param argv: Array of command line options | Parses available options at the command line and uses them to update internal options.
:param parser: argparse.ArgumentParser object
:param argv: Array of command line options | [
"Parses",
"available",
"options",
"at",
"the",
"command",
"line",
"and",
"uses",
"them",
"to",
"update",
"internal",
"options",
".",
":",
"param",
"parser",
":",
"argparse",
".",
"ArgumentParser",
"object",
":",
"param",
"argv",
":",
"Array",
"of",
"command"... | def process_cli(self, parser, argv):
"""
Parses available options at the command line and uses them to update internal options.
:param parser: argparse.ArgumentParser object
:param argv: Array of command line options
""" | [
"def",
"process_cli",
"(",
"self",
",",
"parser",
",",
"argv",
")",
":"
] | https://github.com/riverloopsec/tumblerf/blob/ad79f9dbbfee0612433be3d71c859d6918395f10/tumblerf/interfaces/base.py#L49-L54 | ||
aaronportnoy/toolbag | 2d39457a7617b2f334d203d8c8cf88a5a25ef1fa | toolbag/agent/dbg/cobra/__init__.py | python | CobraDaemon.shareObject | (self, obj, name=None, doref=False) | return name | Share an object in this cobra server. By specifying
doref=True you will let CobraProxy objects decide that
the object is done and should be un-shared. Also, if
name == None a random name is chosen.
Returns: name (or the newly generated random one) | Share an object in this cobra server. By specifying
doref=True you will let CobraProxy objects decide that
the object is done and should be un-shared. Also, if
name == None a random name is chosen. | [
"Share",
"an",
"object",
"in",
"this",
"cobra",
"server",
".",
"By",
"specifying",
"doref",
"=",
"True",
"you",
"will",
"let",
"CobraProxy",
"objects",
"decide",
"that",
"the",
"object",
"is",
"done",
"and",
"should",
"be",
"un",
"-",
"shared",
".",
"Als... | def shareObject(self, obj, name=None, doref=False):
"""
Share an object in this cobra server. By specifying
doref=True you will let CobraProxy objects decide that
the object is done and should be un-shared. Also, if
name == None a random name is chosen.
Returns: name (... | [
"def",
"shareObject",
"(",
"self",
",",
"obj",
",",
"name",
"=",
"None",
",",
"doref",
"=",
"False",
")",
":",
"refcnt",
"=",
"None",
"if",
"doref",
":",
"refcnt",
"=",
"0",
"if",
"name",
"==",
"None",
":",
"name",
"=",
"self",
".",
"getRandomName"... | https://github.com/aaronportnoy/toolbag/blob/2d39457a7617b2f334d203d8c8cf88a5a25ef1fa/toolbag/agent/dbg/cobra/__init__.py#L400-L417 | |
openhatch/oh-mainline | ce29352a034e1223141dcc2f317030bbc3359a51 | vendor/packages/python-social-auth/social/backends/salesforce.py | python | SalesforceOAuth2.get_user_details | (self, response) | return {
'username': response.get('username'),
'email': response.get('email') or '',
'first_name': response.get('first_name'),
'last_name': response.get('last_name'),
'fullname': response.get('display_name')
} | Return user details from a Salesforce account | Return user details from a Salesforce account | [
"Return",
"user",
"details",
"from",
"a",
"Salesforce",
"account"
] | def get_user_details(self, response):
"""Return user details from a Salesforce account"""
return {
'username': response.get('username'),
'email': response.get('email') or '',
'first_name': response.get('first_name'),
'last_name': response.get('last_name'),... | [
"def",
"get_user_details",
"(",
"self",
",",
"response",
")",
":",
"return",
"{",
"'username'",
":",
"response",
".",
"get",
"(",
"'username'",
")",
",",
"'email'",
":",
"response",
".",
"get",
"(",
"'email'",
")",
"or",
"''",
",",
"'first_name'",
":",
... | https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/python-social-auth/social/backends/salesforce.py#L23-L31 | |
arskom/spyne | 88b8e278335f03c7e615b913d6dabc2b8141730e | spyne/util/fileproxy.py | python | SeekableFileProxy.tell | (self) | return self.wrapped.tell() | Gets the file's current position.
:returns: the file's current position
:rtype: :class:`numbers.Integral` | Gets the file's current position. | [
"Gets",
"the",
"file",
"s",
"current",
"position",
"."
] | def tell(self):
"""Gets the file's current position.
:returns: the file's current position
:rtype: :class:`numbers.Integral`
"""
return self.wrapped.tell() | [
"def",
"tell",
"(",
"self",
")",
":",
"return",
"self",
".",
"wrapped",
".",
"tell",
"(",
")"
] | https://github.com/arskom/spyne/blob/88b8e278335f03c7e615b913d6dabc2b8141730e/spyne/util/fileproxy.py#L169-L175 | |
cisco/mindmeld | 809c36112e9ea8019fe29d54d136ca14eb4fd8db | mindmeld/models/taggers/taggers.py | python | _all_O | (entity) | return True | Returns true if all of the tokens we are considering as an entity contain O tags | Returns true if all of the tokens we are considering as an entity contain O tags | [
"Returns",
"true",
"if",
"all",
"of",
"the",
"tokens",
"we",
"are",
"considering",
"as",
"an",
"entity",
"contain",
"O",
"tags"
] | def _all_O(entity):
"""Returns true if all of the tokens we are considering as an entity contain O tags"""
for token in entity:
if token[0] != O_TAG:
return False
return True | [
"def",
"_all_O",
"(",
"entity",
")",
":",
"for",
"token",
"in",
"entity",
":",
"if",
"token",
"[",
"0",
"]",
"!=",
"O_TAG",
":",
"return",
"False",
"return",
"True"
] | https://github.com/cisco/mindmeld/blob/809c36112e9ea8019fe29d54d136ca14eb4fd8db/mindmeld/models/taggers/taggers.py#L470-L475 | |
redhat-imaging/imagefactory | 176f6e045e1df049d50f33a924653128d5ab8b27 | imgfac/rest/bottle.py | python | BaseResponse.status_line | (self) | return self._status_line | The HTTP status line as a string (e.g. ``404 Not Found``). | The HTTP status line as a string (e.g. ``404 Not Found``). | [
"The",
"HTTP",
"status",
"line",
"as",
"a",
"string",
"(",
"e",
".",
"g",
".",
"404",
"Not",
"Found",
")",
"."
] | def status_line(self):
''' The HTTP status line as a string (e.g. ``404 Not Found``).'''
return self._status_line | [
"def",
"status_line",
"(",
"self",
")",
":",
"return",
"self",
".",
"_status_line"
] | https://github.com/redhat-imaging/imagefactory/blob/176f6e045e1df049d50f33a924653128d5ab8b27/imgfac/rest/bottle.py#L1494-L1496 | |
inspurer/WorkAttendanceSystem | 1221e2d67bdf5bb15fe99517cc3ded58ccb066df | V2.0/venv/Lib/site-packages/pip-9.0.1-py3.5.egg/pip/_vendor/distlib/locators.py | python | SimpleScrapingLocator._wait_threads | (self) | Tell all the threads to terminate (by sending a sentinel value) and
wait for them to do so. | Tell all the threads to terminate (by sending a sentinel value) and
wait for them to do so. | [
"Tell",
"all",
"the",
"threads",
"to",
"terminate",
"(",
"by",
"sending",
"a",
"sentinel",
"value",
")",
"and",
"wait",
"for",
"them",
"to",
"do",
"so",
"."
] | def _wait_threads(self):
"""
Tell all the threads to terminate (by sending a sentinel value) and
wait for them to do so.
"""
# Note that you need two loops, since you can't say which
# thread will get each sentinel
for t in self._threads:
self._to_fetc... | [
"def",
"_wait_threads",
"(",
"self",
")",
":",
"# Note that you need two loops, since you can't say which",
"# thread will get each sentinel",
"for",
"t",
"in",
"self",
".",
"_threads",
":",
"self",
".",
"_to_fetch",
".",
"put",
"(",
"None",
")",
"# sentinel",
"for",
... | https://github.com/inspurer/WorkAttendanceSystem/blob/1221e2d67bdf5bb15fe99517cc3ded58ccb066df/V2.0/venv/Lib/site-packages/pip-9.0.1-py3.5.egg/pip/_vendor/distlib/locators.py#L624-L635 | ||
ethereum/trinity | 6383280c5044feb06695ac2f7bc1100b7bcf4fe0 | trinity/sync/header/chain.py | python | SequentialHeaderChainGapSyncer.__init__ | (self,
chain: AsyncChainAPI,
db: BaseAsyncChainDB,
peer_pool: ETHPeerPool) | [] | def __init__(self,
chain: AsyncChainAPI,
db: BaseAsyncChainDB,
peer_pool: ETHPeerPool) -> None:
self.logger = get_logger('trinity.sync.header.chain.SequentialHeaderChainGapSyncer')
self._chain = chain
self._db = db
self._peer_pool = pee... | [
"def",
"__init__",
"(",
"self",
",",
"chain",
":",
"AsyncChainAPI",
",",
"db",
":",
"BaseAsyncChainDB",
",",
"peer_pool",
":",
"ETHPeerPool",
")",
"->",
"None",
":",
"self",
".",
"logger",
"=",
"get_logger",
"(",
"'trinity.sync.header.chain.SequentialHeaderChainGa... | https://github.com/ethereum/trinity/blob/6383280c5044feb06695ac2f7bc1100b7bcf4fe0/trinity/sync/header/chain.py#L174-L184 | ||||
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/apps/analytics/utils.py | python | get_meta | (request) | return {
'HTTP_X_FORWARDED_FOR': request.META.get('HTTP_X_FORWARDED_FOR'),
'REMOTE_ADDR': request.META.get('REMOTE_ADDR'),
} | [] | def get_meta(request):
return {
'HTTP_X_FORWARDED_FOR': request.META.get('HTTP_X_FORWARDED_FOR'),
'REMOTE_ADDR': request.META.get('REMOTE_ADDR'),
} | [
"def",
"get_meta",
"(",
"request",
")",
":",
"return",
"{",
"'HTTP_X_FORWARDED_FOR'",
":",
"request",
".",
"META",
".",
"get",
"(",
"'HTTP_X_FORWARDED_FOR'",
")",
",",
"'REMOTE_ADDR'",
":",
"request",
".",
"META",
".",
"get",
"(",
"'REMOTE_ADDR'",
")",
",",
... | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/analytics/utils.py#L32-L36 | |||
scipy/scipy | e0a749f01e79046642ccfdc419edbf9e7ca141ad | scipy/optimize/_hessian_update_strategy.py | python | FullHessianUpdateStrategy.dot | (self, p) | Compute the product of the internal matrix with the given vector.
Parameters
----------
p : array_like
1-D array representing a vector.
Returns
-------
Hp : array
1-D represents the result of multiplying the approximation matrix
by ve... | Compute the product of the internal matrix with the given vector. | [
"Compute",
"the",
"product",
"of",
"the",
"internal",
"matrix",
"with",
"the",
"given",
"vector",
"."
] | def dot(self, p):
"""Compute the product of the internal matrix with the given vector.
Parameters
----------
p : array_like
1-D array representing a vector.
Returns
-------
Hp : array
1-D represents the result of multiplying the approxima... | [
"def",
"dot",
"(",
"self",
",",
"p",
")",
":",
"if",
"self",
".",
"approx_type",
"==",
"'hess'",
":",
"return",
"self",
".",
"_symv",
"(",
"1",
",",
"self",
".",
"B",
",",
"p",
")",
"else",
":",
"return",
"self",
".",
"_symv",
"(",
"1",
",",
... | https://github.com/scipy/scipy/blob/e0a749f01e79046642ccfdc419edbf9e7ca141ad/scipy/optimize/_hessian_update_strategy.py#L202-L219 | ||
mozillazg/pypy | 2ff5cd960c075c991389f842c6d59e71cf0cb7d0 | pypy/interpreter/baseobjspace.py | python | ObjSpace.is_none | (self, w_obj) | return w_obj is None or self.is_w(w_obj, self.w_None) | mostly for checking inputargs that have unwrap_spec and
can accept both w_None and None | mostly for checking inputargs that have unwrap_spec and
can accept both w_None and None | [
"mostly",
"for",
"checking",
"inputargs",
"that",
"have",
"unwrap_spec",
"and",
"can",
"accept",
"both",
"w_None",
"and",
"None"
] | def is_none(self, w_obj):
""" mostly for checking inputargs that have unwrap_spec and
can accept both w_None and None
"""
return w_obj is None or self.is_w(w_obj, self.w_None) | [
"def",
"is_none",
"(",
"self",
",",
"w_obj",
")",
":",
"return",
"w_obj",
"is",
"None",
"or",
"self",
".",
"is_w",
"(",
"w_obj",
",",
"self",
".",
"w_None",
")"
] | https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/pypy/interpreter/baseobjspace.py#L811-L815 | |
boto/boto3 | 235a19b65af5c752eac47df6d90e327d31f26c73 | boto3/session.py | python | Session.get_available_partitions | (self) | return self._session.get_available_partitions() | Lists the available partitions
:rtype: list
:return: Returns a list of partition names (e.g., ["aws", "aws-cn"]) | Lists the available partitions | [
"Lists",
"the",
"available",
"partitions"
] | def get_available_partitions(self):
"""Lists the available partitions
:rtype: list
:return: Returns a list of partition names (e.g., ["aws", "aws-cn"])
"""
return self._session.get_available_partitions() | [
"def",
"get_available_partitions",
"(",
"self",
")",
":",
"return",
"self",
".",
"_session",
".",
"get_available_partitions",
"(",
")"
] | https://github.com/boto/boto3/blob/235a19b65af5c752eac47df6d90e327d31f26c73/boto3/session.py#L144-L150 | |
fossasia/knitlib | 9fdd79e12d28249dcc679c3abe2f781d464c8da8 | src/knitlib/communication.py | python | Communication.__init__ | (self, serial=None) | Creates an Communication object, with an optional serial-like object. | Creates an Communication object, with an optional serial-like object. | [
"Creates",
"an",
"Communication",
"object",
"with",
"an",
"optional",
"serial",
"-",
"like",
"object",
"."
] | def __init__(self, serial=None):
"""Creates an Communication object, with an optional serial-like object."""
logging.basicConfig(level=logging.DEBUG)
self.__logger = logging.getLogger(__name__)
self.__ser = serial | [
"def",
"__init__",
"(",
"self",
",",
"serial",
"=",
"None",
")",
":",
"logging",
".",
"basicConfig",
"(",
"level",
"=",
"logging",
".",
"DEBUG",
")",
"self",
".",
"__logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"self",
".",
"__ser",... | https://github.com/fossasia/knitlib/blob/9fdd79e12d28249dcc679c3abe2f781d464c8da8/src/knitlib/communication.py#L27-L31 | ||
1012598167/flask_mongodb_game | 60c7e0351586656ec38f851592886338e50b4110 | python_flask/venv/Lib/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/requests/utils.py | python | dict_from_cookiejar | (cj) | return cookie_dict | Returns a key/value dictionary from a CookieJar.
:param cj: CookieJar object to extract cookies from.
:rtype: dict | Returns a key/value dictionary from a CookieJar. | [
"Returns",
"a",
"key",
"/",
"value",
"dictionary",
"from",
"a",
"CookieJar",
"."
] | def dict_from_cookiejar(cj):
"""Returns a key/value dictionary from a CookieJar.
:param cj: CookieJar object to extract cookies from.
:rtype: dict
"""
cookie_dict = {}
for cookie in cj:
cookie_dict[cookie.name] = cookie.value
return cookie_dict | [
"def",
"dict_from_cookiejar",
"(",
"cj",
")",
":",
"cookie_dict",
"=",
"{",
"}",
"for",
"cookie",
"in",
"cj",
":",
"cookie_dict",
"[",
"cookie",
".",
"name",
"]",
"=",
"cookie",
".",
"value",
"return",
"cookie_dict"
] | https://github.com/1012598167/flask_mongodb_game/blob/60c7e0351586656ec38f851592886338e50b4110/python_flask/venv/Lib/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/requests/utils.py#L404-L416 | |
dexy/dexy | 323c1806e51f75435e11d2265703e68f46c8aef3 | dexy/commands/info.py | python | info_command | (
__cli_options=False,
expr="", # An expression partially matching document name.
key="", # The exact document key.
ws=False, # Whether to print website reporter keys and values.
**kwargs
) | Prints metadata about a dexy document.
Dexy must have already run successfully.
You can specify an exact document key or an expression which matches part
of a document name/key. The `dexy grep` command is available to help you
search for documents and print document contents. | Prints metadata about a dexy document. | [
"Prints",
"metadata",
"about",
"a",
"dexy",
"document",
"."
] | def info_command(
__cli_options=False,
expr="", # An expression partially matching document name.
key="", # The exact document key.
ws=False, # Whether to print website reporter keys and values.
**kwargs
):
"""
Prints metadata about a dexy document.
Dexy must... | [
"def",
"info_command",
"(",
"__cli_options",
"=",
"False",
",",
"expr",
"=",
"\"\"",
",",
"# An expression partially matching document name.",
"key",
"=",
"\"\"",
",",
"# The exact document key.",
"ws",
"=",
"False",
",",
"# Whether to print website reporter keys and values... | https://github.com/dexy/dexy/blob/323c1806e51f75435e11d2265703e68f46c8aef3/dexy/commands/info.py#L79-L159 | ||
Pyomo/pyomo | dbd4faee151084f343b893cc2b0c04cf2b76fd92 | pyomo/contrib/mindtpy/single_tree.py | python | LazyOACallback_gurobi | (cb_m, cb_opt, cb_where, solve_data, config) | This is a GUROBI callback function defined for LP/NLP based B&B algorithm.
Parameters
----------
cb_m : Pyomo model
The MIP main problem.
cb_opt : SolverFactory
The gurobi_persistent solver.
cb_where : int
An enum member of gurobipy.GRB.Callback.
solve_data : MindtPySolv... | This is a GUROBI callback function defined for LP/NLP based B&B algorithm. | [
"This",
"is",
"a",
"GUROBI",
"callback",
"function",
"defined",
"for",
"LP",
"/",
"NLP",
"based",
"B&B",
"algorithm",
"."
] | def LazyOACallback_gurobi(cb_m, cb_opt, cb_where, solve_data, config):
"""This is a GUROBI callback function defined for LP/NLP based B&B algorithm.
Parameters
----------
cb_m : Pyomo model
The MIP main problem.
cb_opt : SolverFactory
The gurobi_persistent solver.
cb_where : int... | [
"def",
"LazyOACallback_gurobi",
"(",
"cb_m",
",",
"cb_opt",
",",
"cb_where",
",",
"solve_data",
",",
"config",
")",
":",
"if",
"cb_where",
"==",
"gurobipy",
".",
"GRB",
".",
"Callback",
".",
"MIPSOL",
":",
"# gurobipy.GRB.Callback.MIPSOL means that an integer soluti... | https://github.com/Pyomo/pyomo/blob/dbd4faee151084f343b893cc2b0c04cf2b76fd92/pyomo/contrib/mindtpy/single_tree.py#L664-L741 | ||
tensorflow/model-optimization | b278157b17d073686de3ae67ffd6e820ae862c45 | tensorflow_model_optimization/python/core/sparsity/keras/pruning_impl.py | python | Pruning.__init__ | (self,
training_step_fn,
pruning_vars,
pruning_schedule,
block_size,
block_pooling_type,
sparsity_m_by_n=None) | The logic for magnitude-based pruning weight tensors.
Args:
training_step_fn: A callable that returns the training step.
pruning_vars: A list of (weight, mask, threshold) tuples
pruning_schedule: A `PruningSchedule` object that controls pruning rate
throughout training.
block_size: ... | The logic for magnitude-based pruning weight tensors. | [
"The",
"logic",
"for",
"magnitude",
"-",
"based",
"pruning",
"weight",
"tensors",
"."
] | def __init__(self,
training_step_fn,
pruning_vars,
pruning_schedule,
block_size,
block_pooling_type,
sparsity_m_by_n=None):
"""The logic for magnitude-based pruning weight tensors.
Args:
training_step_fn: A callable... | [
"def",
"__init__",
"(",
"self",
",",
"training_step_fn",
",",
"pruning_vars",
",",
"pruning_schedule",
",",
"block_size",
",",
"block_pooling_type",
",",
"sparsity_m_by_n",
"=",
"None",
")",
":",
"self",
".",
"_pruning_vars",
"=",
"pruning_vars",
"self",
".",
"_... | https://github.com/tensorflow/model-optimization/blob/b278157b17d073686de3ae67ffd6e820ae862c45/tensorflow_model_optimization/python/core/sparsity/keras/pruning_impl.py#L30-L62 | ||
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter8-Regression/venv/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/ipaddress.py | python | IPv6Address.sixtofour | (self) | return IPv4Address((self._ip >> 80) & 0xFFFFFFFF) | Return the IPv4 6to4 embedded address.
Returns:
The IPv4 6to4-embedded address if present or None if the
address doesn't appear to contain a 6to4 embedded address. | Return the IPv4 6to4 embedded address. | [
"Return",
"the",
"IPv4",
"6to4",
"embedded",
"address",
"."
] | def sixtofour(self):
"""Return the IPv4 6to4 embedded address.
Returns:
The IPv4 6to4-embedded address if present or None if the
address doesn't appear to contain a 6to4 embedded address.
"""
if (self._ip >> 112) != 0x2002:
return None
return... | [
"def",
"sixtofour",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"_ip",
">>",
"112",
")",
"!=",
"0x2002",
":",
"return",
"None",
"return",
"IPv4Address",
"(",
"(",
"self",
".",
"_ip",
">>",
"80",
")",
"&",
"0xFFFFFFFF",
")"
] | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter8-Regression/venv/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/ipaddress.py#L2170-L2180 | |
FederatedAI/FATE | 32540492623568ecd1afcb367360133616e02fa3 | python/federatedml/cipher_compressor/compressor.py | python | NormalCipherPackage.has_space | (self) | return self._has_space | [] | def has_space(self):
return self._has_space | [
"def",
"has_space",
"(",
"self",
")",
":",
"return",
"self",
".",
"_has_space"
] | https://github.com/FederatedAI/FATE/blob/32540492623568ecd1afcb367360133616e02fa3/python/federatedml/cipher_compressor/compressor.py#L164-L165 | |||
caiiiac/Machine-Learning-with-Python | 1a26c4467da41ca4ebc3d5bd789ea942ef79422f | MachineLearning/venv/lib/python3.5/site-packages/sklearn/linear_model/logistic.py | python | _logistic_grad_hess | (w, X, y, alpha, sample_weight=None) | return grad, Hs | Computes the gradient and the Hessian, in the case of a logistic loss.
Parameters
----------
w : ndarray, shape (n_features,) or (n_features + 1,)
Coefficient vector.
X : {array-like, sparse matrix}, shape (n_samples, n_features)
Training data.
y : ndarray, shape (n_samples,)
... | Computes the gradient and the Hessian, in the case of a logistic loss. | [
"Computes",
"the",
"gradient",
"and",
"the",
"Hessian",
"in",
"the",
"case",
"of",
"a",
"logistic",
"loss",
"."
] | def _logistic_grad_hess(w, X, y, alpha, sample_weight=None):
"""Computes the gradient and the Hessian, in the case of a logistic loss.
Parameters
----------
w : ndarray, shape (n_features,) or (n_features + 1,)
Coefficient vector.
X : {array-like, sparse matrix}, shape (n_samples, n_featur... | [
"def",
"_logistic_grad_hess",
"(",
"w",
",",
"X",
",",
"y",
",",
"alpha",
",",
"sample_weight",
"=",
"None",
")",
":",
"n_samples",
",",
"n_features",
"=",
"X",
".",
"shape",
"grad",
"=",
"np",
".",
"empty_like",
"(",
"w",
")",
"fit_intercept",
"=",
... | https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/sklearn/linear_model/logistic.py#L165-L239 | |
virt-manager/virt-manager | c51ebdd76a9fc198c40cefcd78838860199467d3 | virtManager/createvm.py | python | vmmCreateVM._start_detect_os_if_needed | (self, forward_after_finish=False) | return True | Will kick off the OS detection thread if all conditions are met,
like we actually have media to detect, detection isn't already
in progress, etc.
Returns True if we actually start the detection process | Will kick off the OS detection thread if all conditions are met,
like we actually have media to detect, detection isn't already
in progress, etc. | [
"Will",
"kick",
"off",
"the",
"OS",
"detection",
"thread",
"if",
"all",
"conditions",
"are",
"met",
"like",
"we",
"actually",
"have",
"media",
"to",
"detect",
"detection",
"isn",
"t",
"already",
"in",
"progress",
"etc",
"."
] | def _start_detect_os_if_needed(self, forward_after_finish=False):
"""
Will kick off the OS detection thread if all conditions are met,
like we actually have media to detect, detection isn't already
in progress, etc.
Returns True if we actually start the detection process
... | [
"def",
"_start_detect_os_if_needed",
"(",
"self",
",",
"forward_after_finish",
"=",
"False",
")",
":",
"is_install_page",
"=",
"(",
"self",
".",
"widget",
"(",
"\"create-pages\"",
")",
".",
"get_current_page",
"(",
")",
"==",
"PAGE_INSTALL",
")",
"cdrom",
",",
... | https://github.com/virt-manager/virt-manager/blob/c51ebdd76a9fc198c40cefcd78838860199467d3/virtManager/createvm.py#L1720-L1744 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/velbus/light.py | python | async_setup_entry | (
hass: HomeAssistant,
entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) | Set up Velbus switch based on config_entry. | Set up Velbus switch based on config_entry. | [
"Set",
"up",
"Velbus",
"switch",
"based",
"on",
"config_entry",
"."
] | async def async_setup_entry(
hass: HomeAssistant,
entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) -> None:
"""Set up Velbus switch based on config_entry."""
await hass.data[DOMAIN][entry.entry_id]["tsk"]
cntrl = hass.data[DOMAIN][entry.entry_id]["cntrl"]
entities: list[Entity]... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
",",
"async_add_entities",
":",
"AddEntitiesCallback",
",",
")",
"->",
"None",
":",
"await",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"entry",
".",... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/velbus/light.py#L32-L45 | ||
compas-dev/compas | 0b33f8786481f710115fb1ae5fe79abc2a9a5175 | src/compas_ghpython/utilities/drawing.py | python | draw_points | (points) | return rg_points | Draw points.
Parameters
----------
points : list of dict
The point definitions.
Returns
-------
list[:rhino:`Rhino.Geometry.Point3d`]
Notes
-----
.. code-block:: python
Schema({
'pos': lambda x: len(x) == 3)
}) | Draw points. | [
"Draw",
"points",
"."
] | def draw_points(points):
"""Draw points.
Parameters
----------
points : list of dict
The point definitions.
Returns
-------
list[:rhino:`Rhino.Geometry.Point3d`]
Notes
-----
.. code-block:: python
Schema({
'pos': lambda x: len(x) == 3)
})
... | [
"def",
"draw_points",
"(",
"points",
")",
":",
"rg_points",
"=",
"[",
"]",
"for",
"p",
"in",
"iter",
"(",
"points",
")",
":",
"pos",
"=",
"p",
"[",
"'pos'",
"]",
"rg_points",
".",
"append",
"(",
"Point3d",
"(",
"*",
"pos",
")",
")",
"return",
"rg... | https://github.com/compas-dev/compas/blob/0b33f8786481f710115fb1ae5fe79abc2a9a5175/src/compas_ghpython/utilities/drawing.py#L49-L74 | |
containernet/containernet | 7b2ae38d691b2ed8da2b2700b85ed03562271d01 | examples/clustercli.py | python | ClusterCLI.do_plot | ( self, _line ) | Plot topology colored by node placement | Plot topology colored by node placement | [
"Plot",
"topology",
"colored",
"by",
"node",
"placement"
] | def do_plot( self, _line ):
"Plot topology colored by node placement"
# Import networkx if needed
global nx, plt, graphviz_layout
if not nx:
try:
# pylint: disable=import-error,no-member
# pylint: disable=import-outside-toplevel
... | [
"def",
"do_plot",
"(",
"self",
",",
"_line",
")",
":",
"# Import networkx if needed",
"global",
"nx",
",",
"plt",
",",
"graphviz_layout",
"if",
"not",
"nx",
":",
"try",
":",
"# pylint: disable=import-error,no-member",
"# pylint: disable=import-outside-toplevel",
"import... | https://github.com/containernet/containernet/blob/7b2ae38d691b2ed8da2b2700b85ed03562271d01/examples/clustercli.py#L27-L84 | ||
longcw/faster_rcnn_pytorch | d8f842dfa51e067105e6949999277a08daa3d743 | faster_rcnn/datasets/kitti.py | python | kitti._load_kitti_voxel_exemplar_annotation | (self, index) | return {'boxes' : boxes,
'gt_classes': gt_classes,
'gt_subclasses': gt_subclasses,
'gt_subclasses_flipped': gt_subclasses_flipped,
'gt_overlaps': overlaps,
'gt_subindexes': subindexes,
'gt_subindexes_flipped': subindexes_fl... | Load image and bounding boxes info from txt file in the KITTI voxel exemplar format. | Load image and bounding boxes info from txt file in the KITTI voxel exemplar format. | [
"Load",
"image",
"and",
"bounding",
"boxes",
"info",
"from",
"txt",
"file",
"in",
"the",
"KITTI",
"voxel",
"exemplar",
"format",
"."
] | def _load_kitti_voxel_exemplar_annotation(self, index):
"""
Load image and bounding boxes info from txt file in the KITTI voxel exemplar format.
"""
if self._image_set == 'train':
prefix = 'validation'
elif self._image_set == 'trainval':
prefix = 'test'
... | [
"def",
"_load_kitti_voxel_exemplar_annotation",
"(",
"self",
",",
"index",
")",
":",
"if",
"self",
".",
"_image_set",
"==",
"'train'",
":",
"prefix",
"=",
"'validation'",
"elif",
"self",
".",
"_image_set",
"==",
"'trainval'",
":",
"prefix",
"=",
"'test'",
"els... | https://github.com/longcw/faster_rcnn_pytorch/blob/d8f842dfa51e067105e6949999277a08daa3d743/faster_rcnn/datasets/kitti.py#L281-L437 | |
thatbrguy/Pedestrian-Detection | b11c7d6bed0ff320811726fe1c429be26a87da9e | object_detection/meta_architectures/faster_rcnn_meta_arch.py | python | FasterRCNNMetaArch._loss_box_classifier | (self,
refined_box_encodings,
class_predictions_with_background,
proposal_boxes,
num_proposals,
groundtruth_boxlists,
groundtruth_classes_with_background_list... | return loss_dict | Computes scalar box classifier loss tensors.
Uses self._detector_target_assigner to obtain regression and classification
targets for the second stage box classifier, optionally performs
hard mining, and returns losses. All losses are computed independently
for each image and then averaged across the b... | Computes scalar box classifier loss tensors. | [
"Computes",
"scalar",
"box",
"classifier",
"loss",
"tensors",
"."
] | def _loss_box_classifier(self,
refined_box_encodings,
class_predictions_with_background,
proposal_boxes,
num_proposals,
groundtruth_boxlists,
groundtruth_clas... | [
"def",
"_loss_box_classifier",
"(",
"self",
",",
"refined_box_encodings",
",",
"class_predictions_with_background",
",",
"proposal_boxes",
",",
"num_proposals",
",",
"groundtruth_boxlists",
",",
"groundtruth_classes_with_background_list",
",",
"image_shape",
",",
"prediction_ma... | https://github.com/thatbrguy/Pedestrian-Detection/blob/b11c7d6bed0ff320811726fe1c429be26a87da9e/object_detection/meta_architectures/faster_rcnn_meta_arch.py#L1388-L1584 | |
rembo10/headphones | b3199605be1ebc83a7a8feab6b1e99b64014187c | lib/cherrypy/_cptools.py | python | HandlerTool._wrapper | (self, **kwargs) | [] | def _wrapper(self, **kwargs):
if self.callable(**kwargs):
cherrypy.serving.request.handler = None | [
"def",
"_wrapper",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"callable",
"(",
"*",
"*",
"kwargs",
")",
":",
"cherrypy",
".",
"serving",
".",
"request",
".",
"handler",
"=",
"None"
] | https://github.com/rembo10/headphones/blob/b3199605be1ebc83a7a8feab6b1e99b64014187c/lib/cherrypy/_cptools.py#L182-L184 | ||||
pytorch/botorch | f85fb8ff36d21e21bdb881d107982fb6d5d78704 | botorch/models/kernels/contextual_lcea.py | python | LCEAKernel.forward | (
self,
x1: Tensor,
x2: Tensor,
diag: bool = False,
last_dim_is_batch: bool = False,
**params: Any,
) | return res | Iterate across each partition of parameter space and sum the
covariance matrices together | Iterate across each partition of parameter space and sum the
covariance matrices together | [
"Iterate",
"across",
"each",
"partition",
"of",
"parameter",
"space",
"and",
"sum",
"the",
"covariance",
"matrices",
"together"
] | def forward(
self,
x1: Tensor,
x2: Tensor,
diag: bool = False,
last_dim_is_batch: bool = False,
**params: Any,
) -> Tensor:
"""Iterate across each partition of parameter space and sum the
covariance matrices together
"""
# context covar... | [
"def",
"forward",
"(",
"self",
",",
"x1",
":",
"Tensor",
",",
"x2",
":",
"Tensor",
",",
"diag",
":",
"bool",
"=",
"False",
",",
"last_dim_is_batch",
":",
"bool",
"=",
"False",
",",
"*",
"*",
"params",
":",
"Any",
",",
")",
"->",
"Tensor",
":",
"#... | https://github.com/pytorch/botorch/blob/f85fb8ff36d21e21bdb881d107982fb6d5d78704/botorch/models/kernels/contextual_lcea.py#L301-L344 | |
nmccrea/sobot-rimulator | c4a8aa3ec00d5b4948175ae6cc4e0199d32dfba5 | robot_control/supervisor_state_machine.py | python | SupervisorStateMachine.condition_danger | (self) | return False | [] | def condition_danger(self):
for d in self._forward_sensor_distances():
if d < D_DANGER:
return True
return False | [
"def",
"condition_danger",
"(",
"self",
")",
":",
"for",
"d",
"in",
"self",
".",
"_forward_sensor_distances",
"(",
")",
":",
"if",
"d",
"<",
"D_DANGER",
":",
"return",
"True",
"return",
"False"
] | https://github.com/nmccrea/sobot-rimulator/blob/c4a8aa3ec00d5b4948175ae6cc4e0199d32dfba5/robot_control/supervisor_state_machine.py#L128-L132 | |||
fossasia/x-mario-center | fe67afe28d995dcf4e2498e305825a4859566172 | build/lib.linux-i686-2.7/softwarecenter/ui/gtk3/panes/pendingpane.py | python | PendingPane._on_button_pressed | (self, widget, event) | button press handler to capture clicks on the cancel button | button press handler to capture clicks on the cancel button | [
"button",
"press",
"handler",
"to",
"capture",
"clicks",
"on",
"the",
"cancel",
"button"
] | def _on_button_pressed(self, widget, event):
"""button press handler to capture clicks on the cancel button"""
#print "_on_clicked: ", event
if event == None or event.button != 1:
return
res = self.tv.get_path_at_pos(int(event.x), int(event.y))
if not res:
... | [
"def",
"_on_button_pressed",
"(",
"self",
",",
"widget",
",",
"event",
")",
":",
"#print \"_on_clicked: \", event",
"if",
"event",
"==",
"None",
"or",
"event",
".",
"button",
"!=",
"1",
":",
"return",
"res",
"=",
"self",
".",
"tv",
".",
"get_path_at_pos",
... | https://github.com/fossasia/x-mario-center/blob/fe67afe28d995dcf4e2498e305825a4859566172/build/lib.linux-i686-2.7/softwarecenter/ui/gtk3/panes/pendingpane.py#L85-L110 | ||
pynag/pynag | e72cf7ce2395263e2b3080cae0ece2b03dbbfa27 | pynag/Control/Command/autogenerated_commands.py | python | enable_host_notifications | (
host_name,
command_file=None,
timestamp=0
) | return send_command("ENABLE_HOST_NOTIFICATIONS",
command_file,
timestamp,
host_name) | Enables notifications for a particular host. Notifications will
be sent out for the host only if notifications are enabled on a
program-wide basis as well. | Enables notifications for a particular host. Notifications will
be sent out for the host only if notifications are enabled on a
program-wide basis as well. | [
"Enables",
"notifications",
"for",
"a",
"particular",
"host",
".",
"Notifications",
"will",
"be",
"sent",
"out",
"for",
"the",
"host",
"only",
"if",
"notifications",
"are",
"enabled",
"on",
"a",
"program",
"-",
"wide",
"basis",
"as",
"well",
"."
] | def enable_host_notifications(
host_name,
command_file=None,
timestamp=0
):
"""
Enables notifications for a particular host. Notifications will
be sent out for the host only if notifications are enabled on a
program-wide basis as well.
"""
return send_command("ENABLE_HOST_NOTIFICATI... | [
"def",
"enable_host_notifications",
"(",
"host_name",
",",
"command_file",
"=",
"None",
",",
"timestamp",
"=",
"0",
")",
":",
"return",
"send_command",
"(",
"\"ENABLE_HOST_NOTIFICATIONS\"",
",",
"command_file",
",",
"timestamp",
",",
"host_name",
")"
] | https://github.com/pynag/pynag/blob/e72cf7ce2395263e2b3080cae0ece2b03dbbfa27/pynag/Control/Command/autogenerated_commands.py#L1176-L1189 | |
openhatch/oh-mainline | ce29352a034e1223141dcc2f317030bbc3359a51 | vendor/packages/twisted/twisted/conch/ssh/transport.py | python | SSHCiphers.setKeys | (self, outIV, outKey, inIV, inKey, outInteg, inInteg) | Set up the ciphers and hashes using the given keys,
@param outIV: the outgoing initialization vector
@param outKey: the outgoing encryption key
@param inIV: the incoming initialization vector
@param inKey: the incoming encryption key
@param outInteg: the outgoing integrity key
... | Set up the ciphers and hashes using the given keys, | [
"Set",
"up",
"the",
"ciphers",
"and",
"hashes",
"using",
"the",
"given",
"keys"
] | def setKeys(self, outIV, outKey, inIV, inKey, outInteg, inInteg):
"""
Set up the ciphers and hashes using the given keys,
@param outIV: the outgoing initialization vector
@param outKey: the outgoing encryption key
@param inIV: the incoming initialization vector
@param in... | [
"def",
"setKeys",
"(",
"self",
",",
"outIV",
",",
"outKey",
",",
"inIV",
",",
"inKey",
",",
"outInteg",
",",
"inInteg",
")",
":",
"o",
"=",
"self",
".",
"_getCipher",
"(",
"self",
".",
"outCipType",
",",
"outIV",
",",
"outKey",
")",
"self",
".",
"e... | https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/twisted/twisted/conch/ssh/transport.py#L1371-L1391 | ||
MrH0wl/Cloudmare | 65e5bc9888f9d362ab2abfb103ea6c1e869d67aa | thirdparty/xlsxwriter/workbook.py | python | Workbook.set_custom_property | (self, name, value, property_type=None) | Set a custom document property.
Args:
name: The name of the custom property.
value: The value of the custom property.
property_type: The type of the custom property. Optional.
Returns:
Nothing. | Set a custom document property. | [
"Set",
"a",
"custom",
"document",
"property",
"."
] | def set_custom_property(self, name, value, property_type=None):
"""
Set a custom document property.
Args:
name: The name of the custom property.
value: The value of the custom property.
property_type: The type of the custom property. Optional... | [
"def",
"set_custom_property",
"(",
"self",
",",
"name",
",",
"value",
",",
"property_type",
"=",
"None",
")",
":",
"if",
"name",
"is",
"None",
"or",
"value",
"is",
"None",
":",
"warn",
"(",
"\"The name and value parameters must be non-None in \"",
"\"set_custom_pr... | https://github.com/MrH0wl/Cloudmare/blob/65e5bc9888f9d362ab2abfb103ea6c1e869d67aa/thirdparty/xlsxwriter/workbook.py#L386-L430 | ||
lepture/authlib | 2284f751a47474da7d127303e0d8f34d9046c310 | authlib/oauth2/rfc7521/client.py | python | AssertionClient.refresh_token | (self) | return self._refresh_token(data) | Using Assertions as Authorization Grants to refresh token as
described in `Section 4.1`_.
.. _`Section 4.1`: https://tools.ietf.org/html/rfc7521#section-4.1 | Using Assertions as Authorization Grants to refresh token as
described in `Section 4.1`_. | [
"Using",
"Assertions",
"as",
"Authorization",
"Grants",
"to",
"refresh",
"token",
"as",
"described",
"in",
"Section",
"4",
".",
"1",
"_",
"."
] | def refresh_token(self):
"""Using Assertions as Authorization Grants to refresh token as
described in `Section 4.1`_.
.. _`Section 4.1`: https://tools.ietf.org/html/rfc7521#section-4.1
"""
generate_assertion = self.ASSERTION_METHODS[self.grant_type]
assertion = generate_... | [
"def",
"refresh_token",
"(",
"self",
")",
":",
"generate_assertion",
"=",
"self",
".",
"ASSERTION_METHODS",
"[",
"self",
".",
"grant_type",
"]",
"assertion",
"=",
"generate_assertion",
"(",
"issuer",
"=",
"self",
".",
"issuer",
",",
"subject",
"=",
"self",
"... | https://github.com/lepture/authlib/blob/2284f751a47474da7d127303e0d8f34d9046c310/authlib/oauth2/rfc7521/client.py#L49-L70 | |
d11wtq/dockerpty | f8d17d893c6758b7cc25825e99f6b02202632a97 | dockerpty/pty.py | python | Operation.israw | (self, **kwargs) | are we dealing with a tty or not? | are we dealing with a tty or not? | [
"are",
"we",
"dealing",
"with",
"a",
"tty",
"or",
"not?"
] | def israw(self, **kwargs):
"""
are we dealing with a tty or not?
"""
raise NotImplementedError() | [
"def",
"israw",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/d11wtq/dockerpty/blob/f8d17d893c6758b7cc25825e99f6b02202632a97/dockerpty/pty.py#L82-L86 | ||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_openshift/library/oc_route.py | python | OpenShiftCLI._schedulable | (self, node=None, selector=None, schedulable=True) | return self.openshift_cmd(cmd, oadm=True, output=True, output_type='raw') | perform oadm manage-node scheduable | perform oadm manage-node scheduable | [
"perform",
"oadm",
"manage",
"-",
"node",
"scheduable"
] | def _schedulable(self, node=None, selector=None, schedulable=True):
''' perform oadm manage-node scheduable '''
cmd = ['manage-node']
if node:
cmd.extend(node)
else:
cmd.append('--selector={}'.format(selector))
cmd.append('--schedulable={}'.format(schedul... | [
"def",
"_schedulable",
"(",
"self",
",",
"node",
"=",
"None",
",",
"selector",
"=",
"None",
",",
"schedulable",
"=",
"True",
")",
":",
"cmd",
"=",
"[",
"'manage-node'",
"]",
"if",
"node",
":",
"cmd",
".",
"extend",
"(",
"node",
")",
"else",
":",
"c... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_openshift/library/oc_route.py#L1076-L1086 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Lib/lib2to3/pgen2/pgen.py | python | ParserGenerator.expect | (self, type, value=None) | return value | [] | def expect(self, type, value=None):
if self.type != type or (value is not None and self.value != value):
self.raise_error("expected %s/%s, got %s/%s",
type, value, self.type, self.value)
value = self.value
self.gettoken()
return value | [
"def",
"expect",
"(",
"self",
",",
"type",
",",
"value",
"=",
"None",
")",
":",
"if",
"self",
".",
"type",
"!=",
"type",
"or",
"(",
"value",
"is",
"not",
"None",
"and",
"self",
".",
"value",
"!=",
"value",
")",
":",
"self",
".",
"raise_error",
"(... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/lib2to3/pgen2/pgen.py#L313-L319 | |||
Seanlinx/mtcnn | feacb3b6ae1bf177664f2a0b676ed4cfd3f5ca55 | core/MtcnnDetector.py | python | MtcnnDetector.resize_image | (self, img, scale) | return img_resized | resize image and transform dimention to [batchsize, channel, height, width]
Parameters:
----------
img: numpy array , height x width x channel
input image, channels in BGR order here
scale: float number
scale factor of resize operation
Retu... | resize image and transform dimention to [batchsize, channel, height, width]
Parameters:
----------
img: numpy array , height x width x channel
input image, channels in BGR order here
scale: float number
scale factor of resize operation
Retu... | [
"resize",
"image",
"and",
"transform",
"dimention",
"to",
"[",
"batchsize",
"channel",
"height",
"width",
"]",
"Parameters",
":",
"----------",
"img",
":",
"numpy",
"array",
"height",
"x",
"width",
"x",
"channel",
"input",
"image",
"channels",
"in",
"BGR",
"... | def resize_image(self, img, scale):
"""
resize image and transform dimention to [batchsize, channel, height, width]
Parameters:
----------
img: numpy array , height x width x channel
input image, channels in BGR order here
scale: float number
... | [
"def",
"resize_image",
"(",
"self",
",",
"img",
",",
"scale",
")",
":",
"height",
",",
"width",
",",
"channels",
"=",
"img",
".",
"shape",
"new_height",
"=",
"int",
"(",
"height",
"*",
"scale",
")",
"# resized new height",
"new_width",
"=",
"int",
"(",
... | https://github.com/Seanlinx/mtcnn/blob/feacb3b6ae1bf177664f2a0b676ed4cfd3f5ca55/core/MtcnnDetector.py#L122-L141 | |
JoinQuant/jqdatasdk | a9e77ff25f3d504f0ffa127bb67905aca3435f93 | jqdatasdk/client.py | python | JQDataClient.convert_message | (cls, msg) | return msg | [] | def convert_message(cls, msg):
if isinstance(msg, dict):
data_type = msg.get("data_type", None)
data_value = msg.get("data_value", None)
if data_type is not None and data_value is not None:
params = data_value
if data_type.startswith("pandas"):... | [
"def",
"convert_message",
"(",
"cls",
",",
"msg",
")",
":",
"if",
"isinstance",
"(",
"msg",
",",
"dict",
")",
":",
"data_type",
"=",
"msg",
".",
"get",
"(",
"\"data_type\"",
",",
"None",
")",
"data_value",
"=",
"msg",
".",
"get",
"(",
"\"data_value\"",... | https://github.com/JoinQuant/jqdatasdk/blob/a9e77ff25f3d504f0ffa127bb67905aca3435f93/jqdatasdk/client.py#L269-L296 | |||
theotherp/nzbhydra | 4b03d7f769384b97dfc60dade4806c0fc987514e | libs/tmdbsimple/movies.py | python | Movies.credits | (self, **kwargs) | return response | Get the cast and crew information for a specific movie id.
Args:
append_to_response: (optional) Comma separated, any movie method.
Returns:
A dict respresentation of the JSON returned from the API. | Get the cast and crew information for a specific movie id.
Args:
append_to_response: (optional) Comma separated, any movie method. | [
"Get",
"the",
"cast",
"and",
"crew",
"information",
"for",
"a",
"specific",
"movie",
"id",
".",
"Args",
":",
"append_to_response",
":",
"(",
"optional",
")",
"Comma",
"separated",
"any",
"movie",
"method",
"."
] | def credits(self, **kwargs):
"""
Get the cast and crew information for a specific movie id.
Args:
append_to_response: (optional) Comma separated, any movie method.
Returns:
A dict respresentation of the JSON returned from the API.
"""
pat... | [
"def",
"credits",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"path",
"=",
"self",
".",
"_get_id_path",
"(",
"'credits'",
")",
"response",
"=",
"self",
".",
"_GET",
"(",
"path",
",",
"kwargs",
")",
"self",
".",
"_set_attrs_to_values",
"(",
"respons... | https://github.com/theotherp/nzbhydra/blob/4b03d7f769384b97dfc60dade4806c0fc987514e/libs/tmdbsimple/movies.py#L84-L98 | |
wistbean/fxxkpython | 88e16d79d8dd37236ba6ecd0d0ff11d63143968c | vip/qyxuan/projects/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/cachecontrol/controller.py | python | parse_uri | (uri) | return (groups[1], groups[3], groups[4], groups[6], groups[8]) | Parses a URI using the regex given in Appendix B of RFC 3986.
(scheme, authority, path, query, fragment) = parse_uri(uri) | Parses a URI using the regex given in Appendix B of RFC 3986. | [
"Parses",
"a",
"URI",
"using",
"the",
"regex",
"given",
"in",
"Appendix",
"B",
"of",
"RFC",
"3986",
"."
] | def parse_uri(uri):
"""Parses a URI using the regex given in Appendix B of RFC 3986.
(scheme, authority, path, query, fragment) = parse_uri(uri)
"""
groups = URI.match(uri).groups()
return (groups[1], groups[3], groups[4], groups[6], groups[8]) | [
"def",
"parse_uri",
"(",
"uri",
")",
":",
"groups",
"=",
"URI",
".",
"match",
"(",
"uri",
")",
".",
"groups",
"(",
")",
"return",
"(",
"groups",
"[",
"1",
"]",
",",
"groups",
"[",
"3",
"]",
",",
"groups",
"[",
"4",
"]",
",",
"groups",
"[",
"6... | https://github.com/wistbean/fxxkpython/blob/88e16d79d8dd37236ba6ecd0d0ff11d63143968c/vip/qyxuan/projects/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/cachecontrol/controller.py#L21-L27 | |
clinton-hall/nzbToMedia | 27669389216902d1085660167e7bda0bd8527ecf | libs/common/setuptools/package_index.py | python | find_external_links | (url, page) | Find rel="homepage" and rel="download" links in `page`, yielding URLs | Find rel="homepage" and rel="download" links in `page`, yielding URLs | [
"Find",
"rel",
"=",
"homepage",
"and",
"rel",
"=",
"download",
"links",
"in",
"page",
"yielding",
"URLs"
] | def find_external_links(url, page):
"""Find rel="homepage" and rel="download" links in `page`, yielding URLs"""
for match in REL.finditer(page):
tag, rel = match.groups()
rels = set(map(str.strip, rel.lower().split(',')))
if 'homepage' in rels or 'download' in rels:
for matc... | [
"def",
"find_external_links",
"(",
"url",
",",
"page",
")",
":",
"for",
"match",
"in",
"REL",
".",
"finditer",
"(",
"page",
")",
":",
"tag",
",",
"rel",
"=",
"match",
".",
"groups",
"(",
")",
"rels",
"=",
"set",
"(",
"map",
"(",
"str",
".",
"stri... | https://github.com/clinton-hall/nzbToMedia/blob/27669389216902d1085660167e7bda0bd8527ecf/libs/common/setuptools/package_index.py#L222-L237 | ||
david8862/keras-YOLOv3-model-set | e9f0f94109430973525219e66eeafe8a2f51363d | scaled_yolo4/models/layers.py | python | Depthwise_Separable_Conv2D_BN_Mish | (filters, kernel_size=(3, 3), block_id_str=None) | return compose(
YoloDepthwiseConv2D(kernel_size, padding='same', name='conv_dw_' + block_id_str),
CustomBatchNormalization(name='conv_dw_%s_bn' % block_id_str),
Activation(mish, name='conv_dw_%s_mish' % block_id_str),
YoloConv2D(filters, (1,1), padding='same', use_bias=False, strides=(1,... | Depthwise Separable Convolution2D. | Depthwise Separable Convolution2D. | [
"Depthwise",
"Separable",
"Convolution2D",
"."
] | def Depthwise_Separable_Conv2D_BN_Mish(filters, kernel_size=(3, 3), block_id_str=None):
"""Depthwise Separable Convolution2D."""
if not block_id_str:
block_id_str = str(K.get_uid())
return compose(
YoloDepthwiseConv2D(kernel_size, padding='same', name='conv_dw_' + block_id_str),
Cust... | [
"def",
"Depthwise_Separable_Conv2D_BN_Mish",
"(",
"filters",
",",
"kernel_size",
"=",
"(",
"3",
",",
"3",
")",
",",
"block_id_str",
"=",
"None",
")",
":",
"if",
"not",
"block_id_str",
":",
"block_id_str",
"=",
"str",
"(",
"K",
".",
"get_uid",
"(",
")",
"... | https://github.com/david8862/keras-YOLOv3-model-set/blob/e9f0f94109430973525219e66eeafe8a2f51363d/scaled_yolo4/models/layers.py#L32-L42 | |
1040003585/WebScrapingWithPython | a770fa5b03894076c8c9539b1ffff34424ffc016 | portia_examle/lib/python2.7/site-packages/pip/_vendor/requests/models.py | python | PreparedRequest.prepare_method | (self, method) | Prepares the given HTTP method. | Prepares the given HTTP method. | [
"Prepares",
"the",
"given",
"HTTP",
"method",
"."
] | def prepare_method(self, method):
"""Prepares the given HTTP method."""
self.method = method
if self.method is not None:
self.method = to_native_string(self.method.upper()) | [
"def",
"prepare_method",
"(",
"self",
",",
"method",
")",
":",
"self",
".",
"method",
"=",
"method",
"if",
"self",
".",
"method",
"is",
"not",
"None",
":",
"self",
".",
"method",
"=",
"to_native_string",
"(",
"self",
".",
"method",
".",
"upper",
"(",
... | https://github.com/1040003585/WebScrapingWithPython/blob/a770fa5b03894076c8c9539b1ffff34424ffc016/portia_examle/lib/python2.7/site-packages/pip/_vendor/requests/models.py#L319-L323 | ||
catalyst-team/catalyst | 678dc06eda1848242df010b7f34adb572def2598 | catalyst/metrics/_functional_metric.py | python | FunctionalLoaderMetric.__init__ | (
self,
metric_fn: Callable,
metric_key: str,
accumulative_fields: Iterable[str] = None,
compute_on_call: bool = True,
prefix: str = None,
suffix: str = None,
) | Init | Init | [
"Init"
] | def __init__(
self,
metric_fn: Callable,
metric_key: str,
accumulative_fields: Iterable[str] = None,
compute_on_call: bool = True,
prefix: str = None,
suffix: str = None,
):
"""Init"""
super().__init__(compute_on_call=compute_on_call, prefix=pr... | [
"def",
"__init__",
"(",
"self",
",",
"metric_fn",
":",
"Callable",
",",
"metric_key",
":",
"str",
",",
"accumulative_fields",
":",
"Iterable",
"[",
"str",
"]",
"=",
"None",
",",
"compute_on_call",
":",
"bool",
"=",
"True",
",",
"prefix",
":",
"str",
"=",... | https://github.com/catalyst-team/catalyst/blob/678dc06eda1848242df010b7f34adb572def2598/catalyst/metrics/_functional_metric.py#L169-L184 | ||
benanne/kaggle-galaxies | bb1908d23ed80e9aeb706166007830760769daf0 | layers.py | python | StridedConvLayer.__init__ | (self, input_layer, n_filters, filter_length, stride, weights_std, init_bias_value, nonlinearity=rectify, dropout=0.) | MB_size, N_filters, Filter_length | MB_size, N_filters, Filter_length | [
"MB_size",
"N_filters",
"Filter_length"
] | def __init__(self, input_layer, n_filters, filter_length, stride, weights_std, init_bias_value, nonlinearity=rectify, dropout=0.):
if filter_length % stride != 0:
print 'ERROR: the filter_length should be a multiple of the stride '
raise
if stride == 1:
print 'ERROR: ... | [
"def",
"__init__",
"(",
"self",
",",
"input_layer",
",",
"n_filters",
",",
"filter_length",
",",
"stride",
",",
"weights_std",
",",
"init_bias_value",
",",
"nonlinearity",
"=",
"rectify",
",",
"dropout",
"=",
"0.",
")",
":",
"if",
"filter_length",
"%",
"stri... | https://github.com/benanne/kaggle-galaxies/blob/bb1908d23ed80e9aeb706166007830760769daf0/layers.py#L497-L526 | ||
SecureAuthCorp/impacket | 10e53952e64e290712d49e263420b70b681bbc73 | impacket/dot11.py | python | Dot11.get_type_n_subtype | (self) | return ((b >> 2) & 0x3F) | Return 802.11 frame 'Type and Subtype' field | Return 802.11 frame 'Type and Subtype' field | [
"Return",
"802",
".",
"11",
"frame",
"Type",
"and",
"Subtype",
"field"
] | def get_type_n_subtype(self):
"Return 802.11 frame 'Type and Subtype' field"
b = self.header.get_byte(0)
return ((b >> 2) & 0x3F) | [
"def",
"get_type_n_subtype",
"(",
"self",
")",
":",
"b",
"=",
"self",
".",
"header",
".",
"get_byte",
"(",
"0",
")",
"return",
"(",
"(",
"b",
">>",
"2",
")",
"&",
"0x3F",
")"
] | https://github.com/SecureAuthCorp/impacket/blob/10e53952e64e290712d49e263420b70b681bbc73/impacket/dot11.py#L442-L445 | |
stoq/stoq | c26991644d1affcf96bc2e0a0434796cabdf8448 | stoqlib/lib/dateutils.py | python | localdatetime | (year, month, day, hour=0, minute=0, second=0,
microsecond=0) | return datetime.datetime(year=year, day=day, month=month,
hour=hour, minute=minute, second=second,
microsecond=microsecond) | Get a datetime according to the local timezone.
This will return a date at midnight for the current locale.
This is relative to the clock on the computer where Stoq is run.
:param int year: the year in four digits
:param int month: the month (1-12)
:param int day: the day (1-31)
:param int hour... | Get a datetime according to the local timezone.
This will return a date at midnight for the current locale.
This is relative to the clock on the computer where Stoq is run. | [
"Get",
"a",
"datetime",
"according",
"to",
"the",
"local",
"timezone",
".",
"This",
"will",
"return",
"a",
"date",
"at",
"midnight",
"for",
"the",
"current",
"locale",
".",
"This",
"is",
"relative",
"to",
"the",
"clock",
"on",
"the",
"computer",
"where",
... | def localdatetime(year, month, day, hour=0, minute=0, second=0,
microsecond=0):
"""Get a datetime according to the local timezone.
This will return a date at midnight for the current locale.
This is relative to the clock on the computer where Stoq is run.
:param int year: the year in ... | [
"def",
"localdatetime",
"(",
"year",
",",
"month",
",",
"day",
",",
"hour",
"=",
"0",
",",
"minute",
"=",
"0",
",",
"second",
"=",
"0",
",",
"microsecond",
"=",
"0",
")",
":",
"# FIXME: When we can use TIMEZONE WITH TIMESTAMP in PostgreSQL",
"# this shoul... | https://github.com/stoq/stoq/blob/c26991644d1affcf96bc2e0a0434796cabdf8448/stoqlib/lib/dateutils.py#L95-L115 | |
Source-Python-Dev-Team/Source.Python | d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb | addons/source-python/packages/site-packages/docutils/utils/math/math2html.py | python | BigSymbol.smalllimit | (self) | return Options.simplemath | Decide if the limit should be a small, one-line symbol. | Decide if the limit should be a small, one-line symbol. | [
"Decide",
"if",
"the",
"limit",
"should",
"be",
"a",
"small",
"one",
"-",
"line",
"symbol",
"."
] | def smalllimit(self):
"Decide if the limit should be a small, one-line symbol."
if not DocumentParameters.displaymode:
return True
if len(self.symbols[self.symbol]) == 1:
return True
return Options.simplemath | [
"def",
"smalllimit",
"(",
"self",
")",
":",
"if",
"not",
"DocumentParameters",
".",
"displaymode",
":",
"return",
"True",
"if",
"len",
"(",
"self",
".",
"symbols",
"[",
"self",
".",
"symbol",
"]",
")",
"==",
"1",
":",
"return",
"True",
"return",
"Optio... | https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/packages/site-packages/docutils/utils/math/math2html.py#L4217-L4223 | |
krintoxi/NoobSec-Toolkit | 38738541cbc03cedb9a3b3ed13b629f781ad64f6 | NoobSecToolkit - MAC OSX/scripts/Hash_ID.py | python | SHA256sha1pass | () | [] | def SHA256sha1pass():
hs='afbed6e0c79338dbfe0000efe6b8e74e3b7121fe73c383ae22f5b505cb39c886'
if len(hash)==len(hs) and hash.isdigit()==False and hash.isalpha()==False and hash.isalnum()==True:
jerar.append("115220") | [
"def",
"SHA256sha1pass",
"(",
")",
":",
"hs",
"=",
"'afbed6e0c79338dbfe0000efe6b8e74e3b7121fe73c383ae22f5b505cb39c886'",
"if",
"len",
"(",
"hash",
")",
"==",
"len",
"(",
"hs",
")",
"and",
"hash",
".",
"isdigit",
"(",
")",
"==",
"False",
"and",
"hash",
".",
"... | https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit - MAC OSX/scripts/Hash_ID.py#L473-L476 | ||||
thaines/helit | 04bd36ee0fb6b762c63d746e2cd8813641dceda9 | ddhdp/corpus.py | python | Corpus.getSeperateDocumentConc | (self) | return self.seperateDocumentConc | True if each document has its own concetration parameter, False if they all share a single concentration parameter. | True if each document has its own concetration parameter, False if they all share a single concentration parameter. | [
"True",
"if",
"each",
"document",
"has",
"its",
"own",
"concetration",
"parameter",
"False",
"if",
"they",
"all",
"share",
"a",
"single",
"concentration",
"parameter",
"."
] | def getSeperateDocumentConc(self):
"""True if each document has its own concetration parameter, False if they all share a single concentration parameter."""
return self.seperateDocumentConc | [
"def",
"getSeperateDocumentConc",
"(",
"self",
")",
":",
"return",
"self",
".",
"seperateDocumentConc"
] | https://github.com/thaines/helit/blob/04bd36ee0fb6b762c63d746e2cd8813641dceda9/ddhdp/corpus.py#L115-L117 | |
scikit-image/scikit-image | ed642e2bc822f362504d24379dee94978d6fa9de | skimage/restoration/_denoise.py | python | _denoise_tv_chambolle_nd | (image, weight=0.1, eps=2.e-4, max_num_iter=200) | return out | Perform total-variation denoising on n-dimensional images.
Parameters
----------
image : ndarray
n-D input data to be denoised.
weight : float, optional
Denoising weight. The greater `weight`, the more denoising (at
the expense of fidelity to `input`).
eps : float, optional
... | Perform total-variation denoising on n-dimensional images. | [
"Perform",
"total",
"-",
"variation",
"denoising",
"on",
"n",
"-",
"dimensional",
"images",
"."
] | def _denoise_tv_chambolle_nd(image, weight=0.1, eps=2.e-4, max_num_iter=200):
"""Perform total-variation denoising on n-dimensional images.
Parameters
----------
image : ndarray
n-D input data to be denoised.
weight : float, optional
Denoising weight. The greater `weight`, the more ... | [
"def",
"_denoise_tv_chambolle_nd",
"(",
"image",
",",
"weight",
"=",
"0.1",
",",
"eps",
"=",
"2.e-4",
",",
"max_num_iter",
"=",
"200",
")",
":",
"ndim",
"=",
"image",
".",
"ndim",
"p",
"=",
"np",
".",
"zeros",
"(",
"(",
"image",
".",
"ndim",
",",
"... | https://github.com/scikit-image/scikit-image/blob/ed642e2bc822f362504d24379dee94978d6fa9de/skimage/restoration/_denoise.py#L354-L432 | |
TesterlifeRaymond/doraemon | d5cb6e34bd5f2aa97273ce0c0c9303e32beaa333 | venv/lib/python3.6/site-packages/pip/_vendor/distlib/database.py | python | InstalledDistribution.get_distinfo_file | (self, path) | return os.path.join(self.path, path) | Returns a path located under the ``.dist-info`` directory. Returns a
string representing the path.
:parameter path: a ``'/'``-separated path relative to the
``.dist-info`` directory or an absolute path;
If *path* is an absolute path and doesn't start
... | Returns a path located under the ``.dist-info`` directory. Returns a
string representing the path. | [
"Returns",
"a",
"path",
"located",
"under",
"the",
".",
"dist",
"-",
"info",
"directory",
".",
"Returns",
"a",
"string",
"representing",
"the",
"path",
"."
] | def get_distinfo_file(self, path):
"""
Returns a path located under the ``.dist-info`` directory. Returns a
string representing the path.
:parameter path: a ``'/'``-separated path relative to the
``.dist-info`` directory or an absolute path;
... | [
"def",
"get_distinfo_file",
"(",
"self",
",",
"path",
")",
":",
"# Check if it is an absolute path # XXX use relpath, add tests",
"if",
"path",
".",
"find",
"(",
"os",
".",
"sep",
")",
">=",
"0",
":",
"# it's an absolute path?",
"distinfo_dirname",
",",
"path",
"="... | https://github.com/TesterlifeRaymond/doraemon/blob/d5cb6e34bd5f2aa97273ce0c0c9303e32beaa333/venv/lib/python3.6/site-packages/pip/_vendor/distlib/database.py#L793-L820 | |
ceph/ceph-deploy | a16316fc4dd364135b11226df42d9df65c0c60a2 | ceph_deploy/mon.py | python | concatenate_keyrings | (args) | return ''.join(contents) | A helper to collect all keyrings into a single blob that will be
used to inject it to mons with ``--mkfs`` on remote nodes
We require all keyring files to be concatenated to be in a directory
to end with ``.keyring``. | A helper to collect all keyrings into a single blob that will be
used to inject it to mons with ``--mkfs`` on remote nodes | [
"A",
"helper",
"to",
"collect",
"all",
"keyrings",
"into",
"a",
"single",
"blob",
"that",
"will",
"be",
"used",
"to",
"inject",
"it",
"to",
"mons",
"with",
"--",
"mkfs",
"on",
"remote",
"nodes"
] | def concatenate_keyrings(args):
"""
A helper to collect all keyrings into a single blob that will be
used to inject it to mons with ``--mkfs`` on remote nodes
We require all keyring files to be concatenated to be in a directory
to end with ``.keyring``.
"""
keyring_path = os.path.abspath(ar... | [
"def",
"concatenate_keyrings",
"(",
"args",
")",
":",
"keyring_path",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"args",
".",
"keyrings",
")",
"LOG",
".",
"info",
"(",
"'concatenating keyrings from %s'",
"%",
"keyring_path",
")",
"LOG",
".",
"info",
"(",
... | https://github.com/ceph/ceph-deploy/blob/a16316fc4dd364135b11226df42d9df65c0c60a2/ceph_deploy/mon.py#L130-L168 | |
openstack/cinder | 23494a6d6c51451688191e1847a458f1d3cdcaa5 | cinder/volume/drivers/macrosan/devop_client.py | python | Client.unmap_lun_to_it | (self, lun_name, initr_wwn, tgt_port_name) | return self.send_request(method='delete', url='/itl', data=data) | Unmap lun to it. | Unmap lun to it. | [
"Unmap",
"lun",
"to",
"it",
"."
] | def unmap_lun_to_it(self, lun_name, initr_wwn, tgt_port_name):
"""Unmap lun to it."""
data = {
'attr': 'unmaplun',
'lun_name': lun_name,
'initr_wwn': initr_wwn,
'tgt_port_name': tgt_port_name,
}
return self.send_request(method='delete', url... | [
"def",
"unmap_lun_to_it",
"(",
"self",
",",
"lun_name",
",",
"initr_wwn",
",",
"tgt_port_name",
")",
":",
"data",
"=",
"{",
"'attr'",
":",
"'unmaplun'",
",",
"'lun_name'",
":",
"lun_name",
",",
"'initr_wwn'",
":",
"initr_wwn",
",",
"'tgt_port_name'",
":",
"t... | https://github.com/openstack/cinder/blob/23494a6d6c51451688191e1847a458f1d3cdcaa5/cinder/volume/drivers/macrosan/devop_client.py#L427-L435 | |
kivy/kivy | fbf561f73ddba9941b1b7e771f86264c6e6eef36 | kivy/core/window/__init__.py | python | WindowBase.restore | (self) | Restores the size and position of a maximized or minimized window.
This method should be used on desktop platforms only.
.. versionadded:: 1.9.0
.. note::
This feature requires the SDL2 window provider and is currently
only supported on desktop platforms. | Restores the size and position of a maximized or minimized window.
This method should be used on desktop platforms only. | [
"Restores",
"the",
"size",
"and",
"position",
"of",
"a",
"maximized",
"or",
"minimized",
"window",
".",
"This",
"method",
"should",
"be",
"used",
"on",
"desktop",
"platforms",
"only",
"."
] | def restore(self):
'''Restores the size and position of a maximized or minimized window.
This method should be used on desktop platforms only.
.. versionadded:: 1.9.0
.. note::
This feature requires the SDL2 window provider and is currently
only supported on des... | [
"def",
"restore",
"(",
"self",
")",
":",
"Logger",
".",
"warning",
"(",
"'Window: restore() is not implemented in the current '",
"'window provider.'",
")"
] | https://github.com/kivy/kivy/blob/fbf561f73ddba9941b1b7e771f86264c6e6eef36/kivy/core/window/__init__.py#L1079-L1090 | ||
pyqt/examples | 843bb982917cecb2350b5f6d7f42c9b7fb142ec1 | src/pyqt-official/xmlpatterns/schema/schema.py | python | MessageHandler.__init__ | (self) | [] | def __init__(self):
super(MessageHandler, self).__init__()
self.m_description = ""
self.m_sourceLocation = QSourceLocation() | [
"def",
"__init__",
"(",
"self",
")",
":",
"super",
"(",
"MessageHandler",
",",
"self",
")",
".",
"__init__",
"(",
")",
"self",
".",
"m_description",
"=",
"\"\"",
"self",
".",
"m_sourceLocation",
"=",
"QSourceLocation",
"(",
")"
] | https://github.com/pyqt/examples/blob/843bb982917cecb2350b5f6d7f42c9b7fb142ec1/src/pyqt-official/xmlpatterns/schema/schema.py#L134-L138 | ||||
urwid/urwid | e2423b5069f51d318ea1ac0f355a0efe5448f7eb | urwid/display_common.py | python | BaseScreen.run_wrapper | (self, fn, *args, **kwargs) | Start the screen, call a function, then stop the screen. Extra
arguments are passed to `start`.
Deprecated in favor of calling `start` as a context manager. | Start the screen, call a function, then stop the screen. Extra
arguments are passed to `start`. | [
"Start",
"the",
"screen",
"call",
"a",
"function",
"then",
"stop",
"the",
"screen",
".",
"Extra",
"arguments",
"are",
"passed",
"to",
"start",
"."
] | def run_wrapper(self, fn, *args, **kwargs):
"""Start the screen, call a function, then stop the screen. Extra
arguments are passed to `start`.
Deprecated in favor of calling `start` as a context manager.
"""
with self.start(*args, **kwargs):
return fn() | [
"def",
"run_wrapper",
"(",
"self",
",",
"fn",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"with",
"self",
".",
"start",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"fn",
"(",
")"
] | https://github.com/urwid/urwid/blob/e2423b5069f51d318ea1ac0f355a0efe5448f7eb/urwid/display_common.py#L827-L834 | ||
agiliq/Django-Socialauth | b0b1acb180dd955edcc9b9b9d086470b8c332de6 | socialauth/lib/twitter.py | python | Api.GetFeatured | (self) | return [User.NewFromJsonDict(x) for x in data] | Fetch the sequence of twitter.User instances featured on twitter.com
The twitter.Api instance must be authenticated.
Returns:
A sequence of twitter.User instances | Fetch the sequence of twitter.User instances featured on twitter.com | [
"Fetch",
"the",
"sequence",
"of",
"twitter",
".",
"User",
"instances",
"featured",
"on",
"twitter",
".",
"com"
] | def GetFeatured(self):
'''Fetch the sequence of twitter.User instances featured on twitter.com
The twitter.Api instance must be authenticated.
Returns:
A sequence of twitter.User instances
'''
url = 'http://twitter.com/statuses/featured.json'
json = self._FetchUrl(url)
data = simplej... | [
"def",
"GetFeatured",
"(",
"self",
")",
":",
"url",
"=",
"'http://twitter.com/statuses/featured.json'",
"json",
"=",
"self",
".",
"_FetchUrl",
"(",
"url",
")",
"data",
"=",
"simplejson",
".",
"loads",
"(",
"json",
")",
"self",
".",
"_CheckForTwitterError",
"("... | https://github.com/agiliq/Django-Socialauth/blob/b0b1acb180dd955edcc9b9b9d086470b8c332de6/socialauth/lib/twitter.py#L1610-L1622 | |
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | osh/glob_.py | python | LooksLikeGlob | (s) | return False | Does this string look like a glob pattern?
Like other shells, OSH avoids calls to glob() unless there are glob
metacharacters.
TODO: Reference lib/glob / glob_pattern functions in bash
$ grep glob_pattern lib/glob/*
Used:
1. in Globber below
2. for the slow path / fast path of prefix/suffix/patsub op... | Does this string look like a glob pattern? | [
"Does",
"this",
"string",
"look",
"like",
"a",
"glob",
"pattern?"
] | def LooksLikeGlob(s):
# type: (str) -> bool
"""Does this string look like a glob pattern?
Like other shells, OSH avoids calls to glob() unless there are glob
metacharacters.
TODO: Reference lib/glob / glob_pattern functions in bash
$ grep glob_pattern lib/glob/*
Used:
1. in Globber below
2. for t... | [
"def",
"LooksLikeGlob",
"(",
"s",
")",
":",
"# type: (str) -> bool",
"left_bracket",
"=",
"False",
"i",
"=",
"0",
"n",
"=",
"len",
"(",
"s",
")",
"while",
"i",
"<",
"n",
":",
"c",
"=",
"s",
"[",
"i",
"]",
"if",
"c",
"==",
"'\\\\'",
":",
"i",
"+... | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/osh/glob_.py#L26-L56 | |
AndrewAnnex/SpiceyPy | 9f8b626338f119bacd39ef2ba94a6f71bd6341c0 | src/spiceypy/spiceypy.py | python | sct2e | (sc: int, sclkdp: Union[float, Iterable[float]]) | Convert encoded spacecraft clock ("ticks") to ephemeris
seconds past J2000 (ET).
https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/sct2e_c.html
:param sc: NAIF spacecraft ID code.
:param sclkdp: SCLK, encoded as ticks since spacecraft clock start.
:return: Ephemeris time, seconds past J2000... | Convert encoded spacecraft clock ("ticks") to ephemeris
seconds past J2000 (ET). | [
"Convert",
"encoded",
"spacecraft",
"clock",
"(",
"ticks",
")",
"to",
"ephemeris",
"seconds",
"past",
"J2000",
"(",
"ET",
")",
"."
] | def sct2e(sc: int, sclkdp: Union[float, Iterable[float]]) -> Union[float, ndarray]:
"""
Convert encoded spacecraft clock ("ticks") to ephemeris
seconds past J2000 (ET).
https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/sct2e_c.html
:param sc: NAIF spacecraft ID code.
:param sclkdp: SCLK... | [
"def",
"sct2e",
"(",
"sc",
":",
"int",
",",
"sclkdp",
":",
"Union",
"[",
"float",
",",
"Iterable",
"[",
"float",
"]",
"]",
")",
"->",
"Union",
"[",
"float",
",",
"ndarray",
"]",
":",
"sc",
"=",
"ctypes",
".",
"c_int",
"(",
"sc",
")",
"et",
"=",... | https://github.com/AndrewAnnex/SpiceyPy/blob/9f8b626338f119bacd39ef2ba94a6f71bd6341c0/src/spiceypy/spiceypy.py#L11102-L11125 | ||
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-windows/x86/PIL/EpsImagePlugin.py | python | has_ghostscript | () | return False | [] | def has_ghostscript():
if gs_windows_binary:
return True
if not sys.platform.startswith("win"):
try:
subprocess.check_call(["gs", "--version"], stdout=subprocess.DEVNULL)
return True
except OSError:
# No Ghostscript
pass
return False | [
"def",
"has_ghostscript",
"(",
")",
":",
"if",
"gs_windows_binary",
":",
"return",
"True",
"if",
"not",
"sys",
".",
"platform",
".",
"startswith",
"(",
"\"win\"",
")",
":",
"try",
":",
"subprocess",
".",
"check_call",
"(",
"[",
"\"gs\"",
",",
"\"--version\... | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-windows/x86/PIL/EpsImagePlugin.py#L51-L61 | |||
the3dadvantage/Modeling-Cloth-2_8 | b0d3a38abf7a9f88f27e4ea706f6b546f619093f | ModelingCloth28.py | python | get_tri_normals | (tr_co) | return cross_vecs, np.cross(cross_vecs[:,0], cross_vecs[:,1]), origins | Takes N x 3 x 3 set of 3d triangles and
returns vectors around the triangle,
non-unit normals and origins | Takes N x 3 x 3 set of 3d triangles and
returns vectors around the triangle,
non-unit normals and origins | [
"Takes",
"N",
"x",
"3",
"x",
"3",
"set",
"of",
"3d",
"triangles",
"and",
"returns",
"vectors",
"around",
"the",
"triangle",
"non",
"-",
"unit",
"normals",
"and",
"origins"
] | def get_tri_normals(tr_co):
"""Takes N x 3 x 3 set of 3d triangles and
returns vectors around the triangle,
non-unit normals and origins"""
origins = tr_co[:,0]
cross_vecs = tr_co[:,1:] - origins[:, nax]
return cross_vecs, np.cross(cross_vecs[:,0], cross_vecs[:,1]), origins | [
"def",
"get_tri_normals",
"(",
"tr_co",
")",
":",
"origins",
"=",
"tr_co",
"[",
":",
",",
"0",
"]",
"cross_vecs",
"=",
"tr_co",
"[",
":",
",",
"1",
":",
"]",
"-",
"origins",
"[",
":",
",",
"nax",
"]",
"return",
"cross_vecs",
",",
"np",
".",
"cros... | https://github.com/the3dadvantage/Modeling-Cloth-2_8/blob/b0d3a38abf7a9f88f27e4ea706f6b546f619093f/ModelingCloth28.py#L159-L165 | |
frappe/frappe | b64cab6867dfd860f10ccaf41a4ec04bc890b583 | frappe/contacts/address_and_contact.py | python | load_address_and_contact | (doc, key=None) | Loads address list and contact list in `__onload` | Loads address list and contact list in `__onload` | [
"Loads",
"address",
"list",
"and",
"contact",
"list",
"in",
"__onload"
] | def load_address_and_contact(doc, key=None):
"""Loads address list and contact list in `__onload`"""
from frappe.contacts.doctype.address.address import get_address_display, get_condensed_address
filters = [
["Dynamic Link", "link_doctype", "=", doc.doctype],
["Dynamic Link", "link_name", "=", doc.name],
["Dy... | [
"def",
"load_address_and_contact",
"(",
"doc",
",",
"key",
"=",
"None",
")",
":",
"from",
"frappe",
".",
"contacts",
".",
"doctype",
".",
"address",
".",
"address",
"import",
"get_address_display",
",",
"get_condensed_address",
"filters",
"=",
"[",
"[",
"\"Dyn... | https://github.com/frappe/frappe/blob/b64cab6867dfd860f10ccaf41a4ec04bc890b583/frappe/contacts/address_and_contact.py#L10-L62 | ||
cbfinn/maml_rl | 9c8e2ebd741cb0c7b8bf2d040c4caeeb8e06cc95 | rllab/optimizers/hessian_free_optimizer.py | python | HessianFreeOptimizer.update_opt | (self, loss, target, inputs, network_outputs, extra_inputs=None) | :param loss: Symbolic expression for the loss function.
:param target: A parameterized object to optimize over. It should implement methods of the
:class:`rllab.core.paramerized.Parameterized` class.
:param inputs: A list of symbolic variables as inputs
:return: No return value. | :param loss: Symbolic expression for the loss function.
:param target: A parameterized object to optimize over. It should implement methods of the
:class:`rllab.core.paramerized.Parameterized` class.
:param inputs: A list of symbolic variables as inputs
:return: No return value. | [
":",
"param",
"loss",
":",
"Symbolic",
"expression",
"for",
"the",
"loss",
"function",
".",
":",
"param",
"target",
":",
"A",
"parameterized",
"object",
"to",
"optimize",
"over",
".",
"It",
"should",
"implement",
"methods",
"of",
"the",
":",
"class",
":",
... | def update_opt(self, loss, target, inputs, network_outputs, extra_inputs=None):
"""
:param loss: Symbolic expression for the loss function.
:param target: A parameterized object to optimize over. It should implement methods of the
:class:`rllab.core.paramerized.Parameterized` class.
... | [
"def",
"update_opt",
"(",
"self",
",",
"loss",
",",
"target",
",",
"inputs",
",",
"network_outputs",
",",
"extra_inputs",
"=",
"None",
")",
":",
"self",
".",
"_target",
"=",
"target",
"if",
"extra_inputs",
"is",
"None",
":",
"extra_inputs",
"=",
"list",
... | https://github.com/cbfinn/maml_rl/blob/9c8e2ebd741cb0c7b8bf2d040c4caeeb8e06cc95/rllab/optimizers/hessian_free_optimizer.py#L23-L46 | ||
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/cheroot/wsgi.py | python | Gateway.start_response | (self, status, headers, exc_info=None) | return self.write | WSGI callable to begin the HTTP response. | WSGI callable to begin the HTTP response. | [
"WSGI",
"callable",
"to",
"begin",
"the",
"HTTP",
"response",
"."
] | def start_response(self, status, headers, exc_info=None):
"""WSGI callable to begin the HTTP response."""
# "The application may call start_response more than once,
# if and only if the exc_info argument is provided."
if self.started_response and not exc_info:
raise RuntimeEr... | [
"def",
"start_response",
"(",
"self",
",",
"status",
",",
"headers",
",",
"exc_info",
"=",
"None",
")",
":",
"# \"The application may call start_response more than once,",
"# if and only if the exc_info argument is provided.\"",
"if",
"self",
".",
"started_response",
"and",
... | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/cheroot/wsgi.py#L152-L188 | |
hardmaru/resnet-cppn-gan-tensorflow | 9206e06512c118e932fbc789c91a5cf4f9e5d2b9 | sampler.py | python | Sampler.save_png | (self, image_data, filename, specific_size = None) | [] | def save_png(self, image_data, filename, specific_size = None):
img_data = np.array(1-image_data)
y_dim = image_data.shape[0]
x_dim = image_data.shape[1]
c_dim = self.model.c_dim
if c_dim > 1:
img_data = np.array(img_data.reshape((y_dim, x_dim, c_dim))*255.0, dtype=np.uint8)
else:
im... | [
"def",
"save_png",
"(",
"self",
",",
"image_data",
",",
"filename",
",",
"specific_size",
"=",
"None",
")",
":",
"img_data",
"=",
"np",
".",
"array",
"(",
"1",
"-",
"image_data",
")",
"y_dim",
"=",
"image_data",
".",
"shape",
"[",
"0",
"]",
"x_dim",
... | https://github.com/hardmaru/resnet-cppn-gan-tensorflow/blob/9206e06512c118e932fbc789c91a5cf4f9e5d2b9/sampler.py#L96-L108 | ||||
TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials | 5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e | deep-learning/fastai-docs/fastai_docs-master/dev_nb/nb_002b.py | python | normalize_funcs | (mean:float, std, do_y=False, device=None) | return (partial(normalize_batch, mean=mean.to(device),std=std.to(device)),
partial(denormalize, mean=mean, std=std)) | Create normalize/denormalize func using `mean` and `std`, can specify `do_y` and `device` | Create normalize/denormalize func using `mean` and `std`, can specify `do_y` and `device` | [
"Create",
"normalize",
"/",
"denormalize",
"func",
"using",
"mean",
"and",
"std",
"can",
"specify",
"do_y",
"and",
"device"
] | def normalize_funcs(mean:float, std, do_y=False, device=None)->[Callable,Callable]:
"Create normalize/denormalize func using `mean` and `std`, can specify `do_y` and `device`"
if device is None: device=default_device
return (partial(normalize_batch, mean=mean.to(device),std=std.to(device)),
part... | [
"def",
"normalize_funcs",
"(",
"mean",
":",
"float",
",",
"std",
",",
"do_y",
"=",
"False",
",",
"device",
"=",
"None",
")",
"->",
"[",
"Callable",
",",
"Callable",
"]",
":",
"if",
"device",
"is",
"None",
":",
"device",
"=",
"default_device",
"return",... | https://github.com/TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials/blob/5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e/deep-learning/fastai-docs/fastai_docs-master/dev_nb/nb_002b.py#L22-L26 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Lib/lib-tk/turtle.py | python | RawTurtle._cc | (self, args) | return "#%02x%02x%02x" % (r, g, b) | Convert colortriples to hexstrings. | Convert colortriples to hexstrings. | [
"Convert",
"colortriples",
"to",
"hexstrings",
"."
] | def _cc(self, args):
"""Convert colortriples to hexstrings.
"""
if isinstance(args, basestring):
return args
try:
r, g, b = args
except:
raise TurtleGraphicsError("bad color arguments: %s" % str(args))
if self.screen._colormode == 1.0:
... | [
"def",
"_cc",
"(",
"self",
",",
"args",
")",
":",
"if",
"isinstance",
"(",
"args",
",",
"basestring",
")",
":",
"return",
"args",
"try",
":",
"r",
",",
"g",
",",
"b",
"=",
"args",
"except",
":",
"raise",
"TurtleGraphicsError",
"(",
"\"bad color argumen... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/lib-tk/turtle.py#L2602-L2615 | |
facebookresearch/pytorch_GAN_zoo | b75dee40918caabb4fe7ec561522717bf096a8cb | models/loss_criterions/loss_texture.py | python | extractIndexedLayers | (sequence,
x,
indexes,
detach) | return output | [] | def extractIndexedLayers(sequence,
x,
indexes,
detach):
index = 0
output = []
indexes.sort()
for iSeq, layer in enumerate(sequence):
if index >= len(indexes):
break
x = layer(x)
if iSeq =... | [
"def",
"extractIndexedLayers",
"(",
"sequence",
",",
"x",
",",
"indexes",
",",
"detach",
")",
":",
"index",
"=",
"0",
"output",
"=",
"[",
"]",
"indexes",
".",
"sort",
"(",
")",
"for",
"iSeq",
",",
"layer",
"in",
"enumerate",
"(",
"sequence",
")",
":"... | https://github.com/facebookresearch/pytorch_GAN_zoo/blob/b75dee40918caabb4fe7ec561522717bf096a8cb/models/loss_criterions/loss_texture.py#L42-L66 | |||
IronLanguages/ironpython3 | 7a7bb2a872eeab0d1009fc8a6e24dca43f65b693 | Src/StdLib/Lib/xml/dom/minidom.py | python | _write_data | (writer, data) | Writes datachars to writer. | Writes datachars to writer. | [
"Writes",
"datachars",
"to",
"writer",
"."
] | def _write_data(writer, data):
"Writes datachars to writer."
if data:
data = data.replace("&", "&").replace("<", "<"). \
replace("\"", """).replace(">", ">")
writer.write(data) | [
"def",
"_write_data",
"(",
"writer",
",",
"data",
")",
":",
"if",
"data",
":",
"data",
"=",
"data",
".",
"replace",
"(",
"\"&\"",
",",
"\"&\"",
")",
".",
"replace",
"(",
"\"<\"",
",",
"\"<\"",
")",
".",
"replace",
"(",
"\"\\\"\"",
",",
"\"&quo... | https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/xml/dom/minidom.py#L302-L307 | ||
jiangxinyang227/bert-for-task | 3e7aed9e3c757ebc22aabfd4f3fb7b4cd81b010a | bert_task/classifier_task/metrics.py | python | multi_f_beta | (pred_y, true_y, labels, beta=1.0) | return f_beta | 多类的f beta值
:param pred_y: 预测结果
:param true_y: 真实结果
:param labels: 标签列表
:param beta: beta值
:return: | 多类的f beta值
:param pred_y: 预测结果
:param true_y: 真实结果
:param labels: 标签列表
:param beta: beta值
:return: | [
"多类的f",
"beta值",
":",
"param",
"pred_y",
":",
"预测结果",
":",
"param",
"true_y",
":",
"真实结果",
":",
"param",
"labels",
":",
"标签列表",
":",
"param",
"beta",
":",
"beta值",
":",
"return",
":"
] | def multi_f_beta(pred_y, true_y, labels, beta=1.0):
"""
多类的f beta值
:param pred_y: 预测结果
:param true_y: 真实结果
:param labels: 标签列表
:param beta: beta值
:return:
"""
if isinstance(pred_y[0], list):
pred_y = [item[0] for item in pred_y]
f_betas = [binary_f_beta(pred_y, true_y, b... | [
"def",
"multi_f_beta",
"(",
"pred_y",
",",
"true_y",
",",
"labels",
",",
"beta",
"=",
"1.0",
")",
":",
"if",
"isinstance",
"(",
"pred_y",
"[",
"0",
"]",
",",
"list",
")",
":",
"pred_y",
"=",
"[",
"item",
"[",
"0",
"]",
"for",
"item",
"in",
"pred_... | https://github.com/jiangxinyang227/bert-for-task/blob/3e7aed9e3c757ebc22aabfd4f3fb7b4cd81b010a/bert_task/classifier_task/metrics.py#L135-L149 | |
cagbal/ros_people_object_detection_tensorflow | 982ffd4a54b8059638f5cd4aa167299c7fc9e61f | src/object_detection/core/keypoint_ops.py | python | to_normalized_coordinates | (keypoints, height, width,
check_range=True, scope=None) | Converts absolute keypoint coordinates to normalized coordinates in [0, 1].
Usually one uses the dynamic shape of the image or conv-layer tensor:
keypoints = keypoint_ops.to_normalized_coordinates(keypoints,
tf.shape(images)[1],
... | Converts absolute keypoint coordinates to normalized coordinates in [0, 1]. | [
"Converts",
"absolute",
"keypoint",
"coordinates",
"to",
"normalized",
"coordinates",
"in",
"[",
"0",
"1",
"]",
"."
] | def to_normalized_coordinates(keypoints, height, width,
check_range=True, scope=None):
"""Converts absolute keypoint coordinates to normalized coordinates in [0, 1].
Usually one uses the dynamic shape of the image or conv-layer tensor:
keypoints = keypoint_ops.to_normalized_coordi... | [
"def",
"to_normalized_coordinates",
"(",
"keypoints",
",",
"height",
",",
"width",
",",
"check_range",
"=",
"True",
",",
"scope",
"=",
"None",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"scope",
",",
"'ToNormalizedCoordinates'",
")",
":",
"height",
"=",... | https://github.com/cagbal/ros_people_object_detection_tensorflow/blob/982ffd4a54b8059638f5cd4aa167299c7fc9e61f/src/object_detection/core/keypoint_ops.py#L128-L163 | ||
facebookresearch/fastMRI | 13560d2f198cc72f06e01675e9ecee509ce5639a | fastmri/coil_combine.py | python | rss | (data: torch.Tensor, dim: int = 0) | return torch.sqrt((data ** 2).sum(dim)) | Compute the Root Sum of Squares (RSS).
RSS is computed assuming that dim is the coil dimension.
Args:
data: The input tensor
dim: The dimensions along which to apply the RSS transform
Returns:
The RSS value. | Compute the Root Sum of Squares (RSS). | [
"Compute",
"the",
"Root",
"Sum",
"of",
"Squares",
"(",
"RSS",
")",
"."
] | def rss(data: torch.Tensor, dim: int = 0) -> torch.Tensor:
"""
Compute the Root Sum of Squares (RSS).
RSS is computed assuming that dim is the coil dimension.
Args:
data: The input tensor
dim: The dimensions along which to apply the RSS transform
Returns:
The RSS value.
... | [
"def",
"rss",
"(",
"data",
":",
"torch",
".",
"Tensor",
",",
"dim",
":",
"int",
"=",
"0",
")",
"->",
"torch",
".",
"Tensor",
":",
"return",
"torch",
".",
"sqrt",
"(",
"(",
"data",
"**",
"2",
")",
".",
"sum",
"(",
"dim",
")",
")"
] | https://github.com/facebookresearch/fastMRI/blob/13560d2f198cc72f06e01675e9ecee509ce5639a/fastmri/coil_combine.py#L13-L26 | |
celery/django-celery-beat | fa73034be892052893e4ef17926ef3a5d4a21ea2 | django_celery_beat/clockedschedule.py | python | clocked.__init__ | (self, clocked_time, nowfun=None, app=None) | Initialize clocked. | Initialize clocked. | [
"Initialize",
"clocked",
"."
] | def __init__(self, clocked_time, nowfun=None, app=None):
"""Initialize clocked."""
self.clocked_time = maybe_make_aware(clocked_time)
super().__init__(nowfun=nowfun, app=app) | [
"def",
"__init__",
"(",
"self",
",",
"clocked_time",
",",
"nowfun",
"=",
"None",
",",
"app",
"=",
"None",
")",
":",
"self",
".",
"clocked_time",
"=",
"maybe_make_aware",
"(",
"clocked_time",
")",
"super",
"(",
")",
".",
"__init__",
"(",
"nowfun",
"=",
... | https://github.com/celery/django-celery-beat/blob/fa73034be892052893e4ef17926ef3a5d4a21ea2/django_celery_beat/clockedschedule.py#L14-L17 | ||
jbittel/django-mama-cas | 22e3b232bb5f16974a0b54cb2ad1d6a35ba501fc | mama_cas/response.py | python | CasResponseBase.ns | (self, tag) | return etree.QName(self.uri, tag) | Given an XML tag, output the qualified name for proper
namespace handling on output. | Given an XML tag, output the qualified name for proper
namespace handling on output. | [
"Given",
"an",
"XML",
"tag",
"output",
"the",
"qualified",
"name",
"for",
"proper",
"namespace",
"handling",
"on",
"output",
"."
] | def ns(self, tag):
"""
Given an XML tag, output the qualified name for proper
namespace handling on output.
"""
return etree.QName(self.uri, tag) | [
"def",
"ns",
"(",
"self",
",",
"tag",
")",
":",
"return",
"etree",
".",
"QName",
"(",
"self",
".",
"uri",
",",
"tag",
")"
] | https://github.com/jbittel/django-mama-cas/blob/22e3b232bb5f16974a0b54cb2ad1d6a35ba501fc/mama_cas/response.py#L22-L27 | |
pgmpy/pgmpy | 24279929a28082ea994c52f3d165ca63fc56b02b | pgmpy/extern/tabulate.py | python | _build_simple_row | (padded_cells, rowfmt) | return (begin + sep.join(padded_cells) + end).rstrip() | Format row according to DataRow format without padding. | Format row according to DataRow format without padding. | [
"Format",
"row",
"according",
"to",
"DataRow",
"format",
"without",
"padding",
"."
] | def _build_simple_row(padded_cells, rowfmt):
"Format row according to DataRow format without padding."
begin, sep, end = rowfmt
return (begin + sep.join(padded_cells) + end).rstrip() | [
"def",
"_build_simple_row",
"(",
"padded_cells",
",",
"rowfmt",
")",
":",
"begin",
",",
"sep",
",",
"end",
"=",
"rowfmt",
"return",
"(",
"begin",
"+",
"sep",
".",
"join",
"(",
"padded_cells",
")",
"+",
"end",
")",
".",
"rstrip",
"(",
")"
] | https://github.com/pgmpy/pgmpy/blob/24279929a28082ea994c52f3d165ca63fc56b02b/pgmpy/extern/tabulate.py#L900-L903 | |
tomplus/kubernetes_asyncio | f028cc793e3a2c519be6a52a49fb77ff0b014c9b | kubernetes_asyncio/client/api/apps_v1_api.py | python | AppsV1Api.patch_namespaced_daemon_set_status | (self, name, namespace, body, **kwargs) | return self.patch_namespaced_daemon_set_status_with_http_info(name, namespace, body, **kwargs) | patch_namespaced_daemon_set_status # noqa: E501
partially update status of the specified DaemonSet # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.patch_namespaced_daemon_set_status... | patch_namespaced_daemon_set_status # noqa: E501 | [
"patch_namespaced_daemon_set_status",
"#",
"noqa",
":",
"E501"
] | def patch_namespaced_daemon_set_status(self, name, namespace, body, **kwargs): # noqa: E501
"""patch_namespaced_daemon_set_status # noqa: E501
partially update status of the specified DaemonSet # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchron... | [
"def",
"patch_namespaced_daemon_set_status",
"(",
"self",
",",
"name",
",",
"namespace",
",",
"body",
",",
"*",
"*",
"kwargs",
")",
":",
"# noqa: E501",
"kwargs",
"[",
"'_return_http_data_only'",
"]",
"=",
"True",
"return",
"self",
".",
"patch_namespaced_daemon_se... | https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/api/apps_v1_api.py#L4401-L4430 | |
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/splom/marker/_colorbar.py | python | ColorBar.exponentformat | (self) | return self["exponentformat"] | Determines a formatting rule for the tick exponents. For
example, consider the number 1,000,000,000. If "none", it
appears as 1,000,000,000. If "e", 1e+9. If "E", 1E+9. If
"power", 1x10^9 (with 9 in a super script). If "SI", 1G. If
"B", 1B.
The 'exponentformat' property is a... | Determines a formatting rule for the tick exponents. For
example, consider the number 1,000,000,000. If "none", it
appears as 1,000,000,000. If "e", 1e+9. If "E", 1E+9. If
"power", 1x10^9 (with 9 in a super script). If "SI", 1G. If
"B", 1B.
The 'exponentformat' property is a... | [
"Determines",
"a",
"formatting",
"rule",
"for",
"the",
"tick",
"exponents",
".",
"For",
"example",
"consider",
"the",
"number",
"1",
"000",
"000",
"000",
".",
"If",
"none",
"it",
"appears",
"as",
"1",
"000",
"000",
"000",
".",
"If",
"e",
"1e",
"+",
"... | def exponentformat(self):
"""
Determines a formatting rule for the tick exponents. For
example, consider the number 1,000,000,000. If "none", it
appears as 1,000,000,000. If "e", 1e+9. If "E", 1E+9. If
"power", 1x10^9 (with 9 in a super script). If "SI", 1G. If
"B", 1B.
... | [
"def",
"exponentformat",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"exponentformat\"",
"]"
] | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/splom/marker/_colorbar.py#L240-L256 | |
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/batch/v20170312/models.py | python | DescribeJobSubmitInfoRequest.__init__ | (self) | r"""
:param JobId: 作业ID
:type JobId: str | r"""
:param JobId: 作业ID
:type JobId: str | [
"r",
":",
"param",
"JobId",
":",
"作业ID",
":",
"type",
"JobId",
":",
"str"
] | def __init__(self):
r"""
:param JobId: 作业ID
:type JobId: str
"""
self.JobId = None | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"JobId",
"=",
"None"
] | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/batch/v20170312/models.py#L1784-L1789 | ||
wenwei202/terngrad | ec4f75e9a3a1e1c4b2e6494d830fbdfdd2e03ddc | terngrad/inception/bingrad_common.py | python | average_scalers | (tower_scalers) | return average_scalers | Calculate the average scalers for gradients across all towers.
Note that this function provides a synchronization point across all towers.
Args:
tower_scalers: List of lists of (scaler, variable) tuples. The outer list
is over individual scaler. The inner list is over the scaler
calculation for ea... | Calculate the average scalers for gradients across all towers. | [
"Calculate",
"the",
"average",
"scalers",
"for",
"gradients",
"across",
"all",
"towers",
"."
] | def average_scalers(tower_scalers):
"""Calculate the average scalers for gradients across all towers.
Note that this function provides a synchronization point across all towers.
Args:
tower_scalers: List of lists of (scaler, variable) tuples. The outer list
is over individual scaler. The inner list is... | [
"def",
"average_scalers",
"(",
"tower_scalers",
")",
":",
"average_scalers",
"=",
"[",
"]",
"for",
"scale_and_vars",
"in",
"zip",
"(",
"*",
"tower_scalers",
")",
":",
"# Note that each scale_and_vars looks like the following:",
"# ((scale0_gpu0, var0_gpu0), ... , (scale0_gp... | https://github.com/wenwei202/terngrad/blob/ec4f75e9a3a1e1c4b2e6494d830fbdfdd2e03ddc/terngrad/inception/bingrad_common.py#L250-L280 | |
hclhkbu/dlbench | 978b034e9c34e6aaa38782bb1e4a2cea0c01d0f9 | synthetic/experiments/tensorflow/cnn/resnet/image_processing.py | python | parse_example_proto | (example_serialized) | return features['image/filename'], label, bbox, features['image/class/text'] | Parses an Example proto containing a training example of an image.
The output of the build_image_data.py image preprocessing script is a dataset
containing serialized Example protocol buffers. Each Example proto contains
the following fields:
image/height: 462
image/width: 581
image/colorspace: 'RGB... | Parses an Example proto containing a training example of an image. | [
"Parses",
"an",
"Example",
"proto",
"containing",
"a",
"training",
"example",
"of",
"an",
"image",
"."
] | def parse_example_proto(example_serialized):
"""Parses an Example proto containing a training example of an image.
The output of the build_image_data.py image preprocessing script is a dataset
containing serialized Example protocol buffers. Each Example proto contains
the following fields:
image/height:... | [
"def",
"parse_example_proto",
"(",
"example_serialized",
")",
":",
"# Dense features in Example proto.",
"feature_map",
"=",
"{",
"'image/filename'",
":",
"tf",
".",
"FixedLenFeature",
"(",
"[",
"]",
",",
"dtype",
"=",
"tf",
".",
"string",
",",
"default_value",
"=... | https://github.com/hclhkbu/dlbench/blob/978b034e9c34e6aaa38782bb1e4a2cea0c01d0f9/synthetic/experiments/tensorflow/cnn/resnet/image_processing.py#L274-L341 | |
GoogleCloudPlatform/cloudml-samples | efddc4a9898127e55edc0946557aca4bfaf59705 | tensorflow/standard/reinforcement_learning/rl_on_gcp_demo/trainer/agent.py | python | Agent.random_action | (self, observation) | Return a random action.
Given an observation return a random action.
Specifications of the action space should be given/initialized
when the agent is initialized.
Args:
observation: object, observations from the env.
Returns:
numpy.array, represent an ac... | Return a random action. | [
"Return",
"a",
"random",
"action",
"."
] | def random_action(self, observation):
"""Return a random action.
Given an observation return a random action.
Specifications of the action space should be given/initialized
when the agent is initialized.
Args:
observation: object, observations from the env.
... | [
"def",
"random_action",
"(",
"self",
",",
"observation",
")",
":",
"raise",
"NotImplementedError",
"(",
"'Not implemented'",
")"
] | https://github.com/GoogleCloudPlatform/cloudml-samples/blob/efddc4a9898127e55edc0946557aca4bfaf59705/tensorflow/standard/reinforcement_learning/rl_on_gcp_demo/trainer/agent.py#L36-L48 | ||
sao-eht/eat | 26062fe552fc304a3efc26274e8ed56ddbda323d | eat/aips/uvdata.py | python | UVFITS.make_vistable | (self, flag=True) | return outdata | Convert visibility data to a two dimentional table.
Args:
flag (boolean):
if flag=True, data with weights <= 0 or sigma <=0 will be ignored.
Returns:
uvdata.VisTable object | Convert visibility data to a two dimentional table. | [
"Convert",
"visibility",
"data",
"to",
"a",
"two",
"dimentional",
"table",
"."
] | def make_vistable(self, flag=True):
'''
Convert visibility data to a two dimentional table.
Args:
flag (boolean):
if flag=True, data with weights <= 0 or sigma <=0 will be ignored.
Returns:
uvdata.VisTable object
'''
outdata = VisTable()
... | [
"def",
"make_vistable",
"(",
"self",
",",
"flag",
"=",
"True",
")",
":",
"outdata",
"=",
"VisTable",
"(",
")",
"# Get size of data",
"Ndata",
",",
"Ndec",
",",
"Nra",
",",
"Nif",
",",
"Nch",
",",
"Nstokes",
",",
"Ncomp",
"=",
"self",
".",
"data",
"."... | https://github.com/sao-eht/eat/blob/26062fe552fc304a3efc26274e8ed56ddbda323d/eat/aips/uvdata.py#L274-L396 | |
Chaffelson/nipyapi | d3b186fd701ce308c2812746d98af9120955e810 | nipyapi/nifi/models/connection_status_predictions_snapshot_dto.py | python | ConnectionStatusPredictionsSnapshotDTO.predicted_millis_until_bytes_backpressure | (self) | return self._predicted_millis_until_bytes_backpressure | Gets the predicted_millis_until_bytes_backpressure of this ConnectionStatusPredictionsSnapshotDTO.
The predicted number of milliseconds before the connection will have backpressure applied, based on the total number of bytes in the queue.
:return: The predicted_millis_until_bytes_backpressure of this C... | Gets the predicted_millis_until_bytes_backpressure of this ConnectionStatusPredictionsSnapshotDTO.
The predicted number of milliseconds before the connection will have backpressure applied, based on the total number of bytes in the queue. | [
"Gets",
"the",
"predicted_millis_until_bytes_backpressure",
"of",
"this",
"ConnectionStatusPredictionsSnapshotDTO",
".",
"The",
"predicted",
"number",
"of",
"milliseconds",
"before",
"the",
"connection",
"will",
"have",
"backpressure",
"applied",
"based",
"on",
"the",
"to... | def predicted_millis_until_bytes_backpressure(self):
"""
Gets the predicted_millis_until_bytes_backpressure of this ConnectionStatusPredictionsSnapshotDTO.
The predicted number of milliseconds before the connection will have backpressure applied, based on the total number of bytes in the queue.
... | [
"def",
"predicted_millis_until_bytes_backpressure",
"(",
"self",
")",
":",
"return",
"self",
".",
"_predicted_millis_until_bytes_backpressure"
] | https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/nifi/models/connection_status_predictions_snapshot_dto.py#L105-L113 | |
PegasusWang/python_data_structures_and_algorithms | d42337b918593cc7d4a35f12902ffaf3bf22091b | docs/17_二叉查找树/bst.py | python | BST.__contains__ | (self, key) | return self._bst_search(self.root, key) is not None | 实现 in 操作符 | 实现 in 操作符 | [
"实现",
"in",
"操作符"
] | def __contains__(self, key):
"""实现 in 操作符"""
return self._bst_search(self.root, key) is not None | [
"def",
"__contains__",
"(",
"self",
",",
"key",
")",
":",
"return",
"self",
".",
"_bst_search",
"(",
"self",
".",
"root",
",",
"key",
")",
"is",
"not",
"None"
] | https://github.com/PegasusWang/python_data_structures_and_algorithms/blob/d42337b918593cc7d4a35f12902ffaf3bf22091b/docs/17_二叉查找树/bst.py#L41-L43 | |
DataDog/integrations-core | 934674b29d94b70ccc008f76ea172d0cdae05e1e | external_dns/datadog_checks/external_dns/config_models/defaults.py | python | instance_bearer_token_auth | (field, value) | return False | [] | def instance_bearer_token_auth(field, value):
return False | [
"def",
"instance_bearer_token_auth",
"(",
"field",
",",
"value",
")",
":",
"return",
"False"
] | https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/external_dns/datadog_checks/external_dns/config_models/defaults.py#L53-L54 | |||
rolandshoemaker/CommonMark-py | c0786fbc05eb2276c9ccc6f8d9b47c261b854155 | CommonMark/CommonMark.py | python | InlineParser.parseLink | (self, inlines) | return 0 | Attempt to parse a link. If successful, add the link to
inlines. | Attempt to parse a link. If successful, add the link to
inlines. | [
"Attempt",
"to",
"parse",
"a",
"link",
".",
"If",
"successful",
"add",
"the",
"link",
"to",
"inlines",
"."
] | def parseLink(self, inlines):
""" Attempt to parse a link. If successful, add the link to
inlines."""
startpos = self.pos
n = self.parseLinkLabel()
if n == 0:
return 0
afterlabel = self.pos
rawlabel = self.subject[startpos:n+startpos]
if se... | [
"def",
"parseLink",
"(",
"self",
",",
"inlines",
")",
":",
"startpos",
"=",
"self",
".",
"pos",
"n",
"=",
"self",
".",
"parseLinkLabel",
"(",
")",
"if",
"n",
"==",
"0",
":",
"return",
"0",
"afterlabel",
"=",
"self",
".",
"pos",
"rawlabel",
"=",
"se... | https://github.com/rolandshoemaker/CommonMark-py/blob/c0786fbc05eb2276c9ccc6f8d9b47c261b854155/CommonMark/CommonMark.py#L560-L626 | |
IronLanguages/main | a949455434b1fda8c783289e897e78a9a0caabb5 | External.LCA_RESTRICTED/Languages/CPython/27/Lib/logging/config.py | python | dictConfig | (config) | Configure logging using a dictionary. | Configure logging using a dictionary. | [
"Configure",
"logging",
"using",
"a",
"dictionary",
"."
] | def dictConfig(config):
"""Configure logging using a dictionary."""
dictConfigClass(config).configure() | [
"def",
"dictConfig",
"(",
"config",
")",
":",
"dictConfigClass",
"(",
"config",
")",
".",
"configure",
"(",
")"
] | https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/CPython/27/Lib/logging/config.py#L774-L776 | ||
CenterForOpenScience/osf.io | cc02691be017e61e2cd64f19b848b2f4c18dcc84 | scripts/embargo_registrations.py | python | should_be_embargoed | (embargo) | return (timezone.now() - embargo.initiation_date) >= settings.EMBARGO_PENDING_TIME and not embargo.is_deleted | Returns true if embargo was initiated more than 48 hours prior. | Returns true if embargo was initiated more than 48 hours prior. | [
"Returns",
"true",
"if",
"embargo",
"was",
"initiated",
"more",
"than",
"48",
"hours",
"prior",
"."
] | def should_be_embargoed(embargo):
"""Returns true if embargo was initiated more than 48 hours prior."""
return (timezone.now() - embargo.initiation_date) >= settings.EMBARGO_PENDING_TIME and not embargo.is_deleted | [
"def",
"should_be_embargoed",
"(",
"embargo",
")",
":",
"return",
"(",
"timezone",
".",
"now",
"(",
")",
"-",
"embargo",
".",
"initiation_date",
")",
">=",
"settings",
".",
"EMBARGO_PENDING_TIME",
"and",
"not",
"embargo",
".",
"is_deleted"
] | https://github.com/CenterForOpenScience/osf.io/blob/cc02691be017e61e2cd64f19b848b2f4c18dcc84/scripts/embargo_registrations.py#L89-L91 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.