repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
3 values
summary
stringlengths
4
350
a1ezzz/wasp-general
wasp_general/task/health.py
WTaskHealth.healthy
def healthy(self): """ Return task health. If None - task is healthy, otherwise - maximum severity of sensors :return: None or WTaskHealthSensor.WTaskSensorSeverity """ state = None for sensor in self._sensors.values(): if sensor.healthy() is False: if state is None or sensor.severity().value > state....
python
def healthy(self): """ Return task health. If None - task is healthy, otherwise - maximum severity of sensors :return: None or WTaskHealthSensor.WTaskSensorSeverity """ state = None for sensor in self._sensors.values(): if sensor.healthy() is False: if state is None or sensor.severity().value > state....
[ "def", "healthy", "(", "self", ")", ":", "state", "=", "None", "for", "sensor", "in", "self", ".", "_sensors", ".", "values", "(", ")", ":", "if", "sensor", ".", "healthy", "(", ")", "is", "False", ":", "if", "state", "is", "None", "or", "sensor", ...
Return task health. If None - task is healthy, otherwise - maximum severity of sensors :return: None or WTaskHealthSensor.WTaskSensorSeverity
[ "Return", "task", "health", ".", "If", "None", "-", "task", "is", "healthy", "otherwise", "-", "maximum", "severity", "of", "sensors" ]
1029839d33eb663f8dec76c1c46754d53c1de4a9
https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/task/health.py#L169-L182
train
Return task health. If None - task is healthy otherwise - maximum severity of sensors is critical.
Chilipp/model-organization
docs/square_preproc.py
SquareModelOrganizer.preproc
def preproc(self, which='sin', **kwargs): """ Create preprocessing data Parameters ---------- which: str The name of the numpy function to apply ``**kwargs`` Any other parameter for the :meth:`model_organization.ModelOrganizer.app_main...
python
def preproc(self, which='sin', **kwargs): """ Create preprocessing data Parameters ---------- which: str The name of the numpy function to apply ``**kwargs`` Any other parameter for the :meth:`model_organization.ModelOrganizer.app_main...
[ "def", "preproc", "(", "self", ",", "which", "=", "'sin'", ",", "*", "*", "kwargs", ")", ":", "self", ".", "app_main", "(", "*", "*", "kwargs", ")", "config", "=", "self", ".", "exp_config", "config", "[", "'infile'", "]", "=", "infile", "=", "osp"...
Create preprocessing data Parameters ---------- which: str The name of the numpy function to apply ``**kwargs`` Any other parameter for the :meth:`model_organization.ModelOrganizer.app_main` method
[ "Create", "preprocessing", "data" ]
694d1219c7ed7e1b2b17153afa11bdc21169bca2
https://github.com/Chilipp/model-organization/blob/694d1219c7ed7e1b2b17153afa11bdc21169bca2/docs/square_preproc.py#L17-L36
train
Create preprocessing data for the base class
a1ezzz/wasp-general
wasp_general/os/linux/mounts.py
WMountPoint.mounts
def mounts(cls): """ Return tuple of current mount points :return: tuple of WMountPoint """ result = [] with open(cls.__mounts_file__) as f: for mount_record in f: result.append(WMountPoint(mount_record)) return tuple(result)
python
def mounts(cls): """ Return tuple of current mount points :return: tuple of WMountPoint """ result = [] with open(cls.__mounts_file__) as f: for mount_record in f: result.append(WMountPoint(mount_record)) return tuple(result)
[ "def", "mounts", "(", "cls", ")", ":", "result", "=", "[", "]", "with", "open", "(", "cls", ".", "__mounts_file__", ")", "as", "f", ":", "for", "mount_record", "in", "f", ":", "result", ".", "append", "(", "WMountPoint", "(", "mount_record", ")", ")"...
Return tuple of current mount points :return: tuple of WMountPoint
[ "Return", "tuple", "of", "current", "mount", "points" ]
1029839d33eb663f8dec76c1c46754d53c1de4a9
https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/os/linux/mounts.py#L123-L132
train
Return tuple of current mount points
a1ezzz/wasp-general
wasp_general/os/linux/mounts.py
WMountPoint.mount_point
def mount_point(cls, file_path): """ Return mount point that, where the given path is reside on :param file_path: target path to search :return: WMountPoint or None (if file path is outside current mount points) """ mount = None for mp in cls.mounts(): mp_path = mp.path() if file_path.startswith(mp_...
python
def mount_point(cls, file_path): """ Return mount point that, where the given path is reside on :param file_path: target path to search :return: WMountPoint or None (if file path is outside current mount points) """ mount = None for mp in cls.mounts(): mp_path = mp.path() if file_path.startswith(mp_...
[ "def", "mount_point", "(", "cls", ",", "file_path", ")", ":", "mount", "=", "None", "for", "mp", "in", "cls", ".", "mounts", "(", ")", ":", "mp_path", "=", "mp", ".", "path", "(", ")", "if", "file_path", ".", "startswith", "(", "mp_path", ")", "is"...
Return mount point that, where the given path is reside on :param file_path: target path to search :return: WMountPoint or None (if file path is outside current mount points)
[ "Return", "mount", "point", "that", "where", "the", "given", "path", "is", "reside", "on" ]
1029839d33eb663f8dec76c1c46754d53c1de4a9
https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/os/linux/mounts.py#L137-L151
train
Return the mount point that where the given path is reside on
a1ezzz/wasp-general
wasp_general/os/linux/mounts.py
WMountPoint.mount
def mount(cls, device, mount_directory, fs=None, options=None, cmd_timeout=None, sudo=False): """ Mount a device to mount directory :param device: device to mount :param mount_directory: target directory where the given device will be mounted to :param fs: optional, filesystem on the specified device. If speci...
python
def mount(cls, device, mount_directory, fs=None, options=None, cmd_timeout=None, sudo=False): """ Mount a device to mount directory :param device: device to mount :param mount_directory: target directory where the given device will be mounted to :param fs: optional, filesystem on the specified device. If speci...
[ "def", "mount", "(", "cls", ",", "device", ",", "mount_directory", ",", "fs", "=", "None", ",", "options", "=", "None", ",", "cmd_timeout", "=", "None", ",", "sudo", "=", "False", ")", ":", "cmd", "=", "[", "]", "if", "sudo", "is", "False", "else",...
Mount a device to mount directory :param device: device to mount :param mount_directory: target directory where the given device will be mounted to :param fs: optional, filesystem on the specified device. If specifies - overrides OS filesystem \ detection with this value. :param options: specifies mount opti...
[ "Mount", "a", "device", "to", "mount", "directory" ]
1029839d33eb663f8dec76c1c46754d53c1de4a9
https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/os/linux/mounts.py#L158-L180
train
Mount a device to a given mount directory.
a1ezzz/wasp-general
wasp_general/os/linux/mounts.py
WMountPoint.umount
def umount(cls, device_or_directory, cmd_timeout=None, sudo=False): """ Unmount device (or mount directory) :param device_or_directory: device name or mount directory to unmount :param cmd_timeout: if specified - timeout with which this unmount command should be evaluated (if \ command isn't complete within th...
python
def umount(cls, device_or_directory, cmd_timeout=None, sudo=False): """ Unmount device (or mount directory) :param device_or_directory: device name or mount directory to unmount :param cmd_timeout: if specified - timeout with which this unmount command should be evaluated (if \ command isn't complete within th...
[ "def", "umount", "(", "cls", ",", "device_or_directory", ",", "cmd_timeout", "=", "None", ",", "sudo", "=", "False", ")", ":", "cmd", "=", "[", "]", "if", "sudo", "is", "False", "else", "[", "'sudo'", "]", "cmd", ".", "extend", "(", "[", "'umount'", ...
Unmount device (or mount directory) :param device_or_directory: device name or mount directory to unmount :param cmd_timeout: if specified - timeout with which this unmount command should be evaluated (if \ command isn't complete within the given timeout - an exception will be raised) :param sudo: whether to u...
[ "Unmount", "device", "(", "or", "mount", "directory", ")" ]
1029839d33eb663f8dec76c1c46754d53c1de4a9
https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/os/linux/mounts.py#L185-L197
train
Unmounts the specified device or mount directory.
AASHE/python-membersuite-api-client
membersuite_api_client/organizations/services.py
OrganizationService.get_org_types
def get_org_types(self): """ Retrieves all current OrganizationType objects """ if not self.client.session_id: self.client.request_session() object_query = "SELECT Objects() FROM OrganizationType" result = self.client.execute_object_query(object_query=object_...
python
def get_org_types(self): """ Retrieves all current OrganizationType objects """ if not self.client.session_id: self.client.request_session() object_query = "SELECT Objects() FROM OrganizationType" result = self.client.execute_object_query(object_query=object_...
[ "def", "get_org_types", "(", "self", ")", ":", "if", "not", "self", ".", "client", ".", "session_id", ":", "self", ".", "client", ".", "request_session", "(", ")", "object_query", "=", "\"SELECT Objects() FROM OrganizationType\"", "result", "=", "self", ".", "...
Retrieves all current OrganizationType objects
[ "Retrieves", "all", "current", "OrganizationType", "objects" ]
221f5ed8bc7d4424237a4669c5af9edc11819ee9
https://github.com/AASHE/python-membersuite-api-client/blob/221f5ed8bc7d4424237a4669c5af9edc11819ee9/membersuite_api_client/organizations/services.py#L80-L93
train
Retrieves all OrganizationTypes in the current session
AASHE/python-membersuite-api-client
membersuite_api_client/organizations/services.py
OrganizationService.package_org_types
def package_org_types(self, obj_list): """ Loops through MS objects returned from queries to turn them into OrganizationType objects and pack them into a list for later use. """ org_type_list = [] for obj in obj_list: sane_obj = convert_ms_object( ...
python
def package_org_types(self, obj_list): """ Loops through MS objects returned from queries to turn them into OrganizationType objects and pack them into a list for later use. """ org_type_list = [] for obj in obj_list: sane_obj = convert_ms_object( ...
[ "def", "package_org_types", "(", "self", ",", "obj_list", ")", ":", "org_type_list", "=", "[", "]", "for", "obj", "in", "obj_list", ":", "sane_obj", "=", "convert_ms_object", "(", "obj", "[", "'Fields'", "]", "[", "'KeyValueOfstringanyType'", "]", ")", "org"...
Loops through MS objects returned from queries to turn them into OrganizationType objects and pack them into a list for later use.
[ "Loops", "through", "MS", "objects", "returned", "from", "queries", "to", "turn", "them", "into", "OrganizationType", "objects", "and", "pack", "them", "into", "a", "list", "for", "later", "use", "." ]
221f5ed8bc7d4424237a4669c5af9edc11819ee9
https://github.com/AASHE/python-membersuite-api-client/blob/221f5ed8bc7d4424237a4669c5af9edc11819ee9/membersuite_api_client/organizations/services.py#L95-L107
train
Packs the list of OrganizationType objects into a list of OrganizationType objects.
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
Returns all Individuals that have organization as a primary org.
20c/grainy
grainy/core.py
int_flags
def int_flags(flags, mapper=const.PERM_STRING_MAP): """ Converts string permission flags into integer permission flags as specified in const.PERM_STRING_MAP Arguments: - flags <str>: one or more flags For example: "crud" or "ru" or "r" - mapper <list=const.PERM_STRING_MAP>: a...
python
def int_flags(flags, mapper=const.PERM_STRING_MAP): """ Converts string permission flags into integer permission flags as specified in const.PERM_STRING_MAP Arguments: - flags <str>: one or more flags For example: "crud" or "ru" or "r" - mapper <list=const.PERM_STRING_MAP>: a...
[ "def", "int_flags", "(", "flags", ",", "mapper", "=", "const", ".", "PERM_STRING_MAP", ")", ":", "r", "=", "0", "if", "not", "flags", ":", "return", "r", "if", "isinstance", "(", "flags", ",", "six", ".", "integer_types", ")", ":", "return", "flags", ...
Converts string permission flags into integer permission flags as specified in const.PERM_STRING_MAP Arguments: - flags <str>: one or more flags For example: "crud" or "ru" or "r" - mapper <list=const.PERM_STRING_MAP>: a list containing tuples mapping int permission flag ...
[ "Converts", "string", "permission", "flags", "into", "integer", "permission", "flags", "as", "specified", "in", "const", ".", "PERM_STRING_MAP", "Arguments", ":", "-", "flags", "<str", ">", ":", "one", "or", "more", "flags", "For", "example", ":", "crud", "o...
cd956fd4144044993abc967974a127aab07a8ef6
https://github.com/20c/grainy/blob/cd956fd4144044993abc967974a127aab07a8ef6/grainy/core.py#L12-L40
train
Converts string permission flags into integer permission flags as specified in const. PERM_STRING_MAP.
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
Check if the value of this namespace is matched by the given list of keys.
20c/grainy
grainy/core.py
PermissionSet.update
def update(self, permissions): """ Update the permissionset with a dict of namespace<str>:permission<Permission|int|long> pairs Example: pset.update( { "a" : const.PERM_READ, "b" : Permission("b", const.PERM_RW) } ...
python
def update(self, permissions): """ Update the permissionset with a dict of namespace<str>:permission<Permission|int|long> pairs Example: pset.update( { "a" : const.PERM_READ, "b" : Permission("b", const.PERM_RW) } ...
[ "def", "update", "(", "self", ",", "permissions", ")", ":", "for", "k", ",", "v", "in", "list", "(", "permissions", ".", "items", "(", ")", ")", ":", "self", ".", "__setitem__", "(", "k", ",", "v", ",", "reindex", "=", "False", ")", "self", ".", ...
Update the permissionset with a dict of namespace<str>:permission<Permission|int|long> pairs Example: pset.update( { "a" : const.PERM_READ, "b" : Permission("b", const.PERM_RW) } )
[ "Update", "the", "permissionset", "with", "a", "dict", "of", "namespace<str", ">", ":", "permission<Permission|int|long", ">", "pairs" ]
cd956fd4144044993abc967974a127aab07a8ef6
https://github.com/20c/grainy/blob/cd956fd4144044993abc967974a127aab07a8ef6/grainy/core.py#L256-L272
train
Update the permissionset with a dict of namespace<str>: permission<int|long > pairs.
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
Updates the index of the permission index for this set.
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
Returns the permissions level for the specified namespace
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
Checks if the permset has permission to the specified namespace at the specified level.
20c/grainy
grainy/core.py
PermissionSet.apply
def apply(self, data, path=None, applicator=None): """ Apply permissions in this set to the provided data, effectively removing all keys from it are not permissioned to be viewed Arguments: data -- dict of data Returns: Cleaned data """ if app...
python
def apply(self, data, path=None, applicator=None): """ Apply permissions in this set to the provided data, effectively removing all keys from it are not permissioned to be viewed Arguments: data -- dict of data Returns: Cleaned data """ if app...
[ "def", "apply", "(", "self", ",", "data", ",", "path", "=", "None", ",", "applicator", "=", "None", ")", ":", "if", "applicator", ":", "applicator", ".", "pset", "=", "self", "else", ":", "applicator", "=", "Applicator", "(", "self", ")", "return", "...
Apply permissions in this set to the provided data, effectively removing all keys from it are not permissioned to be viewed Arguments: data -- dict of data Returns: Cleaned data
[ "Apply", "permissions", "in", "this", "set", "to", "the", "provided", "data", "effectively", "removing", "all", "keys", "from", "it", "are", "not", "permissioned", "to", "be", "viewed" ]
cd956fd4144044993abc967974a127aab07a8ef6
https://github.com/20c/grainy/blob/cd956fd4144044993abc967974a127aab07a8ef6/grainy/core.py#L399-L418
train
Applies permissions in this set to the provided data.
20c/grainy
grainy/core.py
Applicator.apply
def apply(self, data, path=None): """ Apply permissions in this set to the provided data, effectively removing all keys from it are not permissioned to be viewed Arguments: data -- dict of data Returns: Cleaned data """ if path is None: ...
python
def apply(self, data, path=None): """ Apply permissions in this set to the provided data, effectively removing all keys from it are not permissioned to be viewed Arguments: data -- dict of data Returns: Cleaned data """ if path is None: ...
[ "def", "apply", "(", "self", ",", "data", ",", "path", "=", "None", ")", ":", "if", "path", "is", "None", ":", "path", "=", "[", "]", "if", "not", "isinstance", "(", "data", ",", "dict", ")", ":", "return", "data", "def", "_enumerate", "(", "valu...
Apply permissions in this set to the provided data, effectively removing all keys from it are not permissioned to be viewed Arguments: data -- dict of data Returns: Cleaned data
[ "Apply", "permissions", "in", "this", "set", "to", "the", "provided", "data", "effectively", "removing", "all", "keys", "from", "it", "are", "not", "permissioned", "to", "be", "viewed" ]
cd956fd4144044993abc967974a127aab07a8ef6
https://github.com/20c/grainy/blob/cd956fd4144044993abc967974a127aab07a8ef6/grainy/core.py#L436-L553
train
Applies permissions in this set to the provided data effectively removing all keys from it are not permissioned to be viewed
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
Return digest of the given message and key
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
Calls a piece of code with the DOM element that corresponds to the search field of the table.
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
Return the conversion from local keys and modifiers to Qt constants.
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
r Print your name.
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
Disable the yank - pop hook.
olitheolix/qtmacs
qtmacs/extensions/qtmacsscintilla_macros.py
UndoKillRectangle.commit
def commit(self): """ Insert the specified text in all selected lines, always at the same column position. """ # Get the number of lines and columns in last line. last_line, last_col = self.qteWidget.getNumLinesAndColumns() # If this is the first ever call to th...
python
def commit(self): """ Insert the specified text in all selected lines, always at the same column position. """ # Get the number of lines and columns in last line. last_line, last_col = self.qteWidget.getNumLinesAndColumns() # If this is the first ever call to th...
[ "def", "commit", "(", "self", ")", ":", "# Get the number of lines and columns in last line.", "last_line", ",", "last_col", "=", "self", ".", "qteWidget", ".", "getNumLinesAndColumns", "(", ")", "# If this is the first ever call to this undo/redo element", "# then backup the c...
Insert the specified text in all selected lines, always at the same column position.
[ "Insert", "the", "specified", "text", "in", "all", "selected", "lines", "always", "at", "the", "same", "column", "position", "." ]
36253b082b82590f183fe154b053eb3a1e741be2
https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacsscintilla_macros.py#L1000-L1087
train
Commit the current selection of the element.
olitheolix/qtmacs
qtmacs/extensions/qtmacsscintilla_macros.py
UndoKillRectangle.reverseCommit
def reverseCommit(self): """ Re-insert the previously deleted line. """ if self.markerPos is None: return # Remove the specified string from the same position in every line # in between the mark and the cursor (inclusive). col = min((self.markerPos[1...
python
def reverseCommit(self): """ Re-insert the previously deleted line. """ if self.markerPos is None: return # Remove the specified string from the same position in every line # in between the mark and the cursor (inclusive). col = min((self.markerPos[1...
[ "def", "reverseCommit", "(", "self", ")", ":", "if", "self", ".", "markerPos", "is", "None", ":", "return", "# Remove the specified string from the same position in every line", "# in between the mark and the cursor (inclusive).", "col", "=", "min", "(", "(", "self", ".",...
Re-insert the previously deleted line.
[ "Re", "-", "insert", "the", "previously", "deleted", "line", "." ]
36253b082b82590f183fe154b053eb3a1e741be2
https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacsscintilla_macros.py#L1089-L1106
train
Re - insert the previously deleted line.
olitheolix/qtmacs
qtmacs/extensions/qtmacsscintilla_macros.py
UndoYankRectangle.commit
def commit(self): """ Insert the specified text in all selected lines, always at the same column position. """ # Get the number of lines and columns in the last line. last_line, last_col = self.qteWidget.getNumLinesAndColumns() # If this is the first ever call t...
python
def commit(self): """ Insert the specified text in all selected lines, always at the same column position. """ # Get the number of lines and columns in the last line. last_line, last_col = self.qteWidget.getNumLinesAndColumns() # If this is the first ever call t...
[ "def", "commit", "(", "self", ")", ":", "# Get the number of lines and columns in the last line.", "last_line", ",", "last_col", "=", "self", ".", "qteWidget", ".", "getNumLinesAndColumns", "(", ")", "# If this is the first ever call to this undo/redo element", "# then backup t...
Insert the specified text in all selected lines, always at the same column position.
[ "Insert", "the", "specified", "text", "in", "all", "selected", "lines", "always", "at", "the", "same", "column", "position", "." ]
36253b082b82590f183fe154b053eb3a1e741be2
https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacsscintilla_macros.py#L1151-L1175
train
Commit the current cursor position.
olitheolix/qtmacs
qtmacs/extensions/qtmacsscintilla_macros.py
UndoYankRectangle.reverseCommit
def reverseCommit(self): """ Re-insert the previously deleted line. """ # Loop over all lines in the rectangle to remove the # previously yanked strings. col = self.cursorPos[1] for ii, text in enumerate(self.insertedText): line = ii + self.cursorPos[...
python
def reverseCommit(self): """ Re-insert the previously deleted line. """ # Loop over all lines in the rectangle to remove the # previously yanked strings. col = self.cursorPos[1] for ii, text in enumerate(self.insertedText): line = ii + self.cursorPos[...
[ "def", "reverseCommit", "(", "self", ")", ":", "# Loop over all lines in the rectangle to remove the", "# previously yanked strings.", "col", "=", "self", ".", "cursorPos", "[", "1", "]", "for", "ii", ",", "text", "in", "enumerate", "(", "self", ".", "insertedText",...
Re-insert the previously deleted line.
[ "Re", "-", "insert", "the", "previously", "deleted", "line", "." ]
36253b082b82590f183fe154b053eb3a1e741be2
https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacsscintilla_macros.py#L1177-L1194
train
Re - insert the previously deleted line.
olitheolix/qtmacs
qtmacs/extensions/qtmacsscintilla_macros.py
UndoStringInsertRectangle.commit
def commit(self): """ Insert the specified text in all selected lines, always at the same column position. """ # Get the number of lines and columns in last line. last_line, last_col = self.qteWidget.getNumLinesAndColumns() # If this is the first ever call to th...
python
def commit(self): """ Insert the specified text in all selected lines, always at the same column position. """ # Get the number of lines and columns in last line. last_line, last_col = self.qteWidget.getNumLinesAndColumns() # If this is the first ever call to th...
[ "def", "commit", "(", "self", ")", ":", "# Get the number of lines and columns in last line.", "last_line", ",", "last_col", "=", "self", ".", "qteWidget", ".", "getNumLinesAndColumns", "(", ")", "# If this is the first ever call to this undo/redo element", "# then backup the c...
Insert the specified text in all selected lines, always at the same column position.
[ "Insert", "the", "specified", "text", "in", "all", "selected", "lines", "always", "at", "the", "same", "column", "position", "." ]
36253b082b82590f183fe154b053eb3a1e741be2
https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacsscintilla_macros.py#L1235-L1269
train
Commits the current state of the current element.
olitheolix/qtmacs
qtmacs/extensions/qtmacsscintilla_macros.py
UndoStringInsertRectangle.reverseCommit
def reverseCommit(self): """ Re-insert the previously deleted line. """ if self.markerPos is None: return # Remove the specified string from the same position in every line # in between the mark and the cursor (inclusive). col = min((self.markerPos[1...
python
def reverseCommit(self): """ Re-insert the previously deleted line. """ if self.markerPos is None: return # Remove the specified string from the same position in every line # in between the mark and the cursor (inclusive). col = min((self.markerPos[1...
[ "def", "reverseCommit", "(", "self", ")", ":", "if", "self", ".", "markerPos", "is", "None", ":", "return", "# Remove the specified string from the same position in every line", "# in between the mark and the cursor (inclusive).", "col", "=", "min", "(", "(", "self", ".",...
Re-insert the previously deleted line.
[ "Re", "-", "insert", "the", "previously", "deleted", "line", "." ]
36253b082b82590f183fe154b053eb3a1e741be2
https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacsscintilla_macros.py#L1271-L1286
train
Re - insert the previously deleted line.
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
Clears the highlighting of the current item.
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
Highlights the next possible match in the set of matches.
olitheolix/qtmacs
qtmacs/extensions/qtmacsscintilla_macros.py
SearchForwardMiniApplet.qteTextChanged
def qteTextChanged(self): """ Search for sub-string matches. This method is triggered by Qt whenever the text changes, ie. whenever the user has altered the input. Extract the new input, find all matches, and highlight them accordingly. """ # Remove any previous ...
python
def qteTextChanged(self): """ Search for sub-string matches. This method is triggered by Qt whenever the text changes, ie. whenever the user has altered the input. Extract the new input, find all matches, and highlight them accordingly. """ # Remove any previous ...
[ "def", "qteTextChanged", "(", "self", ")", ":", "# Remove any previous highlighting.", "self", ".", "clearHighlighting", "(", ")", "SCI", "=", "self", ".", "qteWidget", "# Compile a list of spans that contain the specified string.", "self", ".", "compileMatchList", "(", "...
Search for sub-string matches. This method is triggered by Qt whenever the text changes, ie. whenever the user has altered the input. Extract the new input, find all matches, and highlight them accordingly.
[ "Search", "for", "sub", "-", "string", "matches", "." ]
36253b082b82590f183fe154b053eb3a1e741be2
https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacsscintilla_macros.py#L1523-L1579
train
Update the highlighting of the new text.
olitheolix/qtmacs
qtmacs/extensions/qtmacsscintilla_macros.py
SearchForwardMiniApplet.qteAbort
def qteAbort(self, msgObj): """ Restore the original cursor position because the user hit abort. """ self.qteWidget.setCursorPosition(*self.cursorPosOrig) self.qteMain.qtesigAbort.disconnect(self.qteAbort)
python
def qteAbort(self, msgObj): """ Restore the original cursor position because the user hit abort. """ self.qteWidget.setCursorPosition(*self.cursorPosOrig) self.qteMain.qtesigAbort.disconnect(self.qteAbort)
[ "def", "qteAbort", "(", "self", ",", "msgObj", ")", ":", "self", ".", "qteWidget", ".", "setCursorPosition", "(", "*", "self", ".", "cursorPosOrig", ")", "self", ".", "qteMain", ".", "qtesigAbort", ".", "disconnect", "(", "self", ".", "qteAbort", ")" ]
Restore the original cursor position because the user hit abort.
[ "Restore", "the", "original", "cursor", "position", "because", "the", "user", "hit", "abort", "." ]
36253b082b82590f183fe154b053eb3a1e741be2
https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacsscintilla_macros.py#L1581-L1586
train
Disconnect from the abort signal.
olitheolix/qtmacs
qtmacs/extensions/qtmacsscintilla_macros.py
SearchForwardMiniApplet.qteToBeKilled
def qteToBeKilled(self): """ Remove all selections and install the original lexer. """ self.clearHighlighting() self.qteWidget.qteSetLexer(self.originalLexer) self.qteText.textChanged.disconnect(self.qteTextChanged)
python
def qteToBeKilled(self): """ Remove all selections and install the original lexer. """ self.clearHighlighting() self.qteWidget.qteSetLexer(self.originalLexer) self.qteText.textChanged.disconnect(self.qteTextChanged)
[ "def", "qteToBeKilled", "(", "self", ")", ":", "self", ".", "clearHighlighting", "(", ")", "self", ".", "qteWidget", ".", "qteSetLexer", "(", "self", ".", "originalLexer", ")", "self", ".", "qteText", ".", "textChanged", ".", "disconnect", "(", "self", "."...
Remove all selections and install the original lexer.
[ "Remove", "all", "selections", "and", "install", "the", "original", "lexer", "." ]
36253b082b82590f183fe154b053eb3a1e741be2
https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacsscintilla_macros.py#L1588-L1594
train
Mark the widget as killed.
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
This method is called by the next stage of the search - replace command.
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
Replace all matches after the current cursor position.
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
Compile the list of spans of every match.
olitheolix/qtmacs
qtmacs/extensions/qtmacsscintilla_macros.py
QueryReplaceMiniApplet.highlightAllMatches
def highlightAllMatches(self): """ Search for sub-string matches. This method is triggered by Qt whenever the text changes, ie. whenever the user has altered the input. Extract the new input, find all matches, and highlight them accordingly. """ # Remove any prev...
python
def highlightAllMatches(self): """ Search for sub-string matches. This method is triggered by Qt whenever the text changes, ie. whenever the user has altered the input. Extract the new input, find all matches, and highlight them accordingly. """ # Remove any prev...
[ "def", "highlightAllMatches", "(", "self", ")", ":", "# Remove any previous highlighting.", "self", ".", "qteWidget", ".", "SCISetStylingEx", "(", "0", ",", "0", ",", "self", ".", "styleOrig", ")", "SCI", "=", "self", ".", "qteWidget", "# Compile a list of spans t...
Search for sub-string matches. This method is triggered by Qt whenever the text changes, ie. whenever the user has altered the input. Extract the new input, find all matches, and highlight them accordingly.
[ "Search", "for", "sub", "-", "string", "matches", "." ]
36253b082b82590f183fe154b053eb3a1e741be2
https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacsscintilla_macros.py#L2058-L2111
train
Highlight all matches in the current document.
olitheolix/qtmacs
qtmacs/extensions/qtmacsscintilla_macros.py
QueryReplaceMiniApplet.qteAbort
def qteAbort(self, msgObj): """ Restore the original cursor position because the user hit abort. """ self.qteWidget.setCursorPosition(*self.cursorPosOrig) try: self.qteMain.qtesigAbort.disconnect(self.qteAbort) except TypeError: pass try: ...
python
def qteAbort(self, msgObj): """ Restore the original cursor position because the user hit abort. """ self.qteWidget.setCursorPosition(*self.cursorPosOrig) try: self.qteMain.qtesigAbort.disconnect(self.qteAbort) except TypeError: pass try: ...
[ "def", "qteAbort", "(", "self", ",", "msgObj", ")", ":", "self", ".", "qteWidget", ".", "setCursorPosition", "(", "*", "self", ".", "cursorPosOrig", ")", "try", ":", "self", ".", "qteMain", ".", "qtesigAbort", ".", "disconnect", "(", "self", ".", "qteAbo...
Restore the original cursor position because the user hit abort.
[ "Restore", "the", "original", "cursor", "position", "because", "the", "user", "hit", "abort", "." ]
36253b082b82590f183fe154b053eb3a1e741be2
https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacsscintilla_macros.py#L2113-L2126
train
Abort the current message.
olitheolix/qtmacs
qtmacs/extensions/qtmacsscintilla_macros.py
QueryReplaceMiniApplet.qteToBeKilled
def qteToBeKilled(self): """ Remove all selections and install the original lexer. """ self.qteWidget.SCISetStylingEx(0, 0, self.styleOrig) self.qteWidget.qteSetLexer(self.originalLexer)
python
def qteToBeKilled(self): """ Remove all selections and install the original lexer. """ self.qteWidget.SCISetStylingEx(0, 0, self.styleOrig) self.qteWidget.qteSetLexer(self.originalLexer)
[ "def", "qteToBeKilled", "(", "self", ")", ":", "self", ".", "qteWidget", ".", "SCISetStylingEx", "(", "0", ",", "0", ",", "self", ".", "styleOrig", ")", "self", ".", "qteWidget", ".", "qteSetLexer", "(", "self", ".", "originalLexer", ")" ]
Remove all selections and install the original lexer.
[ "Remove", "all", "selections", "and", "install", "the", "original", "lexer", "." ]
36253b082b82590f183fe154b053eb3a1e741be2
https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacsscintilla_macros.py#L2128-L2133
train
Mark the current lexer as killed.
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
Replace the currently selected string with the new one.
projectshift/shift-schema
shiftschema/filters/bleach.py
Bleach.filter
def filter(self, value, model=None, context=None): """ Filter Performs value filtering and returns filtered result. :param value: input value :param model: parent model being validated :param context: object, filtering context ...
python
def filter(self, value, model=None, context=None): """ Filter Performs value filtering and returns filtered result. :param value: input value :param model: parent model being validated :param context: object, filtering context ...
[ "def", "filter", "(", "self", ",", "value", ",", "model", "=", "None", ",", "context", "=", "None", ")", ":", "value", "=", "str", "(", "value", ")", "return", "bleach", ".", "clean", "(", "text", "=", "value", ",", "*", "*", "self", ".", "bleach...
Filter Performs value filtering and returns filtered result. :param value: input value :param model: parent model being validated :param context: object, filtering context :return: filtered value
[ "Filter", "Performs", "value", "filtering", "and", "returns", "filtered", "result", "." ]
07787b540d3369bb37217ffbfbe629118edaf0eb
https://github.com/projectshift/shift-schema/blob/07787b540d3369bb37217ffbfbe629118edaf0eb/shiftschema/filters/bleach.py#L86-L97
train
Filter the value and returns the result.
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
Run Kalibrate for a band and return a list of unique identifiers.
projectshift/shift-schema
shiftschema/filters/strip.py
Strip.filter
def filter(self, value, model=None, context=None): """ Filter Performs value filtering and returns filtered result. :param value: input value :param model: parent model being validated :param context: object, filtering context ...
python
def filter(self, value, model=None, context=None): """ Filter Performs value filtering and returns filtered result. :param value: input value :param model: parent model being validated :param context: object, filtering context ...
[ "def", "filter", "(", "self", ",", "value", ",", "model", "=", "None", ",", "context", "=", "None", ")", ":", "value", "=", "str", "(", "value", ")", "if", "self", ".", "mode", "==", "'left'", ":", "return", "value", ".", "lstrip", "(", "self", "...
Filter Performs value filtering and returns filtered result. :param value: input value :param model: parent model being validated :param context: object, filtering context :return: filtered value
[ "Filter", "Performs", "value", "filtering", "and", "returns", "filtered", "result", "." ]
07787b540d3369bb37217ffbfbe629118edaf0eb
https://github.com/projectshift/shift-schema/blob/07787b540d3369bb37217ffbfbe629118edaf0eb/shiftschema/filters/strip.py#L32-L48
train
Filter the value of the key.
erikdejonge/consoleprinter
consoleprinter/__init__.py
bar
def bar(it, label='', width=32, hide=None, empty_char=' ', filled_char=None, expected_size=None, every=1): """ Progress iterator. Wrap your iterables with it. @type it: iterator @type label: str @type width: int @type hide: str, None @type empty_char: float @type filled_char: float @...
python
def bar(it, label='', width=32, hide=None, empty_char=' ', filled_char=None, expected_size=None, every=1): """ Progress iterator. Wrap your iterables with it. @type it: iterator @type label: str @type width: int @type hide: str, None @type empty_char: float @type filled_char: float @...
[ "def", "bar", "(", "it", ",", "label", "=", "''", ",", "width", "=", "32", ",", "hide", "=", "None", ",", "empty_char", "=", "' '", ",", "filled_char", "=", "None", ",", "expected_size", "=", "None", ",", "every", "=", "1", ")", ":", "if", "fille...
Progress iterator. Wrap your iterables with it. @type it: iterator @type label: str @type width: int @type hide: str, None @type empty_char: float @type filled_char: float @type expected_size: int, None @type every: int @return: None
[ "Progress", "iterator", ".", "Wrap", "your", "iterables", "with", "it", "." ]
fa2d3de08a410fc32742f0b04c94b95aae408029
https://github.com/erikdejonge/consoleprinter/blob/fa2d3de08a410fc32742f0b04c94b95aae408029/consoleprinter/__init__.py#L627-L651
train
Wrap your iterables with Bar.
erikdejonge/consoleprinter
consoleprinter/__init__.py
coolname
def coolname(): """ coolname """ happy = False while not happy: names = """ Aldous Ara Ash Asia Azarias Balthazar Barnaby Bastien Beckett Berlin Birch Booker Bridge Bronwyn ...
python
def coolname(): """ coolname """ happy = False while not happy: names = """ Aldous Ara Ash Asia Azarias Balthazar Barnaby Bastien Beckett Berlin Birch Booker Bridge Bronwyn ...
[ "def", "coolname", "(", ")", ":", "happy", "=", "False", "while", "not", "happy", ":", "names", "=", "\"\"\"\n Aldous\n Ara\n Ash\n Asia\n Azarias\n Balthazar\n Barnaby\n Bastien\n Beckett\n Berlin\n Birch\n ...
coolname
[ "coolname" ]
fa2d3de08a410fc32742f0b04c94b95aae408029
https://github.com/erikdejonge/consoleprinter/blob/fa2d3de08a410fc32742f0b04c94b95aae408029/consoleprinter/__init__.py#L1587-L1842
train
get a full full
erikdejonge/consoleprinter
consoleprinter/__init__.py
stack_as_string
def stack_as_string(): """ stack_as_string """ if sys.version_info.major == 3: stack = io.StringIO() else: stack = io.BytesIO() traceback.print_stack(file=stack) stack.seek(0) stack = stack.read() return stack
python
def stack_as_string(): """ stack_as_string """ if sys.version_info.major == 3: stack = io.StringIO() else: stack = io.BytesIO() traceback.print_stack(file=stack) stack.seek(0) stack = stack.read() return stack
[ "def", "stack_as_string", "(", ")", ":", "if", "sys", ".", "version_info", ".", "major", "==", "3", ":", "stack", "=", "io", ".", "StringIO", "(", ")", "else", ":", "stack", "=", "io", ".", "BytesIO", "(", ")", "traceback", ".", "print_stack", "(", ...
stack_as_string
[ "stack_as_string" ]
fa2d3de08a410fc32742f0b04c94b95aae408029
https://github.com/erikdejonge/consoleprinter/blob/fa2d3de08a410fc32742f0b04c94b95aae408029/consoleprinter/__init__.py#L3302-L3314
train
Returns a string containing the current stack trace.
erikdejonge/consoleprinter
consoleprinter/__init__.py
Bar.done
def done(self): """ done """ self.elapsed = time.time() - self.start elapsed_disp = self.format_time(self.elapsed) stream = sys.stderr bar_template = '%s|%s%s| \033[32m%s/%s - %s\033[0m\r' self.last_progress = "%.1f" % float(self.last_progress) sel...
python
def done(self): """ done """ self.elapsed = time.time() - self.start elapsed_disp = self.format_time(self.elapsed) stream = sys.stderr bar_template = '%s|%s%s| \033[32m%s/%s - %s\033[0m\r' self.last_progress = "%.1f" % float(self.last_progress) sel...
[ "def", "done", "(", "self", ")", ":", "self", ".", "elapsed", "=", "time", ".", "time", "(", ")", "-", "self", ".", "start", "elapsed_disp", "=", "self", ".", "format_time", "(", "self", ".", "elapsed", ")", "stream", "=", "sys", ".", "stderr", "ba...
done
[ "done" ]
fa2d3de08a410fc32742f0b04c94b95aae408029
https://github.com/erikdejonge/consoleprinter/blob/fa2d3de08a410fc32742f0b04c94b95aae408029/consoleprinter/__init__.py#L277-L306
train
Print a complete logo of the current state of the object.
a1ezzz/wasp-general
wasp_general/network/web/proto.py
WWebRequestProto.virtual_host
def virtual_host(self): """ Return request virtual host ("Host" header value) :return: None or str """ if self.headers() is not None: host_value = self.headers()['Host'] return host_value[0].lower() if host_value is not None else None
python
def virtual_host(self): """ Return request virtual host ("Host" header value) :return: None or str """ if self.headers() is not None: host_value = self.headers()['Host'] return host_value[0].lower() if host_value is not None else None
[ "def", "virtual_host", "(", "self", ")", ":", "if", "self", ".", "headers", "(", ")", "is", "not", "None", ":", "host_value", "=", "self", ".", "headers", "(", ")", "[", "'Host'", "]", "return", "host_value", "[", "0", "]", ".", "lower", "(", ")", ...
Return request virtual host ("Host" header value) :return: None or str
[ "Return", "request", "virtual", "host", "(", "Host", "header", "value", ")" ]
1029839d33eb663f8dec76c1c46754d53c1de4a9
https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/network/web/proto.py#L122-L129
train
Return request virtual host header value
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
Parse request path and return GET - vars : return None or dictionary of names and tuples of values
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
Parse request payload and return POST - vars
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
Join a list of path items into a single path.
a1ezzz/wasp-general
wasp_general/network/clients/virtual_dir.py
WVirtualDirectoryClient.session_path
def session_path(self, path=None): """ Set and/or get current session path :param path: if defined, then set this value as a current session directory. If this value starts \ with a directory separator, then it is treated as an absolute path. In this case this value replaces a current one, otherwise this value...
python
def session_path(self, path=None): """ Set and/or get current session path :param path: if defined, then set this value as a current session directory. If this value starts \ with a directory separator, then it is treated as an absolute path. In this case this value replaces a current one, otherwise this value...
[ "def", "session_path", "(", "self", ",", "path", "=", "None", ")", ":", "if", "path", "is", "not", "None", ":", "if", "path", ".", "startswith", "(", "self", ".", "directory_sep", "(", ")", ")", "is", "True", ":", "self", ".", "__session_path", "=", ...
Set and/or get current session path :param path: if defined, then set this value as a current session directory. If this value starts \ with a directory separator, then it is treated as an absolute path. In this case this value replaces a current one, otherwise this value is appended to a current one. :return...
[ "Set", "and", "/", "or", "get", "current", "session", "path" ]
1029839d33eb663f8dec76c1c46754d53c1de4a9
https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/network/clients/virtual_dir.py#L89-L103
train
Set and or get current session path
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
Return a full path to a current session directory.
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
Run the model method
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
Postprocess and visualize the data for the current object.
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
Pushes the command object to the stack.
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
Push a new command object to the stack and run its commit method.
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
Undo the last command in the stack.
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
Place the cursor at the given position.
olitheolix/qtmacs
qtmacs/extensions/qtmacstextedit_widget.py
UndoGenericQtmacsTextEdit.commit
def commit(self): """ Put the document into the new state. """ if self.after is None: # If this is the first 'commit' call then do not make # any changes but store the current document state. self.after = self.qteWidget.toHtml() else: ...
python
def commit(self): """ Put the document into the new state. """ if self.after is None: # If this is the first 'commit' call then do not make # any changes but store the current document state. self.after = self.qteWidget.toHtml() else: ...
[ "def", "commit", "(", "self", ")", ":", "if", "self", ".", "after", "is", "None", ":", "# If this is the first 'commit' call then do not make", "# any changes but store the current document state.", "self", ".", "after", "=", "self", ".", "qteWidget", ".", "toHtml", "...
Put the document into the new state.
[ "Put", "the", "document", "into", "the", "new", "state", "." ]
36253b082b82590f183fe154b053eb3a1e741be2
https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacstextedit_widget.py#L111-L123
train
Commits the current document into the new state.
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
Reverse the document to the original state.
olitheolix/qtmacs
qtmacs/extensions/qtmacstextedit_widget.py
UndoSelfInsert.commit
def commit(self): """ Insert the text at the current cursor position. """ tc = self.qteWidget.textCursor() # If this is the first ever call to this undo/redo element then # backup the current cursor position and the selected text (may be # none). This informatio...
python
def commit(self): """ Insert the text at the current cursor position. """ tc = self.qteWidget.textCursor() # If this is the first ever call to this undo/redo element then # backup the current cursor position and the selected text (may be # none). This informatio...
[ "def", "commit", "(", "self", ")", ":", "tc", "=", "self", ".", "qteWidget", ".", "textCursor", "(", ")", "# If this is the first ever call to this undo/redo element then", "# backup the current cursor position and the selected text (may be", "# none). This information will be requ...
Insert the text at the current cursor position.
[ "Insert", "the", "text", "at", "the", "current", "cursor", "position", "." ]
36253b082b82590f183fe154b053eb3a1e741be2
https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacstextedit_widget.py#L152-L192
train
Commits the current state of the current entry.
olitheolix/qtmacs
qtmacs/extensions/qtmacstextedit_widget.py
UndoSelfInsert.reverseCommit
def reverseCommit(self): """ Remove the inserted character(s). """ tc = self.qteWidget.textCursor() # Select the area from before the insertion to after the insertion, # and remove it. tc.setPosition(self.cursorPos1, QtGui.QTextCursor.MoveAnchor) tc.setP...
python
def reverseCommit(self): """ Remove the inserted character(s). """ tc = self.qteWidget.textCursor() # Select the area from before the insertion to after the insertion, # and remove it. tc.setPosition(self.cursorPos1, QtGui.QTextCursor.MoveAnchor) tc.setP...
[ "def", "reverseCommit", "(", "self", ")", ":", "tc", "=", "self", ".", "qteWidget", ".", "textCursor", "(", ")", "# Select the area from before the insertion to after the insertion,", "# and remove it.", "tc", ".", "setPosition", "(", "self", ".", "cursorPos1", ",", ...
Remove the inserted character(s).
[ "Remove", "the", "inserted", "character", "(", "s", ")", "." ]
36253b082b82590f183fe154b053eb3a1e741be2
https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacstextedit_widget.py#L194-L211
train
Reverse the changes made to the current cursor position.
olitheolix/qtmacs
qtmacs/extensions/qtmacstextedit_widget.py
UndoPaste.commit
def commit(self): """ Insert the text at the current cursor position. """ # Backup and remove the currently selected text (may be none). tc = self.qteWidget.textCursor() self.selText = tc.selection().toHtml() self.selStart = tc.selectionStart() self.selEn...
python
def commit(self): """ Insert the text at the current cursor position. """ # Backup and remove the currently selected text (may be none). tc = self.qteWidget.textCursor() self.selText = tc.selection().toHtml() self.selStart = tc.selectionStart() self.selEn...
[ "def", "commit", "(", "self", ")", ":", "# Backup and remove the currently selected text (may be none).", "tc", "=", "self", ".", "qteWidget", ".", "textCursor", "(", ")", "self", ".", "selText", "=", "tc", ".", "selection", "(", ")", ".", "toHtml", "(", ")", ...
Insert the text at the current cursor position.
[ "Insert", "the", "text", "at", "the", "current", "cursor", "position", "." ]
36253b082b82590f183fe154b053eb3a1e741be2
https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacstextedit_widget.py#L242-L273
train
Commits the changes in the current text block and inserts the text at the current cursor position.
olitheolix/qtmacs
qtmacs/extensions/qtmacstextedit_widget.py
UndoPaste.reverseCommit
def reverseCommit(self): """ Remove the inserted character(s). """ # Move the cursor to the right of the text to delete. tc = self.qteWidget.textCursor() # Delete as many characters as necessary. For an image that would # be exactly 1 even though the HTML code t...
python
def reverseCommit(self): """ Remove the inserted character(s). """ # Move the cursor to the right of the text to delete. tc = self.qteWidget.textCursor() # Delete as many characters as necessary. For an image that would # be exactly 1 even though the HTML code t...
[ "def", "reverseCommit", "(", "self", ")", ":", "# Move the cursor to the right of the text to delete.", "tc", "=", "self", ".", "qteWidget", ".", "textCursor", "(", ")", "# Delete as many characters as necessary. For an image that would", "# be exactly 1 even though the HTML code t...
Remove the inserted character(s).
[ "Remove", "the", "inserted", "character", "(", "s", ")", "." ]
36253b082b82590f183fe154b053eb3a1e741be2
https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacstextedit_widget.py#L275-L298
train
Delete the inserted characters and insert the inserted text.
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
Insert a new entry into the list of undone items.
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
Insert the character at the current cursor position.
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
Get schemaVersion attribute from OpenMalaria scenario file xml - open file or content of xml document to be processed
projectshift/shift-schema
shiftschema/filters/lowercase.py
Lowercase.filter
def filter(self, value, model=None, context=None): """ Filter Performs value filtering and returns filtered result. :param value: input value :param model: parent model being validated :param context: object, filtering context ...
python
def filter(self, value, model=None, context=None): """ Filter Performs value filtering and returns filtered result. :param value: input value :param model: parent model being validated :param context: object, filtering context ...
[ "def", "filter", "(", "self", ",", "value", ",", "model", "=", "None", ",", "context", "=", "None", ")", ":", "value", "=", "str", "(", "value", ")", "return", "value", ".", "lower", "(", ")" ]
Filter Performs value filtering and returns filtered result. :param value: input value :param model: parent model being validated :param context: object, filtering context :return: filtered value
[ "Filter", "Performs", "value", "filtering", "and", "returns", "filtered", "result", "." ]
07787b540d3369bb37217ffbfbe629118edaf0eb
https://github.com/projectshift/shift-schema/blob/07787b540d3369bb37217ffbfbe629118edaf0eb/shiftschema/filters/lowercase.py#L11-L22
train
Filter the value of the key - value pair and returns the result.
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
Given a service name and a dict of data returns the formatted account for that service.
blockstack-packages/blockstack-profiles-py
blockstack_profiles/legacy_format.py
get_person_from_legacy_format
def get_person_from_legacy_format(profile_record): """ Given a whole profile, convert it into zone-file format. In the full profile JSON, this method operates on the 'data_record' object. @profile is a dict that contains the legacy profile data Return a dict with the zone-file formatting. ...
python
def get_person_from_legacy_format(profile_record): """ Given a whole profile, convert it into zone-file format. In the full profile JSON, this method operates on the 'data_record' object. @profile is a dict that contains the legacy profile data Return a dict with the zone-file formatting. ...
[ "def", "get_person_from_legacy_format", "(", "profile_record", ")", ":", "if", "not", "is_profile_in_legacy_format", "(", "profile_record", ")", ":", "raise", "ValueError", "(", "\"Not a legacy profile\"", ")", "profile", "=", "profile_record", "try", ":", "profile", ...
Given a whole profile, convert it into zone-file format. In the full profile JSON, this method operates on the 'data_record' object. @profile is a dict that contains the legacy profile data Return a dict with the zone-file formatting.
[ "Given", "a", "whole", "profile", "convert", "it", "into", "zone", "-", "file", "format", ".", "In", "the", "full", "profile", "JSON", "this", "method", "operates", "on", "the", "data_record", "object", "." ]
103783798df78cf0f007801e79ec6298f00b2817
https://github.com/blockstack-packages/blockstack-profiles-py/blob/103783798df78cf0f007801e79ec6298f00b2817/blockstack_profiles/legacy_format.py#L94-L198
train
Convert a full profile into a list of persons.
a1ezzz/wasp-general
wasp_general/types/binarray.py
WBinArray.resize
def resize(self, size): """ Resize current array. If size is None, then array became nonfixed-length array. If new size is less then current size and value, then value will be truncated (lesser significant bits will be truncated). :param size: :return: """ if size is not None: self.__value = int(WBinA...
python
def resize(self, size): """ Resize current array. If size is None, then array became nonfixed-length array. If new size is less then current size and value, then value will be truncated (lesser significant bits will be truncated). :param size: :return: """ if size is not None: self.__value = int(WBinA...
[ "def", "resize", "(", "self", ",", "size", ")", ":", "if", "size", "is", "not", "None", ":", "self", ".", "__value", "=", "int", "(", "WBinArray", "(", "self", ".", "__value", ")", "[", ":", "size", "]", ")", "self", ".", "__size", "=", "size" ]
Resize current array. If size is None, then array became nonfixed-length array. If new size is less then current size and value, then value will be truncated (lesser significant bits will be truncated). :param size: :return:
[ "Resize", "current", "array", ".", "If", "size", "is", "None", "then", "array", "became", "nonfixed", "-", "length", "array", ".", "If", "new", "size", "is", "less", "then", "current", "size", "and", "value", "then", "value", "will", "be", "truncated", "...
1029839d33eb663f8dec76c1c46754d53c1de4a9
https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/types/binarray.py#L164-L174
train
Resize current array.
a1ezzz/wasp-general
wasp_general/types/binarray.py
WBinArray.split
def split(self, bits_count): """ Split array into smaller parts. Each small array is fixed-length WBinArray (length of that array is bits_count). :param bits_count: array length :return: list of WBinArray """ result = [] array = WBinArray(self.__value, self.__size) if (len(array) % bits_count) > 0: ...
python
def split(self, bits_count): """ Split array into smaller parts. Each small array is fixed-length WBinArray (length of that array is bits_count). :param bits_count: array length :return: list of WBinArray """ result = [] array = WBinArray(self.__value, self.__size) if (len(array) % bits_count) > 0: ...
[ "def", "split", "(", "self", ",", "bits_count", ")", ":", "result", "=", "[", "]", "array", "=", "WBinArray", "(", "self", ".", "__value", ",", "self", ".", "__size", ")", "if", "(", "len", "(", "array", ")", "%", "bits_count", ")", ">", "0", ":"...
Split array into smaller parts. Each small array is fixed-length WBinArray (length of that array is bits_count). :param bits_count: array length :return: list of WBinArray
[ "Split", "array", "into", "smaller", "parts", ".", "Each", "small", "array", "is", "fixed", "-", "length", "WBinArray", "(", "length", "of", "that", "array", "is", "bits_count", ")", "." ]
1029839d33eb663f8dec76c1c46754d53c1de4a9
https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/types/binarray.py#L178-L194
train
Split array into smaller parts. Each small array is fixed - length WBinArray.
a1ezzz/wasp-general
wasp_general/types/binarray.py
WBinArray.concat
def concat(self, array): """ Return new fixed-length array, that is made by creating new array with length of sum of two arrays (this array and the given one). In newly created array the most significant bit of the given array will have an index lesser then an index of the least significant bit of this array. ...
python
def concat(self, array): """ Return new fixed-length array, that is made by creating new array with length of sum of two arrays (this array and the given one). In newly created array the most significant bit of the given array will have an index lesser then an index of the least significant bit of this array. ...
[ "def", "concat", "(", "self", ",", "array", ")", ":", "if", "isinstance", "(", "array", ",", "WBinArray", ")", "is", "False", ":", "raise", "TypeError", "(", "'Invalid array type'", ")", "value", "=", "(", "(", "int", "(", "self", ")", "<<", "len", "...
Return new fixed-length array, that is made by creating new array with length of sum of two arrays (this array and the given one). In newly created array the most significant bit of the given array will have an index lesser then an index of the least significant bit of this array. :param array: array to concaten...
[ "Return", "new", "fixed", "-", "length", "array", "that", "is", "made", "by", "creating", "new", "array", "with", "length", "of", "sum", "of", "two", "arrays", "(", "this", "array", "and", "the", "given", "one", ")", ".", "In", "newly", "created", "arr...
1029839d33eb663f8dec76c1c46754d53c1de4a9
https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/types/binarray.py#L196-L207
train
Return new fixed - length array that is made by creating new array with length of sum of two arrays
a1ezzz/wasp-general
wasp_general/types/binarray.py
WBinArray.rconcat
def rconcat(self, array): """ 'Reverse' concatenation. Works the same as :meth:`.WBinArray.concat`, but in newly created array the most significant bit of the given array will have an index greater then an index of the least significant bit of this array :param array: array to concatenate with :return: WBinA...
python
def rconcat(self, array): """ 'Reverse' concatenation. Works the same as :meth:`.WBinArray.concat`, but in newly created array the most significant bit of the given array will have an index greater then an index of the least significant bit of this array :param array: array to concatenate with :return: WBinA...
[ "def", "rconcat", "(", "self", ",", "array", ")", ":", "if", "isinstance", "(", "array", ",", "WBinArray", ")", "is", "False", ":", "raise", "TypeError", "(", "'Invalid array type'", ")", "return", "array", ".", "concat", "(", "self", ")" ]
'Reverse' concatenation. Works the same as :meth:`.WBinArray.concat`, but in newly created array the most significant bit of the given array will have an index greater then an index of the least significant bit of this array :param array: array to concatenate with :return: WBinArray
[ "Reverse", "concatenation", ".", "Works", "the", "same", "as", ":", "meth", ":", ".", "WBinArray", ".", "concat", "but", "in", "newly", "created", "array", "the", "most", "significant", "bit", "of", "the", "given", "array", "will", "have", "an", "index", ...
1029839d33eb663f8dec76c1c46754d53c1de4a9
https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/types/binarray.py#L209-L219
train
Reverse concatenation.
a1ezzz/wasp-general
wasp_general/types/binarray.py
WBinArray.extend
def extend(self, *array_list): """ Concatenate this array with the given arrays. This method doesn't modify current array. Instead, it creates new one, that have all of arrays. (see :meth:`.WBinArray.concat` method) :param array_list: list of WBinArray :return: newly created WBinArray """ result = WBinArra...
python
def extend(self, *array_list): """ Concatenate this array with the given arrays. This method doesn't modify current array. Instead, it creates new one, that have all of arrays. (see :meth:`.WBinArray.concat` method) :param array_list: list of WBinArray :return: newly created WBinArray """ result = WBinArra...
[ "def", "extend", "(", "self", ",", "*", "array_list", ")", ":", "result", "=", "WBinArray", "(", "int", "(", "self", ")", ",", "len", "(", "self", ")", ")", "for", "array", "in", "array_list", ":", "result", "=", "result", ".", "concat", "(", "arra...
Concatenate this array with the given arrays. This method doesn't modify current array. Instead, it creates new one, that have all of arrays. (see :meth:`.WBinArray.concat` method) :param array_list: list of WBinArray :return: newly created WBinArray
[ "Concatenate", "this", "array", "with", "the", "given", "arrays", ".", "This", "method", "doesn", "t", "modify", "current", "array", ".", "Instead", "it", "creates", "new", "one", "that", "have", "all", "of", "arrays", ".", "(", "see", ":", "meth", ":", ...
1029839d33eb663f8dec76c1c46754d53c1de4a9
https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/types/binarray.py#L221-L231
train
Concatenate this array with the given arrays.
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
Mirror current array value in reverse.
a1ezzz/wasp-general
wasp_general/types/binarray.py
WBinArray.join
def join(*args): """ Concatenate all of the given arrays. (see :meth:`.WBinArray.concat` method) :param args: list of WBinArray :return: WBinArray """ if len(args) == 0: return result = WBinArray(int(args[0]), len(args[0])) if len(args) == 1: return result else: result = result.extend(*(args[...
python
def join(*args): """ Concatenate all of the given arrays. (see :meth:`.WBinArray.concat` method) :param args: list of WBinArray :return: WBinArray """ if len(args) == 0: return result = WBinArray(int(args[0]), len(args[0])) if len(args) == 1: return result else: result = result.extend(*(args[...
[ "def", "join", "(", "*", "args", ")", ":", "if", "len", "(", "args", ")", "==", "0", ":", "return", "result", "=", "WBinArray", "(", "int", "(", "args", "[", "0", "]", ")", ",", "len", "(", "args", "[", "0", "]", ")", ")", "if", "len", "(",...
Concatenate all of the given arrays. (see :meth:`.WBinArray.concat` method) :param args: list of WBinArray :return: WBinArray
[ "Concatenate", "all", "of", "the", "given", "arrays", ".", "(", "see", ":", "meth", ":", ".", "WBinArray", ".", "concat", "method", ")" ]
1029839d33eb663f8dec76c1c46754d53c1de4a9
https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/types/binarray.py#L245-L259
train
Concatenate all of the given arrays.
weijia/djangoautoconf
djangoautoconf/auto_conf_admin_tools/admin_register.py
AdminRegister.register_all_models
def register_all_models(self, module_instance, exclude_name_list=[]): """ :param module_instance: the module instance that containing models.Model inherited classes, mostly the models module :param exclude_name_list: class does not need to register or is already registered ...
python
def register_all_models(self, module_instance, exclude_name_list=[]): """ :param module_instance: the module instance that containing models.Model inherited classes, mostly the models module :param exclude_name_list: class does not need to register or is already registered ...
[ "def", "register_all_models", "(", "self", ",", "module_instance", ",", "exclude_name_list", "=", "[", "]", ")", ":", "for", "class_instance", "in", "class_enumerator", "(", "module_instance", ",", "exclude_name_list", ")", ":", "if", "is_inherit_from_model", "(", ...
:param module_instance: the module instance that containing models.Model inherited classes, mostly the models module :param exclude_name_list: class does not need to register or is already registered :return: N/A
[ ":", "param", "module_instance", ":", "the", "module", "instance", "that", "containing", "models", ".", "Model", "inherited", "classes", "mostly", "the", "models", "module", ":", "param", "exclude_name_list", ":", "class", "does", "not", "need", "to", "register"...
b7dbda2287ed8cb9de6d02cb3abaaa1c36b1ced0
https://github.com/weijia/djangoautoconf/blob/b7dbda2287ed8cb9de6d02cb3abaaa1c36b1ced0/djangoautoconf/auto_conf_admin_tools/admin_register.py#L143-L152
train
Register all the classes in the specified module instance.
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
Creates an etcd client.
OpenGov/og-python-utils
ogutils/functions/operators.py
restrict_args
def restrict_args(func, *args, **kwargs): ''' Restricts the possible arguements to a method to match the func argument. restrict_args(lambda a: a, 1, 2) # => 1 ''' callargs = getargspec(func) if not callargs.varargs: args = args[0:len(callargs.args)] return func(*args,...
python
def restrict_args(func, *args, **kwargs): ''' Restricts the possible arguements to a method to match the func argument. restrict_args(lambda a: a, 1, 2) # => 1 ''' callargs = getargspec(func) if not callargs.varargs: args = args[0:len(callargs.args)] return func(*args,...
[ "def", "restrict_args", "(", "func", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "callargs", "=", "getargspec", "(", "func", ")", "if", "not", "callargs", ".", "varargs", ":", "args", "=", "args", "[", "0", ":", "len", "(", "callargs", "."...
Restricts the possible arguements to a method to match the func argument. restrict_args(lambda a: a, 1, 2) # => 1
[ "Restricts", "the", "possible", "arguements", "to", "a", "method", "to", "match", "the", "func", "argument", ".", "restrict_args", "(", "lambda", "a", ":", "a", "1", "2", ")", "#", "=", ">", "1" ]
00f44927383dd1bd6348f47302c4453d56963479
https://github.com/OpenGov/og-python-utils/blob/00f44927383dd1bd6348f47302c4453d56963479/ogutils/functions/operators.py#L3-L13
train
Restricts the possible arguements to a method to match the func argument.
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
Calls the given callable repeatedly until the number of retries times is reached.
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
Decorator to check that the type of the arguments passed in are of the correct type.
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
Set up handler and start loop self.
a1ezzz/wasp-general
wasp_general/network/service.py
WNativeSocketHandler.setup_handler
def setup_handler(self, io_loop): """ :meth:`.WIOLoopServiceHandler.setup_handler` implementation. If :class:`.WNativeSocketDirectIOHandler` is used as a io-handler, then socket object is saved to this handler before loop starting :param io_loop: io_loop to use :return: None """ if self.server_mode() is...
python
def setup_handler(self, io_loop): """ :meth:`.WIOLoopServiceHandler.setup_handler` implementation. If :class:`.WNativeSocketDirectIOHandler` is used as a io-handler, then socket object is saved to this handler before loop starting :param io_loop: io_loop to use :return: None """ if self.server_mode() is...
[ "def", "setup_handler", "(", "self", ",", "io_loop", ")", ":", "if", "self", ".", "server_mode", "(", ")", "is", "True", ":", "s", "=", "self", ".", "transport", "(", ")", ".", "server_socket", "(", "self", ".", "config", "(", ")", ")", "else", ":"...
:meth:`.WIOLoopServiceHandler.setup_handler` implementation. If :class:`.WNativeSocketDirectIOHandler` is used as a io-handler, then socket object is saved to this handler before loop starting :param io_loop: io_loop to use :return: None
[ ":", "meth", ":", ".", "WIOLoopServiceHandler", ".", "setup_handler", "implementation", ".", "If", ":", "class", ":", ".", "WNativeSocketDirectIOHandler", "is", "used", "as", "a", "io", "-", "handler", "then", "socket", "object", "is", "saved", "to", "this", ...
1029839d33eb663f8dec76c1c46754d53c1de4a9
https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/network/service.py#L229-L246
train
method to setup the handler for this service
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
Terminate socket connection because of stopping loop
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
This method discards undelivered messages from the queue.
olitheolix/qtmacs
qtmacs/qtmacsmain.py
DeliverQtKeyEvent.qteRun
def qteRun(self): """ Extract the last ``QKeyEvent`` from the keyboard sequence (there should only be one anyway, but just to be sure) and deliver it to the native ``keyPressEvent`` method of the widget. The actual call is wrapped in a try-except construct because the ``k...
python
def qteRun(self): """ Extract the last ``QKeyEvent`` from the keyboard sequence (there should only be one anyway, but just to be sure) and deliver it to the native ``keyPressEvent`` method of the widget. The actual call is wrapped in a try-except construct because the ``k...
[ "def", "qteRun", "(", "self", ")", ":", "# Ignore the request if the widget has no keyPressEvent method.", "if", "not", "hasattr", "(", "self", ".", "qteWidget", ",", "'keyPressEvent'", ")", ":", "return", "# Extract the last key and send it to the widget.", "keyEvent", "="...
Extract the last ``QKeyEvent`` from the keyboard sequence (there should only be one anyway, but just to be sure) and deliver it to the native ``keyPressEvent`` method of the widget. The actual call is wrapped in a try-except construct because the ``keyPressEvent`` are protected methods i...
[ "Extract", "the", "last", "QKeyEvent", "from", "the", "keyboard", "sequence", "(", "there", "should", "only", "be", "one", "anyway", "but", "just", "to", "be", "sure", ")", "and", "deliver", "it", "to", "the", "native", "keyPressEvent", "method", "of", "th...
36253b082b82590f183fe154b053eb3a1e741be2
https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L119-L145
train
Return the current keyboard sequence and store it in the internal cache.
olitheolix/qtmacs
qtmacs/qtmacsmain.py
QtmacsEventFilter.eventFilter
def eventFilter(self, targetObj, event_qt): """ Intercept keyboard events and pass them on to the key parser and/or applet and/or widget. The handler only intercepts keyboard events and lets Qt handle the remaining ones (eg. mouse clicks) as usual. |Args| * ``t...
python
def eventFilter(self, targetObj, event_qt): """ Intercept keyboard events and pass them on to the key parser and/or applet and/or widget. The handler only intercepts keyboard events and lets Qt handle the remaining ones (eg. mouse clicks) as usual. |Args| * ``t...
[ "def", "eventFilter", "(", "self", ",", "targetObj", ",", "event_qt", ")", ":", "# Return immediately if Qtmacs is not interested in it.", "if", "event_qt", ".", "type", "(", ")", "not", "in", "self", ".", "qteEventList", ":", "return", "False", "# Determine if the ...
Intercept keyboard events and pass them on to the key parser and/or applet and/or widget. The handler only intercepts keyboard events and lets Qt handle the remaining ones (eg. mouse clicks) as usual. |Args| * ``targetObj`` (**QObject**): the source of the event (see Qt ...
[ "Intercept", "keyboard", "events", "and", "pass", "them", "on", "to", "the", "key", "parser", "and", "/", "or", "applet", "and", "/", "or", "widget", "." ]
36253b082b82590f183fe154b053eb3a1e741be2
https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L233-L343
train
Filter out keyboard events and return the internal key - value entry for the event.
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
Process a key press event.
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
Adjust the widget sizes inside the splitter according to handlePos.
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
Add a widget to the splitter and make it visible.
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
Insert a widget into the splitter at the specified index.
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
Trigger the focus manager and work off all queued macros and the key emulation queue.
olitheolix/qtmacs
qtmacs/qtmacsmain.py
QtmacsMain._qteFocusManager
def _qteFocusManager(self): """ Give the focus to the correct applet and widget. This method is the only method in all of Qtmacs that actually instructs the Qt library to focus a widget. It does so by first synchronising what Qtmacs thinks is visible and what Qt knows is...
python
def _qteFocusManager(self): """ Give the focus to the correct applet and widget. This method is the only method in all of Qtmacs that actually instructs the Qt library to focus a widget. It does so by first synchronising what Qtmacs thinks is visible and what Qt knows is...
[ "def", "_qteFocusManager", "(", "self", ")", ":", "# Process all but user input events.", "flag", "=", "QtCore", ".", "QEventLoop", ".", "ExcludeUserInputEvents", "qApp", "=", "QtGui", ".", "QApplication", ".", "instance", "(", ")", "qApp", ".", "processEvents", "...
Give the focus to the correct applet and widget. This method is the only method in all of Qtmacs that actually instructs the Qt library to focus a widget. It does so by first synchronising what Qtmacs thinks is visible and what Qt knows is visible, and then make the applet/widget active...
[ "Give", "the", "focus", "to", "the", "correct", "applet", "and", "widget", "." ]
36253b082b82590f183fe154b053eb3a1e741be2
https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain.py#L1080-L1284
train
This method is used to set the focus to the correct applet and widget. It is called by Qtmacs that actually knows the applet and widget and then the focus manager will update the internal status variables of the applet and widget.
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
Update the internal focus state as the result of a mouse click.
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
Update the entry - point for the focus - changed signal.
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
Return True if the object is a mini applet.
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
Create a new empty window with the specified position and window ID.
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
Make the window active and focus the first applet therein.