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
40,900
hatemile/hatemile-for-python
hatemile/implementation/navig.py
AccessibleNavigationImplementation._generate_list_heading
def _generate_list_heading(self): """ Generate the list of heading links of page. """ local = self.parser.find('body').first_result() id_container_heading_before = ( AccessibleNavigationImplementation.ID_CONTAINER_HEADING_BEFORE ) id_container_heading...
python
def _generate_list_heading(self): """ Generate the list of heading links of page. """ local = self.parser.find('body').first_result() id_container_heading_before = ( AccessibleNavigationImplementation.ID_CONTAINER_HEADING_BEFORE ) id_container_heading...
[ "def", "_generate_list_heading", "(", "self", ")", ":", "local", "=", "self", ".", "parser", ".", "find", "(", "'body'", ")", ".", "first_result", "(", ")", "id_container_heading_before", "=", "(", "AccessibleNavigationImplementation", ".", "ID_CONTAINER_HEADING_BEF...
Generate the list of heading links of page.
[ "Generate", "the", "list", "of", "heading", "links", "of", "page", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/navig.py#L198-L263
40,901
hatemile/hatemile-for-python
hatemile/implementation/navig.py
AccessibleNavigationImplementation._get_heading_level
def _get_heading_level(self, element): """ Returns the level of heading. :param element: The heading. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement :return: The level of heading. :rtype: int """ # pylint: disable=no-self-use tag...
python
def _get_heading_level(self, element): """ Returns the level of heading. :param element: The heading. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement :return: The level of heading. :rtype: int """ # pylint: disable=no-self-use tag...
[ "def", "_get_heading_level", "(", "self", ",", "element", ")", ":", "# pylint: disable=no-self-use", "tag", "=", "element", ".", "get_tag_name", "(", ")", "if", "tag", "==", "'H1'", ":", "return", "1", "elif", "tag", "==", "'H2'", ":", "return", "2", "elif...
Returns the level of heading. :param element: The heading. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement :return: The level of heading. :rtype: int
[ "Returns", "the", "level", "of", "heading", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/navig.py#L265-L289
40,902
hatemile/hatemile-for-python
hatemile/implementation/navig.py
AccessibleNavigationImplementation._is_valid_heading
def _is_valid_heading(self): """ Check that the headings of page are sintatic correct. :return: True if the headings of page are sintatic correct or False if not. :rtype: bool """ elements = self.parser.find('h1,h2,h3,h4,h5,h6').list_results() l...
python
def _is_valid_heading(self): """ Check that the headings of page are sintatic correct. :return: True if the headings of page are sintatic correct or False if not. :rtype: bool """ elements = self.parser.find('h1,h2,h3,h4,h5,h6').list_results() l...
[ "def", "_is_valid_heading", "(", "self", ")", ":", "elements", "=", "self", ".", "parser", ".", "find", "(", "'h1,h2,h3,h4,h5,h6'", ")", ".", "list_results", "(", ")", "last_level", "=", "0", "count_main_heading", "=", "0", "self", ".", "validate_heading", "...
Check that the headings of page are sintatic correct. :return: True if the headings of page are sintatic correct or False if not. :rtype: bool
[ "Check", "that", "the", "headings", "of", "page", "are", "sintatic", "correct", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/navig.py#L291-L314
40,903
hatemile/hatemile-for-python
hatemile/implementation/navig.py
AccessibleNavigationImplementation._generate_anchor_for
def _generate_anchor_for(self, element, data_attribute, anchor_class): """ Generate an anchor for the element. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement :param data_attribute: The name of attribute that links the element ...
python
def _generate_anchor_for(self, element, data_attribute, anchor_class): """ Generate an anchor for the element. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement :param data_attribute: The name of attribute that links the element ...
[ "def", "_generate_anchor_for", "(", "self", ",", "element", ",", "data_attribute", ",", "anchor_class", ")", ":", "self", ".", "id_generator", ".", "generate_id", "(", "element", ")", "if", "self", ".", "parser", ".", "find", "(", "'['", "+", "data_attribute...
Generate an anchor for the element. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement :param data_attribute: The name of attribute that links the element with the anchor. :type data_attribute: str :param a...
[ "Generate", "an", "anchor", "for", "the", "element", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/navig.py#L316-L346
40,904
hatemile/hatemile-for-python
hatemile/implementation/navig.py
AccessibleNavigationImplementation._free_shortcut
def _free_shortcut(self, shortcut): """ Replace the shortcut of elements, that has the shortcut passed. :param shortcut: The shortcut. :type shortcut: str """ alpha_numbers = '1234567890abcdefghijklmnopqrstuvwxyz' elements = self.parser.find('[accesskey]').list_...
python
def _free_shortcut(self, shortcut): """ Replace the shortcut of elements, that has the shortcut passed. :param shortcut: The shortcut. :type shortcut: str """ alpha_numbers = '1234567890abcdefghijklmnopqrstuvwxyz' elements = self.parser.find('[accesskey]').list_...
[ "def", "_free_shortcut", "(", "self", ",", "shortcut", ")", ":", "alpha_numbers", "=", "'1234567890abcdefghijklmnopqrstuvwxyz'", "elements", "=", "self", ".", "parser", ".", "find", "(", "'[accesskey]'", ")", ".", "list_results", "(", ")", "found", "=", "False",...
Replace the shortcut of elements, that has the shortcut passed. :param shortcut: The shortcut. :type shortcut: str
[ "Replace", "the", "shortcut", "of", "elements", "that", "has", "the", "shortcut", "passed", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/navig.py#L348-L375
40,905
danbradham/scrim
scrim/api.py
Scrim._add
def _add(self, name, *args, **kwargs): '''Appends a command to the scrims list of commands. You should not need to use this.''' self.commands.append(Command(name, args, kwargs))
python
def _add(self, name, *args, **kwargs): '''Appends a command to the scrims list of commands. You should not need to use this.''' self.commands.append(Command(name, args, kwargs))
[ "def", "_add", "(", "self", ",", "name", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "commands", ".", "append", "(", "Command", "(", "name", ",", "args", ",", "kwargs", ")", ")" ]
Appends a command to the scrims list of commands. You should not need to use this.
[ "Appends", "a", "command", "to", "the", "scrims", "list", "of", "commands", ".", "You", "should", "not", "need", "to", "use", "this", "." ]
982a5db1db6e4ef40267f15642af2c7ea0e803ae
https://github.com/danbradham/scrim/blob/982a5db1db6e4ef40267f15642af2c7ea0e803ae/scrim/api.py#L63-L67
40,906
danbradham/scrim
scrim/api.py
Scrim.write
def write(self): '''Write this Scrims commands to its path''' if self.path is None: raise Exception('Scrim.path is None') dirname = os.path.dirname(os.path.abspath(self.path)) if not os.path.exists(dirname): try: os.makedirs(dirname) ...
python
def write(self): '''Write this Scrims commands to its path''' if self.path is None: raise Exception('Scrim.path is None') dirname = os.path.dirname(os.path.abspath(self.path)) if not os.path.exists(dirname): try: os.makedirs(dirname) ...
[ "def", "write", "(", "self", ")", ":", "if", "self", ".", "path", "is", "None", ":", "raise", "Exception", "(", "'Scrim.path is None'", ")", "dirname", "=", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "abspath", "(", "self", ".", ...
Write this Scrims commands to its path
[ "Write", "this", "Scrims", "commands", "to", "its", "path" ]
982a5db1db6e4ef40267f15642af2c7ea0e803ae
https://github.com/danbradham/scrim/blob/982a5db1db6e4ef40267f15642af2c7ea0e803ae/scrim/api.py#L225-L239
40,907
tBaxter/activity-monitor
activity_monitor/managers.py
ActivityItemManager.remove_orphans
def remove_orphans(self, instance, **kwargs): """ When an item is deleted, first delete any Activity object that has been created on its behalf. """ from activity_monitor.models import Activity try: instance_content_type = ContentType.objects.get_for_model(instance) t...
python
def remove_orphans(self, instance, **kwargs): """ When an item is deleted, first delete any Activity object that has been created on its behalf. """ from activity_monitor.models import Activity try: instance_content_type = ContentType.objects.get_for_model(instance) t...
[ "def", "remove_orphans", "(", "self", ",", "instance", ",", "*", "*", "kwargs", ")", ":", "from", "activity_monitor", ".", "models", "import", "Activity", "try", ":", "instance_content_type", "=", "ContentType", ".", "objects", ".", "get_for_model", "(", "inst...
When an item is deleted, first delete any Activity object that has been created on its behalf.
[ "When", "an", "item", "is", "deleted", "first", "delete", "any", "Activity", "object", "that", "has", "been", "created", "on", "its", "behalf", "." ]
be6c6edc7c6b4141923b47376502cde0f785eb68
https://github.com/tBaxter/activity-monitor/blob/be6c6edc7c6b4141923b47376502cde0f785eb68/activity_monitor/managers.py#L19-L30
40,908
tBaxter/activity-monitor
activity_monitor/managers.py
ActivityItemManager.follow_model
def follow_model(self, model): """ Follow a particular model class, updating associated Activity objects automatically. """ if model: self.models_by_name[model.__name__.lower()] = model signals.post_save.connect(create_or_update, sender=model) signals.post_d...
python
def follow_model(self, model): """ Follow a particular model class, updating associated Activity objects automatically. """ if model: self.models_by_name[model.__name__.lower()] = model signals.post_save.connect(create_or_update, sender=model) signals.post_d...
[ "def", "follow_model", "(", "self", ",", "model", ")", ":", "if", "model", ":", "self", ".", "models_by_name", "[", "model", ".", "__name__", ".", "lower", "(", ")", "]", "=", "model", "signals", ".", "post_save", ".", "connect", "(", "create_or_update",...
Follow a particular model class, updating associated Activity objects automatically.
[ "Follow", "a", "particular", "model", "class", "updating", "associated", "Activity", "objects", "automatically", "." ]
be6c6edc7c6b4141923b47376502cde0f785eb68
https://github.com/tBaxter/activity-monitor/blob/be6c6edc7c6b4141923b47376502cde0f785eb68/activity_monitor/managers.py#L32-L39
40,909
tBaxter/activity-monitor
activity_monitor/managers.py
ActivityItemManager.get_for_model
def get_for_model(self, model): """ Return a QuerySet of only items of a certain type. """ return self.filter(content_type=ContentType.objects.get_for_model(model))
python
def get_for_model(self, model): """ Return a QuerySet of only items of a certain type. """ return self.filter(content_type=ContentType.objects.get_for_model(model))
[ "def", "get_for_model", "(", "self", ",", "model", ")", ":", "return", "self", ".", "filter", "(", "content_type", "=", "ContentType", ".", "objects", ".", "get_for_model", "(", "model", ")", ")" ]
Return a QuerySet of only items of a certain type.
[ "Return", "a", "QuerySet", "of", "only", "items", "of", "a", "certain", "type", "." ]
be6c6edc7c6b4141923b47376502cde0f785eb68
https://github.com/tBaxter/activity-monitor/blob/be6c6edc7c6b4141923b47376502cde0f785eb68/activity_monitor/managers.py#L41-L45
40,910
tBaxter/activity-monitor
activity_monitor/managers.py
ActivityItemManager.get_last_update_of_model
def get_last_update_of_model(self, model, **kwargs): """ Return the last time a given model's items were updated. Returns the epoch if the items were never updated. """ qs = self.get_for_model(model) if kwargs: qs = qs.filter(**kwargs) try: ...
python
def get_last_update_of_model(self, model, **kwargs): """ Return the last time a given model's items were updated. Returns the epoch if the items were never updated. """ qs = self.get_for_model(model) if kwargs: qs = qs.filter(**kwargs) try: ...
[ "def", "get_last_update_of_model", "(", "self", ",", "model", ",", "*", "*", "kwargs", ")", ":", "qs", "=", "self", ".", "get_for_model", "(", "model", ")", "if", "kwargs", ":", "qs", "=", "qs", ".", "filter", "(", "*", "*", "kwargs", ")", "try", "...
Return the last time a given model's items were updated. Returns the epoch if the items were never updated.
[ "Return", "the", "last", "time", "a", "given", "model", "s", "items", "were", "updated", ".", "Returns", "the", "epoch", "if", "the", "items", "were", "never", "updated", "." ]
be6c6edc7c6b4141923b47376502cde0f785eb68
https://github.com/tBaxter/activity-monitor/blob/be6c6edc7c6b4141923b47376502cde0f785eb68/activity_monitor/managers.py#L47-L58
40,911
daviesjamie/spout
spout/streams.py
Stream.for_each
def for_each(self, operation, limit=0, verbose=False): """ Applies the given Operation to each item in the stream. The Operation executes on the items in the stream in the order that they appear in the stream. If the limit is supplied, then processing of the stream will stop after that ...
python
def for_each(self, operation, limit=0, verbose=False): """ Applies the given Operation to each item in the stream. The Operation executes on the items in the stream in the order that they appear in the stream. If the limit is supplied, then processing of the stream will stop after that ...
[ "def", "for_each", "(", "self", ",", "operation", ",", "limit", "=", "0", ",", "verbose", "=", "False", ")", ":", "if", "limit", "!=", "0", ":", "count", "=", "0", "while", "self", ".", "has_next", "(", ")", ":", "operation", ".", "perform", "(", ...
Applies the given Operation to each item in the stream. The Operation executes on the items in the stream in the order that they appear in the stream. If the limit is supplied, then processing of the stream will stop after that many items have been processed.
[ "Applies", "the", "given", "Operation", "to", "each", "item", "in", "the", "stream", ".", "The", "Operation", "executes", "on", "the", "items", "in", "the", "stream", "in", "the", "order", "that", "they", "appear", "in", "the", "stream", "." ]
c2c16fc55429c53718f2b2dcd34d93f251680de5
https://github.com/daviesjamie/spout/blob/c2c16fc55429c53718f2b2dcd34d93f251680de5/spout/streams.py#L11-L30
40,912
thomasw/querylist
querylist/fieldlookup.py
FieldLookup.iregex
def iregex(value, iregex): """Returns true if the value case insentively matches agains the regex. """ return re.match(iregex, value, flags=re.I)
python
def iregex(value, iregex): """Returns true if the value case insentively matches agains the regex. """ return re.match(iregex, value, flags=re.I)
[ "def", "iregex", "(", "value", ",", "iregex", ")", ":", "return", "re", ".", "match", "(", "iregex", ",", "value", ",", "flags", "=", "re", ".", "I", ")" ]
Returns true if the value case insentively matches agains the regex.
[ "Returns", "true", "if", "the", "value", "case", "insentively", "matches", "agains", "the", "regex", "." ]
4304023ef3330238ef3abccaa530ee97011fba2d
https://github.com/thomasw/querylist/blob/4304023ef3330238ef3abccaa530ee97011fba2d/querylist/fieldlookup.py#L142-L147
40,913
AtomHash/evernode
evernode/functions/utils.py
get_subdirectories
def get_subdirectories(directory): """ Get subdirectories without pycache """ return [name for name in os.listdir(directory) if name != '__pycache__' if os.path.isdir(os.path.join(directory, name))]
python
def get_subdirectories(directory): """ Get subdirectories without pycache """ return [name for name in os.listdir(directory) if name != '__pycache__' if os.path.isdir(os.path.join(directory, name))]
[ "def", "get_subdirectories", "(", "directory", ")", ":", "return", "[", "name", "for", "name", "in", "os", ".", "listdir", "(", "directory", ")", "if", "name", "!=", "'__pycache__'", "if", "os", ".", "path", ".", "isdir", "(", "os", ".", "path", ".", ...
Get subdirectories without pycache
[ "Get", "subdirectories", "without", "pycache" ]
b2fb91555fb937a3f3eba41db56dee26f9b034be
https://github.com/AtomHash/evernode/blob/b2fb91555fb937a3f3eba41db56dee26f9b034be/evernode/functions/utils.py#L5-L9
40,914
AtomHash/evernode
evernode/functions/utils.py
get_python_path
def get_python_path() -> str: """ Accurately get python executable """ python_bin = None if os.name == 'nt': python_root = os.path.abspath( os.path.join(os.__file__, os.pardir, os.pardir)) python_bin = os.path.join(python_root, 'python.exe') else: python_root ...
python
def get_python_path() -> str: """ Accurately get python executable """ python_bin = None if os.name == 'nt': python_root = os.path.abspath( os.path.join(os.__file__, os.pardir, os.pardir)) python_bin = os.path.join(python_root, 'python.exe') else: python_root ...
[ "def", "get_python_path", "(", ")", "->", "str", ":", "python_bin", "=", "None", "if", "os", ".", "name", "==", "'nt'", ":", "python_root", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "join", "(", "os", ".", "__file__", ","...
Accurately get python executable
[ "Accurately", "get", "python", "executable" ]
b2fb91555fb937a3f3eba41db56dee26f9b034be
https://github.com/AtomHash/evernode/blob/b2fb91555fb937a3f3eba41db56dee26f9b034be/evernode/functions/utils.py#L12-L24
40,915
AtomHash/evernode
evernode/classes/user_auth.py
UserAuth.__collect_fields
def __collect_fields(self): """ Use field values from config.json and collect from request """ form = FormData() form.add_field(self.__username_field, required=True, error=self.__username_error) form.add_field(self.__password_field, required=True, ...
python
def __collect_fields(self): """ Use field values from config.json and collect from request """ form = FormData() form.add_field(self.__username_field, required=True, error=self.__username_error) form.add_field(self.__password_field, required=True, ...
[ "def", "__collect_fields", "(", "self", ")", ":", "form", "=", "FormData", "(", ")", "form", ".", "add_field", "(", "self", ".", "__username_field", ",", "required", "=", "True", ",", "error", "=", "self", ".", "__username_error", ")", "form", ".", "add_...
Use field values from config.json and collect from request
[ "Use", "field", "values", "from", "config", ".", "json", "and", "collect", "from", "request" ]
b2fb91555fb937a3f3eba41db56dee26f9b034be
https://github.com/AtomHash/evernode/blob/b2fb91555fb937a3f3eba41db56dee26f9b034be/evernode/classes/user_auth.py#L32-L42
40,916
ponty/confduino
confduino/boardinstall.py
install_board
def install_board(board_id, board_options, hwpack='arduino', replace_existing=False): """install board in boards.txt. :param board_id: string identifier :param board_options: dict like :param replace_existing: bool :rtype: None """ doaction = 0 if board_id in boards(hwpack).keys(): ...
python
def install_board(board_id, board_options, hwpack='arduino', replace_existing=False): """install board in boards.txt. :param board_id: string identifier :param board_options: dict like :param replace_existing: bool :rtype: None """ doaction = 0 if board_id in boards(hwpack).keys(): ...
[ "def", "install_board", "(", "board_id", ",", "board_options", ",", "hwpack", "=", "'arduino'", ",", "replace_existing", "=", "False", ")", ":", "doaction", "=", "0", "if", "board_id", "in", "boards", "(", "hwpack", ")", ".", "keys", "(", ")", ":", "log"...
install board in boards.txt. :param board_id: string identifier :param board_options: dict like :param replace_existing: bool :rtype: None
[ "install", "board", "in", "boards", ".", "txt", "." ]
f4c261e5e84997f145a8bdd001f471db74c9054b
https://github.com/ponty/confduino/blob/f4c261e5e84997f145a8bdd001f471db74c9054b/confduino/boardinstall.py#L11-L32
40,917
asascience-open/paegan-transport
paegan/transport/utils/asasuncycles.py
SunCycles.cycles
def cycles(cls, **kwargs): """ Classmethod for convienence in returning both the sunrise and sunset based on a location and date. Always calculates the sunrise and sunset on the given date, no matter the time passed into the function in the datetime object. Parameters: ...
python
def cycles(cls, **kwargs): """ Classmethod for convienence in returning both the sunrise and sunset based on a location and date. Always calculates the sunrise and sunset on the given date, no matter the time passed into the function in the datetime object. Parameters: ...
[ "def", "cycles", "(", "cls", ",", "*", "*", "kwargs", ")", ":", "if", "\"loc\"", "not", "in", "kwargs", ":", "if", "\"point\"", "not", "in", "kwargs", ":", "if", "\"lat\"", "not", "in", "kwargs", "or", "\"lon\"", "not", "in", "kwargs", ":", "raise", ...
Classmethod for convienence in returning both the sunrise and sunset based on a location and date. Always calculates the sunrise and sunset on the given date, no matter the time passed into the function in the datetime object. Parameters: loc = Location4D (object) O...
[ "Classmethod", "for", "convienence", "in", "returning", "both", "the", "sunrise", "and", "sunset", "based", "on", "a", "location", "and", "date", ".", "Always", "calculates", "the", "sunrise", "and", "sunset", "on", "the", "given", "date", "no", "matter", "t...
99a7f4ea24f0f42d9b34d1fb0e87ab2c49315bd3
https://github.com/asascience-open/paegan-transport/blob/99a7f4ea24f0f42d9b34d1fb0e87ab2c49315bd3/paegan/transport/utils/asasuncycles.py#L12-L88
40,918
hatemile/hatemile-for-python
hatemile/implementation/css.py
AccessibleCSSImplementation._operation_speak_as_spell_out
def _operation_speak_as_spell_out(self, content, index, children): """ The operation method of _speak_as method for spell-out. :param content: The text content of element. :type content: str :param index: The index of pattern in text content of element. :type index: int ...
python
def _operation_speak_as_spell_out(self, content, index, children): """ The operation method of _speak_as method for spell-out. :param content: The text content of element. :type content: str :param index: The index of pattern in text content of element. :type index: int ...
[ "def", "_operation_speak_as_spell_out", "(", "self", ",", "content", ",", "index", ",", "children", ")", ":", "children", ".", "append", "(", "self", ".", "_create_content_element", "(", "content", "[", "0", ":", "(", "index", "+", "1", ")", "]", ",", "'...
The operation method of _speak_as method for spell-out. :param content: The text content of element. :type content: str :param index: The index of pattern in text content of element. :type index: int :param children: The children of element. :type children: list(hatemile...
[ "The", "operation", "method", "of", "_speak_as", "method", "for", "spell", "-", "out", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L208-L227
40,919
hatemile/hatemile-for-python
hatemile/implementation/css.py
AccessibleCSSImplementation._operation_speak_as_literal_punctuation
def _operation_speak_as_literal_punctuation( self, content, index, children ): """ The operation method of _speak_as method for literal-punctuation. :param content: The text content of element. :type content: str :param index: The index of pat...
python
def _operation_speak_as_literal_punctuation( self, content, index, children ): """ The operation method of _speak_as method for literal-punctuation. :param content: The text content of element. :type content: str :param index: The index of pat...
[ "def", "_operation_speak_as_literal_punctuation", "(", "self", ",", "content", ",", "index", ",", "children", ")", ":", "data_property_value", "=", "'literal-punctuation'", "if", "index", "!=", "0", ":", "children", ".", "append", "(", "self", ".", "_create_conten...
The operation method of _speak_as method for literal-punctuation. :param content: The text content of element. :type content: str :param index: The index of pattern in text content of element. :type index: int :param children: The children of element. :type children: lis...
[ "The", "operation", "method", "of", "_speak_as", "method", "for", "literal", "-", "punctuation", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L229-L266
40,920
hatemile/hatemile-for-python
hatemile/implementation/css.py
AccessibleCSSImplementation._operation_speak_as_no_punctuation
def _operation_speak_as_no_punctuation(self, content, index, children): """ The operation method of _speak_as method for no-punctuation. :param content: The text content of element. :type content: str :param index: The index of pattern in text content of element. :type i...
python
def _operation_speak_as_no_punctuation(self, content, index, children): """ The operation method of _speak_as method for no-punctuation. :param content: The text content of element. :type content: str :param index: The index of pattern in text content of element. :type i...
[ "def", "_operation_speak_as_no_punctuation", "(", "self", ",", "content", ",", "index", ",", "children", ")", ":", "if", "index", "!=", "0", ":", "children", ".", "append", "(", "self", ".", "_create_content_element", "(", "content", "[", "0", ":", "index", ...
The operation method of _speak_as method for no-punctuation. :param content: The text content of element. :type content: str :param index: The index of pattern in text content of element. :type index: int :param children: The children of element. :type children: list(hat...
[ "The", "operation", "method", "of", "_speak_as", "method", "for", "no", "-", "punctuation", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L268-L290
40,921
hatemile/hatemile-for-python
hatemile/implementation/css.py
AccessibleCSSImplementation._operation_speak_as_digits
def _operation_speak_as_digits(self, content, index, children): """ The operation method of _speak_as method for digits. :param content: The text content of element. :type content: str :param index: The index of pattern in text content of element. :type index: int ...
python
def _operation_speak_as_digits(self, content, index, children): """ The operation method of _speak_as method for digits. :param content: The text content of element. :type content: str :param index: The index of pattern in text content of element. :type index: int ...
[ "def", "_operation_speak_as_digits", "(", "self", ",", "content", ",", "index", ",", "children", ")", ":", "data_property_value", "=", "'digits'", "if", "index", "!=", "0", ":", "children", ".", "append", "(", "self", ".", "_create_content_element", "(", "cont...
The operation method of _speak_as method for digits. :param content: The text content of element. :type content: str :param index: The index of pattern in text content of element. :type index: int :param children: The children of element. :type children: list(hatemile.ut...
[ "The", "operation", "method", "of", "_speak_as", "method", "for", "digits", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L292-L320
40,922
hatemile/hatemile-for-python
hatemile/implementation/css.py
AccessibleCSSImplementation._set_symbols
def _set_symbols(self, file_name, configure): """ Load the symbols with configuration. :param file_name: The file path of symbol configuration. :type file_name: str :param configure: The configuration of HaTeMiLe. :type configure: hatemile.util.configure.Configure ...
python
def _set_symbols(self, file_name, configure): """ Load the symbols with configuration. :param file_name: The file path of symbol configuration. :type file_name: str :param configure: The configuration of HaTeMiLe. :type configure: hatemile.util.configure.Configure ...
[ "def", "_set_symbols", "(", "self", ",", "file_name", ",", "configure", ")", ":", "self", ".", "symbols", "=", "[", "]", "if", "file_name", "is", "None", ":", "file_name", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", ...
Load the symbols with configuration. :param file_name: The file path of symbol configuration. :type file_name: str :param configure: The configuration of HaTeMiLe. :type configure: hatemile.util.configure.Configure
[ "Load", "the", "symbols", "with", "configuration", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L322-L347
40,923
hatemile/hatemile-for-python
hatemile/implementation/css.py
AccessibleCSSImplementation._get_formated_symbol
def _get_formated_symbol(self, symbol): """ Returns the symbol formated to be searched by regular expression. :param symbol: The symbol. :type symbol: str :return: The symbol formated. :rtype: str """ # pylint: disable=no-self-use old_symbols = [...
python
def _get_formated_symbol(self, symbol): """ Returns the symbol formated to be searched by regular expression. :param symbol: The symbol. :type symbol: str :return: The symbol formated. :rtype: str """ # pylint: disable=no-self-use old_symbols = [...
[ "def", "_get_formated_symbol", "(", "self", ",", "symbol", ")", ":", "# pylint: disable=no-self-use", "old_symbols", "=", "[", "'\\\\'", ",", "'.'", ",", "'+'", ",", "'*'", ",", "'?'", ",", "'^'", ",", "'$'", ",", "'['", ",", "']'", ",", "'{'", ",", "'...
Returns the symbol formated to be searched by regular expression. :param symbol: The symbol. :type symbol: str :return: The symbol formated. :rtype: str
[ "Returns", "the", "symbol", "formated", "to", "be", "searched", "by", "regular", "expression", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L349-L406
40,924
hatemile/hatemile-for-python
hatemile/implementation/css.py
AccessibleCSSImplementation._get_regular_expression_of_symbols
def _get_regular_expression_of_symbols(self): """ Returns the regular expression to search all symbols. :return: The regular expression to search all symbols. :rtype: str """ regular_expression = None for symbol in self.symbols: formated_symbol = sel...
python
def _get_regular_expression_of_symbols(self): """ Returns the regular expression to search all symbols. :return: The regular expression to search all symbols. :rtype: str """ regular_expression = None for symbol in self.symbols: formated_symbol = sel...
[ "def", "_get_regular_expression_of_symbols", "(", "self", ")", ":", "regular_expression", "=", "None", "for", "symbol", "in", "self", ".", "symbols", ":", "formated_symbol", "=", "self", ".", "_get_formated_symbol", "(", "symbol", "[", "'symbol'", "]", ")", "if"...
Returns the regular expression to search all symbols. :return: The regular expression to search all symbols. :rtype: str
[ "Returns", "the", "regular", "expression", "to", "search", "all", "symbols", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L423-L443
40,925
hatemile/hatemile-for-python
hatemile/implementation/css.py
AccessibleCSSImplementation._is_valid_inherit_element
def _is_valid_inherit_element(self, element): """ Check that the children of element can be manipulated to apply the CSS properties. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement :return: True if the children of element can ...
python
def _is_valid_inherit_element(self, element): """ Check that the children of element can be manipulated to apply the CSS properties. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement :return: True if the children of element can ...
[ "def", "_is_valid_inherit_element", "(", "self", ",", "element", ")", ":", "# pylint: disable=no-self-use", "tag_name", "=", "element", ".", "get_tag_name", "(", ")", "return", "(", "(", "tag_name", "in", "AccessibleCSSImplementation", ".", "VALID_INHERIT_TAGS", ")", ...
Check that the children of element can be manipulated to apply the CSS properties. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement :return: True if the children of element can be manipulated to apply the CSS properties or Fal...
[ "Check", "that", "the", "children", "of", "element", "can", "be", "manipulated", "to", "apply", "the", "CSS", "properties", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L445-L463
40,926
hatemile/hatemile-for-python
hatemile/implementation/css.py
AccessibleCSSImplementation._isolate_text_node
def _isolate_text_node(self, element): """ Isolate text nodes of element nodes. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement """ if ( (element.has_children_elements()) and (self._is_valid_element(el...
python
def _isolate_text_node(self, element): """ Isolate text nodes of element nodes. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement """ if ( (element.has_children_elements()) and (self._is_valid_element(el...
[ "def", "_isolate_text_node", "(", "self", ",", "element", ")", ":", "if", "(", "(", "element", ".", "has_children_elements", "(", ")", ")", "and", "(", "self", ".", "_is_valid_element", "(", "element", ")", ")", ")", ":", "if", "self", ".", "_is_valid_el...
Isolate text nodes of element nodes. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement
[ "Isolate", "text", "nodes", "of", "element", "nodes", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L480-L506
40,927
hatemile/hatemile-for-python
hatemile/implementation/css.py
AccessibleCSSImplementation._replace_element_by_own_content
def _replace_element_by_own_content(self, element): """ Replace the element by own text content. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement """ # pylint: disable=no-self-use if element.has_children_elements(): ...
python
def _replace_element_by_own_content(self, element): """ Replace the element by own text content. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement """ # pylint: disable=no-self-use if element.has_children_elements(): ...
[ "def", "_replace_element_by_own_content", "(", "self", ",", "element", ")", ":", "# pylint: disable=no-self-use", "if", "element", ".", "has_children_elements", "(", ")", ":", "children", "=", "element", ".", "get_children_elements", "(", ")", "for", "child", "in", ...
Replace the element by own text content. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement
[ "Replace", "the", "element", "by", "own", "text", "content", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L508-L523
40,928
hatemile/hatemile-for-python
hatemile/implementation/css.py
AccessibleCSSImplementation._visit
def _visit(self, element, operation): """ Visit and execute a operation in element and descendants. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement :param operation: The operation to be executed. :type operation: function ...
python
def _visit(self, element, operation): """ Visit and execute a operation in element and descendants. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement :param operation: The operation to be executed. :type operation: function ...
[ "def", "_visit", "(", "self", ",", "element", ",", "operation", ")", ":", "if", "self", ".", "_is_valid_inherit_element", "(", "element", ")", ":", "if", "element", ".", "has_children_elements", "(", ")", ":", "children", "=", "element", ".", "get_children_e...
Visit and execute a operation in element and descendants. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement :param operation: The operation to be executed. :type operation: function
[ "Visit", "and", "execute", "a", "operation", "in", "element", "and", "descendants", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L525-L541
40,929
hatemile/hatemile-for-python
hatemile/implementation/css.py
AccessibleCSSImplementation._create_content_element
def _create_content_element(self, content, data_property_value): """ Create a element to show the content. :param content: The text content of element. :type content: str :param data_property_value: The value of custom attribute used to identi...
python
def _create_content_element(self, content, data_property_value): """ Create a element to show the content. :param content: The text content of element. :type content: str :param data_property_value: The value of custom attribute used to identi...
[ "def", "_create_content_element", "(", "self", ",", "content", ",", "data_property_value", ")", ":", "content_element", "=", "self", ".", "html_parser", ".", "create_element", "(", "'span'", ")", "content_element", ".", "set_attribute", "(", "AccessibleCSSImplementati...
Create a element to show the content. :param content: The text content of element. :type content: str :param data_property_value: The value of custom attribute used to identify the fix. :type data_property_value: str :return: The element to sh...
[ "Create", "a", "element", "to", "show", "the", "content", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L543-L566
40,930
hatemile/hatemile-for-python
hatemile/implementation/css.py
AccessibleCSSImplementation._create_aural_content_element
def _create_aural_content_element(self, content, data_property_value): """ Create a element to show the content, only to aural displays. :param content: The text content of element. :type content: str :param data_property_value: The value of custom attribute used to ...
python
def _create_aural_content_element(self, content, data_property_value): """ Create a element to show the content, only to aural displays. :param content: The text content of element. :type content: str :param data_property_value: The value of custom attribute used to ...
[ "def", "_create_aural_content_element", "(", "self", ",", "content", ",", "data_property_value", ")", ":", "content_element", "=", "self", ".", "_create_content_element", "(", "content", ",", "data_property_value", ")", "content_element", ".", "set_attribute", "(", "'...
Create a element to show the content, only to aural displays. :param content: The text content of element. :type content: str :param data_property_value: The value of custom attribute used to identify the fix. :type data_property_value: str :r...
[ "Create", "a", "element", "to", "show", "the", "content", "only", "to", "aural", "displays", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L568-L587
40,931
hatemile/hatemile-for-python
hatemile/implementation/css.py
AccessibleCSSImplementation._create_visual_content_element
def _create_visual_content_element(self, content, data_property_value): """ Create a element to show the content, only to visual displays. :param content: The text content of element. :type content: str :param data_property_value: The value of custom attribute used to ...
python
def _create_visual_content_element(self, content, data_property_value): """ Create a element to show the content, only to visual displays. :param content: The text content of element. :type content: str :param data_property_value: The value of custom attribute used to ...
[ "def", "_create_visual_content_element", "(", "self", ",", "content", ",", "data_property_value", ")", ":", "content_element", "=", "self", ".", "_create_content_element", "(", "content", ",", "data_property_value", ")", "content_element", ".", "set_attribute", "(", "...
Create a element to show the content, only to visual displays. :param content: The text content of element. :type content: str :param data_property_value: The value of custom attribute used to identify the fix. :type data_property_value: str :...
[ "Create", "a", "element", "to", "show", "the", "content", "only", "to", "visual", "displays", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L589-L608
40,932
hatemile/hatemile-for-python
hatemile/implementation/css.py
AccessibleCSSImplementation._speak_normal
def _speak_normal(self, element): """ Speak the content of element only. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement """ if element.has_attribute(AccessibleCSSImplementation.DATA_SPEAK): if ( (...
python
def _speak_normal(self, element): """ Speak the content of element only. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement """ if element.has_attribute(AccessibleCSSImplementation.DATA_SPEAK): if ( (...
[ "def", "_speak_normal", "(", "self", ",", "element", ")", ":", "if", "element", ".", "has_attribute", "(", "AccessibleCSSImplementation", ".", "DATA_SPEAK", ")", ":", "if", "(", "(", "element", ".", "get_attribute", "(", "AccessibleCSSImplementation", ".", "DATA...
Speak the content of element only. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement
[ "Speak", "the", "content", "of", "element", "only", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L610-L633
40,933
hatemile/hatemile-for-python
hatemile/implementation/css.py
AccessibleCSSImplementation._speak_normal_inherit
def _speak_normal_inherit(self, element): """ Speak the content of element and descendants. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement """ self._visit(element, self._speak_normal) element.normalize()
python
def _speak_normal_inherit(self, element): """ Speak the content of element and descendants. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement """ self._visit(element, self._speak_normal) element.normalize()
[ "def", "_speak_normal_inherit", "(", "self", ",", "element", ")", ":", "self", ".", "_visit", "(", "element", ",", "self", ".", "_speak_normal", ")", "element", ".", "normalize", "(", ")" ]
Speak the content of element and descendants. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement
[ "Speak", "the", "content", "of", "element", "and", "descendants", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L635-L645
40,934
hatemile/hatemile-for-python
hatemile/implementation/css.py
AccessibleCSSImplementation._speak_none
def _speak_none(self, element): """ No speak any content of element only. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement """ # pylint: disable=no-self-use element.set_attribute('role', 'presentation') element...
python
def _speak_none(self, element): """ No speak any content of element only. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement """ # pylint: disable=no-self-use element.set_attribute('role', 'presentation') element...
[ "def", "_speak_none", "(", "self", ",", "element", ")", ":", "# pylint: disable=no-self-use", "element", ".", "set_attribute", "(", "'role'", ",", "'presentation'", ")", "element", ".", "set_attribute", "(", "'aria-hidden'", ",", "'true'", ")", "element", ".", "...
No speak any content of element only. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement
[ "No", "speak", "any", "content", "of", "element", "only", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L647-L658
40,935
hatemile/hatemile-for-python
hatemile/implementation/css.py
AccessibleCSSImplementation._speak_none_inherit
def _speak_none_inherit(self, element): """ No speak any content of element and descendants. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement """ self._isolate_text_node(element) self._visit(element, self._speak_none)
python
def _speak_none_inherit(self, element): """ No speak any content of element and descendants. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement """ self._isolate_text_node(element) self._visit(element, self._speak_none)
[ "def", "_speak_none_inherit", "(", "self", ",", "element", ")", ":", "self", ".", "_isolate_text_node", "(", "element", ")", "self", ".", "_visit", "(", "element", ",", "self", ".", "_speak_none", ")" ]
No speak any content of element and descendants. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement
[ "No", "speak", "any", "content", "of", "element", "and", "descendants", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L660-L670
40,936
hatemile/hatemile-for-python
hatemile/implementation/css.py
AccessibleCSSImplementation._speak_as
def _speak_as( self, element, regular_expression, data_property_value, operation ): """ Execute a operation by regular expression for element only. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement ...
python
def _speak_as( self, element, regular_expression, data_property_value, operation ): """ Execute a operation by regular expression for element only. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement ...
[ "def", "_speak_as", "(", "self", ",", "element", ",", "regular_expression", ",", "data_property_value", ",", "operation", ")", ":", "children", "=", "[", "]", "pattern", "=", "re", ".", "compile", "(", "regular_expression", ")", "content", "=", "element", "....
Execute a operation by regular expression for element only. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement :param regular_expression: The regular expression. :type regular_expression: str :param data_property_value: The value of cust...
[ "Execute", "a", "operation", "by", "regular", "expression", "for", "element", "only", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L672-L715
40,937
hatemile/hatemile-for-python
hatemile/implementation/css.py
AccessibleCSSImplementation._reverse_speak_as
def _reverse_speak_as(self, element, data_property_value): """ Revert changes of a speak_as method for element and descendants. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement :param data_property_value: The value of custom attribute ...
python
def _reverse_speak_as(self, element, data_property_value): """ Revert changes of a speak_as method for element and descendants. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement :param data_property_value: The value of custom attribute ...
[ "def", "_reverse_speak_as", "(", "self", ",", "element", ",", "data_property_value", ")", ":", "data_property", "=", "(", "'['", "+", "AccessibleCSSImplementation", ".", "DATA_SPEAK_AS", "+", "'=\"'", "+", "data_property_value", "+", "'\"]'", ")", "auxiliar_elements...
Revert changes of a speak_as method for element and descendants. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement :param data_property_value: The value of custom attribute used to identify the fix. :type dat...
[ "Revert", "changes", "of", "a", "speak_as", "method", "for", "element", "and", "descendants", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L717-L756
40,938
hatemile/hatemile-for-python
hatemile/implementation/css.py
AccessibleCSSImplementation._speak_as_normal
def _speak_as_normal(self, element): """ Use the default speak configuration of user agent for element and descendants. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement """ self._reverse_speak_as(element, 'spell-out') ...
python
def _speak_as_normal(self, element): """ Use the default speak configuration of user agent for element and descendants. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement """ self._reverse_speak_as(element, 'spell-out') ...
[ "def", "_speak_as_normal", "(", "self", ",", "element", ")", ":", "self", ".", "_reverse_speak_as", "(", "element", ",", "'spell-out'", ")", "self", ".", "_reverse_speak_as", "(", "element", ",", "'literal-punctuation'", ")", "self", ".", "_reverse_speak_as", "(...
Use the default speak configuration of user agent for element and descendants. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement
[ "Use", "the", "default", "speak", "configuration", "of", "user", "agent", "for", "element", "and", "descendants", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L758-L770
40,939
hatemile/hatemile-for-python
hatemile/implementation/css.py
AccessibleCSSImplementation._speak_as_spell_out_inherit
def _speak_as_spell_out_inherit(self, element): """ Speak one letter at a time for each word for elements and descendants. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement """ self._reverse_speak_as(element, 'spell-out') ...
python
def _speak_as_spell_out_inherit(self, element): """ Speak one letter at a time for each word for elements and descendants. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement """ self._reverse_speak_as(element, 'spell-out') ...
[ "def", "_speak_as_spell_out_inherit", "(", "self", ",", "element", ")", ":", "self", ".", "_reverse_speak_as", "(", "element", ",", "'spell-out'", ")", "self", ".", "_isolate_text_node", "(", "element", ")", "self", ".", "_visit", "(", "element", ",", "self", ...
Speak one letter at a time for each word for elements and descendants. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement
[ "Speak", "one", "letter", "at", "a", "time", "for", "each", "word", "for", "elements", "and", "descendants", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L787-L799
40,940
hatemile/hatemile-for-python
hatemile/implementation/css.py
AccessibleCSSImplementation._speak_as_literal_punctuation
def _speak_as_literal_punctuation(self, element): """ Speak the punctuation for elements only. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement """ self._speak_as( element, self._get_regular_expression_...
python
def _speak_as_literal_punctuation(self, element): """ Speak the punctuation for elements only. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement """ self._speak_as( element, self._get_regular_expression_...
[ "def", "_speak_as_literal_punctuation", "(", "self", ",", "element", ")", ":", "self", ".", "_speak_as", "(", "element", ",", "self", ".", "_get_regular_expression_of_symbols", "(", ")", ",", "'literal-punctuation'", ",", "self", ".", "_operation_speak_as_literal_punc...
Speak the punctuation for elements only. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement
[ "Speak", "the", "punctuation", "for", "elements", "only", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L801-L814
40,941
hatemile/hatemile-for-python
hatemile/implementation/css.py
AccessibleCSSImplementation._speak_as_literal_punctuation_inherit
def _speak_as_literal_punctuation_inherit(self, element): """ Speak the punctuation for elements and descendants. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement """ self._reverse_speak_as(element, 'literal-punctuation') ...
python
def _speak_as_literal_punctuation_inherit(self, element): """ Speak the punctuation for elements and descendants. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement """ self._reverse_speak_as(element, 'literal-punctuation') ...
[ "def", "_speak_as_literal_punctuation_inherit", "(", "self", ",", "element", ")", ":", "self", ".", "_reverse_speak_as", "(", "element", ",", "'literal-punctuation'", ")", "self", ".", "_reverse_speak_as", "(", "element", ",", "'no-punctuation'", ")", "self", ".", ...
Speak the punctuation for elements and descendants. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement
[ "Speak", "the", "punctuation", "for", "elements", "and", "descendants", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L816-L829
40,942
hatemile/hatemile-for-python
hatemile/implementation/css.py
AccessibleCSSImplementation._speak_as_no_punctuation_inherit
def _speak_as_no_punctuation_inherit(self, element): """ No speak the punctuation for element and descendants. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement """ self._reverse_speak_as(element, 'literal-punctuation') ...
python
def _speak_as_no_punctuation_inherit(self, element): """ No speak the punctuation for element and descendants. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement """ self._reverse_speak_as(element, 'literal-punctuation') ...
[ "def", "_speak_as_no_punctuation_inherit", "(", "self", ",", "element", ")", ":", "self", ".", "_reverse_speak_as", "(", "element", ",", "'literal-punctuation'", ")", "self", ".", "_reverse_speak_as", "(", "element", ",", "'no-punctuation'", ")", "self", ".", "_is...
No speak the punctuation for element and descendants. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement
[ "No", "speak", "the", "punctuation", "for", "element", "and", "descendants", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L849-L862
40,943
hatemile/hatemile-for-python
hatemile/implementation/css.py
AccessibleCSSImplementation._speak_as_digits_inherit
def _speak_as_digits_inherit(self, element): """ Speak the digit at a time for each number for element and descendants. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement """ self._reverse_speak_as(element, 'digits') se...
python
def _speak_as_digits_inherit(self, element): """ Speak the digit at a time for each number for element and descendants. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement """ self._reverse_speak_as(element, 'digits') se...
[ "def", "_speak_as_digits_inherit", "(", "self", ",", "element", ")", ":", "self", ".", "_reverse_speak_as", "(", "element", ",", "'digits'", ")", "self", ".", "_isolate_text_node", "(", "element", ")", "self", ".", "_visit", "(", "element", ",", "self", ".",...
Speak the digit at a time for each number for element and descendants. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement
[ "Speak", "the", "digit", "at", "a", "time", "for", "each", "number", "for", "element", "and", "descendants", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L879-L891
40,944
hatemile/hatemile-for-python
hatemile/implementation/css.py
AccessibleCSSImplementation._speak_header_always_inherit
def _speak_header_always_inherit(self, element): """ The cells headers will be spoken for every data cell for element and descendants. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement """ self._speak_header_once_inheri...
python
def _speak_header_always_inherit(self, element): """ The cells headers will be spoken for every data cell for element and descendants. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement """ self._speak_header_once_inheri...
[ "def", "_speak_header_always_inherit", "(", "self", ",", "element", ")", ":", "self", ".", "_speak_header_once_inherit", "(", "element", ")", "cell_elements", "=", "self", ".", "html_parser", ".", "find", "(", "element", ")", ".", "find_descendants", "(", "'td[h...
The cells headers will be spoken for every data cell for element and descendants. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement
[ "The", "cells", "headers", "will", "be", "spoken", "for", "every", "data", "cell", "for", "element", "and", "descendants", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L903-L922
40,945
hatemile/hatemile-for-python
hatemile/implementation/css.py
AccessibleCSSImplementation._speak_header_once_inherit
def _speak_header_once_inherit(self, element): """ The cells headers will be spoken one time for element and descendants. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement """ header_elements = self.html_parser.find(element).fi...
python
def _speak_header_once_inherit(self, element): """ The cells headers will be spoken one time for element and descendants. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement """ header_elements = self.html_parser.find(element).fi...
[ "def", "_speak_header_once_inherit", "(", "self", ",", "element", ")", ":", "header_elements", "=", "self", ".", "html_parser", ".", "find", "(", "element", ")", ".", "find_descendants", "(", "'['", "+", "AccessibleDisplayImplementation", ".", "DATA_ATTRIBUTE_HEADER...
The cells headers will be spoken one time for element and descendants. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement
[ "The", "cells", "headers", "will", "be", "spoken", "one", "time", "for", "element", "and", "descendants", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L924-L938
40,946
hatemile/hatemile-for-python
hatemile/implementation/css.py
AccessibleCSSImplementation._provide_speak_properties_with_rule
def _provide_speak_properties_with_rule(self, element, rule): """ Provide the CSS features of speaking and speech properties in element. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement :param rule: The stylesheet rule. :type r...
python
def _provide_speak_properties_with_rule(self, element, rule): """ Provide the CSS features of speaking and speech properties in element. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement :param rule: The stylesheet rule. :type r...
[ "def", "_provide_speak_properties_with_rule", "(", "self", ",", "element", ",", "rule", ")", ":", "if", "rule", ".", "has_property", "(", "'speak'", ")", ":", "declarations", "=", "rule", ".", "get_declarations", "(", "'speak'", ")", "for", "declaration", "in"...
Provide the CSS features of speaking and speech properties in element. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement :param rule: The stylesheet rule. :type rule: hatemile.util.css.stylesheetrule.StyleSheetRule
[ "Provide", "the", "CSS", "features", "of", "speaking", "and", "speech", "properties", "in", "element", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/css.py#L940-L997
40,947
SeattleTestbed/seash
pyreadline/modes/emacs.py
commonprefix
def commonprefix(m): u"Given a list of pathnames, returns the longest common leading component" if not m: return '' prefix = m[0] for item in m: for i in range(len(prefix)): if prefix[:i + 1].lower() != item[:i + 1].lower(): prefix = prefix[:i] ...
python
def commonprefix(m): u"Given a list of pathnames, returns the longest common leading component" if not m: return '' prefix = m[0] for item in m: for i in range(len(prefix)): if prefix[:i + 1].lower() != item[:i + 1].lower(): prefix = prefix[:i] ...
[ "def", "commonprefix", "(", "m", ")", ":", "if", "not", "m", ":", "return", "''", "prefix", "=", "m", "[", "0", "]", "for", "item", "in", "m", ":", "for", "i", "in", "range", "(", "len", "(", "prefix", ")", ")", ":", "if", "prefix", "[", ":",...
u"Given a list of pathnames, returns the longest common leading component
[ "u", "Given", "a", "list", "of", "pathnames", "returns", "the", "longest", "common", "leading", "component" ]
40f9d2285662ff8b61e0468b4196acee089b273b
https://github.com/SeattleTestbed/seash/blob/40f9d2285662ff8b61e0468b4196acee089b273b/pyreadline/modes/emacs.py#L718-L730
40,948
SeattleTestbed/seash
pyreadline/modes/emacs.py
IncrementalSearchPromptMode._init_incremental_search
def _init_incremental_search(self, searchfun, init_event): u"""Initialize search prompt """ log("init_incremental_search") self.subsearch_query = u'' self.subsearch_fun = searchfun self.subsearch_old_line = self.l_buffer.get_line_text() queue = self.proce...
python
def _init_incremental_search(self, searchfun, init_event): u"""Initialize search prompt """ log("init_incremental_search") self.subsearch_query = u'' self.subsearch_fun = searchfun self.subsearch_old_line = self.l_buffer.get_line_text() queue = self.proce...
[ "def", "_init_incremental_search", "(", "self", ",", "searchfun", ",", "init_event", ")", ":", "log", "(", "\"init_incremental_search\"", ")", "self", ".", "subsearch_query", "=", "u''", "self", ".", "subsearch_fun", "=", "searchfun", "self", ".", "subsearch_old_l...
u"""Initialize search prompt
[ "u", "Initialize", "search", "prompt" ]
40f9d2285662ff8b61e0468b4196acee089b273b
https://github.com/SeattleTestbed/seash/blob/40f9d2285662ff8b61e0468b4196acee089b273b/pyreadline/modes/emacs.py#L80-L107
40,949
SeattleTestbed/seash
pyreadline/modes/emacs.py
DigitArgumentMode._init_digit_argument
def _init_digit_argument(self, keyinfo): """Initialize search prompt """ c = self.console line = self.l_buffer.get_line_text() self._digit_argument_oldprompt = self.prompt queue = self.process_keyevent_queue queue = self.process_keyevent_queue queu...
python
def _init_digit_argument(self, keyinfo): """Initialize search prompt """ c = self.console line = self.l_buffer.get_line_text() self._digit_argument_oldprompt = self.prompt queue = self.process_keyevent_queue queue = self.process_keyevent_queue queu...
[ "def", "_init_digit_argument", "(", "self", ",", "keyinfo", ")", ":", "c", "=", "self", ".", "console", "line", "=", "self", ".", "l_buffer", ".", "get_line_text", "(", ")", "self", ".", "_digit_argument_oldprompt", "=", "self", ".", "prompt", "queue", "="...
Initialize search prompt
[ "Initialize", "search", "prompt" ]
40f9d2285662ff8b61e0468b4196acee089b273b
https://github.com/SeattleTestbed/seash/blob/40f9d2285662ff8b61e0468b4196acee089b273b/pyreadline/modes/emacs.py#L196-L212
40,950
SeattleTestbed/seash
pyreadline/modes/emacs.py
EmacsMode._process_keyevent
def _process_keyevent(self, keyinfo): u"""return True when line is final """ #Process exit keys. Only exit on empty line log(u"_process_keyevent <%s>"%keyinfo) def nop(e): pass if self.next_meta: self.next_meta = False keyinf...
python
def _process_keyevent(self, keyinfo): u"""return True when line is final """ #Process exit keys. Only exit on empty line log(u"_process_keyevent <%s>"%keyinfo) def nop(e): pass if self.next_meta: self.next_meta = False keyinf...
[ "def", "_process_keyevent", "(", "self", ",", "keyinfo", ")", ":", "#Process exit keys. Only exit on empty line\r", "log", "(", "u\"_process_keyevent <%s>\"", "%", "keyinfo", ")", "def", "nop", "(", "e", ")", ":", "pass", "if", "self", ".", "next_meta", ":", "se...
u"""return True when line is final
[ "u", "return", "True", "when", "line", "is", "final" ]
40f9d2285662ff8b61e0468b4196acee089b273b
https://github.com/SeattleTestbed/seash/blob/40f9d2285662ff8b61e0468b4196acee089b273b/pyreadline/modes/emacs.py#L251-L290
40,951
SeattleTestbed/seash
pyreadline/modes/emacs.py
EmacsMode.reverse_search_history
def reverse_search_history(self, e): # (C-r) u'''Search backward starting at the current line and moving up through the history as necessary. This is an incremental search.''' log("rev_search_history") self._init_incremental_search(self._history.reverse_search_history, e) s...
python
def reverse_search_history(self, e): # (C-r) u'''Search backward starting at the current line and moving up through the history as necessary. This is an incremental search.''' log("rev_search_history") self._init_incremental_search(self._history.reverse_search_history, e) s...
[ "def", "reverse_search_history", "(", "self", ",", "e", ")", ":", "# (C-r)\r", "log", "(", "\"rev_search_history\"", ")", "self", ".", "_init_incremental_search", "(", "self", ".", "_history", ".", "reverse_search_history", ",", "e", ")", "self", ".", "finalize"...
u'''Search backward starting at the current line and moving up through the history as necessary. This is an incremental search.
[ "u", "Search", "backward", "starting", "at", "the", "current", "line", "and", "moving", "up", "through", "the", "history", "as", "necessary", ".", "This", "is", "an", "incremental", "search", "." ]
40f9d2285662ff8b61e0468b4196acee089b273b
https://github.com/SeattleTestbed/seash/blob/40f9d2285662ff8b61e0468b4196acee089b273b/pyreadline/modes/emacs.py#L317-L322
40,952
SeattleTestbed/seash
pyreadline/modes/emacs.py
EmacsMode.forward_search_history
def forward_search_history(self, e): # (C-s) u'''Search forward starting at the current line and moving down through the the history as necessary. This is an incremental search.''' log("fwd_search_history") self._init_incremental_search(self._history.forward_search_history,...
python
def forward_search_history(self, e): # (C-s) u'''Search forward starting at the current line and moving down through the the history as necessary. This is an incremental search.''' log("fwd_search_history") self._init_incremental_search(self._history.forward_search_history,...
[ "def", "forward_search_history", "(", "self", ",", "e", ")", ":", "# (C-s)\r", "log", "(", "\"fwd_search_history\"", ")", "self", ".", "_init_incremental_search", "(", "self", ".", "_history", ".", "forward_search_history", ",", "e", ")", "self", ".", "finalize"...
u'''Search forward starting at the current line and moving down through the the history as necessary. This is an incremental search.
[ "u", "Search", "forward", "starting", "at", "the", "current", "line", "and", "moving", "down", "through", "the", "the", "history", "as", "necessary", ".", "This", "is", "an", "incremental", "search", "." ]
40f9d2285662ff8b61e0468b4196acee089b273b
https://github.com/SeattleTestbed/seash/blob/40f9d2285662ff8b61e0468b4196acee089b273b/pyreadline/modes/emacs.py#L324-L330
40,953
SeattleTestbed/seash
pyreadline/modes/emacs.py
EmacsMode.tab_insert
def tab_insert(self, e): # (M-TAB) u'''Insert a tab character. ''' cursor = min(self.l_buffer.point, len(self.l_buffer.line_buffer)) ws = ' ' * (self.tabstop - (cursor % self.tabstop)) self.insert_text(ws) self.finalize()
python
def tab_insert(self, e): # (M-TAB) u'''Insert a tab character. ''' cursor = min(self.l_buffer.point, len(self.l_buffer.line_buffer)) ws = ' ' * (self.tabstop - (cursor % self.tabstop)) self.insert_text(ws) self.finalize()
[ "def", "tab_insert", "(", "self", ",", "e", ")", ":", "# (M-TAB)\r", "cursor", "=", "min", "(", "self", ".", "l_buffer", ".", "point", ",", "len", "(", "self", ".", "l_buffer", ".", "line_buffer", ")", ")", "ws", "=", "' '", "*", "(", "self", ".", ...
u'''Insert a tab character.
[ "u", "Insert", "a", "tab", "character", "." ]
40f9d2285662ff8b61e0468b4196acee089b273b
https://github.com/SeattleTestbed/seash/blob/40f9d2285662ff8b61e0468b4196acee089b273b/pyreadline/modes/emacs.py#L389-L394
40,954
envi-idl/envipyarclib
envipyarclib/gptool/help.py
create
def create(filename, task, alias): """Creates a gptool help xml file.""" metadata = ET.Element('metadata', {'xml:lang': 'en'}) tool = ET.SubElement(metadata, 'tool', name=task.name, displayname=task.display_name, toolboxalias=alias) summary = ET.SubEle...
python
def create(filename, task, alias): """Creates a gptool help xml file.""" metadata = ET.Element('metadata', {'xml:lang': 'en'}) tool = ET.SubElement(metadata, 'tool', name=task.name, displayname=task.display_name, toolboxalias=alias) summary = ET.SubEle...
[ "def", "create", "(", "filename", ",", "task", ",", "alias", ")", ":", "metadata", "=", "ET", ".", "Element", "(", "'metadata'", ",", "{", "'xml:lang'", ":", "'en'", "}", ")", "tool", "=", "ET", ".", "SubElement", "(", "metadata", ",", "'tool'", ",",...
Creates a gptool help xml file.
[ "Creates", "a", "gptool", "help", "xml", "file", "." ]
90135652510c3d53c5f51177252c1fea2639bf22
https://github.com/envi-idl/envipyarclib/blob/90135652510c3d53c5f51177252c1fea2639bf22/envipyarclib/gptool/help.py#L10-L47
40,955
solocompt/plugs-core
plugs_core/clients.py
PlugsAPIClient.parse_params
def parse_params(self, params): """ Parsing params, params is a dict and the dict value can be a string or an iterable, namely a list, we need to process those iterables """ for (key, value) in params.items(): if not isinstance(value, str): ...
python
def parse_params(self, params): """ Parsing params, params is a dict and the dict value can be a string or an iterable, namely a list, we need to process those iterables """ for (key, value) in params.items(): if not isinstance(value, str): ...
[ "def", "parse_params", "(", "self", ",", "params", ")", ":", "for", "(", "key", ",", "value", ")", "in", "params", ".", "items", "(", ")", ":", "if", "not", "isinstance", "(", "value", ",", "str", ")", ":", "string_params", "=", "self", ".", "to_st...
Parsing params, params is a dict and the dict value can be a string or an iterable, namely a list, we need to process those iterables
[ "Parsing", "params", "params", "is", "a", "dict", "and", "the", "dict", "value", "can", "be", "a", "string", "or", "an", "iterable", "namely", "a", "list", "we", "need", "to", "process", "those", "iterables" ]
19fd23101fcfdabe657485f0a22e6b63e2b44f9d
https://github.com/solocompt/plugs-core/blob/19fd23101fcfdabe657485f0a22e6b63e2b44f9d/plugs_core/clients.py#L14-L25
40,956
solocompt/plugs-core
plugs_core/clients.py
PlugsAPIClient.to_string
def to_string(self, obj): """ Picks up an object and transforms it into a string, by coercing each element in an iterable to a string and then joining them, or by trying to coerce the object directly """ try: converted = [str(element) for element in ob...
python
def to_string(self, obj): """ Picks up an object and transforms it into a string, by coercing each element in an iterable to a string and then joining them, or by trying to coerce the object directly """ try: converted = [str(element) for element in ob...
[ "def", "to_string", "(", "self", ",", "obj", ")", ":", "try", ":", "converted", "=", "[", "str", "(", "element", ")", "for", "element", "in", "obj", "]", "string", "=", "','", ".", "join", "(", "converted", ")", "except", "TypeError", ":", "# for now...
Picks up an object and transforms it into a string, by coercing each element in an iterable to a string and then joining them, or by trying to coerce the object directly
[ "Picks", "up", "an", "object", "and", "transforms", "it", "into", "a", "string", "by", "coercing", "each", "element", "in", "an", "iterable", "to", "a", "string", "and", "then", "joining", "them", "or", "by", "trying", "to", "coerce", "the", "object", "d...
19fd23101fcfdabe657485f0a22e6b63e2b44f9d
https://github.com/solocompt/plugs-core/blob/19fd23101fcfdabe657485f0a22e6b63e2b44f9d/plugs_core/clients.py#L27-L40
40,957
solocompt/plugs-core
plugs_core/clients.py
PlugsAPIClient.filter
def filter(self, endpoint, params): """ Makes a get request by construction the path from an endpoint and a dict with filter query params e.g. params = {'category__in': [1,2]} response = self.client.filter('/experiences/', params) """ params = sel...
python
def filter(self, endpoint, params): """ Makes a get request by construction the path from an endpoint and a dict with filter query params e.g. params = {'category__in': [1,2]} response = self.client.filter('/experiences/', params) """ params = sel...
[ "def", "filter", "(", "self", ",", "endpoint", ",", "params", ")", ":", "params", "=", "self", ".", "parse_params", "(", "params", ")", "params", "=", "urlencode", "(", "params", ")", "path", "=", "'{0}?{1}'", ".", "format", "(", "endpoint", ",", "para...
Makes a get request by construction the path from an endpoint and a dict with filter query params e.g. params = {'category__in': [1,2]} response = self.client.filter('/experiences/', params)
[ "Makes", "a", "get", "request", "by", "construction", "the", "path", "from", "an", "endpoint", "and", "a", "dict", "with", "filter", "query", "params" ]
19fd23101fcfdabe657485f0a22e6b63e2b44f9d
https://github.com/solocompt/plugs-core/blob/19fd23101fcfdabe657485f0a22e6b63e2b44f9d/plugs_core/clients.py#L42-L55
40,958
helixyte/everest
everest/entities/attributes.py
is_domain_class_member_attribute
def is_domain_class_member_attribute(ent, attr_name): """ Checks if the given attribute name is a entity attribute of the given registered resource. """ attr = get_domain_class_attribute(ent, attr_name) return attr.kind == RESOURCE_ATTRIBUTE_KINDS.MEMBER
python
def is_domain_class_member_attribute(ent, attr_name): """ Checks if the given attribute name is a entity attribute of the given registered resource. """ attr = get_domain_class_attribute(ent, attr_name) return attr.kind == RESOURCE_ATTRIBUTE_KINDS.MEMBER
[ "def", "is_domain_class_member_attribute", "(", "ent", ",", "attr_name", ")", ":", "attr", "=", "get_domain_class_attribute", "(", "ent", ",", "attr_name", ")", "return", "attr", ".", "kind", "==", "RESOURCE_ATTRIBUTE_KINDS", ".", "MEMBER" ]
Checks if the given attribute name is a entity attribute of the given registered resource.
[ "Checks", "if", "the", "given", "attribute", "name", "is", "a", "entity", "attribute", "of", "the", "given", "registered", "resource", "." ]
70c9b93c3061db5cb62428349d18b8fb8566411b
https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/entities/attributes.py#L52-L58
40,959
helixyte/everest
everest/entities/attributes.py
is_domain_class_collection_attribute
def is_domain_class_collection_attribute(ent, attr_name): """ Checks if the given attribute name is a aggregate attribute of the given registered resource. """ attr = get_domain_class_attribute(ent, attr_name) return attr.kind == RESOURCE_ATTRIBUTE_KINDS.COLLECTION
python
def is_domain_class_collection_attribute(ent, attr_name): """ Checks if the given attribute name is a aggregate attribute of the given registered resource. """ attr = get_domain_class_attribute(ent, attr_name) return attr.kind == RESOURCE_ATTRIBUTE_KINDS.COLLECTION
[ "def", "is_domain_class_collection_attribute", "(", "ent", ",", "attr_name", ")", ":", "attr", "=", "get_domain_class_attribute", "(", "ent", ",", "attr_name", ")", "return", "attr", ".", "kind", "==", "RESOURCE_ATTRIBUTE_KINDS", ".", "COLLECTION" ]
Checks if the given attribute name is a aggregate attribute of the given registered resource.
[ "Checks", "if", "the", "given", "attribute", "name", "is", "a", "aggregate", "attribute", "of", "the", "given", "registered", "resource", "." ]
70c9b93c3061db5cb62428349d18b8fb8566411b
https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/entities/attributes.py#L61-L67
40,960
AtomHash/evernode
evernode/models/base_user_model.py
BaseUserModel.set_password
def set_password(self, password): """ Set user password with hash """ self.password = Security.hash(password) self.save()
python
def set_password(self, password): """ Set user password with hash """ self.password = Security.hash(password) self.save()
[ "def", "set_password", "(", "self", ",", "password", ")", ":", "self", ".", "password", "=", "Security", ".", "hash", "(", "password", ")", "self", ".", "save", "(", ")" ]
Set user password with hash
[ "Set", "user", "password", "with", "hash" ]
b2fb91555fb937a3f3eba41db56dee26f9b034be
https://github.com/AtomHash/evernode/blob/b2fb91555fb937a3f3eba41db56dee26f9b034be/evernode/models/base_user_model.py#L34-L37
40,961
AtomHash/evernode
evernode/models/base_user_model.py
BaseUserModel.create_password_reset
def create_password_reset(cls, email, valid_for=3600) -> str: """ Create a password reset request in the user_password_resets database table. Hashed code gets stored in the database. Returns unhashed reset code """ user = cls.where_email(email) if user is N...
python
def create_password_reset(cls, email, valid_for=3600) -> str: """ Create a password reset request in the user_password_resets database table. Hashed code gets stored in the database. Returns unhashed reset code """ user = cls.where_email(email) if user is N...
[ "def", "create_password_reset", "(", "cls", ",", "email", ",", "valid_for", "=", "3600", ")", "->", "str", ":", "user", "=", "cls", ".", "where_email", "(", "email", ")", "if", "user", "is", "None", ":", "return", "None", "PasswordResetModel", ".", "dele...
Create a password reset request in the user_password_resets database table. Hashed code gets stored in the database. Returns unhashed reset code
[ "Create", "a", "password", "reset", "request", "in", "the", "user_password_resets", "database", "table", ".", "Hashed", "code", "gets", "stored", "in", "the", "database", ".", "Returns", "unhashed", "reset", "code" ]
b2fb91555fb937a3f3eba41db56dee26f9b034be
https://github.com/AtomHash/evernode/blob/b2fb91555fb937a3f3eba41db56dee26f9b034be/evernode/models/base_user_model.py#L40-L60
40,962
AtomHash/evernode
evernode/models/base_user_model.py
BaseUserModel.validate_password_reset
def validate_password_reset(cls, code, new_password): """ Validates an unhashed code against a hashed code. Once the code has been validated and confirmed new_password will replace the old users password """ password_reset_model = \ PasswordResetModel.w...
python
def validate_password_reset(cls, code, new_password): """ Validates an unhashed code against a hashed code. Once the code has been validated and confirmed new_password will replace the old users password """ password_reset_model = \ PasswordResetModel.w...
[ "def", "validate_password_reset", "(", "cls", ",", "code", ",", "new_password", ")", ":", "password_reset_model", "=", "PasswordResetModel", ".", "where_code", "(", "code", ")", "if", "password_reset_model", "is", "None", ":", "return", "None", "jwt", "=", "JWT"...
Validates an unhashed code against a hashed code. Once the code has been validated and confirmed new_password will replace the old users password
[ "Validates", "an", "unhashed", "code", "against", "a", "hashed", "code", ".", "Once", "the", "code", "has", "been", "validated", "and", "confirmed", "new_password", "will", "replace", "the", "old", "users", "password" ]
b2fb91555fb937a3f3eba41db56dee26f9b034be
https://github.com/AtomHash/evernode/blob/b2fb91555fb937a3f3eba41db56dee26f9b034be/evernode/models/base_user_model.py#L63-L81
40,963
AtomHash/evernode
evernode/models/base_user_model.py
BaseUserModel.by_current_session
def by_current_session(cls): """ Returns current user session """ session = Session.current_session() if session is None: return None return cls.where_id(session.user_id)
python
def by_current_session(cls): """ Returns current user session """ session = Session.current_session() if session is None: return None return cls.where_id(session.user_id)
[ "def", "by_current_session", "(", "cls", ")", ":", "session", "=", "Session", ".", "current_session", "(", ")", "if", "session", "is", "None", ":", "return", "None", "return", "cls", ".", "where_id", "(", "session", ".", "user_id", ")" ]
Returns current user session
[ "Returns", "current", "user", "session" ]
b2fb91555fb937a3f3eba41db56dee26f9b034be
https://github.com/AtomHash/evernode/blob/b2fb91555fb937a3f3eba41db56dee26f9b034be/evernode/models/base_user_model.py#L84-L89
40,964
PonteIneptique/flask-github-proxy
flask_github_proxy/models.py
ProxyError.AdvancedJsonify
def AdvancedJsonify(data, status_code): """ Advanced Jsonify Response Maker :param data: Data :param status_code: Status_code :return: Response """ response = jsonify(data) response.status_code = status_code return response
python
def AdvancedJsonify(data, status_code): """ Advanced Jsonify Response Maker :param data: Data :param status_code: Status_code :return: Response """ response = jsonify(data) response.status_code = status_code return response
[ "def", "AdvancedJsonify", "(", "data", ",", "status_code", ")", ":", "response", "=", "jsonify", "(", "data", ")", "response", ".", "status_code", "=", "status_code", "return", "response" ]
Advanced Jsonify Response Maker :param data: Data :param status_code: Status_code :return: Response
[ "Advanced", "Jsonify", "Response", "Maker" ]
f0a60639342f7c0834360dc12a099bfc3a06d939
https://github.com/PonteIneptique/flask-github-proxy/blob/f0a60639342f7c0834360dc12a099bfc3a06d939/flask_github_proxy/models.py#L74-L83
40,965
PonteIneptique/flask-github-proxy
flask_github_proxy/models.py
ProxyError.response
def response(self, callback=None): """ View representation of the object :param callback: Function to represent the error in view. Default : flask.jsonify :type callback: function :return: View """ if not callback: callback = type(self).AdvancedJsonify ...
python
def response(self, callback=None): """ View representation of the object :param callback: Function to represent the error in view. Default : flask.jsonify :type callback: function :return: View """ if not callback: callback = type(self).AdvancedJsonify ...
[ "def", "response", "(", "self", ",", "callback", "=", "None", ")", ":", "if", "not", "callback", ":", "callback", "=", "type", "(", "self", ")", ".", "AdvancedJsonify", "resp", "=", "{", "\"status\"", ":", "\"error\"", ",", "\"message\"", ":", "self", ...
View representation of the object :param callback: Function to represent the error in view. Default : flask.jsonify :type callback: function :return: View
[ "View", "representation", "of", "the", "object" ]
f0a60639342f7c0834360dc12a099bfc3a06d939
https://github.com/PonteIneptique/flask-github-proxy/blob/f0a60639342f7c0834360dc12a099bfc3a06d939/flask_github_proxy/models.py#L85-L103
40,966
AtomHash/evernode
evernode/models/json_model.py
JsonModel.__json
def __json(self): """ Using the exclude lists, convert fields to a string. """ if self.exclude_list is None: self.exclude_list = [] fields = {} for key, item in vars(self).items(): if hasattr(self, '_sa_instance_state'): # ...
python
def __json(self): """ Using the exclude lists, convert fields to a string. """ if self.exclude_list is None: self.exclude_list = [] fields = {} for key, item in vars(self).items(): if hasattr(self, '_sa_instance_state'): # ...
[ "def", "__json", "(", "self", ")", ":", "if", "self", ".", "exclude_list", "is", "None", ":", "self", ".", "exclude_list", "=", "[", "]", "fields", "=", "{", "}", "for", "key", ",", "item", "in", "vars", "(", "self", ")", ".", "items", "(", ")", ...
Using the exclude lists, convert fields to a string.
[ "Using", "the", "exclude", "lists", "convert", "fields", "to", "a", "string", "." ]
b2fb91555fb937a3f3eba41db56dee26f9b034be
https://github.com/AtomHash/evernode/blob/b2fb91555fb937a3f3eba41db56dee26f9b034be/evernode/models/json_model.py#L21-L40
40,967
helixyte/everest
everest/repositories/state.py
EntityState.manage
def manage(cls, entity, unit_of_work): """ Manages the given entity under the given Unit Of Work. If `entity` is already managed by the given Unit Of Work, nothing is done. :raises ValueError: If the given entity is already under management by a different Unit Of Work...
python
def manage(cls, entity, unit_of_work): """ Manages the given entity under the given Unit Of Work. If `entity` is already managed by the given Unit Of Work, nothing is done. :raises ValueError: If the given entity is already under management by a different Unit Of Work...
[ "def", "manage", "(", "cls", ",", "entity", ",", "unit_of_work", ")", ":", "if", "hasattr", "(", "entity", ",", "'__everest__'", ")", ":", "if", "not", "unit_of_work", "is", "entity", ".", "__everest__", ".", "unit_of_work", ":", "raise", "ValueError", "("...
Manages the given entity under the given Unit Of Work. If `entity` is already managed by the given Unit Of Work, nothing is done. :raises ValueError: If the given entity is already under management by a different Unit Of Work.
[ "Manages", "the", "given", "entity", "under", "the", "given", "Unit", "Of", "Work", "." ]
70c9b93c3061db5cb62428349d18b8fb8566411b
https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/repositories/state.py#L58-L73
40,968
helixyte/everest
everest/repositories/state.py
EntityState.release
def release(cls, entity, unit_of_work): """ Releases the given entity from management under the given Unit Of Work. :raises ValueError: If `entity` is not managed at all or is not managed by the given Unit Of Work. """ if not hasattr(entity, '__everest__'): ...
python
def release(cls, entity, unit_of_work): """ Releases the given entity from management under the given Unit Of Work. :raises ValueError: If `entity` is not managed at all or is not managed by the given Unit Of Work. """ if not hasattr(entity, '__everest__'): ...
[ "def", "release", "(", "cls", ",", "entity", ",", "unit_of_work", ")", ":", "if", "not", "hasattr", "(", "entity", ",", "'__everest__'", ")", ":", "raise", "ValueError", "(", "'Trying to unregister an entity that has not '", "'been registered yet!'", ")", "elif", ...
Releases the given entity from management under the given Unit Of Work. :raises ValueError: If `entity` is not managed at all or is not managed by the given Unit Of Work.
[ "Releases", "the", "given", "entity", "from", "management", "under", "the", "given", "Unit", "Of", "Work", "." ]
70c9b93c3061db5cb62428349d18b8fb8566411b
https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/repositories/state.py#L76-L90
40,969
helixyte/everest
everest/repositories/state.py
EntityState.get_state_data
def get_state_data(cls, entity): """ Returns the state data for the given entity. This also works for unmanaged entities. """ attrs = get_domain_class_attribute_iterator(type(entity)) return dict([(attr, get_nested_attribute(entity, attr.entity_attr...
python
def get_state_data(cls, entity): """ Returns the state data for the given entity. This also works for unmanaged entities. """ attrs = get_domain_class_attribute_iterator(type(entity)) return dict([(attr, get_nested_attribute(entity, attr.entity_attr...
[ "def", "get_state_data", "(", "cls", ",", "entity", ")", ":", "attrs", "=", "get_domain_class_attribute_iterator", "(", "type", "(", "entity", ")", ")", "return", "dict", "(", "[", "(", "attr", ",", "get_nested_attribute", "(", "entity", ",", "attr", ".", ...
Returns the state data for the given entity. This also works for unmanaged entities.
[ "Returns", "the", "state", "data", "for", "the", "given", "entity", "." ]
70c9b93c3061db5cb62428349d18b8fb8566411b
https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/repositories/state.py#L100-L110
40,970
helixyte/everest
everest/repositories/state.py
EntityState.set_state_data
def set_state_data(cls, entity, data): """ Sets the state data for the given entity to the given data. This also works for unmanaged entities. """ attr_names = get_domain_class_attribute_names(type(entity)) nested_items = [] for attr, new_attr_value in iteritems_...
python
def set_state_data(cls, entity, data): """ Sets the state data for the given entity to the given data. This also works for unmanaged entities. """ attr_names = get_domain_class_attribute_names(type(entity)) nested_items = [] for attr, new_attr_value in iteritems_...
[ "def", "set_state_data", "(", "cls", ",", "entity", ",", "data", ")", ":", "attr_names", "=", "get_domain_class_attribute_names", "(", "type", "(", "entity", ")", ")", "nested_items", "=", "[", "]", "for", "attr", ",", "new_attr_value", "in", "iteritems_", "...
Sets the state data for the given entity to the given data. This also works for unmanaged entities.
[ "Sets", "the", "state", "data", "for", "the", "given", "entity", "to", "the", "given", "data", "." ]
70c9b93c3061db5cb62428349d18b8fb8566411b
https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/repositories/state.py#L113-L135
40,971
helixyte/everest
everest/repositories/state.py
EntityState.transfer_state_data
def transfer_state_data(cls, source_entity, target_entity): """ Transfers instance state data from the given source entity to the given target entity. """ state_data = cls.get_state_data(source_entity) cls.set_state_data(target_entity, state_data)
python
def transfer_state_data(cls, source_entity, target_entity): """ Transfers instance state data from the given source entity to the given target entity. """ state_data = cls.get_state_data(source_entity) cls.set_state_data(target_entity, state_data)
[ "def", "transfer_state_data", "(", "cls", ",", "source_entity", ",", "target_entity", ")", ":", "state_data", "=", "cls", ".", "get_state_data", "(", "source_entity", ")", "cls", ".", "set_state_data", "(", "target_entity", ",", "state_data", ")" ]
Transfers instance state data from the given source entity to the given target entity.
[ "Transfers", "instance", "state", "data", "from", "the", "given", "source", "entity", "to", "the", "given", "target", "entity", "." ]
70c9b93c3061db5cb62428349d18b8fb8566411b
https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/repositories/state.py#L138-L144
40,972
helixyte/everest
everest/repositories/state.py
EntityState.__set_data
def __set_data(self, data): """ Sets the given state data on the given entity of the given class. :param data: State data to set. :type data: Dictionary mapping attributes to attribute values. :param entity: Entity to receive the state data. """ ent = self.__enti...
python
def __set_data(self, data): """ Sets the given state data on the given entity of the given class. :param data: State data to set. :type data: Dictionary mapping attributes to attribute values. :param entity: Entity to receive the state data. """ ent = self.__enti...
[ "def", "__set_data", "(", "self", ",", "data", ")", ":", "ent", "=", "self", ".", "__entity_ref", "(", ")", "self", ".", "set_state_data", "(", "ent", ",", "data", ")" ]
Sets the given state data on the given entity of the given class. :param data: State data to set. :type data: Dictionary mapping attributes to attribute values. :param entity: Entity to receive the state data.
[ "Sets", "the", "given", "state", "data", "on", "the", "given", "entity", "of", "the", "given", "class", "." ]
70c9b93c3061db5cb62428349d18b8fb8566411b
https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/repositories/state.py#L156-L165
40,973
Nekroze/partpy
partpy/partpyerror.py
PartpyError.pretty_print
def pretty_print(self, carrot=True): """Print the previous and current line with line numbers and a carret under the current character position. Will also print a message if one is given to this exception. """ output = ['\n'] output.extend([line.pretty_print() for line i...
python
def pretty_print(self, carrot=True): """Print the previous and current line with line numbers and a carret under the current character position. Will also print a message if one is given to this exception. """ output = ['\n'] output.extend([line.pretty_print() for line i...
[ "def", "pretty_print", "(", "self", ",", "carrot", "=", "True", ")", ":", "output", "=", "[", "'\\n'", "]", "output", ".", "extend", "(", "[", "line", ".", "pretty_print", "(", ")", "for", "line", "in", "self", ".", "partpyobj", ".", "get_surrounding_l...
Print the previous and current line with line numbers and a carret under the current character position. Will also print a message if one is given to this exception.
[ "Print", "the", "previous", "and", "current", "line", "with", "line", "numbers", "and", "a", "carret", "under", "the", "current", "character", "position", "." ]
dbb7d2fb285464fc43d85bc31f5af46192d301f6
https://github.com/Nekroze/partpy/blob/dbb7d2fb285464fc43d85bc31f5af46192d301f6/partpy/partpyerror.py#L17-L33
40,974
kapot65/python-df-parser
dfparser/rsh_parser.py
RshPackage.get_event
def get_event(self, num): """Extract event from dataset.""" if num < 0 or num >= self.params["events_num"]: raise IndexError("Index out of range [0:%s]" % (self.params["events_num"])) ch_num = self.params['channel_number'] ev_size = self.params['...
python
def get_event(self, num): """Extract event from dataset.""" if num < 0 or num >= self.params["events_num"]: raise IndexError("Index out of range [0:%s]" % (self.params["events_num"])) ch_num = self.params['channel_number'] ev_size = self.params['...
[ "def", "get_event", "(", "self", ",", "num", ")", ":", "if", "num", "<", "0", "or", "num", ">=", "self", ".", "params", "[", "\"events_num\"", "]", ":", "raise", "IndexError", "(", "\"Index out of range [0:%s]\"", "%", "(", "self", ".", "params", "[", ...
Extract event from dataset.
[ "Extract", "event", "from", "dataset", "." ]
bb3eec0fb7ca85d72cb1d9ed7415efe074594f26
https://github.com/kapot65/python-df-parser/blob/bb3eec0fb7ca85d72cb1d9ed7415efe074594f26/dfparser/rsh_parser.py#L351-L379
40,975
kapot65/python-df-parser
dfparser/rsh_parser.py
RshPackage.update_event_data
def update_event_data(self, num, data): """Update event data in dataset.""" if num < 0 or num >= self.params["events_num"]: raise IndexError("Index out of range [0:%s]" % (self.params["events_num"])) if isinstance(data, np.ndarray): raise Typ...
python
def update_event_data(self, num, data): """Update event data in dataset.""" if num < 0 or num >= self.params["events_num"]: raise IndexError("Index out of range [0:%s]" % (self.params["events_num"])) if isinstance(data, np.ndarray): raise Typ...
[ "def", "update_event_data", "(", "self", ",", "num", ",", "data", ")", ":", "if", "num", "<", "0", "or", "num", ">=", "self", ".", "params", "[", "\"events_num\"", "]", ":", "raise", "IndexError", "(", "\"Index out of range [0:%s]\"", "%", "(", "self", "...
Update event data in dataset.
[ "Update", "event", "data", "in", "dataset", "." ]
bb3eec0fb7ca85d72cb1d9ed7415efe074594f26
https://github.com/kapot65/python-df-parser/blob/bb3eec0fb7ca85d72cb1d9ed7415efe074594f26/dfparser/rsh_parser.py#L381-L402
40,976
yougov/vr.common
vr/common/balancer/nginx.py
str_to_pool
def str_to_pool(upstream): """ Given a string containing an nginx upstream section, return the pool name and list of nodes. """ name = re.search('upstream +(.*?) +{', upstream).group(1) nodes = re.findall('server +(.*?);', upstream) return name, nodes
python
def str_to_pool(upstream): """ Given a string containing an nginx upstream section, return the pool name and list of nodes. """ name = re.search('upstream +(.*?) +{', upstream).group(1) nodes = re.findall('server +(.*?);', upstream) return name, nodes
[ "def", "str_to_pool", "(", "upstream", ")", ":", "name", "=", "re", ".", "search", "(", "'upstream +(.*?) +{'", ",", "upstream", ")", ".", "group", "(", "1", ")", "nodes", "=", "re", ".", "findall", "(", "'server +(.*?);'", ",", "upstream", ")", "return"...
Given a string containing an nginx upstream section, return the pool name and list of nodes.
[ "Given", "a", "string", "containing", "an", "nginx", "upstream", "section", "return", "the", "pool", "name", "and", "list", "of", "nodes", "." ]
ca8ed0c50ba873fc51fdfeeaa25d3b8ec1b54eb4
https://github.com/yougov/vr.common/blob/ca8ed0c50ba873fc51fdfeeaa25d3b8ec1b54eb4/vr/common/balancer/nginx.py#L26-L33
40,977
asascience-open/paegan-transport
paegan/transport/models/behaviors/capability.py
Capability.calculate_vss
def calculate_vss(self, method=None): """ Calculate the vertical swimming speed of this behavior. Takes into account the vertical swimming speed and the variance. Parameters: method: "gaussian" (default) or "random" "random" (vss - variance) < X...
python
def calculate_vss(self, method=None): """ Calculate the vertical swimming speed of this behavior. Takes into account the vertical swimming speed and the variance. Parameters: method: "gaussian" (default) or "random" "random" (vss - variance) < X...
[ "def", "calculate_vss", "(", "self", ",", "method", "=", "None", ")", ":", "if", "self", ".", "variance", "==", "float", "(", "0", ")", ":", "return", "self", ".", "vss", "else", ":", "# Calculate gausian distribution and return", "if", "method", "==", "\"...
Calculate the vertical swimming speed of this behavior. Takes into account the vertical swimming speed and the variance. Parameters: method: "gaussian" (default) or "random" "random" (vss - variance) < X < (vss + variance)
[ "Calculate", "the", "vertical", "swimming", "speed", "of", "this", "behavior", ".", "Takes", "into", "account", "the", "vertical", "swimming", "speed", "and", "the", "variance", "." ]
99a7f4ea24f0f42d9b34d1fb0e87ab2c49315bd3
https://github.com/asascience-open/paegan-transport/blob/99a7f4ea24f0f42d9b34d1fb0e87ab2c49315bd3/paegan/transport/models/behaviors/capability.py#L27-L46
40,978
RI-imaging/qpformat
qpformat/file_formats/series_hdf5_hyperspy.py
SeriesHdf5HyperSpy._check_experiment
def _check_experiment(self, name): """Check the signal type of the experiment Returns ------- True, if the signal type is supported, False otherwise Raises ------ Warning if the signal type is not supported """ with h5py.File(name=self.path, mode...
python
def _check_experiment(self, name): """Check the signal type of the experiment Returns ------- True, if the signal type is supported, False otherwise Raises ------ Warning if the signal type is not supported """ with h5py.File(name=self.path, mode...
[ "def", "_check_experiment", "(", "self", ",", "name", ")", ":", "with", "h5py", ".", "File", "(", "name", "=", "self", ".", "path", ",", "mode", "=", "\"r\"", ")", "as", "h5", ":", "sigpath", "=", "\"/Experiments/{}/metadata/Signal\"", ".", "format", "("...
Check the signal type of the experiment Returns ------- True, if the signal type is supported, False otherwise Raises ------ Warning if the signal type is not supported
[ "Check", "the", "signal", "type", "of", "the", "experiment" ]
364e29d7d9e8b9f1d7a4a25c753d1baf9d73d5eb
https://github.com/RI-imaging/qpformat/blob/364e29d7d9e8b9f1d7a4a25c753d1baf9d73d5eb/qpformat/file_formats/series_hdf5_hyperspy.py#L29-L48
40,979
RI-imaging/qpformat
qpformat/file_formats/series_hdf5_hyperspy.py
SeriesHdf5HyperSpy._get_experiments
def _get_experiments(self): """Get all experiments from the hdf5 file""" explist = [] with h5py.File(name=self.path, mode="r") as h5: if "Experiments" not in h5: msg = "Group 'Experiments' not found in {}.".format(self.path) raise HyperSpyNoDataFoundEr...
python
def _get_experiments(self): """Get all experiments from the hdf5 file""" explist = [] with h5py.File(name=self.path, mode="r") as h5: if "Experiments" not in h5: msg = "Group 'Experiments' not found in {}.".format(self.path) raise HyperSpyNoDataFoundEr...
[ "def", "_get_experiments", "(", "self", ")", ":", "explist", "=", "[", "]", "with", "h5py", ".", "File", "(", "name", "=", "self", ".", "path", ",", "mode", "=", "\"r\"", ")", "as", "h5", ":", "if", "\"Experiments\"", "not", "in", "h5", ":", "msg",...
Get all experiments from the hdf5 file
[ "Get", "all", "experiments", "from", "the", "hdf5", "file" ]
364e29d7d9e8b9f1d7a4a25c753d1baf9d73d5eb
https://github.com/RI-imaging/qpformat/blob/364e29d7d9e8b9f1d7a4a25c753d1baf9d73d5eb/qpformat/file_formats/series_hdf5_hyperspy.py#L51-L68
40,980
RI-imaging/qpformat
qpformat/file_formats/series_hdf5_hyperspy.py
SeriesHdf5HyperSpy.verify
def verify(path): """Verify that `path` has the HyperSpy file format""" valid = False try: h5 = h5py.File(path, mode="r") except (OSError, IsADirectoryError): pass else: if ("file_format" in h5.attrs and h5.attrs["file_format"]....
python
def verify(path): """Verify that `path` has the HyperSpy file format""" valid = False try: h5 = h5py.File(path, mode="r") except (OSError, IsADirectoryError): pass else: if ("file_format" in h5.attrs and h5.attrs["file_format"]....
[ "def", "verify", "(", "path", ")", ":", "valid", "=", "False", "try", ":", "h5", "=", "h5py", ".", "File", "(", "path", ",", "mode", "=", "\"r\"", ")", "except", "(", "OSError", ",", "IsADirectoryError", ")", ":", "pass", "else", ":", "if", "(", ...
Verify that `path` has the HyperSpy file format
[ "Verify", "that", "path", "has", "the", "HyperSpy", "file", "format" ]
364e29d7d9e8b9f1d7a4a25c753d1baf9d73d5eb
https://github.com/RI-imaging/qpformat/blob/364e29d7d9e8b9f1d7a4a25c753d1baf9d73d5eb/qpformat/file_formats/series_hdf5_hyperspy.py#L101-L113
40,981
shoprunback/openflow
openflow/datasource.py
DataSource.transform
def transform(self, df): """ Transforms a DataFrame in place. Computes all outputs of the DataFrame. Args: df (pandas.DataFrame): DataFrame to transform. """ for name, function in self.outputs: df[name] = function(df)
python
def transform(self, df): """ Transforms a DataFrame in place. Computes all outputs of the DataFrame. Args: df (pandas.DataFrame): DataFrame to transform. """ for name, function in self.outputs: df[name] = function(df)
[ "def", "transform", "(", "self", ",", "df", ")", ":", "for", "name", ",", "function", "in", "self", ".", "outputs", ":", "df", "[", "name", "]", "=", "function", "(", "df", ")" ]
Transforms a DataFrame in place. Computes all outputs of the DataFrame. Args: df (pandas.DataFrame): DataFrame to transform.
[ "Transforms", "a", "DataFrame", "in", "place", ".", "Computes", "all", "outputs", "of", "the", "DataFrame", "." ]
5bd739a0890cf09198e39bb141f987abf960ee8e
https://github.com/shoprunback/openflow/blob/5bd739a0890cf09198e39bb141f987abf960ee8e/openflow/datasource.py#L30-L38
40,982
helixyte/everest
everest/traversalpath.py
TraversalPath.pop
def pop(self): """ Removes the last traversal path node from this traversal path. """ node = self.nodes.pop() self.__keys.remove(node.key)
python
def pop(self): """ Removes the last traversal path node from this traversal path. """ node = self.nodes.pop() self.__keys.remove(node.key)
[ "def", "pop", "(", "self", ")", ":", "node", "=", "self", ".", "nodes", ".", "pop", "(", ")", "self", ".", "__keys", ".", "remove", "(", "node", ".", "key", ")" ]
Removes the last traversal path node from this traversal path.
[ "Removes", "the", "last", "traversal", "path", "node", "from", "this", "traversal", "path", "." ]
70c9b93c3061db5cb62428349d18b8fb8566411b
https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/traversalpath.py#L51-L56
40,983
helixyte/everest
everest/traversalpath.py
TraversalPath.parent
def parent(self): """ Returns the proxy from the last node visited on the path, or `None`, if no node has been visited yet. """ if len(self.nodes) > 0: parent = self.nodes[-1].proxy else: parent = None return parent
python
def parent(self): """ Returns the proxy from the last node visited on the path, or `None`, if no node has been visited yet. """ if len(self.nodes) > 0: parent = self.nodes[-1].proxy else: parent = None return parent
[ "def", "parent", "(", "self", ")", ":", "if", "len", "(", "self", ".", "nodes", ")", ">", "0", ":", "parent", "=", "self", ".", "nodes", "[", "-", "1", "]", ".", "proxy", "else", ":", "parent", "=", "None", "return", "parent" ]
Returns the proxy from the last node visited on the path, or `None`, if no node has been visited yet.
[ "Returns", "the", "proxy", "from", "the", "last", "node", "visited", "on", "the", "path", "or", "None", "if", "no", "node", "has", "been", "visited", "yet", "." ]
70c9b93c3061db5cb62428349d18b8fb8566411b
https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/traversalpath.py#L65-L74
40,984
helixyte/everest
everest/traversalpath.py
TraversalPath.relation_operation
def relation_operation(self): """ Returns the relation operation from the last node visited on the path, or `None`, if no node has been visited yet. """ if len(self.nodes) > 0: rel_op = self.nodes[-1].relation_operation else: rel_op = None ...
python
def relation_operation(self): """ Returns the relation operation from the last node visited on the path, or `None`, if no node has been visited yet. """ if len(self.nodes) > 0: rel_op = self.nodes[-1].relation_operation else: rel_op = None ...
[ "def", "relation_operation", "(", "self", ")", ":", "if", "len", "(", "self", ".", "nodes", ")", ">", "0", ":", "rel_op", "=", "self", ".", "nodes", "[", "-", "1", "]", ".", "relation_operation", "else", ":", "rel_op", "=", "None", "return", "rel_op"...
Returns the relation operation from the last node visited on the path, or `None`, if no node has been visited yet.
[ "Returns", "the", "relation", "operation", "from", "the", "last", "node", "visited", "on", "the", "path", "or", "None", "if", "no", "node", "has", "been", "visited", "yet", "." ]
70c9b93c3061db5cb62428349d18b8fb8566411b
https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/traversalpath.py#L77-L86
40,985
SeattleTestbed/seash
pyreadline/unicode_helper.py
ensure_unicode
def ensure_unicode(text): u"""helper to ensure that text passed to WriteConsoleW is unicode""" if isinstance(text, str): try: return text.decode(pyreadline_codepage, u"replace") except (LookupError, TypeError): return text.decode(u"ascii", u"replace") return te...
python
def ensure_unicode(text): u"""helper to ensure that text passed to WriteConsoleW is unicode""" if isinstance(text, str): try: return text.decode(pyreadline_codepage, u"replace") except (LookupError, TypeError): return text.decode(u"ascii", u"replace") return te...
[ "def", "ensure_unicode", "(", "text", ")", ":", "if", "isinstance", "(", "text", ",", "str", ")", ":", "try", ":", "return", "text", ".", "decode", "(", "pyreadline_codepage", ",", "u\"replace\"", ")", "except", "(", "LookupError", ",", "TypeError", ")", ...
u"""helper to ensure that text passed to WriteConsoleW is unicode
[ "u", "helper", "to", "ensure", "that", "text", "passed", "to", "WriteConsoleW", "is", "unicode" ]
40f9d2285662ff8b61e0468b4196acee089b273b
https://github.com/SeattleTestbed/seash/blob/40f9d2285662ff8b61e0468b4196acee089b273b/pyreadline/unicode_helper.py#L20-L27
40,986
SeattleTestbed/seash
pyreadline/unicode_helper.py
ensure_str
def ensure_str(text): u"""Convert unicode to str using pyreadline_codepage""" if isinstance(text, unicode): try: return text.encode(pyreadline_codepage, u"replace") except (LookupError, TypeError): return text.encode(u"ascii", u"replace") return text
python
def ensure_str(text): u"""Convert unicode to str using pyreadline_codepage""" if isinstance(text, unicode): try: return text.encode(pyreadline_codepage, u"replace") except (LookupError, TypeError): return text.encode(u"ascii", u"replace") return text
[ "def", "ensure_str", "(", "text", ")", ":", "if", "isinstance", "(", "text", ",", "unicode", ")", ":", "try", ":", "return", "text", ".", "encode", "(", "pyreadline_codepage", ",", "u\"replace\"", ")", "except", "(", "LookupError", ",", "TypeError", ")", ...
u"""Convert unicode to str using pyreadline_codepage
[ "u", "Convert", "unicode", "to", "str", "using", "pyreadline_codepage" ]
40f9d2285662ff8b61e0468b4196acee089b273b
https://github.com/SeattleTestbed/seash/blob/40f9d2285662ff8b61e0468b4196acee089b273b/pyreadline/unicode_helper.py#L29-L36
40,987
shaunvxc/unwrapper
unwrapper/application.py
unwrap_raw
def unwrap_raw(content): """ unwraps the callback and returns the raw content """ starting_symbol = get_start_symbol(content) ending_symbol = ']' if starting_symbol == '[' else '}' start = content.find(starting_symbol, 0) end = content.rfind(ending_symbol) return content[start:end+1]
python
def unwrap_raw(content): """ unwraps the callback and returns the raw content """ starting_symbol = get_start_symbol(content) ending_symbol = ']' if starting_symbol == '[' else '}' start = content.find(starting_symbol, 0) end = content.rfind(ending_symbol) return content[start:end+1]
[ "def", "unwrap_raw", "(", "content", ")", ":", "starting_symbol", "=", "get_start_symbol", "(", "content", ")", "ending_symbol", "=", "']'", "if", "starting_symbol", "==", "'['", "else", "'}'", "start", "=", "content", ".", "find", "(", "starting_symbol", ",",...
unwraps the callback and returns the raw content
[ "unwraps", "the", "callback", "and", "returns", "the", "raw", "content" ]
2d08835f4cf4a2b3b75d5937399a42ac38ef38ea
https://github.com/shaunvxc/unwrapper/blob/2d08835f4cf4a2b3b75d5937399a42ac38ef38ea/unwrapper/application.py#L23-L30
40,988
MKLab-ITI/reveal-user-annotation
reveal_user_annotation/text/text_util.py
combine_word_list
def combine_word_list(word_list): """ Combine word list into a bag-of-words. Input: - word_list: This is a python list of strings. Output: - bag_of_words: This is the corresponding multi-set or bag-of-words, in the form of a python dictionary. """ bag_of_words = collections.defaultdict(int) ...
python
def combine_word_list(word_list): """ Combine word list into a bag-of-words. Input: - word_list: This is a python list of strings. Output: - bag_of_words: This is the corresponding multi-set or bag-of-words, in the form of a python dictionary. """ bag_of_words = collections.defaultdict(int) ...
[ "def", "combine_word_list", "(", "word_list", ")", ":", "bag_of_words", "=", "collections", ".", "defaultdict", "(", "int", ")", "for", "word", "in", "word_list", ":", "bag_of_words", "[", "word", "]", "+=", "1", "return", "bag_of_words" ]
Combine word list into a bag-of-words. Input: - word_list: This is a python list of strings. Output: - bag_of_words: This is the corresponding multi-set or bag-of-words, in the form of a python dictionary.
[ "Combine", "word", "list", "into", "a", "bag", "-", "of", "-", "words", "." ]
ed019c031857b091e5601f53ba3f01a499a0e3ef
https://github.com/MKLab-ITI/reveal-user-annotation/blob/ed019c031857b091e5601f53ba3f01a499a0e3ef/reveal_user_annotation/text/text_util.py#L9-L22
40,989
MKLab-ITI/reveal-user-annotation
reveal_user_annotation/text/text_util.py
reduce_list_of_bags_of_words
def reduce_list_of_bags_of_words(list_of_keyword_sets): """ Reduces a number of keyword sets to a bag-of-words. Input: - list_of_keyword_sets: This is a python list of sets of strings. Output: - bag_of_words: This is the corresponding multi-set or bag-of-words, in the form of a python dictionary. ...
python
def reduce_list_of_bags_of_words(list_of_keyword_sets): """ Reduces a number of keyword sets to a bag-of-words. Input: - list_of_keyword_sets: This is a python list of sets of strings. Output: - bag_of_words: This is the corresponding multi-set or bag-of-words, in the form of a python dictionary. ...
[ "def", "reduce_list_of_bags_of_words", "(", "list_of_keyword_sets", ")", ":", "bag_of_words", "=", "dict", "(", ")", "get_bag_of_words_keys", "=", "bag_of_words", ".", "keys", "for", "keyword_set", "in", "list_of_keyword_sets", ":", "for", "keyword", "in", "keyword_se...
Reduces a number of keyword sets to a bag-of-words. Input: - list_of_keyword_sets: This is a python list of sets of strings. Output: - bag_of_words: This is the corresponding multi-set or bag-of-words, in the form of a python dictionary.
[ "Reduces", "a", "number", "of", "keyword", "sets", "to", "a", "bag", "-", "of", "-", "words", "." ]
ed019c031857b091e5601f53ba3f01a499a0e3ef
https://github.com/MKLab-ITI/reveal-user-annotation/blob/ed019c031857b091e5601f53ba3f01a499a0e3ef/reveal_user_annotation/text/text_util.py#L25-L42
40,990
MKLab-ITI/reveal-user-annotation
reveal_user_annotation/text/text_util.py
query_list_of_words
def query_list_of_words(target_word, list_of_words, edit_distance=1): """ Checks whether a target word is within editing distance of any one in a set of keywords. Inputs: - target_word: A string containing the word we want to search in a list. - list_of_words: A python list of words. ...
python
def query_list_of_words(target_word, list_of_words, edit_distance=1): """ Checks whether a target word is within editing distance of any one in a set of keywords. Inputs: - target_word: A string containing the word we want to search in a list. - list_of_words: A python list of words. ...
[ "def", "query_list_of_words", "(", "target_word", ",", "list_of_words", ",", "edit_distance", "=", "1", ")", ":", "# Initialize lists", "new_list_of_words", "=", "list", "(", ")", "found_list_of_words", "=", "list", "(", ")", "append_left_keyword", "=", "new_list_of...
Checks whether a target word is within editing distance of any one in a set of keywords. Inputs: - target_word: A string containing the word we want to search in a list. - list_of_words: A python list of words. - edit_distance: For larger words, we also check for similar words based on edit...
[ "Checks", "whether", "a", "target", "word", "is", "within", "editing", "distance", "of", "any", "one", "in", "a", "set", "of", "keywords", "." ]
ed019c031857b091e5601f53ba3f01a499a0e3ef
https://github.com/MKLab-ITI/reveal-user-annotation/blob/ed019c031857b091e5601f53ba3f01a499a0e3ef/reveal_user_annotation/text/text_util.py#L86-L118
40,991
Cadasta/django-jsonattrs
jsonattrs/signals.py
fixup_instance
def fixup_instance(sender, **kwargs): """ Cache JSONAttributes data on instance and vice versa for convenience. """ instance = kwargs['instance'] for model_field in instance._meta.fields: if not isinstance(model_field, JSONAttributeField): continue if hasattr(instance, ...
python
def fixup_instance(sender, **kwargs): """ Cache JSONAttributes data on instance and vice versa for convenience. """ instance = kwargs['instance'] for model_field in instance._meta.fields: if not isinstance(model_field, JSONAttributeField): continue if hasattr(instance, ...
[ "def", "fixup_instance", "(", "sender", ",", "*", "*", "kwargs", ")", ":", "instance", "=", "kwargs", "[", "'instance'", "]", "for", "model_field", "in", "instance", ".", "_meta", ".", "fields", ":", "if", "not", "isinstance", "(", "model_field", ",", "J...
Cache JSONAttributes data on instance and vice versa for convenience.
[ "Cache", "JSONAttributes", "data", "on", "instance", "and", "vice", "versa", "for", "convenience", "." ]
5149e08ec84da00dd73bd3fe548bc52fd361667c
https://github.com/Cadasta/django-jsonattrs/blob/5149e08ec84da00dd73bd3fe548bc52fd361667c/jsonattrs/signals.py#L12-L42
40,992
MostAwesomeDude/blackjack
blackjack.py
Node.size
def size(self): """ Recursively find size of a tree. Slow. """ if self is NULL: return 0 return 1 + self.left.size() + self.right.size()
python
def size(self): """ Recursively find size of a tree. Slow. """ if self is NULL: return 0 return 1 + self.left.size() + self.right.size()
[ "def", "size", "(", "self", ")", ":", "if", "self", "is", "NULL", ":", "return", "0", "return", "1", "+", "self", ".", "left", ".", "size", "(", ")", "+", "self", ".", "right", ".", "size", "(", ")" ]
Recursively find size of a tree. Slow.
[ "Recursively", "find", "size", "of", "a", "tree", ".", "Slow", "." ]
1346642e353719ab68c0dc3573aa33b688431bf8
https://github.com/MostAwesomeDude/blackjack/blob/1346642e353719ab68c0dc3573aa33b688431bf8/blackjack.py#L7-L14
40,993
MostAwesomeDude/blackjack
blackjack.py
Node.find_prekeyed
def find_prekeyed(self, value, key): """ Find a value in a node, using a key function. The value is already a key. """ while self is not NULL: direction = cmp(value, key(self.value)) if direction < 0: self = self.left elif dire...
python
def find_prekeyed(self, value, key): """ Find a value in a node, using a key function. The value is already a key. """ while self is not NULL: direction = cmp(value, key(self.value)) if direction < 0: self = self.left elif dire...
[ "def", "find_prekeyed", "(", "self", ",", "value", ",", "key", ")", ":", "while", "self", "is", "not", "NULL", ":", "direction", "=", "cmp", "(", "value", ",", "key", "(", "self", ".", "value", ")", ")", "if", "direction", "<", "0", ":", "self", ...
Find a value in a node, using a key function. The value is already a key.
[ "Find", "a", "value", "in", "a", "node", "using", "a", "key", "function", ".", "The", "value", "is", "already", "a", "key", "." ]
1346642e353719ab68c0dc3573aa33b688431bf8
https://github.com/MostAwesomeDude/blackjack/blob/1346642e353719ab68c0dc3573aa33b688431bf8/blackjack.py#L30-L43
40,994
MostAwesomeDude/blackjack
blackjack.py
Node.rotate_left
def rotate_left(self): """ Rotate the node to the left. """ right = self.right new = self._replace(right=self.right.left, red=True) top = right._replace(left=new, red=self.red) return top
python
def rotate_left(self): """ Rotate the node to the left. """ right = self.right new = self._replace(right=self.right.left, red=True) top = right._replace(left=new, red=self.red) return top
[ "def", "rotate_left", "(", "self", ")", ":", "right", "=", "self", ".", "right", "new", "=", "self", ".", "_replace", "(", "right", "=", "self", ".", "right", ".", "left", ",", "red", "=", "True", ")", "top", "=", "right", ".", "_replace", "(", "...
Rotate the node to the left.
[ "Rotate", "the", "node", "to", "the", "left", "." ]
1346642e353719ab68c0dc3573aa33b688431bf8
https://github.com/MostAwesomeDude/blackjack/blob/1346642e353719ab68c0dc3573aa33b688431bf8/blackjack.py#L45-L53
40,995
MostAwesomeDude/blackjack
blackjack.py
Node.flip
def flip(self): """ Flip colors of a node and its children. """ left = self.left._replace(red=not self.left.red) right = self.right._replace(red=not self.right.red) top = self._replace(left=left, right=right, red=not self.red) return top
python
def flip(self): """ Flip colors of a node and its children. """ left = self.left._replace(red=not self.left.red) right = self.right._replace(red=not self.right.red) top = self._replace(left=left, right=right, red=not self.red) return top
[ "def", "flip", "(", "self", ")", ":", "left", "=", "self", ".", "left", ".", "_replace", "(", "red", "=", "not", "self", ".", "left", ".", "red", ")", "right", "=", "self", ".", "right", ".", "_replace", "(", "red", "=", "not", "self", ".", "ri...
Flip colors of a node and its children.
[ "Flip", "colors", "of", "a", "node", "and", "its", "children", "." ]
1346642e353719ab68c0dc3573aa33b688431bf8
https://github.com/MostAwesomeDude/blackjack/blob/1346642e353719ab68c0dc3573aa33b688431bf8/blackjack.py#L65-L73
40,996
MostAwesomeDude/blackjack
blackjack.py
Node.balance
def balance(self): """ Balance a node. The balance is inductive and relies on all subtrees being balanced recursively or by construction. If the subtrees are not balanced, then this will not fix them. """ # Always lean left with red nodes. if self.right....
python
def balance(self): """ Balance a node. The balance is inductive and relies on all subtrees being balanced recursively or by construction. If the subtrees are not balanced, then this will not fix them. """ # Always lean left with red nodes. if self.right....
[ "def", "balance", "(", "self", ")", ":", "# Always lean left with red nodes.", "if", "self", ".", "right", ".", "red", ":", "self", "=", "self", ".", "rotate_left", "(", ")", "# Never permit red nodes to have red children. Note that if the left-hand", "# node is NULL, it ...
Balance a node. The balance is inductive and relies on all subtrees being balanced recursively or by construction. If the subtrees are not balanced, then this will not fix them.
[ "Balance", "a", "node", "." ]
1346642e353719ab68c0dc3573aa33b688431bf8
https://github.com/MostAwesomeDude/blackjack/blob/1346642e353719ab68c0dc3573aa33b688431bf8/blackjack.py#L75-L99
40,997
MostAwesomeDude/blackjack
blackjack.py
Node.insert
def insert(self, value, key): """ Insert a value into a tree rooted at the given node, and return whether this was an insertion or update. Balances the tree during insertion. An update is performed instead of an insertion if a value in the tree compares equal to the new...
python
def insert(self, value, key): """ Insert a value into a tree rooted at the given node, and return whether this was an insertion or update. Balances the tree during insertion. An update is performed instead of an insertion if a value in the tree compares equal to the new...
[ "def", "insert", "(", "self", ",", "value", ",", "key", ")", ":", "# Base case: Insertion into the empty tree is just creating a new node", "# with no children.", "if", "self", "is", "NULL", ":", "return", "Node", "(", "value", ",", "NULL", ",", "NULL", ",", "True...
Insert a value into a tree rooted at the given node, and return whether this was an insertion or update. Balances the tree during insertion. An update is performed instead of an insertion if a value in the tree compares equal to the new value.
[ "Insert", "a", "value", "into", "a", "tree", "rooted", "at", "the", "given", "node", "and", "return", "whether", "this", "was", "an", "insertion", "or", "update", "." ]
1346642e353719ab68c0dc3573aa33b688431bf8
https://github.com/MostAwesomeDude/blackjack/blob/1346642e353719ab68c0dc3573aa33b688431bf8/blackjack.py#L101-L133
40,998
MostAwesomeDude/blackjack
blackjack.py
Node.move_red_left
def move_red_left(self): """ Shuffle red to the left of a tree. """ self = self.flip() if self.right is not NULL and self.right.left.red: self = self._replace(right=self.right.rotate_right()) self = self.rotate_left().flip() return self
python
def move_red_left(self): """ Shuffle red to the left of a tree. """ self = self.flip() if self.right is not NULL and self.right.left.red: self = self._replace(right=self.right.rotate_right()) self = self.rotate_left().flip() return self
[ "def", "move_red_left", "(", "self", ")", ":", "self", "=", "self", ".", "flip", "(", ")", "if", "self", ".", "right", "is", "not", "NULL", "and", "self", ".", "right", ".", "left", ".", "red", ":", "self", "=", "self", ".", "_replace", "(", "rig...
Shuffle red to the left of a tree.
[ "Shuffle", "red", "to", "the", "left", "of", "a", "tree", "." ]
1346642e353719ab68c0dc3573aa33b688431bf8
https://github.com/MostAwesomeDude/blackjack/blob/1346642e353719ab68c0dc3573aa33b688431bf8/blackjack.py#L135-L145
40,999
MostAwesomeDude/blackjack
blackjack.py
Node.move_red_right
def move_red_right(self): """ Shuffle red to the right of a tree. """ self = self.flip() if self.left is not NULL and self.left.left.red: self = self.rotate_right().flip() return self
python
def move_red_right(self): """ Shuffle red to the right of a tree. """ self = self.flip() if self.left is not NULL and self.left.left.red: self = self.rotate_right().flip() return self
[ "def", "move_red_right", "(", "self", ")", ":", "self", "=", "self", ".", "flip", "(", ")", "if", "self", ".", "left", "is", "not", "NULL", "and", "self", ".", "left", ".", "left", ".", "red", ":", "self", "=", "self", ".", "rotate_right", "(", "...
Shuffle red to the right of a tree.
[ "Shuffle", "red", "to", "the", "right", "of", "a", "tree", "." ]
1346642e353719ab68c0dc3573aa33b688431bf8
https://github.com/MostAwesomeDude/blackjack/blob/1346642e353719ab68c0dc3573aa33b688431bf8/blackjack.py#L147-L156