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
twilio/twilio-python
6e1e811ea57a1edfadd5161ace87397c563f6915
twilio/rest/autopilot/v1/assistant/style_sheet.py
python
StyleSheetList.get
(self)
return StyleSheetContext(self._version, assistant_sid=self._solution['assistant_sid'], )
Constructs a StyleSheetContext :returns: twilio.rest.autopilot.v1.assistant.style_sheet.StyleSheetContext :rtype: twilio.rest.autopilot.v1.assistant.style_sheet.StyleSheetContext
Constructs a StyleSheetContext
[ "Constructs", "a", "StyleSheetContext" ]
def get(self): """ Constructs a StyleSheetContext :returns: twilio.rest.autopilot.v1.assistant.style_sheet.StyleSheetContext :rtype: twilio.rest.autopilot.v1.assistant.style_sheet.StyleSheetContext """ return StyleSheetContext(self._version, assistant_sid=self._solution[...
[ "def", "get", "(", "self", ")", ":", "return", "StyleSheetContext", "(", "self", ".", "_version", ",", "assistant_sid", "=", "self", ".", "_solution", "[", "'assistant_sid'", "]", ",", ")" ]
https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/autopilot/v1/assistant/style_sheet.py#L37-L44
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/matplotlib-3.0.3-py3.7-macosx-10.9-x86_64.egg/matplotlib/pyplot.py
python
show
(*args, **kw)
return _show(*args, **kw)
Display a figure. When running in ipython with its pylab mode, display all figures and return to the ipython prompt. In non-interactive mode, display all figures and block until the figures have been closed; in interactive mode it has no effect unless figures were created prior to a change from ...
Display a figure. When running in ipython with its pylab mode, display all figures and return to the ipython prompt.
[ "Display", "a", "figure", ".", "When", "running", "in", "ipython", "with", "its", "pylab", "mode", "display", "all", "figures", "and", "return", "to", "the", "ipython", "prompt", "." ]
def show(*args, **kw): """ Display a figure. When running in ipython with its pylab mode, display all figures and return to the ipython prompt. In non-interactive mode, display all figures and block until the figures have been closed; in interactive mode it has no effect unless figures were...
[ "def", "show", "(", "*", "args", ",", "*", "*", "kw", ")", ":", "global", "_show", "return", "_show", "(", "*", "args", ",", "*", "*", "kw", ")" ]
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/matplotlib-3.0.3-py3.7-macosx-10.9-x86_64.egg/matplotlib/pyplot.py#L237-L254
friends-of-freeswitch/switchio
dee6e9addcf881b2b411ec1dbb397b0acfbb78cf
switchio/models.py
python
Session.__getitem__
(self, key)
[]
def __getitem__(self, key): try: return self.events[key] except KeyError: raise KeyError("'{}' not found for session '{}'" .format(key, self.uuid))
[ "def", "__getitem__", "(", "self", ",", "key", ")", ":", "try", ":", "return", "self", ".", "events", "[", "key", "]", "except", "KeyError", ":", "raise", "KeyError", "(", "\"'{}' not found for session '{}'\"", ".", "format", "(", "key", ",", "self", ".", ...
https://github.com/friends-of-freeswitch/switchio/blob/dee6e9addcf881b2b411ec1dbb397b0acfbb78cf/switchio/models.py#L132-L137
chainer/chainercv
7159616642e0be7c5b3ef380b848e16b7e99355b
chainercv/experimental/links/model/fcis/fcis_resnet101.py
python
ResNet101Extractor.forward
(self, x)
return res4, res5
Forward the chain. Args: x (~chainer.Variable): 4D image variable.
Forward the chain.
[ "Forward", "the", "chain", "." ]
def forward(self, x): """Forward the chain. Args: x (~chainer.Variable): 4D image variable. """ with chainer.using_config('train', False): h = self.pool1(self.conv1(x)) h = self.res2(h) h.unchain_backward() h = self.res3(h) ...
[ "def", "forward", "(", "self", ",", "x", ")", ":", "with", "chainer", ".", "using_config", "(", "'train'", ",", "False", ")", ":", "h", "=", "self", ".", "pool1", "(", "self", ".", "conv1", "(", "x", ")", ")", "h", "=", "self", ".", "res2", "("...
https://github.com/chainer/chainercv/blob/7159616642e0be7c5b3ef380b848e16b7e99355b/chainercv/experimental/links/model/fcis/fcis_resnet101.py#L235-L250
Rapptz/discord.py
45d498c1b76deaf3b394d17ccf56112fa691d160
discord/user.py
python
BaseUser.colour
(self)
return Colour.default()
:class:`Colour`: A property that returns a colour denoting the rendered colour for the user. This always returns :meth:`Colour.default`. There is an alias for this named :attr:`color`.
:class:`Colour`: A property that returns a colour denoting the rendered colour for the user. This always returns :meth:`Colour.default`.
[ ":", "class", ":", "Colour", ":", "A", "property", "that", "returns", "a", "colour", "denoting", "the", "rendered", "colour", "for", "the", "user", ".", "This", "always", "returns", ":", "meth", ":", "Colour", ".", "default", "." ]
def colour(self) -> Colour: """:class:`Colour`: A property that returns a colour denoting the rendered colour for the user. This always returns :meth:`Colour.default`. There is an alias for this named :attr:`color`. """ return Colour.default()
[ "def", "colour", "(", "self", ")", "->", "Colour", ":", "return", "Colour", ".", "default", "(", ")" ]
https://github.com/Rapptz/discord.py/blob/45d498c1b76deaf3b394d17ccf56112fa691d160/discord/user.py#L220-L226
microsoft/azure-devops-python-api
451cade4c475482792cbe9e522c1fee32393139e
azure-devops/azure/devops/v6_0/gallery/gallery_client.py
python
GalleryClient.get_asset_from_edit_extension_draft
(self, publisher_name, draft_id, asset_type, extension_name, **kwargs)
return self._client.stream_download(response, callback=callback)
GetAssetFromEditExtensionDraft. [Preview API] :param str publisher_name: :param str draft_id: :param str asset_type: :param str extension_name: :rtype: object
GetAssetFromEditExtensionDraft. [Preview API] :param str publisher_name: :param str draft_id: :param str asset_type: :param str extension_name: :rtype: object
[ "GetAssetFromEditExtensionDraft", ".", "[", "Preview", "API", "]", ":", "param", "str", "publisher_name", ":", ":", "param", "str", "draft_id", ":", ":", "param", "str", "asset_type", ":", ":", "param", "str", "extension_name", ":", ":", "rtype", ":", "objec...
def get_asset_from_edit_extension_draft(self, publisher_name, draft_id, asset_type, extension_name, **kwargs): """GetAssetFromEditExtensionDraft. [Preview API] :param str publisher_name: :param str draft_id: :param str asset_type: :param str extension_name: :rtype...
[ "def", "get_asset_from_edit_extension_draft", "(", "self", ",", "publisher_name", ",", "draft_id", ",", "asset_type", ",", "extension_name", ",", "*", "*", "kwargs", ")", ":", "route_values", "=", "{", "}", "if", "publisher_name", "is", "not", "None", ":", "ro...
https://github.com/microsoft/azure-devops-python-api/blob/451cade4c475482792cbe9e522c1fee32393139e/azure-devops/azure/devops/v6_0/gallery/gallery_client.py#L666-L695
tdamdouni/Pythonista
3e082d53b6b9b501a3c8cf3251a8ad4c8be9c2ad
tasks/RobinsieblerTaskList/tasklist.py
python
TaskList.delete_task
(self, task_id)
Delete the given task. :param task_id: id of the task to delete
Delete the given task.
[ "Delete", "the", "given", "task", "." ]
def delete_task(self, task_id): """Delete the given task. :param task_id: id of the task to delete """ task = self._find_task(task_id) if task: self.tasks.remove(task)
[ "def", "delete_task", "(", "self", ",", "task_id", ")", ":", "task", "=", "self", ".", "_find_task", "(", "task_id", ")", "if", "task", ":", "self", ".", "tasks", ".", "remove", "(", "task", ")" ]
https://github.com/tdamdouni/Pythonista/blob/3e082d53b6b9b501a3c8cf3251a8ad4c8be9c2ad/tasks/RobinsieblerTaskList/tasklist.py#L62-L70
IronLanguages/ironpython2
51fdedeeda15727717fb8268a805f71b06c0b9f1
Src/StdLib/Lib/email/iterators.py
python
typed_subpart_iterator
(msg, maintype='text', subtype=None)
Iterate over the subparts with a given MIME type. Use `maintype' as the main MIME type to match against; this defaults to "text". Optional `subtype' is the MIME subtype to match against; if omitted, only the main type is matched.
Iterate over the subparts with a given MIME type.
[ "Iterate", "over", "the", "subparts", "with", "a", "given", "MIME", "type", "." ]
def typed_subpart_iterator(msg, maintype='text', subtype=None): """Iterate over the subparts with a given MIME type. Use `maintype' as the main MIME type to match against; this defaults to "text". Optional `subtype' is the MIME subtype to match against; if omitted, only the main type is matched. "...
[ "def", "typed_subpart_iterator", "(", "msg", ",", "maintype", "=", "'text'", ",", "subtype", "=", "None", ")", ":", "for", "subpart", "in", "msg", ".", "walk", "(", ")", ":", "if", "subpart", ".", "get_content_maintype", "(", ")", "==", "maintype", ":", ...
https://github.com/IronLanguages/ironpython2/blob/51fdedeeda15727717fb8268a805f71b06c0b9f1/Src/StdLib/Lib/email/iterators.py#L47-L57
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/apps/app_manager/views/cli.py
python
list_apps
(request, domain)
return JsonResponse({ 'status': 'success', 'applications': list(map(app_to_json, applications)), })
[]
def list_apps(request, domain): def app_to_json(app): return { 'name': app.name, 'version': app.version, 'app_id': app.get_id, 'download_url': absolute_reverse('direct_ccz', args=[domain], params={'app_id': app.get_...
[ "def", "list_apps", "(", "request", ",", "domain", ")", ":", "def", "app_to_json", "(", "app", ")", ":", "return", "{", "'name'", ":", "app", ".", "name", ",", "'version'", ":", "app", ".", "version", ",", "'app_id'", ":", "app", ".", "get_id", ",", ...
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/app_manager/views/cli.py#L28-L41
SublimeText/ColdFusion
dbe2f76038fe77fe90b4cc4a0651aa817f14f1a3
taglib/cf9.py
python
tags.__init__
(self)
[]
def __init__(self): super(tags, self).__init__() self.completions['cfapplication'] = { 'completions': [ ("name\t@name", "name=\"$1\"$0"), ("loginstorage\t@loginstorage", "loginstorage=\"$1\"$0"), ("loginstorage=\"cookie\"\tloginstorage", "loginstorage=\"${1:cookie}\"$0"), ("loginstorage=\"session...
[ "def", "__init__", "(", "self", ")", ":", "super", "(", "tags", ",", "self", ")", ".", "__init__", "(", ")", "self", ".", "completions", "[", "'cfapplication'", "]", "=", "{", "'completions'", ":", "[", "(", "\"name\\t@name\"", ",", "\"name=\\\"$1\\\"$0\""...
https://github.com/SublimeText/ColdFusion/blob/dbe2f76038fe77fe90b4cc4a0651aa817f14f1a3/taglib/cf9.py#L3-L2714
carbonblack/cbapi-python
24d677ffd99aee911c2c76ecb5528e4e9320c7cc
src/cbapi/psc/threathunter/models.py
python
Process._query_implementation
(cls, cb)
return AsyncProcessQuery(cls, cb)
[]
def _query_implementation(cls, cb): # This will emulate a synchronous process query, for now. return AsyncProcessQuery(cls, cb)
[ "def", "_query_implementation", "(", "cls", ",", "cb", ")", ":", "# This will emulate a synchronous process query, for now.", "return", "AsyncProcessQuery", "(", "cls", ",", "cb", ")" ]
https://github.com/carbonblack/cbapi-python/blob/24d677ffd99aee911c2c76ecb5528e4e9320c7cc/src/cbapi/psc/threathunter/models.py#L48-L50
Azure/azure-devops-cli-extension
11334cd55806bef0b99c3bee5a438eed71e44037
azure-devops/azext_devops/devops_sdk/v6_0/build/build_client.py
python
BuildClient.get_artifact
(self, project, build_id, artifact_name)
return self._deserialize('BuildArtifact', response)
GetArtifact. [Preview API] Gets a specific artifact for a build. :param str project: Project ID or project name :param int build_id: The ID of the build. :param str artifact_name: The name of the artifact. :rtype: :class:`<BuildArtifact> <azure.devops.v6_0.build.models.BuildArtif...
GetArtifact. [Preview API] Gets a specific artifact for a build. :param str project: Project ID or project name :param int build_id: The ID of the build. :param str artifact_name: The name of the artifact. :rtype: :class:`<BuildArtifact> <azure.devops.v6_0.build.models.BuildArtif...
[ "GetArtifact", ".", "[", "Preview", "API", "]", "Gets", "a", "specific", "artifact", "for", "a", "build", ".", ":", "param", "str", "project", ":", "Project", "ID", "or", "project", "name", ":", "param", "int", "build_id", ":", "The", "ID", "of", "the"...
def get_artifact(self, project, build_id, artifact_name): """GetArtifact. [Preview API] Gets a specific artifact for a build. :param str project: Project ID or project name :param int build_id: The ID of the build. :param str artifact_name: The name of the artifact. :rtyp...
[ "def", "get_artifact", "(", "self", ",", "project", ",", "build_id", ",", "artifact_name", ")", ":", "route_values", "=", "{", "}", "if", "project", "is", "not", "None", ":", "route_values", "[", "'project'", "]", "=", "self", ".", "_serialize", ".", "ur...
https://github.com/Azure/azure-devops-cli-extension/blob/11334cd55806bef0b99c3bee5a438eed71e44037/azure-devops/azext_devops/devops_sdk/v6_0/build/build_client.py#L49-L70
tomplus/kubernetes_asyncio
f028cc793e3a2c519be6a52a49fb77ff0b014c9b
kubernetes_asyncio/client/api/policy_v1beta1_api.py
python
PolicyV1beta1Api.delete_collection_namespaced_pod_disruption_budget_with_http_info
(self, namespace, **kwargs)
return self.api_client.call_api( '/apis/policy/v1beta1/namespaces/{namespace}/poddisruptionbudgets', 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, respo...
delete_collection_namespaced_pod_disruption_budget # noqa: E501 delete collection of PodDisruptionBudget # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.delete_collection_namespaced...
delete_collection_namespaced_pod_disruption_budget # noqa: E501
[ "delete_collection_namespaced_pod_disruption_budget", "#", "noqa", ":", "E501" ]
def delete_collection_namespaced_pod_disruption_budget_with_http_info(self, namespace, **kwargs): # noqa: E501 """delete_collection_namespaced_pod_disruption_budget # noqa: E501 delete collection of PodDisruptionBudget # noqa: E501 This method makes a synchronous HTTP request by default. To ...
[ "def", "delete_collection_namespaced_pod_disruption_budget_with_http_info", "(", "self", ",", "namespace", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "local_var_params", "=", "locals", "(", ")", "all_params", "=", "[", "'namespace'", ",", "'pretty'", ",", "'...
https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/api/policy_v1beta1_api.py#L344-L483
JaniceWuo/MovieRecommend
4c86db64ca45598917d304f535413df3bc9fea65
movierecommend/venv1/Lib/site-packages/django/contrib/sessions/backends/base.py
python
SessionBase.decode
(self, session_data)
[]
def decode(self, session_data): encoded_data = base64.b64decode(force_bytes(session_data)) try: # could produce ValueError if there is no ':' hash, serialized = encoded_data.split(b':', 1) expected_hash = self._hash(serialized) if not constant_time_compare...
[ "def", "decode", "(", "self", ",", "session_data", ")", ":", "encoded_data", "=", "base64", ".", "b64decode", "(", "force_bytes", "(", "session_data", ")", ")", "try", ":", "# could produce ValueError if there is no ':'", "hash", ",", "serialized", "=", "encoded_d...
https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/django/contrib/sessions/backends/base.py#L102-L118
theotherp/nzbhydra
4b03d7f769384b97dfc60dade4806c0fc987514e
libs/site.py
python
setquit
()
Define new builtins 'quit' and 'exit'. These are objects which make the interpreter exit when called. The repr of each object contains a hint at how it works.
Define new builtins 'quit' and 'exit'.
[ "Define", "new", "builtins", "quit", "and", "exit", "." ]
def setquit(): """Define new builtins 'quit' and 'exit'. These are objects which make the interpreter exit when called. The repr of each object contains a hint at how it works. """ if os.sep == ':': eof = 'Cmd-Q' elif os.sep == '\\': eof = 'Ctrl-Z plus Return' else: ...
[ "def", "setquit", "(", ")", ":", "if", "os", ".", "sep", "==", "':'", ":", "eof", "=", "'Cmd-Q'", "elif", "os", ".", "sep", "==", "'\\\\'", ":", "eof", "=", "'Ctrl-Z plus Return'", "else", ":", "eof", "=", "'Ctrl-D (i.e. EOF)'", "class", "Quitter", "("...
https://github.com/theotherp/nzbhydra/blob/4b03d7f769384b97dfc60dade4806c0fc987514e/libs/site.py#L334-L362
mozilla/PyPOM
9cb84df9d27b428b4e7423d1bbe6502e92990154
src/pypom/view.py
python
WebView.selenium
(self)
return self.driver
Backwards compatibility attribute
Backwards compatibility attribute
[ "Backwards", "compatibility", "attribute" ]
def selenium(self): """Backwards compatibility attribute""" warn("use driver instead", DeprecationWarning, stacklevel=2) return self.driver
[ "def", "selenium", "(", "self", ")", ":", "warn", "(", "\"use driver instead\"", ",", "DeprecationWarning", ",", "stacklevel", "=", "2", ")", "return", "self", ".", "driver" ]
https://github.com/mozilla/PyPOM/blob/9cb84df9d27b428b4e7423d1bbe6502e92990154/src/pypom/view.py#L28-L31
JinpengLI/deep_ocr
450148c0c51b3565a96ac2f3c94ee33022e55307
deep_ocr/ocrolib/common.py
python
glob_all
(args)
return result
Given a list of command line arguments, expand all of them with glob.
Given a list of command line arguments, expand all of them with glob.
[ "Given", "a", "list", "of", "command", "line", "arguments", "expand", "all", "of", "them", "with", "glob", "." ]
def glob_all(args): """Given a list of command line arguments, expand all of them with glob.""" result = [] for arg in args: if arg[0]=="@": with open(arg[1:],"r") as stream: expanded = stream.read().split("\n") expanded = [s for s in expanded if s!=""] ...
[ "def", "glob_all", "(", "args", ")", ":", "result", "=", "[", "]", "for", "arg", "in", "args", ":", "if", "arg", "[", "0", "]", "==", "\"@\"", ":", "with", "open", "(", "arg", "[", "1", ":", "]", ",", "\"r\"", ")", "as", "stream", ":", "expan...
https://github.com/JinpengLI/deep_ocr/blob/450148c0c51b3565a96ac2f3c94ee33022e55307/deep_ocr/ocrolib/common.py#L562-L575
seleniumbase/SeleniumBase
0d1de7238bfafe4b7309fec6f735dcd0dc4538a8
seleniumbase/fixtures/base_case.py
python
BaseCase.deferred_assert_exact_text
( self, text, selector="html", by=By.CSS_SELECTOR, timeout=None )
A non-terminating assertion for exact text from an element. Failures will be saved until the process_deferred_asserts() method is called from inside a test, likely at the end of it.
A non-terminating assertion for exact text from an element. Failures will be saved until the process_deferred_asserts() method is called from inside a test, likely at the end of it.
[ "A", "non", "-", "terminating", "assertion", "for", "exact", "text", "from", "an", "element", ".", "Failures", "will", "be", "saved", "until", "the", "process_deferred_asserts", "()", "method", "is", "called", "from", "inside", "a", "test", "likely", "at", "...
def deferred_assert_exact_text( self, text, selector="html", by=By.CSS_SELECTOR, timeout=None ): """A non-terminating assertion for exact text from an element. Failures will be saved until the process_deferred_asserts() method is called from inside a test, likely at the end of it."""...
[ "def", "deferred_assert_exact_text", "(", "self", ",", "text", ",", "selector", "=", "\"html\"", ",", "by", "=", "By", ".", "CSS_SELECTOR", ",", "timeout", "=", "None", ")", ":", "self", ".", "__check_scope", "(", ")", "if", "not", "timeout", ":", "timeo...
https://github.com/seleniumbase/SeleniumBase/blob/0d1de7238bfafe4b7309fec6f735dcd0dc4538a8/seleniumbase/fixtures/base_case.py#L10129-L10156
RTIInternational/gobbli
d9ec8132f74ce49dc4bead2fad25b661bcef6e76
gobbli/model/bert/src/modeling.py
python
get_shape_list
(tensor, expected_rank=None, name=None)
return shape
Returns a list of the shape of tensor, preferring static dimensions. Args: tensor: A tf.Tensor object to find the shape of. expected_rank: (optional) int. The expected rank of `tensor`. If this is specified and the `tensor` has a different rank, and exception will be thrown. name: Optional na...
Returns a list of the shape of tensor, preferring static dimensions.
[ "Returns", "a", "list", "of", "the", "shape", "of", "tensor", "preferring", "static", "dimensions", "." ]
def get_shape_list(tensor, expected_rank=None, name=None): """Returns a list of the shape of tensor, preferring static dimensions. Args: tensor: A tf.Tensor object to find the shape of. expected_rank: (optional) int. The expected rank of `tensor`. If this is specified and the `tensor` has a different...
[ "def", "get_shape_list", "(", "tensor", ",", "expected_rank", "=", "None", ",", "name", "=", "None", ")", ":", "if", "name", "is", "None", ":", "name", "=", "tensor", ".", "name", "if", "expected_rank", "is", "not", "None", ":", "assert_rank", "(", "te...
https://github.com/RTIInternational/gobbli/blob/d9ec8132f74ce49dc4bead2fad25b661bcef6e76/gobbli/model/bert/src/modeling.py#L895-L929
1040003585/WebScrapingWithPython
a770fa5b03894076c8c9539b1ffff34424ffc016
portia_examle/lib/python2.7/locale.py
python
getdefaultlocale
(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE'))
return _parse_localename(localename)
Tries to determine the default locale settings and returns them as tuple (language code, encoding). According to POSIX, a program which has not called setlocale(LC_ALL, "") runs using the portable 'C' locale. Calling setlocale(LC_ALL, "") lets it use the default locale as define...
Tries to determine the default locale settings and returns them as tuple (language code, encoding).
[ "Tries", "to", "determine", "the", "default", "locale", "settings", "and", "returns", "them", "as", "tuple", "(", "language", "code", "encoding", ")", "." ]
def getdefaultlocale(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE')): """ Tries to determine the default locale settings and returns them as tuple (language code, encoding). According to POSIX, a program which has not called setlocale(LC_ALL, "") runs using the portable 'C' locale. ...
[ "def", "getdefaultlocale", "(", "envvars", "=", "(", "'LC_ALL'", ",", "'LC_CTYPE'", ",", "'LANG'", ",", "'LANGUAGE'", ")", ")", ":", "try", ":", "# check if it's supported by the _locale module", "import", "_locale", "code", ",", "encoding", "=", "_locale", ".", ...
https://github.com/1040003585/WebScrapingWithPython/blob/a770fa5b03894076c8c9539b1ffff34424ffc016/portia_examle/lib/python2.7/locale.py#L495-L545
PaddlePaddle/PaddleDetection
635e3e0a80f3d05751cdcfca8af04ee17c601a92
static/ppdet/data/parallel_map.py
python
ParallelMap.stop
(self)
notify to exit
notify to exit
[ "notify", "to", "exit" ]
def stop(self): """ notify to exit """ self._exit = True self._feeding_ev.set() for _ in range(len(self._consumers)): self._inq.put(EndSignal(0, "notify consumers to exit"))
[ "def", "stop", "(", "self", ")", ":", "self", ".", "_exit", "=", "True", "self", ".", "_feeding_ev", ".", "set", "(", ")", "for", "_", "in", "range", "(", "len", "(", "self", ".", "_consumers", ")", ")", ":", "self", ".", "_inq", ".", "put", "(...
https://github.com/PaddlePaddle/PaddleDetection/blob/635e3e0a80f3d05751cdcfca8af04ee17c601a92/static/ppdet/data/parallel_map.py#L194-L200
translate/pootle
742c08fce1a0dc16e6ab8d2494eb867c8879205d
docs/server/apache-wsgi.py
python
application
(environ, start_response)
return _wsgi_application(environ, start_response)
Wrapper for Django's WSGIHandler(). This allows to get values specified by SetEnv in the Apache configuration or interpose other changes to that environment, like installing middleware.
Wrapper for Django's WSGIHandler().
[ "Wrapper", "for", "Django", "s", "WSGIHandler", "()", "." ]
def application(environ, start_response): """Wrapper for Django's WSGIHandler(). This allows to get values specified by SetEnv in the Apache configuration or interpose other changes to that environment, like installing middleware. """ try: os.environ['POOTLE_SETTINGS'] = environ['POOTLE...
[ "def", "application", "(", "environ", ",", "start_response", ")", ":", "try", ":", "os", ".", "environ", "[", "'POOTLE_SETTINGS'", "]", "=", "environ", "[", "'POOTLE_SETTINGS'", "]", "except", "KeyError", ":", "pass", "from", "django", ".", "core", ".", "w...
https://github.com/translate/pootle/blob/742c08fce1a0dc16e6ab8d2494eb867c8879205d/docs/server/apache-wsgi.py#L38-L52
jython/jython3
def4f8ec47cb7a9c799ea4c745f12badf92c5769
lib-python/3.5.1/tkinter/ttk.py
python
Notebook.__init__
(self, master=None, **kw)
Construct a Ttk Notebook with parent master. STANDARD OPTIONS class, cursor, style, takefocus WIDGET-SPECIFIC OPTIONS height, padding, width TAB OPTIONS state, sticky, padding, text, image, compound, underline TAB IDENTIFIERS (tab_id) ...
Construct a Ttk Notebook with parent master.
[ "Construct", "a", "Ttk", "Notebook", "with", "parent", "master", "." ]
def __init__(self, master=None, **kw): """Construct a Ttk Notebook with parent master. STANDARD OPTIONS class, cursor, style, takefocus WIDGET-SPECIFIC OPTIONS height, padding, width TAB OPTIONS state, sticky, padding, text, image, compound, unde...
[ "def", "__init__", "(", "self", ",", "master", "=", "None", ",", "*", "*", "kw", ")", ":", "Widget", ".", "__init__", "(", "self", ",", "master", ",", "\"ttk::notebook\"", ",", "kw", ")" ]
https://github.com/jython/jython3/blob/def4f8ec47cb7a9c799ea4c745f12badf92c5769/lib-python/3.5.1/tkinter/ttk.py#L803-L832
sidewalklabs/s2sphere
d1d067e8c06e5fbaf0cc0158bade947b4a03a438
s2sphere/sphere.py
python
RegionCoverer.__max_children_shift
(self)
return 2 * self.__level_mod
[]
def __max_children_shift(self): return 2 * self.__level_mod
[ "def", "__max_children_shift", "(", "self", ")", ":", "return", "2", "*", "self", ".", "__level_mod" ]
https://github.com/sidewalklabs/s2sphere/blob/d1d067e8c06e5fbaf0cc0158bade947b4a03a438/s2sphere/sphere.py#L2943-L2944
openstack/manila
142990edc027e14839d5deaf4954dd6fc88de15e
manila/api/views/services.py
python
ViewBuilder.summary
(self, service)
return {key: service.get(key) for key in keys}
Summary view of a single service.
Summary view of a single service.
[ "Summary", "view", "of", "a", "single", "service", "." ]
def summary(self, service): """Summary view of a single service.""" keys = 'host', 'binary', 'disabled' return {key: service.get(key) for key in keys}
[ "def", "summary", "(", "self", ",", "service", ")", ":", "keys", "=", "'host'", ",", "'binary'", ",", "'disabled'", "return", "{", "key", ":", "service", ".", "get", "(", "key", ")", "for", "key", "in", "keys", "}" ]
https://github.com/openstack/manila/blob/142990edc027e14839d5deaf4954dd6fc88de15e/manila/api/views/services.py#L23-L26
edisonlz/fastor
342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3
base/site-packages/notification/lockfile.py
python
LockBase.__enter__
(self)
return self
Context manager support.
Context manager support.
[ "Context", "manager", "support", "." ]
def __enter__(self): """ Context manager support. """ self.acquire() return self
[ "def", "__enter__", "(", "self", ")", ":", "self", ".", "acquire", "(", ")", "return", "self" ]
https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/notification/lockfile.py#L221-L226
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/lib-python/3/turtle.py
python
TurtleScreenBase._drawline
(self, lineitem, coordlist=None, fill=None, width=None, top=False)
Configure lineitem according to provided arguments: coordlist is sequence of coordinates fill is drawing color width is width of drawn line. top is a boolean value, which specifies if polyitem will be put on top of the canvas' displaylist so it will not be covered by othe...
Configure lineitem according to provided arguments: coordlist is sequence of coordinates fill is drawing color width is width of drawn line. top is a boolean value, which specifies if polyitem will be put on top of the canvas' displaylist so it will not be covered by othe...
[ "Configure", "lineitem", "according", "to", "provided", "arguments", ":", "coordlist", "is", "sequence", "of", "coordinates", "fill", "is", "drawing", "color", "width", "is", "width", "of", "drawn", "line", ".", "top", "is", "a", "boolean", "value", "which", ...
def _drawline(self, lineitem, coordlist=None, fill=None, width=None, top=False): """Configure lineitem according to provided arguments: coordlist is sequence of coordinates fill is drawing color width is width of drawn line. top is a boolean value, which specifi...
[ "def", "_drawline", "(", "self", ",", "lineitem", ",", "coordlist", "=", "None", ",", "fill", "=", "None", ",", "width", "=", "None", ",", "top", "=", "False", ")", ":", "if", "coordlist", "is", "not", "None", ":", "cl", "=", "[", "]", "for", "x"...
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/turtle.py#L530-L551
Kozea/WeasyPrint
6cce2978165134e37683cb5b3d156cac6a11a7f9
weasyprint/layout/preferred.py
python
min_max
(box, width)
return max(min_width, min(width, max_width))
Get box width from given width and box min- and max-widths.
Get box width from given width and box min- and max-widths.
[ "Get", "box", "width", "from", "given", "width", "and", "box", "min", "-", "and", "max", "-", "widths", "." ]
def min_max(box, width): """Get box width from given width and box min- and max-widths.""" min_width = box.style['min_width'] max_width = box.style['max_width'] if min_width == 'auto' or min_width.unit == '%': min_width = 0 else: min_width = min_width.value if max_width == 'auto'...
[ "def", "min_max", "(", "box", ",", "width", ")", ":", "min_width", "=", "box", ".", "style", "[", "'min_width'", "]", "max_width", "=", "box", ".", "style", "[", "'max_width'", "]", "if", "min_width", "==", "'auto'", "or", "min_width", ".", "unit", "==...
https://github.com/Kozea/WeasyPrint/blob/6cce2978165134e37683cb5b3d156cac6a11a7f9/weasyprint/layout/preferred.py#L108-L132
IJDykeman/wangTiles
7c1ee2095ebdf7f72bce07d94c6484915d5cae8b
experimental_code/tiles_3d/venv_mac/lib/python2.7/site-packages/pkg_resources/_vendor/packaging/_compat.py
python
with_metaclass
(meta, *bases)
return type.__new__(metaclass, 'temporary_class', (), {})
Create a base class with a metaclass.
Create a base class with a metaclass.
[ "Create", "a", "base", "class", "with", "a", "metaclass", "." ]
def with_metaclass(meta, *bases): """ Create a base class with a metaclass. """ # This requires a bit of explanation: the basic idea is to make a dummy # metaclass for one level of class instantiation that replaces itself with # the actual metaclass. class metaclass(meta): def __new_...
[ "def", "with_metaclass", "(", "meta", ",", "*", "bases", ")", ":", "# This requires a bit of explanation: the basic idea is to make a dummy", "# metaclass for one level of class instantiation that replaces itself with", "# the actual metaclass.", "class", "metaclass", "(", "meta", ")...
https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/tiles_3d/venv_mac/lib/python2.7/site-packages/pkg_resources/_vendor/packaging/_compat.py#L20-L30
dickreuter/neuron_poker
9f841e5aeead681fa1fb2955524c53081fba2078
agents/agent_keras_rl_dqn.py
python
Player.initiate_agent
(self, env)
initiate a deep Q agent
initiate a deep Q agent
[ "initiate", "a", "deep", "Q", "agent" ]
def initiate_agent(self, env): """initiate a deep Q agent""" tf.compat.v1.disable_eager_execution() self.env = env nb_actions = self.env.action_space.n self.model = Sequential() self.model.add(Dense(512, activation='relu', input_shape=env.observation_space)) se...
[ "def", "initiate_agent", "(", "self", ",", "env", ")", ":", "tf", ".", "compat", ".", "v1", ".", "disable_eager_execution", "(", ")", "self", ".", "env", "=", "env", "nb_actions", "=", "self", ".", "env", ".", "action_space", ".", "n", "self", ".", "...
https://github.com/dickreuter/neuron_poker/blob/9f841e5aeead681fa1fb2955524c53081fba2078/agents/agent_keras_rl_dqn.py#L56-L84
yongzhuo/Keras-TextClassification
640e3f44f90d9d8046546f7e1a93a29ebe5c8d30
keras_textclassification/data_preprocess/text_preprocess.py
python
get_ngram
(text, ns=[1])
return ngrams
获取文本的ngram等特征 :param text: str :return: list
获取文本的ngram等特征 :param text: str :return: list
[ "获取文本的ngram等特征", ":", "param", "text", ":", "str", ":", "return", ":", "list" ]
def get_ngram(text, ns=[1]): """ 获取文本的ngram等特征 :param text: str :return: list """ if type(ns) != list: raise RuntimeError("ns of function get_ngram() must be list!") for n in ns: if n < 1: raise RuntimeError("enum of ns must '>1'!") len_text = len(text) ...
[ "def", "get_ngram", "(", "text", ",", "ns", "=", "[", "1", "]", ")", ":", "if", "type", "(", "ns", ")", "!=", "list", ":", "raise", "RuntimeError", "(", "\"ns of function get_ngram() must be list!\"", ")", "for", "n", "in", "ns", ":", "if", "n", "<", ...
https://github.com/yongzhuo/Keras-TextClassification/blob/640e3f44f90d9d8046546f7e1a93a29ebe5c8d30/keras_textclassification/data_preprocess/text_preprocess.py#L157-L180
tdamdouni/Pythonista
3e082d53b6b9b501a3c8cf3251a8ad4c8be9c2ad
markdown/markdown2pdf/reportlab/graphics/charts/axes.py
python
sample5d
()
return drawing
Sample drawing, xvalue/yvalue axes, y connected at left of x.
Sample drawing, xvalue/yvalue axes, y connected at left of x.
[ "Sample", "drawing", "xvalue", "/", "yvalue", "axes", "y", "connected", "at", "left", "of", "x", "." ]
def sample5d(): "Sample drawing, xvalue/yvalue axes, y connected at left of x." drawing = Drawing(400, 200) data = [(10, 20, 30, 42)] xAxis = XValueAxis() xAxis.setPosition(50, 50, 300) xAxis.configure(data) yAxis = YValueAxis() yAxis.setPosition(50, 50, 125) yAxis.joinAxis = xAxis ...
[ "def", "sample5d", "(", ")", ":", "drawing", "=", "Drawing", "(", "400", ",", "200", ")", "data", "=", "[", "(", "10", ",", "20", ",", "30", ",", "42", ")", "]", "xAxis", "=", "XValueAxis", "(", ")", "xAxis", ".", "setPosition", "(", "50", ",",...
https://github.com/tdamdouni/Pythonista/blob/3e082d53b6b9b501a3c8cf3251a8ad4c8be9c2ad/markdown/markdown2pdf/reportlab/graphics/charts/axes.py#L2165-L2179
lovelylain/pyctp
fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d
futures2/ctp/__init__.py
python
MdApi.OnFrontConnected
(self)
当客户端与交易后台建立起通信连接时(还未登录前),该方法被调用。
当客户端与交易后台建立起通信连接时(还未登录前),该方法被调用。
[ "当客户端与交易后台建立起通信连接时(还未登录前),该方法被调用。" ]
def OnFrontConnected(self): """当客户端与交易后台建立起通信连接时(还未登录前),该方法被调用。"""
[ "def", "OnFrontConnected", "(", "self", ")", ":" ]
https://github.com/lovelylain/pyctp/blob/fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d/futures2/ctp/__init__.py#L109-L110
syrusakbary/Flask-SuperAdmin
e325e57e0c96a195f4e3bc932c19670968661531
flask_superadmin/contrib/fileadmin.py
python
FileAdmin.__init__
(self, base_path, base_url, name=None, category=None, endpoint=None, url=None)
Constructor. `base_path` Base file storage location `base_url` Base URL for the files `name` Name of this view. If not provided, will be defaulted to the class name. `category` View category ...
Constructor.
[ "Constructor", "." ]
def __init__(self, base_path, base_url, name=None, category=None, endpoint=None, url=None): """ Constructor. `base_path` Base file storage location `base_url` Base URL for the files `name` Name of t...
[ "def", "__init__", "(", "self", ",", "base_path", ",", "base_url", ",", "name", "=", "None", ",", "category", "=", "None", ",", "endpoint", "=", "None", ",", "url", "=", "None", ")", ":", "self", ".", "base_path", "=", "base_path", "self", ".", "base...
https://github.com/syrusakbary/Flask-SuperAdmin/blob/e325e57e0c96a195f4e3bc932c19670968661531/flask_superadmin/contrib/fileadmin.py#L135-L164
airbnb/streamalert
26cf1d08432ca285fd4f7410511a6198ca104bbb
streamalert/rule_promotion/promoter.py
python
RulePromoter._update_alert_count
(self)
Transform Athena query results into alert counts for rules_engine Args: query (str): Athena query to run and wait for results Returns: dict: Representation of alert counts, where key is the rule name and value is the alert count (int) since this rule was staged
Transform Athena query results into alert counts for rules_engine
[ "Transform", "Athena", "query", "results", "into", "alert", "counts", "for", "rules_engine" ]
def _update_alert_count(self): """Transform Athena query results into alert counts for rules_engine Args: query (str): Athena query to run and wait for results Returns: dict: Representation of alert counts, where key is the rule name and value is the ale...
[ "def", "_update_alert_count", "(", "self", ")", ":", "query", "=", "StagingStatistic", ".", "construct_compound_count_query", "(", "list", "(", "self", ".", "_staging_stats", ".", "values", "(", ")", ")", ")", "LOGGER", ".", "debug", "(", "'Running compound quer...
https://github.com/airbnb/streamalert/blob/26cf1d08432ca285fd4f7410511a6198ca104bbb/streamalert/rule_promotion/promoter.py#L85-L107
jgagneastro/coffeegrindsize
22661ebd21831dba4cf32bfc6ba59fe3d49f879c
App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/numpy/fft/fftpack.py
python
fft2
(a, s=None, axes=(-2, -1), norm=None)
return _raw_fftnd(a, s, axes, fft, norm)
Compute the 2-dimensional discrete Fourier Transform This function computes the *n*-dimensional discrete Fourier Transform over any axes in an *M*-dimensional array by means of the Fast Fourier Transform (FFT). By default, the transform is computed over the last two axes of the input array, i.e., a 2-...
Compute the 2-dimensional discrete Fourier Transform
[ "Compute", "the", "2", "-", "dimensional", "discrete", "Fourier", "Transform" ]
def fft2(a, s=None, axes=(-2, -1), norm=None): """ Compute the 2-dimensional discrete Fourier Transform This function computes the *n*-dimensional discrete Fourier Transform over any axes in an *M*-dimensional array by means of the Fast Fourier Transform (FFT). By default, the transform is compute...
[ "def", "fft2", "(", "a", ",", "s", "=", "None", ",", "axes", "=", "(", "-", "2", ",", "-", "1", ")", ",", "norm", "=", "None", ")", ":", "return", "_raw_fftnd", "(", "a", ",", "s", ",", "axes", ",", "fft", ",", "norm", ")" ]
https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/numpy/fft/fftpack.py#L863-L950
wger-project/wger
3a17a2cf133d242d1f8c357faa53cf675a7b3223
wger/manager/views/ical.py
python
get_calendar
()
return calendar
Creates and returns a calendar object :return: Calendar
Creates and returns a calendar object
[ "Creates", "and", "returns", "a", "calendar", "object" ]
def get_calendar(): """ Creates and returns a calendar object :return: Calendar """ calendar = Calendar() calendar.add('prodid', '-//wger Workout Manager//wger.de//') calendar.add('version', get_version()) return calendar
[ "def", "get_calendar", "(", ")", ":", "calendar", "=", "Calendar", "(", ")", "calendar", ".", "add", "(", "'prodid'", ",", "'-//wger Workout Manager//wger.de//'", ")", "calendar", ".", "add", "(", "'version'", ",", "get_version", "(", ")", ")", "return", "ca...
https://github.com/wger-project/wger/blob/3a17a2cf133d242d1f8c357faa53cf675a7b3223/wger/manager/views/ical.py#L63-L72
tensorflow/lattice
784eca50cbdfedf39f183cc7d298c9fe376b69c0
tensorflow_lattice/python/pwl_calibration_layer.py
python
PWLCalibrationConstraints.__init__
( self, monotonicity="none", convexity="none", lengths=None, output_min=None, output_max=None, output_min_constraints=pwl_calibration_lib.BoundConstraintsType.NONE, output_max_constraints=pwl_calibration_lib.BoundConstraintsType.NONE, num_projection_iterations=8)
Initializes an instance of `PWLCalibration`. Args: monotonicity: Same meaning as corresponding parameter of `PWLCalibration`. convexity: Same meaning as corresponding parameter of `PWLCalibration`. lengths: Lengths of pieces of piecewise linear function. Needed only if convexity is specif...
Initializes an instance of `PWLCalibration`.
[ "Initializes", "an", "instance", "of", "PWLCalibration", "." ]
def __init__( self, monotonicity="none", convexity="none", lengths=None, output_min=None, output_max=None, output_min_constraints=pwl_calibration_lib.BoundConstraintsType.NONE, output_max_constraints=pwl_calibration_lib.BoundConstraintsType.NONE, num_projection_iter...
[ "def", "__init__", "(", "self", ",", "monotonicity", "=", "\"none\"", ",", "convexity", "=", "\"none\"", ",", "lengths", "=", "None", ",", "output_min", "=", "None", ",", "output_max", "=", "None", ",", "output_min_constraints", "=", "pwl_calibration_lib", "."...
https://github.com/tensorflow/lattice/blob/784eca50cbdfedf39f183cc7d298c9fe376b69c0/tensorflow_lattice/python/pwl_calibration_layer.py#L693-L744
SebKuzminsky/pycam
55e3129f518e470040e79bb00515b4bfcf36c172
pycam/Toolpath/__init__.py
python
Toolpath.maxz
(self)
return self._maxz
[]
def maxz(self): if self._maxz is None: self._maxz = self._get_limit_generic(2, max) return self._maxz
[ "def", "maxz", "(", "self", ")", ":", "if", "self", ".", "_maxz", "is", "None", ":", "self", ".", "_maxz", "=", "self", ".", "_get_limit_generic", "(", "2", ",", "max", ")", "return", "self", ".", "_maxz" ]
https://github.com/SebKuzminsky/pycam/blob/55e3129f518e470040e79bb00515b4bfcf36c172/pycam/Toolpath/__init__.py#L169-L172
chenxuuu/24h-raspberry-live-on-bilibili
09feeb3350a64d9f1c4706c54038ed90462ffe8d
bilibiliClient.py
python
bilibiliClient.SendSocketData
(self, packetlength, magic, ver, action, param, body)
[]
async def SendSocketData(self, packetlength, magic, ver, action, param, body): bytearr = body.encode('utf-8') if packetlength == 0: packetlength = len(bytearr) + 16 sendbytes = pack('!IHHII', packetlength, magic, ver, action, param) if len(bytearr) != 0: sendbytes...
[ "async", "def", "SendSocketData", "(", "self", ",", "packetlength", ",", "magic", ",", "ver", ",", "action", ",", "param", ",", "body", ")", ":", "bytearr", "=", "body", ".", "encode", "(", "'utf-8'", ")", "if", "packetlength", "==", "0", ":", "packetl...
https://github.com/chenxuuu/24h-raspberry-live-on-bilibili/blob/09feeb3350a64d9f1c4706c54038ed90462ffe8d/bilibiliClient.py#L79-L87
Rudrabha/Lip2Wav
95d923f130e4cce93fdffbf67d2ec2d66eef933a
synthesizer/models/modules.py
python
ZoneoutLSTMCell.__init__
(self, num_units, is_training, zoneout_factor_cell=0., zoneout_factor_output=0., state_is_tuple=True, name=None)
Initializer with possibility to set different zoneout values for cell/hidden states.
Initializer with possibility to set different zoneout values for cell/hidden states.
[ "Initializer", "with", "possibility", "to", "set", "different", "zoneout", "values", "for", "cell", "/", "hidden", "states", "." ]
def __init__(self, num_units, is_training, zoneout_factor_cell=0., zoneout_factor_output=0., state_is_tuple=True, name=None): """Initializer with possibility to set different zoneout values for cell/hidden states. """ zm = min(zoneout_factor_output, zoneout_factor_cell) ...
[ "def", "__init__", "(", "self", ",", "num_units", ",", "is_training", ",", "zoneout_factor_cell", "=", "0.", ",", "zoneout_factor_output", "=", "0.", ",", "state_is_tuple", "=", "True", ",", "name", "=", "None", ")", ":", "zm", "=", "min", "(", "zoneout_fa...
https://github.com/Rudrabha/Lip2Wav/blob/95d923f130e4cce93fdffbf67d2ec2d66eef933a/synthesizer/models/modules.py#L102-L116
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/sphinx/sphinx/environment.py
python
BuildEnvironment.process_refonly_bullet_lists
(self, docname, doctree)
Change refonly bullet lists to use compact_paragraphs. Specifically implemented for 'Indices and Tables' section, which looks odd when html_compact_lists is false.
Change refonly bullet lists to use compact_paragraphs.
[ "Change", "refonly", "bullet", "lists", "to", "use", "compact_paragraphs", "." ]
def process_refonly_bullet_lists(self, docname, doctree): """Change refonly bullet lists to use compact_paragraphs. Specifically implemented for 'Indices and Tables' section, which looks odd when html_compact_lists is false. """ if self.config.html_compact_lists: ret...
[ "def", "process_refonly_bullet_lists", "(", "self", ",", "docname", ",", "doctree", ")", ":", "if", "self", ".", "config", ".", "html_compact_lists", ":", "return", "class", "RefOnlyListChecker", "(", "nodes", ".", "GenericNodeVisitor", ")", ":", "\"\"\"Raise `nod...
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/sphinx/sphinx/environment.py#L841-L900
wistbean/learn_python3_spider
73c873f4845f4385f097e5057407d03dd37a117b
stackoverflow/venv/lib/python3.6/site-packages/twisted/protocols/loopback.py
python
collapsingPumpPolicy
(queue, target)
L{collapsingPumpPolicy} is a policy which collapses all outstanding chunks into a single string and delivers it to the target. @see: L{loopbackAsync}
L{collapsingPumpPolicy} is a policy which collapses all outstanding chunks into a single string and delivers it to the target.
[ "L", "{", "collapsingPumpPolicy", "}", "is", "a", "policy", "which", "collapses", "all", "outstanding", "chunks", "into", "a", "single", "string", "and", "delivers", "it", "to", "the", "target", "." ]
def collapsingPumpPolicy(queue, target): """ L{collapsingPumpPolicy} is a policy which collapses all outstanding chunks into a single string and delivers it to the target. @see: L{loopbackAsync} """ bytes = [] while queue: chunk = queue.get() if chunk is None: br...
[ "def", "collapsingPumpPolicy", "(", "queue", ",", "target", ")", ":", "bytes", "=", "[", "]", "while", "queue", ":", "chunk", "=", "queue", ".", "get", "(", ")", "if", "chunk", "is", "None", ":", "break", "bytes", ".", "append", "(", "chunk", ")", ...
https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/twisted/protocols/loopback.py#L130-L144
huggingface/transformers
623b4f7c63f60cce917677ee704d6c93ee960b4b
src/transformers/models/unispeech_sat/modeling_unispeech_sat.py
python
UniSpeechSatEncoderStableLayerNorm.forward
( self, hidden_states, attention_mask=None, output_attentions=False, output_hidden_states=False, return_dict=True, )
return BaseModelOutput( last_hidden_state=hidden_states, hidden_states=all_hidden_states, attentions=all_self_attentions, )
[]
def forward( self, hidden_states, attention_mask=None, output_attentions=False, output_hidden_states=False, return_dict=True, ): all_hidden_states = () if output_hidden_states else None all_self_attentions = () if output_attentions else None i...
[ "def", "forward", "(", "self", ",", "hidden_states", ",", "attention_mask", "=", "None", ",", "output_attentions", "=", "False", ",", "output_hidden_states", "=", "False", ",", "return_dict", "=", "True", ",", ")", ":", "all_hidden_states", "=", "(", ")", "i...
https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/models/unispeech_sat/modeling_unispeech_sat.py#L808-L882
jazdev/genreXpose
383600a6969af5451647702ad88ed0fe07af1bf3
genreXpose/utils.py
python
convert_any_to_wav
(filename)
Converts the input file to the WAV format.
Converts the input file to the WAV format.
[ "Converts", "the", "input", "file", "to", "the", "WAV", "format", "." ]
def convert_any_to_wav(filename): """ Converts the input file to the WAV format. """ pass
[ "def", "convert_any_to_wav", "(", "filename", ")", ":", "pass" ]
https://github.com/jazdev/genreXpose/blob/383600a6969af5451647702ad88ed0fe07af1bf3/genreXpose/utils.py#L49-L53
rhinstaller/anaconda
63edc8680f1b05cbfe11bef28703acba808c5174
pyanaconda/threading.py
python
ThreadManager.running
(self)
Return the number of running threads. :returns: number of running threads :rtype: int
Return the number of running threads.
[ "Return", "the", "number", "of", "running", "threads", "." ]
def running(self): """ Return the number of running threads. :returns: number of running threads :rtype: int """ with self._objs_lock: return len(self._objs)
[ "def", "running", "(", "self", ")", ":", "with", "self", ".", "_objs_lock", ":", "return", "len", "(", "self", ".", "_objs", ")" ]
https://github.com/rhinstaller/anaconda/blob/63edc8680f1b05cbfe11bef28703acba808c5174/pyanaconda/threading.py#L173-L180
aliles/begins
23bc0d802198831375f4286a7e22377a1a1bf952
docs/examples/flask_quickstart.py
python
main
(host='127.0.0.1', port=8080, debug=False)
[]
def main(host='127.0.0.1', port=8080, debug=False): app.run(host=host, port=port, debug=debug)
[ "def", "main", "(", "host", "=", "'127.0.0.1'", ",", "port", "=", "8080", ",", "debug", "=", "False", ")", ":", "app", ".", "run", "(", "host", "=", "host", ",", "port", "=", "port", ",", "debug", "=", "debug", ")" ]
https://github.com/aliles/begins/blob/23bc0d802198831375f4286a7e22377a1a1bf952/docs/examples/flask_quickstart.py#L12-L13
LinOTP/LinOTP
bb3940bbaccea99550e6c063ff824f258dd6d6d7
linotp/controllers/error.py
python
ErrorController.document
(self)
return page
Render the error document
Render the error document
[ "Render", "the", "error", "document" ]
def document(self): """Render the error document""" # TODO: this will break - adjust to flask response resp = request.environ.get("pylons.original_response") if resp is not None: unicode_body = str2unicode(resp.body) content = literal(unicode_body) else:...
[ "def", "document", "(", "self", ")", ":", "# TODO: this will break - adjust to flask response", "resp", "=", "request", ".", "environ", ".", "get", "(", "\"pylons.original_response\"", ")", "if", "resp", "is", "not", "None", ":", "unicode_body", "=", "str2unicode", ...
https://github.com/LinOTP/LinOTP/blob/bb3940bbaccea99550e6c063ff824f258dd6d6d7/linotp/controllers/error.py#L45-L69
mit-han-lab/data-efficient-gans
6858275f08f43a33026844c8c2ac4e703e8a07ba
DiffAugment-biggan-cifar/layers.py
python
SN.__init__
(self, num_svs, num_itrs, num_outputs, transpose=False, eps=1e-12)
[]
def __init__(self, num_svs, num_itrs, num_outputs, transpose=False, eps=1e-12): # Number of power iterations per step self.num_itrs = num_itrs # Number of singular values self.num_svs = num_svs # Transposed? self.transpose = transpose # Epsilon value for avoiding ...
[ "def", "__init__", "(", "self", ",", "num_svs", ",", "num_itrs", ",", "num_outputs", ",", "transpose", "=", "False", ",", "eps", "=", "1e-12", ")", ":", "# Number of power iterations per step", "self", ".", "num_itrs", "=", "num_itrs", "# Number of singular values...
https://github.com/mit-han-lab/data-efficient-gans/blob/6858275f08f43a33026844c8c2ac4e703e8a07ba/DiffAugment-biggan-cifar/layers.py#L59-L71
digidotcom/xbee-python
0757f4be0017530c205175fbee8f9f61be9614d1
digi/xbee/firmware.py
python
_XBeeFirmwareUpdater._check_bootloader_update_required
(self)
return self._xml_bootloader_version > self._target_bootloader_version
Checks whether the bootloader needs to be updated. Returns: Boolean: `True` if the bootloader needs to be updated, `False` otherwise.
Checks whether the bootloader needs to be updated.
[ "Checks", "whether", "the", "bootloader", "needs", "to", "be", "updated", "." ]
def _check_bootloader_update_required(self): """ Checks whether the bootloader needs to be updated. Returns: Boolean: `True` if the bootloader needs to be updated, `False` otherwise. """ # If any bootloader version is None (the XML firmware file one or the # ...
[ "def", "_check_bootloader_update_required", "(", "self", ")", ":", "# If any bootloader version is None (the XML firmware file one or the", "# device one), update is not required.", "if", "None", "in", "(", "self", ".", "_xml_bootloader_version", ",", "self", ".", "_target_bootlo...
https://github.com/digidotcom/xbee-python/blob/0757f4be0017530c205175fbee8f9f61be9614d1/digi/xbee/firmware.py#L2562-L2579
ARM-DOE/pyart
72affe5b669f1996cd3cc39ec7d8dd29b838bd48
pyart/util/xsect.py
python
cross_section_rhi
(radar, target_elevations, el_tol=None)
return radar_ppi
Extract cross sections from an RHI volume along one or more elevation angles. Parameters ---------- radar : Radar Radar volume containing RHI sweeps from which azimuthal cross sections will be extracted. target_elevations : list Elevation angles in degrees where cross sectio...
Extract cross sections from an RHI volume along one or more elevation angles.
[ "Extract", "cross", "sections", "from", "an", "RHI", "volume", "along", "one", "or", "more", "elevation", "angles", "." ]
def cross_section_rhi(radar, target_elevations, el_tol=None): """ Extract cross sections from an RHI volume along one or more elevation angles. Parameters ---------- radar : Radar Radar volume containing RHI sweeps from which azimuthal cross sections will be extracted. targe...
[ "def", "cross_section_rhi", "(", "radar", ",", "target_elevations", ",", "el_tol", "=", "None", ")", ":", "# determine which rays from the rhi radar make up the pseudo PPI", "pppi_rays", "=", "[", "]", "valid_elevations", "=", "[", "]", "for", "target_elevation", "in", ...
https://github.com/ARM-DOE/pyart/blob/72affe5b669f1996cd3cc39ec7d8dd29b838bd48/pyart/util/xsect.py#L70-L126
dmlc/dgl
8d14a739bc9e446d6c92ef83eafe5782398118de
python/dgl/data/citation_graph.py
python
load_citeseer
(raw_dir=None, force_reload=False, verbose=True, reverse_edge=True)
return data
Get CiteseerGraphDataset Parameters ----------- raw_dir : str Raw file directory to download/contains the input data directory. Default: ~/.dgl/ force_reload : bool Whether to reload the dataset. Default: False verbose: bool Whether to print out progress information. Def...
Get CiteseerGraphDataset
[ "Get", "CiteseerGraphDataset" ]
def load_citeseer(raw_dir=None, force_reload=False, verbose=True, reverse_edge=True): """Get CiteseerGraphDataset Parameters ----------- raw_dir : str Raw file directory to download/contains the input data directory. Default: ~/.dgl/ force_reload : bool Whether to reload the...
[ "def", "load_citeseer", "(", "raw_dir", "=", "None", ",", "force_reload", "=", "False", ",", "verbose", "=", "True", ",", "reverse_edge", "=", "True", ")", ":", "data", "=", "CiteseerGraphDataset", "(", "raw_dir", ",", "force_reload", ",", "verbose", ",", ...
https://github.com/dmlc/dgl/blob/8d14a739bc9e446d6c92ef83eafe5782398118de/python/dgl/data/citation_graph.py#L739-L759
pyrogram/pyrogram
e67fd6efbb93e5ba6307fe4c20ea8051c5583d85
pyrogram/methods/invite_links/export_chat_invite_link.py
python
ExportChatInviteLink.export_chat_invite_link
( self, chat_id: Union[int, str], )
return r.link
Generate a new primary invite link for a chat; any previously generated primary link is revoked. You must be an administrator in the chat for this to work and must have the appropriate admin rights. .. note :: Each administrator in a chat generates their own invite links. Bots can't use in...
Generate a new primary invite link for a chat; any previously generated primary link is revoked.
[ "Generate", "a", "new", "primary", "invite", "link", "for", "a", "chat", ";", "any", "previously", "generated", "primary", "link", "is", "revoked", "." ]
async def export_chat_invite_link( self, chat_id: Union[int, str], ) -> "types.ChatInviteLink": """Generate a new primary invite link for a chat; any previously generated primary link is revoked. You must be an administrator in the chat for this to work and must have the appropriate...
[ "async", "def", "export_chat_invite_link", "(", "self", ",", "chat_id", ":", "Union", "[", "int", ",", "str", "]", ",", ")", "->", "\"types.ChatInviteLink\"", ":", "r", "=", "await", "self", ".", "send", "(", "raw", ".", "functions", ".", "messages", "."...
https://github.com/pyrogram/pyrogram/blob/e67fd6efbb93e5ba6307fe4c20ea8051c5583d85/pyrogram/methods/invite_links/export_chat_invite_link.py#L27-L63
hkust-vgd/scanobjectnn
fe60aeade9ceb8882bc3f1bc40612e65469d7e77
pointnet/utils/tf_util.py
python
_variable_on_cpu
(name, shape, initializer, use_fp16=False)
return var
Helper to create a Variable stored on CPU memory. Args: name: name of the variable shape: list of ints initializer: initializer for Variable Returns: Variable Tensor
Helper to create a Variable stored on CPU memory. Args: name: name of the variable shape: list of ints initializer: initializer for Variable Returns: Variable Tensor
[ "Helper", "to", "create", "a", "Variable", "stored", "on", "CPU", "memory", ".", "Args", ":", "name", ":", "name", "of", "the", "variable", "shape", ":", "list", "of", "ints", "initializer", ":", "initializer", "for", "Variable", "Returns", ":", "Variable"...
def _variable_on_cpu(name, shape, initializer, use_fp16=False): """Helper to create a Variable stored on CPU memory. Args: name: name of the variable shape: list of ints initializer: initializer for Variable Returns: Variable Tensor """ with tf.device('/cpu:0'): dtype = tf.float16 if use_f...
[ "def", "_variable_on_cpu", "(", "name", ",", "shape", ",", "initializer", ",", "use_fp16", "=", "False", ")", ":", "with", "tf", ".", "device", "(", "'/cpu:0'", ")", ":", "dtype", "=", "tf", ".", "float16", "if", "use_fp16", "else", "tf", ".", "float32...
https://github.com/hkust-vgd/scanobjectnn/blob/fe60aeade9ceb8882bc3f1bc40612e65469d7e77/pointnet/utils/tf_util.py#L10-L22
amimo/dcc
114326ab5a082a42c7728a375726489e4709ca29
androguard/core/bytecodes/apk.py
python
APK._get_crc32
(self, filename)
return buffer
Calculates and compares the CRC32 and returns the raw buffer. The CRC32 is added to `files_crc32` dictionary, if not present. :param filename: filename inside the zipfile :rtype: bytes
Calculates and compares the CRC32 and returns the raw buffer.
[ "Calculates", "and", "compares", "the", "CRC32", "and", "returns", "the", "raw", "buffer", "." ]
def _get_crc32(self, filename): """ Calculates and compares the CRC32 and returns the raw buffer. The CRC32 is added to `files_crc32` dictionary, if not present. :param filename: filename inside the zipfile :rtype: bytes """ buffer = self.zip.read(filename) ...
[ "def", "_get_crc32", "(", "self", ",", "filename", ")", ":", "buffer", "=", "self", ".", "zip", ".", "read", "(", "filename", ")", "if", "filename", "not", "in", "self", ".", "files_crc32", ":", "self", ".", "files_crc32", "[", "filename", "]", "=", ...
https://github.com/amimo/dcc/blob/114326ab5a082a42c7728a375726489e4709ca29/androguard/core/bytecodes/apk.py#L715-L732
StyraHem/ShellyForHASS
902c04ab25b0a7667718eeef53bb6ad43614fe2f
custom_components/shelly/device.py
python
ShellyDevice.name
(self)
return name
Return the display name of this device.
Return the display name of this device.
[ "Return", "the", "display", "name", "of", "this", "device", "." ]
def name(self): """Return the display name of this device.""" if self._name is None: name = self._dev.friendly_name() else: name = self._name if self._name_ext: name += ' - ' + self._name_ext if self._show_id_in_name: name += " [" +...
[ "def", "name", "(", "self", ")", ":", "if", "self", ".", "_name", "is", "None", ":", "name", "=", "self", ".", "_dev", ".", "friendly_name", "(", ")", "else", ":", "name", "=", "self", ".", "_name", "if", "self", ".", "_name_ext", ":", "name", "+...
https://github.com/StyraHem/ShellyForHASS/blob/902c04ab25b0a7667718eeef53bb6ad43614fe2f/custom_components/shelly/device.py#L77-L87
graalvm/mx
29c0debab406352df3af246be2f8973be5db69ae
mx_ide_eclipse.py
python
_add_eclipse_linked_resources
(xml_doc, project_loc, linked_resources, absolutePaths=False)
Adds a ``linkedResources`` element to `xml_doc` for the resources described by `linked_resources`. :param project_loc: directory containing ``.project`` file containing the content of `xml_doc`
Adds a ``linkedResources`` element to `xml_doc` for the resources described by `linked_resources`.
[ "Adds", "a", "linkedResources", "element", "to", "xml_doc", "for", "the", "resources", "described", "by", "linked_resources", "." ]
def _add_eclipse_linked_resources(xml_doc, project_loc, linked_resources, absolutePaths=False): """ Adds a ``linkedResources`` element to `xml_doc` for the resources described by `linked_resources`. :param project_loc: directory containing ``.project`` file containing the content of `xml_doc` """ i...
[ "def", "_add_eclipse_linked_resources", "(", "xml_doc", ",", "project_loc", ",", "linked_resources", ",", "absolutePaths", "=", "False", ")", ":", "if", "linked_resources", ":", "xml_doc", ".", "open", "(", "'linkedResources'", ")", "for", "lr", "in", "linked_reso...
https://github.com/graalvm/mx/blob/29c0debab406352df3af246be2f8973be5db69ae/mx_ide_eclipse.py#L552-L566
funnyzhou/FPN-Pytorch
423a4499c4e826d17367762e821b51b9b1b0f2f3
tools/download_imagenet_weights.py
python
parse_args
()
return parser.parse_args()
Parser command line argumnets
Parser command line argumnets
[ "Parser", "command", "line", "argumnets" ]
def parse_args(): """Parser command line argumnets""" parser = argparse.ArgumentParser(formatter_class=ColorHelpFormatter) parser.add_argument('--output_dir', help='Directory to save downloaded weight files', default=os.path.join(cfg.DATA_DIR, 'pretrained_model')) parser.add_argu...
[ "def", "parse_args", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "formatter_class", "=", "ColorHelpFormatter", ")", "parser", ".", "add_argument", "(", "'--output_dir'", ",", "help", "=", "'Directory to save downloaded weight files'", ",", ...
https://github.com/funnyzhou/FPN-Pytorch/blob/423a4499c4e826d17367762e821b51b9b1b0f2f3/tools/download_imagenet_weights.py#L17-L28
cdhigh/KindleEar
7c4ecf9625239f12a829210d1760b863ef5a23aa
lib/calibre/ebooks/oeb/base.py
python
TOC.add
(self, title, href, klass=None, id=None, play_order=0, author=None, description=None, toc_thumbnail=None)
return node
Create and return a new sub-node of this node.
Create and return a new sub-node of this node.
[ "Create", "and", "return", "a", "new", "sub", "-", "node", "of", "this", "node", "." ]
def add(self, title, href, klass=None, id=None, play_order=0, author=None, description=None, toc_thumbnail=None): """Create and return a new sub-node of this node.""" node = TOC(title, href, klass, id, play_order, author, description, toc_thumbnail) self.nodes.append(node) return node
[ "def", "add", "(", "self", ",", "title", ",", "href", ",", "klass", "=", "None", ",", "id", "=", "None", ",", "play_order", "=", "0", ",", "author", "=", "None", ",", "description", "=", "None", ",", "toc_thumbnail", "=", "None", ")", ":", "node", ...
https://github.com/cdhigh/KindleEar/blob/7c4ecf9625239f12a829210d1760b863ef5a23aa/lib/calibre/ebooks/oeb/base.py#L1397-L1401
caffeinehit/django-oauth2-provider
6b5bc0d3ad706d2aaa47fa476f38406cddd01236
provider/views.py
python
AccessToken.invalidate_refresh_token
(self, refresh_token)
Override to handle refresh token invalidation. When requesting a new access token from a refresh token, the old one is *always* invalidated. :return None:
Override to handle refresh token invalidation. When requesting a new access token from a refresh token, the old one is *always* invalidated.
[ "Override", "to", "handle", "refresh", "token", "invalidation", ".", "When", "requesting", "a", "new", "access", "token", "from", "a", "refresh", "token", "the", "old", "one", "is", "*", "always", "*", "invalidated", "." ]
def invalidate_refresh_token(self, refresh_token): """ Override to handle refresh token invalidation. When requesting a new access token from a refresh token, the old one is *always* invalidated. :return None: """ raise NotImplementedError
[ "def", "invalidate_refresh_token", "(", "self", ",", "refresh_token", ")", ":", "raise", "NotImplementedError" ]
https://github.com/caffeinehit/django-oauth2-provider/blob/6b5bc0d3ad706d2aaa47fa476f38406cddd01236/provider/views.py#L442-L449
smart-mobile-software/gitstack
d9fee8f414f202143eb6e620529e8e5539a2af56
python/Lib/site-packages/django/contrib/gis/db/models/query.py
python
GeoQuerySet.intersection
(self, geom, **kwargs)
return self._geomset_attribute('intersection', geom, **kwargs)
Returns the spatial intersection of the Geometry field in an `intersection` attribute on each element of this GeoQuerySet.
Returns the spatial intersection of the Geometry field in an `intersection` attribute on each element of this GeoQuerySet.
[ "Returns", "the", "spatial", "intersection", "of", "the", "Geometry", "field", "in", "an", "intersection", "attribute", "on", "each", "element", "of", "this", "GeoQuerySet", "." ]
def intersection(self, geom, **kwargs): """ Returns the spatial intersection of the Geometry field in an `intersection` attribute on each element of this GeoQuerySet. """ return self._geomset_attribute('intersection', geom, **kwargs)
[ "def", "intersection", "(", "self", ",", "geom", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_geomset_attribute", "(", "'intersection'", ",", "geom", ",", "*", "*", "kwargs", ")" ]
https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/site-packages/django/contrib/gis/db/models/query.py#L200-L206
microsoft/azure-devops-python-api
451cade4c475482792cbe9e522c1fee32393139e
azure-devops/azure/devops/v5_1/git/git_client_base.py
python
GitClientBase.create_pull_request
(self, git_pull_request_to_create, repository_id, project=None, supports_iterations=None)
return self._deserialize('GitPullRequest', response)
CreatePullRequest. Create a pull request. :param :class:`<GitPullRequest> <azure.devops.v5_1.git.models.GitPullRequest>` git_pull_request_to_create: The pull request to create. :param str repository_id: The repository ID of the pull request's target branch. :param str project: Project ID...
CreatePullRequest. Create a pull request. :param :class:`<GitPullRequest> <azure.devops.v5_1.git.models.GitPullRequest>` git_pull_request_to_create: The pull request to create. :param str repository_id: The repository ID of the pull request's target branch. :param str project: Project ID...
[ "CreatePullRequest", ".", "Create", "a", "pull", "request", ".", ":", "param", ":", "class", ":", "<GitPullRequest", ">", "<azure", ".", "devops", ".", "v5_1", ".", "git", ".", "models", ".", "GitPullRequest", ">", "git_pull_request_to_create", ":", "The", "...
def create_pull_request(self, git_pull_request_to_create, repository_id, project=None, supports_iterations=None): """CreatePullRequest. Create a pull request. :param :class:`<GitPullRequest> <azure.devops.v5_1.git.models.GitPullRequest>` git_pull_request_to_create: The pull request to create. ...
[ "def", "create_pull_request", "(", "self", ",", "git_pull_request_to_create", ",", "repository_id", ",", "project", "=", "None", ",", "supports_iterations", "=", "None", ")", ":", "route_values", "=", "{", "}", "if", "project", "is", "not", "None", ":", "route...
https://github.com/microsoft/azure-devops-python-api/blob/451cade4c475482792cbe9e522c1fee32393139e/azure-devops/azure/devops/v5_1/git/git_client_base.py#L2066-L2090
osmr/imgclsmob
f2993d3ce73a2f7ddba05da3891defb08547d504
pytorch/pytorchcv/models/drn.py
python
drnc58
(**kwargs)
return get_drn(blocks=58, model_name="drnc58", **kwargs)
DRN-C-58 model from 'Dilated Residual Networks,' https://arxiv.org/abs/1705.09914. Parameters: ---------- pretrained : bool, default False Whether to load the pretrained weights for model. root : str, default '~/.torch/models' Location for keeping the model parameters.
DRN-C-58 model from 'Dilated Residual Networks,' https://arxiv.org/abs/1705.09914.
[ "DRN", "-", "C", "-", "58", "model", "from", "Dilated", "Residual", "Networks", "https", ":", "//", "arxiv", ".", "org", "/", "abs", "/", "1705", ".", "09914", "." ]
def drnc58(**kwargs): """ DRN-C-58 model from 'Dilated Residual Networks,' https://arxiv.org/abs/1705.09914. Parameters: ---------- pretrained : bool, default False Whether to load the pretrained weights for model. root : str, default '~/.torch/models' Location for keeping the m...
[ "def", "drnc58", "(", "*", "*", "kwargs", ")", ":", "return", "get_drn", "(", "blocks", "=", "58", ",", "model_name", "=", "\"drnc58\"", ",", "*", "*", "kwargs", ")" ]
https://github.com/osmr/imgclsmob/blob/f2993d3ce73a2f7ddba05da3891defb08547d504/pytorch/pytorchcv/models/drn.py#L516-L527
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/apps/reports/lookup.py
python
get_full_report_name
(report)
return report.__module__ + '.' + report.__name__
[]
def get_full_report_name(report): if not report: return '' return report.__module__ + '.' + report.__name__
[ "def", "get_full_report_name", "(", "report", ")", ":", "if", "not", "report", ":", "return", "''", "return", "report", ".", "__module__", "+", "'.'", "+", "report", ".", "__name__" ]
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/reports/lookup.py#L54-L58
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/pip/_vendor/pyparsing.py
python
originalTextFor
(expr, asString=True)
return matchExpr
Helper to return the original, untokenized text for a given expression. Useful to restore the parsed fields of an HTML start tag into the raw tag text itself, or to revert separate tokens with intervening whitespace back to the original matching input text. By default, returns astring containing the or...
Helper to return the original, untokenized text for a given expression. Useful to restore the parsed fields of an HTML start tag into the raw tag text itself, or to revert separate tokens with intervening whitespace back to the original matching input text. By default, returns astring containing the or...
[ "Helper", "to", "return", "the", "original", "untokenized", "text", "for", "a", "given", "expression", ".", "Useful", "to", "restore", "the", "parsed", "fields", "of", "an", "HTML", "start", "tag", "into", "the", "raw", "tag", "text", "itself", "or", "to",...
def originalTextFor(expr, asString=True): """Helper to return the original, untokenized text for a given expression. Useful to restore the parsed fields of an HTML start tag into the raw tag text itself, or to revert separate tokens with intervening whitespace back to the original matching input text. ...
[ "def", "originalTextFor", "(", "expr", ",", "asString", "=", "True", ")", ":", "locMarker", "=", "Empty", "(", ")", ".", "setParseAction", "(", "lambda", "s", ",", "loc", ",", "t", ":", "loc", ")", "endlocMarker", "=", "locMarker", ".", "copy", "(", ...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/pip/_vendor/pyparsing.py#L5173-L5213
zatosource/zato
2a9d273f06f9d776fbfeb53e73855af6e40fa208
code/zato-server/src/zato/server/connection/connector/subprocess_/base.py
python
BaseConnectionContainer.handle_http_request
(self, path, msg, ok=b'OK')
Dispatches incoming HTTP requests - either reconfigures the connector or puts messages to queues.
Dispatches incoming HTTP requests - either reconfigures the connector or puts messages to queues.
[ "Dispatches", "incoming", "HTTP", "requests", "-", "either", "reconfigures", "the", "connector", "or", "puts", "messages", "to", "queues", "." ]
def handle_http_request(self, path, msg, ok=b'OK'): """ Dispatches incoming HTTP requests - either reconfigures the connector or puts messages to queues. """ self.logger.info('MSG received %s %s', path, msg) if path == _path_ping: return Response() else: ...
[ "def", "handle_http_request", "(", "self", ",", "path", ",", "msg", ",", "ok", "=", "b'OK'", ")", ":", "self", ".", "logger", ".", "info", "(", "'MSG received %s %s'", ",", "path", ",", "msg", ")", "if", "path", "==", "_path_ping", ":", "return", "Resp...
https://github.com/zatosource/zato/blob/2a9d273f06f9d776fbfeb53e73855af6e40fa208/code/zato-server/src/zato/server/connection/connector/subprocess_/base.py#L415-L432
dfunckt/django-rules
2b79375a8ca2f4a2ded97feba0411f837ae7f80b
rules/contrib/models.py
python
RulesModelMixin.get_perm
(cls, perm_type)
return "%s.%s_%s" % (cls._meta.app_label, perm_type, cls._meta.model_name)
Converts permission type ("add") to permission name ("app.add_modelname") :param perm_type: "add", "change", etc., or custom value :type perm_type: str :returns str:
Converts permission type ("add") to permission name ("app.add_modelname")
[ "Converts", "permission", "type", "(", "add", ")", "to", "permission", "name", "(", "app", ".", "add_modelname", ")" ]
def get_perm(cls, perm_type): """Converts permission type ("add") to permission name ("app.add_modelname") :param perm_type: "add", "change", etc., or custom value :type perm_type: str :returns str: """ return "%s.%s_%s" % (cls._meta.app_label, perm_type, cls._meta.mode...
[ "def", "get_perm", "(", "cls", ",", "perm_type", ")", ":", "return", "\"%s.%s_%s\"", "%", "(", "cls", ".", "_meta", ".", "app_label", ",", "perm_type", ",", "cls", ".", "_meta", ".", "model_name", ")" ]
https://github.com/dfunckt/django-rules/blob/2b79375a8ca2f4a2ded97feba0411f837ae7f80b/rules/contrib/models.py#L59-L66
CedricGuillemet/Imogen
ee417b42747ed5b46cb11b02ef0c3630000085b3
bin/Lib/lib2to3/refactor.py
python
RefactoringTool.print_output
(self, old_text, new_text, filename, equal)
Called with the old version, new version, and filename of a refactored file.
Called with the old version, new version, and filename of a refactored file.
[ "Called", "with", "the", "old", "version", "new", "version", "and", "filename", "of", "a", "refactored", "file", "." ]
def print_output(self, old_text, new_text, filename, equal): """Called with the old version, new version, and filename of a refactored file.""" pass
[ "def", "print_output", "(", "self", ",", "old_text", ",", "new_text", ",", "filename", ",", "equal", ")", ":", "pass" ]
https://github.com/CedricGuillemet/Imogen/blob/ee417b42747ed5b46cb11b02ef0c3630000085b3/bin/Lib/lib2to3/refactor.py#L270-L273
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-darwin/x64/mako/exceptions.py
python
RichTraceback.traceback
(self)
return list(self._get_reformatted_records(self.records))
Return a list of 4-tuple traceback records (i.e. normal python format) with template-corresponding lines remapped to the originating template.
Return a list of 4-tuple traceback records (i.e. normal python format) with template-corresponding lines remapped to the originating template.
[ "Return", "a", "list", "of", "4", "-", "tuple", "traceback", "records", "(", "i", ".", "e", ".", "normal", "python", "format", ")", "with", "template", "-", "corresponding", "lines", "remapped", "to", "the", "originating", "template", "." ]
def traceback(self): """Return a list of 4-tuple traceback records (i.e. normal python format) with template-corresponding lines remapped to the originating template. """ return list(self._get_reformatted_records(self.records))
[ "def", "traceback", "(", "self", ")", ":", "return", "list", "(", "self", ".", "_get_reformatted_records", "(", "self", ".", "records", ")", ")" ]
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-darwin/x64/mako/exceptions.py#L128-L134
bwohlberg/sporco
df67462abcf83af6ab1961bcb0d51b87a66483fa
sporco/admm/admm.py
python
ADMMConsensus.rsdl_rn
(self, AX, Y)
return max((np.linalg.norm(AX), np.sqrt(self.Nb) * np.linalg.norm(Y)))
Compute primal residual normalisation term.
Compute primal residual normalisation term.
[ "Compute", "primal", "residual", "normalisation", "term", "." ]
def rsdl_rn(self, AX, Y): """Compute primal residual normalisation term.""" # The primal residual normalisation term is # max( ||A x^(k)||_2, ||B y^(k)||_2 ) and B = -(I I I ...)^T. # The scaling by sqrt(Nb) of the l2 norm of Y accounts for the # block replication introduced by ...
[ "def", "rsdl_rn", "(", "self", ",", "AX", ",", "Y", ")", ":", "# The primal residual normalisation term is", "# max( ||A x^(k)||_2, ||B y^(k)||_2 ) and B = -(I I I ...)^T.", "# The scaling by sqrt(Nb) of the l2 norm of Y accounts for the", "# block replication introduced by multiplication ...
https://github.com/bwohlberg/sporco/blob/df67462abcf83af6ab1961bcb0d51b87a66483fa/sporco/admm/admm.py#L1693-L1700
jython/frozen-mirror
b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99
src/shell/jython.py
python
parse_launcher_args
(args)
return parsed, unparsed
Process the given argument list into two objects, the first part being a namespace of checked arguments to the interpreter itself, and the rest being the Python program it will run and its arguments.
Process the given argument list into two objects, the first part being a namespace of checked arguments to the interpreter itself, and the rest being the Python program it will run and its arguments.
[ "Process", "the", "given", "argument", "list", "into", "two", "objects", "the", "first", "part", "being", "a", "namespace", "of", "checked", "arguments", "to", "the", "interpreter", "itself", "and", "the", "rest", "being", "the", "Python", "program", "it", "...
def parse_launcher_args(args): """ Process the given argument list into two objects, the first part being a namespace of checked arguments to the interpreter itself, and the rest being the Python program it will run and its arguments. """ class Namespace(object): pass parsed = Na...
[ "def", "parse_launcher_args", "(", "args", ")", ":", "class", "Namespace", "(", "object", ")", ":", "pass", "parsed", "=", "Namespace", "(", ")", "parsed", ".", "boot", "=", "False", "# --boot flag given", "parsed", ".", "jdb", "=", "False", "# --jdb flag gi...
https://github.com/jython/frozen-mirror/blob/b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99/src/shell/jython.py#L90-L155
python/cpython
e13cdca0f5224ec4e23bdd04bb3120506964bc8b
Lib/logging/handlers.py
python
QueueListener.stop
(self)
Stop the listener. This asks the thread to terminate, and then waits for it to do so. Note that if you don't call this before your application exits, there may be some records still left on the queue, which won't be processed.
Stop the listener.
[ "Stop", "the", "listener", "." ]
def stop(self): """ Stop the listener. This asks the thread to terminate, and then waits for it to do so. Note that if you don't call this before your application exits, there may be some records still left on the queue, which won't be processed. """ self.enqueue...
[ "def", "stop", "(", "self", ")", ":", "self", ".", "enqueue_sentinel", "(", ")", "self", ".", "_thread", ".", "join", "(", ")", "self", ".", "_thread", "=", "None" ]
https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/logging/handlers.py#L1579-L1589
jason9693/MusicTransformer-tensorflow2.0
f7c06c0cb2e9cdddcbf6db779cb39cd650282778
custom/layers.py
python
BaselineAttention.__init__
(self, h, d, max_seq=2048, **kwargs)
[]
def __init__(self, h, d, max_seq=2048, **kwargs): super().__init__(**kwargs) self.len_k = None self.max_seq = None self.E = None self.h = h self.d = d self.dh = d // h self.Wq = keras.layers.Dense(int(self.d / 2)) self.Wk = keras.layers.Dense(int(s...
[ "def", "__init__", "(", "self", ",", "h", ",", "d", ",", "max_seq", "=", "2048", ",", "*", "*", "kwargs", ")", ":", "super", "(", ")", ".", "__init__", "(", "*", "*", "kwargs", ")", "self", ".", "len_k", "=", "None", "self", ".", "max_seq", "="...
https://github.com/jason9693/MusicTransformer-tensorflow2.0/blob/f7c06c0cb2e9cdddcbf6db779cb39cd650282778/custom/layers.py#L98-L110
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/full/_pydecimal.py
python
_format_sign
(is_negative, spec)
Determine sign character.
Determine sign character.
[ "Determine", "sign", "character", "." ]
def _format_sign(is_negative, spec): """Determine sign character.""" if is_negative: return '-' elif spec['sign'] in ' +': return spec['sign'] else: return ''
[ "def", "_format_sign", "(", "is_negative", ",", "spec", ")", ":", "if", "is_negative", ":", "return", "'-'", "elif", "spec", "[", "'sign'", "]", "in", "' +'", ":", "return", "spec", "[", "'sign'", "]", "else", ":", "return", "''" ]
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/_pydecimal.py#L6340-L6348
openstack/kuryr-kubernetes
513ada72685ef02cd9f3aca418ac1b2e0dc1b8ba
kuryr_kubernetes/cni/binding/sriov.py
python
VIFSriovDriver._make_annotation_name
(self, neutron_port)
return annot_name
[]
def _make_annotation_name(self, neutron_port): annot_name = constants.K8S_ANNOTATION_NODE_PCI_DEVICE_INFO annot_name = annot_name.replace('/', '~1') annot_name = annot_name + '-' + neutron_port return annot_name
[ "def", "_make_annotation_name", "(", "self", ",", "neutron_port", ")", ":", "annot_name", "=", "constants", ".", "K8S_ANNOTATION_NODE_PCI_DEVICE_INFO", "annot_name", "=", "annot_name", ".", "replace", "(", "'/'", ",", "'~1'", ")", "annot_name", "=", "annot_name", ...
https://github.com/openstack/kuryr-kubernetes/blob/513ada72685ef02cd9f3aca418ac1b2e0dc1b8ba/kuryr_kubernetes/cni/binding/sriov.py#L323-L327
ChineseGLUE/ChineseGLUE
1591b85cf5427c2ff60f718d359ecb71d2b44879
baselines/models/roberta/tf_metrics.py
python
f1
(labels, predictions, num_classes, pos_indices=None, weights=None, average='micro')
return fbeta(labels, predictions, num_classes, pos_indices, weights, average)
[]
def f1(labels, predictions, num_classes, pos_indices=None, weights=None, average='micro'): return fbeta(labels, predictions, num_classes, pos_indices, weights, average)
[ "def", "f1", "(", "labels", ",", "predictions", ",", "num_classes", ",", "pos_indices", "=", "None", ",", "weights", "=", "None", ",", "average", "=", "'micro'", ")", ":", "return", "fbeta", "(", "labels", ",", "predictions", ",", "num_classes", ",", "po...
https://github.com/ChineseGLUE/ChineseGLUE/blob/1591b85cf5427c2ff60f718d359ecb71d2b44879/baselines/models/roberta/tf_metrics.py#L91-L94
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/lib-python/3/__future__.py
python
_Feature.__repr__
(self)
return "_Feature" + repr((self.optional, self.mandatory, self.compiler_flag))
[]
def __repr__(self): return "_Feature" + repr((self.optional, self.mandatory, self.compiler_flag))
[ "def", "__repr__", "(", "self", ")", ":", "return", "\"_Feature\"", "+", "repr", "(", "(", "self", ".", "optional", ",", "self", ".", "mandatory", ",", "self", ".", "compiler_flag", ")", ")" ]
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/__future__.py#L103-L106
DataDog/integrations-core
934674b29d94b70ccc008f76ea172d0cdae05e1e
openstack_controller/datadog_checks/openstack_controller/openstack_controller.py
python
OpenStackControllerCheck.update_servers_cache
(self, cached_servers, tenant_to_name, changes_since)
return servers
[]
def update_servers_cache(self, cached_servers, tenant_to_name, changes_since): servers = copy.deepcopy(cached_servers) query_params = {"all_tenants": True, 'changes-since': changes_since} updated_servers = self.get_servers_detail(query_params) # For each updated servers, we update the ...
[ "def", "update_servers_cache", "(", "self", ",", "cached_servers", ",", "tenant_to_name", ",", "changes_since", ")", ":", "servers", "=", "copy", ".", "deepcopy", "(", "cached_servers", ")", "query_params", "=", "{", "\"all_tenants\"", ":", "True", ",", "'change...
https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/openstack_controller/datadog_checks/openstack_controller/openstack_controller.py#L310-L329
pithos/pithos
fff93d0740ad752d53027732467155219c20acb2
pithos/plugins/mpris.py
python
PithosMprisService.PropertiesChanged
(self, interface, changed, invalidated)
Emits mpris Property changes.
Emits mpris Property changes.
[ "Emits", "mpris", "Property", "changes", "." ]
def PropertiesChanged(self, interface, changed, invalidated): '''Emits mpris Property changes.''' try: self.connection.emit_signal(None, '/org/mpris/MediaPlayer2', 'org.freedesktop.DBus.Properties', 'PropertiesCh...
[ "def", "PropertiesChanged", "(", "self", ",", "interface", ",", "changed", ",", "invalidated", ")", ":", "try", ":", "self", ".", "connection", ".", "emit_signal", "(", "None", ",", "'/org/mpris/MediaPlayer2'", ",", "'org.freedesktop.DBus.Properties'", ",", "'Prop...
https://github.com/pithos/pithos/blob/fff93d0740ad752d53027732467155219c20acb2/pithos/plugins/mpris.py#L813-L825
mher/tornado-celery
b4aeaf7abe4ffc60cfc99a6a851a77d20b498a5b
tcelery/result.py
python
AsyncResult.result
(self)
return self._result or super(AsyncResult, self).result
[]
def result(self): return self._result or super(AsyncResult, self).result
[ "def", "result", "(", "self", ")", ":", "return", "self", ".", "_result", "or", "super", "(", "AsyncResult", ",", "self", ")", ".", "result" ]
https://github.com/mher/tornado-celery/blob/b4aeaf7abe4ffc60cfc99a6a851a77d20b498a5b/tcelery/result.py#L28-L29
openstack/swift
b8d7c3dcb817504dcc0959ba52cc4ed2cf66c100
swift/container/backend.py
python
ContainerBroker.get_own_shard_range
(self, no_default=False)
return own_shard_range
Returns a shard range representing this broker's own shard range. If no such range has been persisted in the broker's shard ranges table then a default shard range representing the entire namespace will be returned. The returned shard range will be updated with the current object stats ...
Returns a shard range representing this broker's own shard range. If no such range has been persisted in the broker's shard ranges table then a default shard range representing the entire namespace will be returned.
[ "Returns", "a", "shard", "range", "representing", "this", "broker", "s", "own", "shard", "range", ".", "If", "no", "such", "range", "has", "been", "persisted", "in", "the", "broker", "s", "shard", "ranges", "table", "then", "a", "default", "shard", "range"...
def get_own_shard_range(self, no_default=False): """ Returns a shard range representing this broker's own shard range. If no such range has been persisted in the broker's shard ranges table then a default shard range representing the entire namespace will be returned. The return...
[ "def", "get_own_shard_range", "(", "self", ",", "no_default", "=", "False", ")", ":", "own_shard_range", "=", "self", ".", "_own_shard_range", "(", "no_default", "=", "no_default", ")", "if", "own_shard_range", ":", "info", "=", "self", ".", "get_info", "(", ...
https://github.com/openstack/swift/blob/b8d7c3dcb817504dcc0959ba52cc4ed2cf66c100/swift/container/backend.py#L1879-L1899
kyuupichan/electrumx
ab9024f74a034e634a518cfbcdb1fcd911e62f00
electrumx/lib/coins.py
python
Coin.hashX_from_script
(cls, script)
return sha256(script).digest()[:HASHX_LEN]
Returns a hashX from a script.
Returns a hashX from a script.
[ "Returns", "a", "hashX", "from", "a", "script", "." ]
def hashX_from_script(cls, script): '''Returns a hashX from a script.''' return sha256(script).digest()[:HASHX_LEN]
[ "def", "hashX_from_script", "(", "cls", ",", "script", ")", ":", "return", "sha256", "(", "script", ")", ".", "digest", "(", ")", "[", ":", "HASHX_LEN", "]" ]
https://github.com/kyuupichan/electrumx/blob/ab9024f74a034e634a518cfbcdb1fcd911e62f00/electrumx/lib/coins.py#L82-L84
gammapy/gammapy
735b25cd5bbed35e2004d633621896dcd5295e8b
gammapy/datasets/spectrum.py
python
PlotMixin.plot_counts
( self, ax=None, kwargs_counts=None, kwargs_background=None, **kwargs )
return ax
Plot counts and background. Parameters ---------- ax : `~matplotlib.axes.Axes` Axes to plot on. kwargs_counts: dict Keyword arguments passed to `~matplotlib.axes.Axes.hist` for the counts. kwargs_background: dict Keyword arguments passed to `~...
Plot counts and background.
[ "Plot", "counts", "and", "background", "." ]
def plot_counts( self, ax=None, kwargs_counts=None, kwargs_background=None, **kwargs ): """Plot counts and background. Parameters ---------- ax : `~matplotlib.axes.Axes` Axes to plot on. kwargs_counts: dict Keyword arguments passed to `~matplo...
[ "def", "plot_counts", "(", "self", ",", "ax", "=", "None", ",", "kwargs_counts", "=", "None", ",", "kwargs_background", "=", "None", ",", "*", "*", "kwargs", ")", ":", "kwargs_counts", "=", "kwargs_counts", "or", "{", "}", "kwargs_background", "=", "kwargs...
https://github.com/gammapy/gammapy/blob/735b25cd5bbed35e2004d633621896dcd5295e8b/gammapy/datasets/spectrum.py#L68-L104
shchur/gnn-benchmark
1e72912a0810cdf27ae54fd589a3b43358a2b161
gnnbench/models/base_model.py
python
GNNModel._preprocess_features
(self, features)
Preprocessing function for the features. Called by the constructor. Even if no preprocessing is needed, the features might need to be converted to a tf.SparseTensor in this method using the function util.to_sparse_tensor. Returns ------- features_tensor : tf.Tensor or tf.SparseT...
Preprocessing function for the features. Called by the constructor. Even if no preprocessing is needed, the features might need to be converted to a tf.SparseTensor in this method using the function util.to_sparse_tensor.
[ "Preprocessing", "function", "for", "the", "features", ".", "Called", "by", "the", "constructor", ".", "Even", "if", "no", "preprocessing", "is", "needed", "the", "features", "might", "need", "to", "be", "converted", "to", "a", "tf", ".", "SparseTensor", "in...
def _preprocess_features(self, features): """ Preprocessing function for the features. Called by the constructor. Even if no preprocessing is needed, the features might need to be converted to a tf.SparseTensor in this method using the function util.to_sparse_tensor. Returns ...
[ "def", "_preprocess_features", "(", "self", ",", "features", ")", ":", "raise", "NotImplementedError" ]
https://github.com/shchur/gnn-benchmark/blob/1e72912a0810cdf27ae54fd589a3b43358a2b161/gnnbench/models/base_model.py#L78-L89
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
custom/abt/reports/filters.py
python
UserFilterDataSource.order_by
(self)
return [OrderBy('username')]
[]
def order_by(self): return [OrderBy('username')]
[ "def", "order_by", "(", "self", ")", ":", "return", "[", "OrderBy", "(", "'username'", ")", "]" ]
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/custom/abt/reports/filters.py#L65-L66
yuzcccc/vqa-mfb
7fab8dddca5924ed1023149795cdaeacf029ff34
mfh_baseline/vqa_data_layer.py
python
VQADataProvider.extract_answer_prob
(self,answer_obj)
Return the most popular answer in string.
Return the most popular answer in string.
[ "Return", "the", "most", "popular", "answer", "in", "string", "." ]
def extract_answer_prob(self,answer_obj): """ Return the most popular answer in string.""" if self.mode == 'test-dev' or self.mode == 'test': return -1 answer_list = [ ans['answer'] for ans in answer_obj] prob_answer_list = [] for ans in answer_list: if s...
[ "def", "extract_answer_prob", "(", "self", ",", "answer_obj", ")", ":", "if", "self", ".", "mode", "==", "'test-dev'", "or", "self", ".", "mode", "==", "'test'", ":", "return", "-", "1", "answer_list", "=", "[", "ans", "[", "'answer'", "]", "for", "ans...
https://github.com/yuzcccc/vqa-mfb/blob/7fab8dddca5924ed1023149795cdaeacf029ff34/mfh_baseline/vqa_data_layer.py#L127-L144
biolab/orange3
41685e1c7b1d1babe680113685a2d44bcc9fec0b
Orange/widgets/data/owtable.py
python
OWDataTable.set_dataset
(self, index: int, data: Table)
Set the input dataset.
Set the input dataset.
[ "Set", "the", "input", "dataset", "." ]
def set_dataset(self, index: int, data: Table): """Set the input dataset.""" datasetname = getattr(data, "name", "Data") slot = self._inputs[index] view = slot.view # reset the (header) view state. view.setModel(None) view.horizontalHeader().setSortIndicator(-1, Q...
[ "def", "set_dataset", "(", "self", ",", "index", ":", "int", ",", "data", ":", "Table", ")", ":", "datasetname", "=", "getattr", "(", "data", ",", "\"name\"", ",", "\"Data\"", ")", "slot", "=", "self", ".", "_inputs", "[", "index", "]", "view", "=", ...
https://github.com/biolab/orange3/blob/41685e1c7b1d1babe680113685a2d44bcc9fec0b/Orange/widgets/data/owtable.py#L282-L297
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/mpmath/matrices/calculus.py
python
MatrixCalculusMethods.logm
(ctx, A)
return L
r""" Computes a logarithm of the square matrix `A`, i.e. returns a matrix `B = \log(A)` such that `\exp(B) = A`. The logarithm of a matrix, if it exists, is not unique. **Examples** Logarithms of some simple matrices:: >>> from mpmath import * >>> mp.dp...
r""" Computes a logarithm of the square matrix `A`, i.e. returns a matrix `B = \log(A)` such that `\exp(B) = A`. The logarithm of a matrix, if it exists, is not unique.
[ "r", "Computes", "a", "logarithm", "of", "the", "square", "matrix", "A", "i", ".", "e", ".", "returns", "a", "matrix", "B", "=", "\\", "log", "(", "A", ")", "such", "that", "\\", "exp", "(", "B", ")", "=", "A", ".", "The", "logarithm", "of", "a...
def logm(ctx, A): r""" Computes a logarithm of the square matrix `A`, i.e. returns a matrix `B = \log(A)` such that `\exp(B) = A`. The logarithm of a matrix, if it exists, is not unique. **Examples** Logarithms of some simple matrices:: >>> from mpmath impo...
[ "def", "logm", "(", "ctx", ",", "A", ")", ":", "A", "=", "ctx", ".", "matrix", "(", "A", ")", "prec", "=", "ctx", ".", "prec", "try", ":", "ctx", ".", "prec", "+=", "10", "tol", "=", "ctx", ".", "eps", "*", "128", "I", "=", "A", "**", "0"...
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/mpmath/matrices/calculus.py#L350-L462
KalleHallden/AutoTimer
2d954216700c4930baa154e28dbddc34609af7ce
env/lib/python2.7/site-packages/pip/_vendor/packaging/version.py
python
_parse_version_parts
(s)
[]
def _parse_version_parts(s): for part in _legacy_version_component_re.split(s): part = _legacy_version_replacement_map.get(part, part) if not part or part == ".": continue if part[:1] in "0123456789": # pad for numeric comparison yield part.zfill(8) ...
[ "def", "_parse_version_parts", "(", "s", ")", ":", "for", "part", "in", "_legacy_version_component_re", ".", "split", "(", "s", ")", ":", "part", "=", "_legacy_version_replacement_map", ".", "get", "(", "part", ",", "part", ")", "if", "not", "part", "or", ...
https://github.com/KalleHallden/AutoTimer/blob/2d954216700c4930baa154e28dbddc34609af7ce/env/lib/python2.7/site-packages/pip/_vendor/packaging/version.py#L135-L149
SteveDoyle2/pyNastran
eda651ac2d4883d95a34951f8a002ff94f642a1a
pyNastran/gui/menus/legend/qt_legend.py
python
LegendPropertiesWindow.on_default_arrow_scale
(self)
action when user clicks 'Default' for arrow_scale factor
action when user clicks 'Default' for arrow_scale factor
[ "action", "when", "user", "clicks", "Default", "for", "arrow_scale", "factor" ]
def on_default_arrow_scale(self): """action when user clicks 'Default' for arrow_scale factor""" self.arrow_scale_edit.setText(func_str_or_none(self._default_arrow_scale)) self.arrow_scale_edit.setStyleSheet("QLineEdit{background: white;}")
[ "def", "on_default_arrow_scale", "(", "self", ")", ":", "self", ".", "arrow_scale_edit", ".", "setText", "(", "func_str_or_none", "(", "self", ".", "_default_arrow_scale", ")", ")", "self", ".", "arrow_scale_edit", ".", "setStyleSheet", "(", "\"QLineEdit{background:...
https://github.com/SteveDoyle2/pyNastran/blob/eda651ac2d4883d95a34951f8a002ff94f642a1a/pyNastran/gui/menus/legend/qt_legend.py#L734-L737
clinton-hall/nzbToMedia
27669389216902d1085660167e7bda0bd8527ecf
libs/common/click/globals.py
python
push_context
(ctx)
Pushes a new context to the current stack.
Pushes a new context to the current stack.
[ "Pushes", "a", "new", "context", "to", "the", "current", "stack", "." ]
def push_context(ctx): """Pushes a new context to the current stack.""" _local.__dict__.setdefault('stack', []).append(ctx)
[ "def", "push_context", "(", "ctx", ")", ":", "_local", ".", "__dict__", ".", "setdefault", "(", "'stack'", ",", "[", "]", ")", ".", "append", "(", "ctx", ")" ]
https://github.com/clinton-hall/nzbToMedia/blob/27669389216902d1085660167e7bda0bd8527ecf/libs/common/click/globals.py#L29-L31
khanhnamle1994/natural-language-processing
01d450d5ac002b0156ef4cf93a07cb508c1bcdc5
assignment1/.env/lib/python2.7/site-packages/IPython/external/pexpect/_pexpect.py
python
searcher_string.search
(self, buffer, freshlen, searchwindowsize=None)
return best_index
This searches 'buffer' for the first occurence of one of the search strings. 'freshlen' must indicate the number of bytes at the end of 'buffer' which have not been searched before. It helps to avoid searching the same, possibly big, buffer over and over again. See class spawn for the ...
This searches 'buffer' for the first occurence of one of the search strings. 'freshlen' must indicate the number of bytes at the end of 'buffer' which have not been searched before. It helps to avoid searching the same, possibly big, buffer over and over again.
[ "This", "searches", "buffer", "for", "the", "first", "occurence", "of", "one", "of", "the", "search", "strings", ".", "freshlen", "must", "indicate", "the", "number", "of", "bytes", "at", "the", "end", "of", "buffer", "which", "have", "not", "been", "searc...
def search(self, buffer, freshlen, searchwindowsize=None): """This searches 'buffer' for the first occurence of one of the search strings. 'freshlen' must indicate the number of bytes at the end of 'buffer' which have not been searched before. It helps to avoid searching the same, poss...
[ "def", "search", "(", "self", ",", "buffer", ",", "freshlen", ",", "searchwindowsize", "=", "None", ")", ":", "absurd_match", "=", "len", "(", "buffer", ")", "first_match", "=", "absurd_match", "# 'freshlen' helps a lot here. Further optimizations could", "# possibly ...
https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/IPython/external/pexpect/_pexpect.py#L1694-L1738
aws/serverless-application-model
ab6943a340a3f489af62b8c70c1366242b2887fe
samtranslator/feature_toggle/feature_toggle.py
python
FeatureToggle._get_dialup
(self, region_config, feature_name)
return DisabledDialup(region_config)
get the right dialup instance if no dialup type is provided or the specified dialup is not supported, an instance of DisabledDialup will be returned :param region_config: region config :param feature_name: feature_name :return: an instance of
get the right dialup instance if no dialup type is provided or the specified dialup is not supported, an instance of DisabledDialup will be returned
[ "get", "the", "right", "dialup", "instance", "if", "no", "dialup", "type", "is", "provided", "or", "the", "specified", "dialup", "is", "not", "supported", "an", "instance", "of", "DisabledDialup", "will", "be", "returned" ]
def _get_dialup(self, region_config, feature_name): """ get the right dialup instance if no dialup type is provided or the specified dialup is not supported, an instance of DisabledDialup will be returned :param region_config: region config :param feature_name: feature_n...
[ "def", "_get_dialup", "(", "self", ",", "region_config", ",", "feature_name", ")", ":", "dialup_type", "=", "region_config", ".", "get", "(", "\"type\"", ")", "if", "dialup_type", "in", "FeatureToggle", ".", "DIALUP_RESOLVER", ":", "return", "FeatureToggle", "."...
https://github.com/aws/serverless-application-model/blob/ab6943a340a3f489af62b8c70c1366242b2887fe/samtranslator/feature_toggle/feature_toggle.py#L39-L55
PaddlePaddle/PaddleSeg
8a9196177c9e4b0187f90cbc6a6bc38a652eba73
paddleseg/utils/ema.py
python
EMA.apply
(self)
Save the origin data and use the EMA data to replace the origin data.
Save the origin data and use the EMA data to replace the origin data.
[ "Save", "the", "origin", "data", "and", "use", "the", "EMA", "data", "to", "replace", "the", "origin", "data", "." ]
def apply(self): """ Save the origin data and use the EMA data to replace the origin data. """ for name, param in self._model.named_parameters(): if not param.stop_gradient: assert name in self._ema_data, \ "The param ({}) isn't in the mode...
[ "def", "apply", "(", "self", ")", ":", "for", "name", ",", "param", "in", "self", ".", "_model", ".", "named_parameters", "(", ")", ":", "if", "not", "param", ".", "stop_gradient", ":", "assert", "name", "in", "self", ".", "_ema_data", ",", "\"The para...
https://github.com/PaddlePaddle/PaddleSeg/blob/8a9196177c9e4b0187f90cbc6a6bc38a652eba73/paddleseg/utils/ema.py#L82-L91
eirannejad/pyRevit
49c0b7eb54eb343458ce1365425e6552d0c47d44
site-packages/sqlalchemy/orm/relationships.py
python
JoinCondition._annotate_fks
(self)
Annotate the primaryjoin and secondaryjoin structures with 'foreign' annotations marking columns considered as foreign.
Annotate the primaryjoin and secondaryjoin structures with 'foreign' annotations marking columns considered as foreign.
[ "Annotate", "the", "primaryjoin", "and", "secondaryjoin", "structures", "with", "foreign", "annotations", "marking", "columns", "considered", "as", "foreign", "." ]
def _annotate_fks(self): """Annotate the primaryjoin and secondaryjoin structures with 'foreign' annotations marking columns considered as foreign. """ if self._has_foreign_annotations: return if self.consider_as_foreign_keys: self._annotate_from...
[ "def", "_annotate_fks", "(", "self", ")", ":", "if", "self", ".", "_has_foreign_annotations", ":", "return", "if", "self", ".", "consider_as_foreign_keys", ":", "self", ".", "_annotate_from_fk_list", "(", ")", "else", ":", "self", ".", "_annotate_present_fks", "...
https://github.com/eirannejad/pyRevit/blob/49c0b7eb54eb343458ce1365425e6552d0c47d44/site-packages/sqlalchemy/orm/relationships.py#L2173-L2185
jhorey/ferry
bbaa047df08386e17130a939e20fde5e840d1ffa
ferry/fabric/local.py
python
LocalFabric.alloc
(self, cluster_uuid, service_uuid, container_info, ctype)
return containers
Allocate several instances.
Allocate several instances.
[ "Allocate", "several", "instances", "." ]
def alloc(self, cluster_uuid, service_uuid, container_info, ctype): """ Allocate several instances. """ containers = [] mounts = {} for c in container_info: # Get a new IP address for this container and construct # a default command. g...
[ "def", "alloc", "(", "self", ",", "cluster_uuid", ",", "service_uuid", ",", "container_info", ",", "ctype", ")", ":", "containers", "=", "[", "]", "mounts", "=", "{", "}", "for", "c", "in", "container_info", ":", "# Get a new IP address for this container and co...
https://github.com/jhorey/ferry/blob/bbaa047df08386e17130a939e20fde5e840d1ffa/ferry/fabric/local.py#L115-L200
apple/coremltools
141a83af482fcbdd5179807c9eaff9a7999c2c49
coremltools/converters/onnx/_operators_nd.py
python
_convert_clip
(builder, node, graph, err)
convert to CoreML Clip Layer: https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#L5066
convert to CoreML Clip Layer: https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#L5066
[ "convert", "to", "CoreML", "Clip", "Layer", ":", "https", ":", "//", "github", ".", "com", "/", "apple", "/", "coremltools", "/", "blob", "/", "655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492", "/", "mlmodel", "/", "format", "/", "NeuralNetwork", ".", "proto#L5066" ]
def _convert_clip(builder, node, graph, err): """ convert to CoreML Clip Layer: https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#L5066 """ max_value = node.attrs.get("max", 3.4028234663852886e38) min_value = node.attrs.get("min...
[ "def", "_convert_clip", "(", "builder", ",", "node", ",", "graph", ",", "err", ")", ":", "max_value", "=", "node", ".", "attrs", ".", "get", "(", "\"max\"", ",", "3.4028234663852886e38", ")", "min_value", "=", "node", ".", "attrs", ".", "get", "(", "\"...
https://github.com/apple/coremltools/blob/141a83af482fcbdd5179807c9eaff9a7999c2c49/coremltools/converters/onnx/_operators_nd.py#L502-L515
GoogleCloudPlatform/PerfKitBenchmarker
6e3412d7d5e414b8ca30ed5eaf970cef1d919a67
perfkitbenchmarker/providers/azure/azure_virtual_machine.py
python
AzureVirtualMachine._Create
(self)
See base class.
See base class.
[ "See", "base", "class", "." ]
def _Create(self): """See base class.""" if self.os_disk.disk_size: disk_size_args = ['--os-disk-size-gb', str(self.os_disk.disk_size)] else: disk_size_args = [] tags = {} tags.update(self.vm_metadata) tags.update(util.GetResourceTags(self.resource_group.timeout_minutes)) tag_ar...
[ "def", "_Create", "(", "self", ")", ":", "if", "self", ".", "os_disk", ".", "disk_size", ":", "disk_size_args", "=", "[", "'--os-disk-size-gb'", ",", "str", "(", "self", ".", "os_disk", ".", "disk_size", ")", "]", "else", ":", "disk_size_args", "=", "[",...
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/6e3412d7d5e414b8ca30ed5eaf970cef1d919a67/perfkitbenchmarker/providers/azure/azure_virtual_machine.py#L550-L632
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/dayu/v20180709/dayu_client.py
python
DayuClient.DeleteL7Rules
(self, request)
删除七层转发规则 :param request: Request instance for DeleteL7Rules. :type request: :class:`tencentcloud.dayu.v20180709.models.DeleteL7RulesRequest` :rtype: :class:`tencentcloud.dayu.v20180709.models.DeleteL7RulesResponse`
删除七层转发规则
[ "删除七层转发规则" ]
def DeleteL7Rules(self, request): """删除七层转发规则 :param request: Request instance for DeleteL7Rules. :type request: :class:`tencentcloud.dayu.v20180709.models.DeleteL7RulesRequest` :rtype: :class:`tencentcloud.dayu.v20180709.models.DeleteL7RulesResponse` """ try: ...
[ "def", "DeleteL7Rules", "(", "self", ",", "request", ")", ":", "try", ":", "params", "=", "request", ".", "_serialize", "(", ")", "body", "=", "self", ".", "call", "(", "\"DeleteL7Rules\"", ",", "params", ")", "response", "=", "json", ".", "loads", "("...
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/dayu/v20180709/dayu_client.py#L701-L726
firedrakeproject/firedrake
06ab4975c14c0d4dcb79be55821f8b9e41554125
firedrake/preconditioners/fdm.py
python
FDMPC.get_interior_facet_maps
(V)
return facet_to_nodes_fun, local_facet_data_fun, nfacets
Extrude V.interior_facet_node_map and V.ufl_domain().interior_facets.local_facet_dat :arg V: a :class:`FunctionSpace` :returns: the 3-tuple of facet_to_nodes_fun: maps interior facets to the nodes of the two cells sharing it, local_facet_data_fun: maps interior facets to the lo...
Extrude V.interior_facet_node_map and V.ufl_domain().interior_facets.local_facet_dat
[ "Extrude", "V", ".", "interior_facet_node_map", "and", "V", ".", "ufl_domain", "()", ".", "interior_facets", ".", "local_facet_dat" ]
def get_interior_facet_maps(V): """ Extrude V.interior_facet_node_map and V.ufl_domain().interior_facets.local_facet_dat :arg V: a :class:`FunctionSpace` :returns: the 3-tuple of facet_to_nodes_fun: maps interior facets to the nodes of the two cells sharing it, ...
[ "def", "get_interior_facet_maps", "(", "V", ")", ":", "mesh", "=", "V", ".", "ufl_domain", "(", ")", "intfacets", "=", "mesh", ".", "interior_facets", "facet_to_cells", "=", "intfacets", ".", "facet_cell_map", ".", "values", "local_facet_data", "=", "intfacets",...
https://github.com/firedrakeproject/firedrake/blob/06ab4975c14c0d4dcb79be55821f8b9e41554125/firedrake/preconditioners/fdm.py#L912-L980