repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
AASHE/python-membersuite-api-client | membersuite_api_client/organizations/services.py | OrganizationService.get_individuals_for_primary_organization | def get_individuals_for_primary_organization(self,
organization):
"""
Returns all Individuals that have `organization` as a primary org.
"""
if not self.client.session_id:
self.client.request_session()
object_query = ... | python | def get_individuals_for_primary_organization(self,
organization):
"""
Returns all Individuals that have `organization` as a primary org.
"""
if not self.client.session_id:
self.client.request_session()
object_query = ... | [
"def",
"get_individuals_for_primary_organization",
"(",
"self",
",",
"organization",
")",
":",
"if",
"not",
"self",
".",
"client",
".",
"session_id",
":",
"self",
".",
"client",
".",
"request_session",
"(",
")",
"object_query",
"=",
"(",
"\"SELECT Objects() FROM I... | Returns all Individuals that have `organization` as a primary org. | [
"Returns",
"all",
"Individuals",
"that",
"have",
"organization",
"as",
"a",
"primary",
"org",
"."
] | 221f5ed8bc7d4424237a4669c5af9edc11819ee9 | https://github.com/AASHE/python-membersuite-api-client/blob/221f5ed8bc7d4424237a4669c5af9edc11819ee9/membersuite_api_client/organizations/services.py#L109-L140 | train |
20c/grainy | grainy/core.py | Namespace.match | def match(self, keys, partial=True):
"""
Check if the value of this namespace is matched by
keys
'*' is treated as wildcard
Arguments:
keys -- list of keys
Examples:
ns = Namespace("a.b.c")
ns.match(["a"]) #True
ns.match(["... | python | def match(self, keys, partial=True):
"""
Check if the value of this namespace is matched by
keys
'*' is treated as wildcard
Arguments:
keys -- list of keys
Examples:
ns = Namespace("a.b.c")
ns.match(["a"]) #True
ns.match(["... | [
"def",
"match",
"(",
"self",
",",
"keys",
",",
"partial",
"=",
"True",
")",
":",
"if",
"not",
"partial",
"and",
"len",
"(",
"keys",
")",
"!=",
"self",
".",
"length",
":",
"return",
"False",
"c",
"=",
"0",
"for",
"k",
"in",
"keys",
":",
"if",
"c... | Check if the value of this namespace is matched by
keys
'*' is treated as wildcard
Arguments:
keys -- list of keys
Examples:
ns = Namespace("a.b.c")
ns.match(["a"]) #True
ns.match(["a","b"]) #True
ns.match(["a","b","c"]) #True
... | [
"Check",
"if",
"the",
"value",
"of",
"this",
"namespace",
"is",
"matched",
"by",
"keys"
] | cd956fd4144044993abc967974a127aab07a8ef6 | https://github.com/20c/grainy/blob/cd956fd4144044993abc967974a127aab07a8ef6/grainy/core.py#L81-L113 | train |
20c/grainy | grainy/core.py | Namespace.container | def container(self, data=None):
"""
Creates a dict built from the keys of this namespace
Returns the dict created as well as the tail in a tuple
Example:
self.value = "a.b.c"
container, tail = self.container()
#{"a":{"b":{"c":{}}}, {}
... | python | def container(self, data=None):
"""
Creates a dict built from the keys of this namespace
Returns the dict created as well as the tail in a tuple
Example:
self.value = "a.b.c"
container, tail = self.container()
#{"a":{"b":{"c":{}}}, {}
... | [
"def",
"container",
"(",
"self",
",",
"data",
"=",
"None",
")",
":",
"if",
"data",
"is",
"None",
":",
"data",
"=",
"{",
"}",
"root",
"=",
"p",
"=",
"d",
"=",
"{",
"}",
"j",
"=",
"0",
"k",
"=",
"None",
"for",
"k",
"in",
"self",
":",
"d",
"... | Creates a dict built from the keys of this namespace
Returns the dict created as well as the tail in a tuple
Example:
self.value = "a.b.c"
container, tail = self.container()
#{"a":{"b":{"c":{}}}, {}
container, tail = self.container({"d":123})
... | [
"Creates",
"a",
"dict",
"built",
"from",
"the",
"keys",
"of",
"this",
"namespace"
] | cd956fd4144044993abc967974a127aab07a8ef6 | https://github.com/20c/grainy/blob/cd956fd4144044993abc967974a127aab07a8ef6/grainy/core.py#L115-L144 | train |
20c/grainy | grainy/core.py | PermissionSet.update_index | def update_index(self):
"""
Regenerates the permission index for this set
Called everytime a rule is added / removed / modified in
the set
"""
# update index
idx = {}
for _, p in sorted(self.permissions.items(), key=lambda x: str(x[0])):
bra... | python | def update_index(self):
"""
Regenerates the permission index for this set
Called everytime a rule is added / removed / modified in
the set
"""
# update index
idx = {}
for _, p in sorted(self.permissions.items(), key=lambda x: str(x[0])):
bra... | [
"def",
"update_index",
"(",
"self",
")",
":",
"# update index",
"idx",
"=",
"{",
"}",
"for",
"_",
",",
"p",
"in",
"sorted",
"(",
"self",
".",
"permissions",
".",
"items",
"(",
")",
",",
"key",
"=",
"lambda",
"x",
":",
"str",
"(",
"x",
"[",
"0",
... | Regenerates the permission index for this set
Called everytime a rule is added / removed / modified in
the set | [
"Regenerates",
"the",
"permission",
"index",
"for",
"this",
"set"
] | cd956fd4144044993abc967974a127aab07a8ef6 | https://github.com/20c/grainy/blob/cd956fd4144044993abc967974a127aab07a8ef6/grainy/core.py#L274-L319 | train |
20c/grainy | grainy/core.py | PermissionSet.get_permissions | def get_permissions(self, namespace, explicit=False):
"""
Returns the permissions level for the specified namespace
Arguments:
namespace -- permissioning namespace (str)
explicit -- require explicitly set permissions to the provided namespace
Returns:
int -- p... | python | def get_permissions(self, namespace, explicit=False):
"""
Returns the permissions level for the specified namespace
Arguments:
namespace -- permissioning namespace (str)
explicit -- require explicitly set permissions to the provided namespace
Returns:
int -- p... | [
"def",
"get_permissions",
"(",
"self",
",",
"namespace",
",",
"explicit",
"=",
"False",
")",
":",
"if",
"not",
"isinstance",
"(",
"namespace",
",",
"Namespace",
")",
":",
"namespace",
"=",
"Namespace",
"(",
"namespace",
")",
"keys",
"=",
"namespace",
".",
... | Returns the permissions level for the specified namespace
Arguments:
namespace -- permissioning namespace (str)
explicit -- require explicitly set permissions to the provided namespace
Returns:
int -- permissioning flags | [
"Returns",
"the",
"permissions",
"level",
"for",
"the",
"specified",
"namespace"
] | cd956fd4144044993abc967974a127aab07a8ef6 | https://github.com/20c/grainy/blob/cd956fd4144044993abc967974a127aab07a8ef6/grainy/core.py#L360-L378 | train |
20c/grainy | grainy/core.py | PermissionSet.check | def check(self, namespace, level, explicit=False):
"""
Checks if the permset has permission to the specified namespace
at the specified level
Arguments:
namespace -- permissioning namespace (str)
level -- permissioning level (int) (PERM_READ for example)
explici... | python | def check(self, namespace, level, explicit=False):
"""
Checks if the permset has permission to the specified namespace
at the specified level
Arguments:
namespace -- permissioning namespace (str)
level -- permissioning level (int) (PERM_READ for example)
explici... | [
"def",
"check",
"(",
"self",
",",
"namespace",
",",
"level",
",",
"explicit",
"=",
"False",
")",
":",
"return",
"(",
"self",
".",
"get_permissions",
"(",
"namespace",
",",
"explicit",
"=",
"explicit",
")",
"&",
"level",
")",
"!=",
"0"
] | Checks if the permset has permission to the specified namespace
at the specified level
Arguments:
namespace -- permissioning namespace (str)
level -- permissioning level (int) (PERM_READ for example)
explicit -- require explicitly set permissions to the provided namespace
... | [
"Checks",
"if",
"the",
"permset",
"has",
"permission",
"to",
"the",
"specified",
"namespace",
"at",
"the",
"specified",
"level"
] | cd956fd4144044993abc967974a127aab07a8ef6 | https://github.com/20c/grainy/blob/cd956fd4144044993abc967974a127aab07a8ef6/grainy/core.py#L381-L397 | train |
a1ezzz/wasp-general | wasp_general/crypto/hmac.py | WHMAC.hash | def hash(self, key, message=None):
""" Return digest of the given message and key
:param key: secret HMAC key
:param message: code (message) to authenticate
:return: bytes
"""
hmac_obj = hmac.HMAC(key, self.__digest_generator, backend=default_backend())
if message is not None:
hmac_obj.update(message... | python | def hash(self, key, message=None):
""" Return digest of the given message and key
:param key: secret HMAC key
:param message: code (message) to authenticate
:return: bytes
"""
hmac_obj = hmac.HMAC(key, self.__digest_generator, backend=default_backend())
if message is not None:
hmac_obj.update(message... | [
"def",
"hash",
"(",
"self",
",",
"key",
",",
"message",
"=",
"None",
")",
":",
"hmac_obj",
"=",
"hmac",
".",
"HMAC",
"(",
"key",
",",
"self",
".",
"__digest_generator",
",",
"backend",
"=",
"default_backend",
"(",
")",
")",
"if",
"message",
"is",
"no... | Return digest of the given message and key
:param key: secret HMAC key
:param message: code (message) to authenticate
:return: bytes | [
"Return",
"digest",
"of",
"the",
"given",
"message",
"and",
"key"
] | 1029839d33eb663f8dec76c1c46754d53c1de4a9 | https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/crypto/hmac.py#L69-L80 | train |
mangalam-research/selenic | selenic/tables.py | Table.call_with_search_field | def call_with_search_field(self, name, callback):
"""
Calls a piece of code with the DOM element that corresponds to
a search field of the table.
If the callback causes a ``StaleElementReferenceException``,
this method will refetch the search fields and try
again. Conseq... | python | def call_with_search_field(self, name, callback):
"""
Calls a piece of code with the DOM element that corresponds to
a search field of the table.
If the callback causes a ``StaleElementReferenceException``,
this method will refetch the search fields and try
again. Conseq... | [
"def",
"call_with_search_field",
"(",
"self",
",",
"name",
",",
"callback",
")",
":",
"done",
"=",
"False",
"while",
"not",
"done",
":",
"def",
"check",
"(",
"*",
"_",
")",
":",
"if",
"name",
"in",
"self",
".",
"_search_fields",
":",
"return",
"True",
... | Calls a piece of code with the DOM element that corresponds to
a search field of the table.
If the callback causes a ``StaleElementReferenceException``,
this method will refetch the search fields and try
again. Consequently **the callback should be designed to be
callable multip... | [
"Calls",
"a",
"piece",
"of",
"code",
"with",
"the",
"DOM",
"element",
"that",
"corresponds",
"to",
"a",
"search",
"field",
"of",
"the",
"table",
"."
] | 2284c68e15fa3d34b88aa2eec1a2e8ecd37f44ad | https://github.com/mangalam-research/selenic/blob/2284c68e15fa3d34b88aa2eec1a2e8ecd37f44ad/selenic/tables.py#L121-L154 | train |
olitheolix/qtmacs | qtmacs/platform_setup.py | determine_keymap | def determine_keymap(qteMain=None):
"""
Return the conversion from keys and modifiers to Qt constants.
This mapping depends on the used OS and keyboard layout.
.. warning :: This method is currently only a dummy that always
returns the same mapping from characters to keys. It works fine
... | python | def determine_keymap(qteMain=None):
"""
Return the conversion from keys and modifiers to Qt constants.
This mapping depends on the used OS and keyboard layout.
.. warning :: This method is currently only a dummy that always
returns the same mapping from characters to keys. It works fine
... | [
"def",
"determine_keymap",
"(",
"qteMain",
"=",
"None",
")",
":",
"if",
"qteMain",
"is",
"None",
":",
"# This case should only happen for testing purposes.",
"qte_global",
".",
"Qt_key_map",
"=",
"default_qt_keymap",
"qte_global",
".",
"Qt_modifier_map",
"=",
"default_q... | Return the conversion from keys and modifiers to Qt constants.
This mapping depends on the used OS and keyboard layout.
.. warning :: This method is currently only a dummy that always
returns the same mapping from characters to keys. It works fine
on my Linux and Windows 7 machine using English/... | [
"Return",
"the",
"conversion",
"from",
"keys",
"and",
"modifiers",
"to",
"Qt",
"constants",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/platform_setup.py#L158-L178 | train |
pmacosta/pexdoc | docs/support/my_module.py | func | def func(name):
r"""
Print your name.
:param name: Name to print
:type name: string
.. [[[cog cog.out(exobj.get_sphinx_autodoc(width=69))]]]
.. [[[end]]]
"""
# Raise condition evaluated in same call as exception addition
pexdoc.addex(TypeError, "Argument `name` is not valid", not... | python | def func(name):
r"""
Print your name.
:param name: Name to print
:type name: string
.. [[[cog cog.out(exobj.get_sphinx_autodoc(width=69))]]]
.. [[[end]]]
"""
# Raise condition evaluated in same call as exception addition
pexdoc.addex(TypeError, "Argument `name` is not valid", not... | [
"def",
"func",
"(",
"name",
")",
":",
"# Raise condition evaluated in same call as exception addition",
"pexdoc",
".",
"addex",
"(",
"TypeError",
",",
"\"Argument `name` is not valid\"",
",",
"not",
"isinstance",
"(",
"name",
",",
"str",
")",
")",
"return",
"\"My name... | r"""
Print your name.
:param name: Name to print
:type name: string
.. [[[cog cog.out(exobj.get_sphinx_autodoc(width=69))]]]
.. [[[end]]] | [
"r",
"Print",
"your",
"name",
"."
] | 201ac243e5781347feb75896a4231429fe6da4b1 | https://github.com/pmacosta/pexdoc/blob/201ac243e5781347feb75896a4231429fe6da4b1/docs/support/my_module.py#L20-L33 | train |
olitheolix/qtmacs | qtmacs/extensions/qtmacsscintilla_macros.py | YankPop.disableHook | def disableHook(self, msgObj):
"""
Disable yank-pop.
The ``enableHook`` method (see below) connects this method
to the ``qtesigKeyseqComplete`` signal to catch
consecutive calls to this ``yank-pop`` macro. Once the user
issues a key sequence for any other macro but this ... | python | def disableHook(self, msgObj):
"""
Disable yank-pop.
The ``enableHook`` method (see below) connects this method
to the ``qtesigKeyseqComplete`` signal to catch
consecutive calls to this ``yank-pop`` macro. Once the user
issues a key sequence for any other macro but this ... | [
"def",
"disableHook",
"(",
"self",
",",
"msgObj",
")",
":",
"# Unpack the data structure.",
"macroName",
",",
"keysequence",
"=",
"msgObj",
".",
"data",
"if",
"macroName",
"!=",
"self",
".",
"qteMacroName",
"(",
")",
":",
"self",
".",
"qteMain",
".",
"qtesig... | Disable yank-pop.
The ``enableHook`` method (see below) connects this method
to the ``qtesigKeyseqComplete`` signal to catch
consecutive calls to this ``yank-pop`` macro. Once the user
issues a key sequence for any other macro but this one, the
kill-list index will be set to a n... | [
"Disable",
"yank",
"-",
"pop",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacsscintilla_macros.py#L912-L928 | train |
olitheolix/qtmacs | qtmacs/extensions/qtmacsscintilla_macros.py | SearchForwardMiniApplet.clearHighlighting | def clearHighlighting(self):
"""
Restore the original style properties of all matches.
This method effectively removes all visible traces of
the match highlighting.
"""
SCI = self.qteWidget
self.qteWidget.SCISetStylingEx(0, 0, self.styleOrig)
# Clear out... | python | def clearHighlighting(self):
"""
Restore the original style properties of all matches.
This method effectively removes all visible traces of
the match highlighting.
"""
SCI = self.qteWidget
self.qteWidget.SCISetStylingEx(0, 0, self.styleOrig)
# Clear out... | [
"def",
"clearHighlighting",
"(",
"self",
")",
":",
"SCI",
"=",
"self",
".",
"qteWidget",
"self",
".",
"qteWidget",
".",
"SCISetStylingEx",
"(",
"0",
",",
"0",
",",
"self",
".",
"styleOrig",
")",
"# Clear out the match set and reset the match index.",
"self",
"."... | Restore the original style properties of all matches.
This method effectively removes all visible traces of
the match highlighting. | [
"Restore",
"the",
"original",
"style",
"properties",
"of",
"all",
"matches",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacsscintilla_macros.py#L1449-L1461 | train |
olitheolix/qtmacs | qtmacs/extensions/qtmacsscintilla_macros.py | SearchForwardMiniApplet.highlightNextMatch | def highlightNextMatch(self):
"""
Select and highlight the next match in the set of matches.
"""
# If this method was called on an empty input field (ie.
# if the user hit <ctrl>+s again) then pick the default
# selection.
if self.qteText.toPlainText() == '':
... | python | def highlightNextMatch(self):
"""
Select and highlight the next match in the set of matches.
"""
# If this method was called on an empty input field (ie.
# if the user hit <ctrl>+s again) then pick the default
# selection.
if self.qteText.toPlainText() == '':
... | [
"def",
"highlightNextMatch",
"(",
"self",
")",
":",
"# If this method was called on an empty input field (ie.",
"# if the user hit <ctrl>+s again) then pick the default",
"# selection.",
"if",
"self",
".",
"qteText",
".",
"toPlainText",
"(",
")",
"==",
"''",
":",
"self",
".... | Select and highlight the next match in the set of matches. | [
"Select",
"and",
"highlight",
"the",
"next",
"match",
"in",
"the",
"set",
"of",
"matches",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacsscintilla_macros.py#L1463-L1500 | train |
olitheolix/qtmacs | qtmacs/extensions/qtmacsscintilla_macros.py | QueryReplaceMiniApplet.nextMode | def nextMode(self):
"""
Put the search-replace macro into the next stage. The first stage
is the query stage to ask the user for the string to replace,
the second stage is to query the string to replace it with,
and the third allows to replace or skip individual matches,
... | python | def nextMode(self):
"""
Put the search-replace macro into the next stage. The first stage
is the query stage to ask the user for the string to replace,
the second stage is to query the string to replace it with,
and the third allows to replace or skip individual matches,
... | [
"def",
"nextMode",
"(",
"self",
")",
":",
"# Terminate the replacement procedure if the no match was found.",
"if",
"len",
"(",
"self",
".",
"matchList",
")",
"==",
"0",
":",
"self",
".",
"qteAbort",
"(",
"QtmacsMessage",
"(",
")",
")",
"self",
".",
"qteMain",
... | Put the search-replace macro into the next stage. The first stage
is the query stage to ask the user for the string to replace,
the second stage is to query the string to replace it with,
and the third allows to replace or skip individual matches,
or replace them all automatically. | [
"Put",
"the",
"search",
"-",
"replace",
"macro",
"into",
"the",
"next",
"stage",
".",
"The",
"first",
"stage",
"is",
"the",
"query",
"stage",
"to",
"ask",
"the",
"user",
"for",
"the",
"string",
"to",
"replace",
"the",
"second",
"stage",
"is",
"to",
"qu... | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacsscintilla_macros.py#L1878-L1932 | train |
olitheolix/qtmacs | qtmacs/extensions/qtmacsscintilla_macros.py | QueryReplaceMiniApplet.replaceAll | def replaceAll(self):
"""
Replace all matches after the current cursor position.
This method calls ``replaceSelectedText`` until it returns
**False**, and then closes the mini buffer.
"""
while self.replaceSelected():
pass
self.qteWidget.SCISetStylin... | python | def replaceAll(self):
"""
Replace all matches after the current cursor position.
This method calls ``replaceSelectedText`` until it returns
**False**, and then closes the mini buffer.
"""
while self.replaceSelected():
pass
self.qteWidget.SCISetStylin... | [
"def",
"replaceAll",
"(",
"self",
")",
":",
"while",
"self",
".",
"replaceSelected",
"(",
")",
":",
"pass",
"self",
".",
"qteWidget",
".",
"SCISetStylingEx",
"(",
"0",
",",
"0",
",",
"self",
".",
"styleOrig",
")",
"self",
".",
"qteMain",
".",
"qteKillM... | Replace all matches after the current cursor position.
This method calls ``replaceSelectedText`` until it returns
**False**, and then closes the mini buffer. | [
"Replace",
"all",
"matches",
"after",
"the",
"current",
"cursor",
"position",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacsscintilla_macros.py#L2010-L2021 | train |
olitheolix/qtmacs | qtmacs/extensions/qtmacsscintilla_macros.py | QueryReplaceMiniApplet.compileMatchList | def compileMatchList(self):
"""
Compile the list of spans of every match.
"""
# Get the new sub-string to search for.
self.matchList = []
# Return immediately if the input field is empty.
numChar = len(self.toReplace)
if numChar == 0:
return
... | python | def compileMatchList(self):
"""
Compile the list of spans of every match.
"""
# Get the new sub-string to search for.
self.matchList = []
# Return immediately if the input field is empty.
numChar = len(self.toReplace)
if numChar == 0:
return
... | [
"def",
"compileMatchList",
"(",
"self",
")",
":",
"# Get the new sub-string to search for.",
"self",
".",
"matchList",
"=",
"[",
"]",
"# Return immediately if the input field is empty.",
"numChar",
"=",
"len",
"(",
"self",
".",
"toReplace",
")",
"if",
"numChar",
"==",... | Compile the list of spans of every match. | [
"Compile",
"the",
"list",
"of",
"spans",
"of",
"every",
"match",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacsscintilla_macros.py#L2023-L2044 | train |
olitheolix/qtmacs | qtmacs/extensions/qtmacsscintilla_macros.py | QueryReplaceRegexpMiniApplet.replaceSelected | def replaceSelected(self):
"""
Replace the currently selected string with the new one.
The method return **False** if another match to the right
of the cursor exists, and **True** if not (ie. when the
end of the document was reached).
"""
SCI = self.qteWidget
... | python | def replaceSelected(self):
"""
Replace the currently selected string with the new one.
The method return **False** if another match to the right
of the cursor exists, and **True** if not (ie. when the
end of the document was reached).
"""
SCI = self.qteWidget
... | [
"def",
"replaceSelected",
"(",
"self",
")",
":",
"SCI",
"=",
"self",
".",
"qteWidget",
"# Restore the original styling.",
"self",
".",
"qteWidget",
".",
"SCISetStylingEx",
"(",
"0",
",",
"0",
",",
"self",
".",
"styleOrig",
")",
"# Select the region spanned by the ... | Replace the currently selected string with the new one.
The method return **False** if another match to the right
of the cursor exists, and **True** if not (ie. when the
end of the document was reached). | [
"Replace",
"the",
"currently",
"selected",
"string",
"with",
"the",
"new",
"one",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacsscintilla_macros.py#L2176-L2214 | train |
ashmastaflash/kal-wrapper | kalibrate/kal.py | Kal.scan_band | def scan_band(self, band, **kwargs):
"""Run Kalibrate for a band.
Supported keyword arguments:
gain -- Gain in dB
device -- Index of device to be used
error -- Initial frequency error in ppm
"""
kal_run_line = fn.build_kal_scan_band_string(self.kal_bin,
... | python | def scan_band(self, band, **kwargs):
"""Run Kalibrate for a band.
Supported keyword arguments:
gain -- Gain in dB
device -- Index of device to be used
error -- Initial frequency error in ppm
"""
kal_run_line = fn.build_kal_scan_band_string(self.kal_bin,
... | [
"def",
"scan_band",
"(",
"self",
",",
"band",
",",
"*",
"*",
"kwargs",
")",
":",
"kal_run_line",
"=",
"fn",
".",
"build_kal_scan_band_string",
"(",
"self",
".",
"kal_bin",
",",
"band",
",",
"kwargs",
")",
"raw_output",
"=",
"subprocess",
".",
"check_output... | Run Kalibrate for a band.
Supported keyword arguments:
gain -- Gain in dB
device -- Index of device to be used
error -- Initial frequency error in ppm | [
"Run",
"Kalibrate",
"for",
"a",
"band",
"."
] | 80ee03ab7bd3172ac26b769d6b442960f3424b0e | https://github.com/ashmastaflash/kal-wrapper/blob/80ee03ab7bd3172ac26b769d6b442960f3424b0e/kalibrate/kal.py#L20-L35 | train |
ashmastaflash/kal-wrapper | kalibrate/kal.py | Kal.scan_channel | def scan_channel(self, channel, **kwargs):
"""Run Kalibrate.
Supported keyword arguments:
gain -- Gain in dB
device -- Index of device to be used
error -- Initial frequency error in ppm
"""
kal_run_line = fn.build_kal_scan_channel_string(self.kal_bin,
... | python | def scan_channel(self, channel, **kwargs):
"""Run Kalibrate.
Supported keyword arguments:
gain -- Gain in dB
device -- Index of device to be used
error -- Initial frequency error in ppm
"""
kal_run_line = fn.build_kal_scan_channel_string(self.kal_bin,
... | [
"def",
"scan_channel",
"(",
"self",
",",
"channel",
",",
"*",
"*",
"kwargs",
")",
":",
"kal_run_line",
"=",
"fn",
".",
"build_kal_scan_channel_string",
"(",
"self",
".",
"kal_bin",
",",
"channel",
",",
"kwargs",
")",
"raw_output",
"=",
"subprocess",
".",
"... | Run Kalibrate.
Supported keyword arguments:
gain -- Gain in dB
device -- Index of device to be used
error -- Initial frequency error in ppm | [
"Run",
"Kalibrate",
"."
] | 80ee03ab7bd3172ac26b769d6b442960f3424b0e | https://github.com/ashmastaflash/kal-wrapper/blob/80ee03ab7bd3172ac26b769d6b442960f3424b0e/kalibrate/kal.py#L37-L52 | train |
a1ezzz/wasp-general | wasp_general/network/web/proto.py | WWebRequestProto.get_vars | def get_vars(self):
""" Parse request path and return GET-vars
:return: None or dictionary of names and tuples of values
"""
if self.method() != 'GET':
raise RuntimeError('Unable to return get vars for non-get method')
re_search = WWebRequestProto.get_vars_re.search(self.path())
if re_search is not None... | python | def get_vars(self):
""" Parse request path and return GET-vars
:return: None or dictionary of names and tuples of values
"""
if self.method() != 'GET':
raise RuntimeError('Unable to return get vars for non-get method')
re_search = WWebRequestProto.get_vars_re.search(self.path())
if re_search is not None... | [
"def",
"get_vars",
"(",
"self",
")",
":",
"if",
"self",
".",
"method",
"(",
")",
"!=",
"'GET'",
":",
"raise",
"RuntimeError",
"(",
"'Unable to return get vars for non-get method'",
")",
"re_search",
"=",
"WWebRequestProto",
".",
"get_vars_re",
".",
"search",
"("... | Parse request path and return GET-vars
:return: None or dictionary of names and tuples of values | [
"Parse",
"request",
"path",
"and",
"return",
"GET",
"-",
"vars"
] | 1029839d33eb663f8dec76c1c46754d53c1de4a9 | https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/network/web/proto.py#L139-L148 | train |
a1ezzz/wasp-general | wasp_general/network/web/proto.py | WWebRequestProto.post_vars | def post_vars(self):
""" Parse request payload and return POST-vars
:return: None or dictionary of names and tuples of values
"""
if self.method() != 'POST':
raise RuntimeError('Unable to return post vars for non-get method')
content_type = self.content_type()
if content_type is None or content_type.lo... | python | def post_vars(self):
""" Parse request payload and return POST-vars
:return: None or dictionary of names and tuples of values
"""
if self.method() != 'POST':
raise RuntimeError('Unable to return post vars for non-get method')
content_type = self.content_type()
if content_type is None or content_type.lo... | [
"def",
"post_vars",
"(",
"self",
")",
":",
"if",
"self",
".",
"method",
"(",
")",
"!=",
"'POST'",
":",
"raise",
"RuntimeError",
"(",
"'Unable to return post vars for non-get method'",
")",
"content_type",
"=",
"self",
".",
"content_type",
"(",
")",
"if",
"cont... | Parse request payload and return POST-vars
:return: None or dictionary of names and tuples of values | [
"Parse",
"request",
"payload",
"and",
"return",
"POST",
"-",
"vars"
] | 1029839d33eb663f8dec76c1c46754d53c1de4a9 | https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/network/web/proto.py#L150-L166 | train |
a1ezzz/wasp-general | wasp_general/network/clients/virtual_dir.py | WVirtualDirectoryClient.join_path | def join_path(self, *path):
""" Unite entries to generate a single path
:param path: path items to unite
:return: str
"""
path = self.directory_sep().join(path)
return self.normalize_path(path) | python | def join_path(self, *path):
""" Unite entries to generate a single path
:param path: path items to unite
:return: str
"""
path = self.directory_sep().join(path)
return self.normalize_path(path) | [
"def",
"join_path",
"(",
"self",
",",
"*",
"path",
")",
":",
"path",
"=",
"self",
".",
"directory_sep",
"(",
")",
".",
"join",
"(",
"path",
")",
"return",
"self",
".",
"normalize_path",
"(",
"path",
")"
] | Unite entries to generate a single path
:param path: path items to unite
:return: str | [
"Unite",
"entries",
"to",
"generate",
"a",
"single",
"path"
] | 1029839d33eb663f8dec76c1c46754d53c1de4a9 | https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/network/clients/virtual_dir.py#L77-L85 | train |
a1ezzz/wasp-general | wasp_general/network/clients/virtual_dir.py | WVirtualDirectoryClient.full_path | def full_path(self):
""" Return a full path to a current session directory. A result is made by joining a start path with
current session directory
:return: str
"""
return self.normalize_path(self.directory_sep().join((self.start_path(), self.session_path()))) | python | def full_path(self):
""" Return a full path to a current session directory. A result is made by joining a start path with
current session directory
:return: str
"""
return self.normalize_path(self.directory_sep().join((self.start_path(), self.session_path()))) | [
"def",
"full_path",
"(",
"self",
")",
":",
"return",
"self",
".",
"normalize_path",
"(",
"self",
".",
"directory_sep",
"(",
")",
".",
"join",
"(",
"(",
"self",
".",
"start_path",
"(",
")",
",",
"self",
".",
"session_path",
"(",
")",
")",
")",
")"
] | Return a full path to a current session directory. A result is made by joining a start path with
current session directory
:return: str | [
"Return",
"a",
"full",
"path",
"to",
"a",
"current",
"session",
"directory",
".",
"A",
"result",
"is",
"made",
"by",
"joining",
"a",
"start",
"path",
"with",
"current",
"session",
"directory"
] | 1029839d33eb663f8dec76c1c46754d53c1de4a9 | https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/network/clients/virtual_dir.py#L105-L111 | train |
Chilipp/model-organization | docs/square_full.py | SquareModelOrganizer.run | def run(self, **kwargs):
"""
Run the model
Parameters
----------
``**kwargs``
Any other parameter for the
:meth:`model_organization.ModelOrganizer.app_main` method
"""
from calculate import compute
self.app_main(**kwargs)
... | python | def run(self, **kwargs):
"""
Run the model
Parameters
----------
``**kwargs``
Any other parameter for the
:meth:`model_organization.ModelOrganizer.app_main` method
"""
from calculate import compute
self.app_main(**kwargs)
... | [
"def",
"run",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"calculate",
"import",
"compute",
"self",
".",
"app_main",
"(",
"*",
"*",
"kwargs",
")",
"# get the default output name",
"output",
"=",
"osp",
".",
"join",
"(",
"self",
".",
"exp_conf... | Run the model
Parameters
----------
``**kwargs``
Any other parameter for the
:meth:`model_organization.ModelOrganizer.app_main` method | [
"Run",
"the",
"model"
] | 694d1219c7ed7e1b2b17153afa11bdc21169bca2 | https://github.com/Chilipp/model-organization/blob/694d1219c7ed7e1b2b17153afa11bdc21169bca2/docs/square_full.py#L45-L75 | train |
Chilipp/model-organization | docs/square_full.py | SquareModelOrganizer.postproc | def postproc(self, close=True, **kwargs):
"""
Postprocess and visualize the data
Parameters
----------
close: bool
Close the figure at the end
``**kwargs``
Any other parameter for the
:meth:`model_organization.ModelOrganizer.app_main` ... | python | def postproc(self, close=True, **kwargs):
"""
Postprocess and visualize the data
Parameters
----------
close: bool
Close the figure at the end
``**kwargs``
Any other parameter for the
:meth:`model_organization.ModelOrganizer.app_main` ... | [
"def",
"postproc",
"(",
"self",
",",
"close",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"import",
"matplotlib",
".",
"pyplot",
"as",
"plt",
"import",
"seaborn",
"as",
"sns",
"# for nice plot styles",
"self",
".",
"app_main",
"(",
"*",
"*",
"kwargs"... | Postprocess and visualize the data
Parameters
----------
close: bool
Close the figure at the end
``**kwargs``
Any other parameter for the
:meth:`model_organization.ModelOrganizer.app_main` method | [
"Postprocess",
"and",
"visualize",
"the",
"data"
] | 694d1219c7ed7e1b2b17153afa11bdc21169bca2 | https://github.com/Chilipp/model-organization/blob/694d1219c7ed7e1b2b17153afa11bdc21169bca2/docs/square_full.py#L77-L116 | train |
olitheolix/qtmacs | qtmacs/undo_stack.py | QtmacsUndoStack._push | def _push(self, undoObj: QtmacsUndoCommand):
"""
The actual method that adds the command object onto the stack.
This method also toggles the ``nextIsRedo`` flag in the
command object and, depending on its value, executes either
the ``commit`` or ``reverseCommit`` method of the o... | python | def _push(self, undoObj: QtmacsUndoCommand):
"""
The actual method that adds the command object onto the stack.
This method also toggles the ``nextIsRedo`` flag in the
command object and, depending on its value, executes either
the ``commit`` or ``reverseCommit`` method of the o... | [
"def",
"_push",
"(",
"self",
",",
"undoObj",
":",
"QtmacsUndoCommand",
")",
":",
"self",
".",
"_qteStack",
".",
"append",
"(",
"undoObj",
")",
"if",
"undoObj",
".",
"nextIsRedo",
":",
"undoObj",
".",
"commit",
"(",
")",
"else",
":",
"undoObj",
".",
"re... | The actual method that adds the command object onto the stack.
This method also toggles the ``nextIsRedo`` flag in the
command object and, depending on its value, executes either
the ``commit`` or ``reverseCommit`` method of the object. This
distinction is invisible to the user but if t... | [
"The",
"actual",
"method",
"that",
"adds",
"the",
"command",
"object",
"onto",
"the",
"stack",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/undo_stack.py#L208-L230 | train |
olitheolix/qtmacs | qtmacs/undo_stack.py | QtmacsUndoStack.push | def push(self, undoObj):
"""
Add ``undoObj`` command to stack and run its ``commit`` method.
|Args|
* ``undoObj`` (**QtmacsUndoCommand**): the new command object.
|Returns|
* **None**
|Raises|
* **QtmacsArgumentError** if at least one argument has an... | python | def push(self, undoObj):
"""
Add ``undoObj`` command to stack and run its ``commit`` method.
|Args|
* ``undoObj`` (**QtmacsUndoCommand**): the new command object.
|Returns|
* **None**
|Raises|
* **QtmacsArgumentError** if at least one argument has an... | [
"def",
"push",
"(",
"self",
",",
"undoObj",
")",
":",
"# Check type of input arguments.",
"if",
"not",
"isinstance",
"(",
"undoObj",
",",
"QtmacsUndoCommand",
")",
":",
"raise",
"QtmacsArgumentError",
"(",
"'undoObj'",
",",
"'QtmacsUndoCommand'",
",",
"inspect",
"... | Add ``undoObj`` command to stack and run its ``commit`` method.
|Args|
* ``undoObj`` (**QtmacsUndoCommand**): the new command object.
|Returns|
* **None**
|Raises|
* **QtmacsArgumentError** if at least one argument has an invalid type. | [
"Add",
"undoObj",
"command",
"to",
"stack",
"and",
"run",
"its",
"commit",
"method",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/undo_stack.py#L232-L256 | train |
olitheolix/qtmacs | qtmacs/undo_stack.py | QtmacsUndoStack.undo | def undo(self):
"""
Undo the last command by adding its inverse action to the stack.
This method automatically takes care of applying the correct
inverse action when it is called consecutively (ie. without a
calling ``push`` in between).
The ``qtesigSavedState`` signal ... | python | def undo(self):
"""
Undo the last command by adding its inverse action to the stack.
This method automatically takes care of applying the correct
inverse action when it is called consecutively (ie. without a
calling ``push`` in between).
The ``qtesigSavedState`` signal ... | [
"def",
"undo",
"(",
"self",
")",
":",
"# If it is the first call to this method after a ``push`` then",
"# reset ``qteIndex`` to the last element, otherwise just",
"# decrease it.",
"if",
"not",
"self",
".",
"_wasUndo",
":",
"self",
".",
"_qteIndex",
"=",
"len",
"(",
"self"... | Undo the last command by adding its inverse action to the stack.
This method automatically takes care of applying the correct
inverse action when it is called consecutively (ie. without a
calling ``push`` in between).
The ``qtesigSavedState`` signal is triggered whenever enough undo
... | [
"Undo",
"the",
"last",
"command",
"by",
"adding",
"its",
"inverse",
"action",
"to",
"the",
"stack",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/undo_stack.py#L282-L350 | train |
olitheolix/qtmacs | qtmacs/extensions/qtmacstextedit_widget.py | UndoGenericQtmacsTextEdit.placeCursor | def placeCursor(self, pos):
"""
Try to place the cursor in ``line`` at ``col`` if possible.
If this is not possible, then place it at the end.
"""
if pos > len(self.qteWidget.toPlainText()):
pos = len(self.qteWidget.toPlainText())
tc = self.qteWidget.textCurs... | python | def placeCursor(self, pos):
"""
Try to place the cursor in ``line`` at ``col`` if possible.
If this is not possible, then place it at the end.
"""
if pos > len(self.qteWidget.toPlainText()):
pos = len(self.qteWidget.toPlainText())
tc = self.qteWidget.textCurs... | [
"def",
"placeCursor",
"(",
"self",
",",
"pos",
")",
":",
"if",
"pos",
">",
"len",
"(",
"self",
".",
"qteWidget",
".",
"toPlainText",
"(",
")",
")",
":",
"pos",
"=",
"len",
"(",
"self",
".",
"qteWidget",
".",
"toPlainText",
"(",
")",
")",
"tc",
"=... | Try to place the cursor in ``line`` at ``col`` if possible.
If this is not possible, then place it at the end. | [
"Try",
"to",
"place",
"the",
"cursor",
"in",
"line",
"at",
"col",
"if",
"possible",
".",
"If",
"this",
"is",
"not",
"possible",
"then",
"place",
"it",
"at",
"the",
"end",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacstextedit_widget.py#L99-L109 | train |
olitheolix/qtmacs | qtmacs/extensions/qtmacstextedit_widget.py | UndoGenericQtmacsTextEdit.reverseCommit | def reverseCommit(self):
"""
Reverse the document to the original state.
"""
print(self.after == self.before)
pos = self.qteWidget.textCursor().position()
self.qteWidget.setHtml(self.before)
self.placeCursor(pos) | python | def reverseCommit(self):
"""
Reverse the document to the original state.
"""
print(self.after == self.before)
pos = self.qteWidget.textCursor().position()
self.qteWidget.setHtml(self.before)
self.placeCursor(pos) | [
"def",
"reverseCommit",
"(",
"self",
")",
":",
"print",
"(",
"self",
".",
"after",
"==",
"self",
".",
"before",
")",
"pos",
"=",
"self",
".",
"qteWidget",
".",
"textCursor",
"(",
")",
".",
"position",
"(",
")",
"self",
".",
"qteWidget",
".",
"setHtml... | Reverse the document to the original state. | [
"Reverse",
"the",
"document",
"to",
"the",
"original",
"state",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacstextedit_widget.py#L125-L132 | train |
olitheolix/qtmacs | qtmacs/extensions/qtmacstextedit_widget.py | QtmacsTextEdit.insertFromMimeData | def insertFromMimeData(self, data):
"""
Paste the MIME data at the current cursor position.
This method also adds another undo-object to the undo-stack.
"""
undoObj = UndoPaste(self, data, self.pasteCnt)
self.pasteCnt += 1
self.qteUndoStack.push(undoObj) | python | def insertFromMimeData(self, data):
"""
Paste the MIME data at the current cursor position.
This method also adds another undo-object to the undo-stack.
"""
undoObj = UndoPaste(self, data, self.pasteCnt)
self.pasteCnt += 1
self.qteUndoStack.push(undoObj) | [
"def",
"insertFromMimeData",
"(",
"self",
",",
"data",
")",
":",
"undoObj",
"=",
"UndoPaste",
"(",
"self",
",",
"data",
",",
"self",
".",
"pasteCnt",
")",
"self",
".",
"pasteCnt",
"+=",
"1",
"self",
".",
"qteUndoStack",
".",
"push",
"(",
"undoObj",
")"... | Paste the MIME data at the current cursor position.
This method also adds another undo-object to the undo-stack. | [
"Paste",
"the",
"MIME",
"data",
"at",
"the",
"current",
"cursor",
"position",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacstextedit_widget.py#L322-L330 | train |
olitheolix/qtmacs | qtmacs/extensions/qtmacstextedit_widget.py | QtmacsTextEdit.keyPressEvent | def keyPressEvent(self, keyEvent):
"""
Insert the character at the current cursor position.
This method also adds another undo-object to the undo-stack.
"""
undoObj = UndoSelfInsert(self, keyEvent.text())
self.qteUndoStack.push(undoObj) | python | def keyPressEvent(self, keyEvent):
"""
Insert the character at the current cursor position.
This method also adds another undo-object to the undo-stack.
"""
undoObj = UndoSelfInsert(self, keyEvent.text())
self.qteUndoStack.push(undoObj) | [
"def",
"keyPressEvent",
"(",
"self",
",",
"keyEvent",
")",
":",
"undoObj",
"=",
"UndoSelfInsert",
"(",
"self",
",",
"keyEvent",
".",
"text",
"(",
")",
")",
"self",
".",
"qteUndoStack",
".",
"push",
"(",
"undoObj",
")"
] | Insert the character at the current cursor position.
This method also adds another undo-object to the undo-stack. | [
"Insert",
"the",
"character",
"at",
"the",
"current",
"cursor",
"position",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacstextedit_widget.py#L332-L339 | train |
vecnet/vecnet.openmalaria | vecnet/openmalaria/__init__.py | get_schema_version_from_xml | def get_schema_version_from_xml(xml):
""" Get schemaVersion attribute from OpenMalaria scenario file
xml - open file or content of xml document to be processed
"""
if isinstance(xml, six.string_types):
xml = StringIO(xml)
try:
tree = ElementTree.parse(xml)
except ParseError:
... | python | def get_schema_version_from_xml(xml):
""" Get schemaVersion attribute from OpenMalaria scenario file
xml - open file or content of xml document to be processed
"""
if isinstance(xml, six.string_types):
xml = StringIO(xml)
try:
tree = ElementTree.parse(xml)
except ParseError:
... | [
"def",
"get_schema_version_from_xml",
"(",
"xml",
")",
":",
"if",
"isinstance",
"(",
"xml",
",",
"six",
".",
"string_types",
")",
":",
"xml",
"=",
"StringIO",
"(",
"xml",
")",
"try",
":",
"tree",
"=",
"ElementTree",
".",
"parse",
"(",
"xml",
")",
"exce... | Get schemaVersion attribute from OpenMalaria scenario file
xml - open file or content of xml document to be processed | [
"Get",
"schemaVersion",
"attribute",
"from",
"OpenMalaria",
"scenario",
"file",
"xml",
"-",
"open",
"file",
"or",
"content",
"of",
"xml",
"document",
"to",
"be",
"processed"
] | 795bc9d1b81a6c664f14879edda7a7c41188e95a | https://github.com/vecnet/vecnet.openmalaria/blob/795bc9d1b81a6c664f14879edda7a7c41188e95a/vecnet/openmalaria/__init__.py#L38-L50 | train |
blockstack-packages/blockstack-profiles-py | blockstack_profiles/legacy_format.py | format_account | def format_account(service_name, data):
"""
Given profile data and the name of a
social media service, format it for
the zone file.
@serviceName: name of the service
@data: legacy profile verification
Returns the formatted account on success,
as a dict.
"""
if "username" not i... | python | def format_account(service_name, data):
"""
Given profile data and the name of a
social media service, format it for
the zone file.
@serviceName: name of the service
@data: legacy profile verification
Returns the formatted account on success,
as a dict.
"""
if "username" not i... | [
"def",
"format_account",
"(",
"service_name",
",",
"data",
")",
":",
"if",
"\"username\"",
"not",
"in",
"data",
":",
"raise",
"KeyError",
"(",
"\"Account is missing a username\"",
")",
"account",
"=",
"{",
"\"@type\"",
":",
"\"Account\"",
",",
"\"service\"",
":"... | Given profile data and the name of a
social media service, format it for
the zone file.
@serviceName: name of the service
@data: legacy profile verification
Returns the formatted account on success,
as a dict. | [
"Given",
"profile",
"data",
"and",
"the",
"name",
"of",
"a",
"social",
"media",
"service",
"format",
"it",
"for",
"the",
"zone",
"file",
"."
] | 103783798df78cf0f007801e79ec6298f00b2817 | https://github.com/blockstack-packages/blockstack-profiles-py/blob/103783798df78cf0f007801e79ec6298f00b2817/blockstack_profiles/legacy_format.py#L63-L91 | train |
a1ezzz/wasp-general | wasp_general/types/binarray.py | WBinArray.swipe | def swipe(self):
""" Mirror current array value in reverse. Bits that had greater index will have lesser index, and
vice-versa. This method doesn't change this array. It creates a new one and return it as a result.
:return: WBinArray
"""
result = WBinArray(0, len(self))
for i in range(len(self)):
result... | python | def swipe(self):
""" Mirror current array value in reverse. Bits that had greater index will have lesser index, and
vice-versa. This method doesn't change this array. It creates a new one and return it as a result.
:return: WBinArray
"""
result = WBinArray(0, len(self))
for i in range(len(self)):
result... | [
"def",
"swipe",
"(",
"self",
")",
":",
"result",
"=",
"WBinArray",
"(",
"0",
",",
"len",
"(",
"self",
")",
")",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"self",
")",
")",
":",
"result",
"[",
"len",
"(",
"self",
")",
"-",
"i",
"-",
"1",
"... | Mirror current array value in reverse. Bits that had greater index will have lesser index, and
vice-versa. This method doesn't change this array. It creates a new one and return it as a result.
:return: WBinArray | [
"Mirror",
"current",
"array",
"value",
"in",
"reverse",
".",
"Bits",
"that",
"had",
"greater",
"index",
"will",
"have",
"lesser",
"index",
"and",
"vice",
"-",
"versa",
".",
"This",
"method",
"doesn",
"t",
"change",
"this",
"array",
".",
"It",
"creates",
... | 1029839d33eb663f8dec76c1c46754d53c1de4a9 | https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/types/binarray.py#L233-L242 | train |
sublee/etc | etc/__init__.py | etcd | def etcd(url=DEFAULT_URL, mock=False, **kwargs):
"""Creates an etcd client."""
if mock:
from etc.adapters.mock import MockAdapter
adapter_class = MockAdapter
else:
from etc.adapters.etcd import EtcdAdapter
adapter_class = EtcdAdapter
return Client(adapter_class(url, **kwa... | python | def etcd(url=DEFAULT_URL, mock=False, **kwargs):
"""Creates an etcd client."""
if mock:
from etc.adapters.mock import MockAdapter
adapter_class = MockAdapter
else:
from etc.adapters.etcd import EtcdAdapter
adapter_class = EtcdAdapter
return Client(adapter_class(url, **kwa... | [
"def",
"etcd",
"(",
"url",
"=",
"DEFAULT_URL",
",",
"mock",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"mock",
":",
"from",
"etc",
".",
"adapters",
".",
"mock",
"import",
"MockAdapter",
"adapter_class",
"=",
"MockAdapter",
"else",
":",
"fro... | Creates an etcd client. | [
"Creates",
"an",
"etcd",
"client",
"."
] | f2be64604da5af0d7739cfacf36f55712f0fc5cb | https://github.com/sublee/etc/blob/f2be64604da5af0d7739cfacf36f55712f0fc5cb/etc/__init__.py#L60-L68 | train |
OpenGov/og-python-utils | ogutils/functions/operators.py | repeat_call | def repeat_call(func, retries, *args, **kwargs):
'''
Tries a total of 'retries' times to execute callable before failing.
'''
retries = max(0, int(retries))
try_num = 0
while True:
if try_num == retries:
return func(*args, **kwargs)
else:
try:
... | python | def repeat_call(func, retries, *args, **kwargs):
'''
Tries a total of 'retries' times to execute callable before failing.
'''
retries = max(0, int(retries))
try_num = 0
while True:
if try_num == retries:
return func(*args, **kwargs)
else:
try:
... | [
"def",
"repeat_call",
"(",
"func",
",",
"retries",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"retries",
"=",
"max",
"(",
"0",
",",
"int",
"(",
"retries",
")",
")",
"try_num",
"=",
"0",
"while",
"True",
":",
"if",
"try_num",
"==",
"retr... | Tries a total of 'retries' times to execute callable before failing. | [
"Tries",
"a",
"total",
"of",
"retries",
"times",
"to",
"execute",
"callable",
"before",
"failing",
"."
] | 00f44927383dd1bd6348f47302c4453d56963479 | https://github.com/OpenGov/og-python-utils/blob/00f44927383dd1bd6348f47302c4453d56963479/ogutils/functions/operators.py#L15-L30 | train |
olitheolix/qtmacs | qtmacs/type_check.py | type_check | def type_check(func_handle):
"""
Ensure arguments have the type specified in the annotation signature.
Example::
def foo(a, b:str, c:int =0, d:(int, list)=None):
pass
This function accepts an arbitrary parameter for ``a``, a string
for ``b``, an integer for ``c`` which default... | python | def type_check(func_handle):
"""
Ensure arguments have the type specified in the annotation signature.
Example::
def foo(a, b:str, c:int =0, d:(int, list)=None):
pass
This function accepts an arbitrary parameter for ``a``, a string
for ``b``, an integer for ``c`` which default... | [
"def",
"type_check",
"(",
"func_handle",
")",
":",
"def",
"checkType",
"(",
"var_name",
",",
"var_val",
",",
"annot",
")",
":",
"# Retrieve the annotation for this variable and determine",
"# if the type of that variable matches with the annotation.",
"# This annotation is stored... | Ensure arguments have the type specified in the annotation signature.
Example::
def foo(a, b:str, c:int =0, d:(int, list)=None):
pass
This function accepts an arbitrary parameter for ``a``, a string
for ``b``, an integer for ``c`` which defaults to 0, and either
an integer or a li... | [
"Ensure",
"arguments",
"have",
"the",
"type",
"specified",
"in",
"the",
"annotation",
"signature",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/type_check.py#L41-L158 | train |
a1ezzz/wasp-general | wasp_general/network/service.py | WIOLoopService.start | def start(self):
""" Set up handler and start loop
:return: None
"""
timeout = self.timeout()
if timeout is not None and timeout > 0:
self.__loop.add_timeout(timedelta(0, timeout), self.stop)
self.handler().setup_handler(self.loop())
self.loop().start()
self.handler().loop_stopped() | python | def start(self):
""" Set up handler and start loop
:return: None
"""
timeout = self.timeout()
if timeout is not None and timeout > 0:
self.__loop.add_timeout(timedelta(0, timeout), self.stop)
self.handler().setup_handler(self.loop())
self.loop().start()
self.handler().loop_stopped() | [
"def",
"start",
"(",
"self",
")",
":",
"timeout",
"=",
"self",
".",
"timeout",
"(",
")",
"if",
"timeout",
"is",
"not",
"None",
"and",
"timeout",
">",
"0",
":",
"self",
".",
"__loop",
".",
"add_timeout",
"(",
"timedelta",
"(",
"0",
",",
"timeout",
"... | Set up handler and start loop
:return: None | [
"Set",
"up",
"handler",
"and",
"start",
"loop"
] | 1029839d33eb663f8dec76c1c46754d53c1de4a9 | https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/network/service.py#L104-L114 | train |
a1ezzz/wasp-general | wasp_general/network/service.py | WNativeSocketHandler.loop_stopped | def loop_stopped(self):
""" Terminate socket connection because of stopping loop
:return: None
"""
transport = self.transport()
if self.server_mode() is True:
transport.close_server_socket(self.config())
else:
transport.close_client_socket(self.config()) | python | def loop_stopped(self):
""" Terminate socket connection because of stopping loop
:return: None
"""
transport = self.transport()
if self.server_mode() is True:
transport.close_server_socket(self.config())
else:
transport.close_client_socket(self.config()) | [
"def",
"loop_stopped",
"(",
"self",
")",
":",
"transport",
"=",
"self",
".",
"transport",
"(",
")",
"if",
"self",
".",
"server_mode",
"(",
")",
"is",
"True",
":",
"transport",
".",
"close_server_socket",
"(",
"self",
".",
"config",
"(",
")",
")",
"else... | Terminate socket connection because of stopping loop
:return: None | [
"Terminate",
"socket",
"connection",
"because",
"of",
"stopping",
"loop"
] | 1029839d33eb663f8dec76c1c46754d53c1de4a9 | https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/network/service.py#L248-L257 | train |
a1ezzz/wasp-general | wasp_general/network/service.py | WZMQService.discard_queue_messages | def discard_queue_messages(self):
""" Sometimes it is necessary to drop undelivered messages. These messages may be stored in different
caches, for example in a zmq socket queue. With different zmq flags we can tweak zmq sockets and
contexts no to keep those messages. But inside ZMQStream class there is a queue t... | python | def discard_queue_messages(self):
""" Sometimes it is necessary to drop undelivered messages. These messages may be stored in different
caches, for example in a zmq socket queue. With different zmq flags we can tweak zmq sockets and
contexts no to keep those messages. But inside ZMQStream class there is a queue t... | [
"def",
"discard_queue_messages",
"(",
"self",
")",
":",
"zmq_stream_queue",
"=",
"self",
".",
"handler",
"(",
")",
".",
"stream",
"(",
")",
".",
"_send_queue",
"while",
"not",
"zmq_stream_queue",
".",
"empty",
"(",
")",
":",
"try",
":",
"zmq_stream_queue",
... | Sometimes it is necessary to drop undelivered messages. These messages may be stored in different
caches, for example in a zmq socket queue. With different zmq flags we can tweak zmq sockets and
contexts no to keep those messages. But inside ZMQStream class there is a queue that can not be
cleaned other way then ... | [
"Sometimes",
"it",
"is",
"necessary",
"to",
"drop",
"undelivered",
"messages",
".",
"These",
"messages",
"may",
"be",
"stored",
"in",
"different",
"caches",
"for",
"example",
"in",
"a",
"zmq",
"socket",
"queue",
".",
"With",
"different",
"zmq",
"flags",
"we"... | 1029839d33eb663f8dec76c1c46754d53c1de4a9 | https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/network/service.py#L402-L421 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsEventFilter.qteProcessKey | def qteProcessKey(self, event, targetObj):
"""
If the key completes a valid key sequence then queue the
associated macro.
|Args|
* ``targetObj`` (**QObject**): the source of the event
(see Qt documentation).
* ``event_qt`` (**QKeyEvent**): information about th... | python | def qteProcessKey(self, event, targetObj):
"""
If the key completes a valid key sequence then queue the
associated macro.
|Args|
* ``targetObj`` (**QObject**): the source of the event
(see Qt documentation).
* ``event_qt`` (**QKeyEvent**): information about th... | [
"def",
"qteProcessKey",
"(",
"self",
",",
"event",
",",
"targetObj",
")",
":",
"# Announce the key and targeted Qtmacs widget.",
"msgObj",
"=",
"QtmacsMessage",
"(",
"(",
"targetObj",
",",
"event",
")",
",",
"None",
")",
"msgObj",
".",
"setSignalName",
"(",
"'qt... | If the key completes a valid key sequence then queue the
associated macro.
|Args|
* ``targetObj`` (**QObject**): the source of the event
(see Qt documentation).
* ``event_qt`` (**QKeyEvent**): information about the key
event (see Qt documentation).
|Returns... | [
"If",
"the",
"key",
"completes",
"a",
"valid",
"key",
"sequence",
"then",
"queue",
"the",
"associated",
"macro",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L345-L447 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsSplitter.qteAdjustWidgetSizes | def qteAdjustWidgetSizes(self, handlePos: int=None):
"""
Adjust the widget size inside the splitter according to ``handlePos``.
See ``pos`` argument in _qteSplitterMovedEvent for a more detailed
explanation.
If ``handlePos`` is **None**, then the widgets are assigne equal size.... | python | def qteAdjustWidgetSizes(self, handlePos: int=None):
"""
Adjust the widget size inside the splitter according to ``handlePos``.
See ``pos`` argument in _qteSplitterMovedEvent for a more detailed
explanation.
If ``handlePos`` is **None**, then the widgets are assigne equal size.... | [
"def",
"qteAdjustWidgetSizes",
"(",
"self",
",",
"handlePos",
":",
"int",
"=",
"None",
")",
":",
"# Do not adjust anything if there are less than two widgets.",
"if",
"self",
".",
"count",
"(",
")",
"<",
"2",
":",
"return",
"if",
"self",
".",
"orientation",
"(",... | Adjust the widget size inside the splitter according to ``handlePos``.
See ``pos`` argument in _qteSplitterMovedEvent for a more detailed
explanation.
If ``handlePos`` is **None**, then the widgets are assigne equal size.
|Args|
* ``handlePos`` (**int**): splitter position re... | [
"Adjust",
"the",
"widget",
"size",
"inside",
"the",
"splitter",
"according",
"to",
"handlePos",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L569-L611 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsSplitter.qteAddWidget | def qteAddWidget(self, widget):
"""
Add a widget to the splitter and make it visible.
The only differences between this- and the native
``QSplitter.addWidget()`` method are
1. ``widget`` must have a ``QtmacsAdmin`` structure to ensure it is a
``QtmacsApplet`` or a ``... | python | def qteAddWidget(self, widget):
"""
Add a widget to the splitter and make it visible.
The only differences between this- and the native
``QSplitter.addWidget()`` method are
1. ``widget`` must have a ``QtmacsAdmin`` structure to ensure it is a
``QtmacsApplet`` or a ``... | [
"def",
"qteAddWidget",
"(",
"self",
",",
"widget",
")",
":",
"# Add ``widget`` to the splitter.",
"self",
".",
"addWidget",
"(",
"widget",
")",
"# Show ``widget``. If it is a ``QtmacsSplitter`` instance then its",
"# show() methods has no argument, whereas ``QtmacsApplet`` instances"... | Add a widget to the splitter and make it visible.
The only differences between this- and the native
``QSplitter.addWidget()`` method are
1. ``widget`` must have a ``QtmacsAdmin`` structure to ensure it is a
``QtmacsApplet`` or a ``QtmacsSplitter``,
2. ``widget`` is automati... | [
"Add",
"a",
"widget",
"to",
"the",
"splitter",
"and",
"make",
"it",
"visible",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L613-L654 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsSplitter.qteInsertWidget | def qteInsertWidget(self, idx, widget):
"""
Insert ``widget`` to the splitter at the specified ``idx``
position and make it visible.
The only differences between this- and the native
``QSplitter.insertWidget()`` method are
1. ``widget`` must have a ``QtmacsAdmin`` struc... | python | def qteInsertWidget(self, idx, widget):
"""
Insert ``widget`` to the splitter at the specified ``idx``
position and make it visible.
The only differences between this- and the native
``QSplitter.insertWidget()`` method are
1. ``widget`` must have a ``QtmacsAdmin`` struc... | [
"def",
"qteInsertWidget",
"(",
"self",
",",
"idx",
",",
"widget",
")",
":",
"# Insert the widget into the splitter.",
"self",
".",
"insertWidget",
"(",
"idx",
",",
"widget",
")",
"# Show ``widget``. If it is a ``QtmacsSplitter`` instance then its",
"# show() methods has no ar... | Insert ``widget`` to the splitter at the specified ``idx``
position and make it visible.
The only differences between this- and the native
``QSplitter.insertWidget()`` method are
1. ``widget`` must have a ``QtmacsAdmin`` structure to ensure it is a
``QtmacsApplet`` or a ``Qt... | [
"Insert",
"widget",
"to",
"the",
"splitter",
"at",
"the",
"specified",
"idx",
"position",
"and",
"make",
"it",
"visible",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L656-L700 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsMain.timerEvent | def timerEvent(self, event):
"""
Trigger the focus manager and work off all queued macros.
The main purpose of using this timer event is to postpone
updating the visual layout of Qtmacs until all macro code has
been fully executed. Furthermore, this GUI update needs to
h... | python | def timerEvent(self, event):
"""
Trigger the focus manager and work off all queued macros.
The main purpose of using this timer event is to postpone
updating the visual layout of Qtmacs until all macro code has
been fully executed. Furthermore, this GUI update needs to
h... | [
"def",
"timerEvent",
"(",
"self",
",",
"event",
")",
":",
"self",
".",
"killTimer",
"(",
"event",
".",
"timerId",
"(",
")",
")",
"if",
"event",
".",
"timerId",
"(",
")",
"==",
"self",
".",
"_qteTimerRunMacro",
":",
"# Declare the macro execution timer event ... | Trigger the focus manager and work off all queued macros.
The main purpose of using this timer event is to postpone
updating the visual layout of Qtmacs until all macro code has
been fully executed. Furthermore, this GUI update needs to
happen in between any two macros.
This me... | [
"Trigger",
"the",
"focus",
"manager",
"and",
"work",
"off",
"all",
"queued",
"macros",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L1003-L1078 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsMain._qteMouseClicked | def _qteMouseClicked(self, widgetObj):
"""
Update the Qtmacs internal focus state as the result of a mouse click.
|Args|
* ``new`` (**QWidget**): the widget that received the focus.
|Returns|
* **None**
|Raises|
* **None**
"""
# ----... | python | def _qteMouseClicked(self, widgetObj):
"""
Update the Qtmacs internal focus state as the result of a mouse click.
|Args|
* ``new`` (**QWidget**): the widget that received the focus.
|Returns|
* **None**
|Raises|
* **None**
"""
# ----... | [
"def",
"_qteMouseClicked",
"(",
"self",
",",
"widgetObj",
")",
":",
"# ------------------------------------------------------------",
"# The following cases for widgetObj have to be distinguished:",
"# 1: not part of the Qtmacs widget hierarchy",
"# 2: part of the Qtmacs widget hierarchy b... | Update the Qtmacs internal focus state as the result of a mouse click.
|Args|
* ``new`` (**QWidget**): the widget that received the focus.
|Returns|
* **None**
|Raises|
* **None** | [
"Update",
"the",
"Qtmacs",
"internal",
"focus",
"state",
"as",
"the",
"result",
"of",
"a",
"mouse",
"click",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L1286-L1335 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsMain.qteFocusChanged | def qteFocusChanged(self, old, new):
"""
Slot for Qt native focus-changed signal to notify Qtmacs if
the window was switched.
.. note: This method is work in progress.
"""
# Do nothing if new is old.
if old is new:
return
# If neither is None... | python | def qteFocusChanged(self, old, new):
"""
Slot for Qt native focus-changed signal to notify Qtmacs if
the window was switched.
.. note: This method is work in progress.
"""
# Do nothing if new is old.
if old is new:
return
# If neither is None... | [
"def",
"qteFocusChanged",
"(",
"self",
",",
"old",
",",
"new",
")",
":",
"# Do nothing if new is old.",
"if",
"old",
"is",
"new",
":",
"return",
"# If neither is None but both have the same top level",
"# window then do nothing.",
"if",
"(",
"old",
"is",
"not",
"None"... | Slot for Qt native focus-changed signal to notify Qtmacs if
the window was switched.
.. note: This method is work in progress. | [
"Slot",
"for",
"Qt",
"native",
"focus",
"-",
"changed",
"signal",
"to",
"notify",
"Qtmacs",
"if",
"the",
"window",
"was",
"switched",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L1337-L1352 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsMain.qteIsMiniApplet | def qteIsMiniApplet(self, obj):
"""
Test if instance ``obj`` is a mini applet.
|Args|
* ``obj`` (**object**): object to test.
|Returns|
* **bool**: whether or not ``obj`` is the mini applet.
|Raises|
* **None**
"""
try:
re... | python | def qteIsMiniApplet(self, obj):
"""
Test if instance ``obj`` is a mini applet.
|Args|
* ``obj`` (**object**): object to test.
|Returns|
* **bool**: whether or not ``obj`` is the mini applet.
|Raises|
* **None**
"""
try:
re... | [
"def",
"qteIsMiniApplet",
"(",
"self",
",",
"obj",
")",
":",
"try",
":",
"ret",
"=",
"obj",
".",
"_qteAdmin",
".",
"isMiniApplet",
"except",
"AttributeError",
":",
"ret",
"=",
"False",
"return",
"ret"
] | Test if instance ``obj`` is a mini applet.
|Args|
* ``obj`` (**object**): object to test.
|Returns|
* **bool**: whether or not ``obj`` is the mini applet.
|Raises|
* **None** | [
"Test",
"if",
"instance",
"obj",
"is",
"a",
"mini",
"applet",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L1407-L1428 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsMain.qteNewWindow | def qteNewWindow(self, pos: QtCore.QRect=None, windowID: str=None):
"""
Create a new, empty window with ``windowID`` at position ``pos``.
|Args|
* ``pos`` (**QRect**): size and position of new window.
* ``windowID`` (**str**): unique window ID.
|Returns|
* **Q... | python | def qteNewWindow(self, pos: QtCore.QRect=None, windowID: str=None):
"""
Create a new, empty window with ``windowID`` at position ``pos``.
|Args|
* ``pos`` (**QRect**): size and position of new window.
* ``windowID`` (**str**): unique window ID.
|Returns|
* **Q... | [
"def",
"qteNewWindow",
"(",
"self",
",",
"pos",
":",
"QtCore",
".",
"QRect",
"=",
"None",
",",
"windowID",
":",
"str",
"=",
"None",
")",
":",
"# Compile a list of all window IDs.",
"winIDList",
"=",
"[",
"_",
".",
"_qteWindowID",
"for",
"_",
"in",
"self",
... | Create a new, empty window with ``windowID`` at position ``pos``.
|Args|
* ``pos`` (**QRect**): size and position of new window.
* ``windowID`` (**str**): unique window ID.
|Returns|
* **QtmacsWindow**: reference to the just created window instance.
|Raises|
... | [
"Create",
"a",
"new",
"empty",
"window",
"with",
"windowID",
"at",
"position",
"pos",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L1431-L1477 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsMain.qteMakeWindowActive | def qteMakeWindowActive(self, windowObj: QtmacsWindow):
"""
Make the window ``windowObj`` active and focus the first
applet therein.
|Args|
* ``windowObj`` (**QtmacsWindow**): window to activate.
|Returns|
* **None**
|Raises|
* **QtmacsArgume... | python | def qteMakeWindowActive(self, windowObj: QtmacsWindow):
"""
Make the window ``windowObj`` active and focus the first
applet therein.
|Args|
* ``windowObj`` (**QtmacsWindow**): window to activate.
|Returns|
* **None**
|Raises|
* **QtmacsArgume... | [
"def",
"qteMakeWindowActive",
"(",
"self",
",",
"windowObj",
":",
"QtmacsWindow",
")",
":",
"if",
"windowObj",
"in",
"self",
".",
"_qteWindowList",
":",
"# This will trigger the focusChanged slot which, in",
"# conjunction with the focus manager, will take care of",
"# the rest... | Make the window ``windowObj`` active and focus the first
applet therein.
|Args|
* ``windowObj`` (**QtmacsWindow**): window to activate.
|Returns|
* **None**
|Raises|
* **QtmacsArgumentError** if at least one argument has an invalid type. | [
"Make",
"the",
"window",
"windowObj",
"active",
"and",
"focus",
"the",
"first",
"applet",
"therein",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L1480-L1505 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsMain.qteActiveWindow | def qteActiveWindow(self):
"""
Return the currently active ``QtmacsWindow`` object.
If no Qtmacs window is currently active (for instance because
the user is working with another application at the moment)
then the method returns the first window in the window list.
The... | python | def qteActiveWindow(self):
"""
Return the currently active ``QtmacsWindow`` object.
If no Qtmacs window is currently active (for instance because
the user is working with another application at the moment)
then the method returns the first window in the window list.
The... | [
"def",
"qteActiveWindow",
"(",
"self",
")",
":",
"if",
"len",
"(",
"self",
".",
"_qteWindowList",
")",
"==",
"0",
":",
"self",
".",
"qteLogger",
".",
"critical",
"(",
"'The window list is empty.'",
")",
"return",
"None",
"elif",
"len",
"(",
"self",
".",
... | Return the currently active ``QtmacsWindow`` object.
If no Qtmacs window is currently active (for instance because
the user is working with another application at the moment)
then the method returns the first window in the window list.
The method only returns **None** if the window lis... | [
"Return",
"the",
"currently",
"active",
"QtmacsWindow",
"object",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L1507-L1543 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsMain.qteNextWindow | def qteNextWindow(self):
"""
Return next window in cyclic order.
|Args|
* **None**
|Returns|
* **QtmacsWindow**: the next window in the Qtmacs internal
window list.
|Raises|
* **None**
"""
# Get the currently active window... | python | def qteNextWindow(self):
"""
Return next window in cyclic order.
|Args|
* **None**
|Returns|
* **QtmacsWindow**: the next window in the Qtmacs internal
window list.
|Raises|
* **None**
"""
# Get the currently active window... | [
"def",
"qteNextWindow",
"(",
"self",
")",
":",
"# Get the currently active window.",
"win",
"=",
"self",
".",
"qteActiveWindow",
"(",
")",
"if",
"win",
"in",
"self",
".",
"_qteWindowList",
":",
"# Find the index of the window in the window list and",
"# cyclically move to... | Return next window in cyclic order.
|Args|
* **None**
|Returns|
* **QtmacsWindow**: the next window in the Qtmacs internal
window list.
|Raises|
* **None** | [
"Return",
"next",
"window",
"in",
"cyclic",
"order",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L1545-L1575 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsMain.qteNextApplet | def qteNextApplet(self, numSkip: int=1, ofsApp: (QtmacsApplet, str)=None,
skipInvisible: bool=True, skipVisible: bool=False,
skipMiniApplet: bool=True,
windowObj: QtmacsWindow=None):
"""
Return the next applet in cyclic order.
If... | python | def qteNextApplet(self, numSkip: int=1, ofsApp: (QtmacsApplet, str)=None,
skipInvisible: bool=True, skipVisible: bool=False,
skipMiniApplet: bool=True,
windowObj: QtmacsWindow=None):
"""
Return the next applet in cyclic order.
If... | [
"def",
"qteNextApplet",
"(",
"self",
",",
"numSkip",
":",
"int",
"=",
"1",
",",
"ofsApp",
":",
"(",
"QtmacsApplet",
",",
"str",
")",
"=",
"None",
",",
"skipInvisible",
":",
"bool",
"=",
"True",
",",
"skipVisible",
":",
"bool",
"=",
"False",
",",
"ski... | Return the next applet in cyclic order.
If ``ofsApp=None`` then start cycling at the currently active
applet. If ``ofsApp`` does not fit the selection criteria,
then the cycling starts at the next applet in cyclic order
that does.
The returned applet is ``numSkip`` items in cyc... | [
"Return",
"the",
"next",
"applet",
"in",
"cyclic",
"order",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L1672-L1809 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsMain.qteRunMacro | def qteRunMacro(self, macroName: str, widgetObj: QtGui.QWidget=None,
keysequence: QtmacsKeysequence=None):
"""
Queue a previously registered macro for execution once the
event loop is idle.
The reason for queuing macros in the first place, instead of
running ... | python | def qteRunMacro(self, macroName: str, widgetObj: QtGui.QWidget=None,
keysequence: QtmacsKeysequence=None):
"""
Queue a previously registered macro for execution once the
event loop is idle.
The reason for queuing macros in the first place, instead of
running ... | [
"def",
"qteRunMacro",
"(",
"self",
",",
"macroName",
":",
"str",
",",
"widgetObj",
":",
"QtGui",
".",
"QWidget",
"=",
"None",
",",
"keysequence",
":",
"QtmacsKeysequence",
"=",
"None",
")",
":",
"# Add the new macro to the queue and call qteUpdate to ensure",
"# tha... | Queue a previously registered macro for execution once the
event loop is idle.
The reason for queuing macros in the first place, instead of
running them straight away, is to ensure that the event loop
updates all the widgets in between any two macros. This will
avoid many spurio... | [
"Queue",
"a",
"previously",
"registered",
"macro",
"for",
"execution",
"once",
"the",
"event",
"loop",
"is",
"idle",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L1812-L1844 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsMain._qteRunQueuedMacro | def _qteRunQueuedMacro(self, macroName: str,
widgetObj: QtGui.QWidget=None,
keysequence: QtmacsKeysequence=None):
"""
Execute the next macro in the macro queue.
This method is triggered by the ``timerEvent`` in conjunction
with the f... | python | def _qteRunQueuedMacro(self, macroName: str,
widgetObj: QtGui.QWidget=None,
keysequence: QtmacsKeysequence=None):
"""
Execute the next macro in the macro queue.
This method is triggered by the ``timerEvent`` in conjunction
with the f... | [
"def",
"_qteRunQueuedMacro",
"(",
"self",
",",
"macroName",
":",
"str",
",",
"widgetObj",
":",
"QtGui",
".",
"QWidget",
"=",
"None",
",",
"keysequence",
":",
"QtmacsKeysequence",
"=",
"None",
")",
":",
"# Fetch the applet holding the widget (this may be None).",
"ap... | Execute the next macro in the macro queue.
This method is triggered by the ``timerEvent`` in conjunction
with the focus manager to ensure the event loop updates the
GUI in between any two macros.
.. warning:: Never call this method directly.
|Args|
* ``macroName`` (**... | [
"Execute",
"the",
"next",
"macro",
"in",
"the",
"macro",
"queue",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L1847-L1912 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsMain.qteNewApplet | def qteNewApplet(self, appletName: str, appletID: str=None,
windowObj: QtmacsWindow=None):
"""
Create a new instance of ``appletName`` and assign it the
``appletID``.
This method creates a new instance of ``appletName``, as
registered by the ``qteRegisterApp... | python | def qteNewApplet(self, appletName: str, appletID: str=None,
windowObj: QtmacsWindow=None):
"""
Create a new instance of ``appletName`` and assign it the
``appletID``.
This method creates a new instance of ``appletName``, as
registered by the ``qteRegisterApp... | [
"def",
"qteNewApplet",
"(",
"self",
",",
"appletName",
":",
"str",
",",
"appletID",
":",
"str",
"=",
"None",
",",
"windowObj",
":",
"QtmacsWindow",
"=",
"None",
")",
":",
"# Use the currently active window if none was specified.",
"if",
"windowObj",
"is",
"None",
... | Create a new instance of ``appletName`` and assign it the
``appletID``.
This method creates a new instance of ``appletName``, as
registered by the ``qteRegisterApplet`` method. If an applet
with ``appletID`` already exists then the method does nothing
and returns **None**, other... | [
"Create",
"a",
"new",
"instance",
"of",
"appletName",
"and",
"assign",
"it",
"the",
"appletID",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L1915-L2022 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsMain.qteAddMiniApplet | def qteAddMiniApplet(self, appletObj: QtmacsApplet):
"""
Install ``appletObj`` as the mini applet in the window layout.
At any given point there can ever only be one mini applet in
the entire Qtmacs application, irrespective of how many
windows are open.
Note that this ... | python | def qteAddMiniApplet(self, appletObj: QtmacsApplet):
"""
Install ``appletObj`` as the mini applet in the window layout.
At any given point there can ever only be one mini applet in
the entire Qtmacs application, irrespective of how many
windows are open.
Note that this ... | [
"def",
"qteAddMiniApplet",
"(",
"self",
",",
"appletObj",
":",
"QtmacsApplet",
")",
":",
"# Do nothing if a custom mini applet has already been",
"# installed.",
"if",
"self",
".",
"_qteMiniApplet",
"is",
"not",
"None",
":",
"msg",
"=",
"'Cannot replace mini applet more t... | Install ``appletObj`` as the mini applet in the window layout.
At any given point there can ever only be one mini applet in
the entire Qtmacs application, irrespective of how many
windows are open.
Note that this method does nothing if a custom mini applet is
already active. Us... | [
"Install",
"appletObj",
"as",
"the",
"mini",
"applet",
"in",
"the",
"window",
"layout",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L2025-L2098 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsMain.qteKillMiniApplet | def qteKillMiniApplet(self):
"""
Remove the mini applet.
If a different applet is to be restored/focused then call
``qteMakeAppletActive`` for that applet *after* calling this
method.
|Args|
* **None**
|Returns|
* **None**
|Raises|
... | python | def qteKillMiniApplet(self):
"""
Remove the mini applet.
If a different applet is to be restored/focused then call
``qteMakeAppletActive`` for that applet *after* calling this
method.
|Args|
* **None**
|Returns|
* **None**
|Raises|
... | [
"def",
"qteKillMiniApplet",
"(",
"self",
")",
":",
"# Sanity check: is the handle valid?",
"if",
"self",
".",
"_qteMiniApplet",
"is",
"None",
":",
"return",
"# Sanity check: is it really a mini applet?",
"if",
"not",
"self",
".",
"qteIsMiniApplet",
"(",
"self",
".",
"... | Remove the mini applet.
If a different applet is to be restored/focused then call
``qteMakeAppletActive`` for that applet *after* calling this
method.
|Args|
* **None**
|Returns|
* **None**
|Raises|
* **None** | [
"Remove",
"the",
"mini",
"applet",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L2100-L2175 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsMain._qteFindAppletInSplitter | def _qteFindAppletInSplitter(self, appletObj: QtmacsApplet,
split: QtmacsSplitter):
"""
Return the splitter that holds ``appletObj``.
This method recursively searches for ``appletObj`` in the
nested splitter hierarchy of the window layout, starting at
... | python | def _qteFindAppletInSplitter(self, appletObj: QtmacsApplet,
split: QtmacsSplitter):
"""
Return the splitter that holds ``appletObj``.
This method recursively searches for ``appletObj`` in the
nested splitter hierarchy of the window layout, starting at
... | [
"def",
"_qteFindAppletInSplitter",
"(",
"self",
",",
"appletObj",
":",
"QtmacsApplet",
",",
"split",
":",
"QtmacsSplitter",
")",
":",
"def",
"splitterIter",
"(",
"split",
")",
":",
"\"\"\"\n Iterator over all QtmacsSplitters.\n \"\"\"",
"for",
"idx",... | Return the splitter that holds ``appletObj``.
This method recursively searches for ``appletObj`` in the
nested splitter hierarchy of the window layout, starting at
``split``. If successful, the method returns a reference to
the splitter, otherwise it returns **None**.
|Args|
... | [
"Return",
"the",
"splitter",
"that",
"holds",
"appletObj",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L2178-L2219 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsMain.qteSplitApplet | def qteSplitApplet(self, applet: (QtmacsApplet, str)=None,
splitHoriz: bool=True,
windowObj: QtmacsWindow=None):
"""
Reveal ``applet`` by splitting the space occupied by the
current applet.
If ``applet`` is already visible then the method do... | python | def qteSplitApplet(self, applet: (QtmacsApplet, str)=None,
splitHoriz: bool=True,
windowObj: QtmacsWindow=None):
"""
Reveal ``applet`` by splitting the space occupied by the
current applet.
If ``applet`` is already visible then the method do... | [
"def",
"qteSplitApplet",
"(",
"self",
",",
"applet",
":",
"(",
"QtmacsApplet",
",",
"str",
")",
"=",
"None",
",",
"splitHoriz",
":",
"bool",
"=",
"True",
",",
"windowObj",
":",
"QtmacsWindow",
"=",
"None",
")",
":",
"# If ``newAppObj`` was specified by its ID ... | Reveal ``applet`` by splitting the space occupied by the
current applet.
If ``applet`` is already visible then the method does
nothing. Furthermore, this method does not change the focus,
ie. the currently active applet will remain active.
If ``applet`` is **None** then the nex... | [
"Reveal",
"applet",
"by",
"splitting",
"the",
"space",
"occupied",
"by",
"the",
"current",
"applet",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L2222-L2363 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsMain.qteReplaceAppletInLayout | def qteReplaceAppletInLayout(self, newApplet: (QtmacsApplet, str),
oldApplet: (QtmacsApplet, str)=None,
windowObj: QtmacsWindow=None):
"""
Replace ``oldApplet`` with ``newApplet`` in the window layout.
If ``oldApplet`` is **None*... | python | def qteReplaceAppletInLayout(self, newApplet: (QtmacsApplet, str),
oldApplet: (QtmacsApplet, str)=None,
windowObj: QtmacsWindow=None):
"""
Replace ``oldApplet`` with ``newApplet`` in the window layout.
If ``oldApplet`` is **None*... | [
"def",
"qteReplaceAppletInLayout",
"(",
"self",
",",
"newApplet",
":",
"(",
"QtmacsApplet",
",",
"str",
")",
",",
"oldApplet",
":",
"(",
"QtmacsApplet",
",",
"str",
")",
"=",
"None",
",",
"windowObj",
":",
"QtmacsWindow",
"=",
"None",
")",
":",
"# If ``old... | Replace ``oldApplet`` with ``newApplet`` in the window layout.
If ``oldApplet`` is **None** then the currently active applet
will be replaced. If ``windowObj`` is **None** then the
currently active window is used.
The ``oldApplet`` and ``newApplet`` parameters can either be
ins... | [
"Replace",
"oldApplet",
"with",
"newApplet",
"in",
"the",
"window",
"layout",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L2366-L2469 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsMain.qteRemoveAppletFromLayout | def qteRemoveAppletFromLayout(self, applet: (QtmacsApplet, str)):
"""
Remove ``applet`` from the window layout.
This method removes ``applet`` and implicitly deletes
obsolete (ie. half-full) splitters in the process. If
``applet`` is the only visible applet in the layout then it... | python | def qteRemoveAppletFromLayout(self, applet: (QtmacsApplet, str)):
"""
Remove ``applet`` from the window layout.
This method removes ``applet`` and implicitly deletes
obsolete (ie. half-full) splitters in the process. If
``applet`` is the only visible applet in the layout then it... | [
"def",
"qteRemoveAppletFromLayout",
"(",
"self",
",",
"applet",
":",
"(",
"QtmacsApplet",
",",
"str",
")",
")",
":",
"# If ``applet`` was specified by its ID (ie. a string) then",
"# fetch the associated ``QtmacsApplet`` instance. If",
"# ``applet`` is already an instance of ``Qtmacs... | Remove ``applet`` from the window layout.
This method removes ``applet`` and implicitly deletes
obsolete (ie. half-full) splitters in the process. If
``applet`` is the only visible applet in the layout then it
will be replaced with the first invisible applet. If no
invisible app... | [
"Remove",
"applet",
"from",
"the",
"window",
"layout",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L2472-L2596 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsMain.qteKillApplet | def qteKillApplet(self, appletID: str):
"""
Destroy the applet with ID ``appletID``.
This method removes ``appletID`` from Qtmacs permanently - no
questions asked. It is the responsibility of the (macro)
programmer to use it responsibly.
If the applet was visible then t... | python | def qteKillApplet(self, appletID: str):
"""
Destroy the applet with ID ``appletID``.
This method removes ``appletID`` from Qtmacs permanently - no
questions asked. It is the responsibility of the (macro)
programmer to use it responsibly.
If the applet was visible then t... | [
"def",
"qteKillApplet",
"(",
"self",
",",
"appletID",
":",
"str",
")",
":",
"# Compile list of all applet IDs.",
"ID_list",
"=",
"[",
"_",
".",
"qteAppletID",
"(",
")",
"for",
"_",
"in",
"self",
".",
"_qteAppletList",
"]",
"if",
"appletID",
"not",
"in",
"I... | Destroy the applet with ID ``appletID``.
This method removes ``appletID`` from Qtmacs permanently - no
questions asked. It is the responsibility of the (macro)
programmer to use it responsibly.
If the applet was visible then the method also takes care of
replacing with the next... | [
"Destroy",
"the",
"applet",
"with",
"ID",
"appletID",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L2599-L2677 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsMain.qteRunHook | def qteRunHook(self, hookName: str, msgObj: QtmacsMessage=None):
"""
Trigger the hook named ``hookName`` and pass on ``msgObj``.
This will call all slots associated with ``hookName`` but
without calling the event loop in between. Therefore, if
one slots changes the state of the ... | python | def qteRunHook(self, hookName: str, msgObj: QtmacsMessage=None):
"""
Trigger the hook named ``hookName`` and pass on ``msgObj``.
This will call all slots associated with ``hookName`` but
without calling the event loop in between. Therefore, if
one slots changes the state of the ... | [
"def",
"qteRunHook",
"(",
"self",
",",
"hookName",
":",
"str",
",",
"msgObj",
":",
"QtmacsMessage",
"=",
"None",
")",
":",
"# Shorthand.",
"reg",
"=",
"self",
".",
"_qteRegistryHooks",
"# Do nothing if there are not recipients for the hook.",
"if",
"hookName",
"not"... | Trigger the hook named ``hookName`` and pass on ``msgObj``.
This will call all slots associated with ``hookName`` but
without calling the event loop in between. Therefore, if
one slots changes the state of the GUI, every subsequent slot
may have difficulties determining the actual state... | [
"Trigger",
"the",
"hook",
"named",
"hookName",
"and",
"pass",
"on",
"msgObj",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L2680-L2741 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsMain.qteConnectHook | def qteConnectHook(self, hookName: str,
slot: (types.FunctionType, types.MethodType)):
"""
Connect the method or function ``slot`` to ``hookName``.
|Args|
* ``hookName`` (**str**): name of the hook.
* ``slot`` (**function**, **method**): the routine to ex... | python | def qteConnectHook(self, hookName: str,
slot: (types.FunctionType, types.MethodType)):
"""
Connect the method or function ``slot`` to ``hookName``.
|Args|
* ``hookName`` (**str**): name of the hook.
* ``slot`` (**function**, **method**): the routine to ex... | [
"def",
"qteConnectHook",
"(",
"self",
",",
"hookName",
":",
"str",
",",
"slot",
":",
"(",
"types",
".",
"FunctionType",
",",
"types",
".",
"MethodType",
")",
")",
":",
"# Shorthand.",
"reg",
"=",
"self",
".",
"_qteRegistryHooks",
"if",
"hookName",
"in",
... | Connect the method or function ``slot`` to ``hookName``.
|Args|
* ``hookName`` (**str**): name of the hook.
* ``slot`` (**function**, **method**): the routine to execute
when the hook triggers.
|Returns|
* **None**
|Raises|
* **QtmacsArgumentError*... | [
"Connect",
"the",
"method",
"or",
"function",
"slot",
"to",
"hookName",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L2744-L2768 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsMain.qteDisconnectHook | def qteDisconnectHook(self, hookName: str,
slot: (types.FunctionType, types.MethodType)):
"""
Disconnect ``slot`` from ``hookName``.
If ``hookName`` does not exist, or ``slot`` is not connected
to ``hookName`` then return **False**, otherwise disassociate
... | python | def qteDisconnectHook(self, hookName: str,
slot: (types.FunctionType, types.MethodType)):
"""
Disconnect ``slot`` from ``hookName``.
If ``hookName`` does not exist, or ``slot`` is not connected
to ``hookName`` then return **False**, otherwise disassociate
... | [
"def",
"qteDisconnectHook",
"(",
"self",
",",
"hookName",
":",
"str",
",",
"slot",
":",
"(",
"types",
".",
"FunctionType",
",",
"types",
".",
"MethodType",
")",
")",
":",
"# Shorthand.",
"reg",
"=",
"self",
".",
"_qteRegistryHooks",
"# Return immediately if no... | Disconnect ``slot`` from ``hookName``.
If ``hookName`` does not exist, or ``slot`` is not connected
to ``hookName`` then return **False**, otherwise disassociate
``slot`` with ``hookName`` and return **True**.
|Args|
* ``hookName`` (**str**): name of the hook.
* ``slot... | [
"Disconnect",
"slot",
"from",
"hookName",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L2771-L2816 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsMain.qteImportModule | def qteImportModule(self, fileName: str):
"""
Import ``fileName`` at run-time.
If ``fileName`` has no path prefix then it must be in the
standard Python module path. Relative path names are possible.
|Args|
* ``fileName`` (**str**): file name (with full path) of module... | python | def qteImportModule(self, fileName: str):
"""
Import ``fileName`` at run-time.
If ``fileName`` has no path prefix then it must be in the
standard Python module path. Relative path names are possible.
|Args|
* ``fileName`` (**str**): file name (with full path) of module... | [
"def",
"qteImportModule",
"(",
"self",
",",
"fileName",
":",
"str",
")",
":",
"# Split the absolute file name into the path- and file name.",
"path",
",",
"name",
"=",
"os",
".",
"path",
".",
"split",
"(",
"fileName",
")",
"name",
",",
"ext",
"=",
"os",
".",
... | Import ``fileName`` at run-time.
If ``fileName`` has no path prefix then it must be in the
standard Python module path. Relative path names are possible.
|Args|
* ``fileName`` (**str**): file name (with full path) of module
to import.
|Returns|
* **module**... | [
"Import",
"fileName",
"at",
"run",
"-",
"time",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L2819-L2871 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsMain.qteMacroNameMangling | def qteMacroNameMangling(self, macroCls):
"""
Convert the class name of a macro class to macro name.
The name mangling inserts a '-' character after every capital
letter and then lowers the entire string.
Example: if the class name of ``macroCls`` is 'ThisIsAMacro'
then... | python | def qteMacroNameMangling(self, macroCls):
"""
Convert the class name of a macro class to macro name.
The name mangling inserts a '-' character after every capital
letter and then lowers the entire string.
Example: if the class name of ``macroCls`` is 'ThisIsAMacro'
then... | [
"def",
"qteMacroNameMangling",
"(",
"self",
",",
"macroCls",
")",
":",
"# Replace camel bump as hyphenated lower case string.",
"macroName",
"=",
"re",
".",
"sub",
"(",
"r\"([A-Z])\"",
",",
"r'-\\1'",
",",
"macroCls",
".",
"__name__",
")",
"# If the first character of t... | Convert the class name of a macro class to macro name.
The name mangling inserts a '-' character after every capital
letter and then lowers the entire string.
Example: if the class name of ``macroCls`` is 'ThisIsAMacro'
then this method will return 'this-is-a-macro', ie. every
... | [
"Convert",
"the",
"class",
"name",
"of",
"a",
"macro",
"class",
"to",
"macro",
"name",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L2873-L2911 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsMain.qteRegisterMacro | def qteRegisterMacro(self, macroCls, replaceMacro: bool=False,
macroName: str=None):
"""
Register a macro.
If ``macroName`` is **None** then its named is deduced from
its class name (see ``qteMacroNameMangling`` for details).
Multiple macros with the sa... | python | def qteRegisterMacro(self, macroCls, replaceMacro: bool=False,
macroName: str=None):
"""
Register a macro.
If ``macroName`` is **None** then its named is deduced from
its class name (see ``qteMacroNameMangling`` for details).
Multiple macros with the sa... | [
"def",
"qteRegisterMacro",
"(",
"self",
",",
"macroCls",
",",
"replaceMacro",
":",
"bool",
"=",
"False",
",",
"macroName",
":",
"str",
"=",
"None",
")",
":",
"# Check type of input arguments.",
"if",
"not",
"issubclass",
"(",
"macroCls",
",",
"QtmacsMacro",
")... | Register a macro.
If ``macroName`` is **None** then its named is deduced from
its class name (see ``qteMacroNameMangling`` for details).
Multiple macros with the same name can co-exist as long as
their applet- and widget signatures, as reported by the
``qteAppletSignature`` and... | [
"Register",
"a",
"macro",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L2914-L3044 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsMain.qteGetMacroObject | def qteGetMacroObject(self, macroName: str, widgetObj: QtGui.QWidget):
"""
Return macro that is name- and signature compatible with
``macroName`` and ``widgetObj``.
The method considers all macros with name ``macroName`` and
returns the one that matches 'best'. To determine this... | python | def qteGetMacroObject(self, macroName: str, widgetObj: QtGui.QWidget):
"""
Return macro that is name- and signature compatible with
``macroName`` and ``widgetObj``.
The method considers all macros with name ``macroName`` and
returns the one that matches 'best'. To determine this... | [
"def",
"qteGetMacroObject",
"(",
"self",
",",
"macroName",
":",
"str",
",",
"widgetObj",
":",
"QtGui",
".",
"QWidget",
")",
":",
"# Determine the applet- and widget signature. This is trivial",
"# if the widget was registered with Qtmacs because its",
"# '_qteAdmin' attribute wil... | Return macro that is name- and signature compatible with
``macroName`` and ``widgetObj``.
The method considers all macros with name ``macroName`` and
returns the one that matches 'best'. To determine this best
match, the applet-and widget signatures of the macro are
compared to ... | [
"Return",
"macro",
"that",
"is",
"name",
"-",
"and",
"signature",
"compatible",
"with",
"macroName",
"and",
"widgetObj",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L3089-L3213 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsMain.qteGetAllMacroNames | def qteGetAllMacroNames(self, widgetObj: QtGui.QWidget=None):
"""
Return all macro names known to Qtmacs as a list.
If ``widgetObj`` is **None** then the names of all registered
macros are returned as a tuple. Otherwise, only those macro
compatible with ``widgetObj`` are returne... | python | def qteGetAllMacroNames(self, widgetObj: QtGui.QWidget=None):
"""
Return all macro names known to Qtmacs as a list.
If ``widgetObj`` is **None** then the names of all registered
macros are returned as a tuple. Otherwise, only those macro
compatible with ``widgetObj`` are returne... | [
"def",
"qteGetAllMacroNames",
"(",
"self",
",",
"widgetObj",
":",
"QtGui",
".",
"QWidget",
"=",
"None",
")",
":",
"# The keys of qteRegistryMacros are (macroObj, app_sig,",
"# wid_sig) tuples. Get them, extract the macro names, and",
"# remove all duplicates.",
"macro_list",
"=",... | Return all macro names known to Qtmacs as a list.
If ``widgetObj`` is **None** then the names of all registered
macros are returned as a tuple. Otherwise, only those macro
compatible with ``widgetObj`` are returned. See
``qteGetMacroObject`` for the definition of a compatible
ma... | [
"Return",
"all",
"macro",
"names",
"known",
"to",
"Qtmacs",
"as",
"a",
"list",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L3216-L3262 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsMain.qteBindKeyGlobal | def qteBindKeyGlobal(self, keysequence, macroName: str):
"""
Associate ``macroName`` with ``keysequence`` in all current
applets.
This method will bind ``macroName`` to ``keysequence`` in the
global key map and **all** local key maps. This also applies
for all applets (a... | python | def qteBindKeyGlobal(self, keysequence, macroName: str):
"""
Associate ``macroName`` with ``keysequence`` in all current
applets.
This method will bind ``macroName`` to ``keysequence`` in the
global key map and **all** local key maps. This also applies
for all applets (a... | [
"def",
"qteBindKeyGlobal",
"(",
"self",
",",
"keysequence",
",",
"macroName",
":",
"str",
")",
":",
"# Convert the key sequence into a QtmacsKeysequence object, or",
"# raise an QtmacsOtherError if the conversion is impossible.",
"keysequence",
"=",
"QtmacsKeysequence",
"(",
"key... | Associate ``macroName`` with ``keysequence`` in all current
applets.
This method will bind ``macroName`` to ``keysequence`` in the
global key map and **all** local key maps. This also applies
for all applets (and their constituent widgets) yet to be
instantiated because they wil... | [
"Associate",
"macroName",
"with",
"keysequence",
"in",
"all",
"current",
"applets",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L3265-L3327 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsMain.qteBindKeyApplet | def qteBindKeyApplet(self, keysequence, macroName: str,
appletObj: QtmacsApplet):
"""
Bind ``macroName`` to all widgets in ``appletObj``.
This method does not affect the key bindings of other applets,
or other instances of the same applet.
The ``keysequ... | python | def qteBindKeyApplet(self, keysequence, macroName: str,
appletObj: QtmacsApplet):
"""
Bind ``macroName`` to all widgets in ``appletObj``.
This method does not affect the key bindings of other applets,
or other instances of the same applet.
The ``keysequ... | [
"def",
"qteBindKeyApplet",
"(",
"self",
",",
"keysequence",
",",
"macroName",
":",
"str",
",",
"appletObj",
":",
"QtmacsApplet",
")",
":",
"# Convert the key sequence into a QtmacsKeysequence object, or",
"# raise a QtmacsKeysequenceError if the conversion is",
"# impossible.",
... | Bind ``macroName`` to all widgets in ``appletObj``.
This method does not affect the key bindings of other applets,
or other instances of the same applet.
The ``keysequence`` can be specified either as a string (eg
'<ctrl>+x <ctrl>+f'), or a list of tuples containing the
constan... | [
"Bind",
"macroName",
"to",
"all",
"widgets",
"in",
"appletObj",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L3330-L3385 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsMain.qteBindKeyWidget | def qteBindKeyWidget(self, keysequence, macroName: str,
widgetObj: QtGui.QWidget):
"""
Bind ``macroName`` to ``widgetObj`` and associate it with
``keysequence``.
This method does not affect the key bindings of other applets
and/or widgets and can be used... | python | def qteBindKeyWidget(self, keysequence, macroName: str,
widgetObj: QtGui.QWidget):
"""
Bind ``macroName`` to ``widgetObj`` and associate it with
``keysequence``.
This method does not affect the key bindings of other applets
and/or widgets and can be used... | [
"def",
"qteBindKeyWidget",
"(",
"self",
",",
"keysequence",
",",
"macroName",
":",
"str",
",",
"widgetObj",
":",
"QtGui",
".",
"QWidget",
")",
":",
"# Convert the key sequence into a QtmacsKeysequence object, or",
"# raise an QtmacsKeysequenceError if the conversion is",
"# i... | Bind ``macroName`` to ``widgetObj`` and associate it with
``keysequence``.
This method does not affect the key bindings of other applets
and/or widgets and can be used to individualise the key
bindings inside every applet instance and every widget inside
that instance. Even mult... | [
"Bind",
"macroName",
"to",
"widgetObj",
"and",
"associate",
"it",
"with",
"keysequence",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L3388-L3456 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsMain.qteUnbindKeyApplet | def qteUnbindKeyApplet(self, applet: (QtmacsApplet, str), keysequence):
"""
Remove ``keysequence`` bindings from all widgets inside ``applet``.
This method does not affect the key bindings of other applets,
or different instances of the same applet.
The ``keysequence`` can be s... | python | def qteUnbindKeyApplet(self, applet: (QtmacsApplet, str), keysequence):
"""
Remove ``keysequence`` bindings from all widgets inside ``applet``.
This method does not affect the key bindings of other applets,
or different instances of the same applet.
The ``keysequence`` can be s... | [
"def",
"qteUnbindKeyApplet",
"(",
"self",
",",
"applet",
":",
"(",
"QtmacsApplet",
",",
"str",
")",
",",
"keysequence",
")",
":",
"# If ``applet`` was specified by its ID (ie. a string) then",
"# fetch the associated ``QtmacsApplet`` instance. If",
"# ``applet`` is already an ins... | Remove ``keysequence`` bindings from all widgets inside ``applet``.
This method does not affect the key bindings of other applets,
or different instances of the same applet.
The ``keysequence`` can be specified either as a string (eg
'<ctrl>+x <ctrl>+f'), or a list of tuples containing... | [
"Remove",
"keysequence",
"bindings",
"from",
"all",
"widgets",
"inside",
"applet",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L3459-L3519 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsMain.qteUnbindKeyFromWidgetObject | def qteUnbindKeyFromWidgetObject(self, keysequence,
widgetObj: QtGui.QWidget):
"""
Disassociate the macro triggered by ``keysequence`` from
``widgetObj``.
The ``keysequence`` can be specified either as a string (eg
'<ctrl>+x <ctrl>+f'), or a ... | python | def qteUnbindKeyFromWidgetObject(self, keysequence,
widgetObj: QtGui.QWidget):
"""
Disassociate the macro triggered by ``keysequence`` from
``widgetObj``.
The ``keysequence`` can be specified either as a string (eg
'<ctrl>+x <ctrl>+f'), or a ... | [
"def",
"qteUnbindKeyFromWidgetObject",
"(",
"self",
",",
"keysequence",
",",
"widgetObj",
":",
"QtGui",
".",
"QWidget",
")",
":",
"# Convert the key sequence into a QtmacsKeysequence object, or",
"# raise an QtmacsKeysequenceError if the conversion is",
"# impossible.",
"keysequenc... | Disassociate the macro triggered by ``keysequence`` from
``widgetObj``.
The ``keysequence`` can be specified either as a string (eg
'<ctrl>+x <ctrl>+f'), or a list of tuples containing the
constants from the ``QtCore.Qt`` name space
(eg. [(ControlModifier, Key_X), (ControlModifi... | [
"Disassociate",
"the",
"macro",
"triggered",
"by",
"keysequence",
"from",
"widgetObj",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L3522-L3569 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsMain.qteUnbindAllFromApplet | def qteUnbindAllFromApplet(self, applet: (QtmacsApplet, str)):
"""
Restore the global key-map for all widgets inside ``applet``.
This method effectively resets the key map of all widgets to
the state they would be in if the widgets were newly
instantiated right now.
The... | python | def qteUnbindAllFromApplet(self, applet: (QtmacsApplet, str)):
"""
Restore the global key-map for all widgets inside ``applet``.
This method effectively resets the key map of all widgets to
the state they would be in if the widgets were newly
instantiated right now.
The... | [
"def",
"qteUnbindAllFromApplet",
"(",
"self",
",",
"applet",
":",
"(",
"QtmacsApplet",
",",
"str",
")",
")",
":",
"# If ``applet`` was specified by its ID (ie. a string) then",
"# fetch the associated ``QtmacsApplet`` instance. If",
"# ``applet`` is already an instance of ``QtmacsApp... | Restore the global key-map for all widgets inside ``applet``.
This method effectively resets the key map of all widgets to
the state they would be in if the widgets were newly
instantiated right now.
The ``applet`` parameter can either be an instance of
``QtmacsApplet`` or a st... | [
"Restore",
"the",
"global",
"key",
"-",
"map",
"for",
"all",
"widgets",
"inside",
"applet",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L3572-L3619 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsMain.qteUnbindAllFromWidgetObject | def qteUnbindAllFromWidgetObject(self, widgetObj: QtGui.QWidget):
"""
Reset the local key-map of ``widgetObj`` to the current global
key-map.
|Args|
* ``widgetObj`` (**QWidget**): determines which widgets
signature to use.
|Returns|
* **None**
... | python | def qteUnbindAllFromWidgetObject(self, widgetObj: QtGui.QWidget):
"""
Reset the local key-map of ``widgetObj`` to the current global
key-map.
|Args|
* ``widgetObj`` (**QWidget**): determines which widgets
signature to use.
|Returns|
* **None**
... | [
"def",
"qteUnbindAllFromWidgetObject",
"(",
"self",
",",
"widgetObj",
":",
"QtGui",
".",
"QWidget",
")",
":",
"# Check type of input arguments.",
"if",
"not",
"hasattr",
"(",
"widgetObj",
",",
"'_qteAdmin'",
")",
":",
"msg",
"=",
"'<widgetObj> was probably not added w... | Reset the local key-map of ``widgetObj`` to the current global
key-map.
|Args|
* ``widgetObj`` (**QWidget**): determines which widgets
signature to use.
|Returns|
* **None**
|Raises|
* **QtmacsArgumentError** if at least one argument has an invalid... | [
"Reset",
"the",
"local",
"key",
"-",
"map",
"of",
"widgetObj",
"to",
"the",
"current",
"global",
"key",
"-",
"map",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L3622-L3649 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsMain.qteRegisterApplet | def qteRegisterApplet(self, cls, replaceApplet: bool=False):
"""
Register ``cls`` as an applet.
The name of the applet is the class name of ``cls``
itself. For instance, if the applet was defined and registered
as
class NewApplet17(QtmacsApplet):
...... | python | def qteRegisterApplet(self, cls, replaceApplet: bool=False):
"""
Register ``cls`` as an applet.
The name of the applet is the class name of ``cls``
itself. For instance, if the applet was defined and registered
as
class NewApplet17(QtmacsApplet):
...... | [
"def",
"qteRegisterApplet",
"(",
"self",
",",
"cls",
",",
"replaceApplet",
":",
"bool",
"=",
"False",
")",
":",
"# Check type of input arguments.",
"if",
"not",
"issubclass",
"(",
"cls",
",",
"QtmacsApplet",
")",
":",
"args",
"=",
"(",
"'cls'",
",",
"'class ... | Register ``cls`` as an applet.
The name of the applet is the class name of ``cls``
itself. For instance, if the applet was defined and registered
as
class NewApplet17(QtmacsApplet):
...
app_name = qteRegisterApplet(NewApplet17)
then the applet ... | [
"Register",
"cls",
"as",
"an",
"applet",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L3688-L3758 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsMain.qteGetAppletHandle | def qteGetAppletHandle(self, appletID: str):
"""
Return a handle to ``appletID``.
If no applet with ID ``appletID`` exists then **None** is
returned.
|Args|
* ``appletID`` (**str**): ID of applet.
|Returns|
* **QtmacsApplet**: handle to applet with ID... | python | def qteGetAppletHandle(self, appletID: str):
"""
Return a handle to ``appletID``.
If no applet with ID ``appletID`` exists then **None** is
returned.
|Args|
* ``appletID`` (**str**): ID of applet.
|Returns|
* **QtmacsApplet**: handle to applet with ID... | [
"def",
"qteGetAppletHandle",
"(",
"self",
",",
"appletID",
":",
"str",
")",
":",
"# Compile list of applet Ids.",
"id_list",
"=",
"[",
"_",
".",
"qteAppletID",
"(",
")",
"for",
"_",
"in",
"self",
".",
"_qteAppletList",
"]",
"# If one of the applets has ``appletID`... | Return a handle to ``appletID``.
If no applet with ID ``appletID`` exists then **None** is
returned.
|Args|
* ``appletID`` (**str**): ID of applet.
|Returns|
* **QtmacsApplet**: handle to applet with ID ``appletID``.
|Raises|
* **QtmacsArgumentError... | [
"Return",
"a",
"handle",
"to",
"appletID",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L3797-L3825 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsMain.qteMakeAppletActive | def qteMakeAppletActive(self, applet: (QtmacsApplet, str)):
"""
Make ``applet`` visible and give it the focus.
If ``applet`` is not yet visible it will replace the
currently active applet, otherwise only the focus will shift.
The ``applet`` parameter can either be an instance o... | python | def qteMakeAppletActive(self, applet: (QtmacsApplet, str)):
"""
Make ``applet`` visible and give it the focus.
If ``applet`` is not yet visible it will replace the
currently active applet, otherwise only the focus will shift.
The ``applet`` parameter can either be an instance o... | [
"def",
"qteMakeAppletActive",
"(",
"self",
",",
"applet",
":",
"(",
"QtmacsApplet",
",",
"str",
")",
")",
":",
"# If ``applet`` was specified by its ID (ie. a string) then",
"# fetch the associated ``QtmacsApplet`` instance. If",
"# ``applet`` is already an instance of ``QtmacsApplet... | Make ``applet`` visible and give it the focus.
If ``applet`` is not yet visible it will replace the
currently active applet, otherwise only the focus will shift.
The ``applet`` parameter can either be an instance of
``QtmacsApplet`` or a string denoting an applet ID. In the
lat... | [
"Make",
"applet",
"visible",
"and",
"give",
"it",
"the",
"focus",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L3828-L3885 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsMain.qteCloseQtmacs | def qteCloseQtmacs(self):
"""
Close Qtmacs.
First kill all applets, then shut down Qtmacs.
|Args|
* **None**
|Returns|
* **None**
|Raises|
* **None**
"""
# Announce the shutdown.
msgObj = QtmacsMessage()
msgOb... | python | def qteCloseQtmacs(self):
"""
Close Qtmacs.
First kill all applets, then shut down Qtmacs.
|Args|
* **None**
|Returns|
* **None**
|Raises|
* **None**
"""
# Announce the shutdown.
msgObj = QtmacsMessage()
msgOb... | [
"def",
"qteCloseQtmacs",
"(",
"self",
")",
":",
"# Announce the shutdown.",
"msgObj",
"=",
"QtmacsMessage",
"(",
")",
"msgObj",
".",
"setSignalName",
"(",
"'qtesigCloseQtmacs'",
")",
"self",
".",
"qtesigCloseQtmacs",
".",
"emit",
"(",
"msgObj",
")",
"# Kill all ap... | Close Qtmacs.
First kill all applets, then shut down Qtmacs.
|Args|
* **None**
|Returns|
* **None**
|Raises|
* **None** | [
"Close",
"Qtmacs",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L3887-L3921 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsMain.qteDefVar | def qteDefVar(self, varName: str, value, module=None, doc: str=None):
"""
Define and document ``varName`` in an arbitrary name space.
If ``module`` is **None** then ``qte_global`` will be used.
.. warning: If the ``varName`` was already defined in
``module`` then its value a... | python | def qteDefVar(self, varName: str, value, module=None, doc: str=None):
"""
Define and document ``varName`` in an arbitrary name space.
If ``module`` is **None** then ``qte_global`` will be used.
.. warning: If the ``varName`` was already defined in
``module`` then its value a... | [
"def",
"qteDefVar",
"(",
"self",
",",
"varName",
":",
"str",
",",
"value",
",",
"module",
"=",
"None",
",",
"doc",
":",
"str",
"=",
"None",
")",
":",
"# Use the global name space per default.",
"if",
"module",
"is",
"None",
":",
"module",
"=",
"qte_global"... | Define and document ``varName`` in an arbitrary name space.
If ``module`` is **None** then ``qte_global`` will be used.
.. warning: If the ``varName`` was already defined in
``module`` then its value and documentation are overwritten
without warning.
|Args|
* ``... | [
"Define",
"and",
"document",
"varName",
"in",
"an",
"arbitrary",
"name",
"space",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L3943-L3982 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsMain.qteGetVariableDoc | def qteGetVariableDoc(self, varName: str, module=None):
"""
Retrieve documentation for ``varName`` defined in ``module``.
If ``module`` is **None** then ``qte_global`` will be used.
|Args|
* ``varName`` (**str**): variable name.
* ``module`` (**Python module**): the mo... | python | def qteGetVariableDoc(self, varName: str, module=None):
"""
Retrieve documentation for ``varName`` defined in ``module``.
If ``module`` is **None** then ``qte_global`` will be used.
|Args|
* ``varName`` (**str**): variable name.
* ``module`` (**Python module**): the mo... | [
"def",
"qteGetVariableDoc",
"(",
"self",
",",
"varName",
":",
"str",
",",
"module",
"=",
"None",
")",
":",
"# Use the global name space per default.",
"if",
"module",
"is",
"None",
":",
"module",
"=",
"qte_global",
"# No documentation for the variable can exists if the ... | Retrieve documentation for ``varName`` defined in ``module``.
If ``module`` is **None** then ``qte_global`` will be used.
|Args|
* ``varName`` (**str**): variable name.
* ``module`` (**Python module**): the module in which the
variable should be defined.
|Returns|
... | [
"Retrieve",
"documentation",
"for",
"varName",
"defined",
"in",
"module",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L3985-L4019 | train |
olitheolix/qtmacs | qtmacs/qtmacsmain.py | QtmacsMain.qteEmulateKeypresses | def qteEmulateKeypresses(self, keysequence):
"""
Emulate the Qt key presses that define ``keysequence``.
The method will put the keys into a queue and process them one
by one once the event loop is idle, ie. the event loop
executes all signals and macros associated with the emul... | python | def qteEmulateKeypresses(self, keysequence):
"""
Emulate the Qt key presses that define ``keysequence``.
The method will put the keys into a queue and process them one
by one once the event loop is idle, ie. the event loop
executes all signals and macros associated with the emul... | [
"def",
"qteEmulateKeypresses",
"(",
"self",
",",
"keysequence",
")",
":",
"# Convert the key sequence into a QtmacsKeysequence object, or",
"# raise an QtmacsOtherError if the conversion is impossible.",
"keysequence",
"=",
"QtmacsKeysequence",
"(",
"keysequence",
")",
"key_list",
... | Emulate the Qt key presses that define ``keysequence``.
The method will put the keys into a queue and process them one
by one once the event loop is idle, ie. the event loop
executes all signals and macros associated with the emulated
key press first before the next one is emulated.
... | [
"Emulate",
"the",
"Qt",
"key",
"presses",
"that",
"define",
"keysequence",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L4027-L4059 | train |
projectshift/shift-schema | shiftschema/schema.py | Schema.process | def process(self, model=None, context=None):
"""
Perform validation and filtering at the same time, return a
validation result object.
:param model: object or dict
:param context: object, dict or None
:return: shiftschema.result.Result
"""
self.filter(mod... | python | def process(self, model=None, context=None):
"""
Perform validation and filtering at the same time, return a
validation result object.
:param model: object or dict
:param context: object, dict or None
:return: shiftschema.result.Result
"""
self.filter(mod... | [
"def",
"process",
"(",
"self",
",",
"model",
"=",
"None",
",",
"context",
"=",
"None",
")",
":",
"self",
".",
"filter",
"(",
"model",
",",
"context",
")",
"return",
"self",
".",
"validate",
"(",
"model",
",",
"context",
")"
] | Perform validation and filtering at the same time, return a
validation result object.
:param model: object or dict
:param context: object, dict or None
:return: shiftschema.result.Result | [
"Perform",
"validation",
"and",
"filtering",
"at",
"the",
"same",
"time",
"return",
"a",
"validation",
"result",
"object",
"."
] | 07787b540d3369bb37217ffbfbe629118edaf0eb | https://github.com/projectshift/shift-schema/blob/07787b540d3369bb37217ffbfbe629118edaf0eb/shiftschema/schema.py#L168-L178 | train |
Midnighter/dependency-info | src/depinfo/info.py | get_sys_info | def get_sys_info():
"""Return system information as a dict."""
blob = dict()
blob["OS"] = platform.system()
blob["OS-release"] = platform.release()
blob["Python"] = platform.python_version()
return blob | python | def get_sys_info():
"""Return system information as a dict."""
blob = dict()
blob["OS"] = platform.system()
blob["OS-release"] = platform.release()
blob["Python"] = platform.python_version()
return blob | [
"def",
"get_sys_info",
"(",
")",
":",
"blob",
"=",
"dict",
"(",
")",
"blob",
"[",
"\"OS\"",
"]",
"=",
"platform",
".",
"system",
"(",
")",
"blob",
"[",
"\"OS-release\"",
"]",
"=",
"platform",
".",
"release",
"(",
")",
"blob",
"[",
"\"Python\"",
"]",
... | Return system information as a dict. | [
"Return",
"system",
"information",
"as",
"a",
"dict",
"."
] | 15bcada0a1d6c047cbe10b844d5bd909ea8cc752 | https://github.com/Midnighter/dependency-info/blob/15bcada0a1d6c047cbe10b844d5bd909ea8cc752/src/depinfo/info.py#L38-L44 | train |
Midnighter/dependency-info | src/depinfo/info.py | get_pkg_info | def get_pkg_info(
package_name, additional=("pip", "flit", "pbr", "setuptools", "wheel")
):
"""Return build and package dependencies as a dict."""
dist_index = build_dist_index(pkg_resources.working_set)
root = dist_index[package_name]
tree = construct_tree(dist_index)
dependencies = {pkg.name: ... | python | def get_pkg_info(
package_name, additional=("pip", "flit", "pbr", "setuptools", "wheel")
):
"""Return build and package dependencies as a dict."""
dist_index = build_dist_index(pkg_resources.working_set)
root = dist_index[package_name]
tree = construct_tree(dist_index)
dependencies = {pkg.name: ... | [
"def",
"get_pkg_info",
"(",
"package_name",
",",
"additional",
"=",
"(",
"\"pip\"",
",",
"\"flit\"",
",",
"\"pbr\"",
",",
"\"setuptools\"",
",",
"\"wheel\"",
")",
")",
":",
"dist_index",
"=",
"build_dist_index",
"(",
"pkg_resources",
".",
"working_set",
")",
"... | Return build and package dependencies as a dict. | [
"Return",
"build",
"and",
"package",
"dependencies",
"as",
"a",
"dict",
"."
] | 15bcada0a1d6c047cbe10b844d5bd909ea8cc752 | https://github.com/Midnighter/dependency-info/blob/15bcada0a1d6c047cbe10b844d5bd909ea8cc752/src/depinfo/info.py#L47-L65 | train |
Midnighter/dependency-info | src/depinfo/info.py | print_info | def print_info(info):
"""Print an information dict to stdout in order."""
format_str = "{:<%d} {:>%d}" % (
max(map(len, info)),
max(map(len, info.values())),
)
for name in sorted(info):
print(format_str.format(name, info[name])) | python | def print_info(info):
"""Print an information dict to stdout in order."""
format_str = "{:<%d} {:>%d}" % (
max(map(len, info)),
max(map(len, info.values())),
)
for name in sorted(info):
print(format_str.format(name, info[name])) | [
"def",
"print_info",
"(",
"info",
")",
":",
"format_str",
"=",
"\"{:<%d} {:>%d}\"",
"%",
"(",
"max",
"(",
"map",
"(",
"len",
",",
"info",
")",
")",
",",
"max",
"(",
"map",
"(",
"len",
",",
"info",
".",
"values",
"(",
")",
")",
")",
",",
")",
"f... | Print an information dict to stdout in order. | [
"Print",
"an",
"information",
"dict",
"to",
"stdout",
"in",
"order",
"."
] | 15bcada0a1d6c047cbe10b844d5bd909ea8cc752 | https://github.com/Midnighter/dependency-info/blob/15bcada0a1d6c047cbe10b844d5bd909ea8cc752/src/depinfo/info.py#L68-L75 | train |
Midnighter/dependency-info | src/depinfo/info.py | print_dependencies | def print_dependencies(package_name):
"""Print the formatted information to standard out."""
info = get_sys_info()
print("\nSystem Information")
print("==================")
print_info(info)
info = get_pkg_info(package_name)
print("\nPackage Versions")
print("================")
print... | python | def print_dependencies(package_name):
"""Print the formatted information to standard out."""
info = get_sys_info()
print("\nSystem Information")
print("==================")
print_info(info)
info = get_pkg_info(package_name)
print("\nPackage Versions")
print("================")
print... | [
"def",
"print_dependencies",
"(",
"package_name",
")",
":",
"info",
"=",
"get_sys_info",
"(",
")",
"print",
"(",
"\"\\nSystem Information\"",
")",
"print",
"(",
"\"==================\"",
")",
"print_info",
"(",
"info",
")",
"info",
"=",
"get_pkg_info",
"(",
"pac... | Print the formatted information to standard out. | [
"Print",
"the",
"formatted",
"information",
"to",
"standard",
"out",
"."
] | 15bcada0a1d6c047cbe10b844d5bd909ea8cc752 | https://github.com/Midnighter/dependency-info/blob/15bcada0a1d6c047cbe10b844d5bd909ea8cc752/src/depinfo/info.py#L78-L88 | train |
OpenGov/og-python-utils | ogutils/web/operators.py | repeat_read_url_request | def repeat_read_url_request(url, headers=None, data=None, retries=2, logger=None):
'''
Allows for repeated http requests up to retries additional times
'''
if logger:
logger.debug("Retrieving url content: {}".format(url))
req = urllib2.Request(url, data, headers=headers or {})
ret... | python | def repeat_read_url_request(url, headers=None, data=None, retries=2, logger=None):
'''
Allows for repeated http requests up to retries additional times
'''
if logger:
logger.debug("Retrieving url content: {}".format(url))
req = urllib2.Request(url, data, headers=headers or {})
ret... | [
"def",
"repeat_read_url_request",
"(",
"url",
",",
"headers",
"=",
"None",
",",
"data",
"=",
"None",
",",
"retries",
"=",
"2",
",",
"logger",
"=",
"None",
")",
":",
"if",
"logger",
":",
"logger",
".",
"debug",
"(",
"\"Retrieving url content: {}\"",
".",
... | Allows for repeated http requests up to retries additional times | [
"Allows",
"for",
"repeated",
"http",
"requests",
"up",
"to",
"retries",
"additional",
"times"
] | 00f44927383dd1bd6348f47302c4453d56963479 | https://github.com/OpenGov/og-python-utils/blob/00f44927383dd1bd6348f47302c4453d56963479/ogutils/web/operators.py#L6-L13 | train |
OpenGov/og-python-utils | ogutils/web/operators.py | repeat_read_json_url_request | def repeat_read_json_url_request(url, headers=None, data=None, retries=2, logger=None):
'''
Allows for repeated http requests up to retries additional times with convienence
wrapper on jsonization of response
'''
if logger:
logger.debug("Retrieving url json content: {}".format(url))
... | python | def repeat_read_json_url_request(url, headers=None, data=None, retries=2, logger=None):
'''
Allows for repeated http requests up to retries additional times with convienence
wrapper on jsonization of response
'''
if logger:
logger.debug("Retrieving url json content: {}".format(url))
... | [
"def",
"repeat_read_json_url_request",
"(",
"url",
",",
"headers",
"=",
"None",
",",
"data",
"=",
"None",
",",
"retries",
"=",
"2",
",",
"logger",
"=",
"None",
")",
":",
"if",
"logger",
":",
"logger",
".",
"debug",
"(",
"\"Retrieving url json content: {}\"",... | Allows for repeated http requests up to retries additional times with convienence
wrapper on jsonization of response | [
"Allows",
"for",
"repeated",
"http",
"requests",
"up",
"to",
"retries",
"additional",
"times",
"with",
"convienence",
"wrapper",
"on",
"jsonization",
"of",
"response"
] | 00f44927383dd1bd6348f47302c4453d56963479 | https://github.com/OpenGov/og-python-utils/blob/00f44927383dd1bd6348f47302c4453d56963479/ogutils/web/operators.py#L15-L23 | train |
atl/py-smartdc | smartdc/machine.py | priv | def priv(x):
"""
Quick and dirty method to find an IP on a private network given a correctly
formatted IPv4 quad.
"""
if x.startswith(u'172.'):
return 16 <= int(x.split(u'.')[1]) < 32
return x.startswith((u'192.168.', u'10.', u'172.')) | python | def priv(x):
"""
Quick and dirty method to find an IP on a private network given a correctly
formatted IPv4 quad.
"""
if x.startswith(u'172.'):
return 16 <= int(x.split(u'.')[1]) < 32
return x.startswith((u'192.168.', u'10.', u'172.')) | [
"def",
"priv",
"(",
"x",
")",
":",
"if",
"x",
".",
"startswith",
"(",
"u'172.'",
")",
":",
"return",
"16",
"<=",
"int",
"(",
"x",
".",
"split",
"(",
"u'.'",
")",
"[",
"1",
"]",
")",
"<",
"32",
"return",
"x",
".",
"startswith",
"(",
"(",
"u'19... | Quick and dirty method to find an IP on a private network given a correctly
formatted IPv4 quad. | [
"Quick",
"and",
"dirty",
"method",
"to",
"find",
"an",
"IP",
"on",
"a",
"private",
"network",
"given",
"a",
"correctly",
"formatted",
"IPv4",
"quad",
"."
] | cc5cd5910e19004cc46e376ce035affe28fc798e | https://github.com/atl/py-smartdc/blob/cc5cd5910e19004cc46e376ce035affe28fc798e/smartdc/machine.py#L7-L14 | train |
a1ezzz/wasp-general | wasp_general/network/transport.py | WBroadcastNetworkTransport.create_client_socket | def create_client_socket(self, config):
""" Create client broadcast socket
:param config: client configuration
:return: socket.socket
"""
client_socket = WUDPNetworkNativeTransport.create_client_socket(self, config)
client_socket.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
return client_socket | python | def create_client_socket(self, config):
""" Create client broadcast socket
:param config: client configuration
:return: socket.socket
"""
client_socket = WUDPNetworkNativeTransport.create_client_socket(self, config)
client_socket.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
return client_socket | [
"def",
"create_client_socket",
"(",
"self",
",",
"config",
")",
":",
"client_socket",
"=",
"WUDPNetworkNativeTransport",
".",
"create_client_socket",
"(",
"self",
",",
"config",
")",
"client_socket",
".",
"setsockopt",
"(",
"socket",
".",
"SOL_SOCKET",
",",
"socke... | Create client broadcast socket
:param config: client configuration
:return: socket.socket | [
"Create",
"client",
"broadcast",
"socket"
] | 1029839d33eb663f8dec76c1c46754d53c1de4a9 | https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/network/transport.py#L274-L282 | train |
AASHE/python-membersuite-api-client | membersuite_api_client/mixins.py | run_object_query | def run_object_query(client, base_object_query, start_record, limit_to,
verbose=False):
"""inline method to take advantage of retry"""
if verbose:
print("[start: %d limit: %d]" % (start_record, limit_to))
start = datetime.datetime.now()
result = client.execute_object_query(
... | python | def run_object_query(client, base_object_query, start_record, limit_to,
verbose=False):
"""inline method to take advantage of retry"""
if verbose:
print("[start: %d limit: %d]" % (start_record, limit_to))
start = datetime.datetime.now()
result = client.execute_object_query(
... | [
"def",
"run_object_query",
"(",
"client",
",",
"base_object_query",
",",
"start_record",
",",
"limit_to",
",",
"verbose",
"=",
"False",
")",
":",
"if",
"verbose",
":",
"print",
"(",
"\"[start: %d limit: %d]\"",
"%",
"(",
"start_record",
",",
"limit_to",
")",
"... | inline method to take advantage of retry | [
"inline",
"method",
"to",
"take",
"advantage",
"of",
"retry"
] | 221f5ed8bc7d4424237a4669c5af9edc11819ee9 | https://github.com/AASHE/python-membersuite-api-client/blob/221f5ed8bc7d4424237a4669c5af9edc11819ee9/membersuite_api_client/mixins.py#L10-L23 | train |
AASHE/python-membersuite-api-client | membersuite_api_client/mixins.py | ChunkQueryMixin.get_long_query | def get_long_query(self, base_object_query, limit_to=100, max_calls=None,
start_record=0, verbose=False):
"""
Takes a base query for all objects and recursively requests them
:param str base_object_query: the base query to be executed
:param int limit_to: how many... | python | def get_long_query(self, base_object_query, limit_to=100, max_calls=None,
start_record=0, verbose=False):
"""
Takes a base query for all objects and recursively requests them
:param str base_object_query: the base query to be executed
:param int limit_to: how many... | [
"def",
"get_long_query",
"(",
"self",
",",
"base_object_query",
",",
"limit_to",
"=",
"100",
",",
"max_calls",
"=",
"None",
",",
"start_record",
"=",
"0",
",",
"verbose",
"=",
"False",
")",
":",
"if",
"verbose",
":",
"print",
"(",
"base_object_query",
")",... | Takes a base query for all objects and recursively requests them
:param str base_object_query: the base query to be executed
:param int limit_to: how many rows to query for in each chunk
:param int max_calls: the max calls(chunks to request) None is infinite
:param int start_record: the... | [
"Takes",
"a",
"base",
"query",
"for",
"all",
"objects",
"and",
"recursively",
"requests",
"them"
] | 221f5ed8bc7d4424237a4669c5af9edc11819ee9 | https://github.com/AASHE/python-membersuite-api-client/blob/221f5ed8bc7d4424237a4669c5af9edc11819ee9/membersuite_api_client/mixins.py#L35-L95 | train |
Chilipp/model-organization | model_organization/__init__.py | ModelOrganizer.logger | def logger(self):
"""The logger of this organizer"""
if self._experiment:
return logging.getLogger('.'.join([self.name, self.experiment]))
elif self._projectname:
return logging.getLogger('.'.join([self.name, self.projectname]))
else:
return logging.ge... | python | def logger(self):
"""The logger of this organizer"""
if self._experiment:
return logging.getLogger('.'.join([self.name, self.experiment]))
elif self._projectname:
return logging.getLogger('.'.join([self.name, self.projectname]))
else:
return logging.ge... | [
"def",
"logger",
"(",
"self",
")",
":",
"if",
"self",
".",
"_experiment",
":",
"return",
"logging",
".",
"getLogger",
"(",
"'.'",
".",
"join",
"(",
"[",
"self",
".",
"name",
",",
"self",
".",
"experiment",
"]",
")",
")",
"elif",
"self",
".",
"_proj... | The logger of this organizer | [
"The",
"logger",
"of",
"this",
"organizer"
] | 694d1219c7ed7e1b2b17153afa11bdc21169bca2 | https://github.com/Chilipp/model-organization/blob/694d1219c7ed7e1b2b17153afa11bdc21169bca2/model_organization/__init__.py#L98-L105 | train |
Chilipp/model-organization | model_organization/__init__.py | ModelOrganizer.main | def main(cls, args=None):
"""
Run the organizer from the command line
Parameters
----------
name: str
The name of the program
args: list
The arguments that are parsed to the argument parser
"""
organizer = cls()
organizer.p... | python | def main(cls, args=None):
"""
Run the organizer from the command line
Parameters
----------
name: str
The name of the program
args: list
The arguments that are parsed to the argument parser
"""
organizer = cls()
organizer.p... | [
"def",
"main",
"(",
"cls",
",",
"args",
"=",
"None",
")",
":",
"organizer",
"=",
"cls",
"(",
")",
"organizer",
".",
"parse_args",
"(",
"args",
")",
"if",
"not",
"organizer",
".",
"no_modification",
":",
"organizer",
".",
"config",
".",
"save",
"(",
"... | Run the organizer from the command line
Parameters
----------
name: str
The name of the program
args: list
The arguments that are parsed to the argument parser | [
"Run",
"the",
"organizer",
"from",
"the",
"command",
"line"
] | 694d1219c7ed7e1b2b17153afa11bdc21169bca2 | https://github.com/Chilipp/model-organization/blob/694d1219c7ed7e1b2b17153afa11bdc21169bca2/model_organization/__init__.py#L141-L155 | train |
Chilipp/model-organization | model_organization/__init__.py | ModelOrganizer.start | def start(self, **kwargs):
"""
Start the commands of this organizer
Parameters
----------
``**kwargs``
Any keyword from the :attr:`commands` or :attr:`parser_commands`
attribute
Returns
-------
argparse.Namespace
The n... | python | def start(self, **kwargs):
"""
Start the commands of this organizer
Parameters
----------
``**kwargs``
Any keyword from the :attr:`commands` or :attr:`parser_commands`
attribute
Returns
-------
argparse.Namespace
The n... | [
"def",
"start",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"ts",
"=",
"{",
"}",
"ret",
"=",
"{",
"}",
"info_parts",
"=",
"{",
"'info'",
",",
"'get-value'",
",",
"'get_value'",
"}",
"for",
"cmd",
"in",
"self",
".",
"commands",
":",
"parser_cmd"... | Start the commands of this organizer
Parameters
----------
``**kwargs``
Any keyword from the :attr:`commands` or :attr:`parser_commands`
attribute
Returns
-------
argparse.Namespace
The namespace with the commands as given in ``**kwar... | [
"Start",
"the",
"commands",
"of",
"this",
"organizer"
] | 694d1219c7ed7e1b2b17153afa11bdc21169bca2 | https://github.com/Chilipp/model-organization/blob/694d1219c7ed7e1b2b17153afa11bdc21169bca2/model_organization/__init__.py#L159-L204 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.