repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
aalireza/SimpleAudioIndexer
SimpleAudioIndexer/__init__.py
SimpleAudioIndexer._split_audio_by_duration
def _split_audio_by_duration(self, audio_abs_path, results_abs_path, duration_seconds): """ Calculates the length of each segment and passes it to self._audio_segment_extractor Parameters ---------- audio_abs_path : str results_ab...
python
def _split_audio_by_duration(self, audio_abs_path, results_abs_path, duration_seconds): """ Calculates the length of each segment and passes it to self._audio_segment_extractor Parameters ---------- audio_abs_path : str results_ab...
[ "def", "_split_audio_by_duration", "(", "self", ",", "audio_abs_path", ",", "results_abs_path", ",", "duration_seconds", ")", ":", "total_seconds", "=", "self", ".", "_get_audio_duration_seconds", "(", "audio_abs_path", ")", "current_segment", "=", "0", "while", "curr...
Calculates the length of each segment and passes it to self._audio_segment_extractor Parameters ---------- audio_abs_path : str results_abs_path : str A place for adding digits needs to be added prior the the format decleration i.e. name%03.wav. Here, we'...
[ "Calculates", "the", "length", "of", "each", "segment", "and", "passes", "it", "to", "self", ".", "_audio_segment_extractor" ]
train
https://github.com/aalireza/SimpleAudioIndexer/blob/73f9d75897d785bdaea9d28dde5fa48104428164/SimpleAudioIndexer/__init__.py#L565-L593
aalireza/SimpleAudioIndexer
SimpleAudioIndexer/__init__.py
SimpleAudioIndexer._split_audio_by_size
def _split_audio_by_size(self, audio_abs_path, results_abs_path, chunk_size): """ Calculates the duration of the name.wav in order for all splits have the size of chunk_size except possibly the last split (which will be smaller) and then passes the duration t...
python
def _split_audio_by_size(self, audio_abs_path, results_abs_path, chunk_size): """ Calculates the duration of the name.wav in order for all splits have the size of chunk_size except possibly the last split (which will be smaller) and then passes the duration t...
[ "def", "_split_audio_by_size", "(", "self", ",", "audio_abs_path", ",", "results_abs_path", ",", "chunk_size", ")", ":", "sample_rate", "=", "self", ".", "_get_audio_sample_rate", "(", "audio_abs_path", ")", "sample_bit", "=", "self", ".", "_get_audio_sample_bit", "...
Calculates the duration of the name.wav in order for all splits have the size of chunk_size except possibly the last split (which will be smaller) and then passes the duration to `split_audio_by_duration` Parameters ---------- audio_abs_path : str results_abs_path : str ...
[ "Calculates", "the", "duration", "of", "the", "name", ".", "wav", "in", "order", "for", "all", "splits", "have", "the", "size", "of", "chunk_size", "except", "possibly", "the", "last", "split", "(", "which", "will", "be", "smaller", ")", "and", "then", "...
train
https://github.com/aalireza/SimpleAudioIndexer/blob/73f9d75897d785bdaea9d28dde5fa48104428164/SimpleAudioIndexer/__init__.py#L595-L618
aalireza/SimpleAudioIndexer
SimpleAudioIndexer/__init__.py
SimpleAudioIndexer._filtering_step
def _filtering_step(self, basename): """ Moves the audio file if the format is `wav` to `filtered` directory. Parameters ---------- basename : str A basename of `/home/random-guy/some-audio-file.wav` is `some-audio-file.wav` """ name = ''....
python
def _filtering_step(self, basename): """ Moves the audio file if the format is `wav` to `filtered` directory. Parameters ---------- basename : str A basename of `/home/random-guy/some-audio-file.wav` is `some-audio-file.wav` """ name = ''....
[ "def", "_filtering_step", "(", "self", ",", "basename", ")", ":", "name", "=", "''", ".", "join", "(", "basename", ".", "split", "(", "'.'", ")", "[", ":", "-", "1", "]", ")", "# May cause problems if wav is not less than 9 channels.", "if", "basename", ".",...
Moves the audio file if the format is `wav` to `filtered` directory. Parameters ---------- basename : str A basename of `/home/random-guy/some-audio-file.wav` is `some-audio-file.wav`
[ "Moves", "the", "audio", "file", "if", "the", "format", "is", "wav", "to", "filtered", "directory", "." ]
train
https://github.com/aalireza/SimpleAudioIndexer/blob/73f9d75897d785bdaea9d28dde5fa48104428164/SimpleAudioIndexer/__init__.py#L620-L638
aalireza/SimpleAudioIndexer
SimpleAudioIndexer/__init__.py
SimpleAudioIndexer._staging_step
def _staging_step(self, basename): """ Checks the size of audio file, splits it if it's needed to manage api limit and then moves to `staged` directory while appending `*` to the end of the filename for self.split_audio_by_duration to replace it by a number. Parameters ...
python
def _staging_step(self, basename): """ Checks the size of audio file, splits it if it's needed to manage api limit and then moves to `staged` directory while appending `*` to the end of the filename for self.split_audio_by_duration to replace it by a number. Parameters ...
[ "def", "_staging_step", "(", "self", ",", "basename", ")", ":", "name", "=", "''", ".", "join", "(", "basename", ".", "split", "(", "'.'", ")", "[", ":", "-", "1", "]", ")", "if", "self", ".", "get_mode", "(", ")", "==", "\"ibm\"", ":", "# Checks...
Checks the size of audio file, splits it if it's needed to manage api limit and then moves to `staged` directory while appending `*` to the end of the filename for self.split_audio_by_duration to replace it by a number. Parameters ---------- basename : str A ...
[ "Checks", "the", "size", "of", "audio", "file", "splits", "it", "if", "it", "s", "needed", "to", "manage", "api", "limit", "and", "then", "moves", "to", "staged", "directory", "while", "appending", "*", "to", "the", "end", "of", "the", "filename", "for",...
train
https://github.com/aalireza/SimpleAudioIndexer/blob/73f9d75897d785bdaea9d28dde5fa48104428164/SimpleAudioIndexer/__init__.py#L640-L712
aalireza/SimpleAudioIndexer
SimpleAudioIndexer/__init__.py
SimpleAudioIndexer._prepare_audio
def _prepare_audio(self, basename, replace_already_indexed=False): """ Prepares and stages the audio file to be indexed. Parameters ---------- basename : str, None A basename of `/home/random-guy/some-audio-file.wav` is `some-audio-file.wav` I...
python
def _prepare_audio(self, basename, replace_already_indexed=False): """ Prepares and stages the audio file to be indexed. Parameters ---------- basename : str, None A basename of `/home/random-guy/some-audio-file.wav` is `some-audio-file.wav` I...
[ "def", "_prepare_audio", "(", "self", ",", "basename", ",", "replace_already_indexed", "=", "False", ")", ":", "if", "basename", "is", "not", "None", ":", "if", "basename", "in", "self", ".", "get_timestamps", "(", ")", ":", "if", "self", ".", "get_verbosi...
Prepares and stages the audio file to be indexed. Parameters ---------- basename : str, None A basename of `/home/random-guy/some-audio-file.wav` is `some-audio-file.wav` If basename is `None`, it'll prepare all the audio files.
[ "Prepares", "and", "stages", "the", "audio", "file", "to", "be", "indexed", "." ]
train
https://github.com/aalireza/SimpleAudioIndexer/blob/73f9d75897d785bdaea9d28dde5fa48104428164/SimpleAudioIndexer/__init__.py#L714-L746
aalireza/SimpleAudioIndexer
SimpleAudioIndexer/__init__.py
SimpleAudioIndexer._index_audio_cmu
def _index_audio_cmu(self, basename=None, replace_already_indexed=False): """ Indexes audio with pocketsphinx. Beware that the output would not be sufficiently accurate. Use this only if you don't want to upload your files to IBM. Parameters ----------- basename ...
python
def _index_audio_cmu(self, basename=None, replace_already_indexed=False): """ Indexes audio with pocketsphinx. Beware that the output would not be sufficiently accurate. Use this only if you don't want to upload your files to IBM. Parameters ----------- basename ...
[ "def", "_index_audio_cmu", "(", "self", ",", "basename", "=", "None", ",", "replace_already_indexed", "=", "False", ")", ":", "self", ".", "_prepare_audio", "(", "basename", "=", "basename", ",", "replace_already_indexed", "=", "replace_already_indexed", ")", "for...
Indexes audio with pocketsphinx. Beware that the output would not be sufficiently accurate. Use this only if you don't want to upload your files to IBM. Parameters ----------- basename : str, optional A specific basename to be indexed and is placed in src_dir ...
[ "Indexes", "audio", "with", "pocketsphinx", ".", "Beware", "that", "the", "output", "would", "not", "be", "sufficiently", "accurate", ".", "Use", "this", "only", "if", "you", "don", "t", "want", "to", "upload", "your", "files", "to", "IBM", "." ]
train
https://github.com/aalireza/SimpleAudioIndexer/blob/73f9d75897d785bdaea9d28dde5fa48104428164/SimpleAudioIndexer/__init__.py#L748-L808
aalireza/SimpleAudioIndexer
SimpleAudioIndexer/__init__.py
SimpleAudioIndexer._timestamp_extractor_cmu
def _timestamp_extractor_cmu(self, staging_audio_basename, str_timestamps_with_sil_conf): """ Parameters ---------- str_timestamps_with_sil_conf : [[str, str, str, str]] Of the form [[word, starting_sec, ending_sec, confidence]] Retur...
python
def _timestamp_extractor_cmu(self, staging_audio_basename, str_timestamps_with_sil_conf): """ Parameters ---------- str_timestamps_with_sil_conf : [[str, str, str, str]] Of the form [[word, starting_sec, ending_sec, confidence]] Retur...
[ "def", "_timestamp_extractor_cmu", "(", "self", ",", "staging_audio_basename", ",", "str_timestamps_with_sil_conf", ")", ":", "filter_untimed", "=", "filter", "(", "lambda", "x", ":", "len", "(", "x", ")", "==", "4", ",", "str_timestamps_with_sil_conf", ")", "if",...
Parameters ---------- str_timestamps_with_sil_conf : [[str, str, str, str]] Of the form [[word, starting_sec, ending_sec, confidence]] Returns ------- timestamps : [[str, float, float]]
[ "Parameters", "----------", "str_timestamps_with_sil_conf", ":", "[[", "str", "str", "str", "str", "]]", "Of", "the", "form", "[[", "word", "starting_sec", "ending_sec", "confidence", "]]" ]
train
https://github.com/aalireza/SimpleAudioIndexer/blob/73f9d75897d785bdaea9d28dde5fa48104428164/SimpleAudioIndexer/__init__.py#L810-L839
aalireza/SimpleAudioIndexer
SimpleAudioIndexer/__init__.py
SimpleAudioIndexer._index_audio_ibm
def _index_audio_ibm(self, basename=None, replace_already_indexed=False, continuous=True, model="en-US_BroadbandModel", word_confidence=True, word_alternatives_threshold=0.9, profanity_filter_for_US_results=False): """ Implements...
python
def _index_audio_ibm(self, basename=None, replace_already_indexed=False, continuous=True, model="en-US_BroadbandModel", word_confidence=True, word_alternatives_threshold=0.9, profanity_filter_for_US_results=False): """ Implements...
[ "def", "_index_audio_ibm", "(", "self", ",", "basename", "=", "None", ",", "replace_already_indexed", "=", "False", ",", "continuous", "=", "True", ",", "model", "=", "\"en-US_BroadbandModel\"", ",", "word_confidence", "=", "True", ",", "word_alternatives_threshold"...
Implements a search-suitable interface for Watson speech API. Some explaination of the parameters here have been taken from [1]_ Parameters ---------- basename : str, optional A specific basename to be indexed and is placed in src_dir e.g `audio.wav`. ...
[ "Implements", "a", "search", "-", "suitable", "interface", "for", "Watson", "speech", "API", "." ]
train
https://github.com/aalireza/SimpleAudioIndexer/blob/73f9d75897d785bdaea9d28dde5fa48104428164/SimpleAudioIndexer/__init__.py#L841-L956
aalireza/SimpleAudioIndexer
SimpleAudioIndexer/__init__.py
SimpleAudioIndexer._timestamp_extractor_ibm
def _timestamp_extractor_ibm(self, staging_audio_basename, audio_json): """ Parameters ---------- audio_json : {str: [{str: [{str: str or nuneric}]}]} Refer to Watson Speech API refrence [1]_ Returns ------- [[str, float, float]] A list wh...
python
def _timestamp_extractor_ibm(self, staging_audio_basename, audio_json): """ Parameters ---------- audio_json : {str: [{str: [{str: str or nuneric}]}]} Refer to Watson Speech API refrence [1]_ Returns ------- [[str, float, float]] A list wh...
[ "def", "_timestamp_extractor_ibm", "(", "self", ",", "staging_audio_basename", ",", "audio_json", ")", ":", "try", ":", "timestamps_of_sentences", "=", "[", "audio_json", "[", "'results'", "]", "[", "i", "]", "[", "'alternatives'", "]", "[", "0", "]", "[", "...
Parameters ---------- audio_json : {str: [{str: [{str: str or nuneric}]}]} Refer to Watson Speech API refrence [1]_ Returns ------- [[str, float, float]] A list whose members are lists. Each member list has three elements. First one is a word....
[ "Parameters", "----------", "audio_json", ":", "{", "str", ":", "[", "{", "str", ":", "[", "{", "str", ":", "str", "or", "nuneric", "}", "]", "}", "]", "}", "Refer", "to", "Watson", "Speech", "API", "refrence", "[", "1", "]", "_" ]
train
https://github.com/aalireza/SimpleAudioIndexer/blob/73f9d75897d785bdaea9d28dde5fa48104428164/SimpleAudioIndexer/__init__.py#L958-L989
aalireza/SimpleAudioIndexer
SimpleAudioIndexer/__init__.py
SimpleAudioIndexer.index_audio
def index_audio(self, *args, **kwargs): """ Calls the correct indexer function based on the mode. If mode is `ibm`, _indexer_audio_ibm is called which is an interface for Watson. Note that some of the explaination of _indexer_audio_ibm's arguments is from [1]_ If mode i...
python
def index_audio(self, *args, **kwargs): """ Calls the correct indexer function based on the mode. If mode is `ibm`, _indexer_audio_ibm is called which is an interface for Watson. Note that some of the explaination of _indexer_audio_ibm's arguments is from [1]_ If mode i...
[ "def", "index_audio", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "with", "_Subdirectory_Managing_Decorator", "(", "self", ".", "src_dir", ",", "self", ".", "_needed_directories", ")", ":", "if", "self", ".", "get_mode", "(", ")", "...
Calls the correct indexer function based on the mode. If mode is `ibm`, _indexer_audio_ibm is called which is an interface for Watson. Note that some of the explaination of _indexer_audio_ibm's arguments is from [1]_ If mode is `cmu`, _indexer_audio_cmu is called which is an interface ...
[ "Calls", "the", "correct", "indexer", "function", "based", "on", "the", "mode", "." ]
train
https://github.com/aalireza/SimpleAudioIndexer/blob/73f9d75897d785bdaea9d28dde5fa48104428164/SimpleAudioIndexer/__init__.py#L991-L1110
aalireza/SimpleAudioIndexer
SimpleAudioIndexer/__init__.py
SimpleAudioIndexer._timestamp_regulator
def _timestamp_regulator(self): """ Makes a dictionary whose keys are audio file basenames and whose values are a list of word blocks from unregulated timestamps and updates the main timestamp attribute. After all done, purges unregulated ones. In case the audio file was ...
python
def _timestamp_regulator(self): """ Makes a dictionary whose keys are audio file basenames and whose values are a list of word blocks from unregulated timestamps and updates the main timestamp attribute. After all done, purges unregulated ones. In case the audio file was ...
[ "def", "_timestamp_regulator", "(", "self", ")", ":", "unified_timestamps", "=", "_PrettyDefaultDict", "(", "list", ")", "staged_files", "=", "self", ".", "_list_audio_files", "(", "sub_dir", "=", "\"staging\"", ")", "for", "timestamp_basename", "in", "self", ".",...
Makes a dictionary whose keys are audio file basenames and whose values are a list of word blocks from unregulated timestamps and updates the main timestamp attribute. After all done, purges unregulated ones. In case the audio file was large enough to be splitted, it adds seconds ...
[ "Makes", "a", "dictionary", "whose", "keys", "are", "audio", "file", "basenames", "and", "whose", "values", "are", "a", "list", "of", "word", "blocks", "from", "unregulated", "timestamps", "and", "updates", "the", "main", "timestamp", "attribute", ".", "After"...
train
https://github.com/aalireza/SimpleAudioIndexer/blob/73f9d75897d785bdaea9d28dde5fa48104428164/SimpleAudioIndexer/__init__.py#L1112-L1170
aalireza/SimpleAudioIndexer
SimpleAudioIndexer/__init__.py
SimpleAudioIndexer.save_indexed_audio
def save_indexed_audio(self, indexed_audio_file_abs_path): """ Writes the corrected timestamps to a file. Timestamps are a python dictionary. Parameters ---------- indexed_audio_file_abs_path : str """ with open(indexed_audio_file_abs_path, "wb") as f: ...
python
def save_indexed_audio(self, indexed_audio_file_abs_path): """ Writes the corrected timestamps to a file. Timestamps are a python dictionary. Parameters ---------- indexed_audio_file_abs_path : str """ with open(indexed_audio_file_abs_path, "wb") as f: ...
[ "def", "save_indexed_audio", "(", "self", ",", "indexed_audio_file_abs_path", ")", ":", "with", "open", "(", "indexed_audio_file_abs_path", ",", "\"wb\"", ")", "as", "f", ":", "pickle", ".", "dump", "(", "self", ".", "get_timestamps", "(", ")", ",", "f", ","...
Writes the corrected timestamps to a file. Timestamps are a python dictionary. Parameters ---------- indexed_audio_file_abs_path : str
[ "Writes", "the", "corrected", "timestamps", "to", "a", "file", ".", "Timestamps", "are", "a", "python", "dictionary", "." ]
train
https://github.com/aalireza/SimpleAudioIndexer/blob/73f9d75897d785bdaea9d28dde5fa48104428164/SimpleAudioIndexer/__init__.py#L1172-L1182
aalireza/SimpleAudioIndexer
SimpleAudioIndexer/__init__.py
SimpleAudioIndexer.load_indexed_audio
def load_indexed_audio(self, indexed_audio_file_abs_path): """ Parameters ---------- indexed_audio_file_abs_path : str """ with open(indexed_audio_file_abs_path, "rb") as f: self.__timestamps = pickle.load(f)
python
def load_indexed_audio(self, indexed_audio_file_abs_path): """ Parameters ---------- indexed_audio_file_abs_path : str """ with open(indexed_audio_file_abs_path, "rb") as f: self.__timestamps = pickle.load(f)
[ "def", "load_indexed_audio", "(", "self", ",", "indexed_audio_file_abs_path", ")", ":", "with", "open", "(", "indexed_audio_file_abs_path", ",", "\"rb\"", ")", "as", "f", ":", "self", ".", "__timestamps", "=", "pickle", ".", "load", "(", "f", ")" ]
Parameters ---------- indexed_audio_file_abs_path : str
[ "Parameters", "----------", "indexed_audio_file_abs_path", ":", "str" ]
train
https://github.com/aalireza/SimpleAudioIndexer/blob/73f9d75897d785bdaea9d28dde5fa48104428164/SimpleAudioIndexer/__init__.py#L1184-L1191
aalireza/SimpleAudioIndexer
SimpleAudioIndexer/__init__.py
SimpleAudioIndexer._is_subsequence_of
def _is_subsequence_of(self, sub, sup): """ Parameters ---------- sub : str sup : str Returns ------- bool """ return bool(re.search(".*".join(sub), sup))
python
def _is_subsequence_of(self, sub, sup): """ Parameters ---------- sub : str sup : str Returns ------- bool """ return bool(re.search(".*".join(sub), sup))
[ "def", "_is_subsequence_of", "(", "self", ",", "sub", ",", "sup", ")", ":", "return", "bool", "(", "re", ".", "search", "(", "\".*\"", ".", "join", "(", "sub", ")", ",", "sup", ")", ")" ]
Parameters ---------- sub : str sup : str Returns ------- bool
[ "Parameters", "----------", "sub", ":", "str", "sup", ":", "str" ]
train
https://github.com/aalireza/SimpleAudioIndexer/blob/73f9d75897d785bdaea9d28dde5fa48104428164/SimpleAudioIndexer/__init__.py#L1206-L1217
aalireza/SimpleAudioIndexer
SimpleAudioIndexer/__init__.py
SimpleAudioIndexer._partial_search_validator
def _partial_search_validator(self, sub, sup, anagram=False, subsequence=False, supersequence=False): """ It's responsible for validating the partial results of `search` method. If it returns True, the search would return its result. Else, search method ...
python
def _partial_search_validator(self, sub, sup, anagram=False, subsequence=False, supersequence=False): """ It's responsible for validating the partial results of `search` method. If it returns True, the search would return its result. Else, search method ...
[ "def", "_partial_search_validator", "(", "self", ",", "sub", ",", "sup", ",", "anagram", "=", "False", ",", "subsequence", "=", "False", ",", "supersequence", "=", "False", ")", ":", "def", "get_all_in", "(", "one", ",", "another", ")", ":", "for", "elem...
It's responsible for validating the partial results of `search` method. If it returns True, the search would return its result. Else, search method would discard what it found and look for others. First, checks to see if all elements of `sub` is in `sup` with at least the same frequency...
[ "It", "s", "responsible", "for", "validating", "the", "partial", "results", "of", "search", "method", ".", "If", "it", "returns", "True", "the", "search", "would", "return", "its", "result", ".", "Else", "search", "method", "would", "discard", "what", "it", ...
train
https://github.com/aalireza/SimpleAudioIndexer/blob/73f9d75897d785bdaea9d28dde5fa48104428164/SimpleAudioIndexer/__init__.py#L1232-L1318
aalireza/SimpleAudioIndexer
SimpleAudioIndexer/__init__.py
SimpleAudioIndexer.search_gen
def search_gen(self, query, audio_basename=None, case_sensitive=False, subsequence=False, supersequence=False, timing_error=0.0, anagram=False, missing_word_tolerance=0): """ A generator that searches for the `query` within the audiofiles of the src_dir. ...
python
def search_gen(self, query, audio_basename=None, case_sensitive=False, subsequence=False, supersequence=False, timing_error=0.0, anagram=False, missing_word_tolerance=0): """ A generator that searches for the `query` within the audiofiles of the src_dir. ...
[ "def", "search_gen", "(", "self", ",", "query", ",", "audio_basename", "=", "None", ",", "case_sensitive", "=", "False", ",", "subsequence", "=", "False", ",", "supersequence", "=", "False", ",", "timing_error", "=", "0.0", ",", "anagram", "=", "False", ",...
A generator that searches for the `query` within the audiofiles of the src_dir. Parameters ---------- query : str A string that'll be searched. It'll be splitted on spaces and then each word gets sequentially searched. audio_basename : str, optional ...
[ "A", "generator", "that", "searches", "for", "the", "query", "within", "the", "audiofiles", "of", "the", "src_dir", "." ]
train
https://github.com/aalireza/SimpleAudioIndexer/blob/73f9d75897d785bdaea9d28dde5fa48104428164/SimpleAudioIndexer/__init__.py#L1320-L1501
aalireza/SimpleAudioIndexer
SimpleAudioIndexer/__init__.py
SimpleAudioIndexer.search_all
def search_all(self, queries, audio_basename=None, case_sensitive=False, subsequence=False, supersequence=False, timing_error=0.0, anagram=False, missing_word_tolerance=0): """ Returns a dictionary of all results of all of the queries for all of the audio fi...
python
def search_all(self, queries, audio_basename=None, case_sensitive=False, subsequence=False, supersequence=False, timing_error=0.0, anagram=False, missing_word_tolerance=0): """ Returns a dictionary of all results of all of the queries for all of the audio fi...
[ "def", "search_all", "(", "self", ",", "queries", ",", "audio_basename", "=", "None", ",", "case_sensitive", "=", "False", ",", "subsequence", "=", "False", ",", "supersequence", "=", "False", ",", "timing_error", "=", "0.0", ",", "anagram", "=", "False", ...
Returns a dictionary of all results of all of the queries for all of the audio files. All the specified parameters work per query. Parameters ---------- queries : [str] or str A list of the strings that'll be searched. If type of queries is `str`, it'll b...
[ "Returns", "a", "dictionary", "of", "all", "results", "of", "all", "of", "the", "queries", "for", "all", "of", "the", "audio", "files", ".", "All", "the", "specified", "parameters", "work", "per", "query", "." ]
train
https://github.com/aalireza/SimpleAudioIndexer/blob/73f9d75897d785bdaea9d28dde5fa48104428164/SimpleAudioIndexer/__init__.py#L1503-L1601
aalireza/SimpleAudioIndexer
SimpleAudioIndexer/__init__.py
SimpleAudioIndexer.search_regexp
def search_regexp(self, pattern, audio_basename=None): """ First joins the words of the word_blocks of timestamps with space, per audio_basename. Then matches `pattern` and calculates the index of the word_block where the first and last word of the matched result appears in. Then...
python
def search_regexp(self, pattern, audio_basename=None): """ First joins the words of the word_blocks of timestamps with space, per audio_basename. Then matches `pattern` and calculates the index of the word_block where the first and last word of the matched result appears in. Then...
[ "def", "search_regexp", "(", "self", ",", "pattern", ",", "audio_basename", "=", "None", ")", ":", "def", "indexes_in_transcript_to_start_end_second", "(", "index_tup", ",", "audio_basename", ")", ":", "\"\"\"\n Calculates the word block index by having the beginni...
First joins the words of the word_blocks of timestamps with space, per audio_basename. Then matches `pattern` and calculates the index of the word_block where the first and last word of the matched result appears in. Then presents the output like `search_all` method. Note that the leadi...
[ "First", "joins", "the", "words", "of", "the", "word_blocks", "of", "timestamps", "with", "space", "per", "audio_basename", ".", "Then", "matches", "pattern", "and", "calculates", "the", "index", "of", "the", "word_block", "where", "the", "first", "and", "last...
train
https://github.com/aalireza/SimpleAudioIndexer/blob/73f9d75897d785bdaea9d28dde5fa48104428164/SimpleAudioIndexer/__init__.py#L1603-L1693
lrq3000/pyFileFixity
pyFileFixity/lib/reedsolomon/reedsolo.py
rwh_primes1
def rwh_primes1(n): # http://stackoverflow.com/questions/2068372/fastest-way-to-list-all-primes-below-n-in-python/3035188#3035188 ''' Returns a list of primes < n ''' sieve = [True] * (n/2) for i in xrange(3,int(n**0.5)+1,2): if sieve[i/2]: sieve[i*i/2::i] = [False] * ((n-i*i-1)/(2*...
python
def rwh_primes1(n): # http://stackoverflow.com/questions/2068372/fastest-way-to-list-all-primes-below-n-in-python/3035188#3035188 ''' Returns a list of primes < n ''' sieve = [True] * (n/2) for i in xrange(3,int(n**0.5)+1,2): if sieve[i/2]: sieve[i*i/2::i] = [False] * ((n-i*i-1)/(2*...
[ "def", "rwh_primes1", "(", "n", ")", ":", "# http://stackoverflow.com/questions/2068372/fastest-way-to-list-all-primes-below-n-in-python/3035188#3035188", "sieve", "=", "[", "True", "]", "*", "(", "n", "/", "2", ")", "for", "i", "in", "xrange", "(", "3", ",", "int",...
Returns a list of primes < n
[ "Returns", "a", "list", "of", "primes", "<", "n" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/reedsolomon/reedsolo.py#L117-L124
lrq3000/pyFileFixity
pyFileFixity/lib/reedsolomon/reedsolo.py
find_prime_polys
def find_prime_polys(generator=2, c_exp=8, fast_primes=False, single=False): '''Compute the list of prime polynomials for the given generator and galois field characteristic exponent.''' # fast_primes will output less results but will be significantly faster. # single will output the first prime polynomial ...
python
def find_prime_polys(generator=2, c_exp=8, fast_primes=False, single=False): '''Compute the list of prime polynomials for the given generator and galois field characteristic exponent.''' # fast_primes will output less results but will be significantly faster. # single will output the first prime polynomial ...
[ "def", "find_prime_polys", "(", "generator", "=", "2", ",", "c_exp", "=", "8", ",", "fast_primes", "=", "False", ",", "single", "=", "False", ")", ":", "# fast_primes will output less results but will be significantly faster.", "# single will output the first prime polynomi...
Compute the list of prime polynomials for the given generator and galois field characteristic exponent.
[ "Compute", "the", "list", "of", "prime", "polynomials", "for", "the", "given", "generator", "and", "galois", "field", "characteristic", "exponent", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/reedsolomon/reedsolo.py#L126-L178
lrq3000/pyFileFixity
pyFileFixity/lib/reedsolomon/reedsolo.py
init_tables
def init_tables(prim=0x11d, generator=2, c_exp=8): '''Precompute the logarithm and anti-log tables for faster computation later, using the provided primitive polynomial. These tables are used for multiplication/division since addition/substraction are simple XOR operations inside GF of characteristic 2. The...
python
def init_tables(prim=0x11d, generator=2, c_exp=8): '''Precompute the logarithm and anti-log tables for faster computation later, using the provided primitive polynomial. These tables are used for multiplication/division since addition/substraction are simple XOR operations inside GF of characteristic 2. The...
[ "def", "init_tables", "(", "prim", "=", "0x11d", ",", "generator", "=", "2", ",", "c_exp", "=", "8", ")", ":", "# generator is the generator number (the \"increment\" that will be used to walk through the field by multiplication, this must be a prime number). This is basically the ba...
Precompute the logarithm and anti-log tables for faster computation later, using the provided primitive polynomial. These tables are used for multiplication/division since addition/substraction are simple XOR operations inside GF of characteristic 2. The basic idea is quite simple: since b**(log_b(x), log_b(y))...
[ "Precompute", "the", "logarithm", "and", "anti", "-", "log", "tables", "for", "faster", "computation", "later", "using", "the", "provided", "primitive", "polynomial", ".", "These", "tables", "are", "used", "for", "multiplication", "/", "division", "since", "addi...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/reedsolomon/reedsolo.py#L180-L214
lrq3000/pyFileFixity
pyFileFixity/lib/reedsolomon/reedsolo.py
gf_mult_noLUT_slow
def gf_mult_noLUT_slow(x, y, prim=0): '''Multiplication in Galois Fields without using a precomputed look-up table (and thus it's slower) by using the standard carry-less multiplication + modular reduction using an irreducible prime polynomial.''' ### Define bitwise carry-less operations as inner functions ###...
python
def gf_mult_noLUT_slow(x, y, prim=0): '''Multiplication in Galois Fields without using a precomputed look-up table (and thus it's slower) by using the standard carry-less multiplication + modular reduction using an irreducible prime polynomial.''' ### Define bitwise carry-less operations as inner functions ###...
[ "def", "gf_mult_noLUT_slow", "(", "x", ",", "y", ",", "prim", "=", "0", ")", ":", "### Define bitwise carry-less operations as inner functions ###", "def", "cl_mult", "(", "x", ",", "y", ")", ":", "'''Bitwise carry-less multiplication on integers'''", "z", "=", "0", ...
Multiplication in Galois Fields without using a precomputed look-up table (and thus it's slower) by using the standard carry-less multiplication + modular reduction using an irreducible prime polynomial.
[ "Multiplication", "in", "Galois", "Fields", "without", "using", "a", "precomputed", "look", "-", "up", "table", "(", "and", "thus", "it", "s", "slower", ")", "by", "using", "the", "standard", "carry", "-", "less", "multiplication", "+", "modular", "reduction...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/reedsolomon/reedsolo.py#L243-L287
lrq3000/pyFileFixity
pyFileFixity/lib/reedsolomon/reedsolo.py
gf_mult_noLUT
def gf_mult_noLUT(x, y, prim=0, field_charac_full=256, carryless=True): '''Galois Field integer multiplication using Russian Peasant Multiplication algorithm (faster than the standard multiplication + modular reduction). If prim is 0 and carryless=False, then the function produces the result for a standard inte...
python
def gf_mult_noLUT(x, y, prim=0, field_charac_full=256, carryless=True): '''Galois Field integer multiplication using Russian Peasant Multiplication algorithm (faster than the standard multiplication + modular reduction). If prim is 0 and carryless=False, then the function produces the result for a standard inte...
[ "def", "gf_mult_noLUT", "(", "x", ",", "y", ",", "prim", "=", "0", ",", "field_charac_full", "=", "256", ",", "carryless", "=", "True", ")", ":", "r", "=", "0", "while", "y", ":", "# while y is above 0", "if", "y", "&", "1", ":", "r", "=", "r", "...
Galois Field integer multiplication using Russian Peasant Multiplication algorithm (faster than the standard multiplication + modular reduction). If prim is 0 and carryless=False, then the function produces the result for a standard integers multiplication (no carry-less arithmetics nor modular reduction).
[ "Galois", "Field", "integer", "multiplication", "using", "Russian", "Peasant", "Multiplication", "algorithm", "(", "faster", "than", "the", "standard", "multiplication", "+", "modular", "reduction", ")", ".", "If", "prim", "is", "0", "and", "carryless", "=", "Fa...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/reedsolomon/reedsolo.py#L289-L299
lrq3000/pyFileFixity
pyFileFixity/lib/reedsolomon/reedsolo.py
gf_poly_mul
def gf_poly_mul(p, q): '''Multiply two polynomials, inside Galois Field (but the procedure is generic). Optimized function by precomputation of log.''' # Pre-allocate the result array r = bytearray(len(p) + len(q) - 1) # Precompute the logarithm of p lp = [gf_log[p[i]] for i in xrange(len(p))] #...
python
def gf_poly_mul(p, q): '''Multiply two polynomials, inside Galois Field (but the procedure is generic). Optimized function by precomputation of log.''' # Pre-allocate the result array r = bytearray(len(p) + len(q) - 1) # Precompute the logarithm of p lp = [gf_log[p[i]] for i in xrange(len(p))] #...
[ "def", "gf_poly_mul", "(", "p", ",", "q", ")", ":", "# Pre-allocate the result array", "r", "=", "bytearray", "(", "len", "(", "p", ")", "+", "len", "(", "q", ")", "-", "1", ")", "# Precompute the logarithm of p", "lp", "=", "[", "gf_log", "[", "p", "[...
Multiply two polynomials, inside Galois Field (but the procedure is generic). Optimized function by precomputation of log.
[ "Multiply", "two", "polynomials", "inside", "Galois", "Field", "(", "but", "the", "procedure", "is", "generic", ")", ".", "Optimized", "function", "by", "precomputation", "of", "log", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/reedsolomon/reedsolo.py#L316-L330
lrq3000/pyFileFixity
pyFileFixity/lib/reedsolomon/reedsolo.py
gf_poly_mul_simple
def gf_poly_mul_simple(p, q): # simple equivalent way of multiplying two polynomials without precomputation, but thus it's slower '''Multiply two polynomials, inside Galois Field''' # Pre-allocate the result array r = bytearray(len(p) + len(q) - 1) # Compute the polynomial multiplication (just like the ...
python
def gf_poly_mul_simple(p, q): # simple equivalent way of multiplying two polynomials without precomputation, but thus it's slower '''Multiply two polynomials, inside Galois Field''' # Pre-allocate the result array r = bytearray(len(p) + len(q) - 1) # Compute the polynomial multiplication (just like the ...
[ "def", "gf_poly_mul_simple", "(", "p", ",", "q", ")", ":", "# simple equivalent way of multiplying two polynomials without precomputation, but thus it's slower", "# Pre-allocate the result array", "r", "=", "bytearray", "(", "len", "(", "p", ")", "+", "len", "(", "q", ")"...
Multiply two polynomials, inside Galois Field
[ "Multiply", "two", "polynomials", "inside", "Galois", "Field" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/reedsolomon/reedsolo.py#L332-L340
lrq3000/pyFileFixity
pyFileFixity/lib/reedsolomon/reedsolo.py
gf_poly_div
def gf_poly_div(dividend, divisor): '''Fast polynomial division by using Extended Synthetic Division and optimized for GF(2^p) computations (doesn't work with standard polynomials outside of this galois field).''' # CAUTION: this function expects polynomials to follow the opposite convention at decoding: the te...
python
def gf_poly_div(dividend, divisor): '''Fast polynomial division by using Extended Synthetic Division and optimized for GF(2^p) computations (doesn't work with standard polynomials outside of this galois field).''' # CAUTION: this function expects polynomials to follow the opposite convention at decoding: the te...
[ "def", "gf_poly_div", "(", "dividend", ",", "divisor", ")", ":", "# CAUTION: this function expects polynomials to follow the opposite convention at decoding: the terms must go from the biggest to lowest degree (while most other functions here expect a list from lowest to biggest degree). eg: 1 + 2x ...
Fast polynomial division by using Extended Synthetic Division and optimized for GF(2^p) computations (doesn't work with standard polynomials outside of this galois field).
[ "Fast", "polynomial", "division", "by", "using", "Extended", "Synthetic", "Division", "and", "optimized", "for", "GF", "(", "2^p", ")", "computations", "(", "doesn", "t", "work", "with", "standard", "polynomials", "outside", "of", "this", "galois", "field", ")...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/reedsolomon/reedsolo.py#L346-L362
lrq3000/pyFileFixity
pyFileFixity/lib/reedsolomon/reedsolo.py
gf_poly_square
def gf_poly_square(poly): '''Linear time implementation of polynomial squaring. For details, see paper: "A fast software implementation for arithmetic operations in GF (2n)". De Win, E., Bosselaers, A., Vandenberghe, S., De Gersem, P., & Vandewalle, J. (1996, January). In Advances in Cryptology - Asiacrypt'96 (pp. ...
python
def gf_poly_square(poly): '''Linear time implementation of polynomial squaring. For details, see paper: "A fast software implementation for arithmetic operations in GF (2n)". De Win, E., Bosselaers, A., Vandenberghe, S., De Gersem, P., & Vandewalle, J. (1996, January). In Advances in Cryptology - Asiacrypt'96 (pp. ...
[ "def", "gf_poly_square", "(", "poly", ")", ":", "length", "=", "len", "(", "poly", ")", "out", "=", "bytearray", "(", "2", "*", "length", "-", "1", ")", "for", "i", "in", "xrange", "(", "length", "-", "1", ")", ":", "p", "=", "poly", "[", "i", ...
Linear time implementation of polynomial squaring. For details, see paper: "A fast software implementation for arithmetic operations in GF (2n)". De Win, E., Bosselaers, A., Vandenberghe, S., De Gersem, P., & Vandewalle, J. (1996, January). In Advances in Cryptology - Asiacrypt'96 (pp. 65-76). Springer Berlin Heidelber...
[ "Linear", "time", "implementation", "of", "polynomial", "squaring", ".", "For", "details", "see", "paper", ":", "A", "fast", "software", "implementation", "for", "arithmetic", "operations", "in", "GF", "(", "2n", ")", ".", "De", "Win", "E", ".", "Bosselaers"...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/reedsolomon/reedsolo.py#L364-L378
lrq3000/pyFileFixity
pyFileFixity/lib/reedsolomon/reedsolo.py
gf_poly_eval
def gf_poly_eval(poly, x): '''Evaluates a polynomial in GF(2^p) given the value for x. This is based on Horner's scheme for maximum efficiency.''' y = poly[0] for i in xrange(1, len(poly)): y = gf_mul(y, x) ^ poly[i] return y
python
def gf_poly_eval(poly, x): '''Evaluates a polynomial in GF(2^p) given the value for x. This is based on Horner's scheme for maximum efficiency.''' y = poly[0] for i in xrange(1, len(poly)): y = gf_mul(y, x) ^ poly[i] return y
[ "def", "gf_poly_eval", "(", "poly", ",", "x", ")", ":", "y", "=", "poly", "[", "0", "]", "for", "i", "in", "xrange", "(", "1", ",", "len", "(", "poly", ")", ")", ":", "y", "=", "gf_mul", "(", "y", ",", "x", ")", "^", "poly", "[", "i", "]"...
Evaluates a polynomial in GF(2^p) given the value for x. This is based on Horner's scheme for maximum efficiency.
[ "Evaluates", "a", "polynomial", "in", "GF", "(", "2^p", ")", "given", "the", "value", "for", "x", ".", "This", "is", "based", "on", "Horner", "s", "scheme", "for", "maximum", "efficiency", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/reedsolomon/reedsolo.py#L380-L385
lrq3000/pyFileFixity
pyFileFixity/lib/reedsolomon/reedsolo.py
rs_generator_poly
def rs_generator_poly(nsym, fcr=0, generator=2): '''Generate an irreducible generator polynomial (necessary to encode a message into Reed-Solomon)''' g = bytearray([1]) for i in xrange(nsym): g = gf_poly_mul(g, [1, gf_pow(generator, i+fcr)]) return g
python
def rs_generator_poly(nsym, fcr=0, generator=2): '''Generate an irreducible generator polynomial (necessary to encode a message into Reed-Solomon)''' g = bytearray([1]) for i in xrange(nsym): g = gf_poly_mul(g, [1, gf_pow(generator, i+fcr)]) return g
[ "def", "rs_generator_poly", "(", "nsym", ",", "fcr", "=", "0", ",", "generator", "=", "2", ")", ":", "g", "=", "bytearray", "(", "[", "1", "]", ")", "for", "i", "in", "xrange", "(", "nsym", ")", ":", "g", "=", "gf_poly_mul", "(", "g", ",", "[",...
Generate an irreducible generator polynomial (necessary to encode a message into Reed-Solomon)
[ "Generate", "an", "irreducible", "generator", "polynomial", "(", "necessary", "to", "encode", "a", "message", "into", "Reed", "-", "Solomon", ")" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/reedsolomon/reedsolo.py#L390-L395
lrq3000/pyFileFixity
pyFileFixity/lib/reedsolomon/reedsolo.py
rs_generator_poly_all
def rs_generator_poly_all(max_nsym, fcr=0, generator=2): '''Generate all irreducible generator polynomials up to max_nsym (usually you can use n, the length of the message+ecc). Very useful to reduce processing time if you want to encode using variable schemes and nsym rates.''' g_all = {} g_all[0] = g_all[...
python
def rs_generator_poly_all(max_nsym, fcr=0, generator=2): '''Generate all irreducible generator polynomials up to max_nsym (usually you can use n, the length of the message+ecc). Very useful to reduce processing time if you want to encode using variable schemes and nsym rates.''' g_all = {} g_all[0] = g_all[...
[ "def", "rs_generator_poly_all", "(", "max_nsym", ",", "fcr", "=", "0", ",", "generator", "=", "2", ")", ":", "g_all", "=", "{", "}", "g_all", "[", "0", "]", "=", "g_all", "[", "1", "]", "=", "[", "1", "]", "for", "nsym", "in", "xrange", "(", "m...
Generate all irreducible generator polynomials up to max_nsym (usually you can use n, the length of the message+ecc). Very useful to reduce processing time if you want to encode using variable schemes and nsym rates.
[ "Generate", "all", "irreducible", "generator", "polynomials", "up", "to", "max_nsym", "(", "usually", "you", "can", "use", "n", "the", "length", "of", "the", "message", "+", "ecc", ")", ".", "Very", "useful", "to", "reduce", "processing", "time", "if", "yo...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/reedsolomon/reedsolo.py#L397-L403
lrq3000/pyFileFixity
pyFileFixity/lib/reedsolomon/reedsolo.py
rs_simple_encode_msg
def rs_simple_encode_msg(msg_in, nsym, fcr=0, generator=2, gen=None): '''Simple Reed-Solomon encoding (mainly an example for you to understand how it works, because it's slower than the inlined function below)''' global field_charac if (len(msg_in) + nsym) > field_charac: raise ValueError("Message is too lo...
python
def rs_simple_encode_msg(msg_in, nsym, fcr=0, generator=2, gen=None): '''Simple Reed-Solomon encoding (mainly an example for you to understand how it works, because it's slower than the inlined function below)''' global field_charac if (len(msg_in) + nsym) > field_charac: raise ValueError("Message is too lo...
[ "def", "rs_simple_encode_msg", "(", "msg_in", ",", "nsym", ",", "fcr", "=", "0", ",", "generator", "=", "2", ",", "gen", "=", "None", ")", ":", "global", "field_charac", "if", "(", "len", "(", "msg_in", ")", "+", "nsym", ")", ">", "field_charac", ":"...
Simple Reed-Solomon encoding (mainly an example for you to understand how it works, because it's slower than the inlined function below)
[ "Simple", "Reed", "-", "Solomon", "encoding", "(", "mainly", "an", "example", "for", "you", "to", "understand", "how", "it", "works", "because", "it", "s", "slower", "than", "the", "inlined", "function", "below", ")" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/reedsolomon/reedsolo.py#L405-L416
lrq3000/pyFileFixity
pyFileFixity/lib/reedsolomon/reedsolo.py
rs_encode_msg
def rs_encode_msg(msg_in, nsym, fcr=0, generator=2, gen=None): '''Reed-Solomon main encoding function, using polynomial division (Extended Synthetic Division, the fastest algorithm available to my knowledge), better explained at http://research.swtch.com/field''' global field_charac if (len(msg_in) + nsym) ...
python
def rs_encode_msg(msg_in, nsym, fcr=0, generator=2, gen=None): '''Reed-Solomon main encoding function, using polynomial division (Extended Synthetic Division, the fastest algorithm available to my knowledge), better explained at http://research.swtch.com/field''' global field_charac if (len(msg_in) + nsym) ...
[ "def", "rs_encode_msg", "(", "msg_in", ",", "nsym", ",", "fcr", "=", "0", ",", "generator", "=", "2", ",", "gen", "=", "None", ")", ":", "global", "field_charac", "if", "(", "len", "(", "msg_in", ")", "+", "nsym", ")", ">", "field_charac", ":", "ra...
Reed-Solomon main encoding function, using polynomial division (Extended Synthetic Division, the fastest algorithm available to my knowledge), better explained at http://research.swtch.com/field
[ "Reed", "-", "Solomon", "main", "encoding", "function", "using", "polynomial", "division", "(", "Extended", "Synthetic", "Division", "the", "fastest", "algorithm", "available", "to", "my", "knowledge", ")", "better", "explained", "at", "http", ":", "//", "resear...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/reedsolomon/reedsolo.py#L418-L444
lrq3000/pyFileFixity
pyFileFixity/lib/reedsolomon/reedsolo.py
rs_calc_syndromes
def rs_calc_syndromes(msg, nsym, fcr=0, generator=2): '''Given the received codeword msg and the number of error correcting symbols (nsym), computes the syndromes polynomial. Mathematically, it's essentially equivalent to a Fourrier Transform (Chien search being the inverse). ''' # Note the "[0] +" : we...
python
def rs_calc_syndromes(msg, nsym, fcr=0, generator=2): '''Given the received codeword msg and the number of error correcting symbols (nsym), computes the syndromes polynomial. Mathematically, it's essentially equivalent to a Fourrier Transform (Chien search being the inverse). ''' # Note the "[0] +" : we...
[ "def", "rs_calc_syndromes", "(", "msg", ",", "nsym", ",", "fcr", "=", "0", ",", "generator", "=", "2", ")", ":", "# Note the \"[0] +\" : we add a 0 coefficient for the lowest degree (the constant). This effectively shifts the syndrome, and will shift every computations depending on t...
Given the received codeword msg and the number of error correcting symbols (nsym), computes the syndromes polynomial. Mathematically, it's essentially equivalent to a Fourrier Transform (Chien search being the inverse).
[ "Given", "the", "received", "codeword", "msg", "and", "the", "number", "of", "error", "correcting", "symbols", "(", "nsym", ")", "computes", "the", "syndromes", "polynomial", ".", "Mathematically", "it", "s", "essentially", "equivalent", "to", "a", "Fourrier", ...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/reedsolomon/reedsolo.py#L449-L455
lrq3000/pyFileFixity
pyFileFixity/lib/reedsolomon/reedsolo.py
rs_correct_errata
def rs_correct_errata(msg_in, synd, err_pos, fcr=0, generator=2): # err_pos is a list of the positions of the errors/erasures/errata '''Forney algorithm, computes the values (error magnitude) to correct the input message.''' global field_charac msg = bytearray(msg_in) # calculate errata locator polynomi...
python
def rs_correct_errata(msg_in, synd, err_pos, fcr=0, generator=2): # err_pos is a list of the positions of the errors/erasures/errata '''Forney algorithm, computes the values (error magnitude) to correct the input message.''' global field_charac msg = bytearray(msg_in) # calculate errata locator polynomi...
[ "def", "rs_correct_errata", "(", "msg_in", ",", "synd", ",", "err_pos", ",", "fcr", "=", "0", ",", "generator", "=", "2", ")", ":", "# err_pos is a list of the positions of the errors/erasures/errata", "global", "field_charac", "msg", "=", "bytearray", "(", "msg_in"...
Forney algorithm, computes the values (error magnitude) to correct the input message.
[ "Forney", "algorithm", "computes", "the", "values", "(", "error", "magnitude", ")", "to", "correct", "the", "input", "message", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/reedsolomon/reedsolo.py#L457-L505
lrq3000/pyFileFixity
pyFileFixity/lib/reedsolomon/reedsolo.py
rs_find_error_locator
def rs_find_error_locator(synd, nsym, erase_loc=None, erase_count=0): '''Find error/errata locator and evaluator polynomials with Berlekamp-Massey algorithm''' # The idea is that BM will iteratively estimate the error locator polynomial. # To do this, it will compute a Discrepancy term called Delta, which w...
python
def rs_find_error_locator(synd, nsym, erase_loc=None, erase_count=0): '''Find error/errata locator and evaluator polynomials with Berlekamp-Massey algorithm''' # The idea is that BM will iteratively estimate the error locator polynomial. # To do this, it will compute a Discrepancy term called Delta, which w...
[ "def", "rs_find_error_locator", "(", "synd", ",", "nsym", ",", "erase_loc", "=", "None", ",", "erase_count", "=", "0", ")", ":", "# The idea is that BM will iteratively estimate the error locator polynomial.", "# To do this, it will compute a Discrepancy term called Delta, which wi...
Find error/errata locator and evaluator polynomials with Berlekamp-Massey algorithm
[ "Find", "error", "/", "errata", "locator", "and", "evaluator", "polynomials", "with", "Berlekamp", "-", "Massey", "algorithm" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/reedsolomon/reedsolo.py#L507-L566
lrq3000/pyFileFixity
pyFileFixity/lib/reedsolomon/reedsolo.py
rs_find_errata_locator
def rs_find_errata_locator(e_pos, generator=2): '''Compute the erasures/errors/errata locator polynomial from the erasures/errors/errata positions (the positions must be relative to the x coefficient, eg: "hello worldxxxxxxxxx" is tampered to "h_ll_ worldxxxxxxxxx" with xxxxxxxxx being the ecc of length n-k=9, here...
python
def rs_find_errata_locator(e_pos, generator=2): '''Compute the erasures/errors/errata locator polynomial from the erasures/errors/errata positions (the positions must be relative to the x coefficient, eg: "hello worldxxxxxxxxx" is tampered to "h_ll_ worldxxxxxxxxx" with xxxxxxxxx being the ecc of length n-k=9, here...
[ "def", "rs_find_errata_locator", "(", "e_pos", ",", "generator", "=", "2", ")", ":", "# See: http://ocw.usu.edu/Electrical_and_Computer_Engineering/Error_Control_Coding/lecture7.pdf and Blahut, Richard E. \"Transform techniques for error control codes.\" IBM Journal of Research and development 2...
Compute the erasures/errors/errata locator polynomial from the erasures/errors/errata positions (the positions must be relative to the x coefficient, eg: "hello worldxxxxxxxxx" is tampered to "h_ll_ worldxxxxxxxxx" with xxxxxxxxx being the ecc of length n-k=9, here the string positions are [1, 4], but the coefficients ...
[ "Compute", "the", "erasures", "/", "errors", "/", "errata", "locator", "polynomial", "from", "the", "erasures", "/", "errors", "/", "errata", "positions", "(", "the", "positions", "must", "be", "relative", "to", "the", "x", "coefficient", "eg", ":", "hello",...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/reedsolomon/reedsolo.py#L568-L575
lrq3000/pyFileFixity
pyFileFixity/lib/reedsolomon/reedsolo.py
rs_find_error_evaluator
def rs_find_error_evaluator(synd, err_loc, nsym): '''Compute the error (or erasures if you supply sigma=erasures locator polynomial, or errata) evaluator polynomial Omega from the syndrome and the error/erasures/errata locator Sigma. Omega is already computed at the same time as Sigma inside the Berlekamp-Massey im...
python
def rs_find_error_evaluator(synd, err_loc, nsym): '''Compute the error (or erasures if you supply sigma=erasures locator polynomial, or errata) evaluator polynomial Omega from the syndrome and the error/erasures/errata locator Sigma. Omega is already computed at the same time as Sigma inside the Berlekamp-Massey im...
[ "def", "rs_find_error_evaluator", "(", "synd", ",", "err_loc", ",", "nsym", ")", ":", "# Omega(x) = [ Synd(x) * Error_loc(x) ] mod x^(n-k+1)", "_", ",", "remainder", "=", "gf_poly_div", "(", "gf_poly_mul", "(", "synd", ",", "err_loc", ")", ",", "(", "[", "1", "]...
Compute the error (or erasures if you supply sigma=erasures locator polynomial, or errata) evaluator polynomial Omega from the syndrome and the error/erasures/errata locator Sigma. Omega is already computed at the same time as Sigma inside the Berlekamp-Massey implemented above, but in case you modify Sigma, you can re...
[ "Compute", "the", "error", "(", "or", "erasures", "if", "you", "supply", "sigma", "=", "erasures", "locator", "polynomial", "or", "errata", ")", "evaluator", "polynomial", "Omega", "from", "the", "syndrome", "and", "the", "error", "/", "erasures", "/", "erra...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/reedsolomon/reedsolo.py#L577-L586
lrq3000/pyFileFixity
pyFileFixity/lib/reedsolomon/reedsolo.py
rs_find_errors
def rs_find_errors(err_loc, nmess, generator=2): '''Find the roots (ie, where evaluation = zero) of error polynomial by bruteforce trial, this is a sort of Chien's search (but less efficient, Chien's search is a way to evaluate the polynomial such that each evaluation only takes constant time).''' # nmess = len...
python
def rs_find_errors(err_loc, nmess, generator=2): '''Find the roots (ie, where evaluation = zero) of error polynomial by bruteforce trial, this is a sort of Chien's search (but less efficient, Chien's search is a way to evaluate the polynomial such that each evaluation only takes constant time).''' # nmess = len...
[ "def", "rs_find_errors", "(", "err_loc", ",", "nmess", ",", "generator", "=", "2", ")", ":", "# nmess = length of whole codeword (message + ecc symbols)", "errs", "=", "len", "(", "err_loc", ")", "-", "1", "err_pos", "=", "[", "]", "for", "i", "in", "xrange", ...
Find the roots (ie, where evaluation = zero) of error polynomial by bruteforce trial, this is a sort of Chien's search (but less efficient, Chien's search is a way to evaluate the polynomial such that each evaluation only takes constant time).
[ "Find", "the", "roots", "(", "ie", "where", "evaluation", "=", "zero", ")", "of", "error", "polynomial", "by", "bruteforce", "trial", "this", "is", "a", "sort", "of", "Chien", "s", "search", "(", "but", "less", "efficient", "Chien", "s", "search", "is", ...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/reedsolomon/reedsolo.py#L588-L600
lrq3000/pyFileFixity
pyFileFixity/lib/reedsolomon/reedsolo.py
rs_correct_msg
def rs_correct_msg(msg_in, nsym, fcr=0, generator=2, erase_pos=None, only_erasures=False): '''Reed-Solomon main decoding function''' global field_charac if len(msg_in) > field_charac: # Note that it is in fact possible to encode/decode messages that are longer than field_charac, but because this wil...
python
def rs_correct_msg(msg_in, nsym, fcr=0, generator=2, erase_pos=None, only_erasures=False): '''Reed-Solomon main decoding function''' global field_charac if len(msg_in) > field_charac: # Note that it is in fact possible to encode/decode messages that are longer than field_charac, but because this wil...
[ "def", "rs_correct_msg", "(", "msg_in", ",", "nsym", ",", "fcr", "=", "0", ",", "generator", "=", "2", ",", "erase_pos", "=", "None", ",", "only_erasures", "=", "False", ")", ":", "global", "field_charac", "if", "len", "(", "msg_in", ")", ">", "field_c...
Reed-Solomon main decoding function
[ "Reed", "-", "Solomon", "main", "decoding", "function" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/reedsolomon/reedsolo.py#L622-L665
lrq3000/pyFileFixity
pyFileFixity/lib/reedsolomon/reedsolo.py
rs_correct_msg_nofsynd
def rs_correct_msg_nofsynd(msg_in, nsym, fcr=0, generator=2, erase_pos=None, only_erasures=False): '''Reed-Solomon main decoding function, without using the modified Forney syndromes''' global field_charac if len(msg_in) > field_charac: raise ValueError("Message is too long (%i when max is %i)" % (l...
python
def rs_correct_msg_nofsynd(msg_in, nsym, fcr=0, generator=2, erase_pos=None, only_erasures=False): '''Reed-Solomon main decoding function, without using the modified Forney syndromes''' global field_charac if len(msg_in) > field_charac: raise ValueError("Message is too long (%i when max is %i)" % (l...
[ "def", "rs_correct_msg_nofsynd", "(", "msg_in", ",", "nsym", ",", "fcr", "=", "0", ",", "generator", "=", "2", ",", "erase_pos", "=", "None", ",", "only_erasures", "=", "False", ")", ":", "global", "field_charac", "if", "len", "(", "msg_in", ")", ">", ...
Reed-Solomon main decoding function, without using the modified Forney syndromes
[ "Reed", "-", "Solomon", "main", "decoding", "function", "without", "using", "the", "modified", "Forney", "syndromes" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/reedsolomon/reedsolo.py#L667-L719
lrq3000/pyFileFixity
pyFileFixity/lib/reedsolomon/reedsolo.py
rs_check
def rs_check(msg, nsym, fcr=0, generator=2): '''Returns true if the message + ecc has no error of false otherwise (may not always catch a wrong decoding or a wrong message, particularly if there are too many errors -- above the Singleton bound --, but it usually does)''' return ( max(rs_calc_syndromes(msg, nsym...
python
def rs_check(msg, nsym, fcr=0, generator=2): '''Returns true if the message + ecc has no error of false otherwise (may not always catch a wrong decoding or a wrong message, particularly if there are too many errors -- above the Singleton bound --, but it usually does)''' return ( max(rs_calc_syndromes(msg, nsym...
[ "def", "rs_check", "(", "msg", ",", "nsym", ",", "fcr", "=", "0", ",", "generator", "=", "2", ")", ":", "return", "(", "max", "(", "rs_calc_syndromes", "(", "msg", ",", "nsym", ",", "fcr", ",", "generator", ")", ")", "==", "0", ")" ]
Returns true if the message + ecc has no error of false otherwise (may not always catch a wrong decoding or a wrong message, particularly if there are too many errors -- above the Singleton bound --, but it usually does)
[ "Returns", "true", "if", "the", "message", "+", "ecc", "has", "no", "error", "of", "false", "otherwise", "(", "may", "not", "always", "catch", "a", "wrong", "decoding", "or", "a", "wrong", "message", "particularly", "if", "there", "are", "too", "many", "...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/reedsolomon/reedsolo.py#L721-L723
lrq3000/pyFileFixity
pyFileFixity/lib/reedsolomon/reedsolo.py
RSCodec.encode
def encode(self, data): '''Encode a message (ie, add the ecc symbols) using Reed-Solomon, whatever the length of the message because we use chunking''' if isinstance(data, str): data = bytearray(data, "latin-1") chunk_size = self.nsize - self.nsym enc = bytearray() fo...
python
def encode(self, data): '''Encode a message (ie, add the ecc symbols) using Reed-Solomon, whatever the length of the message because we use chunking''' if isinstance(data, str): data = bytearray(data, "latin-1") chunk_size = self.nsize - self.nsym enc = bytearray() fo...
[ "def", "encode", "(", "self", ",", "data", ")", ":", "if", "isinstance", "(", "data", ",", "str", ")", ":", "data", "=", "bytearray", "(", "data", ",", "\"latin-1\"", ")", "chunk_size", "=", "self", ".", "nsize", "-", "self", ".", "nsym", "enc", "=...
Encode a message (ie, add the ecc symbols) using Reed-Solomon, whatever the length of the message because we use chunking
[ "Encode", "a", "message", "(", "ie", "add", "the", "ecc", "symbols", ")", "using", "Reed", "-", "Solomon", "whatever", "the", "length", "of", "the", "message", "because", "we", "use", "chunking" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/reedsolomon/reedsolo.py#L758-L767
lrq3000/pyFileFixity
pyFileFixity/lib/reedsolomon/reedsolo.py
RSCodec.decode
def decode(self, data, erase_pos=None, only_erasures=False): '''Repair a message, whatever its size is, by using chunking''' # erase_pos is a list of positions where you know (or greatly suspect at least) there is an erasure (ie, wrong character but you know it's at this position). Just input the list o...
python
def decode(self, data, erase_pos=None, only_erasures=False): '''Repair a message, whatever its size is, by using chunking''' # erase_pos is a list of positions where you know (or greatly suspect at least) there is an erasure (ie, wrong character but you know it's at this position). Just input the list o...
[ "def", "decode", "(", "self", ",", "data", ",", "erase_pos", "=", "None", ",", "only_erasures", "=", "False", ")", ":", "# erase_pos is a list of positions where you know (or greatly suspect at least) there is an erasure (ie, wrong character but you know it's at this position). Just ...
Repair a message, whatever its size is, by using chunking
[ "Repair", "a", "message", "whatever", "its", "size", "is", "by", "using", "chunking" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/reedsolomon/reedsolo.py#L769-L787
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/meliaeloader.py
recurse
def recurse( record, index, stop_types=STOP_TYPES,already_seen=None, type_group=False ): """Depth first traversal of a tree, all children are yielded before parent record -- dictionary record to be recursed upon index -- mapping 'address' ids to dictionary records stop_types -- types which will *...
python
def recurse( record, index, stop_types=STOP_TYPES,already_seen=None, type_group=False ): """Depth first traversal of a tree, all children are yielded before parent record -- dictionary record to be recursed upon index -- mapping 'address' ids to dictionary records stop_types -- types which will *...
[ "def", "recurse", "(", "record", ",", "index", ",", "stop_types", "=", "STOP_TYPES", ",", "already_seen", "=", "None", ",", "type_group", "=", "False", ")", ":", "if", "already_seen", "is", "None", ":", "already_seen", "=", "set", "(", ")", "if", "record...
Depth first traversal of a tree, all children are yielded before parent record -- dictionary record to be recursed upon index -- mapping 'address' ids to dictionary records stop_types -- types which will *not* recurse already_seen -- set storing already-visited nodes yields the travers...
[ "Depth", "first", "traversal", "of", "a", "tree", "all", "children", "are", "yielded", "before", "parent", "record", "--", "dictionary", "record", "to", "be", "recursed", "upon", "index", "--", "mapping", "address", "ids", "to", "dictionary", "records", "stop_...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/meliaeloader.py#L33-L55
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/meliaeloader.py
find_loops
def find_loops( record, index, stop_types = STOP_TYPES, open=None, seen = None ): """Find all loops within the index and replace with loop records""" if open is None: open = [] if seen is None: seen = set() for child in children( record, index, stop_types = stop_types ): if child...
python
def find_loops( record, index, stop_types = STOP_TYPES, open=None, seen = None ): """Find all loops within the index and replace with loop records""" if open is None: open = [] if seen is None: seen = set() for child in children( record, index, stop_types = stop_types ): if child...
[ "def", "find_loops", "(", "record", ",", "index", ",", "stop_types", "=", "STOP_TYPES", ",", "open", "=", "None", ",", "seen", "=", "None", ")", ":", "if", "open", "is", "None", ":", "open", "=", "[", "]", "if", "seen", "is", "None", ":", "seen", ...
Find all loops within the index and replace with loop records
[ "Find", "all", "loops", "within", "the", "index", "and", "replace", "with", "loop", "records" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/meliaeloader.py#L57-L80
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/meliaeloader.py
promote_loops
def promote_loops( loops, index, shared ): """Turn loops into "objects" that can be processed normally""" for loop in loops: loop = list(loop) members = [index[addr] for addr in loop] external_parents = list(set([ addr for addr in sum([shared.get(addr,[]) for addr in loop],[]...
python
def promote_loops( loops, index, shared ): """Turn loops into "objects" that can be processed normally""" for loop in loops: loop = list(loop) members = [index[addr] for addr in loop] external_parents = list(set([ addr for addr in sum([shared.get(addr,[]) for addr in loop],[]...
[ "def", "promote_loops", "(", "loops", ",", "index", ",", "shared", ")", ":", "for", "loop", "in", "loops", ":", "loop", "=", "list", "(", "loop", ")", "members", "=", "[", "index", "[", "addr", "]", "for", "addr", "in", "loop", "]", "external_parents...
Turn loops into "objects" that can be processed normally
[ "Turn", "loops", "into", "objects", "that", "can", "be", "processed", "normally" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/meliaeloader.py#L82-L120
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/meliaeloader.py
children
def children( record, index, key='refs', stop_types=STOP_TYPES ): """Retrieve children records for given record""" result = [] for ref in record.get( key,[]): try: record = index[ref] except KeyError, err: #print 'No record for %s address %s in %s'%(key, ref, record['...
python
def children( record, index, key='refs', stop_types=STOP_TYPES ): """Retrieve children records for given record""" result = [] for ref in record.get( key,[]): try: record = index[ref] except KeyError, err: #print 'No record for %s address %s in %s'%(key, ref, record['...
[ "def", "children", "(", "record", ",", "index", ",", "key", "=", "'refs'", ",", "stop_types", "=", "STOP_TYPES", ")", ":", "result", "=", "[", "]", "for", "ref", "in", "record", ".", "get", "(", "key", ",", "[", "]", ")", ":", "try", ":", "record...
Retrieve children records for given record
[ "Retrieve", "children", "records", "for", "given", "record" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/meliaeloader.py#L122-L134
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/meliaeloader.py
children_types
def children_types( record, index, key='refs', stop_types=STOP_TYPES ): """Produce dictionary mapping type-key to instances for all children""" types = {} for child in children( record, index, key, stop_types=stop_types ): types.setdefault(child['type'],[]).append( child ) return types
python
def children_types( record, index, key='refs', stop_types=STOP_TYPES ): """Produce dictionary mapping type-key to instances for all children""" types = {} for child in children( record, index, key, stop_types=stop_types ): types.setdefault(child['type'],[]).append( child ) return types
[ "def", "children_types", "(", "record", ",", "index", ",", "key", "=", "'refs'", ",", "stop_types", "=", "STOP_TYPES", ")", ":", "types", "=", "{", "}", "for", "child", "in", "children", "(", "record", ",", "index", ",", "key", ",", "stop_types", "=", ...
Produce dictionary mapping type-key to instances for all children
[ "Produce", "dictionary", "mapping", "type", "-", "key", "to", "instances", "for", "all", "children" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/meliaeloader.py#L136-L141
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/meliaeloader.py
recurse_module
def recurse_module( overall_record, index, shared, stop_types=STOP_TYPES, already_seen=None, min_size=0 ): """Creates a has-a recursive-cost hierarchy Mutates objects in-place to produce a hierarchy of memory usage based on reference-holding cost assignment """ for record in recurse( ...
python
def recurse_module( overall_record, index, shared, stop_types=STOP_TYPES, already_seen=None, min_size=0 ): """Creates a has-a recursive-cost hierarchy Mutates objects in-place to produce a hierarchy of memory usage based on reference-holding cost assignment """ for record in recurse( ...
[ "def", "recurse_module", "(", "overall_record", ",", "index", ",", "shared", ",", "stop_types", "=", "STOP_TYPES", ",", "already_seen", "=", "None", ",", "min_size", "=", "0", ")", ":", "for", "record", "in", "recurse", "(", "overall_record", ",", "index", ...
Creates a has-a recursive-cost hierarchy Mutates objects in-place to produce a hierarchy of memory usage based on reference-holding cost assignment
[ "Creates", "a", "has", "-", "a", "recursive", "-", "cost", "hierarchy", "Mutates", "objects", "in", "-", "place", "to", "produce", "a", "hierarchy", "of", "memory", "usage", "based", "on", "reference", "-", "holding", "cost", "assignment" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/meliaeloader.py#L144-L175
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/meliaeloader.py
rewrite_refs
def rewrite_refs( targets, old,new, index, key='refs', single_ref=False ): """Rewrite key in all targets (from index if necessary) to replace old with new""" for parent in targets: if not isinstance( parent, dict ): try: parent = index[parent] except KeyError, err...
python
def rewrite_refs( targets, old,new, index, key='refs', single_ref=False ): """Rewrite key in all targets (from index if necessary) to replace old with new""" for parent in targets: if not isinstance( parent, dict ): try: parent = index[parent] except KeyError, err...
[ "def", "rewrite_refs", "(", "targets", ",", "old", ",", "new", ",", "index", ",", "key", "=", "'refs'", ",", "single_ref", "=", "False", ")", ":", "for", "parent", "in", "targets", ":", "if", "not", "isinstance", "(", "parent", ",", "dict", ")", ":",...
Rewrite key in all targets (from index if necessary) to replace old with new
[ "Rewrite", "key", "in", "all", "targets", "(", "from", "index", "if", "necessary", ")", "to", "replace", "old", "with", "new" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/meliaeloader.py#L183-L191
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/meliaeloader.py
rewrite_references
def rewrite_references( sequence, old, new, single_ref=False ): """Rewrite parents to point to new in old sequence -- sequence of id references old -- old id new -- new id returns rewritten sequence """ old,new = as_id(old),as_id(new) to_delete = [] for i,n in enumerate(s...
python
def rewrite_references( sequence, old, new, single_ref=False ): """Rewrite parents to point to new in old sequence -- sequence of id references old -- old id new -- new id returns rewritten sequence """ old,new = as_id(old),as_id(new) to_delete = [] for i,n in enumerate(s...
[ "def", "rewrite_references", "(", "sequence", ",", "old", ",", "new", ",", "single_ref", "=", "False", ")", ":", "old", ",", "new", "=", "as_id", "(", "old", ")", ",", "as_id", "(", "new", ")", "to_delete", "=", "[", "]", "for", "i", ",", "n", "i...
Rewrite parents to point to new in old sequence -- sequence of id references old -- old id new -- new id returns rewritten sequence
[ "Rewrite", "parents", "to", "point", "to", "new", "in", "old", "sequence", "--", "sequence", "of", "id", "references", "old", "--", "old", "id", "new", "--", "new", "id", "returns", "rewritten", "sequence" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/meliaeloader.py#L193-L218
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/meliaeloader.py
simple
def simple( child, shared, parent ): """Return sub-set of children who are "simple" in the sense of group_children""" return ( not child.get('refs',()) and ( not shared.get(child['address']) or shared.get(child['address']) == [parent['address']] ) )
python
def simple( child, shared, parent ): """Return sub-set of children who are "simple" in the sense of group_children""" return ( not child.get('refs',()) and ( not shared.get(child['address']) or shared.get(child['address']) == [parent['address']] ) )
[ "def", "simple", "(", "child", ",", "shared", ",", "parent", ")", ":", "return", "(", "not", "child", ".", "get", "(", "'refs'", ",", "(", ")", ")", "and", "(", "not", "shared", ".", "get", "(", "child", "[", "'address'", "]", ")", "or", "shared"...
Return sub-set of children who are "simple" in the sense of group_children
[ "Return", "sub", "-", "set", "of", "children", "who", "are", "simple", "in", "the", "sense", "of", "group_children" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/meliaeloader.py#L220-L229
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/meliaeloader.py
group_children
def group_children( index, shared, min_kids=10, stop_types=STOP_TYPES, delete_children=True ): """Collect like-type children into sub-groups of objects for objects with long children-lists Only group if: * there are more than X children of type Y * children are "simple" * i...
python
def group_children( index, shared, min_kids=10, stop_types=STOP_TYPES, delete_children=True ): """Collect like-type children into sub-groups of objects for objects with long children-lists Only group if: * there are more than X children of type Y * children are "simple" * i...
[ "def", "group_children", "(", "index", ",", "shared", ",", "min_kids", "=", "10", ",", "stop_types", "=", "STOP_TYPES", ",", "delete_children", "=", "True", ")", ":", "to_compress", "=", "[", "]", "for", "to_simplify", "in", "list", "(", "iterindex", "(", ...
Collect like-type children into sub-groups of objects for objects with long children-lists Only group if: * there are more than X children of type Y * children are "simple" * individual children have no children themselves * individual children have no other parents...
[ "Collect", "like", "-", "type", "children", "into", "sub", "-", "groups", "of", "objects", "for", "objects", "with", "long", "children", "-", "lists", "Only", "group", "if", ":", "*", "there", "are", "more", "than", "X", "children", "of", "type", "Y", ...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/meliaeloader.py#L231-L278
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/meliaeloader.py
simplify_dicts
def simplify_dicts( index, shared, simplify_dicts=SIMPLIFY_DICTS, always_compress=ALWAYS_COMPRESS_DICTS ): """Eliminate "noise" dictionary records from the index index -- overall index of objects (including metadata such as type records) shared -- parent-count mapping for records in index mod...
python
def simplify_dicts( index, shared, simplify_dicts=SIMPLIFY_DICTS, always_compress=ALWAYS_COMPRESS_DICTS ): """Eliminate "noise" dictionary records from the index index -- overall index of objects (including metadata such as type records) shared -- parent-count mapping for records in index mod...
[ "def", "simplify_dicts", "(", "index", ",", "shared", ",", "simplify_dicts", "=", "SIMPLIFY_DICTS", ",", "always_compress", "=", "ALWAYS_COMPRESS_DICTS", ")", ":", "# things which will have their dictionaries compressed out", "to_delete", "=", "set", "(", ")", "for", "t...
Eliminate "noise" dictionary records from the index index -- overall index of objects (including metadata such as type records) shared -- parent-count mapping for records in index module/type/class dictionaries
[ "Eliminate", "noise", "dictionary", "records", "from", "the", "index", "index", "--", "overall", "index", "of", "objects", "(", "including", "metadata", "such", "as", "type", "records", ")", "shared", "--", "parent", "-", "count", "mapping", "for", "records", ...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/meliaeloader.py#L289-L345
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/meliaeloader.py
find_reachable
def find_reachable( modules, index, shared, stop_types=STOP_TYPES ): """Find the set of all reachable objects from given root nodes (modules)""" reachable = set() already_seen = set() for module in modules: for child in recurse( module, index, stop_types=stop_types, already_seen=already_seen): ...
python
def find_reachable( modules, index, shared, stop_types=STOP_TYPES ): """Find the set of all reachable objects from given root nodes (modules)""" reachable = set() already_seen = set() for module in modules: for child in recurse( module, index, stop_types=stop_types, already_seen=already_seen): ...
[ "def", "find_reachable", "(", "modules", ",", "index", ",", "shared", ",", "stop_types", "=", "STOP_TYPES", ")", ":", "reachable", "=", "set", "(", ")", "already_seen", "=", "set", "(", ")", "for", "module", "in", "modules", ":", "for", "child", "in", ...
Find the set of all reachable objects from given root nodes (modules)
[ "Find", "the", "set", "of", "all", "reachable", "objects", "from", "given", "root", "nodes", "(", "modules", ")" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/meliaeloader.py#L347-L354
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/meliaeloader.py
deparent_unreachable
def deparent_unreachable( reachable, shared ): """Eliminate all parent-links from unreachable objects from reachable objects """ for id,shares in shared.iteritems(): if id in reachable: # child is reachable filtered = [ x for x in shares ...
python
def deparent_unreachable( reachable, shared ): """Eliminate all parent-links from unreachable objects from reachable objects """ for id,shares in shared.iteritems(): if id in reachable: # child is reachable filtered = [ x for x in shares ...
[ "def", "deparent_unreachable", "(", "reachable", ",", "shared", ")", ":", "for", "id", ",", "shares", "in", "shared", ".", "iteritems", "(", ")", ":", "if", "id", "in", "reachable", ":", "# child is reachable", "filtered", "=", "[", "x", "for", "x", "in"...
Eliminate all parent-links from unreachable objects from reachable objects
[ "Eliminate", "all", "parent", "-", "links", "from", "unreachable", "objects", "from", "reachable", "objects" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/meliaeloader.py#L356-L367
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/meliaeloader.py
bind_parents
def bind_parents( index, shared ): """Set parents on all items in index""" for v in iterindex( index ): v['parents'] = shared.get( v['address'], [] )
python
def bind_parents( index, shared ): """Set parents on all items in index""" for v in iterindex( index ): v['parents'] = shared.get( v['address'], [] )
[ "def", "bind_parents", "(", "index", ",", "shared", ")", ":", "for", "v", "in", "iterindex", "(", "index", ")", ":", "v", "[", "'parents'", "]", "=", "shared", ".", "get", "(", "v", "[", "'address'", "]", ",", "[", "]", ")" ]
Set parents on all items in index
[ "Set", "parents", "on", "all", "items", "in", "index" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/meliaeloader.py#L392-L395
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/meliaeloader.py
find_roots
def find_roots( disconnected, index, shared ): """Find appropriate "root" objects from which to recurse the hierarchies Will generate a synthetic root for anything which doesn't have any parents... """ log.warn( '%s disconnected objects in %s total objects', len(disconnected), len(index)) natur...
python
def find_roots( disconnected, index, shared ): """Find appropriate "root" objects from which to recurse the hierarchies Will generate a synthetic root for anything which doesn't have any parents... """ log.warn( '%s disconnected objects in %s total objects', len(disconnected), len(index)) natur...
[ "def", "find_roots", "(", "disconnected", ",", "index", ",", "shared", ")", ":", "log", ".", "warn", "(", "'%s disconnected objects in %s total objects'", ",", "len", "(", "disconnected", ")", ",", "len", "(", "index", ")", ")", "natural_roots", "=", "[", "x...
Find appropriate "root" objects from which to recurse the hierarchies Will generate a synthetic root for anything which doesn't have any parents...
[ "Find", "appropriate", "root", "objects", "from", "which", "to", "recurse", "the", "hierarchies", "Will", "generate", "a", "synthetic", "root", "for", "anything", "which", "doesn", "t", "have", "any", "parents", "..." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/meliaeloader.py#L509-L533
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/meliaeloader.py
Loader.get_root
def get_root( self, key ): """Retrieve the given root by type-key""" if key not in self.roots: root,self.rows = load( self.filename, include_interpreter = self.include_interpreter ) self.roots[key] = root return self.roots[key]
python
def get_root( self, key ): """Retrieve the given root by type-key""" if key not in self.roots: root,self.rows = load( self.filename, include_interpreter = self.include_interpreter ) self.roots[key] = root return self.roots[key]
[ "def", "get_root", "(", "self", ",", "key", ")", ":", "if", "key", "not", "in", "self", ".", "roots", ":", "root", ",", "self", ".", "rows", "=", "load", "(", "self", ".", "filename", ",", "include_interpreter", "=", "self", ".", "include_interpreter",...
Retrieve the given root by type-key
[ "Retrieve", "the", "given", "root", "by", "type", "-", "key" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/meliaeloader.py#L549-L554
douban/brownant
brownant/dinergate.py
Dinergate.url
def url(self): """The fetching target URL. The default behavior of this property is build URL string with the :const:`~brownant.dinergate.Dinergate.URL_TEMPLATE`. The subclasses could override :const:`~brownant.dinergate.Dinergate.URL_TEMPLATE` or use a different implem...
python
def url(self): """The fetching target URL. The default behavior of this property is build URL string with the :const:`~brownant.dinergate.Dinergate.URL_TEMPLATE`. The subclasses could override :const:`~brownant.dinergate.Dinergate.URL_TEMPLATE` or use a different implem...
[ "def", "url", "(", "self", ")", ":", "if", "not", "self", ".", "URL_TEMPLATE", ":", "raise", "NotImplementedError", "return", "self", ".", "URL_TEMPLATE", ".", "format", "(", "self", "=", "self", ")" ]
The fetching target URL. The default behavior of this property is build URL string with the :const:`~brownant.dinergate.Dinergate.URL_TEMPLATE`. The subclasses could override :const:`~brownant.dinergate.Dinergate.URL_TEMPLATE` or use a different implementation.
[ "The", "fetching", "target", "URL", "." ]
train
https://github.com/douban/brownant/blob/3c7e6d30f67b8f0f8ca1f823ea3daed74e8725cd/brownant/dinergate.py#L60-L72
douban/brownant
brownant/site.py
Site.record_action
def record_action(self, method_name, *args, **kwargs): """Record the method-calling action. The actions expect to be played on an target object. :param method_name: the name of called method. :param args: the general arguments for calling method. :param kwargs: the keyword argu...
python
def record_action(self, method_name, *args, **kwargs): """Record the method-calling action. The actions expect to be played on an target object. :param method_name: the name of called method. :param args: the general arguments for calling method. :param kwargs: the keyword argu...
[ "def", "record_action", "(", "self", ",", "method_name", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "actions", ".", "append", "(", "(", "method_name", ",", "args", ",", "kwargs", ")", ")" ]
Record the method-calling action. The actions expect to be played on an target object. :param method_name: the name of called method. :param args: the general arguments for calling method. :param kwargs: the keyword arguments for calling method.
[ "Record", "the", "method", "-", "calling", "action", "." ]
train
https://github.com/douban/brownant/blob/3c7e6d30f67b8f0f8ca1f823ea3daed74e8725cd/brownant/site.py#L14-L23
douban/brownant
brownant/site.py
Site.play_actions
def play_actions(self, target): """Play record actions on the target object. :param target: the target which recive all record actions, is a brown ant app instance normally. :type target: :class:`~brownant.app.Brownant` """ for method_name, args, kwargs in...
python
def play_actions(self, target): """Play record actions on the target object. :param target: the target which recive all record actions, is a brown ant app instance normally. :type target: :class:`~brownant.app.Brownant` """ for method_name, args, kwargs in...
[ "def", "play_actions", "(", "self", ",", "target", ")", ":", "for", "method_name", ",", "args", ",", "kwargs", "in", "self", ".", "actions", ":", "method", "=", "getattr", "(", "target", ",", "method_name", ")", "method", "(", "*", "args", ",", "*", ...
Play record actions on the target object. :param target: the target which recive all record actions, is a brown ant app instance normally. :type target: :class:`~brownant.app.Brownant`
[ "Play", "record", "actions", "on", "the", "target", "object", "." ]
train
https://github.com/douban/brownant/blob/3c7e6d30f67b8f0f8ca1f823ea3daed74e8725cd/brownant/site.py#L25-L34
douban/brownant
brownant/site.py
Site.route
def route(self, host, rule, **options): """The decorator to register wrapped function as the brown ant app. All optional parameters of this method are compatible with the :meth:`~brownant.app.Brownant.add_url_rule`. Registered functions or classes must be import-able with its qualified...
python
def route(self, host, rule, **options): """The decorator to register wrapped function as the brown ant app. All optional parameters of this method are compatible with the :meth:`~brownant.app.Brownant.add_url_rule`. Registered functions or classes must be import-able with its qualified...
[ "def", "route", "(", "self", ",", "host", ",", "rule", ",", "*", "*", "options", ")", ":", "def", "decorator", "(", "func", ")", ":", "endpoint", "=", "\"{func.__module__}:{func.__name__}\"", ".", "format", "(", "func", "=", "func", ")", "self", ".", "...
The decorator to register wrapped function as the brown ant app. All optional parameters of this method are compatible with the :meth:`~brownant.app.Brownant.add_url_rule`. Registered functions or classes must be import-able with its qualified name. It is different from the :class:`~fl...
[ "The", "decorator", "to", "register", "wrapped", "function", "as", "the", "brown", "ant", "app", "." ]
train
https://github.com/douban/brownant/blob/3c7e6d30f67b8f0f8ca1f823ea3daed74e8725cd/brownant/site.py#L36-L72
douban/brownant
brownant/utils.py
to_bytes_safe
def to_bytes_safe(text, encoding="utf-8"): """Convert the input value into bytes type. If the input value is string type and could be encode as UTF-8 bytes, the encoded value will be returned. Otherwise, the encoding has failed, the origin value will be returned as well. :param text: the input val...
python
def to_bytes_safe(text, encoding="utf-8"): """Convert the input value into bytes type. If the input value is string type and could be encode as UTF-8 bytes, the encoded value will be returned. Otherwise, the encoding has failed, the origin value will be returned as well. :param text: the input val...
[ "def", "to_bytes_safe", "(", "text", ",", "encoding", "=", "\"utf-8\"", ")", ":", "if", "not", "isinstance", "(", "text", ",", "(", "bytes", ",", "text_type", ")", ")", ":", "raise", "TypeError", "(", "\"must be string type\"", ")", "if", "isinstance", "("...
Convert the input value into bytes type. If the input value is string type and could be encode as UTF-8 bytes, the encoded value will be returned. Otherwise, the encoding has failed, the origin value will be returned as well. :param text: the input value which could be string or bytes. :param enco...
[ "Convert", "the", "input", "value", "into", "bytes", "type", "." ]
train
https://github.com/douban/brownant/blob/3c7e6d30f67b8f0f8ca1f823ea3daed74e8725cd/brownant/utils.py#L4-L22
douban/brownant
brownant/pipeline/base.py
PipelineProperty.get_attr
def get_attr(self, obj, name): """Get attribute of the target object with the configured attribute name in the :attr:`~brownant.pipeline.base.PipelineProperty.attr_names` of this instance. :param obj: the target object. :type obj: :class:`~brownant.dinergate.Dinergate` :...
python
def get_attr(self, obj, name): """Get attribute of the target object with the configured attribute name in the :attr:`~brownant.pipeline.base.PipelineProperty.attr_names` of this instance. :param obj: the target object. :type obj: :class:`~brownant.dinergate.Dinergate` :...
[ "def", "get_attr", "(", "self", ",", "obj", ",", "name", ")", ":", "attr_name", "=", "self", ".", "attr_names", "[", "name", "]", "return", "getattr", "(", "obj", ",", "attr_name", ")" ]
Get attribute of the target object with the configured attribute name in the :attr:`~brownant.pipeline.base.PipelineProperty.attr_names` of this instance. :param obj: the target object. :type obj: :class:`~brownant.dinergate.Dinergate` :param name: the internal name used in the ...
[ "Get", "attribute", "of", "the", "target", "object", "with", "the", "configured", "attribute", "name", "in", "the", ":", "attr", ":", "~brownant", ".", "pipeline", ".", "base", ".", "PipelineProperty", ".", "attr_names", "of", "this", "instance", "." ]
train
https://github.com/douban/brownant/blob/3c7e6d30f67b8f0f8ca1f823ea3daed74e8725cd/brownant/pipeline/base.py#L83-L95
douban/brownant
brownant/app.py
Brownant.add_url_rule
def add_url_rule(self, host, rule_string, endpoint, **options): """Add a url rule to the app instance. The url rule is the same with Flask apps and other Werkzeug apps. :param host: the matched hostname. e.g. "www.python.org" :param rule_string: the matched path pattern. e.g. "/news/<i...
python
def add_url_rule(self, host, rule_string, endpoint, **options): """Add a url rule to the app instance. The url rule is the same with Flask apps and other Werkzeug apps. :param host: the matched hostname. e.g. "www.python.org" :param rule_string: the matched path pattern. e.g. "/news/<i...
[ "def", "add_url_rule", "(", "self", ",", "host", ",", "rule_string", ",", "endpoint", ",", "*", "*", "options", ")", ":", "rule", "=", "Rule", "(", "rule_string", ",", "host", "=", "host", ",", "endpoint", "=", "endpoint", ",", "*", "*", "options", "...
Add a url rule to the app instance. The url rule is the same with Flask apps and other Werkzeug apps. :param host: the matched hostname. e.g. "www.python.org" :param rule_string: the matched path pattern. e.g. "/news/<int:id>" :param endpoint: the endpoint name as a dispatching key suc...
[ "Add", "a", "url", "rule", "to", "the", "app", "instance", "." ]
train
https://github.com/douban/brownant/blob/3c7e6d30f67b8f0f8ca1f823ea3daed74e8725cd/brownant/app.py#L23-L34
douban/brownant
brownant/app.py
Brownant.parse_url
def parse_url(self, url_string): """Parse the URL string with the url map of this app instance. :param url_string: the origin URL string. :returns: the tuple as `(url, url_adapter, query_args)`, the url is parsed by the standard library `urlparse`, the url_adapter is ...
python
def parse_url(self, url_string): """Parse the URL string with the url map of this app instance. :param url_string: the origin URL string. :returns: the tuple as `(url, url_adapter, query_args)`, the url is parsed by the standard library `urlparse`, the url_adapter is ...
[ "def", "parse_url", "(", "self", ",", "url_string", ")", ":", "url", "=", "urllib", ".", "parse", ".", "urlparse", "(", "url_string", ")", "url", "=", "self", ".", "validate_url", "(", "url", ")", "url_adapter", "=", "self", ".", "url_map", ".", "bind"...
Parse the URL string with the url map of this app instance. :param url_string: the origin URL string. :returns: the tuple as `(url, url_adapter, query_args)`, the url is parsed by the standard library `urlparse`, the url_adapter is from the werkzeug bound URL map, th...
[ "Parse", "the", "URL", "string", "with", "the", "url", "map", "of", "this", "app", "instance", "." ]
train
https://github.com/douban/brownant/blob/3c7e6d30f67b8f0f8ca1f823ea3daed74e8725cd/brownant/app.py#L36-L51
douban/brownant
brownant/app.py
Brownant.validate_url
def validate_url(self, url): """Validate the :class:`~urllib.parse.ParseResult` object. This method will make sure the :meth:`~brownant.app.BrownAnt.parse_url` could work as expected even meet a unexpected URL string. :param url: the parsed url. :type url: :class:`~urllib.parse...
python
def validate_url(self, url): """Validate the :class:`~urllib.parse.ParseResult` object. This method will make sure the :meth:`~brownant.app.BrownAnt.parse_url` could work as expected even meet a unexpected URL string. :param url: the parsed url. :type url: :class:`~urllib.parse...
[ "def", "validate_url", "(", "self", ",", "url", ")", ":", "# fix up the non-ascii path", "url_path", "=", "to_bytes_safe", "(", "url", ".", "path", ")", "url_path", "=", "urllib", ".", "parse", ".", "quote", "(", "url_path", ",", "safe", "=", "b\"/%\"", ")...
Validate the :class:`~urllib.parse.ParseResult` object. This method will make sure the :meth:`~brownant.app.BrownAnt.parse_url` could work as expected even meet a unexpected URL string. :param url: the parsed url. :type url: :class:`~urllib.parse.ParseResult`
[ "Validate", "the", ":", "class", ":", "~urllib", ".", "parse", ".", "ParseResult", "object", "." ]
train
https://github.com/douban/brownant/blob/3c7e6d30f67b8f0f8ca1f823ea3daed74e8725cd/brownant/app.py#L53-L81
douban/brownant
brownant/app.py
Brownant.dispatch_url
def dispatch_url(self, url_string): """Dispatch the URL string to the target endpoint function. :param url_string: the origin URL string. :returns: the return value of calling dispatched function. """ url, url_adapter, query_args = self.parse_url(url_string) try: ...
python
def dispatch_url(self, url_string): """Dispatch the URL string to the target endpoint function. :param url_string: the origin URL string. :returns: the return value of calling dispatched function. """ url, url_adapter, query_args = self.parse_url(url_string) try: ...
[ "def", "dispatch_url", "(", "self", ",", "url_string", ")", ":", "url", ",", "url_adapter", ",", "query_args", "=", "self", ".", "parse_url", "(", "url_string", ")", "try", ":", "endpoint", ",", "kwargs", "=", "url_adapter", ".", "match", "(", ")", "exce...
Dispatch the URL string to the target endpoint function. :param url_string: the origin URL string. :returns: the return value of calling dispatched function.
[ "Dispatch", "the", "URL", "string", "to", "the", "target", "endpoint", "function", "." ]
train
https://github.com/douban/brownant/blob/3c7e6d30f67b8f0f8ca1f823ea3daed74e8725cd/brownant/app.py#L83-L104
douban/brownant
brownant/app.py
Brownant.mount_site
def mount_site(self, site): """Mount a supported site to this app instance. :param site: the site instance be mounted. """ if isinstance(site, string_types): site = import_string(site) site.play_actions(target=self)
python
def mount_site(self, site): """Mount a supported site to this app instance. :param site: the site instance be mounted. """ if isinstance(site, string_types): site = import_string(site) site.play_actions(target=self)
[ "def", "mount_site", "(", "self", ",", "site", ")", ":", "if", "isinstance", "(", "site", ",", "string_types", ")", ":", "site", "=", "import_string", "(", "site", ")", "site", ".", "play_actions", "(", "target", "=", "self", ")" ]
Mount a supported site to this app instance. :param site: the site instance be mounted.
[ "Mount", "a", "supported", "site", "to", "this", "app", "instance", "." ]
train
https://github.com/douban/brownant/blob/3c7e6d30f67b8f0f8ca1f823ea3daed74e8725cd/brownant/app.py#L106-L113
taskcluster/taskcluster-client.py
taskcluster/github.py
Github.ping
def ping(self, *args, **kwargs): """ Ping Server Respond without doing anything. This endpoint is used to check that the service is up. This method is ``stable`` """ return self._makeApiCall(self.funcinfo["ping"], *args, **kwargs)
python
def ping(self, *args, **kwargs): """ Ping Server Respond without doing anything. This endpoint is used to check that the service is up. This method is ``stable`` """ return self._makeApiCall(self.funcinfo["ping"], *args, **kwargs)
[ "def", "ping", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_makeApiCall", "(", "self", ".", "funcinfo", "[", "\"ping\"", "]", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
Ping Server Respond without doing anything. This endpoint is used to check that the service is up. This method is ``stable``
[ "Ping", "Server" ]
train
https://github.com/taskcluster/taskcluster-client.py/blob/bcc95217f8bf80bed2ae5885a19fa0035da7ebc9/taskcluster/github.py#L31-L41
taskcluster/taskcluster-client.py
taskcluster/github.py
Github.githubWebHookConsumer
def githubWebHookConsumer(self, *args, **kwargs): """ Consume GitHub WebHook Capture a GitHub event and publish it via pulse, if it's a push, release or pull request. This method is ``experimental`` """ return self._makeApiCall(self.funcinfo["githubWebHookConsu...
python
def githubWebHookConsumer(self, *args, **kwargs): """ Consume GitHub WebHook Capture a GitHub event and publish it via pulse, if it's a push, release or pull request. This method is ``experimental`` """ return self._makeApiCall(self.funcinfo["githubWebHookConsu...
[ "def", "githubWebHookConsumer", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_makeApiCall", "(", "self", ".", "funcinfo", "[", "\"githubWebHookConsumer\"", "]", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
Consume GitHub WebHook Capture a GitHub event and publish it via pulse, if it's a push, release or pull request. This method is ``experimental``
[ "Consume", "GitHub", "WebHook" ]
train
https://github.com/taskcluster/taskcluster-client.py/blob/bcc95217f8bf80bed2ae5885a19fa0035da7ebc9/taskcluster/github.py#L43-L53
taskcluster/taskcluster-client.py
taskcluster/github.py
Github.badge
def badge(self, *args, **kwargs): """ Latest Build Status Badge Checks the status of the latest build of a given branch and returns corresponding badge svg. This method is ``experimental`` """ return self._makeApiCall(self.funcinfo["badge"], *args, **kwargs)
python
def badge(self, *args, **kwargs): """ Latest Build Status Badge Checks the status of the latest build of a given branch and returns corresponding badge svg. This method is ``experimental`` """ return self._makeApiCall(self.funcinfo["badge"], *args, **kwargs)
[ "def", "badge", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_makeApiCall", "(", "self", ".", "funcinfo", "[", "\"badge\"", "]", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
Latest Build Status Badge Checks the status of the latest build of a given branch and returns corresponding badge svg. This method is ``experimental``
[ "Latest", "Build", "Status", "Badge" ]
train
https://github.com/taskcluster/taskcluster-client.py/blob/bcc95217f8bf80bed2ae5885a19fa0035da7ebc9/taskcluster/github.py#L70-L80
taskcluster/taskcluster-client.py
taskcluster/github.py
Github.createComment
def createComment(self, *args, **kwargs): """ Post a comment on a given GitHub Issue or Pull Request For a given Issue or Pull Request of a repository, this will write a new message. This method takes input: ``v1/create-comment.json#`` This method is ``experimental`` "...
python
def createComment(self, *args, **kwargs): """ Post a comment on a given GitHub Issue or Pull Request For a given Issue or Pull Request of a repository, this will write a new message. This method takes input: ``v1/create-comment.json#`` This method is ``experimental`` "...
[ "def", "createComment", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_makeApiCall", "(", "self", ".", "funcinfo", "[", "\"createComment\"", "]", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
Post a comment on a given GitHub Issue or Pull Request For a given Issue or Pull Request of a repository, this will write a new message. This method takes input: ``v1/create-comment.json#`` This method is ``experimental``
[ "Post", "a", "comment", "on", "a", "given", "GitHub", "Issue", "or", "Pull", "Request" ]
train
https://github.com/taskcluster/taskcluster-client.py/blob/bcc95217f8bf80bed2ae5885a19fa0035da7ebc9/taskcluster/github.py#L127-L138
jart/fabulous
fabulous/gotham.py
lorem_gotham
def lorem_gotham(): """Cheesy Gothic Poetry Generator Uses Python generators to yield eternal angst. When you need to generate random verbiage to test your code or typographic design, let's face it... Lorem Ipsum and "the quick brown fox" are old and boring! What you need is something with *f...
python
def lorem_gotham(): """Cheesy Gothic Poetry Generator Uses Python generators to yield eternal angst. When you need to generate random verbiage to test your code or typographic design, let's face it... Lorem Ipsum and "the quick brown fox" are old and boring! What you need is something with *f...
[ "def", "lorem_gotham", "(", ")", ":", "w", "=", "lambda", "l", ":", "l", "[", "random", ".", "randrange", "(", "len", "(", "l", ")", ")", "]", "er", "=", "lambda", "w", ":", "w", "[", ":", "-", "1", "]", "+", "'ier'", "if", "w", ".", "endsw...
Cheesy Gothic Poetry Generator Uses Python generators to yield eternal angst. When you need to generate random verbiage to test your code or typographic design, let's face it... Lorem Ipsum and "the quick brown fox" are old and boring! What you need is something with *flavor*, the kind of thing a...
[ "Cheesy", "Gothic", "Poetry", "Generator" ]
train
https://github.com/jart/fabulous/blob/19903cf0a980b82f5928c3bec1f28b6bdd3785bd/fabulous/gotham.py#L65-L92
jart/fabulous
fabulous/gotham.py
lorem_gotham_title
def lorem_gotham_title(): """Names your poem """ w = lambda l: l[random.randrange(len(l))] sentence = lambda *l: lambda: " ".join(l) pick = lambda *l: (l[random.randrange(len(l))])() return pick( sentence('why i',w(me_verb)), sentence(w(place)), sentence('a',w(adj),w(adj)...
python
def lorem_gotham_title(): """Names your poem """ w = lambda l: l[random.randrange(len(l))] sentence = lambda *l: lambda: " ".join(l) pick = lambda *l: (l[random.randrange(len(l))])() return pick( sentence('why i',w(me_verb)), sentence(w(place)), sentence('a',w(adj),w(adj)...
[ "def", "lorem_gotham_title", "(", ")", ":", "w", "=", "lambda", "l", ":", "l", "[", "random", ".", "randrange", "(", "len", "(", "l", ")", ")", "]", "sentence", "=", "lambda", "*", "l", ":", "lambda", ":", "\" \"", ".", "join", "(", "l", ")", "...
Names your poem
[ "Names", "your", "poem" ]
train
https://github.com/jart/fabulous/blob/19903cf0a980b82f5928c3bec1f28b6bdd3785bd/fabulous/gotham.py#L95-L105
jart/fabulous
fabulous/gotham.py
main
def main(): """I provide a command-line interface for this module """ print() print("-~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~-") print(lorem_gotham_title().center(50)) print("-~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~-") print() poem = lorem_gotham() for n in range(16...
python
def main(): """I provide a command-line interface for this module """ print() print("-~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~-") print(lorem_gotham_title().center(50)) print("-~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~-") print() poem = lorem_gotham() for n in range(16...
[ "def", "main", "(", ")", ":", "print", "(", ")", "print", "(", "\"-~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~-\"", ")", "print", "(", "lorem_gotham_title", "(", ")", ".", "center", "(", "50", ")", ")", "print", "(", "\"-~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--...
I provide a command-line interface for this module
[ "I", "provide", "a", "command", "-", "line", "interface", "for", "this", "module" ]
train
https://github.com/jart/fabulous/blob/19903cf0a980b82f5928c3bec1f28b6bdd3785bd/fabulous/gotham.py#L108-L121
taskcluster/taskcluster-client.py
taskcluster/aio/ec2manager.py
EC2Manager.listWorkerTypes
async def listWorkerTypes(self, *args, **kwargs): """ See the list of worker types which are known to be managed This method is only for debugging the ec2-manager This method gives output: ``v1/list-worker-types.json#`` This method is ``experimental`` """ retu...
python
async def listWorkerTypes(self, *args, **kwargs): """ See the list of worker types which are known to be managed This method is only for debugging the ec2-manager This method gives output: ``v1/list-worker-types.json#`` This method is ``experimental`` """ retu...
[ "async", "def", "listWorkerTypes", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "await", "self", ".", "_makeApiCall", "(", "self", ".", "funcinfo", "[", "\"listWorkerTypes\"", "]", ",", "*", "args", ",", "*", "*", "kwargs...
See the list of worker types which are known to be managed This method is only for debugging the ec2-manager This method gives output: ``v1/list-worker-types.json#`` This method is ``experimental``
[ "See", "the", "list", "of", "worker", "types", "which", "are", "known", "to", "be", "managed" ]
train
https://github.com/taskcluster/taskcluster-client.py/blob/bcc95217f8bf80bed2ae5885a19fa0035da7ebc9/taskcluster/aio/ec2manager.py#L36-L47
taskcluster/taskcluster-client.py
taskcluster/aio/ec2manager.py
EC2Manager.runInstance
async def runInstance(self, *args, **kwargs): """ Run an instance Request an instance of a worker type This method takes input: ``v1/run-instance-request.json#`` This method is ``experimental`` """ return await self._makeApiCall(self.funcinfo["runInstance"], *...
python
async def runInstance(self, *args, **kwargs): """ Run an instance Request an instance of a worker type This method takes input: ``v1/run-instance-request.json#`` This method is ``experimental`` """ return await self._makeApiCall(self.funcinfo["runInstance"], *...
[ "async", "def", "runInstance", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "await", "self", ".", "_makeApiCall", "(", "self", ".", "funcinfo", "[", "\"runInstance\"", "]", ",", "*", "args", ",", "*", "*", "kwargs", ")"...
Run an instance Request an instance of a worker type This method takes input: ``v1/run-instance-request.json#`` This method is ``experimental``
[ "Run", "an", "instance" ]
train
https://github.com/taskcluster/taskcluster-client.py/blob/bcc95217f8bf80bed2ae5885a19fa0035da7ebc9/taskcluster/aio/ec2manager.py#L49-L60
taskcluster/taskcluster-client.py
taskcluster/aio/ec2manager.py
EC2Manager.workerTypeStats
async def workerTypeStats(self, *args, **kwargs): """ Look up the resource stats for a workerType Return an object which has a generic state description. This only contains counts of instances This method gives output: ``v1/worker-type-resources.json#`` This method is ``experi...
python
async def workerTypeStats(self, *args, **kwargs): """ Look up the resource stats for a workerType Return an object which has a generic state description. This only contains counts of instances This method gives output: ``v1/worker-type-resources.json#`` This method is ``experi...
[ "async", "def", "workerTypeStats", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "await", "self", ".", "_makeApiCall", "(", "self", ".", "funcinfo", "[", "\"workerTypeStats\"", "]", ",", "*", "args", ",", "*", "*", "kwargs...
Look up the resource stats for a workerType Return an object which has a generic state description. This only contains counts of instances This method gives output: ``v1/worker-type-resources.json#`` This method is ``experimental``
[ "Look", "up", "the", "resource", "stats", "for", "a", "workerType" ]
train
https://github.com/taskcluster/taskcluster-client.py/blob/bcc95217f8bf80bed2ae5885a19fa0035da7ebc9/taskcluster/aio/ec2manager.py#L73-L84
taskcluster/taskcluster-client.py
taskcluster/aio/ec2manager.py
EC2Manager.workerTypeHealth
async def workerTypeHealth(self, *args, **kwargs): """ Look up the resource health for a workerType Return a view of the health of a given worker type This method gives output: ``v1/health.json#`` This method is ``experimental`` """ return await self._makeApiC...
python
async def workerTypeHealth(self, *args, **kwargs): """ Look up the resource health for a workerType Return a view of the health of a given worker type This method gives output: ``v1/health.json#`` This method is ``experimental`` """ return await self._makeApiC...
[ "async", "def", "workerTypeHealth", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "await", "self", ".", "_makeApiCall", "(", "self", ".", "funcinfo", "[", "\"workerTypeHealth\"", "]", ",", "*", "args", ",", "*", "*", "kwar...
Look up the resource health for a workerType Return a view of the health of a given worker type This method gives output: ``v1/health.json#`` This method is ``experimental``
[ "Look", "up", "the", "resource", "health", "for", "a", "workerType" ]
train
https://github.com/taskcluster/taskcluster-client.py/blob/bcc95217f8bf80bed2ae5885a19fa0035da7ebc9/taskcluster/aio/ec2manager.py#L86-L97
taskcluster/taskcluster-client.py
taskcluster/aio/ec2manager.py
EC2Manager.workerTypeErrors
async def workerTypeErrors(self, *args, **kwargs): """ Look up the most recent errors of a workerType Return a list of the most recent errors encountered by a worker type This method gives output: ``v1/errors.json#`` This method is ``experimental`` """ return ...
python
async def workerTypeErrors(self, *args, **kwargs): """ Look up the most recent errors of a workerType Return a list of the most recent errors encountered by a worker type This method gives output: ``v1/errors.json#`` This method is ``experimental`` """ return ...
[ "async", "def", "workerTypeErrors", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "await", "self", ".", "_makeApiCall", "(", "self", ".", "funcinfo", "[", "\"workerTypeErrors\"", "]", ",", "*", "args", ",", "*", "*", "kwar...
Look up the most recent errors of a workerType Return a list of the most recent errors encountered by a worker type This method gives output: ``v1/errors.json#`` This method is ``experimental``
[ "Look", "up", "the", "most", "recent", "errors", "of", "a", "workerType" ]
train
https://github.com/taskcluster/taskcluster-client.py/blob/bcc95217f8bf80bed2ae5885a19fa0035da7ebc9/taskcluster/aio/ec2manager.py#L99-L110
taskcluster/taskcluster-client.py
taskcluster/aio/ec2manager.py
EC2Manager.workerTypeState
async def workerTypeState(self, *args, **kwargs): """ Look up the resource state for a workerType Return state information for a given worker type This method gives output: ``v1/worker-type-state.json#`` This method is ``experimental`` """ return await self._m...
python
async def workerTypeState(self, *args, **kwargs): """ Look up the resource state for a workerType Return state information for a given worker type This method gives output: ``v1/worker-type-state.json#`` This method is ``experimental`` """ return await self._m...
[ "async", "def", "workerTypeState", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "await", "self", ".", "_makeApiCall", "(", "self", ".", "funcinfo", "[", "\"workerTypeState\"", "]", ",", "*", "args", ",", "*", "*", "kwargs...
Look up the resource state for a workerType Return state information for a given worker type This method gives output: ``v1/worker-type-state.json#`` This method is ``experimental``
[ "Look", "up", "the", "resource", "state", "for", "a", "workerType" ]
train
https://github.com/taskcluster/taskcluster-client.py/blob/bcc95217f8bf80bed2ae5885a19fa0035da7ebc9/taskcluster/aio/ec2manager.py#L112-L123
taskcluster/taskcluster-client.py
taskcluster/aio/ec2manager.py
EC2Manager.ensureKeyPair
async def ensureKeyPair(self, *args, **kwargs): """ Ensure a KeyPair for a given worker type exists Idempotently ensure that a keypair of a given name exists This method takes input: ``v1/create-key-pair.json#`` This method is ``experimental`` """ return await...
python
async def ensureKeyPair(self, *args, **kwargs): """ Ensure a KeyPair for a given worker type exists Idempotently ensure that a keypair of a given name exists This method takes input: ``v1/create-key-pair.json#`` This method is ``experimental`` """ return await...
[ "async", "def", "ensureKeyPair", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "await", "self", ".", "_makeApiCall", "(", "self", ".", "funcinfo", "[", "\"ensureKeyPair\"", "]", ",", "*", "args", ",", "*", "*", "kwargs", ...
Ensure a KeyPair for a given worker type exists Idempotently ensure that a keypair of a given name exists This method takes input: ``v1/create-key-pair.json#`` This method is ``experimental``
[ "Ensure", "a", "KeyPair", "for", "a", "given", "worker", "type", "exists" ]
train
https://github.com/taskcluster/taskcluster-client.py/blob/bcc95217f8bf80bed2ae5885a19fa0035da7ebc9/taskcluster/aio/ec2manager.py#L125-L136
taskcluster/taskcluster-client.py
taskcluster/aio/ec2manager.py
EC2Manager.removeKeyPair
async def removeKeyPair(self, *args, **kwargs): """ Ensure a KeyPair for a given worker type does not exist Ensure that a keypair of a given name does not exist. This method is ``experimental`` """ return await self._makeApiCall(self.funcinfo["removeKeyPair"], *args, *...
python
async def removeKeyPair(self, *args, **kwargs): """ Ensure a KeyPair for a given worker type does not exist Ensure that a keypair of a given name does not exist. This method is ``experimental`` """ return await self._makeApiCall(self.funcinfo["removeKeyPair"], *args, *...
[ "async", "def", "removeKeyPair", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "await", "self", ".", "_makeApiCall", "(", "self", ".", "funcinfo", "[", "\"removeKeyPair\"", "]", ",", "*", "args", ",", "*", "*", "kwargs", ...
Ensure a KeyPair for a given worker type does not exist Ensure that a keypair of a given name does not exist. This method is ``experimental``
[ "Ensure", "a", "KeyPair", "for", "a", "given", "worker", "type", "does", "not", "exist" ]
train
https://github.com/taskcluster/taskcluster-client.py/blob/bcc95217f8bf80bed2ae5885a19fa0035da7ebc9/taskcluster/aio/ec2manager.py#L138-L147
taskcluster/taskcluster-client.py
taskcluster/aio/ec2manager.py
EC2Manager.terminateInstance
async def terminateInstance(self, *args, **kwargs): """ Terminate an instance Terminate an instance in a specified region This method is ``experimental`` """ return await self._makeApiCall(self.funcinfo["terminateInstance"], *args, **kwargs)
python
async def terminateInstance(self, *args, **kwargs): """ Terminate an instance Terminate an instance in a specified region This method is ``experimental`` """ return await self._makeApiCall(self.funcinfo["terminateInstance"], *args, **kwargs)
[ "async", "def", "terminateInstance", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "await", "self", ".", "_makeApiCall", "(", "self", ".", "funcinfo", "[", "\"terminateInstance\"", "]", ",", "*", "args", ",", "*", "*", "kw...
Terminate an instance Terminate an instance in a specified region This method is ``experimental``
[ "Terminate", "an", "instance" ]
train
https://github.com/taskcluster/taskcluster-client.py/blob/bcc95217f8bf80bed2ae5885a19fa0035da7ebc9/taskcluster/aio/ec2manager.py#L149-L158
taskcluster/taskcluster-client.py
taskcluster/aio/ec2manager.py
EC2Manager.getSpecificPrices
async def getSpecificPrices(self, *args, **kwargs): """ Request prices for EC2 Return a list of possible prices for EC2 This method takes input: ``v1/prices-request.json#`` This method gives output: ``v1/prices.json#`` This method is ``experimental`` """ ...
python
async def getSpecificPrices(self, *args, **kwargs): """ Request prices for EC2 Return a list of possible prices for EC2 This method takes input: ``v1/prices-request.json#`` This method gives output: ``v1/prices.json#`` This method is ``experimental`` """ ...
[ "async", "def", "getSpecificPrices", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "await", "self", ".", "_makeApiCall", "(", "self", ".", "funcinfo", "[", "\"getSpecificPrices\"", "]", ",", "*", "args", ",", "*", "*", "kw...
Request prices for EC2 Return a list of possible prices for EC2 This method takes input: ``v1/prices-request.json#`` This method gives output: ``v1/prices.json#`` This method is ``experimental``
[ "Request", "prices", "for", "EC2" ]
train
https://github.com/taskcluster/taskcluster-client.py/blob/bcc95217f8bf80bed2ae5885a19fa0035da7ebc9/taskcluster/aio/ec2manager.py#L173-L186
taskcluster/taskcluster-client.py
taskcluster/aio/ec2manager.py
EC2Manager.getHealth
async def getHealth(self, *args, **kwargs): """ Get EC2 account health metrics Give some basic stats on the health of our EC2 account This method gives output: ``v1/health.json#`` This method is ``experimental`` """ return await self._makeApiCall(self.funcinfo...
python
async def getHealth(self, *args, **kwargs): """ Get EC2 account health metrics Give some basic stats on the health of our EC2 account This method gives output: ``v1/health.json#`` This method is ``experimental`` """ return await self._makeApiCall(self.funcinfo...
[ "async", "def", "getHealth", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "await", "self", ".", "_makeApiCall", "(", "self", ".", "funcinfo", "[", "\"getHealth\"", "]", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
Get EC2 account health metrics Give some basic stats on the health of our EC2 account This method gives output: ``v1/health.json#`` This method is ``experimental``
[ "Get", "EC2", "account", "health", "metrics" ]
train
https://github.com/taskcluster/taskcluster-client.py/blob/bcc95217f8bf80bed2ae5885a19fa0035da7ebc9/taskcluster/aio/ec2manager.py#L188-L199
taskcluster/taskcluster-client.py
taskcluster/aio/ec2manager.py
EC2Manager.getRecentErrors
async def getRecentErrors(self, *args, **kwargs): """ Look up the most recent errors in the provisioner across all worker types Return a list of recent errors encountered This method gives output: ``v1/errors.json#`` This method is ``experimental`` """ return ...
python
async def getRecentErrors(self, *args, **kwargs): """ Look up the most recent errors in the provisioner across all worker types Return a list of recent errors encountered This method gives output: ``v1/errors.json#`` This method is ``experimental`` """ return ...
[ "async", "def", "getRecentErrors", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "await", "self", ".", "_makeApiCall", "(", "self", ".", "funcinfo", "[", "\"getRecentErrors\"", "]", ",", "*", "args", ",", "*", "*", "kwargs...
Look up the most recent errors in the provisioner across all worker types Return a list of recent errors encountered This method gives output: ``v1/errors.json#`` This method is ``experimental``
[ "Look", "up", "the", "most", "recent", "errors", "in", "the", "provisioner", "across", "all", "worker", "types" ]
train
https://github.com/taskcluster/taskcluster-client.py/blob/bcc95217f8bf80bed2ae5885a19fa0035da7ebc9/taskcluster/aio/ec2manager.py#L201-L212
taskcluster/taskcluster-client.py
taskcluster/aio/ec2manager.py
EC2Manager.regions
async def regions(self, *args, **kwargs): """ See the list of regions managed by this ec2-manager This method is only for debugging the ec2-manager This method is ``experimental`` """ return await self._makeApiCall(self.funcinfo["regions"], *args, **kwargs)
python
async def regions(self, *args, **kwargs): """ See the list of regions managed by this ec2-manager This method is only for debugging the ec2-manager This method is ``experimental`` """ return await self._makeApiCall(self.funcinfo["regions"], *args, **kwargs)
[ "async", "def", "regions", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "await", "self", ".", "_makeApiCall", "(", "self", ".", "funcinfo", "[", "\"regions\"", "]", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
See the list of regions managed by this ec2-manager This method is only for debugging the ec2-manager This method is ``experimental``
[ "See", "the", "list", "of", "regions", "managed", "by", "this", "ec2", "-", "manager" ]
train
https://github.com/taskcluster/taskcluster-client.py/blob/bcc95217f8bf80bed2ae5885a19fa0035da7ebc9/taskcluster/aio/ec2manager.py#L214-L223
taskcluster/taskcluster-client.py
taskcluster/aio/ec2manager.py
EC2Manager.amiUsage
async def amiUsage(self, *args, **kwargs): """ See the list of AMIs and their usage List AMIs and their usage by returning a list of objects in the form: { region: string volumetype: string lastused: timestamp } This method is ``experimental`...
python
async def amiUsage(self, *args, **kwargs): """ See the list of AMIs and their usage List AMIs and their usage by returning a list of objects in the form: { region: string volumetype: string lastused: timestamp } This method is ``experimental`...
[ "async", "def", "amiUsage", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "await", "self", ".", "_makeApiCall", "(", "self", ".", "funcinfo", "[", "\"amiUsage\"", "]", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
See the list of AMIs and their usage List AMIs and their usage by returning a list of objects in the form: { region: string volumetype: string lastused: timestamp } This method is ``experimental``
[ "See", "the", "list", "of", "AMIs", "and", "their", "usage" ]
train
https://github.com/taskcluster/taskcluster-client.py/blob/bcc95217f8bf80bed2ae5885a19fa0035da7ebc9/taskcluster/aio/ec2manager.py#L225-L239
taskcluster/taskcluster-client.py
taskcluster/aio/ec2manager.py
EC2Manager.ebsUsage
async def ebsUsage(self, *args, **kwargs): """ See the current EBS volume usage list Lists current EBS volume usage by returning a list of objects that are uniquely defined by {region, volumetype, state} in the form: { region: string, volumetype: string, ...
python
async def ebsUsage(self, *args, **kwargs): """ See the current EBS volume usage list Lists current EBS volume usage by returning a list of objects that are uniquely defined by {region, volumetype, state} in the form: { region: string, volumetype: string, ...
[ "async", "def", "ebsUsage", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "await", "self", ".", "_makeApiCall", "(", "self", ".", "funcinfo", "[", "\"ebsUsage\"", "]", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
See the current EBS volume usage list Lists current EBS volume usage by returning a list of objects that are uniquely defined by {region, volumetype, state} in the form: { region: string, volumetype: string, state: string, totalcount: integer, tot...
[ "See", "the", "current", "EBS", "volume", "usage", "list" ]
train
https://github.com/taskcluster/taskcluster-client.py/blob/bcc95217f8bf80bed2ae5885a19fa0035da7ebc9/taskcluster/aio/ec2manager.py#L241-L259
taskcluster/taskcluster-client.py
taskcluster/aio/ec2manager.py
EC2Manager.dbpoolStats
async def dbpoolStats(self, *args, **kwargs): """ Statistics on the Database client pool This method is only for debugging the ec2-manager This method is ``experimental`` """ return await self._makeApiCall(self.funcinfo["dbpoolStats"], *args, **kwargs)
python
async def dbpoolStats(self, *args, **kwargs): """ Statistics on the Database client pool This method is only for debugging the ec2-manager This method is ``experimental`` """ return await self._makeApiCall(self.funcinfo["dbpoolStats"], *args, **kwargs)
[ "async", "def", "dbpoolStats", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "await", "self", ".", "_makeApiCall", "(", "self", ".", "funcinfo", "[", "\"dbpoolStats\"", "]", ",", "*", "args", ",", "*", "*", "kwargs", ")"...
Statistics on the Database client pool This method is only for debugging the ec2-manager This method is ``experimental``
[ "Statistics", "on", "the", "Database", "client", "pool" ]
train
https://github.com/taskcluster/taskcluster-client.py/blob/bcc95217f8bf80bed2ae5885a19fa0035da7ebc9/taskcluster/aio/ec2manager.py#L261-L270
taskcluster/taskcluster-client.py
taskcluster/aio/ec2manager.py
EC2Manager.sqsStats
async def sqsStats(self, *args, **kwargs): """ Statistics on the sqs queues This method is only for debugging the ec2-manager This method is ``experimental`` """ return await self._makeApiCall(self.funcinfo["sqsStats"], *args, **kwargs)
python
async def sqsStats(self, *args, **kwargs): """ Statistics on the sqs queues This method is only for debugging the ec2-manager This method is ``experimental`` """ return await self._makeApiCall(self.funcinfo["sqsStats"], *args, **kwargs)
[ "async", "def", "sqsStats", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "await", "self", ".", "_makeApiCall", "(", "self", ".", "funcinfo", "[", "\"sqsStats\"", "]", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
Statistics on the sqs queues This method is only for debugging the ec2-manager This method is ``experimental``
[ "Statistics", "on", "the", "sqs", "queues" ]
train
https://github.com/taskcluster/taskcluster-client.py/blob/bcc95217f8bf80bed2ae5885a19fa0035da7ebc9/taskcluster/aio/ec2manager.py#L283-L292
taskcluster/taskcluster-client.py
taskcluster/aio/ec2manager.py
EC2Manager.purgeQueues
async def purgeQueues(self, *args, **kwargs): """ Purge the SQS queues This method is only for debugging the ec2-manager This method is ``experimental`` """ return await self._makeApiCall(self.funcinfo["purgeQueues"], *args, **kwargs)
python
async def purgeQueues(self, *args, **kwargs): """ Purge the SQS queues This method is only for debugging the ec2-manager This method is ``experimental`` """ return await self._makeApiCall(self.funcinfo["purgeQueues"], *args, **kwargs)
[ "async", "def", "purgeQueues", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "await", "self", ".", "_makeApiCall", "(", "self", ".", "funcinfo", "[", "\"purgeQueues\"", "]", ",", "*", "args", ",", "*", "*", "kwargs", ")"...
Purge the SQS queues This method is only for debugging the ec2-manager This method is ``experimental``
[ "Purge", "the", "SQS", "queues" ]
train
https://github.com/taskcluster/taskcluster-client.py/blob/bcc95217f8bf80bed2ae5885a19fa0035da7ebc9/taskcluster/aio/ec2manager.py#L294-L303
taskcluster/taskcluster-client.py
taskcluster/githubevents.py
GithubEvents.pullRequest
def pullRequest(self, *args, **kwargs): """ GitHub Pull Request Event When a GitHub pull request event is posted it will be broadcast on this exchange with the designated `organization` and `repository` in the routing-key along with event specific metadata in the payload. ...
python
def pullRequest(self, *args, **kwargs): """ GitHub Pull Request Event When a GitHub pull request event is posted it will be broadcast on this exchange with the designated `organization` and `repository` in the routing-key along with event specific metadata in the payload. ...
[ "def", "pullRequest", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "ref", "=", "{", "'exchange'", ":", "'pull-request'", ",", "'name'", ":", "'pullRequest'", ",", "'routingKey'", ":", "[", "{", "'constant'", ":", "'primary'", ",", ...
GitHub Pull Request Event When a GitHub pull request event is posted it will be broadcast on this exchange with the designated `organization` and `repository` in the routing-key along with event specific metadata in the payload. This exchange outputs: ``v1/github-pull-request-message.j...
[ "GitHub", "Pull", "Request", "Event" ]
train
https://github.com/taskcluster/taskcluster-client.py/blob/bcc95217f8bf80bed2ae5885a19fa0035da7ebc9/taskcluster/githubevents.py#L30-L73
taskcluster/taskcluster-client.py
taskcluster/githubevents.py
GithubEvents.push
def push(self, *args, **kwargs): """ GitHub push Event When a GitHub push event is posted it will be broadcast on this exchange with the designated `organization` and `repository` in the routing-key along with event specific metadata in the payload. This exchange output...
python
def push(self, *args, **kwargs): """ GitHub push Event When a GitHub push event is posted it will be broadcast on this exchange with the designated `organization` and `repository` in the routing-key along with event specific metadata in the payload. This exchange output...
[ "def", "push", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "ref", "=", "{", "'exchange'", ":", "'push'", ",", "'name'", ":", "'push'", ",", "'routingKey'", ":", "[", "{", "'constant'", ":", "'primary'", ",", "'multipleWords'", "...
GitHub push Event When a GitHub push event is posted it will be broadcast on this exchange with the designated `organization` and `repository` in the routing-key along with event specific metadata in the payload. This exchange outputs: ``v1/github-push-message.json#``This exchange take...
[ "GitHub", "push", "Event" ]
train
https://github.com/taskcluster/taskcluster-client.py/blob/bcc95217f8bf80bed2ae5885a19fa0035da7ebc9/taskcluster/githubevents.py#L75-L112
taskcluster/taskcluster-client.py
taskcluster/githubevents.py
GithubEvents.release
def release(self, *args, **kwargs): """ GitHub release Event When a GitHub release event is posted it will be broadcast on this exchange with the designated `organization` and `repository` in the routing-key along with event specific metadata in the payload. This exchan...
python
def release(self, *args, **kwargs): """ GitHub release Event When a GitHub release event is posted it will be broadcast on this exchange with the designated `organization` and `repository` in the routing-key along with event specific metadata in the payload. This exchan...
[ "def", "release", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "ref", "=", "{", "'exchange'", ":", "'release'", ",", "'name'", ":", "'release'", ",", "'routingKey'", ":", "[", "{", "'constant'", ":", "'primary'", ",", "'multipleWor...
GitHub release Event When a GitHub release event is posted it will be broadcast on this exchange with the designated `organization` and `repository` in the routing-key along with event specific metadata in the payload. This exchange outputs: ``v1/github-release-message.json#``This exch...
[ "GitHub", "release", "Event" ]
train
https://github.com/taskcluster/taskcluster-client.py/blob/bcc95217f8bf80bed2ae5885a19fa0035da7ebc9/taskcluster/githubevents.py#L114-L151
taskcluster/taskcluster-client.py
taskcluster/githubevents.py
GithubEvents.taskGroupCreationRequested
def taskGroupCreationRequested(self, *args, **kwargs): """ tc-gh requested the Queue service to create all the tasks in a group supposed to signal that taskCreate API has been called for every task in the task group for this particular repo and this particular organization curre...
python
def taskGroupCreationRequested(self, *args, **kwargs): """ tc-gh requested the Queue service to create all the tasks in a group supposed to signal that taskCreate API has been called for every task in the task group for this particular repo and this particular organization curre...
[ "def", "taskGroupCreationRequested", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "ref", "=", "{", "'exchange'", ":", "'task-group-creation-requested'", ",", "'name'", ":", "'taskGroupCreationRequested'", ",", "'routingKey'", ":", "[", "{", ...
tc-gh requested the Queue service to create all the tasks in a group supposed to signal that taskCreate API has been called for every task in the task group for this particular repo and this particular organization currently used for creating initial status indicators in GitHub UI using Statuse...
[ "tc", "-", "gh", "requested", "the", "Queue", "service", "to", "create", "all", "the", "tasks", "in", "a", "group" ]
train
https://github.com/taskcluster/taskcluster-client.py/blob/bcc95217f8bf80bed2ae5885a19fa0035da7ebc9/taskcluster/githubevents.py#L153-L193
jart/fabulous
fabulous/rotating_cube.py
rotating_cube
def rotating_cube(degree_change=3, frame_rate=3): """Rotating cube program How it works: 1. Create two imaginary ellipses 2. Sized to fit in the top third and bottom third of screen 3. Create four imaginary points on each ellipse 4. Make those points the top and bottom corners of your ...
python
def rotating_cube(degree_change=3, frame_rate=3): """Rotating cube program How it works: 1. Create two imaginary ellipses 2. Sized to fit in the top third and bottom third of screen 3. Create four imaginary points on each ellipse 4. Make those points the top and bottom corners of your ...
[ "def", "rotating_cube", "(", "degree_change", "=", "3", ",", "frame_rate", "=", "3", ")", ":", "degrees", "=", "0", "while", "True", ":", "t1", "=", "time", ".", "time", "(", ")", "with", "Frame", "(", ")", "as", "frame", ":", "oval_width", "=", "f...
Rotating cube program How it works: 1. Create two imaginary ellipses 2. Sized to fit in the top third and bottom third of screen 3. Create four imaginary points on each ellipse 4. Make those points the top and bottom corners of your cube 5. Connect the lines and render 6. Rotat...
[ "Rotating", "cube", "program" ]
train
https://github.com/jart/fabulous/blob/19903cf0a980b82f5928c3bec1f28b6bdd3785bd/fabulous/rotating_cube.py#L89-L136