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
38,200
ooici/elasticpy
elasticpy/facet.py
ElasticFacet.terms
def terms(self, facet_name, field, size=10, order=None, all_terms=False, exclude=[], regex='', regex_flags=''): ''' Allow to specify field facets that return the N most frequent terms. Ordering: Allow to control the ordering of the terms facets, to be ordered by count, term, reverse_count or re...
python
def terms(self, facet_name, field, size=10, order=None, all_terms=False, exclude=[], regex='', regex_flags=''): ''' Allow to specify field facets that return the N most frequent terms. Ordering: Allow to control the ordering of the terms facets, to be ordered by count, term, reverse_count or re...
[ "def", "terms", "(", "self", ",", "facet_name", ",", "field", ",", "size", "=", "10", ",", "order", "=", "None", ",", "all_terms", "=", "False", ",", "exclude", "=", "[", "]", ",", "regex", "=", "''", ",", "regex_flags", "=", "''", ")", ":", "sel...
Allow to specify field facets that return the N most frequent terms. Ordering: Allow to control the ordering of the terms facets, to be ordered by count, term, reverse_count or reverse_term. The default is count. All Terms: Allow to get all the terms in the terms facet, ones that do not match a hit, wi...
[ "Allow", "to", "specify", "field", "facets", "that", "return", "the", "N", "most", "frequent", "terms", "." ]
ec221800a80c39e80d8c31667c5b138da39219f2
https://github.com/ooici/elasticpy/blob/ec221800a80c39e80d8c31667c5b138da39219f2/elasticpy/facet.py#L24-L46
38,201
toumorokoshi/sprinter
sprinter/next/environment/injections.py
backup_file
def backup_file(filename): """ create a backup of the file desired """ if not os.path.exists(filename): return BACKUP_SUFFIX = ".sprinter.bak" backup_filename = filename + BACKUP_SUFFIX shutil.copyfile(filename, backup_filename)
python
def backup_file(filename): """ create a backup of the file desired """ if not os.path.exists(filename): return BACKUP_SUFFIX = ".sprinter.bak" backup_filename = filename + BACKUP_SUFFIX shutil.copyfile(filename, backup_filename)
[ "def", "backup_file", "(", "filename", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "filename", ")", ":", "return", "BACKUP_SUFFIX", "=", "\".sprinter.bak\"", "backup_filename", "=", "filename", "+", "BACKUP_SUFFIX", "shutil", ".", "copyfile",...
create a backup of the file desired
[ "create", "a", "backup", "of", "the", "file", "desired" ]
846697a7a087e69c61d075232e754d6975a64152
https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/next/environment/injections.py#L162-L170
38,202
toumorokoshi/sprinter
sprinter/next/environment/injections.py
Injections.inject
def inject(self, filename, content): """ add the injection content to the dictionary """ # ensure content always has one trailing newline content = _unicode(content).rstrip() + "\n" if filename not in self.inject_dict: self.inject_dict[filename] = "" self.inject_dict[...
python
def inject(self, filename, content): """ add the injection content to the dictionary """ # ensure content always has one trailing newline content = _unicode(content).rstrip() + "\n" if filename not in self.inject_dict: self.inject_dict[filename] = "" self.inject_dict[...
[ "def", "inject", "(", "self", ",", "filename", ",", "content", ")", ":", "# ensure content always has one trailing newline", "content", "=", "_unicode", "(", "content", ")", ".", "rstrip", "(", ")", "+", "\"\\n\"", "if", "filename", "not", "in", "self", ".", ...
add the injection content to the dictionary
[ "add", "the", "injection", "content", "to", "the", "dictionary" ]
846697a7a087e69c61d075232e754d6975a64152
https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/next/environment/injections.py#L42-L48
38,203
toumorokoshi/sprinter
sprinter/next/environment/injections.py
Injections.commit
def commit(self): """ commit the injections desired, overwriting any previous injections in the file. """ self.logger.debug("Starting injections...") self.logger.debug("Injections dict is:") self.logger.debug(self.inject_dict) self.logger.debug("Clear list is:") self.logg...
python
def commit(self): """ commit the injections desired, overwriting any previous injections in the file. """ self.logger.debug("Starting injections...") self.logger.debug("Injections dict is:") self.logger.debug(self.inject_dict) self.logger.debug("Clear list is:") self.logg...
[ "def", "commit", "(", "self", ")", ":", "self", ".", "logger", ".", "debug", "(", "\"Starting injections...\"", ")", "self", ".", "logger", ".", "debug", "(", "\"Injections dict is:\"", ")", "self", ".", "logger", ".", "debug", "(", "self", ".", "inject_di...
commit the injections desired, overwriting any previous injections in the file.
[ "commit", "the", "injections", "desired", "overwriting", "any", "previous", "injections", "in", "the", "file", "." ]
846697a7a087e69c61d075232e754d6975a64152
https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/next/environment/injections.py#L59-L72
38,204
toumorokoshi/sprinter
sprinter/next/environment/injections.py
Injections.injected
def injected(self, filename): """ Return true if the file has already been injected before. """ full_path = os.path.expanduser(filename) if not os.path.exists(full_path): return False with codecs.open(full_path, 'r+', encoding="utf-8") as fh: contents = fh.read() ...
python
def injected(self, filename): """ Return true if the file has already been injected before. """ full_path = os.path.expanduser(filename) if not os.path.exists(full_path): return False with codecs.open(full_path, 'r+', encoding="utf-8") as fh: contents = fh.read() ...
[ "def", "injected", "(", "self", ",", "filename", ")", ":", "full_path", "=", "os", ".", "path", ".", "expanduser", "(", "filename", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "full_path", ")", ":", "return", "False", "with", "codecs", "...
Return true if the file has already been injected before.
[ "Return", "true", "if", "the", "file", "has", "already", "been", "injected", "before", "." ]
846697a7a087e69c61d075232e754d6975a64152
https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/next/environment/injections.py#L74-L81
38,205
toumorokoshi/sprinter
sprinter/next/environment/injections.py
Injections.destructive_inject
def destructive_inject(self, filename, content): """ Injects the injections desired immediately. This should generally be run only during the commit phase, when no future injections will be done. """ content = _unicode(content) backup_file(filename) full_p...
python
def destructive_inject(self, filename, content): """ Injects the injections desired immediately. This should generally be run only during the commit phase, when no future injections will be done. """ content = _unicode(content) backup_file(filename) full_p...
[ "def", "destructive_inject", "(", "self", ",", "filename", ",", "content", ")", ":", "content", "=", "_unicode", "(", "content", ")", "backup_file", "(", "filename", ")", "full_path", "=", "self", ".", "__generate_file", "(", "filename", ")", "with", "codecs...
Injects the injections desired immediately. This should generally be run only during the commit phase, when no future injections will be done.
[ "Injects", "the", "injections", "desired", "immediately", ".", "This", "should", "generally", "be", "run", "only", "during", "the", "commit", "phase", "when", "no", "future", "injections", "will", "be", "done", "." ]
846697a7a087e69c61d075232e754d6975a64152
https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/next/environment/injections.py#L83-L95
38,206
toumorokoshi/sprinter
sprinter/next/environment/injections.py
Injections.__generate_file
def __generate_file(self, file_path): """ Generate the file at the file_path desired. Creates any needed directories on the way. returns the absolute path of the file. """ file_path = os.path.expanduser(file_path) if not os.path.exists(os.path.dirname(file_path)): ...
python
def __generate_file(self, file_path): """ Generate the file at the file_path desired. Creates any needed directories on the way. returns the absolute path of the file. """ file_path = os.path.expanduser(file_path) if not os.path.exists(os.path.dirname(file_path)): ...
[ "def", "__generate_file", "(", "self", ",", "file_path", ")", ":", "file_path", "=", "os", ".", "path", ".", "expanduser", "(", "file_path", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "os", ".", "path", ".", "dirname", "(", "file_path", ...
Generate the file at the file_path desired. Creates any needed directories on the way. returns the absolute path of the file.
[ "Generate", "the", "file", "at", "the", "file_path", "desired", ".", "Creates", "any", "needed", "directories", "on", "the", "way", ".", "returns", "the", "absolute", "path", "of", "the", "file", "." ]
846697a7a087e69c61d075232e754d6975a64152
https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/next/environment/injections.py#L107-L118
38,207
toumorokoshi/sprinter
sprinter/next/environment/injections.py
Injections.in_noninjected_file
def in_noninjected_file(self, file_path, content): """ Checks if a string exists in the file, sans the injected """ if os.path.exists(file_path): file_content = codecs.open(file_path, encoding="utf-8").read() file_content = self.wrapper_match.sub(u"", file_content) else: ...
python
def in_noninjected_file(self, file_path, content): """ Checks if a string exists in the file, sans the injected """ if os.path.exists(file_path): file_content = codecs.open(file_path, encoding="utf-8").read() file_content = self.wrapper_match.sub(u"", file_content) else: ...
[ "def", "in_noninjected_file", "(", "self", ",", "file_path", ",", "content", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "file_path", ")", ":", "file_content", "=", "codecs", ".", "open", "(", "file_path", ",", "encoding", "=", "\"utf-8\"", ")...
Checks if a string exists in the file, sans the injected
[ "Checks", "if", "a", "string", "exists", "in", "the", "file", "sans", "the", "injected" ]
846697a7a087e69c61d075232e754d6975a64152
https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/next/environment/injections.py#L120-L127
38,208
toumorokoshi/sprinter
sprinter/next/environment/injections.py
Injections.clear_content
def clear_content(self, content): """ Clear the injected content from the content buffer, and return the results """ content = _unicode(content) return self.wrapper_match.sub("", content)
python
def clear_content(self, content): """ Clear the injected content from the content buffer, and return the results """ content = _unicode(content) return self.wrapper_match.sub("", content)
[ "def", "clear_content", "(", "self", ",", "content", ")", ":", "content", "=", "_unicode", "(", "content", ")", "return", "self", ".", "wrapper_match", ".", "sub", "(", "\"\"", ",", "content", ")" ]
Clear the injected content from the content buffer, and return the results
[ "Clear", "the", "injected", "content", "from", "the", "content", "buffer", "and", "return", "the", "results" ]
846697a7a087e69c61d075232e754d6975a64152
https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/next/environment/injections.py#L154-L159
38,209
gtaylor/EVE-Market-Data-Structures
emds/data_structures.py
MarketOrderList.add_order
def add_order(self, order): """ Adds a MarketOrder instance to the list of market orders contained within this order list. Does some behind-the-scenes magic to get it all ready for serialization. :param MarketOrder order: The order to add to this order list. """ ...
python
def add_order(self, order): """ Adds a MarketOrder instance to the list of market orders contained within this order list. Does some behind-the-scenes magic to get it all ready for serialization. :param MarketOrder order: The order to add to this order list. """ ...
[ "def", "add_order", "(", "self", ",", "order", ")", ":", "# This key is used to group the orders based on region.", "key", "=", "'%s_%s'", "%", "(", "order", ".", "region_id", ",", "order", ".", "type_id", ")", "if", "not", "self", ".", "_orders", ".", "has_ke...
Adds a MarketOrder instance to the list of market orders contained within this order list. Does some behind-the-scenes magic to get it all ready for serialization. :param MarketOrder order: The order to add to this order list.
[ "Adds", "a", "MarketOrder", "instance", "to", "the", "list", "of", "market", "orders", "contained", "within", "this", "order", "list", ".", "Does", "some", "behind", "-", "the", "-", "scenes", "magic", "to", "get", "it", "all", "ready", "for", "serializati...
77d69b24f2aada3aeff8fba3d75891bfba8fdcf3
https://github.com/gtaylor/EVE-Market-Data-Structures/blob/77d69b24f2aada3aeff8fba3d75891bfba8fdcf3/emds/data_structures.py#L121-L143
38,210
gtaylor/EVE-Market-Data-Structures
emds/data_structures.py
MarketHistoryList.add_entry
def add_entry(self, entry): """ Adds a MarketHistoryEntry instance to the list of market history entries contained within this instance. Does some behind-the-scenes magic to get it all ready for serialization. :param MarketHistoryEntry entry: The history entry to add to ...
python
def add_entry(self, entry): """ Adds a MarketHistoryEntry instance to the list of market history entries contained within this instance. Does some behind-the-scenes magic to get it all ready for serialization. :param MarketHistoryEntry entry: The history entry to add to ...
[ "def", "add_entry", "(", "self", ",", "entry", ")", ":", "# This key is used to group the orders based on region.", "key", "=", "'%s_%s'", "%", "(", "entry", ".", "region_id", ",", "entry", ".", "type_id", ")", "if", "not", "self", ".", "_history", ".", "has_k...
Adds a MarketHistoryEntry instance to the list of market history entries contained within this instance. Does some behind-the-scenes magic to get it all ready for serialization. :param MarketHistoryEntry entry: The history entry to add to instance.
[ "Adds", "a", "MarketHistoryEntry", "instance", "to", "the", "list", "of", "market", "history", "entries", "contained", "within", "this", "instance", ".", "Does", "some", "behind", "-", "the", "-", "scenes", "magic", "to", "get", "it", "all", "ready", "for", ...
77d69b24f2aada3aeff8fba3d75891bfba8fdcf3
https://github.com/gtaylor/EVE-Market-Data-Structures/blob/77d69b24f2aada3aeff8fba3d75891bfba8fdcf3/emds/data_structures.py#L449-L472
38,211
foliant-docs/foliantcontrib.includes
foliant/preprocessors/includes.py
Preprocessor._find_file
def _find_file(self, file_name: str, lookup_dir: Path) -> Path or None: '''Find a file in a directory by name. Check subdirectories recursively. :param file_name: Name of the file :lookup_dir: Starting directory :returns: Path to the found file or None if the file was not found ...
python
def _find_file(self, file_name: str, lookup_dir: Path) -> Path or None: '''Find a file in a directory by name. Check subdirectories recursively. :param file_name: Name of the file :lookup_dir: Starting directory :returns: Path to the found file or None if the file was not found ...
[ "def", "_find_file", "(", "self", ",", "file_name", ":", "str", ",", "lookup_dir", ":", "Path", ")", "->", "Path", "or", "None", ":", "self", ".", "logger", ".", "debug", "(", "'Trying to find the file {file_name} inside the directory {lookup_dir}'", ")", "result"...
Find a file in a directory by name. Check subdirectories recursively. :param file_name: Name of the file :lookup_dir: Starting directory :returns: Path to the found file or None if the file was not found :raises: FileNotFoundError
[ "Find", "a", "file", "in", "a", "directory", "by", "name", ".", "Check", "subdirectories", "recursively", "." ]
4bd89f6d287c9e21246d984c90ad05c2ccd24fcc
https://github.com/foliant-docs/foliantcontrib.includes/blob/4bd89f6d287c9e21246d984c90ad05c2ccd24fcc/foliant/preprocessors/includes.py#L28-L51
38,212
foliant-docs/foliantcontrib.includes
foliant/preprocessors/includes.py
Preprocessor._sync_repo
def _sync_repo(self, repo_url: str, revision: str or None = None) -> Path: '''Clone a Git repository to the cache dir. If it has been cloned before, update it. :param repo_url: Repository URL :param revision: Revision: branch, commit hash, or tag :returns: Path to the cloned repository...
python
def _sync_repo(self, repo_url: str, revision: str or None = None) -> Path: '''Clone a Git repository to the cache dir. If it has been cloned before, update it. :param repo_url: Repository URL :param revision: Revision: branch, commit hash, or tag :returns: Path to the cloned repository...
[ "def", "_sync_repo", "(", "self", ",", "repo_url", ":", "str", ",", "revision", ":", "str", "or", "None", "=", "None", ")", "->", "Path", ":", "repo_name", "=", "repo_url", ".", "split", "(", "'/'", ")", "[", "-", "1", "]", ".", "rsplit", "(", "'...
Clone a Git repository to the cache dir. If it has been cloned before, update it. :param repo_url: Repository URL :param revision: Revision: branch, commit hash, or tag :returns: Path to the cloned repository
[ "Clone", "a", "Git", "repository", "to", "the", "cache", "dir", ".", "If", "it", "has", "been", "cloned", "before", "update", "it", "." ]
4bd89f6d287c9e21246d984c90ad05c2ccd24fcc
https://github.com/foliant-docs/foliantcontrib.includes/blob/4bd89f6d287c9e21246d984c90ad05c2ccd24fcc/foliant/preprocessors/includes.py#L53-L108
38,213
foliant-docs/foliantcontrib.includes
foliant/preprocessors/includes.py
Preprocessor._shift_headings
def _shift_headings(self, content: str, shift: int) -> str: '''Shift Markdown headings in a string by a given value. The shift can be positive or negative. :param content: Markdown content :param shift: Heading shift :returns: Markdown content with headings shifted by ``shift``...
python
def _shift_headings(self, content: str, shift: int) -> str: '''Shift Markdown headings in a string by a given value. The shift can be positive or negative. :param content: Markdown content :param shift: Heading shift :returns: Markdown content with headings shifted by ``shift``...
[ "def", "_shift_headings", "(", "self", ",", "content", ":", "str", ",", "shift", ":", "int", ")", "->", "str", ":", "def", "_sub", "(", "heading", ")", ":", "new_heading_level", "=", "len", "(", "heading", ".", "group", "(", "'hashes'", ")", ")", "+"...
Shift Markdown headings in a string by a given value. The shift can be positive or negative. :param content: Markdown content :param shift: Heading shift :returns: Markdown content with headings shifted by ``shift``
[ "Shift", "Markdown", "headings", "in", "a", "string", "by", "a", "given", "value", ".", "The", "shift", "can", "be", "positive", "or", "negative", "." ]
4bd89f6d287c9e21246d984c90ad05c2ccd24fcc
https://github.com/foliant-docs/foliantcontrib.includes/blob/4bd89f6d287c9e21246d984c90ad05c2ccd24fcc/foliant/preprocessors/includes.py#L110-L133
38,214
foliant-docs/foliantcontrib.includes
foliant/preprocessors/includes.py
Preprocessor._cut_from_heading_to_heading
def _cut_from_heading_to_heading( self, content: str, from_heading: str, to_heading: str or None = None, options={} ) -> str: '''Cut part of Markdown string between two headings, set internal heading level, and remove top heading. ...
python
def _cut_from_heading_to_heading( self, content: str, from_heading: str, to_heading: str or None = None, options={} ) -> str: '''Cut part of Markdown string between two headings, set internal heading level, and remove top heading. ...
[ "def", "_cut_from_heading_to_heading", "(", "self", ",", "content", ":", "str", ",", "from_heading", ":", "str", ",", "to_heading", ":", "str", "or", "None", "=", "None", ",", "options", "=", "{", "}", ")", "->", "str", ":", "self", ".", "logger", ".",...
Cut part of Markdown string between two headings, set internal heading level, and remove top heading. If only the starting heading is defined, cut to the next heading of the same level. Heading shift and top heading elimination are optional. :param content: Markdown content ...
[ "Cut", "part", "of", "Markdown", "string", "between", "two", "headings", "set", "internal", "heading", "level", "and", "remove", "top", "heading", "." ]
4bd89f6d287c9e21246d984c90ad05c2ccd24fcc
https://github.com/foliant-docs/foliantcontrib.includes/blob/4bd89f6d287c9e21246d984c90ad05c2ccd24fcc/foliant/preprocessors/includes.py#L156-L214
38,215
foliant-docs/foliantcontrib.includes
foliant/preprocessors/includes.py
Preprocessor._cut_to_heading
def _cut_to_heading( self, content: str, to_heading: str or None = None, options={} ) -> str: '''Cut part of Markdown string from the start to a certain heading, set internal heading level, and remove top heading. If not heading is defined...
python
def _cut_to_heading( self, content: str, to_heading: str or None = None, options={} ) -> str: '''Cut part of Markdown string from the start to a certain heading, set internal heading level, and remove top heading. If not heading is defined...
[ "def", "_cut_to_heading", "(", "self", ",", "content", ":", "str", ",", "to_heading", ":", "str", "or", "None", "=", "None", ",", "options", "=", "{", "}", ")", "->", "str", ":", "self", ".", "logger", ".", "debug", "(", "f'Cutting to heading: {to_headin...
Cut part of Markdown string from the start to a certain heading, set internal heading level, and remove top heading. If not heading is defined, the whole string is returned. Heading shift and top heading elimination are optional. :param content: Markdown content :param to_head...
[ "Cut", "part", "of", "Markdown", "string", "from", "the", "start", "to", "a", "certain", "heading", "set", "internal", "heading", "level", "and", "remove", "top", "heading", "." ]
4bd89f6d287c9e21246d984c90ad05c2ccd24fcc
https://github.com/foliant-docs/foliantcontrib.includes/blob/4bd89f6d287c9e21246d984c90ad05c2ccd24fcc/foliant/preprocessors/includes.py#L216-L269
38,216
foliant-docs/foliantcontrib.includes
foliant/preprocessors/includes.py
Preprocessor._adjust_image_paths
def _adjust_image_paths(self, content: str, md_file_path: Path) -> str: '''Locate images referenced in a Markdown string and replace their paths with the absolute ones. :param content: Markdown content :param md_file_path: Path to the Markdown file containing the content :retur...
python
def _adjust_image_paths(self, content: str, md_file_path: Path) -> str: '''Locate images referenced in a Markdown string and replace their paths with the absolute ones. :param content: Markdown content :param md_file_path: Path to the Markdown file containing the content :retur...
[ "def", "_adjust_image_paths", "(", "self", ",", "content", ":", "str", ",", "md_file_path", ":", "Path", ")", "->", "str", ":", "def", "_sub", "(", "image", ")", ":", "image_caption", "=", "image", ".", "group", "(", "'caption'", ")", "image_path", "=", ...
Locate images referenced in a Markdown string and replace their paths with the absolute ones. :param content: Markdown content :param md_file_path: Path to the Markdown file containing the content :returns: Markdown content with absolute image paths
[ "Locate", "images", "referenced", "in", "a", "Markdown", "string", "and", "replace", "their", "paths", "with", "the", "absolute", "ones", "." ]
4bd89f6d287c9e21246d984c90ad05c2ccd24fcc
https://github.com/foliant-docs/foliantcontrib.includes/blob/4bd89f6d287c9e21246d984c90ad05c2ccd24fcc/foliant/preprocessors/includes.py#L271-L292
38,217
foliant-docs/foliantcontrib.includes
foliant/preprocessors/includes.py
Preprocessor._get_src_file_path
def _get_src_file_path(self, markdown_file_path: Path) -> Path: '''Translate the path of Markdown file that is located inside the temporary working directory into the path of the corresponding Markdown file that is located inside the source directory of Foliant project. :param markdown_...
python
def _get_src_file_path(self, markdown_file_path: Path) -> Path: '''Translate the path of Markdown file that is located inside the temporary working directory into the path of the corresponding Markdown file that is located inside the source directory of Foliant project. :param markdown_...
[ "def", "_get_src_file_path", "(", "self", ",", "markdown_file_path", ":", "Path", ")", "->", "Path", ":", "path_relative_to_working_dir", "=", "markdown_file_path", ".", "relative_to", "(", "self", ".", "working_dir", ".", "resolve", "(", ")", ")", "self", ".", ...
Translate the path of Markdown file that is located inside the temporary working directory into the path of the corresponding Markdown file that is located inside the source directory of Foliant project. :param markdown_file_path: Path to Markdown file that is located inside the temporary worki...
[ "Translate", "the", "path", "of", "Markdown", "file", "that", "is", "located", "inside", "the", "temporary", "working", "directory", "into", "the", "path", "of", "the", "corresponding", "Markdown", "file", "that", "is", "located", "inside", "the", "source", "d...
4bd89f6d287c9e21246d984c90ad05c2ccd24fcc
https://github.com/foliant-docs/foliantcontrib.includes/blob/4bd89f6d287c9e21246d984c90ad05c2ccd24fcc/foliant/preprocessors/includes.py#L294-L322
38,218
foliant-docs/foliantcontrib.includes
foliant/preprocessors/includes.py
Preprocessor._get_included_file_path
def _get_included_file_path(self, user_specified_path: str, current_processed_file_path: Path) -> Path: '''Resolve user specified path to the local included file. :param user_specified_path: User specified string that represents the path to a local file :param current_processed_fil...
python
def _get_included_file_path(self, user_specified_path: str, current_processed_file_path: Path) -> Path: '''Resolve user specified path to the local included file. :param user_specified_path: User specified string that represents the path to a local file :param current_processed_fil...
[ "def", "_get_included_file_path", "(", "self", ",", "user_specified_path", ":", "str", ",", "current_processed_file_path", ":", "Path", ")", "->", "Path", ":", "self", ".", "logger", ".", "debug", "(", "f'Currently processed Markdown file: {current_processed_file_path}'",...
Resolve user specified path to the local included file. :param user_specified_path: User specified string that represents the path to a local file :param current_processed_file_path: Path to the currently processed Markdown file that contains include statements :return...
[ "Resolve", "user", "specified", "path", "to", "the", "local", "included", "file", "." ]
4bd89f6d287c9e21246d984c90ad05c2ccd24fcc
https://github.com/foliant-docs/foliantcontrib.includes/blob/4bd89f6d287c9e21246d984c90ad05c2ccd24fcc/foliant/preprocessors/includes.py#L324-L365
38,219
foliant-docs/foliantcontrib.includes
foliant/preprocessors/includes.py
Preprocessor.process_includes
def process_includes(self, markdown_file_path: Path, content: str) -> str: '''Replace all include statements with the respective file contents. :param markdown_file_path: Path to curently processed Markdown file :param content: Markdown content :returns: Markdown content with resolved ...
python
def process_includes(self, markdown_file_path: Path, content: str) -> str: '''Replace all include statements with the respective file contents. :param markdown_file_path: Path to curently processed Markdown file :param content: Markdown content :returns: Markdown content with resolved ...
[ "def", "process_includes", "(", "self", ",", "markdown_file_path", ":", "Path", ",", "content", ":", "str", ")", "->", "str", ":", "markdown_file_path", "=", "markdown_file_path", ".", "resolve", "(", ")", "self", ".", "logger", ".", "debug", "(", "f'Process...
Replace all include statements with the respective file contents. :param markdown_file_path: Path to curently processed Markdown file :param content: Markdown content :returns: Markdown content with resolved includes
[ "Replace", "all", "include", "statements", "with", "the", "respective", "file", "contents", "." ]
4bd89f6d287c9e21246d984c90ad05c2ccd24fcc
https://github.com/foliant-docs/foliantcontrib.includes/blob/4bd89f6d287c9e21246d984c90ad05c2ccd24fcc/foliant/preprocessors/includes.py#L416-L516
38,220
nimbusproject/dashi
dashi/bootstrap/__init__.py
get_logger
def get_logger(name, CFG=None): """set up logging for a service using the py 2.7 dictConfig """ logger = logging.getLogger(name) if CFG: # Make log directory if it doesn't exist for handler in CFG.get('handlers', {}).itervalues(): if 'filename' in handler: l...
python
def get_logger(name, CFG=None): """set up logging for a service using the py 2.7 dictConfig """ logger = logging.getLogger(name) if CFG: # Make log directory if it doesn't exist for handler in CFG.get('handlers', {}).itervalues(): if 'filename' in handler: l...
[ "def", "get_logger", "(", "name", ",", "CFG", "=", "None", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", "name", ")", "if", "CFG", ":", "# Make log directory if it doesn't exist", "for", "handler", "in", "CFG", ".", "get", "(", "'handlers'", "...
set up logging for a service using the py 2.7 dictConfig
[ "set", "up", "logging", "for", "a", "service", "using", "the", "py", "2", ".", "7", "dictConfig" ]
368b3963ec8abd60aebe0f81915429b45cbf4b5a
https://github.com/nimbusproject/dashi/blob/368b3963ec8abd60aebe0f81915429b45cbf4b5a/dashi/bootstrap/__init__.py#L238-L258
38,221
thewca/wca-regulations-compiler
wrc/parse/lexer.py
WCALexer.t_trailingwhitespace
def t_trailingwhitespace(self, token): ur'.+? \n' print "Error: trailing whitespace at line %s in text '%s'" % (token.lexer.lineno + 1, token.value[:-1]) token.lexer.lexerror = True token.lexer.skip(1)
python
def t_trailingwhitespace(self, token): ur'.+? \n' print "Error: trailing whitespace at line %s in text '%s'" % (token.lexer.lineno + 1, token.value[:-1]) token.lexer.lexerror = True token.lexer.skip(1)
[ "def", "t_trailingwhitespace", "(", "self", ",", "token", ")", ":", "print", "\"Error: trailing whitespace at line %s in text '%s'\"", "%", "(", "token", ".", "lexer", ".", "lineno", "+", "1", ",", "token", ".", "value", "[", ":", "-", "1", "]", ")", "token"...
ur'.+? \n
[ "ur", ".", "+", "?", "\\", "n" ]
3ebbd8fe8fec7c9167296f59b2677696fe61a954
https://github.com/thewca/wca-regulations-compiler/blob/3ebbd8fe8fec7c9167296f59b2677696fe61a954/wrc/parse/lexer.py#L142-L146
38,222
frascoweb/frasco
frasco/views.py
exec_before_request_actions
def exec_before_request_actions(actions, **kwargs): """Execute actions in the "before" and "before_METHOD" groups """ groups = ("before", "before_" + flask.request.method.lower()) return execute_actions(actions, limit_groups=groups, **kwargs)
python
def exec_before_request_actions(actions, **kwargs): """Execute actions in the "before" and "before_METHOD" groups """ groups = ("before", "before_" + flask.request.method.lower()) return execute_actions(actions, limit_groups=groups, **kwargs)
[ "def", "exec_before_request_actions", "(", "actions", ",", "*", "*", "kwargs", ")", ":", "groups", "=", "(", "\"before\"", ",", "\"before_\"", "+", "flask", ".", "request", ".", "method", ".", "lower", "(", ")", ")", "return", "execute_actions", "(", "acti...
Execute actions in the "before" and "before_METHOD" groups
[ "Execute", "actions", "in", "the", "before", "and", "before_METHOD", "groups" ]
ea519d69dd5ca6deaf3650175692ee4a1a02518f
https://github.com/frascoweb/frasco/blob/ea519d69dd5ca6deaf3650175692ee4a1a02518f/frasco/views.py#L14-L18
38,223
frascoweb/frasco
frasco/views.py
exec_after_request_actions
def exec_after_request_actions(actions, response, **kwargs): """Executes actions of the "after" and "after_METHOD" groups. A "response" var will be injected in the current context. """ current_context["response"] = response groups = ("after_" + flask.request.method.lower(), "after") try: ...
python
def exec_after_request_actions(actions, response, **kwargs): """Executes actions of the "after" and "after_METHOD" groups. A "response" var will be injected in the current context. """ current_context["response"] = response groups = ("after_" + flask.request.method.lower(), "after") try: ...
[ "def", "exec_after_request_actions", "(", "actions", ",", "response", ",", "*", "*", "kwargs", ")", ":", "current_context", "[", "\"response\"", "]", "=", "response", "groups", "=", "(", "\"after_\"", "+", "flask", ".", "request", ".", "method", ".", "lower"...
Executes actions of the "after" and "after_METHOD" groups. A "response" var will be injected in the current context.
[ "Executes", "actions", "of", "the", "after", "and", "after_METHOD", "groups", ".", "A", "response", "var", "will", "be", "injected", "in", "the", "current", "context", "." ]
ea519d69dd5ca6deaf3650175692ee4a1a02518f
https://github.com/frascoweb/frasco/blob/ea519d69dd5ca6deaf3650175692ee4a1a02518f/frasco/views.py#L28-L40
38,224
frascoweb/frasco
frasco/views.py
as_view
def as_view(url=None, methods=None, view_class=ActionsView, name=None, url_rules=None, **kwargs): """Decorator to transform a function into a view class. Be warned that this will replace the function with the view class. """ def decorator(f): if url is not None: f = expose(url, metho...
python
def as_view(url=None, methods=None, view_class=ActionsView, name=None, url_rules=None, **kwargs): """Decorator to transform a function into a view class. Be warned that this will replace the function with the view class. """ def decorator(f): if url is not None: f = expose(url, metho...
[ "def", "as_view", "(", "url", "=", "None", ",", "methods", "=", "None", ",", "view_class", "=", "ActionsView", ",", "name", "=", "None", ",", "url_rules", "=", "None", ",", "*", "*", "kwargs", ")", ":", "def", "decorator", "(", "f", ")", ":", "if",...
Decorator to transform a function into a view class. Be warned that this will replace the function with the view class.
[ "Decorator", "to", "transform", "a", "function", "into", "a", "view", "class", ".", "Be", "warned", "that", "this", "will", "replace", "the", "function", "with", "the", "view", "class", "." ]
ea519d69dd5ca6deaf3650175692ee4a1a02518f
https://github.com/frascoweb/frasco/blob/ea519d69dd5ca6deaf3650175692ee4a1a02518f/frasco/views.py#L159-L184
38,225
frascoweb/frasco
frasco/views.py
RegistrableViewMixin.register
def register(self, target): """Registers url_rules on the blueprint """ for rule, options in self.url_rules: target.add_url_rule(rule, self.name, self.dispatch_request, **options)
python
def register(self, target): """Registers url_rules on the blueprint """ for rule, options in self.url_rules: target.add_url_rule(rule, self.name, self.dispatch_request, **options)
[ "def", "register", "(", "self", ",", "target", ")", ":", "for", "rule", ",", "options", "in", "self", ".", "url_rules", ":", "target", ".", "add_url_rule", "(", "rule", ",", "self", ".", "name", ",", "self", ".", "dispatch_request", ",", "*", "*", "o...
Registers url_rules on the blueprint
[ "Registers", "url_rules", "on", "the", "blueprint" ]
ea519d69dd5ca6deaf3650175692ee4a1a02518f
https://github.com/frascoweb/frasco/blob/ea519d69dd5ca6deaf3650175692ee4a1a02518f/frasco/views.py#L89-L93
38,226
frascoweb/frasco
frasco/views.py
ViewContainerMixin.view
def view(self, *args, **kwargs): """Decorator to automatically apply as_view decorator and register it. """ def decorator(f): kwargs.setdefault("view_class", self.view_class) return self.add_view(as_view(*args, **kwargs)(f)) return decorator
python
def view(self, *args, **kwargs): """Decorator to automatically apply as_view decorator and register it. """ def decorator(f): kwargs.setdefault("view_class", self.view_class) return self.add_view(as_view(*args, **kwargs)(f)) return decorator
[ "def", "view", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "def", "decorator", "(", "f", ")", ":", "kwargs", ".", "setdefault", "(", "\"view_class\"", ",", "self", ".", "view_class", ")", "return", "self", ".", "add_view", "(", ...
Decorator to automatically apply as_view decorator and register it.
[ "Decorator", "to", "automatically", "apply", "as_view", "decorator", "and", "register", "it", "." ]
ea519d69dd5ca6deaf3650175692ee4a1a02518f
https://github.com/frascoweb/frasco/blob/ea519d69dd5ca6deaf3650175692ee4a1a02518f/frasco/views.py#L199-L205
38,227
frascoweb/frasco
frasco/views.py
ViewContainerMixin.add_action_view
def add_action_view(self, name, url, actions, **kwargs): """Creates an ActionsView instance and registers it. """ view = ActionsView(name, url=url, self_var=self, **kwargs) if isinstance(actions, dict): for group, actions in actions.iteritems(): view.actions.e...
python
def add_action_view(self, name, url, actions, **kwargs): """Creates an ActionsView instance and registers it. """ view = ActionsView(name, url=url, self_var=self, **kwargs) if isinstance(actions, dict): for group, actions in actions.iteritems(): view.actions.e...
[ "def", "add_action_view", "(", "self", ",", "name", ",", "url", ",", "actions", ",", "*", "*", "kwargs", ")", ":", "view", "=", "ActionsView", "(", "name", ",", "url", "=", "url", ",", "self_var", "=", "self", ",", "*", "*", "kwargs", ")", "if", ...
Creates an ActionsView instance and registers it.
[ "Creates", "an", "ActionsView", "instance", "and", "registers", "it", "." ]
ea519d69dd5ca6deaf3650175692ee4a1a02518f
https://github.com/frascoweb/frasco/blob/ea519d69dd5ca6deaf3650175692ee4a1a02518f/frasco/views.py#L207-L217
38,228
bryanwweber/thermohw
thermohw/convert_thermo_exam.py
process
def process(exam_num: int, time: str, date: str) -> None: """Process the exams in the exam_num folder for the time.""" prefix = Path(f"exams/exam-{exam_num}") problems = list(prefix.glob(f"exam-{exam_num}-{time}-[0-9].ipynb")) problems = sorted(problems, key=lambda k: k.stem[-1]) output_directory ...
python
def process(exam_num: int, time: str, date: str) -> None: """Process the exams in the exam_num folder for the time.""" prefix = Path(f"exams/exam-{exam_num}") problems = list(prefix.glob(f"exam-{exam_num}-{time}-[0-9].ipynb")) problems = sorted(problems, key=lambda k: k.stem[-1]) output_directory ...
[ "def", "process", "(", "exam_num", ":", "int", ",", "time", ":", "str", ",", "date", ":", "str", ")", "->", "None", ":", "prefix", "=", "Path", "(", "f\"exams/exam-{exam_num}\"", ")", "problems", "=", "list", "(", "prefix", ".", "glob", "(", "f\"exam-{...
Process the exams in the exam_num folder for the time.
[ "Process", "the", "exams", "in", "the", "exam_num", "folder", "for", "the", "time", "." ]
b6be276c14f8adf6ae23f5498065de74f868ccaa
https://github.com/bryanwweber/thermohw/blob/b6be276c14f8adf6ae23f5498065de74f868ccaa/thermohw/convert_thermo_exam.py#L63-L118
38,229
bryanwweber/thermohw
thermohw/convert_thermo_exam.py
main
def main(argv: Optional[Sequence[str]] = None) -> None: """Parse arguments and process the exam assignment.""" parser = ArgumentParser(description="Convert Jupyter Notebook exams to PDFs") parser.add_argument( "--exam", type=int, required=True, help="Exam number to convert", ...
python
def main(argv: Optional[Sequence[str]] = None) -> None: """Parse arguments and process the exam assignment.""" parser = ArgumentParser(description="Convert Jupyter Notebook exams to PDFs") parser.add_argument( "--exam", type=int, required=True, help="Exam number to convert", ...
[ "def", "main", "(", "argv", ":", "Optional", "[", "Sequence", "[", "str", "]", "]", "=", "None", ")", "->", "None", ":", "parser", "=", "ArgumentParser", "(", "description", "=", "\"Convert Jupyter Notebook exams to PDFs\"", ")", "parser", ".", "add_argument",...
Parse arguments and process the exam assignment.
[ "Parse", "arguments", "and", "process", "the", "exam", "assignment", "." ]
b6be276c14f8adf6ae23f5498065de74f868ccaa
https://github.com/bryanwweber/thermohw/blob/b6be276c14f8adf6ae23f5498065de74f868ccaa/thermohw/convert_thermo_exam.py#L121-L138
38,230
oxalorg/dystic
dystic/marker.py
Marker.extract_meta
def extract_meta(self, text): """ Takes input as the entire file. Reads the first yaml document as metadata. and the rest of the document as text """ first_line = True metadata = [] content = [] metadata_parsed = False for line in text.spl...
python
def extract_meta(self, text): """ Takes input as the entire file. Reads the first yaml document as metadata. and the rest of the document as text """ first_line = True metadata = [] content = [] metadata_parsed = False for line in text.spl...
[ "def", "extract_meta", "(", "self", ",", "text", ")", ":", "first_line", "=", "True", "metadata", "=", "[", "]", "content", "=", "[", "]", "metadata_parsed", "=", "False", "for", "line", "in", "text", ".", "split", "(", "'\\n'", ")", ":", "if", "firs...
Takes input as the entire file. Reads the first yaml document as metadata. and the rest of the document as text
[ "Takes", "input", "as", "the", "entire", "file", ".", "Reads", "the", "first", "yaml", "document", "as", "metadata", ".", "and", "the", "rest", "of", "the", "document", "as", "text" ]
6f5a449158ec12fc1c9cc25d85e2f8adc27885db
https://github.com/oxalorg/dystic/blob/6f5a449158ec12fc1c9cc25d85e2f8adc27885db/dystic/marker.py#L42-L78
38,231
cidrblock/modelsettings
modelsettings/__init__.py
ModelSettings.set_defaults
def set_defaults(self): """ Add each model entry with it's default """ for key, value in self.spec.items(): setattr(self, key.upper(), value.get("default", None))
python
def set_defaults(self): """ Add each model entry with it's default """ for key, value in self.spec.items(): setattr(self, key.upper(), value.get("default", None))
[ "def", "set_defaults", "(", "self", ")", ":", "for", "key", ",", "value", "in", "self", ".", "spec", ".", "items", "(", ")", ":", "setattr", "(", "self", ",", "key", ".", "upper", "(", ")", ",", "value", ".", "get", "(", "\"default\"", ",", "None...
Add each model entry with it's default
[ "Add", "each", "model", "entry", "with", "it", "s", "default" ]
09763c111fb38b3ba7a13cc95ca59e4393fe75ba
https://github.com/cidrblock/modelsettings/blob/09763c111fb38b3ba7a13cc95ca59e4393fe75ba/modelsettings/__init__.py#L70-L74
38,232
cidrblock/modelsettings
modelsettings/__init__.py
ModelSettings.load_env
def load_env(self): """ Load the model fron environment variables """ for key, value in self.spec.items(): if value['type'] in (dict, list): envar = (self.env_prefix + "_" + key).upper() try: envvar = env.json(envar, ...
python
def load_env(self): """ Load the model fron environment variables """ for key, value in self.spec.items(): if value['type'] in (dict, list): envar = (self.env_prefix + "_" + key).upper() try: envvar = env.json(envar, ...
[ "def", "load_env", "(", "self", ")", ":", "for", "key", ",", "value", "in", "self", ".", "spec", ".", "items", "(", ")", ":", "if", "value", "[", "'type'", "]", "in", "(", "dict", ",", "list", ")", ":", "envar", "=", "(", "self", ".", "env_pref...
Load the model fron environment variables
[ "Load", "the", "model", "fron", "environment", "variables" ]
09763c111fb38b3ba7a13cc95ca59e4393fe75ba
https://github.com/cidrblock/modelsettings/blob/09763c111fb38b3ba7a13cc95ca59e4393fe75ba/modelsettings/__init__.py#L76-L94
38,233
cidrblock/modelsettings
modelsettings/__init__.py
ModelSettings.parse_args
def parse_args(self): """ Parse the cli args Returns: args (namespace): The args """ parser = ArgumentParser(description='', formatter_class=RawTextHelpFormatter) parser.add_argument("--generate", action="store", dest='generate...
python
def parse_args(self): """ Parse the cli args Returns: args (namespace): The args """ parser = ArgumentParser(description='', formatter_class=RawTextHelpFormatter) parser.add_argument("--generate", action="store", dest='generate...
[ "def", "parse_args", "(", "self", ")", ":", "parser", "=", "ArgumentParser", "(", "description", "=", "''", ",", "formatter_class", "=", "RawTextHelpFormatter", ")", "parser", ".", "add_argument", "(", "\"--generate\"", ",", "action", "=", "\"store\"", ",", "d...
Parse the cli args Returns: args (namespace): The args
[ "Parse", "the", "cli", "args" ]
09763c111fb38b3ba7a13cc95ca59e4393fe75ba
https://github.com/cidrblock/modelsettings/blob/09763c111fb38b3ba7a13cc95ca59e4393fe75ba/modelsettings/__init__.py#L97-L133
38,234
cidrblock/modelsettings
modelsettings/__init__.py
ModelSettings.add_args
def add_args(self, args): """ Add the args Args: args (namespace): The commandline args """ for key, value in vars(args).items(): if value is not None: setattr(self, key.upper(), value)
python
def add_args(self, args): """ Add the args Args: args (namespace): The commandline args """ for key, value in vars(args).items(): if value is not None: setattr(self, key.upper(), value)
[ "def", "add_args", "(", "self", ",", "args", ")", ":", "for", "key", ",", "value", "in", "vars", "(", "args", ")", ".", "items", "(", ")", ":", "if", "value", "is", "not", "None", ":", "setattr", "(", "self", ",", "key", ".", "upper", "(", ")",...
Add the args Args: args (namespace): The commandline args
[ "Add", "the", "args" ]
09763c111fb38b3ba7a13cc95ca59e4393fe75ba
https://github.com/cidrblock/modelsettings/blob/09763c111fb38b3ba7a13cc95ca59e4393fe75ba/modelsettings/__init__.py#L135-L144
38,235
cidrblock/modelsettings
modelsettings/__init__.py
ModelSettings.load_ini
def load_ini(self, ini_file): """ Load the contents from the ini file Args: ini_file (str): The file from which the settings should be loaded """ if ini_file and not os.path.exists(ini_file): self.log.critical(f"Settings file specified but not found. {in...
python
def load_ini(self, ini_file): """ Load the contents from the ini file Args: ini_file (str): The file from which the settings should be loaded """ if ini_file and not os.path.exists(ini_file): self.log.critical(f"Settings file specified but not found. {in...
[ "def", "load_ini", "(", "self", ",", "ini_file", ")", ":", "if", "ini_file", "and", "not", "os", ".", "path", ".", "exists", "(", "ini_file", ")", ":", "self", ".", "log", ".", "critical", "(", "f\"Settings file specified but not found. {ini_file}\"", ")", "...
Load the contents from the ini file Args: ini_file (str): The file from which the settings should be loaded
[ "Load", "the", "contents", "from", "the", "ini", "file" ]
09763c111fb38b3ba7a13cc95ca59e4393fe75ba
https://github.com/cidrblock/modelsettings/blob/09763c111fb38b3ba7a13cc95ca59e4393fe75ba/modelsettings/__init__.py#L146-L180
38,236
cidrblock/modelsettings
modelsettings/__init__.py
ModelSettings.check_required
def check_required(self): """ Check all required settings have been provided """ die = False for key, value in self.spec.items(): if not getattr(self, key.upper()) and value['required']: print(f"{key} is a required setting. " "Set via com...
python
def check_required(self): """ Check all required settings have been provided """ die = False for key, value in self.spec.items(): if not getattr(self, key.upper()) and value['required']: print(f"{key} is a required setting. " "Set via com...
[ "def", "check_required", "(", "self", ")", ":", "die", "=", "False", "for", "key", ",", "value", "in", "self", ".", "spec", ".", "items", "(", ")", ":", "if", "not", "getattr", "(", "self", ",", "key", ".", "upper", "(", ")", ")", "and", "value",...
Check all required settings have been provided
[ "Check", "all", "required", "settings", "have", "been", "provided" ]
09763c111fb38b3ba7a13cc95ca59e4393fe75ba
https://github.com/cidrblock/modelsettings/blob/09763c111fb38b3ba7a13cc95ca59e4393fe75ba/modelsettings/__init__.py#L182-L193
38,237
cidrblock/modelsettings
modelsettings/__init__.py
ModelSettings.generate
def generate(self): """ Generate sample settings """ otype = getattr(self, 'GENERATE') if otype: if otype == 'env': self.generate_env() elif otype == "command": self.generate_command() elif otype == "docker-run": ...
python
def generate(self): """ Generate sample settings """ otype = getattr(self, 'GENERATE') if otype: if otype == 'env': self.generate_env() elif otype == "command": self.generate_command() elif otype == "docker-run": ...
[ "def", "generate", "(", "self", ")", ":", "otype", "=", "getattr", "(", "self", ",", "'GENERATE'", ")", "if", "otype", ":", "if", "otype", "==", "'env'", ":", "self", ".", "generate_env", "(", ")", "elif", "otype", "==", "\"command\"", ":", "self", "...
Generate sample settings
[ "Generate", "sample", "settings" ]
09763c111fb38b3ba7a13cc95ca59e4393fe75ba
https://github.com/cidrblock/modelsettings/blob/09763c111fb38b3ba7a13cc95ca59e4393fe75ba/modelsettings/__init__.py#L195-L217
38,238
cidrblock/modelsettings
modelsettings/__init__.py
ModelSettings.generate_env
def generate_env(self): """ Generate sample environment variables """ for key in sorted(list(self.spec.keys())): if self.spec[key]['type'] in (dict, list): value = f"\'{json.dumps(self.spec[key].get('example', ''))}\'" else: value = f"{self...
python
def generate_env(self): """ Generate sample environment variables """ for key in sorted(list(self.spec.keys())): if self.spec[key]['type'] in (dict, list): value = f"\'{json.dumps(self.spec[key].get('example', ''))}\'" else: value = f"{self...
[ "def", "generate_env", "(", "self", ")", ":", "for", "key", "in", "sorted", "(", "list", "(", "self", ".", "spec", ".", "keys", "(", ")", ")", ")", ":", "if", "self", ".", "spec", "[", "key", "]", "[", "'type'", "]", "in", "(", "dict", ",", "...
Generate sample environment variables
[ "Generate", "sample", "environment", "variables" ]
09763c111fb38b3ba7a13cc95ca59e4393fe75ba
https://github.com/cidrblock/modelsettings/blob/09763c111fb38b3ba7a13cc95ca59e4393fe75ba/modelsettings/__init__.py#L220-L228
38,239
cidrblock/modelsettings
modelsettings/__init__.py
ModelSettings.generate_command
def generate_command(self): """ Generate a sample command """ example = [] example.append(f"{sys.argv[0]}") for key in sorted(list(self.spec.keys())): if self.spec[key]['type'] == list: value = " ".join(self.spec[key].get('example', '')) el...
python
def generate_command(self): """ Generate a sample command """ example = [] example.append(f"{sys.argv[0]}") for key in sorted(list(self.spec.keys())): if self.spec[key]['type'] == list: value = " ".join(self.spec[key].get('example', '')) el...
[ "def", "generate_command", "(", "self", ")", ":", "example", "=", "[", "]", "example", ".", "append", "(", "f\"{sys.argv[0]}\"", ")", "for", "key", "in", "sorted", "(", "list", "(", "self", ".", "spec", ".", "keys", "(", ")", ")", ")", ":", "if", "...
Generate a sample command
[ "Generate", "a", "sample", "command" ]
09763c111fb38b3ba7a13cc95ca59e4393fe75ba
https://github.com/cidrblock/modelsettings/blob/09763c111fb38b3ba7a13cc95ca59e4393fe75ba/modelsettings/__init__.py#L230-L244
38,240
cidrblock/modelsettings
modelsettings/__init__.py
ModelSettings.generate_docker_run
def generate_docker_run(self): """ Generate a sample docker run """ example = [] example.append("docker run -it") for key in sorted(list(self.spec.keys())): if self.spec[key]['type'] in (dict, list): value = f"\'{json.dumps(self.spec[key].get('example'...
python
def generate_docker_run(self): """ Generate a sample docker run """ example = [] example.append("docker run -it") for key in sorted(list(self.spec.keys())): if self.spec[key]['type'] in (dict, list): value = f"\'{json.dumps(self.spec[key].get('example'...
[ "def", "generate_docker_run", "(", "self", ")", ":", "example", "=", "[", "]", "example", ".", "append", "(", "\"docker run -it\"", ")", "for", "key", "in", "sorted", "(", "list", "(", "self", ".", "spec", ".", "keys", "(", ")", ")", ")", ":", "if", ...
Generate a sample docker run
[ "Generate", "a", "sample", "docker", "run" ]
09763c111fb38b3ba7a13cc95ca59e4393fe75ba
https://github.com/cidrblock/modelsettings/blob/09763c111fb38b3ba7a13cc95ca59e4393fe75ba/modelsettings/__init__.py#L246-L259
38,241
cidrblock/modelsettings
modelsettings/__init__.py
ModelSettings.generate_docker_compose
def generate_docker_compose(self): """ Generate a sample docker compose """ example = {} example['app'] = {} example['app']['environment'] = [] for key in sorted(list(self.spec.keys())): if self.spec[key]['type'] in (dict, list): value = f"\'{j...
python
def generate_docker_compose(self): """ Generate a sample docker compose """ example = {} example['app'] = {} example['app']['environment'] = [] for key in sorted(list(self.spec.keys())): if self.spec[key]['type'] in (dict, list): value = f"\'{j...
[ "def", "generate_docker_compose", "(", "self", ")", ":", "example", "=", "{", "}", "example", "[", "'app'", "]", "=", "{", "}", "example", "[", "'app'", "]", "[", "'environment'", "]", "=", "[", "]", "for", "key", "in", "sorted", "(", "list", "(", ...
Generate a sample docker compose
[ "Generate", "a", "sample", "docker", "compose" ]
09763c111fb38b3ba7a13cc95ca59e4393fe75ba
https://github.com/cidrblock/modelsettings/blob/09763c111fb38b3ba7a13cc95ca59e4393fe75ba/modelsettings/__init__.py#L261-L273
38,242
cidrblock/modelsettings
modelsettings/__init__.py
ModelSettings.generate_ini
def generate_ini(self): """ Generate a sample ini """ example = [] example.append("[settings]") for key in sorted(list(self.spec.keys())): if self.spec[key]['type'] in [list, dict]: value = json.dumps(self.spec[key].get('example', '')) else...
python
def generate_ini(self): """ Generate a sample ini """ example = [] example.append("[settings]") for key in sorted(list(self.spec.keys())): if self.spec[key]['type'] in [list, dict]: value = json.dumps(self.spec[key].get('example', '')) else...
[ "def", "generate_ini", "(", "self", ")", ":", "example", "=", "[", "]", "example", ".", "append", "(", "\"[settings]\"", ")", "for", "key", "in", "sorted", "(", "list", "(", "self", ".", "spec", ".", "keys", "(", ")", ")", ")", ":", "if", "self", ...
Generate a sample ini
[ "Generate", "a", "sample", "ini" ]
09763c111fb38b3ba7a13cc95ca59e4393fe75ba
https://github.com/cidrblock/modelsettings/blob/09763c111fb38b3ba7a13cc95ca59e4393fe75ba/modelsettings/__init__.py#L275-L287
38,243
cidrblock/modelsettings
modelsettings/__init__.py
ModelSettings.generate_kubernetes
def generate_kubernetes(self): """ Generate a sample kubernetes """ example = {} example['spec'] = {} example['spec']['containers'] = [] example['spec']['containers'].append({"name": '', "image": '', "env": []}) for key, value in self.spec.items(): if ...
python
def generate_kubernetes(self): """ Generate a sample kubernetes """ example = {} example['spec'] = {} example['spec']['containers'] = [] example['spec']['containers'].append({"name": '', "image": '', "env": []}) for key, value in self.spec.items(): if ...
[ "def", "generate_kubernetes", "(", "self", ")", ":", "example", "=", "{", "}", "example", "[", "'spec'", "]", "=", "{", "}", "example", "[", "'spec'", "]", "[", "'containers'", "]", "=", "[", "]", "example", "[", "'spec'", "]", "[", "'containers'", "...
Generate a sample kubernetes
[ "Generate", "a", "sample", "kubernetes" ]
09763c111fb38b3ba7a13cc95ca59e4393fe75ba
https://github.com/cidrblock/modelsettings/blob/09763c111fb38b3ba7a13cc95ca59e4393fe75ba/modelsettings/__init__.py#L289-L303
38,244
cidrblock/modelsettings
modelsettings/__init__.py
ModelSettings.generate_drone_plugin
def generate_drone_plugin(self): """ Generate a sample drone plugin configuration """ example = {} example['pipeline'] = {} example['pipeline']['appname'] = {} example['pipeline']['appname']['image'] = "" example['pipeline']['appname']['secrets'] = "" for ...
python
def generate_drone_plugin(self): """ Generate a sample drone plugin configuration """ example = {} example['pipeline'] = {} example['pipeline']['appname'] = {} example['pipeline']['appname']['image'] = "" example['pipeline']['appname']['secrets'] = "" for ...
[ "def", "generate_drone_plugin", "(", "self", ")", ":", "example", "=", "{", "}", "example", "[", "'pipeline'", "]", "=", "{", "}", "example", "[", "'pipeline'", "]", "[", "'appname'", "]", "=", "{", "}", "example", "[", "'pipeline'", "]", "[", "'appnam...
Generate a sample drone plugin configuration
[ "Generate", "a", "sample", "drone", "plugin", "configuration" ]
09763c111fb38b3ba7a13cc95ca59e4393fe75ba
https://github.com/cidrblock/modelsettings/blob/09763c111fb38b3ba7a13cc95ca59e4393fe75ba/modelsettings/__init__.py#L305-L319
38,245
cidrblock/modelsettings
modelsettings/__init__.py
ModelSettings.generate_readme
def generate_readme(self): """ Generate a readme with all the generators """ print("## Examples of settings runtime params") print("### Command-line parameters") print("```") self.generate_command() print("```") print("### Environment variables") ...
python
def generate_readme(self): """ Generate a readme with all the generators """ print("## Examples of settings runtime params") print("### Command-line parameters") print("```") self.generate_command() print("```") print("### Environment variables") ...
[ "def", "generate_readme", "(", "self", ")", ":", "print", "(", "\"## Examples of settings runtime params\"", ")", "print", "(", "\"### Command-line parameters\"", ")", "print", "(", "\"```\"", ")", "self", ".", "generate_command", "(", ")", "print", "(", "\"```\"", ...
Generate a readme with all the generators
[ "Generate", "a", "readme", "with", "all", "the", "generators" ]
09763c111fb38b3ba7a13cc95ca59e4393fe75ba
https://github.com/cidrblock/modelsettings/blob/09763c111fb38b3ba7a13cc95ca59e4393fe75ba/modelsettings/__init__.py#L321-L352
38,246
Robpol86/Flask-Statics-Helper
flask_statics/resource_base.py
ResourceBase.file_exists
def file_exists(self, subdir, prefix, suffix): """Returns true if the resource file exists, else False. Positional arguments: subdir -- sub directory name under the resource's main directory (e.g. css or js, or an empty string if the resource's directory structure is flat). ...
python
def file_exists(self, subdir, prefix, suffix): """Returns true if the resource file exists, else False. Positional arguments: subdir -- sub directory name under the resource's main directory (e.g. css or js, or an empty string if the resource's directory structure is flat). ...
[ "def", "file_exists", "(", "self", ",", "subdir", ",", "prefix", ",", "suffix", ")", ":", "real_path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "STATIC_DIR", ",", "self", ".", "DIR", ",", "subdir", ",", "prefix", "+", "suffix", ")", "...
Returns true if the resource file exists, else False. Positional arguments: subdir -- sub directory name under the resource's main directory (e.g. css or js, or an empty string if the resource's directory structure is flat). prefix -- file name without the file extension. su...
[ "Returns", "true", "if", "the", "resource", "file", "exists", "else", "False", "." ]
b1771e65225f62b760b3ef841b710ff23ef6f83c
https://github.com/Robpol86/Flask-Statics-Helper/blob/b1771e65225f62b760b3ef841b710ff23ef6f83c/flask_statics/resource_base.py#L30-L40
38,247
Robpol86/Flask-Statics-Helper
flask_statics/resource_base.py
ResourceBase.add_css
def add_css(self, subdir, file_name_prefix): """Add a css file for this resource. If self.minify is True, checks if the .min.css file exists. If not, falls back to non-minified file. If that file also doesn't exist, IOError is raised. Positional arguments: subdir -- sub directo...
python
def add_css(self, subdir, file_name_prefix): """Add a css file for this resource. If self.minify is True, checks if the .min.css file exists. If not, falls back to non-minified file. If that file also doesn't exist, IOError is raised. Positional arguments: subdir -- sub directo...
[ "def", "add_css", "(", "self", ",", "subdir", ",", "file_name_prefix", ")", ":", "suffix_maxify", "=", "'.css'", "suffix_minify", "=", "'.min.css'", "if", "self", ".", "minify", "and", "self", ".", "file_exists", "(", "subdir", ",", "file_name_prefix", ",", ...
Add a css file for this resource. If self.minify is True, checks if the .min.css file exists. If not, falls back to non-minified file. If that file also doesn't exist, IOError is raised. Positional arguments: subdir -- sub directory name under the resource's main directory (e.g. css or...
[ "Add", "a", "css", "file", "for", "this", "resource", "." ]
b1771e65225f62b760b3ef841b710ff23ef6f83c
https://github.com/Robpol86/Flask-Statics-Helper/blob/b1771e65225f62b760b3ef841b710ff23ef6f83c/flask_statics/resource_base.py#L42-L60
38,248
smarie/python-parsyfiles
parsyfiles/plugins_optional/support_for_pandas.py
read_dataframe_from_xls
def read_dataframe_from_xls(desired_type: Type[T], file_path: str, encoding: str, logger: Logger, **kwargs) -> pd.DataFrame: """ We register this method rather than the other because pandas guesses the encoding by itself. Also, it is easier to put a breakpoint and debug by tryin...
python
def read_dataframe_from_xls(desired_type: Type[T], file_path: str, encoding: str, logger: Logger, **kwargs) -> pd.DataFrame: """ We register this method rather than the other because pandas guesses the encoding by itself. Also, it is easier to put a breakpoint and debug by tryin...
[ "def", "read_dataframe_from_xls", "(", "desired_type", ":", "Type", "[", "T", "]", ",", "file_path", ":", "str", ",", "encoding", ":", "str", ",", "logger", ":", "Logger", ",", "*", "*", "kwargs", ")", "->", "pd", ".", "DataFrame", ":", "return", "pd",...
We register this method rather than the other because pandas guesses the encoding by itself. Also, it is easier to put a breakpoint and debug by trying various options to find the good one (in streaming mode you just have one try and then the stream is consumed) :param desired_type: :param file_path: ...
[ "We", "register", "this", "method", "rather", "than", "the", "other", "because", "pandas", "guesses", "the", "encoding", "by", "itself", "." ]
344b37e1151e8d4e7c2ee49ae09d6568715ae64e
https://github.com/smarie/python-parsyfiles/blob/344b37e1151e8d4e7c2ee49ae09d6568715ae64e/parsyfiles/plugins_optional/support_for_pandas.py#L25-L40
38,249
smarie/python-parsyfiles
parsyfiles/plugins_optional/support_for_pandas.py
read_df_or_series_from_csv
def read_df_or_series_from_csv(desired_type: Type[pd.DataFrame], file_path: str, encoding: str, logger: Logger, **kwargs) -> pd.DataFrame: """ Helper method to read a dataframe from a csv file. By default this is well suited for a dataframe with headers in the first row, for e...
python
def read_df_or_series_from_csv(desired_type: Type[pd.DataFrame], file_path: str, encoding: str, logger: Logger, **kwargs) -> pd.DataFrame: """ Helper method to read a dataframe from a csv file. By default this is well suited for a dataframe with headers in the first row, for e...
[ "def", "read_df_or_series_from_csv", "(", "desired_type", ":", "Type", "[", "pd", ".", "DataFrame", "]", ",", "file_path", ":", "str", ",", "encoding", ":", "str", ",", "logger", ":", "Logger", ",", "*", "*", "kwargs", ")", "->", "pd", ".", "DataFrame", ...
Helper method to read a dataframe from a csv file. By default this is well suited for a dataframe with headers in the first row, for example a parameter dataframe. :param desired_type: :param file_path: :param encoding: :param logger: :param kwargs: :return:
[ "Helper", "method", "to", "read", "a", "dataframe", "from", "a", "csv", "file", ".", "By", "default", "this", "is", "well", "suited", "for", "a", "dataframe", "with", "headers", "in", "the", "first", "row", "for", "example", "a", "parameter", "dataframe", ...
344b37e1151e8d4e7c2ee49ae09d6568715ae64e
https://github.com/smarie/python-parsyfiles/blob/344b37e1151e8d4e7c2ee49ae09d6568715ae64e/parsyfiles/plugins_optional/support_for_pandas.py#L43-L75
38,250
smarie/python-parsyfiles
parsyfiles/plugins_optional/support_for_pandas.py
dict_to_df
def dict_to_df(desired_type: Type[T], dict_obj: Dict, logger: Logger, orient: str = None, **kwargs) -> pd.DataFrame: """ Helper method to convert a dictionary into a dataframe. It supports both simple key-value dicts as well as true table dicts. For this it uses pd.DataFrame constructor or pd.DataFrame.from...
python
def dict_to_df(desired_type: Type[T], dict_obj: Dict, logger: Logger, orient: str = None, **kwargs) -> pd.DataFrame: """ Helper method to convert a dictionary into a dataframe. It supports both simple key-value dicts as well as true table dicts. For this it uses pd.DataFrame constructor or pd.DataFrame.from...
[ "def", "dict_to_df", "(", "desired_type", ":", "Type", "[", "T", "]", ",", "dict_obj", ":", "Dict", ",", "logger", ":", "Logger", ",", "orient", ":", "str", "=", "None", ",", "*", "*", "kwargs", ")", "->", "pd", ".", "DataFrame", ":", "if", "len", ...
Helper method to convert a dictionary into a dataframe. It supports both simple key-value dicts as well as true table dicts. For this it uses pd.DataFrame constructor or pd.DataFrame.from_dict intelligently depending on the case. The orientation of the resulting dataframe can be configured, or left to defa...
[ "Helper", "method", "to", "convert", "a", "dictionary", "into", "a", "dataframe", ".", "It", "supports", "both", "simple", "key", "-", "value", "dicts", "as", "well", "as", "true", "table", "dicts", ".", "For", "this", "it", "uses", "pd", ".", "DataFrame...
344b37e1151e8d4e7c2ee49ae09d6568715ae64e
https://github.com/smarie/python-parsyfiles/blob/344b37e1151e8d4e7c2ee49ae09d6568715ae64e/parsyfiles/plugins_optional/support_for_pandas.py#L100-L148
38,251
smarie/python-parsyfiles
parsyfiles/plugins_optional/support_for_pandas.py
single_row_or_col_df_to_series
def single_row_or_col_df_to_series(desired_type: Type[T], single_rowcol_df: pd.DataFrame, logger: Logger, **kwargs)\ -> pd.Series: """ Helper method to convert a dataframe with one row or one or two columns into a Series :param desired_type: :param single_col_df: :param logger: :param k...
python
def single_row_or_col_df_to_series(desired_type: Type[T], single_rowcol_df: pd.DataFrame, logger: Logger, **kwargs)\ -> pd.Series: """ Helper method to convert a dataframe with one row or one or two columns into a Series :param desired_type: :param single_col_df: :param logger: :param k...
[ "def", "single_row_or_col_df_to_series", "(", "desired_type", ":", "Type", "[", "T", "]", ",", "single_rowcol_df", ":", "pd", ".", "DataFrame", ",", "logger", ":", "Logger", ",", "*", "*", "kwargs", ")", "->", "pd", ".", "Series", ":", "if", "single_rowcol...
Helper method to convert a dataframe with one row or one or two columns into a Series :param desired_type: :param single_col_df: :param logger: :param kwargs: :return:
[ "Helper", "method", "to", "convert", "a", "dataframe", "with", "one", "row", "or", "one", "or", "two", "columns", "into", "a", "Series" ]
344b37e1151e8d4e7c2ee49ae09d6568715ae64e
https://github.com/smarie/python-parsyfiles/blob/344b37e1151e8d4e7c2ee49ae09d6568715ae64e/parsyfiles/plugins_optional/support_for_pandas.py#L156-L180
38,252
smarie/python-parsyfiles
parsyfiles/plugins_optional/support_for_pandas.py
single_row_or_col_df_to_dict
def single_row_or_col_df_to_dict(desired_type: Type[T], single_rowcol_df: pd.DataFrame, logger: Logger, **kwargs)\ -> Dict[str, str]: """ Helper method to convert a dataframe with one row or one or two columns into a dictionary :param desired_type: :param single_rowcol_df: :param logger: ...
python
def single_row_or_col_df_to_dict(desired_type: Type[T], single_rowcol_df: pd.DataFrame, logger: Logger, **kwargs)\ -> Dict[str, str]: """ Helper method to convert a dataframe with one row or one or two columns into a dictionary :param desired_type: :param single_rowcol_df: :param logger: ...
[ "def", "single_row_or_col_df_to_dict", "(", "desired_type", ":", "Type", "[", "T", "]", ",", "single_rowcol_df", ":", "pd", ".", "DataFrame", ",", "logger", ":", "Logger", ",", "*", "*", "kwargs", ")", "->", "Dict", "[", "str", ",", "str", "]", ":", "i...
Helper method to convert a dataframe with one row or one or two columns into a dictionary :param desired_type: :param single_rowcol_df: :param logger: :param kwargs: :return:
[ "Helper", "method", "to", "convert", "a", "dataframe", "with", "one", "row", "or", "one", "or", "two", "columns", "into", "a", "dictionary" ]
344b37e1151e8d4e7c2ee49ae09d6568715ae64e
https://github.com/smarie/python-parsyfiles/blob/344b37e1151e8d4e7c2ee49ae09d6568715ae64e/parsyfiles/plugins_optional/support_for_pandas.py#L183-L207
38,253
mdickinson/refcycle
refcycle/directed_graph.py
DirectedGraph.full_subgraph
def full_subgraph(self, vertices): """ Return the subgraph of this graph whose vertices are the given ones and whose edges are all the edges of the original graph between those vertices. """ subgraph_vertices = {v for v in vertices} subgraph_edges = {edge ...
python
def full_subgraph(self, vertices): """ Return the subgraph of this graph whose vertices are the given ones and whose edges are all the edges of the original graph between those vertices. """ subgraph_vertices = {v for v in vertices} subgraph_edges = {edge ...
[ "def", "full_subgraph", "(", "self", ",", "vertices", ")", ":", "subgraph_vertices", "=", "{", "v", "for", "v", "in", "vertices", "}", "subgraph_edges", "=", "{", "edge", "for", "v", "in", "subgraph_vertices", "for", "edge", "in", "self", ".", "_out_edges"...
Return the subgraph of this graph whose vertices are the given ones and whose edges are all the edges of the original graph between those vertices.
[ "Return", "the", "subgraph", "of", "this", "graph", "whose", "vertices", "are", "the", "given", "ones", "and", "whose", "edges", "are", "all", "the", "edges", "of", "the", "original", "graph", "between", "those", "vertices", "." ]
627fad74c74efc601209c96405f8118cd99b2241
https://github.com/mdickinson/refcycle/blob/627fad74c74efc601209c96405f8118cd99b2241/refcycle/directed_graph.py#L96-L117
38,254
mdickinson/refcycle
refcycle/directed_graph.py
DirectedGraph._raw
def _raw(cls, vertices, edges, heads, tails): """ Private constructor for direct construction of a DirectedGraph from its consituents. """ self = object.__new__(cls) self._vertices = vertices self._edges = edges self._heads = heads self._tails = t...
python
def _raw(cls, vertices, edges, heads, tails): """ Private constructor for direct construction of a DirectedGraph from its consituents. """ self = object.__new__(cls) self._vertices = vertices self._edges = edges self._heads = heads self._tails = t...
[ "def", "_raw", "(", "cls", ",", "vertices", ",", "edges", ",", "heads", ",", "tails", ")", ":", "self", "=", "object", ".", "__new__", "(", "cls", ")", "self", ".", "_vertices", "=", "vertices", "self", ".", "_edges", "=", "edges", "self", ".", "_h...
Private constructor for direct construction of a DirectedGraph from its consituents.
[ "Private", "constructor", "for", "direct", "construction", "of", "a", "DirectedGraph", "from", "its", "consituents", "." ]
627fad74c74efc601209c96405f8118cd99b2241
https://github.com/mdickinson/refcycle/blob/627fad74c74efc601209c96405f8118cd99b2241/refcycle/directed_graph.py#L124-L143
38,255
mdickinson/refcycle
refcycle/directed_graph.py
DirectedGraph.from_out_edges
def from_out_edges(cls, vertices, edge_mapper): """ Create a DirectedGraph from a collection of vertices and a mapping giving the vertices that each vertex is connected to. """ vertices = set(vertices) edges = set() heads = {} tails = {} # Number...
python
def from_out_edges(cls, vertices, edge_mapper): """ Create a DirectedGraph from a collection of vertices and a mapping giving the vertices that each vertex is connected to. """ vertices = set(vertices) edges = set() heads = {} tails = {} # Number...
[ "def", "from_out_edges", "(", "cls", ",", "vertices", ",", "edge_mapper", ")", ":", "vertices", "=", "set", "(", "vertices", ")", "edges", "=", "set", "(", ")", "heads", "=", "{", "}", "tails", "=", "{", "}", "# Number the edges arbitrarily.", "edge_identi...
Create a DirectedGraph from a collection of vertices and a mapping giving the vertices that each vertex is connected to.
[ "Create", "a", "DirectedGraph", "from", "a", "collection", "of", "vertices", "and", "a", "mapping", "giving", "the", "vertices", "that", "each", "vertex", "is", "connected", "to", "." ]
627fad74c74efc601209c96405f8118cd99b2241
https://github.com/mdickinson/refcycle/blob/627fad74c74efc601209c96405f8118cd99b2241/refcycle/directed_graph.py#L146-L171
38,256
mdickinson/refcycle
refcycle/directed_graph.py
DirectedGraph.from_edge_pairs
def from_edge_pairs(cls, vertices, edge_pairs): """ Create a DirectedGraph from a collection of vertices and a collection of pairs giving links between the vertices. """ vertices = set(vertices) edges = set() heads = {} tails = {} # Number the ed...
python
def from_edge_pairs(cls, vertices, edge_pairs): """ Create a DirectedGraph from a collection of vertices and a collection of pairs giving links between the vertices. """ vertices = set(vertices) edges = set() heads = {} tails = {} # Number the ed...
[ "def", "from_edge_pairs", "(", "cls", ",", "vertices", ",", "edge_pairs", ")", ":", "vertices", "=", "set", "(", "vertices", ")", "edges", "=", "set", "(", ")", "heads", "=", "{", "}", "tails", "=", "{", "}", "# Number the edges arbitrarily.", "edge_identi...
Create a DirectedGraph from a collection of vertices and a collection of pairs giving links between the vertices.
[ "Create", "a", "DirectedGraph", "from", "a", "collection", "of", "vertices", "and", "a", "collection", "of", "pairs", "giving", "links", "between", "the", "vertices", "." ]
627fad74c74efc601209c96405f8118cd99b2241
https://github.com/mdickinson/refcycle/blob/627fad74c74efc601209c96405f8118cd99b2241/refcycle/directed_graph.py#L174-L198
38,257
mdickinson/refcycle
refcycle/directed_graph.py
DirectedGraph.annotated
def annotated(self): """ Return an AnnotatedGraph with the same structure as this graph. """ annotated_vertices = { vertex: AnnotatedVertex( id=vertex_id, annotation=six.text_type(vertex), ) for vertex_id, verte...
python
def annotated(self): """ Return an AnnotatedGraph with the same structure as this graph. """ annotated_vertices = { vertex: AnnotatedVertex( id=vertex_id, annotation=six.text_type(vertex), ) for vertex_id, verte...
[ "def", "annotated", "(", "self", ")", ":", "annotated_vertices", "=", "{", "vertex", ":", "AnnotatedVertex", "(", "id", "=", "vertex_id", ",", "annotation", "=", "six", ".", "text_type", "(", "vertex", ")", ",", ")", "for", "vertex_id", ",", "vertex", "i...
Return an AnnotatedGraph with the same structure as this graph.
[ "Return", "an", "AnnotatedGraph", "with", "the", "same", "structure", "as", "this", "graph", "." ]
627fad74c74efc601209c96405f8118cd99b2241
https://github.com/mdickinson/refcycle/blob/627fad74c74efc601209c96405f8118cd99b2241/refcycle/directed_graph.py#L200-L227
38,258
evansde77/dockerstache
src/dockerstache/dotfile.py
Dotfile.load
def load(self): """ read dotfile and populate self opts will override the dotfile settings, make sure everything is synced in both opts and this object """ if self.exists(): with open(self.dot_file, 'r') as handle: self.update(json.loa...
python
def load(self): """ read dotfile and populate self opts will override the dotfile settings, make sure everything is synced in both opts and this object """ if self.exists(): with open(self.dot_file, 'r') as handle: self.update(json.loa...
[ "def", "load", "(", "self", ")", ":", "if", "self", ".", "exists", "(", ")", ":", "with", "open", "(", "self", ".", "dot_file", ",", "'r'", ")", "as", "handle", ":", "self", ".", "update", "(", "json", ".", "load", "(", "handle", ")", ")", "if"...
read dotfile and populate self opts will override the dotfile settings, make sure everything is synced in both opts and this object
[ "read", "dotfile", "and", "populate", "self", "opts", "will", "override", "the", "dotfile", "settings", "make", "sure", "everything", "is", "synced", "in", "both", "opts", "and", "this", "object" ]
929c102e9fffde322dbf17f8e69533a00976aacb
https://github.com/evansde77/dockerstache/blob/929c102e9fffde322dbf17f8e69533a00976aacb/src/dockerstache/dotfile.py#L91-L126
38,259
evansde77/dockerstache
src/dockerstache/dotfile.py
Dotfile.env_dictionary
def env_dictionary(self): """ convert the options to this script into an env var dictionary for pre and post scripts """ none_to_str = lambda x: str(x) if x else "" return {"DOCKERSTACHE_{}".format(k.upper()): none_to_str(v) for k, v in six.iteritems(self)}
python
def env_dictionary(self): """ convert the options to this script into an env var dictionary for pre and post scripts """ none_to_str = lambda x: str(x) if x else "" return {"DOCKERSTACHE_{}".format(k.upper()): none_to_str(v) for k, v in six.iteritems(self)}
[ "def", "env_dictionary", "(", "self", ")", ":", "none_to_str", "=", "lambda", "x", ":", "str", "(", "x", ")", "if", "x", "else", "\"\"", "return", "{", "\"DOCKERSTACHE_{}\"", ".", "format", "(", "k", ".", "upper", "(", ")", ")", ":", "none_to_str", "...
convert the options to this script into an env var dictionary for pre and post scripts
[ "convert", "the", "options", "to", "this", "script", "into", "an", "env", "var", "dictionary", "for", "pre", "and", "post", "scripts" ]
929c102e9fffde322dbf17f8e69533a00976aacb
https://github.com/evansde77/dockerstache/blob/929c102e9fffde322dbf17f8e69533a00976aacb/src/dockerstache/dotfile.py#L152-L158
38,260
evansde77/dockerstache
src/dockerstache/dotfile.py
Dotfile.pre_script
def pre_script(self): """ execute the pre script if it is defined """ if self['pre_script'] is None: return LOGGER.info("Executing pre script: {}".format(self['pre_script'])) cmd = self['pre_script'] execute_command(self.abs_input_dir(), cmd, self.env_...
python
def pre_script(self): """ execute the pre script if it is defined """ if self['pre_script'] is None: return LOGGER.info("Executing pre script: {}".format(self['pre_script'])) cmd = self['pre_script'] execute_command(self.abs_input_dir(), cmd, self.env_...
[ "def", "pre_script", "(", "self", ")", ":", "if", "self", "[", "'pre_script'", "]", "is", "None", ":", "return", "LOGGER", ".", "info", "(", "\"Executing pre script: {}\"", ".", "format", "(", "self", "[", "'pre_script'", "]", ")", ")", "cmd", "=", "self...
execute the pre script if it is defined
[ "execute", "the", "pre", "script", "if", "it", "is", "defined" ]
929c102e9fffde322dbf17f8e69533a00976aacb
https://github.com/evansde77/dockerstache/blob/929c102e9fffde322dbf17f8e69533a00976aacb/src/dockerstache/dotfile.py#L160-L169
38,261
wdbm/propyte
propyte.py
say_tmp_filepath
def say_tmp_filepath( text = None, preference_program = "festival" ): """ Say specified text to a temporary file and return the filepath. """ filepath = shijian.tmp_filepath() + ".wav" say( text = text, preference_program = preference_program, ...
python
def say_tmp_filepath( text = None, preference_program = "festival" ): """ Say specified text to a temporary file and return the filepath. """ filepath = shijian.tmp_filepath() + ".wav" say( text = text, preference_program = preference_program, ...
[ "def", "say_tmp_filepath", "(", "text", "=", "None", ",", "preference_program", "=", "\"festival\"", ")", ":", "filepath", "=", "shijian", ".", "tmp_filepath", "(", ")", "+", "\".wav\"", "say", "(", "text", "=", "text", ",", "preference_program", "=", "prefe...
Say specified text to a temporary file and return the filepath.
[ "Say", "specified", "text", "to", "a", "temporary", "file", "and", "return", "the", "filepath", "." ]
0375a267c49e80223627331c8edbe13dfe9fd116
https://github.com/wdbm/propyte/blob/0375a267c49e80223627331c8edbe13dfe9fd116/propyte.py#L483-L496
38,262
aaronbassett/django-GNU-Terry-Pratchett
gnu_terry_pratchett/decorators.py
clacks_overhead
def clacks_overhead(fn): """ A Django view decorator that will add the `X-Clacks-Overhead` header. Usage: @clacks_overhead def my_view(request): return my_response """ @wraps(fn) def _wrapped(*args, **kw): response = fn(*args, **kw) response['X-Clac...
python
def clacks_overhead(fn): """ A Django view decorator that will add the `X-Clacks-Overhead` header. Usage: @clacks_overhead def my_view(request): return my_response """ @wraps(fn) def _wrapped(*args, **kw): response = fn(*args, **kw) response['X-Clac...
[ "def", "clacks_overhead", "(", "fn", ")", ":", "@", "wraps", "(", "fn", ")", "def", "_wrapped", "(", "*", "args", ",", "*", "*", "kw", ")", ":", "response", "=", "fn", "(", "*", "args", ",", "*", "*", "kw", ")", "response", "[", "'X-Clacks-Overhe...
A Django view decorator that will add the `X-Clacks-Overhead` header. Usage: @clacks_overhead def my_view(request): return my_response
[ "A", "Django", "view", "decorator", "that", "will", "add", "the", "X", "-", "Clacks", "-", "Overhead", "header", "." ]
3292af0d93c0e97515fce3ca513ec7eda1ba7c20
https://github.com/aaronbassett/django-GNU-Terry-Pratchett/blob/3292af0d93c0e97515fce3ca513ec7eda1ba7c20/gnu_terry_pratchett/decorators.py#L4-L21
38,263
WhyNotHugo/django-renderpdf
django_renderpdf/views.py
PDFView.render
def render(self, request, template, context): """ Returns a response. By default, this will contain the rendered PDF, but if both ``allow_force_html`` is ``True`` and the querystring ``html=true`` was set it will return a plain HTML. """ if self.allow_force_html and self....
python
def render(self, request, template, context): """ Returns a response. By default, this will contain the rendered PDF, but if both ``allow_force_html`` is ``True`` and the querystring ``html=true`` was set it will return a plain HTML. """ if self.allow_force_html and self....
[ "def", "render", "(", "self", ",", "request", ",", "template", ",", "context", ")", ":", "if", "self", ".", "allow_force_html", "and", "self", ".", "request", ".", "GET", ".", "get", "(", "'html'", ",", "False", ")", ":", "html", "=", "get_template", ...
Returns a response. By default, this will contain the rendered PDF, but if both ``allow_force_html`` is ``True`` and the querystring ``html=true`` was set it will return a plain HTML.
[ "Returns", "a", "response", ".", "By", "default", "this", "will", "contain", "the", "rendered", "PDF", "but", "if", "both", "allow_force_html", "is", "True", "and", "the", "querystring", "html", "=", "true", "was", "set", "it", "will", "return", "a", "plai...
56de11326e61d317b5eb08c340790ef9955778e3
https://github.com/WhyNotHugo/django-renderpdf/blob/56de11326e61d317b5eb08c340790ef9955778e3/django_renderpdf/views.py#L88-L108
38,264
Chilipp/psy-simple
psy_simple/base.py
TextBase.replace
def replace(self, s, data, attrs=None): """ Replace the attributes of the plotter data in a string %(replace_note)s Parameters ---------- s: str String where the replacements shall be made data: InteractiveBase Data object from which to u...
python
def replace(self, s, data, attrs=None): """ Replace the attributes of the plotter data in a string %(replace_note)s Parameters ---------- s: str String where the replacements shall be made data: InteractiveBase Data object from which to u...
[ "def", "replace", "(", "self", ",", "s", ",", "data", ",", "attrs", "=", "None", ")", ":", "# insert labels", "s", "=", "s", ".", "format", "(", "*", "*", "self", ".", "rc", "[", "'labels'", "]", ")", "# replace attributes", "attrs", "=", "attrs", ...
Replace the attributes of the plotter data in a string %(replace_note)s Parameters ---------- s: str String where the replacements shall be made data: InteractiveBase Data object from which to use the coordinates and insert the coordinate and...
[ "Replace", "the", "attributes", "of", "the", "plotter", "data", "in", "a", "string" ]
7d916406a6d3c3c27c0b7102f98fef07a4da0a61
https://github.com/Chilipp/psy-simple/blob/7d916406a6d3c3c27c0b7102f98fef07a4da0a61/psy_simple/base.py#L88-L131
38,265
Chilipp/psy-simple
psy_simple/base.py
TextBase.get_fig_data_attrs
def get_fig_data_attrs(self, delimiter=None): """Join the data attributes with other plotters in the project This method joins the attributes of the :class:`~psyplot.InteractiveBase` instances in the project that draw on the same figure as this instance does. Parameters ...
python
def get_fig_data_attrs(self, delimiter=None): """Join the data attributes with other plotters in the project This method joins the attributes of the :class:`~psyplot.InteractiveBase` instances in the project that draw on the same figure as this instance does. Parameters ...
[ "def", "get_fig_data_attrs", "(", "self", ",", "delimiter", "=", "None", ")", ":", "if", "self", ".", "project", "is", "not", "None", ":", "delimiter", "=", "next", "(", "filter", "(", "lambda", "d", ":", "d", "is", "not", "None", ",", "[", "delimite...
Join the data attributes with other plotters in the project This method joins the attributes of the :class:`~psyplot.InteractiveBase` instances in the project that draw on the same figure as this instance does. Parameters ---------- delimiter: str Specifies ...
[ "Join", "the", "data", "attributes", "with", "other", "plotters", "in", "the", "project" ]
7d916406a6d3c3c27c0b7102f98fef07a4da0a61
https://github.com/Chilipp/psy-simple/blob/7d916406a6d3c3c27c0b7102f98fef07a4da0a61/psy_simple/base.py#L133-L167
38,266
Chilipp/psy-simple
psy_simple/base.py
TextBase.get_fmt_widget
def get_fmt_widget(self, parent, project): """Create a combobox with the attributes""" from psy_simple.widgets.texts import LabelWidget return LabelWidget(parent, self, project)
python
def get_fmt_widget(self, parent, project): """Create a combobox with the attributes""" from psy_simple.widgets.texts import LabelWidget return LabelWidget(parent, self, project)
[ "def", "get_fmt_widget", "(", "self", ",", "parent", ",", "project", ")", ":", "from", "psy_simple", ".", "widgets", ".", "texts", "import", "LabelWidget", "return", "LabelWidget", "(", "parent", ",", "self", ",", "project", ")" ]
Create a combobox with the attributes
[ "Create", "a", "combobox", "with", "the", "attributes" ]
7d916406a6d3c3c27c0b7102f98fef07a4da0a61
https://github.com/Chilipp/psy-simple/blob/7d916406a6d3c3c27c0b7102f98fef07a4da0a61/psy_simple/base.py#L177-L180
38,267
Chilipp/psy-simple
psy_simple/base.py
Figtitle.clear_other_texts
def clear_other_texts(self, remove=False): """Make sure that no other text is a the same position as this one This method clears all text instances in the figure that are at the same position as the :attr:`_text` attribute Parameters ---------- remove: bool ...
python
def clear_other_texts(self, remove=False): """Make sure that no other text is a the same position as this one This method clears all text instances in the figure that are at the same position as the :attr:`_text` attribute Parameters ---------- remove: bool ...
[ "def", "clear_other_texts", "(", "self", ",", "remove", "=", "False", ")", ":", "fig", "=", "self", ".", "ax", ".", "get_figure", "(", ")", "# don't do anything if our figtitle is the only Text instance", "if", "len", "(", "fig", ".", "texts", ")", "==", "1", ...
Make sure that no other text is a the same position as this one This method clears all text instances in the figure that are at the same position as the :attr:`_text` attribute Parameters ---------- remove: bool If True, the Text instances are permanently deleted fr...
[ "Make", "sure", "that", "no", "other", "text", "is", "a", "the", "same", "position", "as", "this", "one" ]
7d916406a6d3c3c27c0b7102f98fef07a4da0a61
https://github.com/Chilipp/psy-simple/blob/7d916406a6d3c3c27c0b7102f98fef07a4da0a61/psy_simple/base.py#L521-L543
38,268
Chilipp/psy-simple
psy_simple/base.py
Text.transform
def transform(self): """Dictionary containing the relevant transformations""" ax = self.ax return {'axes': ax.transAxes, 'fig': ax.get_figure().transFigure, 'data': ax.transData}
python
def transform(self): """Dictionary containing the relevant transformations""" ax = self.ax return {'axes': ax.transAxes, 'fig': ax.get_figure().transFigure, 'data': ax.transData}
[ "def", "transform", "(", "self", ")", ":", "ax", "=", "self", ".", "ax", "return", "{", "'axes'", ":", "ax", ".", "transAxes", ",", "'fig'", ":", "ax", ".", "get_figure", "(", ")", ".", "transFigure", ",", "'data'", ":", "ax", ".", "transData", "}"...
Dictionary containing the relevant transformations
[ "Dictionary", "containing", "the", "relevant", "transformations" ]
7d916406a6d3c3c27c0b7102f98fef07a4da0a61
https://github.com/Chilipp/psy-simple/blob/7d916406a6d3c3c27c0b7102f98fef07a4da0a61/psy_simple/base.py#L578-L583
38,269
Chilipp/psy-simple
psy_simple/base.py
Text._remove_texttuple
def _remove_texttuple(self, pos): """Remove a texttuple from the value in the plotter Parameters ---------- pos: tuple (x, y, cs) x and y are the x- and y-positions and cs the coordinate system""" for i, (old_x, old_y, s, old_cs, d) in enumerate(self.value): ...
python
def _remove_texttuple(self, pos): """Remove a texttuple from the value in the plotter Parameters ---------- pos: tuple (x, y, cs) x and y are the x- and y-positions and cs the coordinate system""" for i, (old_x, old_y, s, old_cs, d) in enumerate(self.value): ...
[ "def", "_remove_texttuple", "(", "self", ",", "pos", ")", ":", "for", "i", ",", "(", "old_x", ",", "old_y", ",", "s", ",", "old_cs", ",", "d", ")", "in", "enumerate", "(", "self", ".", "value", ")", ":", "if", "(", "old_x", ",", "old_y", ",", "...
Remove a texttuple from the value in the plotter Parameters ---------- pos: tuple (x, y, cs) x and y are the x- and y-positions and cs the coordinate system
[ "Remove", "a", "texttuple", "from", "the", "value", "in", "the", "plotter" ]
7d916406a6d3c3c27c0b7102f98fef07a4da0a61
https://github.com/Chilipp/psy-simple/blob/7d916406a6d3c3c27c0b7102f98fef07a4da0a61/psy_simple/base.py#L592-L603
38,270
Chilipp/psy-simple
psy_simple/base.py
Text._update_texttuple
def _update_texttuple(self, x, y, s, cs, d): """Update the text tuple at `x` and `y` with the given `s` and `d`""" pos = (x, y, cs) for i, (old_x, old_y, old_s, old_cs, old_d) in enumerate(self.value): if (old_x, old_y, old_cs) == pos: self.value[i] = (old_x, old_y, s...
python
def _update_texttuple(self, x, y, s, cs, d): """Update the text tuple at `x` and `y` with the given `s` and `d`""" pos = (x, y, cs) for i, (old_x, old_y, old_s, old_cs, old_d) in enumerate(self.value): if (old_x, old_y, old_cs) == pos: self.value[i] = (old_x, old_y, s...
[ "def", "_update_texttuple", "(", "self", ",", "x", ",", "y", ",", "s", ",", "cs", ",", "d", ")", ":", "pos", "=", "(", "x", ",", "y", ",", "cs", ")", "for", "i", ",", "(", "old_x", ",", "old_y", ",", "old_s", ",", "old_cs", ",", "old_d", ")...
Update the text tuple at `x` and `y` with the given `s` and `d`
[ "Update", "the", "text", "tuple", "at", "x", "and", "y", "with", "the", "given", "s", "and", "d" ]
7d916406a6d3c3c27c0b7102f98fef07a4da0a61
https://github.com/Chilipp/psy-simple/blob/7d916406a6d3c3c27c0b7102f98fef07a4da0a61/psy_simple/base.py#L605-L612
38,271
Chilipp/psy-simple
psy_simple/base.py
Text.share
def share(self, fmto, **kwargs): """Share the settings of this formatoption with other data objects Parameters ---------- fmto: Formatoption The :class:`Formatoption` instance to share the attributes with ``**kwargs`` Any other keyword argument that shall...
python
def share(self, fmto, **kwargs): """Share the settings of this formatoption with other data objects Parameters ---------- fmto: Formatoption The :class:`Formatoption` instance to share the attributes with ``**kwargs`` Any other keyword argument that shall...
[ "def", "share", "(", "self", ",", "fmto", ",", "*", "*", "kwargs", ")", ":", "kwargs", ".", "setdefault", "(", "'texts_to_remove'", ",", "self", ".", "_texts_to_remove", ")", "super", "(", "Text", ",", "self", ")", ".", "share", "(", "fmto", ",", "*"...
Share the settings of this formatoption with other data objects Parameters ---------- fmto: Formatoption The :class:`Formatoption` instance to share the attributes with ``**kwargs`` Any other keyword argument that shall be passed to the update method ...
[ "Share", "the", "settings", "of", "this", "formatoption", "with", "other", "data", "objects" ]
7d916406a6d3c3c27c0b7102f98fef07a4da0a61
https://github.com/Chilipp/psy-simple/blob/7d916406a6d3c3c27c0b7102f98fef07a4da0a61/psy_simple/base.py#L670-L687
38,272
bryanwweber/thermohw
thermohw/pymarkdown.py
PyMarkdownPreprocessor.preprocess_cell
def preprocess_cell( self, cell: "NotebookNode", resources: dict, index: int ) -> Tuple["NotebookNode", dict]: """Preprocess cell. Parameters ---------- cell : NotebookNode cell Notebook cell being processed resources : dictionary Additional r...
python
def preprocess_cell( self, cell: "NotebookNode", resources: dict, index: int ) -> Tuple["NotebookNode", dict]: """Preprocess cell. Parameters ---------- cell : NotebookNode cell Notebook cell being processed resources : dictionary Additional r...
[ "def", "preprocess_cell", "(", "self", ",", "cell", ":", "\"NotebookNode\"", ",", "resources", ":", "dict", ",", "index", ":", "int", ")", "->", "Tuple", "[", "\"NotebookNode\"", ",", "dict", "]", ":", "if", "cell", ".", "cell_type", "==", "\"markdown\"", ...
Preprocess cell. Parameters ---------- cell : NotebookNode cell Notebook cell being processed resources : dictionary Additional resources used in the conversion process. Allows preprocessors to pass variables into the Jinja engine. cell_index ...
[ "Preprocess", "cell", "." ]
b6be276c14f8adf6ae23f5498065de74f868ccaa
https://github.com/bryanwweber/thermohw/blob/b6be276c14f8adf6ae23f5498065de74f868ccaa/thermohw/pymarkdown.py#L74-L96
38,273
oxalorg/dystic
dystic/indexer.py
Indexer.index_dir
def index_dir(self, folder): """ Creates a nested dictionary that represents the folder structure of folder. Also extracts meta data from all markdown posts and adds to the dictionary. """ folder_path = folder print('Indexing folder: ' + folder_path) nested_dir = ...
python
def index_dir(self, folder): """ Creates a nested dictionary that represents the folder structure of folder. Also extracts meta data from all markdown posts and adds to the dictionary. """ folder_path = folder print('Indexing folder: ' + folder_path) nested_dir = ...
[ "def", "index_dir", "(", "self", ",", "folder", ")", ":", "folder_path", "=", "folder", "print", "(", "'Indexing folder: '", "+", "folder_path", ")", "nested_dir", "=", "{", "}", "folder", "=", "folder_path", ".", "rstrip", "(", "os", ".", "sep", ")", "s...
Creates a nested dictionary that represents the folder structure of folder. Also extracts meta data from all markdown posts and adds to the dictionary.
[ "Creates", "a", "nested", "dictionary", "that", "represents", "the", "folder", "structure", "of", "folder", ".", "Also", "extracts", "meta", "data", "from", "all", "markdown", "posts", "and", "adds", "to", "the", "dictionary", "." ]
6f5a449158ec12fc1c9cc25d85e2f8adc27885db
https://github.com/oxalorg/dystic/blob/6f5a449158ec12fc1c9cc25d85e2f8adc27885db/dystic/indexer.py#L17-L48
38,274
mdickinson/refcycle
refcycle/creators.py
cycles_created_by
def cycles_created_by(callable): """ Return graph of cyclic garbage created by the given callable. Return an :class:`~refcycle.object_graph.ObjectGraph` representing those objects generated by the given callable that can't be collected by Python's usual reference-count based garbage collection. ...
python
def cycles_created_by(callable): """ Return graph of cyclic garbage created by the given callable. Return an :class:`~refcycle.object_graph.ObjectGraph` representing those objects generated by the given callable that can't be collected by Python's usual reference-count based garbage collection. ...
[ "def", "cycles_created_by", "(", "callable", ")", ":", "with", "restore_gc_state", "(", ")", ":", "gc", ".", "disable", "(", ")", "gc", ".", "collect", "(", ")", "gc", ".", "set_debug", "(", "gc", ".", "DEBUG_SAVEALL", ")", "callable", "(", ")", "new_o...
Return graph of cyclic garbage created by the given callable. Return an :class:`~refcycle.object_graph.ObjectGraph` representing those objects generated by the given callable that can't be collected by Python's usual reference-count based garbage collection. This includes objects that will eventually ...
[ "Return", "graph", "of", "cyclic", "garbage", "created", "by", "the", "given", "callable", "." ]
627fad74c74efc601209c96405f8118cd99b2241
https://github.com/mdickinson/refcycle/blob/627fad74c74efc601209c96405f8118cd99b2241/refcycle/creators.py#L26-L53
38,275
mdickinson/refcycle
refcycle/creators.py
snapshot
def snapshot(): """Return the graph of all currently gc-tracked objects. Excludes the returned :class:`~refcycle.object_graph.ObjectGraph` and objects owned by it. Note that a subsequent call to :func:`~refcycle.creators.snapshot` will capture all of the objects owned by this snapshot. The :m...
python
def snapshot(): """Return the graph of all currently gc-tracked objects. Excludes the returned :class:`~refcycle.object_graph.ObjectGraph` and objects owned by it. Note that a subsequent call to :func:`~refcycle.creators.snapshot` will capture all of the objects owned by this snapshot. The :m...
[ "def", "snapshot", "(", ")", ":", "all_objects", "=", "gc", ".", "get_objects", "(", ")", "this_frame", "=", "inspect", ".", "currentframe", "(", ")", "selected_objects", "=", "[", "]", "for", "obj", "in", "all_objects", ":", "if", "obj", "is", "not", ...
Return the graph of all currently gc-tracked objects. Excludes the returned :class:`~refcycle.object_graph.ObjectGraph` and objects owned by it. Note that a subsequent call to :func:`~refcycle.creators.snapshot` will capture all of the objects owned by this snapshot. The :meth:`~refcycle.object_g...
[ "Return", "the", "graph", "of", "all", "currently", "gc", "-", "tracked", "objects", "." ]
627fad74c74efc601209c96405f8118cd99b2241
https://github.com/mdickinson/refcycle/blob/627fad74c74efc601209c96405f8118cd99b2241/refcycle/creators.py#L102-L122
38,276
moccu/django-markymark
markymark/extensions/base.py
MarkymarkExtension.extendMarkdown
def extendMarkdown(self, md, md_globals): """ Every extension requires a extendMarkdown method to tell the markdown renderer how use the extension. """ md.registerExtension(self) for processor in (self.preprocessors or []): md.preprocessors.add(processor.__na...
python
def extendMarkdown(self, md, md_globals): """ Every extension requires a extendMarkdown method to tell the markdown renderer how use the extension. """ md.registerExtension(self) for processor in (self.preprocessors or []): md.preprocessors.add(processor.__na...
[ "def", "extendMarkdown", "(", "self", ",", "md", ",", "md_globals", ")", ":", "md", ".", "registerExtension", "(", "self", ")", "for", "processor", "in", "(", "self", ".", "preprocessors", "or", "[", "]", ")", ":", "md", ".", "preprocessors", ".", "add...
Every extension requires a extendMarkdown method to tell the markdown renderer how use the extension.
[ "Every", "extension", "requires", "a", "extendMarkdown", "method", "to", "tell", "the", "markdown", "renderer", "how", "use", "the", "extension", "." ]
c1bf69f439981d6295e5b4d13c26dadf3dba2e9d
https://github.com/moccu/django-markymark/blob/c1bf69f439981d6295e5b4d13c26dadf3dba2e9d/markymark/extensions/base.py#L15-L29
38,277
Julian/L
l/cli.py
run
def run( paths, output=_I_STILL_HATE_EVERYTHING, recurse=core.flat, sort_by=None, ls=core.ls, stdout=stdout, ): """ Project-oriented directory and file information lister. """ if output is _I_STILL_HATE_EVERYTHING: output = core.columnized if stdout.isatty() else core.o...
python
def run( paths, output=_I_STILL_HATE_EVERYTHING, recurse=core.flat, sort_by=None, ls=core.ls, stdout=stdout, ): """ Project-oriented directory and file information lister. """ if output is _I_STILL_HATE_EVERYTHING: output = core.columnized if stdout.isatty() else core.o...
[ "def", "run", "(", "paths", ",", "output", "=", "_I_STILL_HATE_EVERYTHING", ",", "recurse", "=", "core", ".", "flat", ",", "sort_by", "=", "None", ",", "ls", "=", "core", ".", "ls", ",", "stdout", "=", "stdout", ",", ")", ":", "if", "output", "is", ...
Project-oriented directory and file information lister.
[ "Project", "-", "oriented", "directory", "and", "file", "information", "lister", "." ]
946b5378466ec9fa8587bd2187fc632f46d6efdf
https://github.com/Julian/L/blob/946b5378466ec9fa8587bd2187fc632f46d6efdf/l/cli.py#L24-L60
38,278
unixorn/logrus
logrus/utils.py
getCustomLogger
def getCustomLogger(name, logLevel, logFormat='%(asctime)s %(levelname)-9s:%(name)s:%(module)s:%(funcName)s: %(message)s'): ''' Set up logging :param str name: What log level to set :param str logLevel: What log level to use :param str logFormat: Format string for logging :rtype: logger ''' assert isin...
python
def getCustomLogger(name, logLevel, logFormat='%(asctime)s %(levelname)-9s:%(name)s:%(module)s:%(funcName)s: %(message)s'): ''' Set up logging :param str name: What log level to set :param str logLevel: What log level to use :param str logFormat: Format string for logging :rtype: logger ''' assert isin...
[ "def", "getCustomLogger", "(", "name", ",", "logLevel", ",", "logFormat", "=", "'%(asctime)s %(levelname)-9s:%(name)s:%(module)s:%(funcName)s: %(message)s'", ")", ":", "assert", "isinstance", "(", "logFormat", ",", "basestring", ")", ",", "(", "\"logFormat must be a string ...
Set up logging :param str name: What log level to set :param str logLevel: What log level to use :param str logFormat: Format string for logging :rtype: logger
[ "Set", "up", "logging" ]
d1af28639fd42968acc257476d526d9bbe57719f
https://github.com/unixorn/logrus/blob/d1af28639fd42968acc257476d526d9bbe57719f/logrus/utils.py#L27-L55
38,279
unixorn/logrus
logrus/utils.py
mkdir_p
def mkdir_p(path): ''' Mimic `mkdir -p` since os module doesn't provide one. :param str path: directory to create ''' assert isinstance(path, basestring), ("path must be a string but is %r" % path) try: os.makedirs(path) except OSError as exception: if exception.errno != errno.EEXIST: raise
python
def mkdir_p(path): ''' Mimic `mkdir -p` since os module doesn't provide one. :param str path: directory to create ''' assert isinstance(path, basestring), ("path must be a string but is %r" % path) try: os.makedirs(path) except OSError as exception: if exception.errno != errno.EEXIST: raise
[ "def", "mkdir_p", "(", "path", ")", ":", "assert", "isinstance", "(", "path", ",", "basestring", ")", ",", "(", "\"path must be a string but is %r\"", "%", "path", ")", "try", ":", "os", ".", "makedirs", "(", "path", ")", "except", "OSError", "as", "except...
Mimic `mkdir -p` since os module doesn't provide one. :param str path: directory to create
[ "Mimic", "mkdir", "-", "p", "since", "os", "module", "doesn", "t", "provide", "one", "." ]
d1af28639fd42968acc257476d526d9bbe57719f
https://github.com/unixorn/logrus/blob/d1af28639fd42968acc257476d526d9bbe57719f/logrus/utils.py#L58-L69
38,280
Cadasta/cadasta-workertoolbox
cadasta/workertoolbox/setup.py
setup_exchanges
def setup_exchanges(app): """ Setup result exchange to route all tasks to platform queue. """ with app.producer_or_acquire() as P: # Ensure all queues are noticed and configured with their # appropriate exchange. for q in app.amqp.queues.values(): P.maybe_declare(q)
python
def setup_exchanges(app): """ Setup result exchange to route all tasks to platform queue. """ with app.producer_or_acquire() as P: # Ensure all queues are noticed and configured with their # appropriate exchange. for q in app.amqp.queues.values(): P.maybe_declare(q)
[ "def", "setup_exchanges", "(", "app", ")", ":", "with", "app", ".", "producer_or_acquire", "(", ")", "as", "P", ":", "# Ensure all queues are noticed and configured with their", "# appropriate exchange.", "for", "q", "in", "app", ".", "amqp", ".", "queues", ".", "...
Setup result exchange to route all tasks to platform queue.
[ "Setup", "result", "exchange", "to", "route", "all", "tasks", "to", "platform", "queue", "." ]
e17cf376538cee0b32c7a21afd5319e3549b954f
https://github.com/Cadasta/cadasta-workertoolbox/blob/e17cf376538cee0b32c7a21afd5319e3549b954f/cadasta/workertoolbox/setup.py#L16-L24
38,281
Cadasta/cadasta-workertoolbox
cadasta/workertoolbox/setup.py
setup_app
def setup_app(app, throw=True): """ Ensure application is set up to expected configuration. This function is typically triggered by the worker_init signal, however it must be called manually by codebases that are run only as task producers or from within a Python shell. """ success = True ...
python
def setup_app(app, throw=True): """ Ensure application is set up to expected configuration. This function is typically triggered by the worker_init signal, however it must be called manually by codebases that are run only as task producers or from within a Python shell. """ success = True ...
[ "def", "setup_app", "(", "app", ",", "throw", "=", "True", ")", ":", "success", "=", "True", "try", ":", "for", "func", "in", "SETUP_FUNCS", ":", "try", ":", "func", "(", "app", ")", "except", "Exception", ":", "success", "=", "False", "if", "throw",...
Ensure application is set up to expected configuration. This function is typically triggered by the worker_init signal, however it must be called manually by codebases that are run only as task producers or from within a Python shell.
[ "Ensure", "application", "is", "set", "up", "to", "expected", "configuration", ".", "This", "function", "is", "typically", "triggered", "by", "the", "worker_init", "signal", "however", "it", "must", "be", "called", "manually", "by", "codebases", "that", "are", ...
e17cf376538cee0b32c7a21afd5319e3549b954f
https://github.com/Cadasta/cadasta-workertoolbox/blob/e17cf376538cee0b32c7a21afd5319e3549b954f/cadasta/workertoolbox/setup.py#L33-L53
38,282
ofek/depq
depq/depq.py
DEPQ._poplast
def _poplast(self): """For avoiding lock during inserting to keep maxlen""" try: tup = self.data.pop() except IndexError as ex: ex.args = ('DEPQ is already empty',) raise self_items = self.items try: self_items[tup[0]] -= 1 ...
python
def _poplast(self): """For avoiding lock during inserting to keep maxlen""" try: tup = self.data.pop() except IndexError as ex: ex.args = ('DEPQ is already empty',) raise self_items = self.items try: self_items[tup[0]] -= 1 ...
[ "def", "_poplast", "(", "self", ")", ":", "try", ":", "tup", "=", "self", ".", "data", ".", "pop", "(", ")", "except", "IndexError", "as", "ex", ":", "ex", ".", "args", "=", "(", "'DEPQ is already empty'", ",", ")", "raise", "self_items", "=", "self"...
For avoiding lock during inserting to keep maxlen
[ "For", "avoiding", "lock", "during", "inserting", "to", "keep", "maxlen" ]
370e3ad503d3e9cedc3c49dc64add393ba945764
https://github.com/ofek/depq/blob/370e3ad503d3e9cedc3c49dc64add393ba945764/depq/depq.py#L188-L209
38,283
memphis-iis/GLUDB
gludb/data.py
DatabaseEnabled
def DatabaseEnabled(cls): """Given persistence methods to classes with this annotation. All this really does is add some functions that forward to the mapped database class. """ if not issubclass(cls, Storable): raise ValueError( "%s is not a subclass of gludb.datab.Storage" % r...
python
def DatabaseEnabled(cls): """Given persistence methods to classes with this annotation. All this really does is add some functions that forward to the mapped database class. """ if not issubclass(cls, Storable): raise ValueError( "%s is not a subclass of gludb.datab.Storage" % r...
[ "def", "DatabaseEnabled", "(", "cls", ")", ":", "if", "not", "issubclass", "(", "cls", ",", "Storable", ")", ":", "raise", "ValueError", "(", "\"%s is not a subclass of gludb.datab.Storage\"", "%", "repr", "(", "cls", ")", ")", "cls", ".", "ensure_table", "=",...
Given persistence methods to classes with this annotation. All this really does is add some functions that forward to the mapped database class.
[ "Given", "persistence", "methods", "to", "classes", "with", "this", "annotation", "." ]
25692528ff6fe8184a3570f61f31f1a90088a388
https://github.com/memphis-iis/GLUDB/blob/25692528ff6fe8184a3570f61f31f1a90088a388/gludb/data.py#L145-L163
38,284
studionow/pybrightcove
pybrightcove/playlist.py
Playlist._find_playlist
def _find_playlist(self): """ Internal method to populate the object given the ``id`` or ``reference_id`` that has been set in the constructor. """ data = None if self.id: data = self.connection.get_item( 'find_playlist_by_id', playlist_id=self...
python
def _find_playlist(self): """ Internal method to populate the object given the ``id`` or ``reference_id`` that has been set in the constructor. """ data = None if self.id: data = self.connection.get_item( 'find_playlist_by_id', playlist_id=self...
[ "def", "_find_playlist", "(", "self", ")", ":", "data", "=", "None", "if", "self", ".", "id", ":", "data", "=", "self", ".", "connection", ".", "get_item", "(", "'find_playlist_by_id'", ",", "playlist_id", "=", "self", ".", "id", ")", "elif", "self", "...
Internal method to populate the object given the ``id`` or ``reference_id`` that has been set in the constructor.
[ "Internal", "method", "to", "populate", "the", "object", "given", "the", "id", "or", "reference_id", "that", "has", "been", "set", "in", "the", "constructor", "." ]
19c946b689a80156e070fe9bc35589c4b768e614
https://github.com/studionow/pybrightcove/blob/19c946b689a80156e070fe9bc35589c4b768e614/pybrightcove/playlist.py#L93-L108
38,285
studionow/pybrightcove
pybrightcove/playlist.py
Playlist._to_dict
def _to_dict(self): """ Internal method that serializes object into a dictionary. """ data = { 'name': self.name, 'referenceId': self.reference_id, 'shortDescription': self.short_description, 'playlistType': self.type, 'id': sel...
python
def _to_dict(self): """ Internal method that serializes object into a dictionary. """ data = { 'name': self.name, 'referenceId': self.reference_id, 'shortDescription': self.short_description, 'playlistType': self.type, 'id': sel...
[ "def", "_to_dict", "(", "self", ")", ":", "data", "=", "{", "'name'", ":", "self", ".", "name", ",", "'referenceId'", ":", "self", ".", "reference_id", ",", "'shortDescription'", ":", "self", ".", "short_description", ",", "'playlistType'", ":", "self", "....
Internal method that serializes object into a dictionary.
[ "Internal", "method", "that", "serializes", "object", "into", "a", "dictionary", "." ]
19c946b689a80156e070fe9bc35589c4b768e614
https://github.com/studionow/pybrightcove/blob/19c946b689a80156e070fe9bc35589c4b768e614/pybrightcove/playlist.py#L110-L127
38,286
studionow/pybrightcove
pybrightcove/playlist.py
Playlist._load
def _load(self, data): """ Internal method that deserializes a ``pybrightcove.playlist.Playlist`` object. """ self.raw_data = data self.id = data['id'] self.reference_id = data['referenceId'] self.name = data['name'] self.short_description = data['...
python
def _load(self, data): """ Internal method that deserializes a ``pybrightcove.playlist.Playlist`` object. """ self.raw_data = data self.id = data['id'] self.reference_id = data['referenceId'] self.name = data['name'] self.short_description = data['...
[ "def", "_load", "(", "self", ",", "data", ")", ":", "self", ".", "raw_data", "=", "data", "self", ".", "id", "=", "data", "[", "'id'", "]", "self", ".", "reference_id", "=", "data", "[", "'referenceId'", "]", "self", ".", "name", "=", "data", "[", ...
Internal method that deserializes a ``pybrightcove.playlist.Playlist`` object.
[ "Internal", "method", "that", "deserializes", "a", "pybrightcove", ".", "playlist", ".", "Playlist", "object", "." ]
19c946b689a80156e070fe9bc35589c4b768e614
https://github.com/studionow/pybrightcove/blob/19c946b689a80156e070fe9bc35589c4b768e614/pybrightcove/playlist.py#L129-L146
38,287
studionow/pybrightcove
pybrightcove/playlist.py
Playlist.save
def save(self): """ Create or update a playlist. """ d = self._to_dict() if len(d.get('videoIds', [])) > 0: if not self.id: self.id = self.connection.post('create_playlist', playlist=d) else: data = self.connection.post('upd...
python
def save(self): """ Create or update a playlist. """ d = self._to_dict() if len(d.get('videoIds', [])) > 0: if not self.id: self.id = self.connection.post('create_playlist', playlist=d) else: data = self.connection.post('upd...
[ "def", "save", "(", "self", ")", ":", "d", "=", "self", ".", "_to_dict", "(", ")", "if", "len", "(", "d", ".", "get", "(", "'videoIds'", ",", "[", "]", ")", ")", ">", "0", ":", "if", "not", "self", ".", "id", ":", "self", ".", "id", "=", ...
Create or update a playlist.
[ "Create", "or", "update", "a", "playlist", "." ]
19c946b689a80156e070fe9bc35589c4b768e614
https://github.com/studionow/pybrightcove/blob/19c946b689a80156e070fe9bc35589c4b768e614/pybrightcove/playlist.py#L148-L159
38,288
studionow/pybrightcove
pybrightcove/playlist.py
Playlist.delete
def delete(self, cascade=False): """ Deletes this playlist. """ if self.id: self.connection.post('delete_playlist', playlist_id=self.id, cascade=cascade) self.id = None
python
def delete(self, cascade=False): """ Deletes this playlist. """ if self.id: self.connection.post('delete_playlist', playlist_id=self.id, cascade=cascade) self.id = None
[ "def", "delete", "(", "self", ",", "cascade", "=", "False", ")", ":", "if", "self", ".", "id", ":", "self", ".", "connection", ".", "post", "(", "'delete_playlist'", ",", "playlist_id", "=", "self", ".", "id", ",", "cascade", "=", "cascade", ")", "se...
Deletes this playlist.
[ "Deletes", "this", "playlist", "." ]
19c946b689a80156e070fe9bc35589c4b768e614
https://github.com/studionow/pybrightcove/blob/19c946b689a80156e070fe9bc35589c4b768e614/pybrightcove/playlist.py#L161-L168
38,289
studionow/pybrightcove
pybrightcove/playlist.py
Playlist.find_all
def find_all(connection=None, page_size=100, page_number=0, sort_by=DEFAULT_SORT_BY, sort_order=DEFAULT_SORT_ORDER): """ List all playlists. """ return pybrightcove.connection.ItemResultSet("find_all_playlists", Playlist, connection, page_size, page_number, sort_by, s...
python
def find_all(connection=None, page_size=100, page_number=0, sort_by=DEFAULT_SORT_BY, sort_order=DEFAULT_SORT_ORDER): """ List all playlists. """ return pybrightcove.connection.ItemResultSet("find_all_playlists", Playlist, connection, page_size, page_number, sort_by, s...
[ "def", "find_all", "(", "connection", "=", "None", ",", "page_size", "=", "100", ",", "page_number", "=", "0", ",", "sort_by", "=", "DEFAULT_SORT_BY", ",", "sort_order", "=", "DEFAULT_SORT_ORDER", ")", ":", "return", "pybrightcove", ".", "connection", ".", "...
List all playlists.
[ "List", "all", "playlists", "." ]
19c946b689a80156e070fe9bc35589c4b768e614
https://github.com/studionow/pybrightcove/blob/19c946b689a80156e070fe9bc35589c4b768e614/pybrightcove/playlist.py#L171-L177
38,290
studionow/pybrightcove
pybrightcove/playlist.py
Playlist.find_by_ids
def find_by_ids(ids, connection=None, page_size=100, page_number=0, sort_by=DEFAULT_SORT_BY, sort_order=DEFAULT_SORT_ORDER): """ List playlists by specific IDs. """ ids = ','.join([str(i) for i in ids]) return pybrightcove.connection.ItemResultSet('find_playlists_by_ids',...
python
def find_by_ids(ids, connection=None, page_size=100, page_number=0, sort_by=DEFAULT_SORT_BY, sort_order=DEFAULT_SORT_ORDER): """ List playlists by specific IDs. """ ids = ','.join([str(i) for i in ids]) return pybrightcove.connection.ItemResultSet('find_playlists_by_ids',...
[ "def", "find_by_ids", "(", "ids", ",", "connection", "=", "None", ",", "page_size", "=", "100", ",", "page_number", "=", "0", ",", "sort_by", "=", "DEFAULT_SORT_BY", ",", "sort_order", "=", "DEFAULT_SORT_ORDER", ")", ":", "ids", "=", "','", ".", "join", ...
List playlists by specific IDs.
[ "List", "playlists", "by", "specific", "IDs", "." ]
19c946b689a80156e070fe9bc35589c4b768e614
https://github.com/studionow/pybrightcove/blob/19c946b689a80156e070fe9bc35589c4b768e614/pybrightcove/playlist.py#L180-L188
38,291
studionow/pybrightcove
pybrightcove/playlist.py
Playlist.find_by_reference_ids
def find_by_reference_ids(reference_ids, connection=None, page_size=100, page_number=0, sort_by=DEFAULT_SORT_BY, sort_order=DEFAULT_SORT_ORDER): """ List playlists by specific reference_ids. """ reference_ids = ','.join([str(i) for i in reference_ids]) return pybrightcove...
python
def find_by_reference_ids(reference_ids, connection=None, page_size=100, page_number=0, sort_by=DEFAULT_SORT_BY, sort_order=DEFAULT_SORT_ORDER): """ List playlists by specific reference_ids. """ reference_ids = ','.join([str(i) for i in reference_ids]) return pybrightcove...
[ "def", "find_by_reference_ids", "(", "reference_ids", ",", "connection", "=", "None", ",", "page_size", "=", "100", ",", "page_number", "=", "0", ",", "sort_by", "=", "DEFAULT_SORT_BY", ",", "sort_order", "=", "DEFAULT_SORT_ORDER", ")", ":", "reference_ids", "="...
List playlists by specific reference_ids.
[ "List", "playlists", "by", "specific", "reference_ids", "." ]
19c946b689a80156e070fe9bc35589c4b768e614
https://github.com/studionow/pybrightcove/blob/19c946b689a80156e070fe9bc35589c4b768e614/pybrightcove/playlist.py#L191-L199
38,292
studionow/pybrightcove
pybrightcove/playlist.py
Playlist.find_for_player_id
def find_for_player_id(player_id, connection=None, page_size=100, page_number=0, sort_by=DEFAULT_SORT_BY, sort_order=DEFAULT_SORT_ORDER): """ List playlists for a for given player id. """ return pybrightcove.connection.ItemResultSet( "find_playlists_for_player_id", Pl...
python
def find_for_player_id(player_id, connection=None, page_size=100, page_number=0, sort_by=DEFAULT_SORT_BY, sort_order=DEFAULT_SORT_ORDER): """ List playlists for a for given player id. """ return pybrightcove.connection.ItemResultSet( "find_playlists_for_player_id", Pl...
[ "def", "find_for_player_id", "(", "player_id", ",", "connection", "=", "None", ",", "page_size", "=", "100", ",", "page_number", "=", "0", ",", "sort_by", "=", "DEFAULT_SORT_BY", ",", "sort_order", "=", "DEFAULT_SORT_ORDER", ")", ":", "return", "pybrightcove", ...
List playlists for a for given player id.
[ "List", "playlists", "for", "a", "for", "given", "player", "id", "." ]
19c946b689a80156e070fe9bc35589c4b768e614
https://github.com/studionow/pybrightcove/blob/19c946b689a80156e070fe9bc35589c4b768e614/pybrightcove/playlist.py#L202-L209
38,293
smarie/python-parsyfiles
parsyfiles/converting_core.py
get_options_for_id
def get_options_for_id(options: Dict[str, Dict[str, Any]], identifier: str): """ Helper method, from the full options dict of dicts, to return either the options related to this parser or an empty dictionary. It also performs all the var type checks :param options: :param identifier: :return: ...
python
def get_options_for_id(options: Dict[str, Dict[str, Any]], identifier: str): """ Helper method, from the full options dict of dicts, to return either the options related to this parser or an empty dictionary. It also performs all the var type checks :param options: :param identifier: :return: ...
[ "def", "get_options_for_id", "(", "options", ":", "Dict", "[", "str", ",", "Dict", "[", "str", ",", "Any", "]", "]", ",", "identifier", ":", "str", ")", ":", "check_var", "(", "options", ",", "var_types", "=", "dict", ",", "var_name", "=", "'options'",...
Helper method, from the full options dict of dicts, to return either the options related to this parser or an empty dictionary. It also performs all the var type checks :param options: :param identifier: :return:
[ "Helper", "method", "from", "the", "full", "options", "dict", "of", "dicts", "to", "return", "either", "the", "options", "related", "to", "this", "parser", "or", "an", "empty", "dictionary", ".", "It", "also", "performs", "all", "the", "var", "type", "chec...
344b37e1151e8d4e7c2ee49ae09d6568715ae64e
https://github.com/smarie/python-parsyfiles/blob/344b37e1151e8d4e7c2ee49ae09d6568715ae64e/parsyfiles/converting_core.py#L373-L385
38,294
smarie/python-parsyfiles
parsyfiles/converting_core.py
Converter._convert
def _convert(self, desired_type: Type[T], source_obj: S, logger: Logger, options: Dict[str, Dict[str, Any]]) -> T: """ Implementing classes should implement this method to perform the conversion itself :param desired_type: the destination type of the conversion :param source_obj: the so...
python
def _convert(self, desired_type: Type[T], source_obj: S, logger: Logger, options: Dict[str, Dict[str, Any]]) -> T: """ Implementing classes should implement this method to perform the conversion itself :param desired_type: the destination type of the conversion :param source_obj: the so...
[ "def", "_convert", "(", "self", ",", "desired_type", ":", "Type", "[", "T", "]", ",", "source_obj", ":", "S", ",", "logger", ":", "Logger", ",", "options", ":", "Dict", "[", "str", ",", "Dict", "[", "str", ",", "Any", "]", "]", ")", "->", "T", ...
Implementing classes should implement this method to perform the conversion itself :param desired_type: the destination type of the conversion :param source_obj: the source object that should be converter :param logger: a logger to use if any is available, or None :param options: additi...
[ "Implementing", "classes", "should", "implement", "this", "method", "to", "perform", "the", "conversion", "itself" ]
344b37e1151e8d4e7c2ee49ae09d6568715ae64e
https://github.com/smarie/python-parsyfiles/blob/344b37e1151e8d4e7c2ee49ae09d6568715ae64e/parsyfiles/converting_core.py#L324-L335
38,295
smarie/python-parsyfiles
parsyfiles/converting_core.py
ConverterFunction._convert
def _convert(self, desired_type: Type[T], source_obj: S, logger: Logger, options: Dict[str, Dict[str, Any]]) -> T: """ Delegates to the user-provided method. Passes the appropriate part of the options according to the function name. :param desired_type: :param source_obj: ...
python
def _convert(self, desired_type: Type[T], source_obj: S, logger: Logger, options: Dict[str, Dict[str, Any]]) -> T: """ Delegates to the user-provided method. Passes the appropriate part of the options according to the function name. :param desired_type: :param source_obj: ...
[ "def", "_convert", "(", "self", ",", "desired_type", ":", "Type", "[", "T", "]", ",", "source_obj", ":", "S", ",", "logger", ":", "Logger", ",", "options", ":", "Dict", "[", "str", ",", "Dict", "[", "str", ",", "Any", "]", "]", ")", "->", "T", ...
Delegates to the user-provided method. Passes the appropriate part of the options according to the function name. :param desired_type: :param source_obj: :param logger: :param options: :return:
[ "Delegates", "to", "the", "user", "-", "provided", "method", ".", "Passes", "the", "appropriate", "part", "of", "the", "options", "according", "to", "the", "function", "name", "." ]
344b37e1151e8d4e7c2ee49ae09d6568715ae64e
https://github.com/smarie/python-parsyfiles/blob/344b37e1151e8d4e7c2ee49ae09d6568715ae64e/parsyfiles/converting_core.py#L507-L532
38,296
smarie/python-parsyfiles
parsyfiles/converting_core.py
ConversionChain.remove_first
def remove_first(self, inplace: bool = False): """ Utility method to remove the first converter of this chain. If inplace is True, this object is modified and None is returned. Otherwise, a copy is returned :param inplace: boolean indicating whether to modify this object (True) or retur...
python
def remove_first(self, inplace: bool = False): """ Utility method to remove the first converter of this chain. If inplace is True, this object is modified and None is returned. Otherwise, a copy is returned :param inplace: boolean indicating whether to modify this object (True) or retur...
[ "def", "remove_first", "(", "self", ",", "inplace", ":", "bool", "=", "False", ")", ":", "if", "len", "(", "self", ".", "_converters_list", ")", ">", "1", ":", "if", "inplace", ":", "self", ".", "_converters_list", "=", "self", ".", "_converters_list", ...
Utility method to remove the first converter of this chain. If inplace is True, this object is modified and None is returned. Otherwise, a copy is returned :param inplace: boolean indicating whether to modify this object (True) or return a copy (False) :return: None or a copy with the first con...
[ "Utility", "method", "to", "remove", "the", "first", "converter", "of", "this", "chain", ".", "If", "inplace", "is", "True", "this", "object", "is", "modified", "and", "None", "is", "returned", ".", "Otherwise", "a", "copy", "is", "returned" ]
344b37e1151e8d4e7c2ee49ae09d6568715ae64e
https://github.com/smarie/python-parsyfiles/blob/344b37e1151e8d4e7c2ee49ae09d6568715ae64e/parsyfiles/converting_core.py#L621-L642
38,297
smarie/python-parsyfiles
parsyfiles/converting_core.py
ConversionChain.add_conversion_steps
def add_conversion_steps(self, converters: List[Converter], inplace: bool = False): """ Utility method to add converters to this chain. If inplace is True, this object is modified and None is returned. Otherwise, a copy is returned :param converters: the list of converters to add ...
python
def add_conversion_steps(self, converters: List[Converter], inplace: bool = False): """ Utility method to add converters to this chain. If inplace is True, this object is modified and None is returned. Otherwise, a copy is returned :param converters: the list of converters to add ...
[ "def", "add_conversion_steps", "(", "self", ",", "converters", ":", "List", "[", "Converter", "]", ",", "inplace", ":", "bool", "=", "False", ")", ":", "check_var", "(", "converters", ",", "var_types", "=", "list", ",", "min_len", "=", "1", ")", "if", ...
Utility method to add converters to this chain. If inplace is True, this object is modified and None is returned. Otherwise, a copy is returned :param converters: the list of converters to add :param inplace: boolean indicating whether to modify this object (True) or return a copy (False) ...
[ "Utility", "method", "to", "add", "converters", "to", "this", "chain", ".", "If", "inplace", "is", "True", "this", "object", "is", "modified", "and", "None", "is", "returned", ".", "Otherwise", "a", "copy", "is", "returned" ]
344b37e1151e8d4e7c2ee49ae09d6568715ae64e
https://github.com/smarie/python-parsyfiles/blob/344b37e1151e8d4e7c2ee49ae09d6568715ae64e/parsyfiles/converting_core.py#L644-L660
38,298
smarie/python-parsyfiles
parsyfiles/converting_core.py
ConversionChain.add_conversion_step
def add_conversion_step(self, converter: Converter[S, T], inplace: bool = False): """ Utility method to add a converter to this chain. If inplace is True, this object is modified and None is returned. Otherwise, a copy is returned :param converter: the converter to add :param in...
python
def add_conversion_step(self, converter: Converter[S, T], inplace: bool = False): """ Utility method to add a converter to this chain. If inplace is True, this object is modified and None is returned. Otherwise, a copy is returned :param converter: the converter to add :param in...
[ "def", "add_conversion_step", "(", "self", ",", "converter", ":", "Converter", "[", "S", ",", "T", "]", ",", "inplace", ":", "bool", "=", "False", ")", ":", "# it the current chain is generic, raise an error", "if", "self", ".", "is_generic", "(", ")", "and", ...
Utility method to add a converter to this chain. If inplace is True, this object is modified and None is returned. Otherwise, a copy is returned :param converter: the converter to add :param inplace: boolean indicating whether to modify this object (True) or return a copy (False) :retur...
[ "Utility", "method", "to", "add", "a", "converter", "to", "this", "chain", ".", "If", "inplace", "is", "True", "this", "object", "is", "modified", "and", "None", "is", "returned", ".", "Otherwise", "a", "copy", "is", "returned" ]
344b37e1151e8d4e7c2ee49ae09d6568715ae64e
https://github.com/smarie/python-parsyfiles/blob/344b37e1151e8d4e7c2ee49ae09d6568715ae64e/parsyfiles/converting_core.py#L662-L693
38,299
smarie/python-parsyfiles
parsyfiles/converting_core.py
ConversionChain.insert_conversion_steps_at_beginning
def insert_conversion_steps_at_beginning(self, converters: List[Converter], inplace: bool = False): """ Utility method to insert converters at the beginning ofthis chain. If inplace is True, this object is modified and None is returned. Otherwise, a copy is returned :param converters: ...
python
def insert_conversion_steps_at_beginning(self, converters: List[Converter], inplace: bool = False): """ Utility method to insert converters at the beginning ofthis chain. If inplace is True, this object is modified and None is returned. Otherwise, a copy is returned :param converters: ...
[ "def", "insert_conversion_steps_at_beginning", "(", "self", ",", "converters", ":", "List", "[", "Converter", "]", ",", "inplace", ":", "bool", "=", "False", ")", ":", "if", "inplace", ":", "for", "converter", "in", "reversed", "(", "converters", ")", ":", ...
Utility method to insert converters at the beginning ofthis chain. If inplace is True, this object is modified and None is returned. Otherwise, a copy is returned :param converters: the list of converters to insert :param inplace: boolean indicating whether to modify this object (True) or retu...
[ "Utility", "method", "to", "insert", "converters", "at", "the", "beginning", "ofthis", "chain", ".", "If", "inplace", "is", "True", "this", "object", "is", "modified", "and", "None", "is", "returned", ".", "Otherwise", "a", "copy", "is", "returned" ]
344b37e1151e8d4e7c2ee49ae09d6568715ae64e
https://github.com/smarie/python-parsyfiles/blob/344b37e1151e8d4e7c2ee49ae09d6568715ae64e/parsyfiles/converting_core.py#L695-L713