id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
52,000
senaite/senaite.jsonapi
src/senaite/jsonapi/api.py
find_objects
def find_objects(uid=None): """Find the object by its UID 1. get the object from the given uid 2. fetch objects specified in the request parameters 3. fetch objects located in the request body :param uid: The UID of the object to find :type uid: string :returns: List of found objects :...
python
def find_objects(uid=None): """Find the object by its UID 1. get the object from the given uid 2. fetch objects specified in the request parameters 3. fetch objects located in the request body :param uid: The UID of the object to find :type uid: string :returns: List of found objects :...
[ "def", "find_objects", "(", "uid", "=", "None", ")", ":", "# The objects to cut", "objects", "=", "[", "]", "# get the object by the given uid or try to find it by the request", "# parameters", "obj", "=", "get_object_by_uid", "(", "uid", ")", "or", "get_object_by_request...
Find the object by its UID 1. get the object from the given uid 2. fetch objects specified in the request parameters 3. fetch objects located in the request body :param uid: The UID of the object to find :type uid: string :returns: List of found objects :rtype: list
[ "Find", "the", "object", "by", "its", "UID" ]
871959f4b1c9edbb477e9456325527ca78e13ec6
https://github.com/senaite/senaite.jsonapi/blob/871959f4b1c9edbb477e9456325527ca78e13ec6/src/senaite/jsonapi/api.py#L1257-L1290
52,001
senaite/senaite.jsonapi
src/senaite/jsonapi/api.py
find_target_container
def find_target_container(portal_type, record): """Locates a target container for the given portal_type and record :param record: The dictionary representation of a content object :type record: dict :returns: folder which contains the object :rtype: object """ portal_type = portal_type or r...
python
def find_target_container(portal_type, record): """Locates a target container for the given portal_type and record :param record: The dictionary representation of a content object :type record: dict :returns: folder which contains the object :rtype: object """ portal_type = portal_type or r...
[ "def", "find_target_container", "(", "portal_type", ",", "record", ")", ":", "portal_type", "=", "portal_type", "or", "record", ".", "get", "(", "\"portal_type\"", ")", "container", "=", "get_container_for", "(", "portal_type", ")", "if", "container", ":", "retu...
Locates a target container for the given portal_type and record :param record: The dictionary representation of a content object :type record: dict :returns: folder which contains the object :rtype: object
[ "Locates", "a", "target", "container", "for", "the", "given", "portal_type", "and", "record" ]
871959f4b1c9edbb477e9456325527ca78e13ec6
https://github.com/senaite/senaite.jsonapi/blob/871959f4b1c9edbb477e9456325527ca78e13ec6/src/senaite/jsonapi/api.py#L1293-L1322
52,002
senaite/senaite.jsonapi
src/senaite/jsonapi/api.py
create_object
def create_object(container, portal_type, **data): """Creates an object slug :returns: The new created content object :rtype: object """ if "id" in data: # always omit the id as senaite LIMS generates a proper one id = data.pop("id") logger.warn("Passed in ID '{}' omitted! ...
python
def create_object(container, portal_type, **data): """Creates an object slug :returns: The new created content object :rtype: object """ if "id" in data: # always omit the id as senaite LIMS generates a proper one id = data.pop("id") logger.warn("Passed in ID '{}' omitted! ...
[ "def", "create_object", "(", "container", ",", "portal_type", ",", "*", "*", "data", ")", ":", "if", "\"id\"", "in", "data", ":", "# always omit the id as senaite LIMS generates a proper one", "id", "=", "data", ".", "pop", "(", "\"id\"", ")", "logger", ".", "...
Creates an object slug :returns: The new created content object :rtype: object
[ "Creates", "an", "object", "slug" ]
871959f4b1c9edbb477e9456325527ca78e13ec6
https://github.com/senaite/senaite.jsonapi/blob/871959f4b1c9edbb477e9456325527ca78e13ec6/src/senaite/jsonapi/api.py#L1325-L1365
52,003
senaite/senaite.jsonapi
src/senaite/jsonapi/api.py
create_analysisrequest
def create_analysisrequest(container, **data): """Create a minimun viable AnalysisRequest :param container: A single folderish catalog brain or content object :type container: ATContentType/DexterityContentType/CatalogBrain """ container = get_object(container) request = req.get_request() #...
python
def create_analysisrequest(container, **data): """Create a minimun viable AnalysisRequest :param container: A single folderish catalog brain or content object :type container: ATContentType/DexterityContentType/CatalogBrain """ container = get_object(container) request = req.get_request() #...
[ "def", "create_analysisrequest", "(", "container", ",", "*", "*", "data", ")", ":", "container", "=", "get_object", "(", "container", ")", "request", "=", "req", ".", "get_request", "(", ")", "# we need to resolve the SampleType to a full object", "sample_type", "="...
Create a minimun viable AnalysisRequest :param container: A single folderish catalog brain or content object :type container: ATContentType/DexterityContentType/CatalogBrain
[ "Create", "a", "minimun", "viable", "AnalysisRequest" ]
871959f4b1c9edbb477e9456325527ca78e13ec6
https://github.com/senaite/senaite.jsonapi/blob/871959f4b1c9edbb477e9456325527ca78e13ec6/src/senaite/jsonapi/api.py#L1368-L1390
52,004
senaite/senaite.jsonapi
src/senaite/jsonapi/api.py
update_object_with_data
def update_object_with_data(content, record): """Update the content with the record data :param content: A single folderish catalog brain or content object :type content: ATContentType/DexterityContentType/CatalogBrain :param record: The data to update :type record: dict :returns: The updated c...
python
def update_object_with_data(content, record): """Update the content with the record data :param content: A single folderish catalog brain or content object :type content: ATContentType/DexterityContentType/CatalogBrain :param record: The data to update :type record: dict :returns: The updated c...
[ "def", "update_object_with_data", "(", "content", ",", "record", ")", ":", "# ensure we have a full content object", "content", "=", "get_object", "(", "content", ")", "# get the proper data manager", "dm", "=", "IDataManager", "(", "content", ")", "if", "dm", "is", ...
Update the content with the record data :param content: A single folderish catalog brain or content object :type content: ATContentType/DexterityContentType/CatalogBrain :param record: The data to update :type record: dict :returns: The updated content object :rtype: object :raises: ...
[ "Update", "the", "content", "with", "the", "record", "data" ]
871959f4b1c9edbb477e9456325527ca78e13ec6
https://github.com/senaite/senaite.jsonapi/blob/871959f4b1c9edbb477e9456325527ca78e13ec6/src/senaite/jsonapi/api.py#L1393-L1444
52,005
senaite/senaite.jsonapi
src/senaite/jsonapi/api.py
validate_object
def validate_object(brain_or_object, data): """Validate the entire object :param brain_or_object: A single catalog brain or content object :type brain_or_object: ATContentType/DexterityContentType/CatalogBrain :param data: The sharing dictionary as returned from the API :type data: dict :return...
python
def validate_object(brain_or_object, data): """Validate the entire object :param brain_or_object: A single catalog brain or content object :type brain_or_object: ATContentType/DexterityContentType/CatalogBrain :param data: The sharing dictionary as returned from the API :type data: dict :return...
[ "def", "validate_object", "(", "brain_or_object", ",", "data", ")", ":", "obj", "=", "get_object", "(", "brain_or_object", ")", "# Call the validator of AT Content Types", "if", "is_at_content", "(", "obj", ")", ":", "return", "obj", ".", "validate", "(", "data", ...
Validate the entire object :param brain_or_object: A single catalog brain or content object :type brain_or_object: ATContentType/DexterityContentType/CatalogBrain :param data: The sharing dictionary as returned from the API :type data: dict :returns: invalidity status :rtype: dict
[ "Validate", "the", "entire", "object" ]
871959f4b1c9edbb477e9456325527ca78e13ec6
https://github.com/senaite/senaite.jsonapi/blob/871959f4b1c9edbb477e9456325527ca78e13ec6/src/senaite/jsonapi/api.py#L1447-L1463
52,006
senaite/senaite.jsonapi
src/senaite/jsonapi/api.py
deactivate_object
def deactivate_object(brain_or_object): """Deactivate the given object :param brain_or_object: A single catalog brain or content object :type brain_or_object: ATContentType/DexterityContentType/CatalogBrain :returns: Nothing :rtype: None """ obj = get_object(brain_or_object) # we do not...
python
def deactivate_object(brain_or_object): """Deactivate the given object :param brain_or_object: A single catalog brain or content object :type brain_or_object: ATContentType/DexterityContentType/CatalogBrain :returns: Nothing :rtype: None """ obj = get_object(brain_or_object) # we do not...
[ "def", "deactivate_object", "(", "brain_or_object", ")", ":", "obj", "=", "get_object", "(", "brain_or_object", ")", "# we do not want to delete the site root!", "if", "is_root", "(", "obj", ")", ":", "fail", "(", "401", ",", "\"Deactivating the Portal is not allowed\""...
Deactivate the given object :param brain_or_object: A single catalog brain or content object :type brain_or_object: ATContentType/DexterityContentType/CatalogBrain :returns: Nothing :rtype: None
[ "Deactivate", "the", "given", "object" ]
871959f4b1c9edbb477e9456325527ca78e13ec6
https://github.com/senaite/senaite.jsonapi/blob/871959f4b1c9edbb477e9456325527ca78e13ec6/src/senaite/jsonapi/api.py#L1466-L1481
52,007
senaite/senaite.jsonapi
src/senaite/jsonapi/api.py
get_settings_by_keyword
def get_settings_by_keyword(keyword=None): """Get the settings associated to the specified keyword or, if keyword is None, get all the settings. :param keyword: settings to be retrieved :return: dictionary with the settings plus a key to identify from which keyword where retrieved. """ set...
python
def get_settings_by_keyword(keyword=None): """Get the settings associated to the specified keyword or, if keyword is None, get all the settings. :param keyword: settings to be retrieved :return: dictionary with the settings plus a key to identify from which keyword where retrieved. """ set...
[ "def", "get_settings_by_keyword", "(", "keyword", "=", "None", ")", ":", "settings", "=", "[", "]", "if", "keyword", "is", "None", ":", "# iterate over all the schemas to return all settings", "for", "key", ",", "ischemas", "in", "CONTROLPANEL_INTERFACE_MAPPING", ".",...
Get the settings associated to the specified keyword or, if keyword is None, get all the settings. :param keyword: settings to be retrieved :return: dictionary with the settings plus a key to identify from which keyword where retrieved.
[ "Get", "the", "settings", "associated", "to", "the", "specified", "keyword", "or", "if", "keyword", "is", "None", "get", "all", "the", "settings", "." ]
871959f4b1c9edbb477e9456325527ca78e13ec6
https://github.com/senaite/senaite.jsonapi/blob/871959f4b1c9edbb477e9456325527ca78e13ec6/src/senaite/jsonapi/api.py#L1514-L1536
52,008
senaite/senaite.jsonapi
src/senaite/jsonapi/api.py
get_settings_from_interface
def get_settings_from_interface(iface): """Get the configuration settings associated to a list of schema interfaces :param iface: The schema interface from which we want to get its fields :return: Dictionary with iface name as key and as value a dictionary with the setting names (keys) linked t...
python
def get_settings_from_interface(iface): """Get the configuration settings associated to a list of schema interfaces :param iface: The schema interface from which we want to get its fields :return: Dictionary with iface name as key and as value a dictionary with the setting names (keys) linked t...
[ "def", "get_settings_from_interface", "(", "iface", ")", ":", "settings", "=", "{", "}", "schema_id", "=", "iface", ".", "getName", "(", ")", "settings", "[", "schema_id", "]", "=", "{", "}", "schema", "=", "getAdapter", "(", "api", ".", "get_portal", "(...
Get the configuration settings associated to a list of schema interfaces :param iface: The schema interface from which we want to get its fields :return: Dictionary with iface name as key and as value a dictionary with the setting names (keys) linked to that schema and its values.
[ "Get", "the", "configuration", "settings", "associated", "to", "a", "list", "of", "schema", "interfaces" ]
871959f4b1c9edbb477e9456325527ca78e13ec6
https://github.com/senaite/senaite.jsonapi/blob/871959f4b1c9edbb477e9456325527ca78e13ec6/src/senaite/jsonapi/api.py#L1539-L1557
52,009
idmillington/layout
layout/managers/grid.py
SimpleGridLM.calculate_columns
def calculate_columns(self): """Assuming the number of rows is constant, work out the best number of columns to use.""" self.cols = int(math.ceil(len(self.elements) / float(self.rows)))
python
def calculate_columns(self): """Assuming the number of rows is constant, work out the best number of columns to use.""" self.cols = int(math.ceil(len(self.elements) / float(self.rows)))
[ "def", "calculate_columns", "(", "self", ")", ":", "self", ".", "cols", "=", "int", "(", "math", ".", "ceil", "(", "len", "(", "self", ".", "elements", ")", "/", "float", "(", "self", ".", "rows", ")", ")", ")" ]
Assuming the number of rows is constant, work out the best number of columns to use.
[ "Assuming", "the", "number", "of", "rows", "is", "constant", "work", "out", "the", "best", "number", "of", "columns", "to", "use", "." ]
c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5
https://github.com/idmillington/layout/blob/c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5/layout/managers/grid.py#L16-L20
52,010
idmillington/layout
layout/managers/grid.py
GridLM.add_rule
def add_rule(self, start_col, start_row, end_col, end_row, width=0.5, color=(0,0,0)): """Adds a rule to the grid. The row and column numbers are those on the top left of the corresponding cell in the grid. So if the grid is 10x10, then the right hand edge of the grid wil...
python
def add_rule(self, start_col, start_row, end_col, end_row, width=0.5, color=(0,0,0)): """Adds a rule to the grid. The row and column numbers are those on the top left of the corresponding cell in the grid. So if the grid is 10x10, then the right hand edge of the grid wil...
[ "def", "add_rule", "(", "self", ",", "start_col", ",", "start_row", ",", "end_col", ",", "end_row", ",", "width", "=", "0.5", ",", "color", "=", "(", "0", ",", "0", ",", "0", ")", ")", ":", "self", ".", "rules", ".", "append", "(", "(", "start_co...
Adds a rule to the grid. The row and column numbers are those on the top left of the corresponding cell in the grid. So if the grid is 10x10, then the right hand edge of the grid will be column 10, and the bottom will be column 10. In other words there is one more rule-row and column tha...
[ "Adds", "a", "rule", "to", "the", "grid", ".", "The", "row", "and", "column", "numbers", "are", "those", "on", "the", "top", "left", "of", "the", "corresponding", "cell", "in", "the", "grid", ".", "So", "if", "the", "grid", "is", "10x10", "then", "th...
c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5
https://github.com/idmillington/layout/blob/c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5/layout/managers/grid.py#L86-L96
52,011
idmillington/layout
layout/managers/grid.py
GridLM._compile_dimension_size
def _compile_dimension_size(self, base_index, array, property, sized_elements): """Build one set of col widths or row heights.""" sort_index = base_index + 2 sized_elements.sort(key=lambda x: x[sort_index]) for element_data in sized_elements: s...
python
def _compile_dimension_size(self, base_index, array, property, sized_elements): """Build one set of col widths or row heights.""" sort_index = base_index + 2 sized_elements.sort(key=lambda x: x[sort_index]) for element_data in sized_elements: s...
[ "def", "_compile_dimension_size", "(", "self", ",", "base_index", ",", "array", ",", "property", ",", "sized_elements", ")", ":", "sort_index", "=", "base_index", "+", "2", "sized_elements", ".", "sort", "(", "key", "=", "lambda", "x", ":", "x", "[", "sort...
Build one set of col widths or row heights.
[ "Build", "one", "set", "of", "col", "widths", "or", "row", "heights", "." ]
c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5
https://github.com/idmillington/layout/blob/c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5/layout/managers/grid.py#L98-L118
52,012
idmillington/layout
layout/managers/grid.py
GridLM.get_minimum_size
def get_minimum_size(self, data): """Finds the minimum size of the grid.""" # Gat a list of elements with their sizes, so we don't have to # recalculate that each time. sized_elements = [ (col, row, cols, rows, element, element.get_minimum_size(data)) for col, ro...
python
def get_minimum_size(self, data): """Finds the minimum size of the grid.""" # Gat a list of elements with their sizes, so we don't have to # recalculate that each time. sized_elements = [ (col, row, cols, rows, element, element.get_minimum_size(data)) for col, ro...
[ "def", "get_minimum_size", "(", "self", ",", "data", ")", ":", "# Gat a list of elements with their sizes, so we don't have to", "# recalculate that each time.", "sized_elements", "=", "[", "(", "col", ",", "row", ",", "cols", ",", "rows", ",", "element", ",", "elemen...
Finds the minimum size of the grid.
[ "Finds", "the", "minimum", "size", "of", "the", "grid", "." ]
c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5
https://github.com/idmillington/layout/blob/c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5/layout/managers/grid.py#L120-L141
52,013
idmillington/layout
layout/managers/grid.py
GridLM.render
def render(self, rect, data): """Draws the cells in grid.""" size = self.get_minimum_size(data) # Find how much extra space we have. extra_width = rect.w - size.x extra_height = rect.h - size.y # Distribute the extra space into the correct rows and columns. if s...
python
def render(self, rect, data): """Draws the cells in grid.""" size = self.get_minimum_size(data) # Find how much extra space we have. extra_width = rect.w - size.x extra_height = rect.h - size.y # Distribute the extra space into the correct rows and columns. if s...
[ "def", "render", "(", "self", ",", "rect", ",", "data", ")", ":", "size", "=", "self", ".", "get_minimum_size", "(", "data", ")", "# Find how much extra space we have.", "extra_width", "=", "rect", ".", "w", "-", "size", ".", "x", "extra_height", "=", "rec...
Draws the cells in grid.
[ "Draws", "the", "cells", "in", "grid", "." ]
c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5
https://github.com/idmillington/layout/blob/c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5/layout/managers/grid.py#L143-L218
52,014
danilobellini/dose
dose/rest.py
get_block
def get_block(name, data, newline="\n"): """ First block in a list of one line strings containing reStructuredText data. The result is as a joined string with the given newline, or a line generator if it's None. The BLOCK_START and BLOCK_END delimiters are selected with the given name and aren't...
python
def get_block(name, data, newline="\n"): """ First block in a list of one line strings containing reStructuredText data. The result is as a joined string with the given newline, or a line generator if it's None. The BLOCK_START and BLOCK_END delimiters are selected with the given name and aren't...
[ "def", "get_block", "(", "name", ",", "data", ",", "newline", "=", "\"\\n\"", ")", ":", "lines", "=", "itertools", ".", "dropwhile", "(", "not_eq", "(", "BLOCK_START", "%", "name", ")", ",", "data", ")", "gen", "=", "itertools", ".", "takewhile", "(", ...
First block in a list of one line strings containing reStructuredText data. The result is as a joined string with the given newline, or a line generator if it's None. The BLOCK_START and BLOCK_END delimiters are selected with the given name and aren't included in the result.
[ "First", "block", "in", "a", "list", "of", "one", "line", "strings", "containing", "reStructuredText", "data", ".", "The", "result", "is", "as", "a", "joined", "string", "with", "the", "given", "newline", "or", "a", "line", "generator", "if", "it", "s", ...
141f48322f7812b7d32e3d5f065d4473a11102a4
https://github.com/danilobellini/dose/blob/141f48322f7812b7d32e3d5f065d4473a11102a4/dose/rest.py#L28-L38
52,015
danilobellini/dose
dose/rest.py
all_but_blocks
def all_but_blocks(names, data, newline="\n", remove_empty_next=True, remove_comments=True): """ Multiline string from a list of strings data, removing every block with any of the given names, as well as their delimiters. Removes the empty lines after BLOCK_END when ``remove_empty_nex...
python
def all_but_blocks(names, data, newline="\n", remove_empty_next=True, remove_comments=True): """ Multiline string from a list of strings data, removing every block with any of the given names, as well as their delimiters. Removes the empty lines after BLOCK_END when ``remove_empty_nex...
[ "def", "all_but_blocks", "(", "names", ",", "data", ",", "newline", "=", "\"\\n\"", ",", "remove_empty_next", "=", "True", ",", "remove_comments", "=", "True", ")", ":", "@", "allow_implicit_stop", "def", "remove_blocks", "(", "name", ",", "iterable", ")", "...
Multiline string from a list of strings data, removing every block with any of the given names, as well as their delimiters. Removes the empty lines after BLOCK_END when ``remove_empty_next`` is True. Returns a joined string with the given newline, or a line generator if it's None. If desired, this func...
[ "Multiline", "string", "from", "a", "list", "of", "strings", "data", "removing", "every", "block", "with", "any", "of", "the", "given", "names", "as", "well", "as", "their", "delimiters", ".", "Removes", "the", "empty", "lines", "after", "BLOCK_END", "when",...
141f48322f7812b7d32e3d5f065d4473a11102a4
https://github.com/danilobellini/dose/blob/141f48322f7812b7d32e3d5f065d4473a11102a4/dose/rest.py#L41-L70
52,016
danilobellini/dose
dose/rest.py
commentless
def commentless(data): """ Generator that removes from a list of strings the double dot reStructuredText comments and its contents based on indentation, removing trailing empty lines after each comment as well. """ it = iter(data) while True: line = next(it) while ":" in line...
python
def commentless(data): """ Generator that removes from a list of strings the double dot reStructuredText comments and its contents based on indentation, removing trailing empty lines after each comment as well. """ it = iter(data) while True: line = next(it) while ":" in line...
[ "def", "commentless", "(", "data", ")", ":", "it", "=", "iter", "(", "data", ")", "while", "True", ":", "line", "=", "next", "(", "it", ")", "while", "\":\"", "in", "line", "or", "not", "line", ".", "lstrip", "(", ")", ".", "startswith", "(", "\"...
Generator that removes from a list of strings the double dot reStructuredText comments and its contents based on indentation, removing trailing empty lines after each comment as well.
[ "Generator", "that", "removes", "from", "a", "list", "of", "strings", "the", "double", "dot", "reStructuredText", "comments", "and", "its", "contents", "based", "on", "indentation", "removing", "trailing", "empty", "lines", "after", "each", "comment", "as", "wel...
141f48322f7812b7d32e3d5f065d4473a11102a4
https://github.com/danilobellini/dose/blob/141f48322f7812b7d32e3d5f065d4473a11102a4/dose/rest.py#L74-L88
52,017
cvxopt/chompack
src/python/symbolic.py
__tdfs
def __tdfs(j, k, head, next, post, stack): """ Depth-first search and postorder of a tree rooted at node j. """ top = 0 stack[0] = j while (top >= 0): p = stack[top] i = head[p] if i == -1: top -= 1 post[k] = p k += 1 else: ...
python
def __tdfs(j, k, head, next, post, stack): """ Depth-first search and postorder of a tree rooted at node j. """ top = 0 stack[0] = j while (top >= 0): p = stack[top] i = head[p] if i == -1: top -= 1 post[k] = p k += 1 else: ...
[ "def", "__tdfs", "(", "j", ",", "k", ",", "head", ",", "next", ",", "post", ",", "stack", ")", ":", "top", "=", "0", "stack", "[", "0", "]", "=", "j", "while", "(", "top", ">=", "0", ")", ":", "p", "=", "stack", "[", "top", "]", "i", "=",...
Depth-first search and postorder of a tree rooted at node j.
[ "Depth", "-", "first", "search", "and", "postorder", "of", "a", "tree", "rooted", "at", "node", "j", "." ]
e07106b58b8055c34f6201e8c954482f86987833
https://github.com/cvxopt/chompack/blob/e07106b58b8055c34f6201e8c954482f86987833/src/python/symbolic.py#L6-L24
52,018
cvxopt/chompack
src/python/symbolic.py
post_order
def post_order(parent): """ Post order a forest. """ n = len(parent) k = 0 p = matrix(0,(n,1)) head = matrix(-1,(n,1)) next = matrix(0,(n,1)) stack = matrix(0,(n,1)) for j in range(n-1,-1,-1): if (parent[j] == j): continue next[j] = head[parent[j]] head[...
python
def post_order(parent): """ Post order a forest. """ n = len(parent) k = 0 p = matrix(0,(n,1)) head = matrix(-1,(n,1)) next = matrix(0,(n,1)) stack = matrix(0,(n,1)) for j in range(n-1,-1,-1): if (parent[j] == j): continue next[j] = head[parent[j]] head[...
[ "def", "post_order", "(", "parent", ")", ":", "n", "=", "len", "(", "parent", ")", "k", "=", "0", "p", "=", "matrix", "(", "0", ",", "(", "n", ",", "1", ")", ")", "head", "=", "matrix", "(", "-", "1", ",", "(", "n", ",", "1", ")", ")", ...
Post order a forest.
[ "Post", "order", "a", "forest", "." ]
e07106b58b8055c34f6201e8c954482f86987833
https://github.com/cvxopt/chompack/blob/e07106b58b8055c34f6201e8c954482f86987833/src/python/symbolic.py#L26-L47
52,019
cvxopt/chompack
src/python/symbolic.py
etree
def etree(A): """ Compute elimination tree from upper triangle of A. """ assert isinstance(A,spmatrix), "A must be a sparse matrix" assert A.size[0] == A.size[1], "A must be a square matrix" n = A.size[0] cp,ri,_ = A.CCS parent = matrix(0,(n,1)) w = matrix(0,(n,1)) for k in ran...
python
def etree(A): """ Compute elimination tree from upper triangle of A. """ assert isinstance(A,spmatrix), "A must be a sparse matrix" assert A.size[0] == A.size[1], "A must be a square matrix" n = A.size[0] cp,ri,_ = A.CCS parent = matrix(0,(n,1)) w = matrix(0,(n,1)) for k in ran...
[ "def", "etree", "(", "A", ")", ":", "assert", "isinstance", "(", "A", ",", "spmatrix", ")", ",", "\"A must be a sparse matrix\"", "assert", "A", ".", "size", "[", "0", "]", "==", "A", ".", "size", "[", "1", "]", ",", "\"A must be a square matrix\"", "n",...
Compute elimination tree from upper triangle of A.
[ "Compute", "elimination", "tree", "from", "upper", "triangle", "of", "A", "." ]
e07106b58b8055c34f6201e8c954482f86987833
https://github.com/cvxopt/chompack/blob/e07106b58b8055c34f6201e8c954482f86987833/src/python/symbolic.py#L49-L72
52,020
cvxopt/chompack
src/python/symbolic.py
__leaf
def __leaf(i, j, first, maxfirst, prevleaf, ancestor): """ Determine if j is leaf of i'th row subtree. """ jleaf = 0 if i<=j or first[j] <= maxfirst[i]: return -1, jleaf maxfirst[i] = first[j] jprev = prevleaf[i] prevleaf[i] = j if jprev == -1: jleaf = 1 else: jleaf = 2 if jl...
python
def __leaf(i, j, first, maxfirst, prevleaf, ancestor): """ Determine if j is leaf of i'th row subtree. """ jleaf = 0 if i<=j or first[j] <= maxfirst[i]: return -1, jleaf maxfirst[i] = first[j] jprev = prevleaf[i] prevleaf[i] = j if jprev == -1: jleaf = 1 else: jleaf = 2 if jl...
[ "def", "__leaf", "(", "i", ",", "j", ",", "first", ",", "maxfirst", ",", "prevleaf", ",", "ancestor", ")", ":", "jleaf", "=", "0", "if", "i", "<=", "j", "or", "first", "[", "j", "]", "<=", "maxfirst", "[", "i", "]", ":", "return", "-", "1", "...
Determine if j is leaf of i'th row subtree.
[ "Determine", "if", "j", "is", "leaf", "of", "i", "th", "row", "subtree", "." ]
e07106b58b8055c34f6201e8c954482f86987833
https://github.com/cvxopt/chompack/blob/e07106b58b8055c34f6201e8c954482f86987833/src/python/symbolic.py#L74-L93
52,021
cvxopt/chompack
src/python/symbolic.py
counts
def counts(A, parent, post): """ Compute column counts. """ n = A.size[0] colcount = matrix(0,(n,1)) ancestor = matrix(range(n),(n,1)) maxfirst = matrix(-1,(n,1)) prevleaf = matrix(-1,(n,1)) first = matrix(-1,(n,1)) for k in range(n): j = post[k] if first[j] ...
python
def counts(A, parent, post): """ Compute column counts. """ n = A.size[0] colcount = matrix(0,(n,1)) ancestor = matrix(range(n),(n,1)) maxfirst = matrix(-1,(n,1)) prevleaf = matrix(-1,(n,1)) first = matrix(-1,(n,1)) for k in range(n): j = post[k] if first[j] ...
[ "def", "counts", "(", "A", ",", "parent", ",", "post", ")", ":", "n", "=", "A", ".", "size", "[", "0", "]", "colcount", "=", "matrix", "(", "0", ",", "(", "n", ",", "1", ")", ")", "ancestor", "=", "matrix", "(", "range", "(", "n", ")", ",",...
Compute column counts.
[ "Compute", "column", "counts", "." ]
e07106b58b8055c34f6201e8c954482f86987833
https://github.com/cvxopt/chompack/blob/e07106b58b8055c34f6201e8c954482f86987833/src/python/symbolic.py#L95-L131
52,022
cvxopt/chompack
src/python/symbolic.py
pothen_sun
def pothen_sun(par, post, colcount): """ Find supernodes and supernodal etree. ARGUMENTS par parent array post array with post ordering colcount array with column counts RETURNS snpar supernodal parent structure flag integer vector of length n; if flag[i] <...
python
def pothen_sun(par, post, colcount): """ Find supernodes and supernodal etree. ARGUMENTS par parent array post array with post ordering colcount array with column counts RETURNS snpar supernodal parent structure flag integer vector of length n; if flag[i] <...
[ "def", "pothen_sun", "(", "par", ",", "post", ",", "colcount", ")", ":", "n", "=", "len", "(", "par", ")", "flag", "=", "matrix", "(", "-", "1", ",", "(", "n", ",", "1", ")", ")", "snpar", "=", "matrix", "(", "-", "1", ",", "(", "n", ",", ...
Find supernodes and supernodal etree. ARGUMENTS par parent array post array with post ordering colcount array with column counts RETURNS snpar supernodal parent structure flag integer vector of length n; if flag[i] < 0, then -flag[i] is the degree of ...
[ "Find", "supernodes", "and", "supernodal", "etree", "." ]
e07106b58b8055c34f6201e8c954482f86987833
https://github.com/cvxopt/chompack/blob/e07106b58b8055c34f6201e8c954482f86987833/src/python/symbolic.py#L133-L198
52,023
cvxopt/chompack
src/python/symbolic.py
supernodes
def supernodes(par, post, colcount): """ Find supernodes. ARGUMENTS par parent array post array with post ordering colcount array with column counts RETURNS snode array with supernodes; snode[snptr[k]:snptr[k+1]] contains the indices of supernode k ...
python
def supernodes(par, post, colcount): """ Find supernodes. ARGUMENTS par parent array post array with post ordering colcount array with column counts RETURNS snode array with supernodes; snode[snptr[k]:snptr[k+1]] contains the indices of supernode k ...
[ "def", "supernodes", "(", "par", ",", "post", ",", "colcount", ")", ":", "snpar", ",", "flag", "=", "pothen_sun", "(", "par", ",", "post", ",", "colcount", ")", "n", "=", "len", "(", "par", ")", "N", "=", "len", "(", "snpar", ")", "snode", "=", ...
Find supernodes. ARGUMENTS par parent array post array with post ordering colcount array with column counts RETURNS snode array with supernodes; snode[snptr[k]:snptr[k+1]] contains the indices of supernode k snptr pointer array; snptr[k] is the index of...
[ "Find", "supernodes", "." ]
e07106b58b8055c34f6201e8c954482f86987833
https://github.com/cvxopt/chompack/blob/e07106b58b8055c34f6201e8c954482f86987833/src/python/symbolic.py#L200-L244
52,024
cvxopt/chompack
src/python/symbolic.py
amalgamate
def amalgamate(colcount, snode, snptr, snpar, snpost, merge_function): """ Supernodal amalgamation. colcount, snode, snptr, snpar, snpost = ... amalgamate(colcount, snode, snptr, snpar, snpost, merge_function) PURPOSE Iterates over the clique tree in topological order and greedily ...
python
def amalgamate(colcount, snode, snptr, snpar, snpost, merge_function): """ Supernodal amalgamation. colcount, snode, snptr, snpar, snpost = ... amalgamate(colcount, snode, snptr, snpar, snpost, merge_function) PURPOSE Iterates over the clique tree in topological order and greedily ...
[ "def", "amalgamate", "(", "colcount", ",", "snode", ",", "snptr", ",", "snpar", ",", "snpost", ",", "merge_function", ")", ":", "N", "=", "len", "(", "snpost", ")", "ch", "=", "{", "}", "for", "j", "in", "snpost", ":", "if", "snpar", "[", "j", "]...
Supernodal amalgamation. colcount, snode, snptr, snpar, snpost = ... amalgamate(colcount, snode, snptr, snpar, snpost, merge_function) PURPOSE Iterates over the clique tree in topological order and greedily merges a supernode with its parent if merge_function(|J_{par(k)}|, |J_k...
[ "Supernodal", "amalgamation", "." ]
e07106b58b8055c34f6201e8c954482f86987833
https://github.com/cvxopt/chompack/blob/e07106b58b8055c34f6201e8c954482f86987833/src/python/symbolic.py#L246-L326
52,025
cvxopt/chompack
src/python/symbolic.py
embed
def embed(A, colcount, snode, snptr, snpar, snpost): """ Compute filled pattern. colptr, rowidx = embed(A, colcount, snode, snptr, snpar, snpost) PURPOSE Computes rowindices and column pointer for representative vertices in supernodes. ARGUMENTS A sparse matrix colcount v...
python
def embed(A, colcount, snode, snptr, snpar, snpost): """ Compute filled pattern. colptr, rowidx = embed(A, colcount, snode, snptr, snpar, snpost) PURPOSE Computes rowindices and column pointer for representative vertices in supernodes. ARGUMENTS A sparse matrix colcount v...
[ "def", "embed", "(", "A", ",", "colcount", ",", "snode", ",", "snptr", ",", "snpar", ",", "snpost", ")", ":", "Alo", "=", "tril", "(", "A", ")", "cp", ",", "ri", ",", "_", "=", "Alo", ".", "CCS", "N", "=", "len", "(", "snpar", ")", "# colptr ...
Compute filled pattern. colptr, rowidx = embed(A, colcount, snode, snptr, snpar, snpost) PURPOSE Computes rowindices and column pointer for representative vertices in supernodes. ARGUMENTS A sparse matrix colcount vector with column counts snode vector with supernodes ...
[ "Compute", "filled", "pattern", "." ]
e07106b58b8055c34f6201e8c954482f86987833
https://github.com/cvxopt/chompack/blob/e07106b58b8055c34f6201e8c954482f86987833/src/python/symbolic.py#L328-L384
52,026
cvxopt/chompack
src/python/symbolic.py
relative_idx
def relative_idx(colptr, rowidx, snptr, snpar): """ Compute relative indices of update matrices in frontal matrix of parent. """ relptr = matrix(0, (len(snptr),1)) relidx = matrix(-1, (colptr[-1],1)) def lfind(a,b): i = 0 ret = +a for k in range(len(a)): ...
python
def relative_idx(colptr, rowidx, snptr, snpar): """ Compute relative indices of update matrices in frontal matrix of parent. """ relptr = matrix(0, (len(snptr),1)) relidx = matrix(-1, (colptr[-1],1)) def lfind(a,b): i = 0 ret = +a for k in range(len(a)): ...
[ "def", "relative_idx", "(", "colptr", ",", "rowidx", ",", "snptr", ",", "snpar", ")", ":", "relptr", "=", "matrix", "(", "0", ",", "(", "len", "(", "snptr", ")", ",", "1", ")", ")", "relidx", "=", "matrix", "(", "-", "1", ",", "(", "colptr", "[...
Compute relative indices of update matrices in frontal matrix of parent.
[ "Compute", "relative", "indices", "of", "update", "matrices", "in", "frontal", "matrix", "of", "parent", "." ]
e07106b58b8055c34f6201e8c954482f86987833
https://github.com/cvxopt/chompack/blob/e07106b58b8055c34f6201e8c954482f86987833/src/python/symbolic.py#L386-L411
52,027
cvxopt/chompack
src/python/symbolic.py
peo
def peo(A, p): """ Checks whether an ordering is a perfect elmimination order. Returns `True` if the permutation :math:`p` is a perfect elimination order for a Cholesky factorization :math:`PAP^T = LL^T`. Only the lower triangular part of :math:`A` is accessed. :param A: :py:class:`spmat...
python
def peo(A, p): """ Checks whether an ordering is a perfect elmimination order. Returns `True` if the permutation :math:`p` is a perfect elimination order for a Cholesky factorization :math:`PAP^T = LL^T`. Only the lower triangular part of :math:`A` is accessed. :param A: :py:class:`spmat...
[ "def", "peo", "(", "A", ",", "p", ")", ":", "n", "=", "A", ".", "size", "[", "0", "]", "assert", "type", "(", "A", ")", "==", "spmatrix", ",", "\"A must be a sparse matrix\"", "assert", "A", ".", "size", "[", "1", "]", "==", "n", ",", "\"A must b...
Checks whether an ordering is a perfect elmimination order. Returns `True` if the permutation :math:`p` is a perfect elimination order for a Cholesky factorization :math:`PAP^T = LL^T`. Only the lower triangular part of :math:`A` is accessed. :param A: :py:class:`spmatrix` :param p: :...
[ "Checks", "whether", "an", "ordering", "is", "a", "perfect", "elmimination", "order", "." ]
e07106b58b8055c34f6201e8c954482f86987833
https://github.com/cvxopt/chompack/blob/e07106b58b8055c34f6201e8c954482f86987833/src/python/symbolic.py#L413-L449
52,028
cvxopt/chompack
src/python/symbolic.py
symbolic.nnz
def nnz(self): """ Returns the number of lower-triangular nonzeros. """ nnz = 0 for k in range(len(self.snpost)): nn = self.snptr[k+1]-self.snptr[k] na = self.relptr[k+1]-self.relptr[k] nnz += nn*(nn+1)/2 + nn*na return nnz
python
def nnz(self): """ Returns the number of lower-triangular nonzeros. """ nnz = 0 for k in range(len(self.snpost)): nn = self.snptr[k+1]-self.snptr[k] na = self.relptr[k+1]-self.relptr[k] nnz += nn*(nn+1)/2 + nn*na return nnz
[ "def", "nnz", "(", "self", ")", ":", "nnz", "=", "0", "for", "k", "in", "range", "(", "len", "(", "self", ".", "snpost", ")", ")", ":", "nn", "=", "self", ".", "snptr", "[", "k", "+", "1", "]", "-", "self", ".", "snptr", "[", "k", "]", "n...
Returns the number of lower-triangular nonzeros.
[ "Returns", "the", "number", "of", "lower", "-", "triangular", "nonzeros", "." ]
e07106b58b8055c34f6201e8c954482f86987833
https://github.com/cvxopt/chompack/blob/e07106b58b8055c34f6201e8c954482f86987833/src/python/symbolic.py#L820-L829
52,029
cvxopt/chompack
src/python/symbolic.py
symbolic.cliques
def cliques(self, reordered = True): """ Returns a list of cliques """ if reordered: return [list(self.snrowidx[self.sncolptr[k]:self.sncolptr[k+1]]) for k in range(self.Nsn)] else: return [list(self.__p[self.snrowidx[self.sncolptr[k]:self.sncolptr[k+1]]])...
python
def cliques(self, reordered = True): """ Returns a list of cliques """ if reordered: return [list(self.snrowidx[self.sncolptr[k]:self.sncolptr[k+1]]) for k in range(self.Nsn)] else: return [list(self.__p[self.snrowidx[self.sncolptr[k]:self.sncolptr[k+1]]])...
[ "def", "cliques", "(", "self", ",", "reordered", "=", "True", ")", ":", "if", "reordered", ":", "return", "[", "list", "(", "self", ".", "snrowidx", "[", "self", ".", "sncolptr", "[", "k", "]", ":", "self", ".", "sncolptr", "[", "k", "+", "1", "]...
Returns a list of cliques
[ "Returns", "a", "list", "of", "cliques" ]
e07106b58b8055c34f6201e8c954482f86987833
https://github.com/cvxopt/chompack/blob/e07106b58b8055c34f6201e8c954482f86987833/src/python/symbolic.py#L857-L864
52,030
cvxopt/chompack
src/python/symbolic.py
symbolic.separators
def separators(self, reordered = True): """ Returns a list of separator sets """ if reordered: return [list(self.snrowidx[self.sncolptr[k]+self.snptr[k+1]-self.snptr[k]:self.sncolptr[k+1]]) for k in range(self.Nsn)] else: return [list(self.__p[self.snrow...
python
def separators(self, reordered = True): """ Returns a list of separator sets """ if reordered: return [list(self.snrowidx[self.sncolptr[k]+self.snptr[k+1]-self.snptr[k]:self.sncolptr[k+1]]) for k in range(self.Nsn)] else: return [list(self.__p[self.snrow...
[ "def", "separators", "(", "self", ",", "reordered", "=", "True", ")", ":", "if", "reordered", ":", "return", "[", "list", "(", "self", ".", "snrowidx", "[", "self", ".", "sncolptr", "[", "k", "]", "+", "self", ".", "snptr", "[", "k", "+", "1", "]...
Returns a list of separator sets
[ "Returns", "a", "list", "of", "separator", "sets" ]
e07106b58b8055c34f6201e8c954482f86987833
https://github.com/cvxopt/chompack/blob/e07106b58b8055c34f6201e8c954482f86987833/src/python/symbolic.py#L866-L873
52,031
cvxopt/chompack
src/python/symbolic.py
symbolic.supernodes
def supernodes(self, reordered = True): """ Returns a list of supernode sets """ if reordered: return [list(self.snode[self.snptr[k]:self.snptr[k+1]]) for k in range(self.Nsn)] else: return [list(self.__p[self.snode[self.snptr[k]:self.snptr[k+1]]]) for k i...
python
def supernodes(self, reordered = True): """ Returns a list of supernode sets """ if reordered: return [list(self.snode[self.snptr[k]:self.snptr[k+1]]) for k in range(self.Nsn)] else: return [list(self.__p[self.snode[self.snptr[k]:self.snptr[k+1]]]) for k i...
[ "def", "supernodes", "(", "self", ",", "reordered", "=", "True", ")", ":", "if", "reordered", ":", "return", "[", "list", "(", "self", ".", "snode", "[", "self", ".", "snptr", "[", "k", "]", ":", "self", ".", "snptr", "[", "k", "+", "1", "]", "...
Returns a list of supernode sets
[ "Returns", "a", "list", "of", "supernode", "sets" ]
e07106b58b8055c34f6201e8c954482f86987833
https://github.com/cvxopt/chompack/blob/e07106b58b8055c34f6201e8c954482f86987833/src/python/symbolic.py#L875-L882
52,032
cvxopt/chompack
src/python/symbolic.py
cspmatrix.diag
def diag(self, reordered = True): """ Returns a vector with the diagonal elements of the matrix. """ sncolptr = self.symb.sncolptr snptr = self.symb.snptr snode = self.symb.snode blkptr = self.symb.blkptr D = matrix(0.0,(self.symb.n,1)) fo...
python
def diag(self, reordered = True): """ Returns a vector with the diagonal elements of the matrix. """ sncolptr = self.symb.sncolptr snptr = self.symb.snptr snode = self.symb.snode blkptr = self.symb.blkptr D = matrix(0.0,(self.symb.n,1)) fo...
[ "def", "diag", "(", "self", ",", "reordered", "=", "True", ")", ":", "sncolptr", "=", "self", ".", "symb", ".", "sncolptr", "snptr", "=", "self", ".", "symb", ".", "snptr", "snode", "=", "self", ".", "symb", ".", "snode", "blkptr", "=", "self", "."...
Returns a vector with the diagonal elements of the matrix.
[ "Returns", "a", "vector", "with", "the", "diagonal", "elements", "of", "the", "matrix", "." ]
e07106b58b8055c34f6201e8c954482f86987833
https://github.com/cvxopt/chompack/blob/e07106b58b8055c34f6201e8c954482f86987833/src/python/symbolic.py#L1113-L1128
52,033
thehq/python-branchio
branchio/client.py
Client.create_deep_link_url
def create_deep_link_url(self, data=None, alias=None, type=0, duration=None, identity=None, tags=None, campaign=None, feature=None, channel=None, stage=None, skip_api_call=False): """ Creates a deep linking url See the URL https://dev.branch.io/references/http_api/#...
python
def create_deep_link_url(self, data=None, alias=None, type=0, duration=None, identity=None, tags=None, campaign=None, feature=None, channel=None, stage=None, skip_api_call=False): """ Creates a deep linking url See the URL https://dev.branch.io/references/http_api/#...
[ "def", "create_deep_link_url", "(", "self", ",", "data", "=", "None", ",", "alias", "=", "None", ",", "type", "=", "0", ",", "duration", "=", "None", ",", "identity", "=", "None", ",", "tags", "=", "None", ",", "campaign", "=", "None", ",", "feature"...
Creates a deep linking url See the URL https://dev.branch.io/references/http_api/#creating-a-deep-linking-url You can also use this method to bulk create deep link by setting "skip_api_call=True" and using the parameters returned by the method as an array and call "create_deep_linking_urls" ...
[ "Creates", "a", "deep", "linking", "url" ]
7b8a1fae9bfeb75cf3099869f7aae5e2cead2def
https://github.com/thehq/python-branchio/blob/7b8a1fae9bfeb75cf3099869f7aae5e2cead2def/branchio/client.py#L80-L112
52,034
thehq/python-branchio
branchio/client.py
Client.create_deep_linking_urls
def create_deep_linking_urls(self, url_params): """ Bulk Creates Deep Linking URLs See the URL https://dev.branch.io/references/http_api/#bulk-creating-deep-linking-urls :param url_params: Array of values returned from "create_deep_link_url(..., skip_api_call=True)" :return: Th...
python
def create_deep_linking_urls(self, url_params): """ Bulk Creates Deep Linking URLs See the URL https://dev.branch.io/references/http_api/#bulk-creating-deep-linking-urls :param url_params: Array of values returned from "create_deep_link_url(..., skip_api_call=True)" :return: Th...
[ "def", "create_deep_linking_urls", "(", "self", ",", "url_params", ")", ":", "url", "=", "\"/v1/url/bulk/%s\"", "%", "self", ".", "branch_key", "method", "=", "\"POST\"", "# Checks params", "self", ".", "_check_param", "(", "value", "=", "url_params", ",", "type...
Bulk Creates Deep Linking URLs See the URL https://dev.branch.io/references/http_api/#bulk-creating-deep-linking-urls :param url_params: Array of values returned from "create_deep_link_url(..., skip_api_call=True)" :return: The response
[ "Bulk", "Creates", "Deep", "Linking", "URLs" ]
7b8a1fae9bfeb75cf3099869f7aae5e2cead2def
https://github.com/thehq/python-branchio/blob/7b8a1fae9bfeb75cf3099869f7aae5e2cead2def/branchio/client.py#L114-L130
52,035
chukysoria/pyspotify-connect
spotifyconnect/utils.py
make_enum
def make_enum(lib_prefix, enum_prefix=''): """Class decorator for automatically adding enum values. The values are read directly from the :attr:`spotify.lib` CFFI wrapper around libspotify. All values starting with ``lib_prefix`` are added. The ``lib_prefix`` is stripped from the name. Optionally, ``en...
python
def make_enum(lib_prefix, enum_prefix=''): """Class decorator for automatically adding enum values. The values are read directly from the :attr:`spotify.lib` CFFI wrapper around libspotify. All values starting with ``lib_prefix`` are added. The ``lib_prefix`` is stripped from the name. Optionally, ``en...
[ "def", "make_enum", "(", "lib_prefix", ",", "enum_prefix", "=", "''", ")", ":", "def", "wrapper", "(", "cls", ")", ":", "for", "attr", "in", "dir", "(", "lib", ")", ":", "if", "attr", ".", "startswith", "(", "lib_prefix", ")", ":", "name", "=", "at...
Class decorator for automatically adding enum values. The values are read directly from the :attr:`spotify.lib` CFFI wrapper around libspotify. All values starting with ``lib_prefix`` are added. The ``lib_prefix`` is stripped from the name. Optionally, ``enum_prefix`` can be specified to add a prefix t...
[ "Class", "decorator", "for", "automatically", "adding", "enum", "values", "." ]
bd157fa4fb2b51b3641f198a35384678c1a4fa11
https://github.com/chukysoria/pyspotify-connect/blob/bd157fa4fb2b51b3641f198a35384678c1a4fa11/spotifyconnect/utils.py#L143-L158
52,036
chukysoria/pyspotify-connect
spotifyconnect/utils.py
to_bytes
def to_bytes(value): """Converts bytes, unicode, and C char arrays to bytes. Unicode strings are encoded to UTF-8. """ if isinstance(value, text_type): return value.encode('utf-8') elif isinstance(value, ffi.CData): return ffi.string(value) elif isinstance(value, binary_type): ...
python
def to_bytes(value): """Converts bytes, unicode, and C char arrays to bytes. Unicode strings are encoded to UTF-8. """ if isinstance(value, text_type): return value.encode('utf-8') elif isinstance(value, ffi.CData): return ffi.string(value) elif isinstance(value, binary_type): ...
[ "def", "to_bytes", "(", "value", ")", ":", "if", "isinstance", "(", "value", ",", "text_type", ")", ":", "return", "value", ".", "encode", "(", "'utf-8'", ")", "elif", "isinstance", "(", "value", ",", "ffi", ".", "CData", ")", ":", "return", "ffi", "...
Converts bytes, unicode, and C char arrays to bytes. Unicode strings are encoded to UTF-8.
[ "Converts", "bytes", "unicode", "and", "C", "char", "arrays", "to", "bytes", "." ]
bd157fa4fb2b51b3641f198a35384678c1a4fa11
https://github.com/chukysoria/pyspotify-connect/blob/bd157fa4fb2b51b3641f198a35384678c1a4fa11/spotifyconnect/utils.py#L161-L173
52,037
chukysoria/pyspotify-connect
spotifyconnect/utils.py
to_bytes_or_none
def to_bytes_or_none(value): """Converts C char arrays to bytes and C NULL values to None.""" if value == ffi.NULL: return None elif isinstance(value, ffi.CData): return ffi.string(value) else: raise ValueError('Value must be char[] or NULL')
python
def to_bytes_or_none(value): """Converts C char arrays to bytes and C NULL values to None.""" if value == ffi.NULL: return None elif isinstance(value, ffi.CData): return ffi.string(value) else: raise ValueError('Value must be char[] or NULL')
[ "def", "to_bytes_or_none", "(", "value", ")", ":", "if", "value", "==", "ffi", ".", "NULL", ":", "return", "None", "elif", "isinstance", "(", "value", ",", "ffi", ".", "CData", ")", ":", "return", "ffi", ".", "string", "(", "value", ")", "else", ":",...
Converts C char arrays to bytes and C NULL values to None.
[ "Converts", "C", "char", "arrays", "to", "bytes", "and", "C", "NULL", "values", "to", "None", "." ]
bd157fa4fb2b51b3641f198a35384678c1a4fa11
https://github.com/chukysoria/pyspotify-connect/blob/bd157fa4fb2b51b3641f198a35384678c1a4fa11/spotifyconnect/utils.py#L176-L183
52,038
chukysoria/pyspotify-connect
spotifyconnect/utils.py
to_unicode
def to_unicode(value): """Converts bytes, unicode, and C char arrays to unicode strings. Bytes and C char arrays are decoded from UTF-8. """ if isinstance(value, ffi.CData): return ffi.string(value).decode('utf-8') elif isinstance(value, binary_type): return value.decode('utf-8') ...
python
def to_unicode(value): """Converts bytes, unicode, and C char arrays to unicode strings. Bytes and C char arrays are decoded from UTF-8. """ if isinstance(value, ffi.CData): return ffi.string(value).decode('utf-8') elif isinstance(value, binary_type): return value.decode('utf-8') ...
[ "def", "to_unicode", "(", "value", ")", ":", "if", "isinstance", "(", "value", ",", "ffi", ".", "CData", ")", ":", "return", "ffi", ".", "string", "(", "value", ")", ".", "decode", "(", "'utf-8'", ")", "elif", "isinstance", "(", "value", ",", "binary...
Converts bytes, unicode, and C char arrays to unicode strings. Bytes and C char arrays are decoded from UTF-8.
[ "Converts", "bytes", "unicode", "and", "C", "char", "arrays", "to", "unicode", "strings", "." ]
bd157fa4fb2b51b3641f198a35384678c1a4fa11
https://github.com/chukysoria/pyspotify-connect/blob/bd157fa4fb2b51b3641f198a35384678c1a4fa11/spotifyconnect/utils.py#L201-L213
52,039
chukysoria/pyspotify-connect
spotifyconnect/utils.py
to_unicode_or_none
def to_unicode_or_none(value): """Converts C char arrays to unicode and C NULL values to None. C char arrays are decoded from UTF-8. """ if value == ffi.NULL: return None elif isinstance(value, ffi.CData): return ffi.string(value).decode('utf-8') else: raise ValueError('...
python
def to_unicode_or_none(value): """Converts C char arrays to unicode and C NULL values to None. C char arrays are decoded from UTF-8. """ if value == ffi.NULL: return None elif isinstance(value, ffi.CData): return ffi.string(value).decode('utf-8') else: raise ValueError('...
[ "def", "to_unicode_or_none", "(", "value", ")", ":", "if", "value", "==", "ffi", ".", "NULL", ":", "return", "None", "elif", "isinstance", "(", "value", ",", "ffi", ".", "CData", ")", ":", "return", "ffi", ".", "string", "(", "value", ")", ".", "deco...
Converts C char arrays to unicode and C NULL values to None. C char arrays are decoded from UTF-8.
[ "Converts", "C", "char", "arrays", "to", "unicode", "and", "C", "NULL", "values", "to", "None", "." ]
bd157fa4fb2b51b3641f198a35384678c1a4fa11
https://github.com/chukysoria/pyspotify-connect/blob/bd157fa4fb2b51b3641f198a35384678c1a4fa11/spotifyconnect/utils.py#L216-L226
52,040
chukysoria/pyspotify-connect
spotifyconnect/utils.py
EventEmitter.on
def on(self, event, listener, *user_args): """Register a ``listener`` to be called on ``event``. The listener will be called with any extra arguments passed to :meth:`emit` first, and then the extra arguments passed to :meth:`on` last. If the listener function returns :class:`F...
python
def on(self, event, listener, *user_args): """Register a ``listener`` to be called on ``event``. The listener will be called with any extra arguments passed to :meth:`emit` first, and then the extra arguments passed to :meth:`on` last. If the listener function returns :class:`F...
[ "def", "on", "(", "self", ",", "event", ",", "listener", ",", "*", "user_args", ")", ":", "self", ".", "_listeners", "[", "event", "]", ".", "append", "(", "_Listener", "(", "callback", "=", "listener", ",", "user_args", "=", "user_args", ")", ")" ]
Register a ``listener`` to be called on ``event``. The listener will be called with any extra arguments passed to :meth:`emit` first, and then the extra arguments passed to :meth:`on` last. If the listener function returns :class:`False`, it is removed and will not be called th...
[ "Register", "a", "listener", "to", "be", "called", "on", "event", "." ]
bd157fa4fb2b51b3641f198a35384678c1a4fa11
https://github.com/chukysoria/pyspotify-connect/blob/bd157fa4fb2b51b3641f198a35384678c1a4fa11/spotifyconnect/utils.py#L29-L40
52,041
chukysoria/pyspotify-connect
spotifyconnect/utils.py
EventEmitter.off
def off(self, event=None, listener=None): """Remove a ``listener`` that was to be called on ``event``. If ``listener`` is :class:`None`, all listeners for the given ``event`` will be removed. If ``event`` is :class:`None`, all listeners for all events on this object will be rem...
python
def off(self, event=None, listener=None): """Remove a ``listener`` that was to be called on ``event``. If ``listener`` is :class:`None`, all listeners for the given ``event`` will be removed. If ``event`` is :class:`None`, all listeners for all events on this object will be rem...
[ "def", "off", "(", "self", ",", "event", "=", "None", ",", "listener", "=", "None", ")", ":", "if", "event", "is", "None", ":", "events", "=", "self", ".", "_listeners", ".", "keys", "(", ")", "else", ":", "events", "=", "[", "event", "]", "for",...
Remove a ``listener`` that was to be called on ``event``. If ``listener`` is :class:`None`, all listeners for the given ``event`` will be removed. If ``event`` is :class:`None`, all listeners for all events on this object will be removed.
[ "Remove", "a", "listener", "that", "was", "to", "be", "called", "on", "event", "." ]
bd157fa4fb2b51b3641f198a35384678c1a4fa11
https://github.com/chukysoria/pyspotify-connect/blob/bd157fa4fb2b51b3641f198a35384678c1a4fa11/spotifyconnect/utils.py#L43-L62
52,042
chukysoria/pyspotify-connect
spotifyconnect/utils.py
EventEmitter.emit
def emit(self, event, *event_args): """Call the registered listeners for ``event``. The listeners will be called with any extra arguments passed to :meth:`emit` first, and then the extra arguments passed to :meth:`on` """ listeners = self._listeners[event][:] for listene...
python
def emit(self, event, *event_args): """Call the registered listeners for ``event``. The listeners will be called with any extra arguments passed to :meth:`emit` first, and then the extra arguments passed to :meth:`on` """ listeners = self._listeners[event][:] for listene...
[ "def", "emit", "(", "self", ",", "event", ",", "*", "event_args", ")", ":", "listeners", "=", "self", ".", "_listeners", "[", "event", "]", "[", ":", "]", "for", "listener", "in", "listeners", ":", "args", "=", "list", "(", "event_args", ")", "+", ...
Call the registered listeners for ``event``. The listeners will be called with any extra arguments passed to :meth:`emit` first, and then the extra arguments passed to :meth:`on`
[ "Call", "the", "registered", "listeners", "for", "event", "." ]
bd157fa4fb2b51b3641f198a35384678c1a4fa11
https://github.com/chukysoria/pyspotify-connect/blob/bd157fa4fb2b51b3641f198a35384678c1a4fa11/spotifyconnect/utils.py#L64-L75
52,043
chukysoria/pyspotify-connect
spotifyconnect/utils.py
EventEmitter.num_listeners
def num_listeners(self, event=None): """Return the number of listeners for ``event``. Return the total number of listeners for all events on this object if ``event`` is :class:`None`. """ if event is not None: return len(self._listeners[event]) else: ...
python
def num_listeners(self, event=None): """Return the number of listeners for ``event``. Return the total number of listeners for all events on this object if ``event`` is :class:`None`. """ if event is not None: return len(self._listeners[event]) else: ...
[ "def", "num_listeners", "(", "self", ",", "event", "=", "None", ")", ":", "if", "event", "is", "not", "None", ":", "return", "len", "(", "self", ".", "_listeners", "[", "event", "]", ")", "else", ":", "return", "sum", "(", "len", "(", "l", ")", "...
Return the number of listeners for ``event``. Return the total number of listeners for all events on this object if ``event`` is :class:`None`.
[ "Return", "the", "number", "of", "listeners", "for", "event", "." ]
bd157fa4fb2b51b3641f198a35384678c1a4fa11
https://github.com/chukysoria/pyspotify-connect/blob/bd157fa4fb2b51b3641f198a35384678c1a4fa11/spotifyconnect/utils.py#L77-L86
52,044
chukysoria/pyspotify-connect
spotifyconnect/utils.py
EventEmitter.call
def call(self, event, *event_args): """Call the single registered listener for ``event``. The listener will be called with any extra arguments passed to :meth:`call` first, and then the extra arguments passed to :meth:`on` Raises :exc:`AssertionError` if there is none or multiple liste...
python
def call(self, event, *event_args): """Call the single registered listener for ``event``. The listener will be called with any extra arguments passed to :meth:`call` first, and then the extra arguments passed to :meth:`on` Raises :exc:`AssertionError` if there is none or multiple liste...
[ "def", "call", "(", "self", ",", "event", ",", "*", "event_args", ")", ":", "# XXX It would be a lot better for debugging if this error was raised", "# when registering the second listener instead of when the event is", "# emitted.", "assert", "self", ".", "num_listeners", "(", ...
Call the single registered listener for ``event``. The listener will be called with any extra arguments passed to :meth:`call` first, and then the extra arguments passed to :meth:`on` Raises :exc:`AssertionError` if there is none or multiple listeners for ``event``. Returns the listene...
[ "Call", "the", "single", "registered", "listener", "for", "event", "." ]
bd157fa4fb2b51b3641f198a35384678c1a4fa11
https://github.com/chukysoria/pyspotify-connect/blob/bd157fa4fb2b51b3641f198a35384678c1a4fa11/spotifyconnect/utils.py#L88-L105
52,045
chukysoria/pyspotify-connect
spotifyconnect/utils.py
IntEnum.add
def add(cls, name, value): """Add a name-value pair to the enumeration.""" attr = cls(value) attr._name = name setattr(cls, name, attr)
python
def add(cls, name, value): """Add a name-value pair to the enumeration.""" attr = cls(value) attr._name = name setattr(cls, name, attr)
[ "def", "add", "(", "cls", ",", "name", ",", "value", ")", ":", "attr", "=", "cls", "(", "value", ")", "attr", ".", "_name", "=", "name", "setattr", "(", "cls", ",", "name", ",", "attr", ")" ]
Add a name-value pair to the enumeration.
[ "Add", "a", "name", "-", "value", "pair", "to", "the", "enumeration", "." ]
bd157fa4fb2b51b3641f198a35384678c1a4fa11
https://github.com/chukysoria/pyspotify-connect/blob/bd157fa4fb2b51b3641f198a35384678c1a4fa11/spotifyconnect/utils.py#L136-L140
52,046
idmillington/layout
layout/managers/directional.py
VerticalLM.get_minimum_size
def get_minimum_size(self, data): """ Minimum height is the total height + margins, minimum width is the largest width. """ min_width = 0 height = 0 for element in self.elements: size = element.get_minimum_size(data) min_width = max(min_wid...
python
def get_minimum_size(self, data): """ Minimum height is the total height + margins, minimum width is the largest width. """ min_width = 0 height = 0 for element in self.elements: size = element.get_minimum_size(data) min_width = max(min_wid...
[ "def", "get_minimum_size", "(", "self", ",", "data", ")", ":", "min_width", "=", "0", "height", "=", "0", "for", "element", "in", "self", ".", "elements", ":", "size", "=", "element", ".", "get_minimum_size", "(", "data", ")", "min_width", "=", "max", ...
Minimum height is the total height + margins, minimum width is the largest width.
[ "Minimum", "height", "is", "the", "total", "height", "+", "margins", "minimum", "width", "is", "the", "largest", "width", "." ]
c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5
https://github.com/idmillington/layout/blob/c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5/layout/managers/directional.py#L82-L94
52,047
idmillington/layout
layout/managers/directional.py
HorizontalLM.get_minimum_size
def get_minimum_size(self, data): """Minimum width is the total width + margins, minimum height is the largest height.""" width = 0 min_height = 0 for element in self.elements: size = element.get_minimum_size(data) min_height = max(min_height, size.y) ...
python
def get_minimum_size(self, data): """Minimum width is the total width + margins, minimum height is the largest height.""" width = 0 min_height = 0 for element in self.elements: size = element.get_minimum_size(data) min_height = max(min_height, size.y) ...
[ "def", "get_minimum_size", "(", "self", ",", "data", ")", ":", "width", "=", "0", "min_height", "=", "0", "for", "element", "in", "self", ".", "elements", ":", "size", "=", "element", ".", "get_minimum_size", "(", "data", ")", "min_height", "=", "max", ...
Minimum width is the total width + margins, minimum height is the largest height.
[ "Minimum", "width", "is", "the", "total", "width", "+", "margins", "minimum", "height", "is", "the", "largest", "height", "." ]
c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5
https://github.com/idmillington/layout/blob/c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5/layout/managers/directional.py#L234-L244
52,048
idmillington/layout
layout/managers/directional.py
EqualColumnsLM.render
def render(self, rect, data): """Draws the columns.""" num_elements = len(self.elements) col_width = (rect.w-self.margin*(num_elements-1)) / float(num_elements) x = rect.x for element in self.elements: if element is not None: element.render(datatypes.R...
python
def render(self, rect, data): """Draws the columns.""" num_elements = len(self.elements) col_width = (rect.w-self.margin*(num_elements-1)) / float(num_elements) x = rect.x for element in self.elements: if element is not None: element.render(datatypes.R...
[ "def", "render", "(", "self", ",", "rect", ",", "data", ")", ":", "num_elements", "=", "len", "(", "self", ".", "elements", ")", "col_width", "=", "(", "rect", ".", "w", "-", "self", ".", "margin", "*", "(", "num_elements", "-", "1", ")", ")", "/...
Draws the columns.
[ "Draws", "the", "columns", "." ]
c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5
https://github.com/idmillington/layout/blob/c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5/layout/managers/directional.py#L333-L343
52,049
idmillington/layout
layout/managers/directional.py
EqualRowsLM.get_minimum_size
def get_minimum_size(self, data): """The minimum height is the number of rows multiplied by the tallest row.""" min_width = 0 min_height = 0 for element in self.elements: size = ( datatypes.Point(0, 0) if element is None else element.ge...
python
def get_minimum_size(self, data): """The minimum height is the number of rows multiplied by the tallest row.""" min_width = 0 min_height = 0 for element in self.elements: size = ( datatypes.Point(0, 0) if element is None else element.ge...
[ "def", "get_minimum_size", "(", "self", ",", "data", ")", ":", "min_width", "=", "0", "min_height", "=", "0", "for", "element", "in", "self", ".", "elements", ":", "size", "=", "(", "datatypes", ".", "Point", "(", "0", ",", "0", ")", "if", "element",...
The minimum height is the number of rows multiplied by the tallest row.
[ "The", "minimum", "height", "is", "the", "number", "of", "rows", "multiplied", "by", "the", "tallest", "row", "." ]
c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5
https://github.com/idmillington/layout/blob/c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5/layout/managers/directional.py#L351-L366
52,050
fusionbox/django-pyscss
django_pyscss/extension/django.py
DjangoExtension.handle_import
def handle_import(self, name, compilation, rule): """ Re-implementation of the core Sass import mechanism, which looks for files using the staticfiles storage and staticfiles finders. """ original_path = PurePath(name) search_exts = list(compilation.compiler.dynamic_exte...
python
def handle_import(self, name, compilation, rule): """ Re-implementation of the core Sass import mechanism, which looks for files using the staticfiles storage and staticfiles finders. """ original_path = PurePath(name) search_exts = list(compilation.compiler.dynamic_exte...
[ "def", "handle_import", "(", "self", ",", "name", ",", "compilation", ",", "rule", ")", ":", "original_path", "=", "PurePath", "(", "name", ")", "search_exts", "=", "list", "(", "compilation", ".", "compiler", ".", "dynamic_extensions", ")", "if", "original_...
Re-implementation of the core Sass import mechanism, which looks for files using the staticfiles storage and staticfiles finders.
[ "Re", "-", "implementation", "of", "the", "core", "Sass", "import", "mechanism", "which", "looks", "for", "files", "using", "the", "staticfiles", "storage", "and", "staticfiles", "finders", "." ]
8baf1e9c78af733d60299c4444c81501e733b434
https://github.com/fusionbox/django-pyscss/blob/8baf1e9c78af733d60299c4444c81501e733b434/django_pyscss/extension/django.py#L17-L47
52,051
stedmeister/easyargs
easyargs/parsers.py
parser_help_text
def parser_help_text(help_text): """Takes the help text supplied as a doc string and extraxts the description and any param arguments.""" if help_text is None: return None, {} main_text = '' params_help = {} for line in help_text.splitlines(): line = line.strip() match ...
python
def parser_help_text(help_text): """Takes the help text supplied as a doc string and extraxts the description and any param arguments.""" if help_text is None: return None, {} main_text = '' params_help = {} for line in help_text.splitlines(): line = line.strip() match ...
[ "def", "parser_help_text", "(", "help_text", ")", ":", "if", "help_text", "is", "None", ":", "return", "None", ",", "{", "}", "main_text", "=", "''", "params_help", "=", "{", "}", "for", "line", "in", "help_text", ".", "splitlines", "(", ")", ":", "lin...
Takes the help text supplied as a doc string and extraxts the description and any param arguments.
[ "Takes", "the", "help", "text", "supplied", "as", "a", "doc", "string", "and", "extraxts", "the", "description", "and", "any", "param", "arguments", "." ]
dd675bcac604abdb15647116f901cd4409ce3d4b
https://github.com/stedmeister/easyargs/blob/dd675bcac604abdb15647116f901cd4409ce3d4b/easyargs/parsers.py#L19-L37
52,052
stedmeister/easyargs
easyargs/parsers.py
calculate_default_type
def calculate_default_type(arg, has_default, default_value, params_help): """This function looks at the default value and returns the type that should be supplied to the parser""" positional = True arg_params = {} arg_name = arg # Check to see if we have help text for this argument try: ...
python
def calculate_default_type(arg, has_default, default_value, params_help): """This function looks at the default value and returns the type that should be supplied to the parser""" positional = True arg_params = {} arg_name = arg # Check to see if we have help text for this argument try: ...
[ "def", "calculate_default_type", "(", "arg", ",", "has_default", ",", "default_value", ",", "params_help", ")", ":", "positional", "=", "True", "arg_params", "=", "{", "}", "arg_name", "=", "arg", "# Check to see if we have help text for this argument", "try", ":", ...
This function looks at the default value and returns the type that should be supplied to the parser
[ "This", "function", "looks", "at", "the", "default", "value", "and", "returns", "the", "type", "that", "should", "be", "supplied", "to", "the", "parser" ]
dd675bcac604abdb15647116f901cd4409ce3d4b
https://github.com/stedmeister/easyargs/blob/dd675bcac604abdb15647116f901cd4409ce3d4b/easyargs/parsers.py#L49-L95
52,053
stedmeister/easyargs
easyargs/parsers.py
function_parser
def function_parser(function, parser): """This function parses a function and adds its arguments to the supplied parser""" # Store the function pointer on the parser for later use parser.set_defaults(func=function) # Get the help text and parse it for params help_text = inspect.getdoc(function) ...
python
def function_parser(function, parser): """This function parses a function and adds its arguments to the supplied parser""" # Store the function pointer on the parser for later use parser.set_defaults(func=function) # Get the help text and parse it for params help_text = inspect.getdoc(function) ...
[ "def", "function_parser", "(", "function", ",", "parser", ")", ":", "# Store the function pointer on the parser for later use", "parser", ".", "set_defaults", "(", "func", "=", "function", ")", "# Get the help text and parse it for params", "help_text", "=", "inspect", ".",...
This function parses a function and adds its arguments to the supplied parser
[ "This", "function", "parses", "a", "function", "and", "adds", "its", "arguments", "to", "the", "supplied", "parser" ]
dd675bcac604abdb15647116f901cd4409ce3d4b
https://github.com/stedmeister/easyargs/blob/dd675bcac604abdb15647116f901cd4409ce3d4b/easyargs/parsers.py#L98-L130
52,054
tkem/uritools
uritools/join.py
urijoin
def urijoin(base, ref, strict=False): """Convert a URI reference relative to a base URI to its target URI string. """ if isinstance(base, type(ref)): return urisplit(base).transform(ref, strict).geturi() elif isinstance(base, bytes): return urisplit(base.decode()).transform(ref, str...
python
def urijoin(base, ref, strict=False): """Convert a URI reference relative to a base URI to its target URI string. """ if isinstance(base, type(ref)): return urisplit(base).transform(ref, strict).geturi() elif isinstance(base, bytes): return urisplit(base.decode()).transform(ref, str...
[ "def", "urijoin", "(", "base", ",", "ref", ",", "strict", "=", "False", ")", ":", "if", "isinstance", "(", "base", ",", "type", "(", "ref", ")", ")", ":", "return", "urisplit", "(", "base", ")", ".", "transform", "(", "ref", ",", "strict", ")", "...
Convert a URI reference relative to a base URI to its target URI string.
[ "Convert", "a", "URI", "reference", "relative", "to", "a", "base", "URI", "to", "its", "target", "URI", "string", "." ]
e77ba4acd937b68da9850138563debd4c925ef9f
https://github.com/tkem/uritools/blob/e77ba4acd937b68da9850138563debd4c925ef9f/uritools/join.py#L4-L14
52,055
tjguk/networkzero
misc/pyconuk2017/robotics/robot/robot.py
Robot.send_response
def send_response(self, response): """Send a unicode object as reply to the most recently-issued command """ response_bytes = response.encode(config.CODEC) log.debug("About to send reponse: %r", response_bytes) self.socket.send(response_bytes)
python
def send_response(self, response): """Send a unicode object as reply to the most recently-issued command """ response_bytes = response.encode(config.CODEC) log.debug("About to send reponse: %r", response_bytes) self.socket.send(response_bytes)
[ "def", "send_response", "(", "self", ",", "response", ")", ":", "response_bytes", "=", "response", ".", "encode", "(", "config", ".", "CODEC", ")", "log", ".", "debug", "(", "\"About to send reponse: %r\"", ",", "response_bytes", ")", "self", ".", "socket", ...
Send a unicode object as reply to the most recently-issued command
[ "Send", "a", "unicode", "object", "as", "reply", "to", "the", "most", "recently", "-", "issued", "command" ]
0e3e81d2e9200b25a83ac07741612283599486d7
https://github.com/tjguk/networkzero/blob/0e3e81d2e9200b25a83ac07741612283599486d7/misc/pyconuk2017/robotics/robot/robot.py#L56-L61
52,056
tjguk/networkzero
misc/pyconuk2017/robotics/robot/robot.py
Robot.parse_command
def parse_command(self, command): """Break a multi word command up into an action and its parameters """ words = shlex.split(command.lower()) return words[0], words[1:]
python
def parse_command(self, command): """Break a multi word command up into an action and its parameters """ words = shlex.split(command.lower()) return words[0], words[1:]
[ "def", "parse_command", "(", "self", ",", "command", ")", ":", "words", "=", "shlex", ".", "split", "(", "command", ".", "lower", "(", ")", ")", "return", "words", "[", "0", "]", ",", "words", "[", "1", ":", "]" ]
Break a multi word command up into an action and its parameters
[ "Break", "a", "multi", "word", "command", "up", "into", "an", "action", "and", "its", "parameters" ]
0e3e81d2e9200b25a83ac07741612283599486d7
https://github.com/tjguk/networkzero/blob/0e3e81d2e9200b25a83ac07741612283599486d7/misc/pyconuk2017/robotics/robot/robot.py#L63-L67
52,057
tjguk/networkzero
misc/pyconuk2017/robotics/robot/robot.py
Robot.dispatch
def dispatch(self, command): """Pass a command along with its params to a suitable handler If the command is blank, succeed silently If the command has no handler, succeed silently If the handler raises an exception, fail with the exception message """ log.info("...
python
def dispatch(self, command): """Pass a command along with its params to a suitable handler If the command is blank, succeed silently If the command has no handler, succeed silently If the handler raises an exception, fail with the exception message """ log.info("...
[ "def", "dispatch", "(", "self", ",", "command", ")", ":", "log", ".", "info", "(", "\"Dispatch on %s\"", ",", "command", ")", "if", "not", "command", ":", "return", "\"OK\"", "action", ",", "params", "=", "self", ".", "parse_command", "(", "command", ")"...
Pass a command along with its params to a suitable handler If the command is blank, succeed silently If the command has no handler, succeed silently If the handler raises an exception, fail with the exception message
[ "Pass", "a", "command", "along", "with", "its", "params", "to", "a", "suitable", "handler", "If", "the", "command", "is", "blank", "succeed", "silently", "If", "the", "command", "has", "no", "handler", "succeed", "silently", "If", "the", "handler", "raises",...
0e3e81d2e9200b25a83ac07741612283599486d7
https://github.com/tjguk/networkzero/blob/0e3e81d2e9200b25a83ac07741612283599486d7/misc/pyconuk2017/robotics/robot/robot.py#L69-L91
52,058
tjguk/networkzero
misc/pyconuk2017/robotics/robot/robot.py
Robot.do_output
def do_output(self, *args): """Pass a command directly to the current output processor """ if args: action, params = args[0], args[1:] log.debug("Pass %s directly to output with %s", action, params) function = getattr(self.output, "do_" + action, None) ...
python
def do_output(self, *args): """Pass a command directly to the current output processor """ if args: action, params = args[0], args[1:] log.debug("Pass %s directly to output with %s", action, params) function = getattr(self.output, "do_" + action, None) ...
[ "def", "do_output", "(", "self", ",", "*", "args", ")", ":", "if", "args", ":", "action", ",", "params", "=", "args", "[", "0", "]", ",", "args", "[", "1", ":", "]", "log", ".", "debug", "(", "\"Pass %s directly to output with %s\"", ",", "action", "...
Pass a command directly to the current output processor
[ "Pass", "a", "command", "directly", "to", "the", "current", "output", "processor" ]
0e3e81d2e9200b25a83ac07741612283599486d7
https://github.com/tjguk/networkzero/blob/0e3e81d2e9200b25a83ac07741612283599486d7/misc/pyconuk2017/robotics/robot/robot.py#L93-L101
52,059
tjguk/networkzero
networkzero/sockets.py
Sockets.intervals_ms
def intervals_ms(self, timeout_ms): """Generate a series of interval lengths, in ms, which will add up to the number of ms in timeout_ms. If timeout_ms is None, keep returning intervals forever. """ if timeout_ms is config.FOREVER: while True: yield se...
python
def intervals_ms(self, timeout_ms): """Generate a series of interval lengths, in ms, which will add up to the number of ms in timeout_ms. If timeout_ms is None, keep returning intervals forever. """ if timeout_ms is config.FOREVER: while True: yield se...
[ "def", "intervals_ms", "(", "self", ",", "timeout_ms", ")", ":", "if", "timeout_ms", "is", "config", ".", "FOREVER", ":", "while", "True", ":", "yield", "self", ".", "try_length_ms", "else", ":", "whole_intervals", ",", "part_interval", "=", "divmod", "(", ...
Generate a series of interval lengths, in ms, which will add up to the number of ms in timeout_ms. If timeout_ms is None, keep returning intervals forever.
[ "Generate", "a", "series", "of", "interval", "lengths", "in", "ms", "which", "will", "add", "up", "to", "the", "number", "of", "ms", "in", "timeout_ms", ".", "If", "timeout_ms", "is", "None", "keep", "returning", "intervals", "forever", "." ]
0e3e81d2e9200b25a83ac07741612283599486d7
https://github.com/tjguk/networkzero/blob/0e3e81d2e9200b25a83ac07741612283599486d7/networkzero/sockets.py#L190-L202
52,060
tjguk/networkzero
networkzero/sockets.py
Sockets._receive_with_timeout
def _receive_with_timeout(self, socket, timeout_s, use_multipart=False): """Check for socket activity and either return what's received on the socket or time out if timeout_s expires without anything on the socket. This is implemented in loops of self.try_length_ms milliseconds ...
python
def _receive_with_timeout(self, socket, timeout_s, use_multipart=False): """Check for socket activity and either return what's received on the socket or time out if timeout_s expires without anything on the socket. This is implemented in loops of self.try_length_ms milliseconds ...
[ "def", "_receive_with_timeout", "(", "self", ",", "socket", ",", "timeout_s", ",", "use_multipart", "=", "False", ")", ":", "if", "timeout_s", "is", "config", ".", "FOREVER", ":", "timeout_ms", "=", "config", ".", "FOREVER", "else", ":", "timeout_ms", "=", ...
Check for socket activity and either return what's received on the socket or time out if timeout_s expires without anything on the socket. This is implemented in loops of self.try_length_ms milliseconds to allow Ctrl-C handling to take place.
[ "Check", "for", "socket", "activity", "and", "either", "return", "what", "s", "received", "on", "the", "socket", "or", "time", "out", "if", "timeout_s", "expires", "without", "anything", "on", "the", "socket", ".", "This", "is", "implemented", "in", "loops",...
0e3e81d2e9200b25a83ac07741612283599486d7
https://github.com/tjguk/networkzero/blob/0e3e81d2e9200b25a83ac07741612283599486d7/networkzero/sockets.py#L204-L232
52,061
phn/lineid_plot
lineid_plot/utils.py
get_labels
def get_labels(labels): """Create unique labels.""" label_u = unique_labels(labels) label_u_line = [i + "_line" for i in label_u] return label_u, label_u_line
python
def get_labels(labels): """Create unique labels.""" label_u = unique_labels(labels) label_u_line = [i + "_line" for i in label_u] return label_u, label_u_line
[ "def", "get_labels", "(", "labels", ")", ":", "label_u", "=", "unique_labels", "(", "labels", ")", "label_u_line", "=", "[", "i", "+", "\"_line\"", "for", "i", "in", "label_u", "]", "return", "label_u", ",", "label_u_line" ]
Create unique labels.
[ "Create", "unique", "labels", "." ]
7c7a1af53fe439b3a7c5a57f01680575837fb978
https://github.com/phn/lineid_plot/blob/7c7a1af53fe439b3a7c5a57f01680575837fb978/lineid_plot/utils.py#L7-L11
52,062
phn/lineid_plot
lineid_plot/utils.py
get_boxes_and_lines
def get_boxes_and_lines(ax, labels): """Get boxes and lines using labels as id.""" labels_u, labels_u_line = get_labels(labels) boxes = ax.findobj(mpl.text.Annotation) lines = ax.findobj(mpl.lines.Line2D) lineid_boxes = [] lineid_lines = [] for box in boxes: l = box.get_label() ...
python
def get_boxes_and_lines(ax, labels): """Get boxes and lines using labels as id.""" labels_u, labels_u_line = get_labels(labels) boxes = ax.findobj(mpl.text.Annotation) lines = ax.findobj(mpl.lines.Line2D) lineid_boxes = [] lineid_lines = [] for box in boxes: l = box.get_label() ...
[ "def", "get_boxes_and_lines", "(", "ax", ",", "labels", ")", ":", "labels_u", ",", "labels_u_line", "=", "get_labels", "(", "labels", ")", "boxes", "=", "ax", ".", "findobj", "(", "mpl", ".", "text", ".", "Annotation", ")", "lines", "=", "ax", ".", "fi...
Get boxes and lines using labels as id.
[ "Get", "boxes", "and", "lines", "using", "labels", "as", "id", "." ]
7c7a1af53fe439b3a7c5a57f01680575837fb978
https://github.com/phn/lineid_plot/blob/7c7a1af53fe439b3a7c5a57f01680575837fb978/lineid_plot/utils.py#L14-L40
52,063
phn/lineid_plot
lineid_plot/utils.py
color_text_boxes
def color_text_boxes(ax, labels, colors, color_arrow=True): """Color text boxes. Instead of this function, one can pass annotate_kwargs and plot_kwargs to plot_line_ids function. """ assert len(labels) == len(colors), \ "Equal no. of colors and lables must be given" boxes = ax.findobj(m...
python
def color_text_boxes(ax, labels, colors, color_arrow=True): """Color text boxes. Instead of this function, one can pass annotate_kwargs and plot_kwargs to plot_line_ids function. """ assert len(labels) == len(colors), \ "Equal no. of colors and lables must be given" boxes = ax.findobj(m...
[ "def", "color_text_boxes", "(", "ax", ",", "labels", ",", "colors", ",", "color_arrow", "=", "True", ")", ":", "assert", "len", "(", "labels", ")", "==", "len", "(", "colors", ")", ",", "\"Equal no. of colors and lables must be given\"", "boxes", "=", "ax", ...
Color text boxes. Instead of this function, one can pass annotate_kwargs and plot_kwargs to plot_line_ids function.
[ "Color", "text", "boxes", "." ]
7c7a1af53fe439b3a7c5a57f01680575837fb978
https://github.com/phn/lineid_plot/blob/7c7a1af53fe439b3a7c5a57f01680575837fb978/lineid_plot/utils.py#L43-L63
52,064
phn/lineid_plot
lineid_plot/utils.py
color_lines
def color_lines(ax, labels, colors): """Color lines. Instead of this function, one can pass annotate_kwargs and plot_kwargs to plot_line_ids function. """ assert len(labels) == len(colors), \ "Equal no. of colors and lables must be given" lines = ax.findobj(mpl.lines.Line2D) line_la...
python
def color_lines(ax, labels, colors): """Color lines. Instead of this function, one can pass annotate_kwargs and plot_kwargs to plot_line_ids function. """ assert len(labels) == len(colors), \ "Equal no. of colors and lables must be given" lines = ax.findobj(mpl.lines.Line2D) line_la...
[ "def", "color_lines", "(", "ax", ",", "labels", ",", "colors", ")", ":", "assert", "len", "(", "labels", ")", "==", "len", "(", "colors", ")", ",", "\"Equal no. of colors and lables must be given\"", "lines", "=", "ax", ".", "findobj", "(", "mpl", ".", "li...
Color lines. Instead of this function, one can pass annotate_kwargs and plot_kwargs to plot_line_ids function.
[ "Color", "lines", "." ]
7c7a1af53fe439b3a7c5a57f01680575837fb978
https://github.com/phn/lineid_plot/blob/7c7a1af53fe439b3a7c5a57f01680575837fb978/lineid_plot/utils.py#L66-L84
52,065
project-generator/project_generator_definitions
project_generator_definitions/definitions.py
ProGenDef.get_tool_definition
def get_tool_definition(self, target): """ Returns tool specific dic or None if it does not exist for defined tool """ if target not in self.targets_mcu_list: logging.debug("Target not found in definitions") return None mcu_record = self.targets.get_mcu_record(target) if ...
python
def get_tool_definition(self, target): """ Returns tool specific dic or None if it does not exist for defined tool """ if target not in self.targets_mcu_list: logging.debug("Target not found in definitions") return None mcu_record = self.targets.get_mcu_record(target) if ...
[ "def", "get_tool_definition", "(", "self", ",", "target", ")", ":", "if", "target", "not", "in", "self", ".", "targets_mcu_list", ":", "logging", ".", "debug", "(", "\"Target not found in definitions\"", ")", "return", "None", "mcu_record", "=", "self", ".", "...
Returns tool specific dic or None if it does not exist for defined tool
[ "Returns", "tool", "specific", "dic", "or", "None", "if", "it", "does", "not", "exist", "for", "defined", "tool" ]
22f138496d5a6e4812c4170e47f065eefa507d13
https://github.com/project-generator/project_generator_definitions/blob/22f138496d5a6e4812c4170e47f065eefa507d13/project_generator_definitions/definitions.py#L113-L122
52,066
project-generator/project_generator_definitions
project_generator_definitions/definitions.py
ProGenDef.is_supported
def is_supported(self, target): """ Returns True if target is supported by definitions """ if target.lower() not in self.targets_mcu_list: logging.debug("Target not found in definitions") return False mcu_record = self.targets.get_mcu_record(target) if self.mcus.get_mcu_r...
python
def is_supported(self, target): """ Returns True if target is supported by definitions """ if target.lower() not in self.targets_mcu_list: logging.debug("Target not found in definitions") return False mcu_record = self.targets.get_mcu_record(target) if self.mcus.get_mcu_r...
[ "def", "is_supported", "(", "self", ",", "target", ")", ":", "if", "target", ".", "lower", "(", ")", "not", "in", "self", ".", "targets_mcu_list", ":", "logging", ".", "debug", "(", "\"Target not found in definitions\"", ")", "return", "False", "mcu_record", ...
Returns True if target is supported by definitions
[ "Returns", "True", "if", "target", "is", "supported", "by", "definitions" ]
22f138496d5a6e4812c4170e47f065eefa507d13
https://github.com/project-generator/project_generator_definitions/blob/22f138496d5a6e4812c4170e47f065eefa507d13/project_generator_definitions/definitions.py#L124-L143
52,067
bitprophet/lexicon
lexicon/alias_dict.py
AliasDict.aliases_of
def aliases_of(self, name): """ Returns other names for given real key or alias ``name``. If given a real key, returns its aliases. If given an alias, returns the real key it points to, plus any other aliases of that real key. (The given alias itself is not included in ...
python
def aliases_of(self, name): """ Returns other names for given real key or alias ``name``. If given a real key, returns its aliases. If given an alias, returns the real key it points to, plus any other aliases of that real key. (The given alias itself is not included in ...
[ "def", "aliases_of", "(", "self", ",", "name", ")", ":", "names", "=", "[", "]", "key", "=", "name", "# self.aliases keys are aliases, not realkeys. Easy test to see if we", "# should flip around to the POV of a realkey when given an alias.", "if", "name", "in", "self", "."...
Returns other names for given real key or alias ``name``. If given a real key, returns its aliases. If given an alias, returns the real key it points to, plus any other aliases of that real key. (The given alias itself is not included in the return value.)
[ "Returns", "other", "names", "for", "given", "real", "key", "or", "alias", "name", "." ]
26d53f476d4481374685fc2454a2a0bc81f5621f
https://github.com/bitprophet/lexicon/blob/26d53f476d4481374685fc2454a2a0bc81f5621f/lexicon/alias_dict.py#L20-L45
52,068
tkem/uritools
uritools/defrag.py
uridefrag
def uridefrag(uristring): """Remove an existing fragment component from a URI reference string. """ if isinstance(uristring, bytes): parts = uristring.partition(b'#') else: parts = uristring.partition(u'#') return DefragResult(parts[0], parts[2] if parts[1] else None)
python
def uridefrag(uristring): """Remove an existing fragment component from a URI reference string. """ if isinstance(uristring, bytes): parts = uristring.partition(b'#') else: parts = uristring.partition(u'#') return DefragResult(parts[0], parts[2] if parts[1] else None)
[ "def", "uridefrag", "(", "uristring", ")", ":", "if", "isinstance", "(", "uristring", ",", "bytes", ")", ":", "parts", "=", "uristring", ".", "partition", "(", "b'#'", ")", "else", ":", "parts", "=", "uristring", ".", "partition", "(", "u'#'", ")", "re...
Remove an existing fragment component from a URI reference string.
[ "Remove", "an", "existing", "fragment", "component", "from", "a", "URI", "reference", "string", "." ]
e77ba4acd937b68da9850138563debd4c925ef9f
https://github.com/tkem/uritools/blob/e77ba4acd937b68da9850138563debd4c925ef9f/uritools/defrag.py#L33-L41
52,069
tkem/uritools
uritools/defrag.py
DefragResult.geturi
def geturi(self): """Return the recombined version of the original URI as a string.""" fragment = self.fragment if fragment is None: return self.uri elif isinstance(fragment, bytes): return self.uri + b'#' + fragment else: return self.uri + u'#...
python
def geturi(self): """Return the recombined version of the original URI as a string.""" fragment = self.fragment if fragment is None: return self.uri elif isinstance(fragment, bytes): return self.uri + b'#' + fragment else: return self.uri + u'#...
[ "def", "geturi", "(", "self", ")", ":", "fragment", "=", "self", ".", "fragment", "if", "fragment", "is", "None", ":", "return", "self", ".", "uri", "elif", "isinstance", "(", "fragment", ",", "bytes", ")", ":", "return", "self", ".", "uri", "+", "b'...
Return the recombined version of the original URI as a string.
[ "Return", "the", "recombined", "version", "of", "the", "original", "URI", "as", "a", "string", "." ]
e77ba4acd937b68da9850138563debd4c925ef9f
https://github.com/tkem/uritools/blob/e77ba4acd937b68da9850138563debd4c925ef9f/uritools/defrag.py#L11-L19
52,070
tkem/uritools
uritools/defrag.py
DefragResult.getfragment
def getfragment(self, default=None, encoding='utf-8', errors='strict'): """Return the decoded fragment identifier, or `default` if the original URI did not contain a fragment component. """ fragment = self.fragment if fragment is not None: return uridecode(fragment, ...
python
def getfragment(self, default=None, encoding='utf-8', errors='strict'): """Return the decoded fragment identifier, or `default` if the original URI did not contain a fragment component. """ fragment = self.fragment if fragment is not None: return uridecode(fragment, ...
[ "def", "getfragment", "(", "self", ",", "default", "=", "None", ",", "encoding", "=", "'utf-8'", ",", "errors", "=", "'strict'", ")", ":", "fragment", "=", "self", ".", "fragment", "if", "fragment", "is", "not", "None", ":", "return", "uridecode", "(", ...
Return the decoded fragment identifier, or `default` if the original URI did not contain a fragment component.
[ "Return", "the", "decoded", "fragment", "identifier", "or", "default", "if", "the", "original", "URI", "did", "not", "contain", "a", "fragment", "component", "." ]
e77ba4acd937b68da9850138563debd4c925ef9f
https://github.com/tkem/uritools/blob/e77ba4acd937b68da9850138563debd4c925ef9f/uritools/defrag.py#L21-L30
52,071
Projectplace/basepage
basepage/base_page.py
BasePage.click
def click(self, locator, params=None, timeout=None): """ Click web element. :param locator: locator tuple or WebElement instance :param params: (optional) locator parameters :param timeout: (optional) time to wait for element :return: None """ self._click...
python
def click(self, locator, params=None, timeout=None): """ Click web element. :param locator: locator tuple or WebElement instance :param params: (optional) locator parameters :param timeout: (optional) time to wait for element :return: None """ self._click...
[ "def", "click", "(", "self", ",", "locator", ",", "params", "=", "None", ",", "timeout", "=", "None", ")", ":", "self", ".", "_click", "(", "locator", ",", "params", ",", "timeout", ")" ]
Click web element. :param locator: locator tuple or WebElement instance :param params: (optional) locator parameters :param timeout: (optional) time to wait for element :return: None
[ "Click", "web", "element", "." ]
735476877eb100db0981590a6d12140e68652167
https://github.com/Projectplace/basepage/blob/735476877eb100db0981590a6d12140e68652167/basepage/base_page.py#L59-L68
52,072
Projectplace/basepage
basepage/base_page.py
BasePage.alt_click
def alt_click(self, locator, params=None, timeout=None): """ Alt-click web element. :param locator: locator tuple or WebElement instance :param params: (optional) locator parameters :param timeout: (optional) time to wait for element :return: None """ sel...
python
def alt_click(self, locator, params=None, timeout=None): """ Alt-click web element. :param locator: locator tuple or WebElement instance :param params: (optional) locator parameters :param timeout: (optional) time to wait for element :return: None """ sel...
[ "def", "alt_click", "(", "self", ",", "locator", ",", "params", "=", "None", ",", "timeout", "=", "None", ")", ":", "self", ".", "_click", "(", "locator", ",", "params", ",", "timeout", ",", "Keys", ".", "ALT", ")" ]
Alt-click web element. :param locator: locator tuple or WebElement instance :param params: (optional) locator parameters :param timeout: (optional) time to wait for element :return: None
[ "Alt", "-", "click", "web", "element", "." ]
735476877eb100db0981590a6d12140e68652167
https://github.com/Projectplace/basepage/blob/735476877eb100db0981590a6d12140e68652167/basepage/base_page.py#L70-L79
52,073
Projectplace/basepage
basepage/base_page.py
BasePage.shift_click
def shift_click(self, locator, params=None, timeout=None): """ Shift-click web element. :param locator: locator tuple or WebElement instance :param params: (optional) locator parameters :param timeout: (optional) time to wait for element :return: None """ ...
python
def shift_click(self, locator, params=None, timeout=None): """ Shift-click web element. :param locator: locator tuple or WebElement instance :param params: (optional) locator parameters :param timeout: (optional) time to wait for element :return: None """ ...
[ "def", "shift_click", "(", "self", ",", "locator", ",", "params", "=", "None", ",", "timeout", "=", "None", ")", ":", "self", ".", "_click", "(", "locator", ",", "params", ",", "timeout", ",", "Keys", ".", "SHIFT", ")" ]
Shift-click web element. :param locator: locator tuple or WebElement instance :param params: (optional) locator parameters :param timeout: (optional) time to wait for element :return: None
[ "Shift", "-", "click", "web", "element", "." ]
735476877eb100db0981590a6d12140e68652167
https://github.com/Projectplace/basepage/blob/735476877eb100db0981590a6d12140e68652167/basepage/base_page.py#L81-L90
52,074
Projectplace/basepage
basepage/base_page.py
BasePage.multi_click
def multi_click(self, locator, params=None, timeout=None): """ Presses left control or command button depending on OS, clicks and then releases control or command key. :param locator: locator tuple or WebElement instance :param params: (optional) locator parameters :param timeou...
python
def multi_click(self, locator, params=None, timeout=None): """ Presses left control or command button depending on OS, clicks and then releases control or command key. :param locator: locator tuple or WebElement instance :param params: (optional) locator parameters :param timeou...
[ "def", "multi_click", "(", "self", ",", "locator", ",", "params", "=", "None", ",", "timeout", "=", "None", ")", ":", "platform", "=", "self", ".", "execute_script", "(", "'return navigator.platform'", ")", "multi_key", "=", "Keys", ".", "COMMAND", "if", "...
Presses left control or command button depending on OS, clicks and then releases control or command key. :param locator: locator tuple or WebElement instance :param params: (optional) locator parameters :param timeout: (optional) time to wait for element :return: None
[ "Presses", "left", "control", "or", "command", "button", "depending", "on", "OS", "clicks", "and", "then", "releases", "control", "or", "command", "key", "." ]
735476877eb100db0981590a6d12140e68652167
https://github.com/Projectplace/basepage/blob/735476877eb100db0981590a6d12140e68652167/basepage/base_page.py#L92-L103
52,075
Projectplace/basepage
basepage/base_page.py
BasePage.shift_select
def shift_select(self, first_element, last_element): """ Clicks a web element and shift clicks another web element. :param first_element: WebElement instance :param last_element: WebElement instance :return: None """ self.click(first_element) self.shift_c...
python
def shift_select(self, first_element, last_element): """ Clicks a web element and shift clicks another web element. :param first_element: WebElement instance :param last_element: WebElement instance :return: None """ self.click(first_element) self.shift_c...
[ "def", "shift_select", "(", "self", ",", "first_element", ",", "last_element", ")", ":", "self", ".", "click", "(", "first_element", ")", "self", ".", "shift_click", "(", "last_element", ")" ]
Clicks a web element and shift clicks another web element. :param first_element: WebElement instance :param last_element: WebElement instance :return: None
[ "Clicks", "a", "web", "element", "and", "shift", "clicks", "another", "web", "element", "." ]
735476877eb100db0981590a6d12140e68652167
https://github.com/Projectplace/basepage/blob/735476877eb100db0981590a6d12140e68652167/basepage/base_page.py#L115-L124
52,076
Projectplace/basepage
basepage/base_page.py
BasePage.multi_select
def multi_select(self, elements_to_select): """ Multi-select any number of elements. :param elements_to_select: list of WebElement instances :return: None """ # Click the first element first_element = elements_to_select.pop() self.click(first_element) ...
python
def multi_select(self, elements_to_select): """ Multi-select any number of elements. :param elements_to_select: list of WebElement instances :return: None """ # Click the first element first_element = elements_to_select.pop() self.click(first_element) ...
[ "def", "multi_select", "(", "self", ",", "elements_to_select", ")", ":", "# Click the first element", "first_element", "=", "elements_to_select", ".", "pop", "(", ")", "self", ".", "click", "(", "first_element", ")", "# Click the rest", "for", "index", ",", "eleme...
Multi-select any number of elements. :param elements_to_select: list of WebElement instances :return: None
[ "Multi", "-", "select", "any", "number", "of", "elements", "." ]
735476877eb100db0981590a6d12140e68652167
https://github.com/Projectplace/basepage/blob/735476877eb100db0981590a6d12140e68652167/basepage/base_page.py#L126-L139
52,077
Projectplace/basepage
basepage/base_page.py
BasePage.select_from_drop_down_by_value
def select_from_drop_down_by_value(self, locator, value, params=None): """ Select option from drop down widget using value. :param locator: locator tuple or WebElement instance :param value: string :param params: (optional) locator parameters :return: None """ ...
python
def select_from_drop_down_by_value(self, locator, value, params=None): """ Select option from drop down widget using value. :param locator: locator tuple or WebElement instance :param value: string :param params: (optional) locator parameters :return: None """ ...
[ "def", "select_from_drop_down_by_value", "(", "self", ",", "locator", ",", "value", ",", "params", "=", "None", ")", ":", "from", "selenium", ".", "webdriver", ".", "support", ".", "ui", "import", "Select", "element", "=", "locator", "if", "not", "isinstance...
Select option from drop down widget using value. :param locator: locator tuple or WebElement instance :param value: string :param params: (optional) locator parameters :return: None
[ "Select", "option", "from", "drop", "down", "widget", "using", "value", "." ]
735476877eb100db0981590a6d12140e68652167
https://github.com/Projectplace/basepage/blob/735476877eb100db0981590a6d12140e68652167/basepage/base_page.py#L141-L156
52,078
Projectplace/basepage
basepage/base_page.py
BasePage.select_from_drop_down_by_text
def select_from_drop_down_by_text(self, drop_down_locator, option_locator, option_text, params=None): """ Select option from drop down widget using text. :param drop_down_locator: locator tuple (if any, params needs to be in place) or WebElement instance :param option_locator: locator t...
python
def select_from_drop_down_by_text(self, drop_down_locator, option_locator, option_text, params=None): """ Select option from drop down widget using text. :param drop_down_locator: locator tuple (if any, params needs to be in place) or WebElement instance :param option_locator: locator t...
[ "def", "select_from_drop_down_by_text", "(", "self", ",", "drop_down_locator", ",", "option_locator", ",", "option_text", ",", "params", "=", "None", ")", ":", "# Open/activate drop down", "self", ".", "click", "(", "drop_down_locator", ",", "params", "[", "'drop_do...
Select option from drop down widget using text. :param drop_down_locator: locator tuple (if any, params needs to be in place) or WebElement instance :param option_locator: locator tuple (if any, params needs to be in place) :param option_text: text to base option selection on :param par...
[ "Select", "option", "from", "drop", "down", "widget", "using", "text", "." ]
735476877eb100db0981590a6d12140e68652167
https://github.com/Projectplace/basepage/blob/735476877eb100db0981590a6d12140e68652167/basepage/base_page.py#L158-L175
52,079
Projectplace/basepage
basepage/base_page.py
BasePage.select_from_drop_down_by_locator
def select_from_drop_down_by_locator(self, drop_down_locator, option_locator, params=None): """ Select option from drop down widget using locator. :param drop_down_locator: locator tuple or WebElement instance :param option_locator: locator tuple or WebElement instance :param pa...
python
def select_from_drop_down_by_locator(self, drop_down_locator, option_locator, params=None): """ Select option from drop down widget using locator. :param drop_down_locator: locator tuple or WebElement instance :param option_locator: locator tuple or WebElement instance :param pa...
[ "def", "select_from_drop_down_by_locator", "(", "self", ",", "drop_down_locator", ",", "option_locator", ",", "params", "=", "None", ")", ":", "# Open/activate drop down", "self", ".", "click", "(", "drop_down_locator", ",", "params", "[", "'drop_down'", "]", "if", ...
Select option from drop down widget using locator. :param drop_down_locator: locator tuple or WebElement instance :param option_locator: locator tuple or WebElement instance :param params: Dictionary containing dictionary of params :return: None
[ "Select", "option", "from", "drop", "down", "widget", "using", "locator", "." ]
735476877eb100db0981590a6d12140e68652167
https://github.com/Projectplace/basepage/blob/735476877eb100db0981590a6d12140e68652167/basepage/base_page.py#L177-L190
52,080
Projectplace/basepage
basepage/base_page.py
BasePage.get_attribute
def get_attribute(self, locator, attribute, params=None, timeout=None, visible=False): """ Get attribute from element based on locator with optional parameters. Calls get_element() with expected condition: visibility of element located :param locator: locator tuple or WebElement instan...
python
def get_attribute(self, locator, attribute, params=None, timeout=None, visible=False): """ Get attribute from element based on locator with optional parameters. Calls get_element() with expected condition: visibility of element located :param locator: locator tuple or WebElement instan...
[ "def", "get_attribute", "(", "self", ",", "locator", ",", "attribute", ",", "params", "=", "None", ",", "timeout", "=", "None", ",", "visible", "=", "False", ")", ":", "element", "=", "locator", "if", "not", "isinstance", "(", "element", ",", "WebElement...
Get attribute from element based on locator with optional parameters. Calls get_element() with expected condition: visibility of element located :param locator: locator tuple or WebElement instance :param attribute: attribute to return :param params: (optional) locator parameters ...
[ "Get", "attribute", "from", "element", "based", "on", "locator", "with", "optional", "parameters", "." ]
735476877eb100db0981590a6d12140e68652167
https://github.com/Projectplace/basepage/blob/735476877eb100db0981590a6d12140e68652167/basepage/base_page.py#L192-L213
52,081
Projectplace/basepage
basepage/base_page.py
BasePage.get_text
def get_text(self, locator, params=None, timeout=None, visible=True): """ Get text or value from element based on locator with optional parameters. :param locator: element identifier :param params: (optional) locator parameters :param timeout: (optional) time to wait for text (d...
python
def get_text(self, locator, params=None, timeout=None, visible=True): """ Get text or value from element based on locator with optional parameters. :param locator: element identifier :param params: (optional) locator parameters :param timeout: (optional) time to wait for text (d...
[ "def", "get_text", "(", "self", ",", "locator", ",", "params", "=", "None", ",", "timeout", "=", "None", ",", "visible", "=", "True", ")", ":", "element", "=", "locator", "if", "not", "isinstance", "(", "element", ",", "WebElement", ")", ":", "element"...
Get text or value from element based on locator with optional parameters. :param locator: element identifier :param params: (optional) locator parameters :param timeout: (optional) time to wait for text (default: None) :param visible: should element be visible before getting text (defau...
[ "Get", "text", "or", "value", "from", "element", "based", "on", "locator", "with", "optional", "parameters", "." ]
735476877eb100db0981590a6d12140e68652167
https://github.com/Projectplace/basepage/blob/735476877eb100db0981590a6d12140e68652167/basepage/base_page.py#L215-L235
52,082
Projectplace/basepage
basepage/base_page.py
BasePage.enter_text
def enter_text(self, locator, text, with_click=True, with_clear=False, with_enter=False, params=None): """ Enter text into a web element. :param locator: locator tuple or WebElement instance :param text: text to input :param with_click: clicks the input field :param with...
python
def enter_text(self, locator, text, with_click=True, with_clear=False, with_enter=False, params=None): """ Enter text into a web element. :param locator: locator tuple or WebElement instance :param text: text to input :param with_click: clicks the input field :param with...
[ "def", "enter_text", "(", "self", ",", "locator", ",", "text", ",", "with_click", "=", "True", ",", "with_clear", "=", "False", ",", "with_enter", "=", "False", ",", "params", "=", "None", ")", ":", "element", "=", "locator", "if", "not", "isinstance", ...
Enter text into a web element. :param locator: locator tuple or WebElement instance :param text: text to input :param with_click: clicks the input field :param with_clear: clears the input field :param with_enter: hits enter-key after text input :param params: (optional)...
[ "Enter", "text", "into", "a", "web", "element", "." ]
735476877eb100db0981590a6d12140e68652167
https://github.com/Projectplace/basepage/blob/735476877eb100db0981590a6d12140e68652167/basepage/base_page.py#L237-L271
52,083
Projectplace/basepage
basepage/base_page.py
BasePage.erase_text
def erase_text(self, locator, click=True, clear=False, backspace=0, params=None): """ Various ways to erase text from web element. :param locator: locator tuple or WebElement instance :param click: clicks the input field :param clear: clears the input field :param backsp...
python
def erase_text(self, locator, click=True, clear=False, backspace=0, params=None): """ Various ways to erase text from web element. :param locator: locator tuple or WebElement instance :param click: clicks the input field :param clear: clears the input field :param backsp...
[ "def", "erase_text", "(", "self", ",", "locator", ",", "click", "=", "True", ",", "clear", "=", "False", ",", "backspace", "=", "0", ",", "params", "=", "None", ")", ":", "element", "=", "locator", "if", "not", "isinstance", "(", "element", ",", "Web...
Various ways to erase text from web element. :param locator: locator tuple or WebElement instance :param click: clicks the input field :param clear: clears the input field :param backspace: how many times to hit backspace :param params: (optional) locator params :return:...
[ "Various", "ways", "to", "erase", "text", "from", "web", "element", "." ]
735476877eb100db0981590a6d12140e68652167
https://github.com/Projectplace/basepage/blob/735476877eb100db0981590a6d12140e68652167/basepage/base_page.py#L293-L318
52,084
Projectplace/basepage
basepage/base_page.py
BasePage.drag_and_drop
def drag_and_drop(self, source_element, target_element, params=None): """ Drag source element and drop at target element. Note: Target can either be a WebElement or a list with x- and y-coordinates (integers) :param source_element: WebElement instance :param target_element: Web...
python
def drag_and_drop(self, source_element, target_element, params=None): """ Drag source element and drop at target element. Note: Target can either be a WebElement or a list with x- and y-coordinates (integers) :param source_element: WebElement instance :param target_element: Web...
[ "def", "drag_and_drop", "(", "self", ",", "source_element", ",", "target_element", ",", "params", "=", "None", ")", ":", "if", "not", "isinstance", "(", "source_element", ",", "WebElement", ")", ":", "source_element", "=", "self", ".", "get_visible_element", "...
Drag source element and drop at target element. Note: Target can either be a WebElement or a list with x- and y-coordinates (integers) :param source_element: WebElement instance :param target_element: WebElement instance or list of x- and y-coordinates :param params: Dictionary contain...
[ "Drag", "source", "element", "and", "drop", "at", "target", "element", "." ]
735476877eb100db0981590a6d12140e68652167
https://github.com/Projectplace/basepage/blob/735476877eb100db0981590a6d12140e68652167/basepage/base_page.py#L320-L342
52,085
Projectplace/basepage
basepage/base_page.py
BasePage.get_present_element
def get_present_element(self, locator, params=None, timeout=None, visible=False, parent=None): """ Get element present in the DOM. If timeout is 0 (zero) return WebElement instance or None, else we wait and retry for timeout and raise TimeoutException should the element not be found. ...
python
def get_present_element(self, locator, params=None, timeout=None, visible=False, parent=None): """ Get element present in the DOM. If timeout is 0 (zero) return WebElement instance or None, else we wait and retry for timeout and raise TimeoutException should the element not be found. ...
[ "def", "get_present_element", "(", "self", ",", "locator", ",", "params", "=", "None", ",", "timeout", "=", "None", ",", "visible", "=", "False", ",", "parent", "=", "None", ")", ":", "error_msg", "=", "\"Child was never present\"", "if", "parent", "else", ...
Get element present in the DOM. If timeout is 0 (zero) return WebElement instance or None, else we wait and retry for timeout and raise TimeoutException should the element not be found. :param locator: element identifier :param params: (optional) locator parameters :param timeo...
[ "Get", "element", "present", "in", "the", "DOM", "." ]
735476877eb100db0981590a6d12140e68652167
https://github.com/Projectplace/basepage/blob/735476877eb100db0981590a6d12140e68652167/basepage/base_page.py#L400-L416
52,086
Projectplace/basepage
basepage/base_page.py
BasePage.get_visible_element
def get_visible_element(self, locator, params=None, timeout=None): """ Get element both present AND visible in the DOM. If timeout is 0 (zero) return WebElement instance or None, else we wait and retry for timeout and raise TimeoutException should the element not be found. :par...
python
def get_visible_element(self, locator, params=None, timeout=None): """ Get element both present AND visible in the DOM. If timeout is 0 (zero) return WebElement instance or None, else we wait and retry for timeout and raise TimeoutException should the element not be found. :par...
[ "def", "get_visible_element", "(", "self", ",", "locator", ",", "params", "=", "None", ",", "timeout", "=", "None", ")", ":", "return", "self", ".", "get_present_element", "(", "locator", ",", "params", ",", "timeout", ",", "True", ")" ]
Get element both present AND visible in the DOM. If timeout is 0 (zero) return WebElement instance or None, else we wait and retry for timeout and raise TimeoutException should the element not be found. :param locator: locator tuple :param params: (optional) locator params :par...
[ "Get", "element", "both", "present", "AND", "visible", "in", "the", "DOM", "." ]
735476877eb100db0981590a6d12140e68652167
https://github.com/Projectplace/basepage/blob/735476877eb100db0981590a6d12140e68652167/basepage/base_page.py#L418-L430
52,087
Projectplace/basepage
basepage/base_page.py
BasePage.get_present_elements
def get_present_elements(self, locator, params=None, timeout=None, visible=False, parent=None): """ Get elements present in the DOM. If timeout is 0 (zero) return WebElement instance or None, else we wait and retry for timeout and raise TimeoutException should the element not be found. ...
python
def get_present_elements(self, locator, params=None, timeout=None, visible=False, parent=None): """ Get elements present in the DOM. If timeout is 0 (zero) return WebElement instance or None, else we wait and retry for timeout and raise TimeoutException should the element not be found. ...
[ "def", "get_present_elements", "(", "self", ",", "locator", ",", "params", "=", "None", ",", "timeout", "=", "None", ",", "visible", "=", "False", ",", "parent", "=", "None", ")", ":", "error_msg", "=", "\"Children were never present\"", "if", "parent", "els...
Get elements present in the DOM. If timeout is 0 (zero) return WebElement instance or None, else we wait and retry for timeout and raise TimeoutException should the element not be found. :param locator: element identifier :param params: (optional) locator parameters :param time...
[ "Get", "elements", "present", "in", "the", "DOM", "." ]
735476877eb100db0981590a6d12140e68652167
https://github.com/Projectplace/basepage/blob/735476877eb100db0981590a6d12140e68652167/basepage/base_page.py#L432-L448
52,088
Projectplace/basepage
basepage/base_page.py
BasePage.get_visible_elements
def get_visible_elements(self, locator, params=None, timeout=None): """ Get elements both present AND visible in the DOM. If timeout is 0 (zero) return WebElement instance or None, else we wait and retry for timeout and raise TimeoutException should the element not be found. :p...
python
def get_visible_elements(self, locator, params=None, timeout=None): """ Get elements both present AND visible in the DOM. If timeout is 0 (zero) return WebElement instance or None, else we wait and retry for timeout and raise TimeoutException should the element not be found. :p...
[ "def", "get_visible_elements", "(", "self", ",", "locator", ",", "params", "=", "None", ",", "timeout", "=", "None", ")", ":", "return", "self", ".", "get_present_elements", "(", "locator", ",", "params", ",", "timeout", ",", "True", ")" ]
Get elements both present AND visible in the DOM. If timeout is 0 (zero) return WebElement instance or None, else we wait and retry for timeout and raise TimeoutException should the element not be found. :param locator: locator tuple :param params: (optional) locator params :pa...
[ "Get", "elements", "both", "present", "AND", "visible", "in", "the", "DOM", "." ]
735476877eb100db0981590a6d12140e68652167
https://github.com/Projectplace/basepage/blob/735476877eb100db0981590a6d12140e68652167/basepage/base_page.py#L450-L462
52,089
Projectplace/basepage
basepage/base_page.py
BasePage.get_present_child
def get_present_child(self, parent, locator, params=None, timeout=None, visible=False): """ Get child-element present in the DOM. If timeout is 0 (zero) return WebElement instance or None, else we wait and retry for timeout and raise TimeoutException should the element not be found. ...
python
def get_present_child(self, parent, locator, params=None, timeout=None, visible=False): """ Get child-element present in the DOM. If timeout is 0 (zero) return WebElement instance or None, else we wait and retry for timeout and raise TimeoutException should the element not be found. ...
[ "def", "get_present_child", "(", "self", ",", "parent", ",", "locator", ",", "params", "=", "None", ",", "timeout", "=", "None", ",", "visible", "=", "False", ")", ":", "return", "self", ".", "get_present_element", "(", "locator", ",", "params", ",", "ti...
Get child-element present in the DOM. If timeout is 0 (zero) return WebElement instance or None, else we wait and retry for timeout and raise TimeoutException should the element not be found. :param parent: parent-element :param locator: locator tuple :param params: (optional) ...
[ "Get", "child", "-", "element", "present", "in", "the", "DOM", "." ]
735476877eb100db0981590a6d12140e68652167
https://github.com/Projectplace/basepage/blob/735476877eb100db0981590a6d12140e68652167/basepage/base_page.py#L464-L478
52,090
Projectplace/basepage
basepage/base_page.py
BasePage.get_visible_child
def get_visible_child(self, parent, locator, params=None, timeout=None): """ Get child-element both present AND visible in the DOM. If timeout is 0 (zero) return WebElement instance or None, else we wait and retry for timeout and raise TimeoutException should the element not be found. ...
python
def get_visible_child(self, parent, locator, params=None, timeout=None): """ Get child-element both present AND visible in the DOM. If timeout is 0 (zero) return WebElement instance or None, else we wait and retry for timeout and raise TimeoutException should the element not be found. ...
[ "def", "get_visible_child", "(", "self", ",", "parent", ",", "locator", ",", "params", "=", "None", ",", "timeout", "=", "None", ")", ":", "return", "self", ".", "get_present_child", "(", "parent", ",", "locator", ",", "params", ",", "timeout", ",", "Tru...
Get child-element both present AND visible in the DOM. If timeout is 0 (zero) return WebElement instance or None, else we wait and retry for timeout and raise TimeoutException should the element not be found. :param parent: parent-element :param locator: locator tuple :param pa...
[ "Get", "child", "-", "element", "both", "present", "AND", "visible", "in", "the", "DOM", "." ]
735476877eb100db0981590a6d12140e68652167
https://github.com/Projectplace/basepage/blob/735476877eb100db0981590a6d12140e68652167/basepage/base_page.py#L480-L493
52,091
Projectplace/basepage
basepage/base_page.py
BasePage.get_present_children
def get_present_children(self, parent, locator, params=None, timeout=None, visible=False): """ Get child-elements both present in the DOM. If timeout is 0 (zero) return WebElement instance or None, else we wait and retry for timeout and raise TimeoutException should the element not be f...
python
def get_present_children(self, parent, locator, params=None, timeout=None, visible=False): """ Get child-elements both present in the DOM. If timeout is 0 (zero) return WebElement instance or None, else we wait and retry for timeout and raise TimeoutException should the element not be f...
[ "def", "get_present_children", "(", "self", ",", "parent", ",", "locator", ",", "params", "=", "None", ",", "timeout", "=", "None", ",", "visible", "=", "False", ")", ":", "return", "self", ".", "get_present_elements", "(", "locator", ",", "params", ",", ...
Get child-elements both present in the DOM. If timeout is 0 (zero) return WebElement instance or None, else we wait and retry for timeout and raise TimeoutException should the element not be found. :param parent: parent-element :param locator: locator tuple :param params: (opti...
[ "Get", "child", "-", "elements", "both", "present", "in", "the", "DOM", "." ]
735476877eb100db0981590a6d12140e68652167
https://github.com/Projectplace/basepage/blob/735476877eb100db0981590a6d12140e68652167/basepage/base_page.py#L495-L509
52,092
Projectplace/basepage
basepage/base_page.py
BasePage.get_visible_children
def get_visible_children(self, parent, locator, params=None, timeout=None): """ Get child-elements both present AND visible in the DOM. If timeout is 0 (zero) return WebElement instance or None, else we wait and retry for timeout and raise TimeoutException should the element not be foun...
python
def get_visible_children(self, parent, locator, params=None, timeout=None): """ Get child-elements both present AND visible in the DOM. If timeout is 0 (zero) return WebElement instance or None, else we wait and retry for timeout and raise TimeoutException should the element not be foun...
[ "def", "get_visible_children", "(", "self", ",", "parent", ",", "locator", ",", "params", "=", "None", ",", "timeout", "=", "None", ")", ":", "return", "self", ".", "get_present_children", "(", "parent", ",", "locator", ",", "params", ",", "timeout", ",", ...
Get child-elements both present AND visible in the DOM. If timeout is 0 (zero) return WebElement instance or None, else we wait and retry for timeout and raise TimeoutException should the element not be found. :param parent: parent-element :param locator: locator tuple :param p...
[ "Get", "child", "-", "elements", "both", "present", "AND", "visible", "in", "the", "DOM", "." ]
735476877eb100db0981590a6d12140e68652167
https://github.com/Projectplace/basepage/blob/735476877eb100db0981590a6d12140e68652167/basepage/base_page.py#L511-L524
52,093
Projectplace/basepage
basepage/base_page.py
BasePage._get
def _get(self, locator, expected_condition, params=None, timeout=None, error_msg="", driver=None, **kwargs): """ Get elements based on locator with optional parameters. Uses selenium.webdriver.support.expected_conditions to determine the state of the element(s). :param locator: element...
python
def _get(self, locator, expected_condition, params=None, timeout=None, error_msg="", driver=None, **kwargs): """ Get elements based on locator with optional parameters. Uses selenium.webdriver.support.expected_conditions to determine the state of the element(s). :param locator: element...
[ "def", "_get", "(", "self", ",", "locator", ",", "expected_condition", ",", "params", "=", "None", ",", "timeout", "=", "None", ",", "error_msg", "=", "\"\"", ",", "driver", "=", "None", ",", "*", "*", "kwargs", ")", ":", "from", "selenium", ".", "we...
Get elements based on locator with optional parameters. Uses selenium.webdriver.support.expected_conditions to determine the state of the element(s). :param locator: element identifier :param expected_condition: expected condition of element (ie. visible, clickable, etc) :param params:...
[ "Get", "elements", "based", "on", "locator", "with", "optional", "parameters", "." ]
735476877eb100db0981590a6d12140e68652167
https://github.com/Projectplace/basepage/blob/735476877eb100db0981590a6d12140e68652167/basepage/base_page.py#L526-L563
52,094
Projectplace/basepage
basepage/base_page.py
BasePage.scroll_element_into_view
def scroll_element_into_view(self, selector): """ Scrolls an element into view. :param selector: selector of element or WebElement to scroll into view :return: None """ element = selector if isinstance(element, WebElement): self.execute_script("argume...
python
def scroll_element_into_view(self, selector): """ Scrolls an element into view. :param selector: selector of element or WebElement to scroll into view :return: None """ element = selector if isinstance(element, WebElement): self.execute_script("argume...
[ "def", "scroll_element_into_view", "(", "self", ",", "selector", ")", ":", "element", "=", "selector", "if", "isinstance", "(", "element", ",", "WebElement", ")", ":", "self", ".", "execute_script", "(", "\"arguments[0].scrollIntoView( true );\"", ",", "element", ...
Scrolls an element into view. :param selector: selector of element or WebElement to scroll into view :return: None
[ "Scrolls", "an", "element", "into", "view", "." ]
735476877eb100db0981590a6d12140e68652167
https://github.com/Projectplace/basepage/blob/735476877eb100db0981590a6d12140e68652167/basepage/base_page.py#L579-L590
52,095
Projectplace/basepage
basepage/base_page.py
BasePage.open_hover
def open_hover(self, locator, params=None, use_js=False): """ Open a hover or popover. :param locator: locator tuple or WebElement instance :param params: (optional) locator parameters :param use_js: use javascript to open hover :return: element hovered """ ...
python
def open_hover(self, locator, params=None, use_js=False): """ Open a hover or popover. :param locator: locator tuple or WebElement instance :param params: (optional) locator parameters :param use_js: use javascript to open hover :return: element hovered """ ...
[ "def", "open_hover", "(", "self", ",", "locator", ",", "params", "=", "None", ",", "use_js", "=", "False", ")", ":", "element", "=", "locator", "if", "not", "isinstance", "(", "element", ",", "WebElement", ")", ":", "element", "=", "self", ".", "get_vi...
Open a hover or popover. :param locator: locator tuple or WebElement instance :param params: (optional) locator parameters :param use_js: use javascript to open hover :return: element hovered
[ "Open", "a", "hover", "or", "popover", "." ]
735476877eb100db0981590a6d12140e68652167
https://github.com/Projectplace/basepage/blob/735476877eb100db0981590a6d12140e68652167/basepage/base_page.py#L592-L611
52,096
Projectplace/basepage
basepage/base_page.py
BasePage.close_hover
def close_hover(self, element, use_js=False): """ Close hover by moving to a set offset "away" from the element being hovered. :param element: element that triggered the hover to open :param use_js: use javascript to close hover :return: None """ try: ...
python
def close_hover(self, element, use_js=False): """ Close hover by moving to a set offset "away" from the element being hovered. :param element: element that triggered the hover to open :param use_js: use javascript to close hover :return: None """ try: ...
[ "def", "close_hover", "(", "self", ",", "element", ",", "use_js", "=", "False", ")", ":", "try", ":", "if", "use_js", ":", "self", ".", "_js_hover", "(", "'mouseout'", ",", "element", ")", "else", ":", "actions", "=", "ActionChains", "(", "self", ".", ...
Close hover by moving to a set offset "away" from the element being hovered. :param element: element that triggered the hover to open :param use_js: use javascript to close hover :return: None
[ "Close", "hover", "by", "moving", "to", "a", "set", "offset", "away", "from", "the", "element", "being", "hovered", "." ]
735476877eb100db0981590a6d12140e68652167
https://github.com/Projectplace/basepage/blob/735476877eb100db0981590a6d12140e68652167/basepage/base_page.py#L613-L629
52,097
Projectplace/basepage
basepage/base_page.py
BasePage.perform_hover_action
def perform_hover_action(self, locator, func, error_msg='', exceptions=None, params=None, alt_loc=None, alt_params=None, **kwargs): """ Hovers an element and performs whatever action is specified in the supplied function. NOTE: Specified function MUST return a non-f...
python
def perform_hover_action(self, locator, func, error_msg='', exceptions=None, params=None, alt_loc=None, alt_params=None, **kwargs): """ Hovers an element and performs whatever action is specified in the supplied function. NOTE: Specified function MUST return a non-f...
[ "def", "perform_hover_action", "(", "self", ",", "locator", ",", "func", ",", "error_msg", "=", "''", ",", "exceptions", "=", "None", ",", "params", "=", "None", ",", "alt_loc", "=", "None", ",", "alt_params", "=", "None", ",", "*", "*", "kwargs", ")",...
Hovers an element and performs whatever action is specified in the supplied function. NOTE: Specified function MUST return a non-false value upon success! :param locator: locator tuple or WebElement instance :param func: action to perform while hovering :param error_msg: error message ...
[ "Hovers", "an", "element", "and", "performs", "whatever", "action", "is", "specified", "in", "the", "supplied", "function", "." ]
735476877eb100db0981590a6d12140e68652167
https://github.com/Projectplace/basepage/blob/735476877eb100db0981590a6d12140e68652167/basepage/base_page.py#L640-L673
52,098
Projectplace/basepage
basepage/base_page.py
BasePage.hover
def hover(self, locator, params=None, use_js=False, alt_loc=None, alt_params=None): """ Context manager for hovering. Opens and closes the hover. Usage: with self.hover(locator, params): // do something with the hover :param locator: locator tuple o...
python
def hover(self, locator, params=None, use_js=False, alt_loc=None, alt_params=None): """ Context manager for hovering. Opens and closes the hover. Usage: with self.hover(locator, params): // do something with the hover :param locator: locator tuple o...
[ "def", "hover", "(", "self", ",", "locator", ",", "params", "=", "None", ",", "use_js", "=", "False", ",", "alt_loc", "=", "None", ",", "alt_params", "=", "None", ")", ":", "# Open hover", "element", "=", "self", ".", "open_hover", "(", "locator", ",",...
Context manager for hovering. Opens and closes the hover. Usage: with self.hover(locator, params): // do something with the hover :param locator: locator tuple or WebElement instance :param params: (optional) locator params :param use_js: use javasc...
[ "Context", "manager", "for", "hovering", "." ]
735476877eb100db0981590a6d12140e68652167
https://github.com/Projectplace/basepage/blob/735476877eb100db0981590a6d12140e68652167/basepage/base_page.py#L676-L703
52,099
Projectplace/basepage
basepage/base_page.py
BasePage.wait_for_non_empty_text
def wait_for_non_empty_text(self, locator, params=None, timeout=5): """ Wait and get elements when they're populated with any text. :param locator: locator tuple :param params: (optional) locator params :param timeout: (optional) maximum waiting time (in seconds) (default: 5) ...
python
def wait_for_non_empty_text(self, locator, params=None, timeout=5): """ Wait and get elements when they're populated with any text. :param locator: locator tuple :param params: (optional) locator params :param timeout: (optional) maximum waiting time (in seconds) (default: 5) ...
[ "def", "wait_for_non_empty_text", "(", "self", ",", "locator", ",", "params", "=", "None", ",", "timeout", "=", "5", ")", ":", "def", "_do_wait", "(", ")", ":", "elements", "=", "self", ".", "get_present_elements", "(", "locator", ",", "params", ",", "ti...
Wait and get elements when they're populated with any text. :param locator: locator tuple :param params: (optional) locator params :param timeout: (optional) maximum waiting time (in seconds) (default: 5) :return: list of WebElements
[ "Wait", "and", "get", "elements", "when", "they", "re", "populated", "with", "any", "text", "." ]
735476877eb100db0981590a6d12140e68652167
https://github.com/Projectplace/basepage/blob/735476877eb100db0981590a6d12140e68652167/basepage/base_page.py#L722-L738