partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
__get_table_limits
Here we simply take a count of each of the database tables so we know our upper limits for our random number calls then return a dictionary of them to the calling function...
surrealism.py
def __get_table_limits(): """Here we simply take a count of each of the database tables so we know our upper limits for our random number calls then return a dictionary of them to the calling function...""" table_counts = { 'max_adjectives': None, 'max_names': None, 'max_nouns'...
def __get_table_limits(): """Here we simply take a count of each of the database tables so we know our upper limits for our random number calls then return a dictionary of them to the calling function...""" table_counts = { 'max_adjectives': None, 'max_names': None, 'max_nouns'...
[ "Here", "we", "simply", "take", "a", "count", "of", "each", "of", "the", "database", "tables", "so", "we", "know", "our", "upper", "limits", "for", "our", "random", "number", "calls", "then", "return", "a", "dictionary", "of", "them", "to", "the", "calli...
Morrolan/surrealism
python
https://github.com/Morrolan/surrealism/blob/7fdd2eae534410df16ee1f9d7e9bb77aa10decab/surrealism.py#L478-L518
[ "def", "__get_table_limits", "(", ")", ":", "table_counts", "=", "{", "'max_adjectives'", ":", "None", ",", "'max_names'", ":", "None", ",", "'max_nouns'", ":", "None", ",", "'max_sentences'", ":", "None", ",", "'max_faults'", ":", "None", ",", "'max_verbs'", ...
7fdd2eae534410df16ee1f9d7e9bb77aa10decab
train
__process_sentence
pull the actual sentence from the tuple (tuple contains additional data such as ID) :param _sentence_tuple: :param counts:
surrealism.py
def __process_sentence(sentence_tuple, counts): """pull the actual sentence from the tuple (tuple contains additional data such as ID) :param _sentence_tuple: :param counts: """ sentence = sentence_tuple[2] # now we start replacing words one type at a time... sentence = __replace_verbs(sen...
def __process_sentence(sentence_tuple, counts): """pull the actual sentence from the tuple (tuple contains additional data such as ID) :param _sentence_tuple: :param counts: """ sentence = sentence_tuple[2] # now we start replacing words one type at a time... sentence = __replace_verbs(sen...
[ "pull", "the", "actual", "sentence", "from", "the", "tuple", "(", "tuple", "contains", "additional", "data", "such", "as", "ID", ")", ":", "param", "_sentence_tuple", ":", ":", "param", "counts", ":" ]
Morrolan/surrealism
python
https://github.com/Morrolan/surrealism/blob/7fdd2eae534410df16ee1f9d7e9bb77aa10decab/surrealism.py#L521-L559
[ "def", "__process_sentence", "(", "sentence_tuple", ",", "counts", ")", ":", "sentence", "=", "sentence_tuple", "[", "2", "]", "# now we start replacing words one type at a time...", "sentence", "=", "__replace_verbs", "(", "sentence", ",", "counts", ")", "sentence", ...
7fdd2eae534410df16ee1f9d7e9bb77aa10decab
train
__replace_verbs
Lets find and replace all instances of #VERB :param _sentence: :param counts:
surrealism.py
def __replace_verbs(sentence, counts): """Lets find and replace all instances of #VERB :param _sentence: :param counts: """ if sentence is not None: while sentence.find('#VERB') != -1: sentence = sentence.replace('#VERB', str(__get_verb(counts)), 1) if sentence.find...
def __replace_verbs(sentence, counts): """Lets find and replace all instances of #VERB :param _sentence: :param counts: """ if sentence is not None: while sentence.find('#VERB') != -1: sentence = sentence.replace('#VERB', str(__get_verb(counts)), 1) if sentence.find...
[ "Lets", "find", "and", "replace", "all", "instances", "of", "#VERB", ":", "param", "_sentence", ":", ":", "param", "counts", ":" ]
Morrolan/surrealism
python
https://github.com/Morrolan/surrealism/blob/7fdd2eae534410df16ee1f9d7e9bb77aa10decab/surrealism.py#L562-L576
[ "def", "__replace_verbs", "(", "sentence", ",", "counts", ")", ":", "if", "sentence", "is", "not", "None", ":", "while", "sentence", ".", "find", "(", "'#VERB'", ")", "!=", "-", "1", ":", "sentence", "=", "sentence", ".", "replace", "(", "'#VERB'", ","...
7fdd2eae534410df16ee1f9d7e9bb77aa10decab
train
__replace_nouns
Lets find and replace all instances of #NOUN :param _sentence: :param counts:
surrealism.py
def __replace_nouns(sentence, counts): """Lets find and replace all instances of #NOUN :param _sentence: :param counts: """ if sentence is not None: while sentence.find('#NOUN') != -1: sentence = sentence.replace('#NOUN', str(__get_noun(counts)), 1) if sentence.find...
def __replace_nouns(sentence, counts): """Lets find and replace all instances of #NOUN :param _sentence: :param counts: """ if sentence is not None: while sentence.find('#NOUN') != -1: sentence = sentence.replace('#NOUN', str(__get_noun(counts)), 1) if sentence.find...
[ "Lets", "find", "and", "replace", "all", "instances", "of", "#NOUN", ":", "param", "_sentence", ":", ":", "param", "counts", ":" ]
Morrolan/surrealism
python
https://github.com/Morrolan/surrealism/blob/7fdd2eae534410df16ee1f9d7e9bb77aa10decab/surrealism.py#L579-L594
[ "def", "__replace_nouns", "(", "sentence", ",", "counts", ")", ":", "if", "sentence", "is", "not", "None", ":", "while", "sentence", ".", "find", "(", "'#NOUN'", ")", "!=", "-", "1", ":", "sentence", "=", "sentence", ".", "replace", "(", "'#NOUN'", ","...
7fdd2eae534410df16ee1f9d7e9bb77aa10decab
train
___replace_adjective_maybe
Lets find and replace all instances of #ADJECTIVE_MAYBE :param _sentence: :param counts:
surrealism.py
def ___replace_adjective_maybe(sentence, counts): """Lets find and replace all instances of #ADJECTIVE_MAYBE :param _sentence: :param counts: """ random_decision = random.randint(0, 1) if sentence is not None: while sentence.find('#ADJECTIVE_MAYBE') != -1: if random_decis...
def ___replace_adjective_maybe(sentence, counts): """Lets find and replace all instances of #ADJECTIVE_MAYBE :param _sentence: :param counts: """ random_decision = random.randint(0, 1) if sentence is not None: while sentence.find('#ADJECTIVE_MAYBE') != -1: if random_decis...
[ "Lets", "find", "and", "replace", "all", "instances", "of", "#ADJECTIVE_MAYBE", ":", "param", "_sentence", ":", ":", "param", "counts", ":" ]
Morrolan/surrealism
python
https://github.com/Morrolan/surrealism/blob/7fdd2eae534410df16ee1f9d7e9bb77aa10decab/surrealism.py#L597-L619
[ "def", "___replace_adjective_maybe", "(", "sentence", ",", "counts", ")", ":", "random_decision", "=", "random", ".", "randint", "(", "0", ",", "1", ")", "if", "sentence", "is", "not", "None", ":", "while", "sentence", ".", "find", "(", "'#ADJECTIVE_MAYBE'",...
7fdd2eae534410df16ee1f9d7e9bb77aa10decab
train
__replace_adjective
Lets find and replace all instances of #ADJECTIVE :param _sentence: :param counts:
surrealism.py
def __replace_adjective(sentence, counts): """Lets find and replace all instances of #ADJECTIVE :param _sentence: :param counts: """ if sentence is not None: while sentence.find('#ADJECTIVE') != -1: sentence = sentence.replace('#ADJECTIVE', ...
def __replace_adjective(sentence, counts): """Lets find and replace all instances of #ADJECTIVE :param _sentence: :param counts: """ if sentence is not None: while sentence.find('#ADJECTIVE') != -1: sentence = sentence.replace('#ADJECTIVE', ...
[ "Lets", "find", "and", "replace", "all", "instances", "of", "#ADJECTIVE", ":", "param", "_sentence", ":", ":", "param", "counts", ":" ]
Morrolan/surrealism
python
https://github.com/Morrolan/surrealism/blob/7fdd2eae534410df16ee1f9d7e9bb77aa10decab/surrealism.py#L622-L638
[ "def", "__replace_adjective", "(", "sentence", ",", "counts", ")", ":", "if", "sentence", "is", "not", "None", ":", "while", "sentence", ".", "find", "(", "'#ADJECTIVE'", ")", "!=", "-", "1", ":", "sentence", "=", "sentence", ".", "replace", "(", "'#ADJE...
7fdd2eae534410df16ee1f9d7e9bb77aa10decab
train
__replace_names
Lets find and replace all instances of #NAME :param _sentence: :param counts:
surrealism.py
def __replace_names(sentence, counts): """Lets find and replace all instances of #NAME :param _sentence: :param counts: """ if sentence is not None: while sentence.find('#NAME') != -1: sentence = sentence.replace('#NAME', str(__get_name(counts)), 1) if sentence.fin...
def __replace_names(sentence, counts): """Lets find and replace all instances of #NAME :param _sentence: :param counts: """ if sentence is not None: while sentence.find('#NAME') != -1: sentence = sentence.replace('#NAME', str(__get_name(counts)), 1) if sentence.fin...
[ "Lets", "find", "and", "replace", "all", "instances", "of", "#NAME", ":", "param", "_sentence", ":", ":", "param", "counts", ":" ]
Morrolan/surrealism
python
https://github.com/Morrolan/surrealism/blob/7fdd2eae534410df16ee1f9d7e9bb77aa10decab/surrealism.py#L641-L656
[ "def", "__replace_names", "(", "sentence", ",", "counts", ")", ":", "if", "sentence", "is", "not", "None", ":", "while", "sentence", ".", "find", "(", "'#NAME'", ")", "!=", "-", "1", ":", "sentence", "=", "sentence", ".", "replace", "(", "'#NAME'", ","...
7fdd2eae534410df16ee1f9d7e9bb77aa10decab
train
__replace_an
Lets find and replace all instances of #AN This is a little different, as this depends on whether the next word starts with a vowel or a consonant. :param _sentence:
surrealism.py
def __replace_an(sentence): """Lets find and replace all instances of #AN This is a little different, as this depends on whether the next word starts with a vowel or a consonant. :param _sentence: """ if sentence is not None: while sentence.find('#AN') != -1: an_index = sen...
def __replace_an(sentence): """Lets find and replace all instances of #AN This is a little different, as this depends on whether the next word starts with a vowel or a consonant. :param _sentence: """ if sentence is not None: while sentence.find('#AN') != -1: an_index = sen...
[ "Lets", "find", "and", "replace", "all", "instances", "of", "#AN", "This", "is", "a", "little", "different", "as", "this", "depends", "on", "whether", "the", "next", "word", "starts", "with", "a", "vowel", "or", "a", "consonant", "." ]
Morrolan/surrealism
python
https://github.com/Morrolan/surrealism/blob/7fdd2eae534410df16ee1f9d7e9bb77aa10decab/surrealism.py#L659-L683
[ "def", "__replace_an", "(", "sentence", ")", ":", "if", "sentence", "is", "not", "None", ":", "while", "sentence", ".", "find", "(", "'#AN'", ")", "!=", "-", "1", ":", "an_index", "=", "sentence", ".", "find", "(", "'#AN'", ")", "if", "an_index", ">"...
7fdd2eae534410df16ee1f9d7e9bb77aa10decab
train
__replace_random
Lets find and replace all instances of #RANDOM :param _sentence:
surrealism.py
def __replace_random(sentence): """Lets find and replace all instances of #RANDOM :param _sentence: """ sub_list = None choice = None if sentence is not None: while sentence.find('#RANDOM') != -1: random_index = sentence.find('#RANDOM') start_index = sentence....
def __replace_random(sentence): """Lets find and replace all instances of #RANDOM :param _sentence: """ sub_list = None choice = None if sentence is not None: while sentence.find('#RANDOM') != -1: random_index = sentence.find('#RANDOM') start_index = sentence....
[ "Lets", "find", "and", "replace", "all", "instances", "of", "#RANDOM", ":", "param", "_sentence", ":" ]
Morrolan/surrealism
python
https://github.com/Morrolan/surrealism/blob/7fdd2eae534410df16ee1f9d7e9bb77aa10decab/surrealism.py#L686-L716
[ "def", "__replace_random", "(", "sentence", ")", ":", "sub_list", "=", "None", "choice", "=", "None", "if", "sentence", "is", "not", "None", ":", "while", "sentence", ".", "find", "(", "'#RANDOM'", ")", "!=", "-", "1", ":", "random_index", "=", "sentence...
7fdd2eae534410df16ee1f9d7e9bb77aa10decab
train
__replace_repeat
Allows the use of repeating random-elements such as in the 'Ten green bottles' type sentences. :param sentence:
surrealism.py
def __replace_repeat(sentence): """ Allows the use of repeating random-elements such as in the 'Ten green bottles' type sentences. :param sentence: """ ######### USE SENTENCE_ID 47 for testing! repeat_dict = {} if sentence is not None: while sentence.find('#DEFINE_REPEAT') != -1...
def __replace_repeat(sentence): """ Allows the use of repeating random-elements such as in the 'Ten green bottles' type sentences. :param sentence: """ ######### USE SENTENCE_ID 47 for testing! repeat_dict = {} if sentence is not None: while sentence.find('#DEFINE_REPEAT') != -1...
[ "Allows", "the", "use", "of", "repeating", "random", "-", "elements", "such", "as", "in", "the", "Ten", "green", "bottles", "type", "sentences", "." ]
Morrolan/surrealism
python
https://github.com/Morrolan/surrealism/blob/7fdd2eae534410df16ee1f9d7e9bb77aa10decab/surrealism.py#L719-L760
[ "def", "__replace_repeat", "(", "sentence", ")", ":", "######### USE SENTENCE_ID 47 for testing!", "repeat_dict", "=", "{", "}", "if", "sentence", "is", "not", "None", ":", "while", "sentence", ".", "find", "(", "'#DEFINE_REPEAT'", ")", "!=", "-", "1", ":", "b...
7fdd2eae534410df16ee1f9d7e9bb77aa10decab
train
__replace_capitalise
here we replace all instances of #CAPITALISE and cap the next word. ############ #NOTE: Buggy as hell, as it doesn't account for words that are already #capitalized ############ :param _sentence:
surrealism.py
def __replace_capitalise(sentence): """here we replace all instances of #CAPITALISE and cap the next word. ############ #NOTE: Buggy as hell, as it doesn't account for words that are already #capitalized ############ :param _sentence: """ if sentence is not None: while senten...
def __replace_capitalise(sentence): """here we replace all instances of #CAPITALISE and cap the next word. ############ #NOTE: Buggy as hell, as it doesn't account for words that are already #capitalized ############ :param _sentence: """ if sentence is not None: while senten...
[ "here", "we", "replace", "all", "instances", "of", "#CAPITALISE", "and", "cap", "the", "next", "word", ".", "############" ]
Morrolan/surrealism
python
https://github.com/Morrolan/surrealism/blob/7fdd2eae534410df16ee1f9d7e9bb77aa10decab/surrealism.py#L763-L790
[ "def", "__replace_capitalise", "(", "sentence", ")", ":", "if", "sentence", "is", "not", "None", ":", "while", "sentence", ".", "find", "(", "'#CAPITALISE'", ")", "!=", "-", "1", ":", "cap_index", "=", "_sentence", ".", "find", "(", "'#CAPITALISE'", ")", ...
7fdd2eae534410df16ee1f9d7e9bb77aa10decab
train
__replace_capall
here we replace all instances of #CAPALL and cap the entire sentence. Don't believe that CAPALL is buggy anymore as it forces all uppercase OK? :param _sentence:
surrealism.py
def __replace_capall(sentence): """here we replace all instances of #CAPALL and cap the entire sentence. Don't believe that CAPALL is buggy anymore as it forces all uppercase OK? :param _sentence: """ # print "\nReplacing CAPITALISE: " if sentence is not None: while sentence.find...
def __replace_capall(sentence): """here we replace all instances of #CAPALL and cap the entire sentence. Don't believe that CAPALL is buggy anymore as it forces all uppercase OK? :param _sentence: """ # print "\nReplacing CAPITALISE: " if sentence is not None: while sentence.find...
[ "here", "we", "replace", "all", "instances", "of", "#CAPALL", "and", "cap", "the", "entire", "sentence", ".", "Don", "t", "believe", "that", "CAPALL", "is", "buggy", "anymore", "as", "it", "forces", "all", "uppercase", "OK?" ]
Morrolan/surrealism
python
https://github.com/Morrolan/surrealism/blob/7fdd2eae534410df16ee1f9d7e9bb77aa10decab/surrealism.py#L793-L811
[ "def", "__replace_capall", "(", "sentence", ")", ":", "# print \"\\nReplacing CAPITALISE: \"", "if", "sentence", "is", "not", "None", ":", "while", "sentence", ".", "find", "(", "'#CAPALL'", ")", "!=", "-", "1", ":", "# _cap_index = _sentence.find('#CAPALL')", "sen...
7fdd2eae534410df16ee1f9d7e9bb77aa10decab
train
__check_spaces
Here we check to see that we have the correct number of spaces in the correct locations. :param _sentence: :return:
surrealism.py
def __check_spaces(sentence): """ Here we check to see that we have the correct number of spaces in the correct locations. :param _sentence: :return: """ # We have to run the process multiple times: # Once to search for all spaces, and check if there are adjoining spaces; # The seco...
def __check_spaces(sentence): """ Here we check to see that we have the correct number of spaces in the correct locations. :param _sentence: :return: """ # We have to run the process multiple times: # Once to search for all spaces, and check if there are adjoining spaces; # The seco...
[ "Here", "we", "check", "to", "see", "that", "we", "have", "the", "correct", "number", "of", "spaces", "in", "the", "correct", "locations", "." ]
Morrolan/surrealism
python
https://github.com/Morrolan/surrealism/blob/7fdd2eae534410df16ee1f9d7e9bb77aa10decab/surrealism.py#L814-L841
[ "def", "__check_spaces", "(", "sentence", ")", ":", "# We have to run the process multiple times:", "# Once to search for all spaces, and check if there are adjoining spaces;", "# The second time to check for 2 spaces after sentence-ending characters such as . and ! and ?", "if", "sentence",...
7fdd2eae534410df16ee1f9d7e9bb77aa10decab
train
make_exploded_column
Internal helper function used by `explode_columns()`.
tohu/v6/utils.py
def make_exploded_column(df, colname_new, colname_old): """ Internal helper function used by `explode_columns()`. """ s = df[colname_old].apply(pd.Series).stack() s.name = colname_new return s
def make_exploded_column(df, colname_new, colname_old): """ Internal helper function used by `explode_columns()`. """ s = df[colname_old].apply(pd.Series).stack() s.name = colname_new return s
[ "Internal", "helper", "function", "used", "by", "explode_columns", "()", "." ]
maxalbert/tohu
python
https://github.com/maxalbert/tohu/blob/43380162fadec99cdd5c5c3152dd6b7d3a9d39a8/tohu/v6/utils.py#L48-L54
[ "def", "make_exploded_column", "(", "df", ",", "colname_new", ",", "colname_old", ")", ":", "s", "=", "df", "[", "colname_old", "]", ".", "apply", "(", "pd", ".", "Series", ")", ".", "stack", "(", ")", "s", ".", "name", "=", "colname_new", "return", ...
43380162fadec99cdd5c5c3152dd6b7d3a9d39a8
train
explode_columns
Given a dataframe with certain columns that contain lists, return another dataframe where the elements in each list are "exploded" into individual rows. Example: >>> df col1 col2 col3 col4 0 foo 11 [DDD, AAA, CCC] [dd, aa, cc] 1 bar 22 [FFF] ...
tohu/v6/utils.py
def explode_columns(df, colnames): """ Given a dataframe with certain columns that contain lists, return another dataframe where the elements in each list are "exploded" into individual rows. Example: >>> df col1 col2 col3 col4 0 foo 11 [DDD, AAA, CCC] [dd...
def explode_columns(df, colnames): """ Given a dataframe with certain columns that contain lists, return another dataframe where the elements in each list are "exploded" into individual rows. Example: >>> df col1 col2 col3 col4 0 foo 11 [DDD, AAA, CCC] [dd...
[ "Given", "a", "dataframe", "with", "certain", "columns", "that", "contain", "lists", "return", "another", "dataframe", "where", "the", "elements", "in", "each", "list", "are", "exploded", "into", "individual", "rows", "." ]
maxalbert/tohu
python
https://github.com/maxalbert/tohu/blob/43380162fadec99cdd5c5c3152dd6b7d3a9d39a8/tohu/v6/utils.py#L57-L97
[ "def", "explode_columns", "(", "df", ",", "colnames", ")", ":", "if", "isinstance", "(", "colnames", ",", "(", "list", ",", "tuple", ")", ")", ":", "colnames", "=", "{", "name", ":", "name", "for", "name", "in", "colnames", "}", "remaining_columns", "=...
43380162fadec99cdd5c5c3152dd6b7d3a9d39a8
train
print_generated_sequence
Helper function which prints a sequence of `num` items produced by the random generator `gen`.
tohu/v6/utils.py
def print_generated_sequence(gen, num, *, sep=", ", fmt='', seed=None): """ Helper function which prints a sequence of `num` items produced by the random generator `gen`. """ if seed: gen.reset(seed) elems = [format(next(gen), fmt) for _ in range(num)] sep_initial = "\n\n" if '\n' in...
def print_generated_sequence(gen, num, *, sep=", ", fmt='', seed=None): """ Helper function which prints a sequence of `num` items produced by the random generator `gen`. """ if seed: gen.reset(seed) elems = [format(next(gen), fmt) for _ in range(num)] sep_initial = "\n\n" if '\n' in...
[ "Helper", "function", "which", "prints", "a", "sequence", "of", "num", "items", "produced", "by", "the", "random", "generator", "gen", "." ]
maxalbert/tohu
python
https://github.com/maxalbert/tohu/blob/43380162fadec99cdd5c5c3152dd6b7d3a9d39a8/tohu/v6/utils.py#L100-L110
[ "def", "print_generated_sequence", "(", "gen", ",", "num", ",", "*", ",", "sep", "=", "\", \"", ",", "fmt", "=", "''", ",", "seed", "=", "None", ")", ":", "if", "seed", ":", "gen", ".", "reset", "(", "seed", ")", "elems", "=", "[", "format", "(",...
43380162fadec99cdd5c5c3152dd6b7d3a9d39a8
train
make_dummy_tuples
Helper function to create a list of namedtuples which are useful for testing and debugging (especially of custom generators). Example ------- >>> make_dummy_tuples(chars='abcd') [Quux(x='AA', y='aa'), Quux(x='BB', y='bb'), Quux(x='CC', y='cc'), Quux(x='DD', y='dd')]
tohu/v6/utils.py
def make_dummy_tuples(chars='abcde'): """ Helper function to create a list of namedtuples which are useful for testing and debugging (especially of custom generators). Example ------- >>> make_dummy_tuples(chars='abcd') [Quux(x='AA', y='aa'), Quux(x='BB', y='bb'), Quux(x='CC', y='...
def make_dummy_tuples(chars='abcde'): """ Helper function to create a list of namedtuples which are useful for testing and debugging (especially of custom generators). Example ------- >>> make_dummy_tuples(chars='abcd') [Quux(x='AA', y='aa'), Quux(x='BB', y='bb'), Quux(x='CC', y='...
[ "Helper", "function", "to", "create", "a", "list", "of", "namedtuples", "which", "are", "useful", "for", "testing", "and", "debugging", "(", "especially", "of", "custom", "generators", ")", "." ]
maxalbert/tohu
python
https://github.com/maxalbert/tohu/blob/43380162fadec99cdd5c5c3152dd6b7d3a9d39a8/tohu/v6/utils.py#L113-L128
[ "def", "make_dummy_tuples", "(", "chars", "=", "'abcde'", ")", ":", "Quux", "=", "namedtuple", "(", "'Quux'", ",", "[", "'x'", ",", "'y'", "]", ")", "some_tuples", "=", "[", "Quux", "(", "(", "c", "*", "2", ")", ".", "upper", "(", ")", ",", "c", ...
43380162fadec99cdd5c5c3152dd6b7d3a9d39a8
train
ensure_is_date_object
Ensure input represents a valid date and return the corresponding `datetime.date` object. Valid inputs: - string of the form "YYYY-MM-DD" - dt.date object - pd.Timestamp of the form "YYYY-MM-DD 00:00:00" with freq='D' (as is generated by pd.date_range())
tohu/v6/utils.py
def ensure_is_date_object(x): """ Ensure input represents a valid date and return the corresponding `datetime.date` object. Valid inputs: - string of the form "YYYY-MM-DD" - dt.date object - pd.Timestamp of the form "YYYY-MM-DD 00:00:00" with freq='D' (as is generated by pd.date_range())...
def ensure_is_date_object(x): """ Ensure input represents a valid date and return the corresponding `datetime.date` object. Valid inputs: - string of the form "YYYY-MM-DD" - dt.date object - pd.Timestamp of the form "YYYY-MM-DD 00:00:00" with freq='D' (as is generated by pd.date_range())...
[ "Ensure", "input", "represents", "a", "valid", "date", "and", "return", "the", "corresponding", "datetime", ".", "date", "object", "." ]
maxalbert/tohu
python
https://github.com/maxalbert/tohu/blob/43380162fadec99cdd5c5c3152dd6b7d3a9d39a8/tohu/v6/utils.py#L148-L175
[ "def", "ensure_is_date_object", "(", "x", ")", ":", "error_msg", "=", "f\"Cannot convert input to date object: {x} (type: {type(x)})\"", "if", "isinstance", "(", "x", ",", "dt", ".", "date", ")", ":", "if", "isinstance", "(", "x", ",", "pd", ".", "Timestamp", ")...
43380162fadec99cdd5c5c3152dd6b7d3a9d39a8
train
TohuNamespace.all_independent_generators
Return all generators in this namespace which are not clones.
tohu/v6/tohu_namespace.py
def all_independent_generators(self): """ Return all generators in this namespace which are not clones. """ return {g: name for g, name in self._ns.items() if not is_clone(g)}
def all_independent_generators(self): """ Return all generators in this namespace which are not clones. """ return {g: name for g, name in self._ns.items() if not is_clone(g)}
[ "Return", "all", "generators", "in", "this", "namespace", "which", "are", "not", "clones", "." ]
maxalbert/tohu
python
https://github.com/maxalbert/tohu/blob/43380162fadec99cdd5c5c3152dd6b7d3a9d39a8/tohu/v6/tohu_namespace.py#L60-L64
[ "def", "all_independent_generators", "(", "self", ")", ":", "return", "{", "g", ":", "name", "for", "g", ",", "name", "in", "self", ".", "_ns", ".", "items", "(", ")", "if", "not", "is_clone", "(", "g", ")", "}" ]
43380162fadec99cdd5c5c3152dd6b7d3a9d39a8
train
make_tohu_items_class
Parameters ---------- clsname: string Name of the class to be created attr_names: list of strings Names of the attributes of the class to be created
tohu/v6/custom_generator/utils.py
def make_tohu_items_class(clsname, attr_names): """ Parameters ---------- clsname: string Name of the class to be created attr_names: list of strings Names of the attributes of the class to be created """ item_cls = attr.make_class(clsname, {name: attr.ib() for name in attr...
def make_tohu_items_class(clsname, attr_names): """ Parameters ---------- clsname: string Name of the class to be created attr_names: list of strings Names of the attributes of the class to be created """ item_cls = attr.make_class(clsname, {name: attr.ib() for name in attr...
[ "Parameters", "----------", "clsname", ":", "string", "Name", "of", "the", "class", "to", "be", "created" ]
maxalbert/tohu
python
https://github.com/maxalbert/tohu/blob/43380162fadec99cdd5c5c3152dd6b7d3a9d39a8/tohu/v6/custom_generator/utils.py#L11-L54
[ "def", "make_tohu_items_class", "(", "clsname", ",", "attr_names", ")", ":", "item_cls", "=", "attr", ".", "make_class", "(", "clsname", ",", "{", "name", ":", "attr", ".", "ib", "(", ")", "for", "name", "in", "attr_names", "}", ",", "repr", "=", "Fals...
43380162fadec99cdd5c5c3152dd6b7d3a9d39a8
train
get_tohu_items_name
Return a string which defines the name of the namedtuple class which will be used to produce items for the custom generator. By default this will be the first part of the class name (before '...Generator'), for example: FoobarGenerator -> Foobar QuuxGenerator -> Quux However, it can...
tohu/v6/custom_generator/utils.py
def get_tohu_items_name(cls): """ Return a string which defines the name of the namedtuple class which will be used to produce items for the custom generator. By default this will be the first part of the class name (before '...Generator'), for example: FoobarGenerator -> Foobar Qu...
def get_tohu_items_name(cls): """ Return a string which defines the name of the namedtuple class which will be used to produce items for the custom generator. By default this will be the first part of the class name (before '...Generator'), for example: FoobarGenerator -> Foobar Qu...
[ "Return", "a", "string", "which", "defines", "the", "name", "of", "the", "namedtuple", "class", "which", "will", "be", "used", "to", "produce", "items", "for", "the", "custom", "generator", "." ]
maxalbert/tohu
python
https://github.com/maxalbert/tohu/blob/43380162fadec99cdd5c5c3152dd6b7d3a9d39a8/tohu/v6/custom_generator/utils.py#L57-L92
[ "def", "get_tohu_items_name", "(", "cls", ")", ":", "assert", "issubclass", "(", "cls", ",", "TohuBaseGenerator", ")", "try", ":", "tohu_items_name", "=", "cls", ".", "__dict__", "[", "'__tohu_items_name__'", "]", "logger", ".", "debug", "(", "f\"Using item clas...
43380162fadec99cdd5c5c3152dd6b7d3a9d39a8
train
SelectOnePrimitive._init_randgen
Initialise random generator to be used for picking elements. With the current implementation in tohu (where we pick elements from generators individually instead of in bulk), it is faster to `use random.Random` than `numpy.random.RandomState` (it is possible that this may change in the f...
tohu/v4/primitive_generators.py
def _init_randgen(self): """ Initialise random generator to be used for picking elements. With the current implementation in tohu (where we pick elements from generators individually instead of in bulk), it is faster to `use random.Random` than `numpy.random.RandomState` (it is ...
def _init_randgen(self): """ Initialise random generator to be used for picking elements. With the current implementation in tohu (where we pick elements from generators individually instead of in bulk), it is faster to `use random.Random` than `numpy.random.RandomState` (it is ...
[ "Initialise", "random", "generator", "to", "be", "used", "for", "picking", "elements", ".", "With", "the", "current", "implementation", "in", "tohu", "(", "where", "we", "pick", "elements", "from", "generators", "individually", "instead", "of", "in", "bulk", "...
maxalbert/tohu
python
https://github.com/maxalbert/tohu/blob/43380162fadec99cdd5c5c3152dd6b7d3a9d39a8/tohu/v4/primitive_generators.py#L511-L532
[ "def", "_init_randgen", "(", "self", ")", ":", "if", "self", ".", "p", "is", "None", ":", "self", ".", "randgen", "=", "Random", "(", ")", "self", ".", "func_random_choice", "=", "self", ".", "randgen", ".", "choice", "else", ":", "self", ".", "randg...
43380162fadec99cdd5c5c3152dd6b7d3a9d39a8
train
SelectOnePrimitive._set_random_state_from
Transfer the internal state from `other` to `self`. After this call, `self` will produce the same elements in the same order as `other` (even though they otherwise remain completely independent).
tohu/v4/primitive_generators.py
def _set_random_state_from(self, other): """ Transfer the internal state from `other` to `self`. After this call, `self` will produce the same elements in the same order as `other` (even though they otherwise remain completely independent). """ try: # ...
def _set_random_state_from(self, other): """ Transfer the internal state from `other` to `self`. After this call, `self` will produce the same elements in the same order as `other` (even though they otherwise remain completely independent). """ try: # ...
[ "Transfer", "the", "internal", "state", "from", "other", "to", "self", ".", "After", "this", "call", "self", "will", "produce", "the", "same", "elements", "in", "the", "same", "order", "as", "other", "(", "even", "though", "they", "otherwise", "remain", "c...
maxalbert/tohu
python
https://github.com/maxalbert/tohu/blob/43380162fadec99cdd5c5c3152dd6b7d3a9d39a8/tohu/v4/primitive_generators.py#L534-L548
[ "def", "_set_random_state_from", "(", "self", ",", "other", ")", ":", "try", ":", "# this works if randgen is an instance of random.Random()", "self", ".", "randgen", ".", "setstate", "(", "other", ".", "randgen", ".", "getstate", "(", ")", ")", "except", "Attribu...
43380162fadec99cdd5c5c3152dd6b7d3a9d39a8
train
SelectMultiplePrimitive._init_randgen
Initialise random generator to be used for picking elements. With the current implementation in tohu (where we pick elements from generators individually instead of in bulk), it is faster to `use random.Random` than `numpy.random.RandomState` (it is possible that this may change in the f...
tohu/v4/primitive_generators.py
def _init_randgen(self): """ Initialise random generator to be used for picking elements. With the current implementation in tohu (where we pick elements from generators individually instead of in bulk), it is faster to `use random.Random` than `numpy.random.RandomState` (it is ...
def _init_randgen(self): """ Initialise random generator to be used for picking elements. With the current implementation in tohu (where we pick elements from generators individually instead of in bulk), it is faster to `use random.Random` than `numpy.random.RandomState` (it is ...
[ "Initialise", "random", "generator", "to", "be", "used", "for", "picking", "elements", ".", "With", "the", "current", "implementation", "in", "tohu", "(", "where", "we", "pick", "elements", "from", "generators", "individually", "instead", "of", "in", "bulk", "...
maxalbert/tohu
python
https://github.com/maxalbert/tohu/blob/43380162fadec99cdd5c5c3152dd6b7d3a9d39a8/tohu/v4/primitive_generators.py#L589-L610
[ "def", "_init_randgen", "(", "self", ")", ":", "if", "self", ".", "p", "is", "None", ":", "self", ".", "randgen", "=", "Random", "(", ")", "self", ".", "func_random_choice", "=", "partial", "(", "self", ".", "randgen", ".", "choices", ",", "k", "=", ...
43380162fadec99cdd5c5c3152dd6b7d3a9d39a8
train
update_with_tohu_generators
Helper function which updates `field_gens` with any items in the dictionary `adict` that are instances of `TohuUltraBaseGenerator`.
tohu/v2/custom_generator_NEW.py
def update_with_tohu_generators(field_gens, adict): """ Helper function which updates `field_gens` with any items in the dictionary `adict` that are instances of `TohuUltraBaseGenerator`. """ for name, gen in adict.items(): if isinstance(gen, TohuUltraBaseGenerator): field_gens[n...
def update_with_tohu_generators(field_gens, adict): """ Helper function which updates `field_gens` with any items in the dictionary `adict` that are instances of `TohuUltraBaseGenerator`. """ for name, gen in adict.items(): if isinstance(gen, TohuUltraBaseGenerator): field_gens[n...
[ "Helper", "function", "which", "updates", "field_gens", "with", "any", "items", "in", "the", "dictionary", "adict", "that", "are", "instances", "of", "TohuUltraBaseGenerator", "." ]
maxalbert/tohu
python
https://github.com/maxalbert/tohu/blob/43380162fadec99cdd5c5c3152dd6b7d3a9d39a8/tohu/v2/custom_generator_NEW.py#L22-L29
[ "def", "update_with_tohu_generators", "(", "field_gens", ",", "adict", ")", ":", "for", "name", ",", "gen", "in", "adict", ".", "items", "(", ")", ":", "if", "isinstance", "(", "gen", ",", "TohuUltraBaseGenerator", ")", ":", "field_gens", "[", "name", "]",...
43380162fadec99cdd5c5c3152dd6b7d3a9d39a8
train
find_field_generator_templates
Return dictionary with the names and instances of all tohu.BaseGenerator occurring in the given object's class & instance namespaces.
tohu/v2/custom_generator_NEW.py
def find_field_generator_templates(obj): """ Return dictionary with the names and instances of all tohu.BaseGenerator occurring in the given object's class & instance namespaces. """ cls_dict = obj.__class__.__dict__ obj_dict = obj.__dict__ #debug_print_dict(cls_dict, 'cls_dict') #d...
def find_field_generator_templates(obj): """ Return dictionary with the names and instances of all tohu.BaseGenerator occurring in the given object's class & instance namespaces. """ cls_dict = obj.__class__.__dict__ obj_dict = obj.__dict__ #debug_print_dict(cls_dict, 'cls_dict') #d...
[ "Return", "dictionary", "with", "the", "names", "and", "instances", "of", "all", "tohu", ".", "BaseGenerator", "occurring", "in", "the", "given", "object", "s", "class", "&", "instance", "namespaces", "." ]
maxalbert/tohu
python
https://github.com/maxalbert/tohu/blob/43380162fadec99cdd5c5c3152dd6b7d3a9d39a8/tohu/v2/custom_generator_NEW.py#L32-L48
[ "def", "find_field_generator_templates", "(", "obj", ")", ":", "cls_dict", "=", "obj", ".", "__class__", ".", "__dict__", "obj_dict", "=", "obj", ".", "__dict__", "#debug_print_dict(cls_dict, 'cls_dict')", "#debug_print_dict(obj_dict, 'obj_dict')", "field_gens", "=", "{",...
43380162fadec99cdd5c5c3152dd6b7d3a9d39a8
train
set_item_class_name_on_custom_generator_class
Set the attribute `cls.__tohu_items_name__` to a string which defines the name of the namedtuple class which will be used to produce items for the custom generator. By default this will be the first part of the class name (before '...Generator'), for example: FoobarGenerator -> Foobar ...
tohu/v2/custom_generator_NEW.py
def set_item_class_name_on_custom_generator_class(cls): """ Set the attribute `cls.__tohu_items_name__` to a string which defines the name of the namedtuple class which will be used to produce items for the custom generator. By default this will be the first part of the class name (before '...Gener...
def set_item_class_name_on_custom_generator_class(cls): """ Set the attribute `cls.__tohu_items_name__` to a string which defines the name of the namedtuple class which will be used to produce items for the custom generator. By default this will be the first part of the class name (before '...Gener...
[ "Set", "the", "attribute", "cls", ".", "__tohu_items_name__", "to", "a", "string", "which", "defines", "the", "name", "of", "the", "namedtuple", "class", "which", "will", "be", "used", "to", "produce", "items", "for", "the", "custom", "generator", "." ]
maxalbert/tohu
python
https://github.com/maxalbert/tohu/blob/43380162fadec99cdd5c5c3152dd6b7d3a9d39a8/tohu/v2/custom_generator_NEW.py#L51-L80
[ "def", "set_item_class_name_on_custom_generator_class", "(", "cls", ")", ":", "if", "'__tohu__items__name__'", "in", "cls", ".", "__dict__", ":", "logger", ".", "debug", "(", "f\"Using item class name '{cls.__tohu_items_name__}' (derived from attribute '__tohu_items_name__')\"", ...
43380162fadec99cdd5c5c3152dd6b7d3a9d39a8
train
make_item_class_for_custom_generator_class
cls: The custom generator class for which to create an item-class
tohu/v2/custom_generator_NEW.py
def make_item_class_for_custom_generator_class(cls): """ cls: The custom generator class for which to create an item-class """ clsname = cls.__tohu_items_name__ attr_names = cls.field_gens.keys() return make_item_class(clsname, attr_names)
def make_item_class_for_custom_generator_class(cls): """ cls: The custom generator class for which to create an item-class """ clsname = cls.__tohu_items_name__ attr_names = cls.field_gens.keys() return make_item_class(clsname, attr_names)
[ "cls", ":", "The", "custom", "generator", "class", "for", "which", "to", "create", "an", "item", "-", "class" ]
maxalbert/tohu
python
https://github.com/maxalbert/tohu/blob/43380162fadec99cdd5c5c3152dd6b7d3a9d39a8/tohu/v2/custom_generator_NEW.py#L129-L136
[ "def", "make_item_class_for_custom_generator_class", "(", "cls", ")", ":", "clsname", "=", "cls", ".", "__tohu_items_name__", "attr_names", "=", "cls", ".", "field_gens", ".", "keys", "(", ")", "return", "make_item_class", "(", "clsname", ",", "attr_names", ")" ]
43380162fadec99cdd5c5c3152dd6b7d3a9d39a8
train
_add_new_init_method
Replace the existing cls.__init__() method with a new one which calls the original one and in addition performs the following actions: (1) Finds all instances of tohu.BaseGenerator in the namespace and collects them in the dictionary `self.field_gens`. (2) ..to do..
tohu/v2/custom_generator_NEW.py
def _add_new_init_method(cls): """ Replace the existing cls.__init__() method with a new one which calls the original one and in addition performs the following actions: (1) Finds all instances of tohu.BaseGenerator in the namespace and collects them in the dictionary `self.field_gens`. ...
def _add_new_init_method(cls): """ Replace the existing cls.__init__() method with a new one which calls the original one and in addition performs the following actions: (1) Finds all instances of tohu.BaseGenerator in the namespace and collects them in the dictionary `self.field_gens`. ...
[ "Replace", "the", "existing", "cls", ".", "__init__", "()", "method", "with", "a", "new", "one", "which", "calls", "the", "original", "one", "and", "in", "addition", "performs", "the", "following", "actions", ":" ]
maxalbert/tohu
python
https://github.com/maxalbert/tohu/blob/43380162fadec99cdd5c5c3152dd6b7d3a9d39a8/tohu/v2/custom_generator_NEW.py#L139-L192
[ "def", "_add_new_init_method", "(", "cls", ")", ":", "orig_init", "=", "cls", ".", "__init__", "def", "new_init_method", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "logger", ".", "debug", "(", "f\"Initialising new {self} (type: {type(sel...
43380162fadec99cdd5c5c3152dd6b7d3a9d39a8
train
_add_new_next_method
TODO
tohu/v2/custom_generator_NEW.py
def _add_new_next_method(cls): """ TODO """ def new_next(self): field_values = [next(g) for g in self.field_gens.values()] return self.item_cls(*field_values) cls.__next__ = new_next
def _add_new_next_method(cls): """ TODO """ def new_next(self): field_values = [next(g) for g in self.field_gens.values()] return self.item_cls(*field_values) cls.__next__ = new_next
[ "TODO" ]
maxalbert/tohu
python
https://github.com/maxalbert/tohu/blob/43380162fadec99cdd5c5c3152dd6b7d3a9d39a8/tohu/v2/custom_generator_NEW.py#L195-L204
[ "def", "_add_new_next_method", "(", "cls", ")", ":", "def", "new_next", "(", "self", ")", ":", "field_values", "=", "[", "next", "(", "g", ")", "for", "g", "in", "self", ".", "field_gens", ".", "values", "(", ")", "]", "return", "self", ".", "item_cl...
43380162fadec99cdd5c5c3152dd6b7d3a9d39a8
train
_add_new_reset_method
Attach a new `reset()` method to `cls` which resets the internal seed generator of `cls` and then resets each of its constituent field generators found in `cls.field_gens`.
tohu/v2/custom_generator_NEW.py
def _add_new_reset_method(cls): """ Attach a new `reset()` method to `cls` which resets the internal seed generator of `cls` and then resets each of its constituent field generators found in `cls.field_gens`. """ # # Create and assign automatically generated reset() method # def n...
def _add_new_reset_method(cls): """ Attach a new `reset()` method to `cls` which resets the internal seed generator of `cls` and then resets each of its constituent field generators found in `cls.field_gens`. """ # # Create and assign automatically generated reset() method # def n...
[ "Attach", "a", "new", "reset", "()", "method", "to", "cls", "which", "resets", "the", "internal", "seed", "generator", "of", "cls", "and", "then", "resets", "each", "of", "its", "constituent", "field", "generators", "found", "in", "cls", ".", "field_gens", ...
maxalbert/tohu
python
https://github.com/maxalbert/tohu/blob/43380162fadec99cdd5c5c3152dd6b7d3a9d39a8/tohu/v2/custom_generator_NEW.py#L207-L237
[ "def", "_add_new_reset_method", "(", "cls", ")", ":", "#", "# Create and assign automatically generated reset() method", "#", "def", "new_reset_method", "(", "self", ",", "seed", "=", "None", ")", ":", "logger", ".", "debug", "(", "f'[EEE] Inside automatically generated...
43380162fadec99cdd5c5c3152dd6b7d3a9d39a8
train
_add_new_spawn_method
TODO
tohu/v2/custom_generator_NEW.py
def _add_new_spawn_method(cls): """ TODO """ def new_spawn_method(self, dependency_mapping): # TODO/FIXME: Check that this does the right thing: # (i) the spawned generator is independent of the original one (i.e. they can be reset independently without altering the other's behaviour) ...
def _add_new_spawn_method(cls): """ TODO """ def new_spawn_method(self, dependency_mapping): # TODO/FIXME: Check that this does the right thing: # (i) the spawned generator is independent of the original one (i.e. they can be reset independently without altering the other's behaviour) ...
[ "TODO" ]
maxalbert/tohu
python
https://github.com/maxalbert/tohu/blob/43380162fadec99cdd5c5c3152dd6b7d3a9d39a8/tohu/v2/custom_generator_NEW.py#L240-L259
[ "def", "_add_new_spawn_method", "(", "cls", ")", ":", "def", "new_spawn_method", "(", "self", ",", "dependency_mapping", ")", ":", "# TODO/FIXME: Check that this does the right thing:", "# (i) the spawned generator is independent of the original one (i.e. they can be reset independentl...
43380162fadec99cdd5c5c3152dd6b7d3a9d39a8
train
DerivedGenerator.reset_input_generators
Helper method which explicitly resets all input generators to the derived generator. This should only ever be called for testing or debugging.
tohu/v6/derived_generators.py
def reset_input_generators(self, seed): """ Helper method which explicitly resets all input generators to the derived generator. This should only ever be called for testing or debugging. """ seed_generator = SeedGenerator().reset(seed=seed) for gen in self.input_...
def reset_input_generators(self, seed): """ Helper method which explicitly resets all input generators to the derived generator. This should only ever be called for testing or debugging. """ seed_generator = SeedGenerator().reset(seed=seed) for gen in self.input_...
[ "Helper", "method", "which", "explicitly", "resets", "all", "input", "generators", "to", "the", "derived", "generator", ".", "This", "should", "only", "ever", "be", "called", "for", "testing", "or", "debugging", "." ]
maxalbert/tohu
python
https://github.com/maxalbert/tohu/blob/43380162fadec99cdd5c5c3152dd6b7d3a9d39a8/tohu/v6/derived_generators.py#L20-L35
[ "def", "reset_input_generators", "(", "self", ",", "seed", ")", ":", "seed_generator", "=", "SeedGenerator", "(", ")", ".", "reset", "(", "seed", "=", "seed", ")", "for", "gen", "in", "self", ".", "input_generators", ":", "gen", ".", "reset", "(", "next"...
43380162fadec99cdd5c5c3152dd6b7d3a9d39a8
train
SelectOne._spot_check_that_elements_produced_by_this_generator_have_attribute
Helper function to spot-check that the items produces by this generator have the attribute `name`.
tohu/v6/derived_generators.py
def _spot_check_that_elements_produced_by_this_generator_have_attribute(self, name): """ Helper function to spot-check that the items produces by this generator have the attribute `name`. """ g_tmp = self.values_gen.spawn() sample_element = next(g_tmp)[0] try: ...
def _spot_check_that_elements_produced_by_this_generator_have_attribute(self, name): """ Helper function to spot-check that the items produces by this generator have the attribute `name`. """ g_tmp = self.values_gen.spawn() sample_element = next(g_tmp)[0] try: ...
[ "Helper", "function", "to", "spot", "-", "check", "that", "the", "items", "produces", "by", "this", "generator", "have", "the", "attribute", "name", "." ]
maxalbert/tohu
python
https://github.com/maxalbert/tohu/blob/43380162fadec99cdd5c5c3152dd6b7d3a9d39a8/tohu/v6/derived_generators.py#L201-L210
[ "def", "_spot_check_that_elements_produced_by_this_generator_have_attribute", "(", "self", ",", "name", ")", ":", "g_tmp", "=", "self", ".", "values_gen", ".", "spawn", "(", ")", "sample_element", "=", "next", "(", "g_tmp", ")", "[", "0", "]", "try", ":", "get...
43380162fadec99cdd5c5c3152dd6b7d3a9d39a8
train
ItemList.to_df
Export items as rows in a pandas dataframe table. Parameters ---------- fields: list or dict List of field names to export, or dictionary mapping output column names to attribute names of the generators. Examples: fields=['field_name_1', 'fie...
tohu/v6/item_list.py
def to_df(self, fields=None, fields_to_explode=None): """ Export items as rows in a pandas dataframe table. Parameters ---------- fields: list or dict List of field names to export, or dictionary mapping output column names to attribute names of the gene...
def to_df(self, fields=None, fields_to_explode=None): """ Export items as rows in a pandas dataframe table. Parameters ---------- fields: list or dict List of field names to export, or dictionary mapping output column names to attribute names of the gene...
[ "Export", "items", "as", "rows", "in", "a", "pandas", "dataframe", "table", "." ]
maxalbert/tohu
python
https://github.com/maxalbert/tohu/blob/43380162fadec99cdd5c5c3152dd6b7d3a9d39a8/tohu/v6/item_list.py#L104-L180
[ "def", "to_df", "(", "self", ",", "fields", "=", "None", ",", "fields_to_explode", "=", "None", ")", ":", "if", "isinstance", "(", "fields", ",", "(", "list", ",", "tuple", ")", ")", ":", "fields", "=", "{", "name", ":", "name", "for", "name", "in"...
43380162fadec99cdd5c5c3152dd6b7d3a9d39a8
train
ItemList.to_csv
Parameters ---------- output_file: str or file object or None The file to which output will be written. By default, any existing content is overwritten. Use `append=True` to open the file in append mode instead. If `output_file` is None, the generated CSV output is re...
tohu/v6/item_list.py
def to_csv(self, output_file=None, *, fields=None, fields_to_explode=None, append=False, header=True, header_prefix='', sep=',', newline='\n'): """ Parameters ---------- output_file: str or file object or None The file to which output will be written. By default, any existing...
def to_csv(self, output_file=None, *, fields=None, fields_to_explode=None, append=False, header=True, header_prefix='', sep=',', newline='\n'): """ Parameters ---------- output_file: str or file object or None The file to which output will be written. By default, any existing...
[ "Parameters", "----------", "output_file", ":", "str", "or", "file", "object", "or", "None", "The", "file", "to", "which", "output", "will", "be", "written", ".", "By", "default", "any", "existing", "content", "is", "overwritten", ".", "Use", "append", "=", ...
maxalbert/tohu
python
https://github.com/maxalbert/tohu/blob/43380162fadec99cdd5c5c3152dd6b7d3a9d39a8/tohu/v6/item_list.py#L182-L280
[ "def", "to_csv", "(", "self", ",", "output_file", "=", "None", ",", "*", ",", "fields", "=", "None", ",", "fields_to_explode", "=", "None", ",", "append", "=", "False", ",", "header", "=", "True", ",", "header_prefix", "=", "''", ",", "sep", "=", "',...
43380162fadec99cdd5c5c3152dd6b7d3a9d39a8
train
ItemList.to_sql
Export items as rows in a PostgreSQL table. Parameters ---------- url: string Connection string to connect to the database. Example: "postgresql://postgres@127.0.0.1:5432/testdb" table_name: string Name of the database table. Note that if this name ...
tohu/v6/item_list.py
def to_sql(self, url, table_name, *, schema=None, fields=None, fields_to_explode=None, if_exists="fail", dtype=None): """ Export items as rows in a PostgreSQL table. Parameters ---------- url: string Connection string to connect to the database. Example:...
def to_sql(self, url, table_name, *, schema=None, fields=None, fields_to_explode=None, if_exists="fail", dtype=None): """ Export items as rows in a PostgreSQL table. Parameters ---------- url: string Connection string to connect to the database. Example:...
[ "Export", "items", "as", "rows", "in", "a", "PostgreSQL", "table", "." ]
maxalbert/tohu
python
https://github.com/maxalbert/tohu/blob/43380162fadec99cdd5c5c3152dd6b7d3a9d39a8/tohu/v6/item_list.py#L282-L345
[ "def", "to_sql", "(", "self", ",", "url", ",", "table_name", ",", "*", ",", "schema", "=", "None", ",", "fields", "=", "None", ",", "fields_to_explode", "=", "None", ",", "if_exists", "=", "\"fail\"", ",", "dtype", "=", "None", ")", ":", "if", "schem...
43380162fadec99cdd5c5c3152dd6b7d3a9d39a8
train
TohuBaseGenerator.reset
Reset this generator's seed generator and any clones.
tohu/v6/base.py
def reset(self, seed): """ Reset this generator's seed generator and any clones. """ logger.debug(f'Resetting {self} (seed={seed})') self.seed_generator.reset(seed) for c in self.clones: c.reset(seed)
def reset(self, seed): """ Reset this generator's seed generator and any clones. """ logger.debug(f'Resetting {self} (seed={seed})') self.seed_generator.reset(seed) for c in self.clones: c.reset(seed)
[ "Reset", "this", "generator", "s", "seed", "generator", "and", "any", "clones", "." ]
maxalbert/tohu
python
https://github.com/maxalbert/tohu/blob/43380162fadec99cdd5c5c3152dd6b7d3a9d39a8/tohu/v6/base.py#L121-L129
[ "def", "reset", "(", "self", ",", "seed", ")", ":", "logger", ".", "debug", "(", "f'Resetting {self} (seed={seed})'", ")", "self", ".", "seed_generator", ".", "reset", "(", "seed", ")", "for", "c", "in", "self", ".", "clones", ":", "c", ".", "reset", "...
43380162fadec99cdd5c5c3152dd6b7d3a9d39a8
train
_load_config
Kwargs: initial_namespace: defaults:
flexisettings/__init__.py
def _load_config(initial_namespace=None, defaults=None): # type: (Optional[str], Optional[str]) -> ConfigLoader """ Kwargs: initial_namespace: defaults: """ # load defaults if defaults: config = ConfigLoader() config.update_from_object(defaults) namespace = g...
def _load_config(initial_namespace=None, defaults=None): # type: (Optional[str], Optional[str]) -> ConfigLoader """ Kwargs: initial_namespace: defaults: """ # load defaults if defaults: config = ConfigLoader() config.update_from_object(defaults) namespace = g...
[ "Kwargs", ":", "initial_namespace", ":", "defaults", ":" ]
depop/python-flexisettings
python
https://github.com/depop/python-flexisettings/blob/36d08280ab7c45568fdf206fcdb4cf771d240c6b/flexisettings/__init__.py#L90-L114
[ "def", "_load_config", "(", "initial_namespace", "=", "None", ",", "defaults", "=", "None", ")", ":", "# type: (Optional[str], Optional[str]) -> ConfigLoader", "# load defaults", "if", "defaults", ":", "config", "=", "ConfigLoader", "(", ")", "config", ".", "update_fr...
36d08280ab7c45568fdf206fcdb4cf771d240c6b
train
override_environment
Override env vars and reload the Settings object NOTE: Obviously this context has to be in place before you import any module which reads env values at import time. NOTE: The values in `kwargs` must be strings else you will get a cryptic: TypeError: execve() arg 3 contains a non-string va...
flexisettings/utils.py
def override_environment(settings, **kwargs): # type: (Settings, **str) -> Generator """ Override env vars and reload the Settings object NOTE: Obviously this context has to be in place before you import any module which reads env values at import time. NOTE: The values in `kwargs` mus...
def override_environment(settings, **kwargs): # type: (Settings, **str) -> Generator """ Override env vars and reload the Settings object NOTE: Obviously this context has to be in place before you import any module which reads env values at import time. NOTE: The values in `kwargs` mus...
[ "Override", "env", "vars", "and", "reload", "the", "Settings", "object" ]
depop/python-flexisettings
python
https://github.com/depop/python-flexisettings/blob/36d08280ab7c45568fdf206fcdb4cf771d240c6b/flexisettings/utils.py#L47-L75
[ "def", "override_environment", "(", "settings", ",", "*", "*", "kwargs", ")", ":", "# type: (Settings, **str) -> Generator", "old_env", "=", "os", ".", "environ", ".", "copy", "(", ")", "os", ".", "environ", ".", "update", "(", "kwargs", ")", "settings", "."...
36d08280ab7c45568fdf206fcdb4cf771d240c6b
train
_import_yaml
Return a configuration object
repex.py
def _import_yaml(config_file_path): """Return a configuration object """ try: logger.info('Importing config %s...', config_file_path) with open(config_file_path) as config_file: return yaml.safe_load(config_file.read()) except IOError as ex: raise RepexError('{0}: {1}...
def _import_yaml(config_file_path): """Return a configuration object """ try: logger.info('Importing config %s...', config_file_path) with open(config_file_path) as config_file: return yaml.safe_load(config_file.read()) except IOError as ex: raise RepexError('{0}: {1}...
[ "Return", "a", "configuration", "object" ]
cloudify-cosmo/repex
python
https://github.com/cloudify-cosmo/repex/blob/589e442857fa4a99fa88670d7df1a72f983bbd28/repex.py#L72-L83
[ "def", "_import_yaml", "(", "config_file_path", ")", ":", "try", ":", "logger", ".", "info", "(", "'Importing config %s...'", ",", "config_file_path", ")", "with", "open", "(", "config_file_path", ")", "as", "config_file", ":", "return", "yaml", ".", "safe_load"...
589e442857fa4a99fa88670d7df1a72f983bbd28
train
_get_all_files
Get all files for processing. This starts iterating from `base_dir` and checks for all files that look like `filename_regex` under `path` regex excluding all paths under the `excluded_paths` list, whether they are files or folders. `excluded_paths` are explicit paths, not regex. `excluded_filename_...
repex.py
def _get_all_files(filename_regex, path, base_dir, excluded_paths=None, excluded_filename_regex=None): """Get all files for processing. This starts iterating from `base_dir` and checks for all files that look like `filename_regex` ...
def _get_all_files(filename_regex, path, base_dir, excluded_paths=None, excluded_filename_regex=None): """Get all files for processing. This starts iterating from `base_dir` and checks for all files that look like `filename_regex` ...
[ "Get", "all", "files", "for", "processing", "." ]
cloudify-cosmo/repex
python
https://github.com/cloudify-cosmo/repex/blob/589e442857fa4a99fa88670d7df1a72f983bbd28/repex.py#L120-L167
[ "def", "_get_all_files", "(", "filename_regex", ",", "path", ",", "base_dir", ",", "excluded_paths", "=", "None", ",", "excluded_filename_regex", "=", "None", ")", ":", "# For windows", "def", "replace_backslashes", "(", "string", ")", ":", "return", "string", "...
589e442857fa4a99fa88670d7df1a72f983bbd28
train
_match_tags
Check for matching tags between what the user provided and the tags set in the config. If `any` is chosen, match. If no tags are chosen and none are configured, match. If the user provided tags match any of the configured tags, match.
repex.py
def _match_tags(repex_tags, path_tags): """Check for matching tags between what the user provided and the tags set in the config. If `any` is chosen, match. If no tags are chosen and none are configured, match. If the user provided tags match any of the configured tags, match. """ if 'any' ...
def _match_tags(repex_tags, path_tags): """Check for matching tags between what the user provided and the tags set in the config. If `any` is chosen, match. If no tags are chosen and none are configured, match. If the user provided tags match any of the configured tags, match. """ if 'any' ...
[ "Check", "for", "matching", "tags", "between", "what", "the", "user", "provided", "and", "the", "tags", "set", "in", "the", "config", "." ]
cloudify-cosmo/repex
python
https://github.com/cloudify-cosmo/repex/blob/589e442857fa4a99fa88670d7df1a72f983bbd28/repex.py#L328-L340
[ "def", "_match_tags", "(", "repex_tags", ",", "path_tags", ")", ":", "if", "'any'", "in", "repex_tags", "or", "(", "not", "repex_tags", "and", "not", "path_tags", ")", ":", "return", "True", "elif", "set", "(", "repex_tags", ")", "&", "set", "(", "path_t...
589e442857fa4a99fa88670d7df1a72f983bbd28
train
iterate
Iterate over all paths in `config_file_path` :param string config_file_path: a path to a repex config file :param dict config: a dictionary representing a repex config :param dict variables: a dict of variables (can be None) :param list tags: a list of tags to check for :param bool validate: whethe...
repex.py
def iterate(config_file_path=None, config=None, variables=None, tags=None, validate=True, validate_only=False, with_diff=False): """Iterate over all paths in `config_file_path` :param string config_file_path: a path to a repex config file ...
def iterate(config_file_path=None, config=None, variables=None, tags=None, validate=True, validate_only=False, with_diff=False): """Iterate over all paths in `config_file_path` :param string config_file_path: a path to a repex config file ...
[ "Iterate", "over", "all", "paths", "in", "config_file_path" ]
cloudify-cosmo/repex
python
https://github.com/cloudify-cosmo/repex/blob/589e442857fa4a99fa88670d7df1a72f983bbd28/repex.py#L343-L378
[ "def", "iterate", "(", "config_file_path", "=", "None", ",", "config", "=", "None", ",", "variables", "=", "None", ",", "tags", "=", "None", ",", "validate", "=", "True", ",", "validate_only", "=", "False", ",", "with_diff", "=", "False", ")", ":", "# ...
589e442857fa4a99fa88670d7df1a72f983bbd28
train
handle_path
Iterate over all chosen files in a path :param dict pathobj: a dict of a specific path in the config :param dict variables: a dict of variables (can be None)
repex.py
def handle_path(pathobj, variables=None, diff=False): """Iterate over all chosen files in a path :param dict pathobj: a dict of a specific path in the config :param dict variables: a dict of variables (can be None) """ logger.info('Handling path with description: %s', pathobj.get('d...
def handle_path(pathobj, variables=None, diff=False): """Iterate over all chosen files in a path :param dict pathobj: a dict of a specific path in the config :param dict variables: a dict of variables (can be None) """ logger.info('Handling path with description: %s', pathobj.get('d...
[ "Iterate", "over", "all", "chosen", "files", "in", "a", "path" ]
cloudify-cosmo/repex
python
https://github.com/cloudify-cosmo/repex/blob/589e442857fa4a99fa88670d7df1a72f983bbd28/repex.py#L503-L545
[ "def", "handle_path", "(", "pathobj", ",", "variables", "=", "None", ",", "diff", "=", "False", ")", ":", "logger", ".", "info", "(", "'Handling path with description: %s'", ",", "pathobj", ".", "get", "(", "'description'", ")", ")", "variables", "=", "varia...
589e442857fa4a99fa88670d7df1a72f983bbd28
train
_build_vars_dict
Merge variables into a single dictionary Applies to CLI provided variables only
repex.py
def _build_vars_dict(vars_file='', variables=None): """Merge variables into a single dictionary Applies to CLI provided variables only """ repex_vars = {} if vars_file: with open(vars_file) as varsfile: repex_vars = yaml.safe_load(varsfile.read()) for var in variables: ...
def _build_vars_dict(vars_file='', variables=None): """Merge variables into a single dictionary Applies to CLI provided variables only """ repex_vars = {} if vars_file: with open(vars_file) as varsfile: repex_vars = yaml.safe_load(varsfile.read()) for var in variables: ...
[ "Merge", "variables", "into", "a", "single", "dictionary" ]
cloudify-cosmo/repex
python
https://github.com/cloudify-cosmo/repex/blob/589e442857fa4a99fa88670d7df1a72f983bbd28/repex.py#L705-L717
[ "def", "_build_vars_dict", "(", "vars_file", "=", "''", ",", "variables", "=", "None", ")", ":", "repex_vars", "=", "{", "}", "if", "vars_file", ":", "with", "open", "(", "vars_file", ")", "as", "varsfile", ":", "repex_vars", "=", "yaml", ".", "safe_load...
589e442857fa4a99fa88670d7df1a72f983bbd28
train
main
Replace strings in one or multiple files. You must either provide `REGEX_PATH` or use the `-c` flag to provide a valid repex configuration. `REGEX_PATH` can be: a regex of paths under `basedir`, a path to a single directory under `basedir`, or a path to a single file. It's important to note t...
repex.py
def main(verbose, **kwargs): """Replace strings in one or multiple files. You must either provide `REGEX_PATH` or use the `-c` flag to provide a valid repex configuration. `REGEX_PATH` can be: a regex of paths under `basedir`, a path to a single directory under `basedir`, or a path to a single...
def main(verbose, **kwargs): """Replace strings in one or multiple files. You must either provide `REGEX_PATH` or use the `-c` flag to provide a valid repex configuration. `REGEX_PATH` can be: a regex of paths under `basedir`, a path to a single directory under `basedir`, or a path to a single...
[ "Replace", "strings", "in", "one", "or", "multiple", "files", "." ]
cloudify-cosmo/repex
python
https://github.com/cloudify-cosmo/repex/blob/589e442857fa4a99fa88670d7df1a72f983bbd28/repex.py#L859-L898
[ "def", "main", "(", "verbose", ",", "*", "*", "kwargs", ")", ":", "config", "=", "kwargs", "[", "'config'", "]", "if", "not", "config", "and", "not", "kwargs", "[", "'regex_path'", "]", ":", "click", ".", "echo", "(", "'Must either provide a path or a viab...
589e442857fa4a99fa88670d7df1a72f983bbd28
train
_VariablesHandler.expand
r"""Receive a dict of variables and a dict of fields and iterates through them to expand a variable in an field, then returns the fields dict with its variables expanded. This will fail if not all variables expand (due to not providing all necessary ones). fields: type...
repex.py
def expand(self, repex_vars, fields): r"""Receive a dict of variables and a dict of fields and iterates through them to expand a variable in an field, then returns the fields dict with its variables expanded. This will fail if not all variables expand (due to not providing all n...
def expand(self, repex_vars, fields): r"""Receive a dict of variables and a dict of fields and iterates through them to expand a variable in an field, then returns the fields dict with its variables expanded. This will fail if not all variables expand (due to not providing all n...
[ "r", "Receive", "a", "dict", "of", "variables", "and", "a", "dict", "of", "fields", "and", "iterates", "through", "them", "to", "expand", "a", "variable", "in", "an", "field", "then", "returns", "the", "fields", "dict", "with", "its", "variables", "expande...
cloudify-cosmo/repex
python
https://github.com/cloudify-cosmo/repex/blob/589e442857fa4a99fa88670d7df1a72f983bbd28/repex.py#L217-L293
[ "def", "expand", "(", "self", ",", "repex_vars", ",", "fields", ")", ":", "logger", ".", "debug", "(", "'Expanding variables...'", ")", "unexpanded_instances", "=", "set", "(", ")", "# Expand variables in variables", "# TODO: This should be done in the global scope.", "...
589e442857fa4a99fa88670d7df1a72f983bbd28
train
_VariablesHandler._expand_var
Expand variable to its corresponding value in_string :param string variable: variable name :param value: value to replace with :param string in_string: the string to replace in
repex.py
def _expand_var(self, in_string, available_variables): """Expand variable to its corresponding value in_string :param string variable: variable name :param value: value to replace with :param string in_string: the string to replace in """ instances = self._get_instances(...
def _expand_var(self, in_string, available_variables): """Expand variable to its corresponding value in_string :param string variable: variable name :param value: value to replace with :param string in_string: the string to replace in """ instances = self._get_instances(...
[ "Expand", "variable", "to", "its", "corresponding", "value", "in_string" ]
cloudify-cosmo/repex
python
https://github.com/cloudify-cosmo/repex/blob/589e442857fa4a99fa88670d7df1a72f983bbd28/repex.py#L302-L315
[ "def", "_expand_var", "(", "self", ",", "in_string", ",", "available_variables", ")", ":", "instances", "=", "self", ".", "_get_instances", "(", "in_string", ")", "for", "instance", "in", "instances", ":", "for", "name", ",", "value", "in", "available_variable...
589e442857fa4a99fa88670d7df1a72f983bbd28
train
Repex.validate_before
Verify that all required strings are in the file
repex.py
def validate_before(self, content, file_to_handle): """Verify that all required strings are in the file """ logger.debug('Looking for required strings: %s', self.must_include) included = True for string in self.must_include: if not re.search(r'{0}'.format(string), con...
def validate_before(self, content, file_to_handle): """Verify that all required strings are in the file """ logger.debug('Looking for required strings: %s', self.must_include) included = True for string in self.must_include: if not re.search(r'{0}'.format(string), con...
[ "Verify", "that", "all", "required", "strings", "are", "in", "the", "file" ]
cloudify-cosmo/repex
python
https://github.com/cloudify-cosmo/repex/blob/589e442857fa4a99fa88670d7df1a72f983bbd28/repex.py#L589-L603
[ "def", "validate_before", "(", "self", ",", "content", ",", "file_to_handle", ")", ":", "logger", ".", "debug", "(", "'Looking for required strings: %s'", ",", "self", ".", "must_include", ")", "included", "=", "True", "for", "string", "in", "self", ".", "must...
589e442857fa4a99fa88670d7df1a72f983bbd28
train
Repex.find_matches
Find all matches of an expression in a file
repex.py
def find_matches(self, content, file_to_handle): """Find all matches of an expression in a file """ # look for all match groups in the content groups = [match.groupdict() for match in self.match_expression.finditer(content)] # filter out content not in the match...
def find_matches(self, content, file_to_handle): """Find all matches of an expression in a file """ # look for all match groups in the content groups = [match.groupdict() for match in self.match_expression.finditer(content)] # filter out content not in the match...
[ "Find", "all", "matches", "of", "an", "expression", "in", "a", "file" ]
cloudify-cosmo/repex
python
https://github.com/cloudify-cosmo/repex/blob/589e442857fa4a99fa88670d7df1a72f983bbd28/repex.py#L605-L618
[ "def", "find_matches", "(", "self", ",", "content", ",", "file_to_handle", ")", ":", "# look for all match groups in the content", "groups", "=", "[", "match", ".", "groupdict", "(", ")", "for", "match", "in", "self", ".", "match_expression", ".", "finditer", "(...
589e442857fa4a99fa88670d7df1a72f983bbd28
train
Repex.replace
Replace all occurences of the regex in all matches from a file with a specific value.
repex.py
def replace(self, match, content): """Replace all occurences of the regex in all matches from a file with a specific value. """ new_string = self.replace_expression.sub(self.replace_with, match) logger.info('Replacing: [ %s ] --> [ %s ]', match, new_string) new_content = ...
def replace(self, match, content): """Replace all occurences of the regex in all matches from a file with a specific value. """ new_string = self.replace_expression.sub(self.replace_with, match) logger.info('Replacing: [ %s ] --> [ %s ]', match, new_string) new_content = ...
[ "Replace", "all", "occurences", "of", "the", "regex", "in", "all", "matches", "from", "a", "file", "with", "a", "specific", "value", "." ]
cloudify-cosmo/repex
python
https://github.com/cloudify-cosmo/repex/blob/589e442857fa4a99fa88670d7df1a72f983bbd28/repex.py#L623-L630
[ "def", "replace", "(", "self", ",", "match", ",", "content", ")", ":", "new_string", "=", "self", ".", "replace_expression", ".", "sub", "(", "self", ".", "replace_with", ",", "match", ")", "logger", ".", "info", "(", "'Replacing: [ %s ] --> [ %s ]'", ",", ...
589e442857fa4a99fa88670d7df1a72f983bbd28
train
MasterProcess.set_exit_events
Do exit on certain events :param bool no_workers: Shutdown uWSGI when no workers are running. :param bool idle: Shutdown uWSGI when idle. :param bool reload: Force exit even if a reload is requested. :param bool sig_term: Exit on SIGTERM instead of brutal workers reload. ...
uwsgiconf/options/master_process.py
def set_exit_events(self, no_workers=None, idle=None, reload=None, sig_term=None): """Do exit on certain events :param bool no_workers: Shutdown uWSGI when no workers are running. :param bool idle: Shutdown uWSGI when idle. :param bool reload: Force exit even if a reload is requested....
def set_exit_events(self, no_workers=None, idle=None, reload=None, sig_term=None): """Do exit on certain events :param bool no_workers: Shutdown uWSGI when no workers are running. :param bool idle: Shutdown uWSGI when idle. :param bool reload: Force exit even if a reload is requested....
[ "Do", "exit", "on", "certain", "events" ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/master_process.py#L59-L78
[ "def", "set_exit_events", "(", "self", ",", "no_workers", "=", "None", ",", "idle", "=", "None", ",", "reload", "=", "None", ",", "sig_term", "=", "None", ")", ":", "self", ".", "_set", "(", "'die-on-no-workers'", ",", "no_workers", ",", "cast", "=", "...
475407acb44199edbf7e0a66261bfeb51de1afae
train
MasterProcess.set_exception_handling_params
Exception handling related params. :param str|unicode|list[str|unicode] handler: Register one or more exception handling C-functions. :param bool catch: Catch exceptions and report them as http output (including stack trace and env params). .. warning:: Use only for testing purposes. ...
uwsgiconf/options/master_process.py
def set_exception_handling_params(self, handler=None, catch=None, no_write_exception=None): """Exception handling related params. :param str|unicode|list[str|unicode] handler: Register one or more exception handling C-functions. :param bool catch: Catch exceptions and report them as http outpu...
def set_exception_handling_params(self, handler=None, catch=None, no_write_exception=None): """Exception handling related params. :param str|unicode|list[str|unicode] handler: Register one or more exception handling C-functions. :param bool catch: Catch exceptions and report them as http outpu...
[ "Exception", "handling", "related", "params", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/master_process.py#L80-L100
[ "def", "set_exception_handling_params", "(", "self", ",", "handler", "=", "None", ",", "catch", "=", "None", ",", "no_write_exception", "=", "None", ")", ":", "self", ".", "_set", "(", "'exception-handler'", ",", "handler", ",", "multi", "=", "True", ")", ...
475407acb44199edbf7e0a66261bfeb51de1afae
train
MasterProcess.set_idle_params
Activate idle mode - put uWSGI in cheap mode after inactivity timeout. :param int timeout: Inactivity timeout in seconds. :param bool exit: Shutdown uWSGI when idle.
uwsgiconf/options/master_process.py
def set_idle_params(self, timeout=None, exit=None): """Activate idle mode - put uWSGI in cheap mode after inactivity timeout. :param int timeout: Inactivity timeout in seconds. :param bool exit: Shutdown uWSGI when idle. """ self._set('idle', timeout) self._set('die-on...
def set_idle_params(self, timeout=None, exit=None): """Activate idle mode - put uWSGI in cheap mode after inactivity timeout. :param int timeout: Inactivity timeout in seconds. :param bool exit: Shutdown uWSGI when idle. """ self._set('idle', timeout) self._set('die-on...
[ "Activate", "idle", "mode", "-", "put", "uWSGI", "in", "cheap", "mode", "after", "inactivity", "timeout", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/master_process.py#L102-L113
[ "def", "set_idle_params", "(", "self", ",", "timeout", "=", "None", ",", "exit", "=", "None", ")", ":", "self", ".", "_set", "(", "'idle'", ",", "timeout", ")", "self", ".", "_set", "(", "'die-on-idle'", ",", "exit", ",", "cast", "=", "bool", ")", ...
475407acb44199edbf7e0a66261bfeb51de1afae
train
MasterProcess.set_reload_params
Set reload related params. :param int mercy: Set the maximum time (in seconds) we wait for workers and other processes to die during reload/shutdown. :param bool exit: Force exit even if a reload is requested.
uwsgiconf/options/master_process.py
def set_reload_params(self, mercy=None, exit=None): """Set reload related params. :param int mercy: Set the maximum time (in seconds) we wait for workers and other processes to die during reload/shutdown. :param bool exit: Force exit even if a reload is requested. """ ...
def set_reload_params(self, mercy=None, exit=None): """Set reload related params. :param int mercy: Set the maximum time (in seconds) we wait for workers and other processes to die during reload/shutdown. :param bool exit: Force exit even if a reload is requested. """ ...
[ "Set", "reload", "related", "params", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/master_process.py#L115-L127
[ "def", "set_reload_params", "(", "self", ",", "mercy", "=", "None", ",", "exit", "=", "None", ")", ":", "self", ".", "_set", "(", "'reload-mercy'", ",", "mercy", ")", "self", ".", "set_exit_events", "(", "reload", "=", "exit", ")", "return", "self", "....
475407acb44199edbf7e0a66261bfeb51de1afae
train
MasterProcess.add_cron_task
Adds a cron task running the given command on the given schedule. http://uwsgi.readthedocs.io/en/latest/Cron.html HINTS: * Use negative values to say `every`: hour=-3 stands for `every 3 hours` * Use - (minus) to make interval: minute='13-18' s...
uwsgiconf/options/master_process.py
def add_cron_task( self, command, weekday=None, month=None, day=None, hour=None, minute=None, legion=None, unique=None, harakiri=None): """Adds a cron task running the given command on the given schedule. http://uwsgi.readthedocs.io/en/latest/Cron.html HINTS: ...
def add_cron_task( self, command, weekday=None, month=None, day=None, hour=None, minute=None, legion=None, unique=None, harakiri=None): """Adds a cron task running the given command on the given schedule. http://uwsgi.readthedocs.io/en/latest/Cron.html HINTS: ...
[ "Adds", "a", "cron", "task", "running", "the", "given", "command", "on", "the", "given", "schedule", ".", "http", ":", "//", "uwsgi", ".", "readthedocs", ".", "io", "/", "en", "/", "latest", "/", "Cron", ".", "html" ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/master_process.py#L129-L179
[ "def", "add_cron_task", "(", "self", ",", "command", ",", "weekday", "=", "None", ",", "month", "=", "None", ",", "day", "=", "None", ",", "hour", "=", "None", ",", "minute", "=", "None", ",", "legion", "=", "None", ",", "unique", "=", "None", ",",...
475407acb44199edbf7e0a66261bfeb51de1afae
train
MasterProcess.attach_process_classic
Attaches a command/daemon to the master process optionally managed by a pidfile. This will allow the uWSGI master to control/monitor/respawn this process. .. note:: This uses old classic uWSGI means of process attaching To have more control use ``.attach_process()`` method (requires uWSGI...
uwsgiconf/options/master_process.py
def attach_process_classic(self, command_or_pid_path, background, control=False, for_legion=False): """Attaches a command/daemon to the master process optionally managed by a pidfile. This will allow the uWSGI master to control/monitor/respawn this process. .. note:: This uses old classic uWSG...
def attach_process_classic(self, command_or_pid_path, background, control=False, for_legion=False): """Attaches a command/daemon to the master process optionally managed by a pidfile. This will allow the uWSGI master to control/monitor/respawn this process. .. note:: This uses old classic uWSG...
[ "Attaches", "a", "command", "/", "daemon", "to", "the", "master", "process", "optionally", "managed", "by", "a", "pidfile", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/master_process.py#L181-L230
[ "def", "attach_process_classic", "(", "self", ",", "command_or_pid_path", ",", "background", ",", "control", "=", "False", ",", "for_legion", "=", "False", ")", ":", "prefix", "=", "'legion-'", "if", "for_legion", "else", "''", "if", "'.pid'", "in", "command_o...
475407acb44199edbf7e0a66261bfeb51de1afae
train
MasterProcess.attach_process
Attaches a command/daemon to the master process. This will allow the uWSGI master to control/monitor/respawn this process. http://uwsgi-docs.readthedocs.io/en/latest/AttachingDaemons.html :param str|unicode command: The command line to execute. :param bool for_legion: Legion daemons ...
uwsgiconf/options/master_process.py
def attach_process( self, command, for_legion=False, broken_counter=None, pidfile=None, control=None, daemonize=None, touch_reload=None, signal_stop=None, signal_reload=None, honour_stdin=None, uid=None, gid=None, new_pid_ns=None, change_dir=None): """Attaches a command/daemo...
def attach_process( self, command, for_legion=False, broken_counter=None, pidfile=None, control=None, daemonize=None, touch_reload=None, signal_stop=None, signal_reload=None, honour_stdin=None, uid=None, gid=None, new_pid_ns=None, change_dir=None): """Attaches a command/daemo...
[ "Attaches", "a", "command", "/", "daemon", "to", "the", "master", "process", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/master_process.py#L232-L309
[ "def", "attach_process", "(", "self", ",", "command", ",", "for_legion", "=", "False", ",", "broken_counter", "=", "None", ",", "pidfile", "=", "None", ",", "control", "=", "None", ",", "daemonize", "=", "None", ",", "touch_reload", "=", "None", ",", "si...
475407acb44199edbf7e0a66261bfeb51de1afae
train
AlgoBusyness.set_basic_params
:param int check_interval_busy: Interval (sec) to check worker busyness. :param int busy_max: Maximum busyness (percents). Every time the calculated busyness is higher than this value, uWSGI will spawn new workers. Default: 50. :param int busy_min: Minimum busyness (percents). If busyness ...
uwsgiconf/options/workers_cheapening.py
def set_basic_params( self, check_interval_busy=None, busy_max=None, busy_min=None, idle_cycles_max=None, idle_cycles_penalty=None, verbose=None): """ :param int check_interval_busy: Interval (sec) to check worker busyness. :param int busy_max: Ma...
def set_basic_params( self, check_interval_busy=None, busy_max=None, busy_min=None, idle_cycles_max=None, idle_cycles_penalty=None, verbose=None): """ :param int check_interval_busy: Interval (sec) to check worker busyness. :param int busy_max: Ma...
[ ":", "param", "int", "check_interval_busy", ":", "Interval", "(", "sec", ")", "to", "check", "worker", "busyness", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/workers_cheapening.py#L90-L121
[ "def", "set_basic_params", "(", "self", ",", "check_interval_busy", "=", "None", ",", "busy_max", "=", "None", ",", "busy_min", "=", "None", ",", "idle_cycles_max", "=", "None", ",", "idle_cycles_penalty", "=", "None", ",", "verbose", "=", "None", ")", ":", ...
475407acb44199edbf7e0a66261bfeb51de1afae
train
AlgoBusyness.set_emergency_params
Sets busyness algorithm emergency workers related params. Emergency workers could be spawned depending upon uWSGI backlog state. .. note:: These options are Linux only. :param int workers_step: Number of emergency workers to spawn. Default: 1. :param int idle_cycles_max: Idle cycles ...
uwsgiconf/options/workers_cheapening.py
def set_emergency_params( self, workers_step=None, idle_cycles_max=None, queue_size=None, queue_nonzero_delay=None): """Sets busyness algorithm emergency workers related params. Emergency workers could be spawned depending upon uWSGI backlog state. .. note:: These options are Linux...
def set_emergency_params( self, workers_step=None, idle_cycles_max=None, queue_size=None, queue_nonzero_delay=None): """Sets busyness algorithm emergency workers related params. Emergency workers could be spawned depending upon uWSGI backlog state. .. note:: These options are Linux...
[ "Sets", "busyness", "algorithm", "emergency", "workers", "related", "params", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/workers_cheapening.py#L123-L146
[ "def", "set_emergency_params", "(", "self", ",", "workers_step", "=", "None", ",", "idle_cycles_max", "=", "None", ",", "queue_size", "=", "None", ",", "queue_nonzero_delay", "=", "None", ")", ":", "self", ".", "_set", "(", "'cheaper-busyness-backlog-step'", ","...
475407acb44199edbf7e0a66261bfeb51de1afae
train
Cheapening.set_basic_params
:param bool spawn_on_request: Spawn workers only after the first request. :param Algo cheaper_algo: The algorithm object to be used used for adaptive process spawning. Default: ``spare``. See ``.algorithms``. :param int workers_min: Minimal workers count. Enables cheaper mode (adaptive pro...
uwsgiconf/options/workers_cheapening.py
def set_basic_params( self, spawn_on_request=None, cheaper_algo=None, workers_min=None, workers_startup=None, workers_step=None): """ :param bool spawn_on_request: Spawn workers only after the first request. :param Algo cheaper_algo: The algorithm object to be used used ...
def set_basic_params( self, spawn_on_request=None, cheaper_algo=None, workers_min=None, workers_startup=None, workers_step=None): """ :param bool spawn_on_request: Spawn workers only after the first request. :param Algo cheaper_algo: The algorithm object to be used used ...
[ ":", "param", "bool", "spawn_on_request", ":", "Spawn", "workers", "only", "after", "the", "first", "request", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/workers_cheapening.py#L175-L208
[ "def", "set_basic_params", "(", "self", ",", "spawn_on_request", "=", "None", ",", "cheaper_algo", "=", "None", ",", "workers_min", "=", "None", ",", "workers_startup", "=", "None", ",", "workers_step", "=", "None", ")", ":", "self", ".", "_set", "(", "'ch...
475407acb44199edbf7e0a66261bfeb51de1afae
train
Cheapening.set_memory_limits
Sets worker memory limits for cheapening. :param int rss_soft: Don't spawn new workers if total resident memory usage of all workers is higher than this limit in bytes. .. warning:: This option expects memory reporting enabled: ``.logging.set_basic_params(me...
uwsgiconf/options/workers_cheapening.py
def set_memory_limits(self, rss_soft=None, rss_hard=None): """Sets worker memory limits for cheapening. :param int rss_soft: Don't spawn new workers if total resident memory usage of all workers is higher than this limit in bytes. .. warning:: This option expects me...
def set_memory_limits(self, rss_soft=None, rss_hard=None): """Sets worker memory limits for cheapening. :param int rss_soft: Don't spawn new workers if total resident memory usage of all workers is higher than this limit in bytes. .. warning:: This option expects me...
[ "Sets", "worker", "memory", "limits", "for", "cheapening", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/workers_cheapening.py#L210-L226
[ "def", "set_memory_limits", "(", "self", ",", "rss_soft", "=", "None", ",", "rss_hard", "=", "None", ")", ":", "self", ".", "_set", "(", "'cheaper-rss-limit-soft'", ",", "rss_soft", ")", "self", ".", "_set", "(", "'cheaper-rss-limit-hard'", ",", "rss_hard", ...
475407acb44199edbf7e0a66261bfeb51de1afae
train
_Environment.get_version
Returns uWSGI version string or tuple. :param bool as_tuple: :rtype: str|tuple
uwsgiconf/runtime/environ.py
def get_version(self, as_tuple=False): """Returns uWSGI version string or tuple. :param bool as_tuple: :rtype: str|tuple """ if as_tuple: return uwsgi.version_info return decode(uwsgi.version)
def get_version(self, as_tuple=False): """Returns uWSGI version string or tuple. :param bool as_tuple: :rtype: str|tuple """ if as_tuple: return uwsgi.version_info return decode(uwsgi.version)
[ "Returns", "uWSGI", "version", "string", "or", "tuple", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/runtime/environ.py#L81-L91
[ "def", "get_version", "(", "self", ",", "as_tuple", "=", "False", ")", ":", "if", "as_tuple", ":", "return", "uwsgi", ".", "version_info", "return", "decode", "(", "uwsgi", ".", "version", ")" ]
475407acb44199edbf7e0a66261bfeb51de1afae
train
Routing.register_route
Registers a routing rule. :param RouteRule|list[RouteRule] route_rules: :param str|unicode label: Label to mark the given set of rules. This can be used in conjunction with ``do_goto`` rule action. * http://uwsgi.readthedocs.io/en/latest/InternalRouting.html#goto
uwsgiconf/options/routing.py
def register_route(self, route_rules, label=None): """Registers a routing rule. :param RouteRule|list[RouteRule] route_rules: :param str|unicode label: Label to mark the given set of rules. This can be used in conjunction with ``do_goto`` rule action. * http://uwsgi.re...
def register_route(self, route_rules, label=None): """Registers a routing rule. :param RouteRule|list[RouteRule] route_rules: :param str|unicode label: Label to mark the given set of rules. This can be used in conjunction with ``do_goto`` rule action. * http://uwsgi.re...
[ "Registers", "a", "routing", "rule", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/routing.py#L283-L302
[ "def", "register_route", "(", "self", ",", "route_rules", ",", "label", "=", "None", ")", ":", "route_rules", "=", "listify", "(", "route_rules", ")", "if", "route_rules", "and", "label", ":", "self", ".", "_set", "(", "route_rules", "[", "0", "]", ".", ...
475407acb44199edbf7e0a66261bfeb51de1afae
train
Routing.set_error_page
Add an error page (html) for managed 403, 404, 500 response. :param int status: HTTP status code. :param str|unicode html_fpath: HTML page file path.
uwsgiconf/options/routing.py
def set_error_page(self, status, html_fpath): """Add an error page (html) for managed 403, 404, 500 response. :param int status: HTTP status code. :param str|unicode html_fpath: HTML page file path. """ statuses = [403, 404, 500] status = int(status) if statu...
def set_error_page(self, status, html_fpath): """Add an error page (html) for managed 403, 404, 500 response. :param int status: HTTP status code. :param str|unicode html_fpath: HTML page file path. """ statuses = [403, 404, 500] status = int(status) if statu...
[ "Add", "an", "error", "page", "(", "html", ")", "for", "managed", "403", "404", "500", "response", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/routing.py#L311-L330
[ "def", "set_error_page", "(", "self", ",", "status", ",", "html_fpath", ")", ":", "statuses", "=", "[", "403", ",", "404", ",", "500", "]", "status", "=", "int", "(", "status", ")", "if", "status", "not", "in", "statuses", ":", "raise", "ConfigurationE...
475407acb44199edbf7e0a66261bfeb51de1afae
train
Routing.set_error_pages
Add an error pages for managed 403, 404, 500 responses. Shortcut for ``.set_error_page()``. :param dict codes_map: Status code mapped into an html filepath or just a filename if common_prefix is used. If not set, filename containing status code is presumed: 400.html, 500.html,...
uwsgiconf/options/routing.py
def set_error_pages(self, codes_map=None, common_prefix=None): """Add an error pages for managed 403, 404, 500 responses. Shortcut for ``.set_error_page()``. :param dict codes_map: Status code mapped into an html filepath or just a filename if common_prefix is used. If...
def set_error_pages(self, codes_map=None, common_prefix=None): """Add an error pages for managed 403, 404, 500 responses. Shortcut for ``.set_error_page()``. :param dict codes_map: Status code mapped into an html filepath or just a filename if common_prefix is used. If...
[ "Add", "an", "error", "pages", "for", "managed", "403", "404", "500", "responses", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/routing.py#L332-L357
[ "def", "set_error_pages", "(", "self", ",", "codes_map", "=", "None", ",", "common_prefix", "=", "None", ")", ":", "statuses", "=", "[", "403", ",", "404", ",", "500", "]", "if", "common_prefix", ":", "if", "not", "codes_map", ":", "codes_map", "=", "{...
475407acb44199edbf7e0a66261bfeb51de1afae
train
Routing.set_geoip_params
Sets GeoIP parameters. * http://uwsgi.readthedocs.io/en/latest/GeoIP.html :param str|unicode db_country: Country database file path. :param str|unicode db_city: City database file path. Example: ``GeoLiteCity.dat``.
uwsgiconf/options/routing.py
def set_geoip_params(self, db_country=None, db_city=None): """Sets GeoIP parameters. * http://uwsgi.readthedocs.io/en/latest/GeoIP.html :param str|unicode db_country: Country database file path. :param str|unicode db_city: City database file path. Example: ``GeoLiteCity.dat``. ...
def set_geoip_params(self, db_country=None, db_city=None): """Sets GeoIP parameters. * http://uwsgi.readthedocs.io/en/latest/GeoIP.html :param str|unicode db_country: Country database file path. :param str|unicode db_city: City database file path. Example: ``GeoLiteCity.dat``. ...
[ "Sets", "GeoIP", "parameters", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/routing.py#L359-L372
[ "def", "set_geoip_params", "(", "self", ",", "db_country", "=", "None", ",", "db_city", "=", "None", ")", ":", "self", ".", "_set", "(", "'geoip-country'", ",", "db_country", ",", "plugin", "=", "'geoip'", ")", "self", ".", "_set", "(", "'geoip-city'", "...
475407acb44199edbf7e0a66261bfeb51de1afae
train
Routing.header_add
Automatically add HTTP headers to response. :param str|unicode name: :param str|unicode value:
uwsgiconf/options/routing.py
def header_add(self, name, value): """Automatically add HTTP headers to response. :param str|unicode name: :param str|unicode value: """ self._set('add-header', '%s: %s' % (name, value), multi=True) return self._section
def header_add(self, name, value): """Automatically add HTTP headers to response. :param str|unicode name: :param str|unicode value: """ self._set('add-header', '%s: %s' % (name, value), multi=True) return self._section
[ "Automatically", "add", "HTTP", "headers", "to", "response", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/routing.py#L374-L384
[ "def", "header_add", "(", "self", ",", "name", ",", "value", ")", ":", "self", ".", "_set", "(", "'add-header'", ",", "'%s: %s'", "%", "(", "name", ",", "value", ")", ",", "multi", "=", "True", ")", "return", "self", ".", "_section" ]
475407acb44199edbf7e0a66261bfeb51de1afae
train
Routing.header_remove
Automatically remove specified HTTP header from the response. :param str|unicode value:
uwsgiconf/options/routing.py
def header_remove(self, value): """Automatically remove specified HTTP header from the response. :param str|unicode value: """ self._set('del-header', value, multi=True) return self._section
def header_remove(self, value): """Automatically remove specified HTTP header from the response. :param str|unicode value: """ self._set('del-header', value, multi=True) return self._section
[ "Automatically", "remove", "specified", "HTTP", "header", "from", "the", "response", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/routing.py#L386-L394
[ "def", "header_remove", "(", "self", ",", "value", ")", ":", "self", ".", "_set", "(", "'del-header'", ",", "value", ",", "multi", "=", "True", ")", "return", "self", ".", "_section" ]
475407acb44199edbf7e0a66261bfeb51de1afae
train
Routing.header_collect
Store the specified response header in a request var (optionally removing it from the response). :param str|unicode name: :param str|unicode target_var: :param bool pull: Whether to remove header from response.
uwsgiconf/options/routing.py
def header_collect(self, name, target_var, pull=False): """Store the specified response header in a request var (optionally removing it from the response). :param str|unicode name: :param str|unicode target_var: :param bool pull: Whether to remove header from response. ...
def header_collect(self, name, target_var, pull=False): """Store the specified response header in a request var (optionally removing it from the response). :param str|unicode name: :param str|unicode target_var: :param bool pull: Whether to remove header from response. ...
[ "Store", "the", "specified", "response", "header", "in", "a", "request", "var", "(", "optionally", "removing", "it", "from", "the", "response", ")", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/routing.py#L396-L411
[ "def", "header_collect", "(", "self", ",", "name", ",", "target_var", ",", "pull", "=", "False", ")", ":", "self", ".", "_set", "(", "'pull-header'", "if", "pull", "else", "'collect-header'", ",", "'%s %s'", "%", "(", "name", ",", "target_var", ")", ",",...
475407acb44199edbf7e0a66261bfeb51de1afae
train
Statics.register_static_map
Allows mapping mountpoint to a static directory (or file). * http://uwsgi.readthedocs.io/en/latest/StaticFiles.html#mode-3-using-static-file-mount-points :param str|unicode mountpoint: :param str|unicode target: :param bool retain_resource_path: Append the requested resource to the d...
uwsgiconf/options/statics.py
def register_static_map(self, mountpoint, target, retain_resource_path=False, safe_target=False): """Allows mapping mountpoint to a static directory (or file). * http://uwsgi.readthedocs.io/en/latest/StaticFiles.html#mode-3-using-static-file-mount-points :param str|unicode mountpoint: ...
def register_static_map(self, mountpoint, target, retain_resource_path=False, safe_target=False): """Allows mapping mountpoint to a static directory (or file). * http://uwsgi.readthedocs.io/en/latest/StaticFiles.html#mode-3-using-static-file-mount-points :param str|unicode mountpoint: ...
[ "Allows", "mapping", "mountpoint", "to", "a", "static", "directory", "(", "or", "file", ")", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/statics.py#L92-L127
[ "def", "register_static_map", "(", "self", ",", "mountpoint", ",", "target", ",", "retain_resource_path", "=", "False", ",", "safe_target", "=", "False", ")", ":", "command", "=", "'static-map'", "if", "retain_resource_path", ":", "command", "+=", "'2'", "self",...
475407acb44199edbf7e0a66261bfeb51de1afae
train
Statics.add_expiration_rule
Adds statics expiration rule based on a criterion. :param str|unicode criterion: Criterion (subject) to base expiration on. See ``.expiration_criteria``. :param str|unicode|list[str|unicode] value: Value to test criteria upon. .. note:: Usually a regular expression. ...
uwsgiconf/options/statics.py
def add_expiration_rule(self, criterion, value, timeout, use_mod_time=False): """Adds statics expiration rule based on a criterion. :param str|unicode criterion: Criterion (subject) to base expiration on. See ``.expiration_criteria``. :param str|unicode|list[str|unicode] value: Va...
def add_expiration_rule(self, criterion, value, timeout, use_mod_time=False): """Adds statics expiration rule based on a criterion. :param str|unicode criterion: Criterion (subject) to base expiration on. See ``.expiration_criteria``. :param str|unicode|list[str|unicode] value: Va...
[ "Adds", "statics", "expiration", "rule", "based", "on", "a", "criterion", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/statics.py#L129-L163
[ "def", "add_expiration_rule", "(", "self", ",", "criterion", ",", "value", ",", "timeout", ",", "use_mod_time", "=", "False", ")", ":", "command", "=", "'static-expires'", "separator", "=", "' '", "if", "criterion", "!=", "self", ".", "expiration_criteria", "....
475407acb44199edbf7e0a66261bfeb51de1afae
train
Statics.set_paths_caching_params
Use the uWSGI caching subsystem to store mappings from URI to filesystem paths. * http://uwsgi.readthedocs.io/en/latest/StaticFiles.html#caching-paths-mappings-resolutions :param int timeout: Amount of seconds to put resolved paths in the uWSGI cache. :param str|unicode cache_name: Cache name...
uwsgiconf/options/statics.py
def set_paths_caching_params(self, timeout=None, cache_name=None): """Use the uWSGI caching subsystem to store mappings from URI to filesystem paths. * http://uwsgi.readthedocs.io/en/latest/StaticFiles.html#caching-paths-mappings-resolutions :param int timeout: Amount of seconds to put resolve...
def set_paths_caching_params(self, timeout=None, cache_name=None): """Use the uWSGI caching subsystem to store mappings from URI to filesystem paths. * http://uwsgi.readthedocs.io/en/latest/StaticFiles.html#caching-paths-mappings-resolutions :param int timeout: Amount of seconds to put resolve...
[ "Use", "the", "uWSGI", "caching", "subsystem", "to", "store", "mappings", "from", "URI", "to", "filesystem", "paths", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/statics.py#L168-L181
[ "def", "set_paths_caching_params", "(", "self", ",", "timeout", "=", "None", ",", "cache_name", "=", "None", ")", ":", "self", ".", "_set", "(", "'static-cache-paths'", ",", "timeout", ")", "self", ".", "_set", "(", "'static-cache-paths-name'", ",", "cache_nam...
475407acb44199edbf7e0a66261bfeb51de1afae
train
Networking.set_socket_params
Sets common socket params. :param int send_timeout: Send (write) timeout in seconds. :param bool keep_alive: Enable TCP KEEPALIVEs. :param bool no_defer_accept: Disable deferred ``accept()`` on sockets by default (where available) uWSGI will defer the accept() of requests until so...
uwsgiconf/options/networking.py
def set_socket_params( self, send_timeout=None, keep_alive=None, no_defer_accept=None, buffer_send=None, buffer_receive=None): """Sets common socket params. :param int send_timeout: Send (write) timeout in seconds. :param bool keep_alive: Enable TCP KEEPALIVEs. ...
def set_socket_params( self, send_timeout=None, keep_alive=None, no_defer_accept=None, buffer_send=None, buffer_receive=None): """Sets common socket params. :param int send_timeout: Send (write) timeout in seconds. :param bool keep_alive: Enable TCP KEEPALIVEs. ...
[ "Sets", "common", "socket", "params", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/networking.py#L56-L81
[ "def", "set_socket_params", "(", "self", ",", "send_timeout", "=", "None", ",", "keep_alive", "=", "None", ",", "no_defer_accept", "=", "None", ",", "buffer_send", "=", "None", ",", "buffer_receive", "=", "None", ")", ":", "self", ".", "_set", "(", "'so-se...
475407acb44199edbf7e0a66261bfeb51de1afae
train
Networking.set_unix_socket_params
Sets Unix-socket related params. :param bool abstract: Force UNIX socket into abstract mode (Linux only). :param str permissions: UNIX sockets are filesystem objects that obey UNIX permissions like any other filesystem object. You can set the UNIX sockets' permissions with thi...
uwsgiconf/options/networking.py
def set_unix_socket_params(self, abstract=None, permissions=None, owner=None, umask=None): """Sets Unix-socket related params. :param bool abstract: Force UNIX socket into abstract mode (Linux only). :param str permissions: UNIX sockets are filesystem objects that obey UNIX permiss...
def set_unix_socket_params(self, abstract=None, permissions=None, owner=None, umask=None): """Sets Unix-socket related params. :param bool abstract: Force UNIX socket into abstract mode (Linux only). :param str permissions: UNIX sockets are filesystem objects that obey UNIX permiss...
[ "Sets", "Unix", "-", "socket", "related", "params", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/networking.py#L83-L105
[ "def", "set_unix_socket_params", "(", "self", ",", "abstract", "=", "None", ",", "permissions", "=", "None", ",", "owner", "=", "None", ",", "umask", "=", "None", ")", ":", "self", ".", "_set", "(", "'abstract-socket'", ",", "abstract", ",", "cast", "=",...
475407acb44199edbf7e0a66261bfeb51de1afae
train
Networking.set_bsd_socket_params
Sets BSD-sockets related params. :param bool port_reuse: Enable REUSE_PORT flag on socket to allow multiple instances binding on the same address (BSD only).
uwsgiconf/options/networking.py
def set_bsd_socket_params(self, port_reuse=None): """Sets BSD-sockets related params. :param bool port_reuse: Enable REUSE_PORT flag on socket to allow multiple instances binding on the same address (BSD only). """ self._set('reuse-port', port_reuse, cast=bool) ret...
def set_bsd_socket_params(self, port_reuse=None): """Sets BSD-sockets related params. :param bool port_reuse: Enable REUSE_PORT flag on socket to allow multiple instances binding on the same address (BSD only). """ self._set('reuse-port', port_reuse, cast=bool) ret...
[ "Sets", "BSD", "-", "sockets", "related", "params", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/networking.py#L107-L116
[ "def", "set_bsd_socket_params", "(", "self", ",", "port_reuse", "=", "None", ")", ":", "self", ".", "_set", "(", "'reuse-port'", ",", "port_reuse", ",", "cast", "=", "bool", ")", "return", "self", ".", "_section" ]
475407acb44199edbf7e0a66261bfeb51de1afae
train
Networking.register_socket
Registers the given socket(s) for further use. :param Socket|list[Socket] socket: Socket type object. See ``.sockets``.
uwsgiconf/options/networking.py
def register_socket(self, socket): """Registers the given socket(s) for further use. :param Socket|list[Socket] socket: Socket type object. See ``.sockets``. """ sockets = self._sockets for socket in listify(socket): uses_shared = isinstance(socket.address, Socket...
def register_socket(self, socket): """Registers the given socket(s) for further use. :param Socket|list[Socket] socket: Socket type object. See ``.sockets``. """ sockets = self._sockets for socket in listify(socket): uses_shared = isinstance(socket.address, Socket...
[ "Registers", "the", "given", "socket", "(", "s", ")", "for", "further", "use", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/networking.py#L121-L158
[ "def", "register_socket", "(", "self", ",", "socket", ")", ":", "sockets", "=", "self", ".", "_sockets", "for", "socket", "in", "listify", "(", "socket", ")", ":", "uses_shared", "=", "isinstance", "(", "socket", ".", "address", ",", "SocketShared", ")", ...
475407acb44199edbf7e0a66261bfeb51de1afae
train
Networking.set_sni_params
Allows setting Server Name Identification (virtual hosting for SSL nodes) params. * http://uwsgi.readthedocs.io/en/latest/SNI.html :param str|unicode name: Node/server/host name. :param str|unicode cert: Certificate file. :param str|unicode key: Private key file. :param str|...
uwsgiconf/options/networking.py
def set_sni_params(self, name, cert, key, ciphers=None, client_ca=None, wildcard=False): """Allows setting Server Name Identification (virtual hosting for SSL nodes) params. * http://uwsgi.readthedocs.io/en/latest/SNI.html :param str|unicode name: Node/server/host name. :param str|uni...
def set_sni_params(self, name, cert, key, ciphers=None, client_ca=None, wildcard=False): """Allows setting Server Name Identification (virtual hosting for SSL nodes) params. * http://uwsgi.readthedocs.io/en/latest/SNI.html :param str|unicode name: Node/server/host name. :param str|uni...
[ "Allows", "setting", "Server", "Name", "Identification", "(", "virtual", "hosting", "for", "SSL", "nodes", ")", "params", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/networking.py#L206-L243
[ "def", "set_sni_params", "(", "self", ",", "name", ",", "cert", ",", "key", ",", "ciphers", "=", "None", ",", "client_ca", "=", "None", ",", "wildcard", "=", "False", ")", ":", "command", "=", "'sni'", "if", "wildcard", ":", "command", "+=", "'-regexp'...
475407acb44199edbf7e0a66261bfeb51de1afae
train
Networking.set_sni_dir_params
Enable checking for cert/key/client_ca file in the specified directory and create a sni/ssl context on demand. Expected filenames: * <sni-name>.crt * <sni-name>.key * <sni-name>.ca - this file is optional * http://uwsgi.readthedocs.io/en/latest/SNI.html#mass...
uwsgiconf/options/networking.py
def set_sni_dir_params(self, dir, ciphers=None): """Enable checking for cert/key/client_ca file in the specified directory and create a sni/ssl context on demand. Expected filenames: * <sni-name>.crt * <sni-name>.key * <sni-name>.ca - this file is optional ...
def set_sni_dir_params(self, dir, ciphers=None): """Enable checking for cert/key/client_ca file in the specified directory and create a sni/ssl context on demand. Expected filenames: * <sni-name>.crt * <sni-name>.key * <sni-name>.ca - this file is optional ...
[ "Enable", "checking", "for", "cert", "/", "key", "/", "client_ca", "file", "in", "the", "specified", "directory", "and", "create", "a", "sni", "/", "ssl", "context", "on", "demand", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/networking.py#L245-L271
[ "def", "set_sni_dir_params", "(", "self", ",", "dir", ",", "ciphers", "=", "None", ")", ":", "self", ".", "_set", "(", "'sni-dir'", ",", "dir", ")", "self", ".", "_set", "(", "'sni-dir-ciphers'", ",", "ciphers", ")", "return", "self", ".", "_section" ]
475407acb44199edbf7e0a66261bfeb51de1afae
train
Queue.enable
Enables shared queue of the given size. :param int size: Queue size. :param int block_size: Block size in bytes. Default: 8 KiB. :param str|unicode store: Persist the queue into file. :param int store_sync_interval: Store sync interval in master cycles (usually seconds).
uwsgiconf/options/queue.py
def enable(self, size, block_size=None, store=None, store_sync_interval=None): """Enables shared queue of the given size. :param int size: Queue size. :param int block_size: Block size in bytes. Default: 8 KiB. :param str|unicode store: Persist the queue into file. :param int...
def enable(self, size, block_size=None, store=None, store_sync_interval=None): """Enables shared queue of the given size. :param int size: Queue size. :param int block_size: Block size in bytes. Default: 8 KiB. :param str|unicode store: Persist the queue into file. :param int...
[ "Enables", "shared", "queue", "of", "the", "given", "size", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/queue.py#L15-L32
[ "def", "enable", "(", "self", ",", "size", ",", "block_size", "=", "None", ",", "store", "=", "None", ",", "store_sync_interval", "=", "None", ")", ":", "self", ".", "_set", "(", "'queue'", ",", "size", ")", "self", ".", "_set", "(", "'queue-blocksize'...
475407acb44199edbf7e0a66261bfeb51de1afae
train
Locks.set_basic_params
:param int count: Create the specified number of shared locks. :param bool thunder_lock: Serialize accept() usage (if possible) Could improve performance on Linux with robust pthread mutexes. http://uwsgi.readthedocs.io/en/latest/articles/SerializingAccept.html :param str|unic...
uwsgiconf/options/locks.py
def set_basic_params(self, count=None, thunder_lock=None, lock_engine=None): """ :param int count: Create the specified number of shared locks. :param bool thunder_lock: Serialize accept() usage (if possible) Could improve performance on Linux with robust pthread mutexes. ...
def set_basic_params(self, count=None, thunder_lock=None, lock_engine=None): """ :param int count: Create the specified number of shared locks. :param bool thunder_lock: Serialize accept() usage (if possible) Could improve performance on Linux with robust pthread mutexes. ...
[ ":", "param", "int", "count", ":", "Create", "the", "specified", "number", "of", "shared", "locks", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/locks.py#L11-L30
[ "def", "set_basic_params", "(", "self", ",", "count", "=", "None", ",", "thunder_lock", "=", "None", ",", "lock_engine", "=", "None", ")", ":", "self", ".", "_set", "(", "'thunder-lock'", ",", "thunder_lock", ",", "cast", "=", "bool", ")", "self", ".", ...
475407acb44199edbf7e0a66261bfeb51de1afae
train
Locks.set_ipcsem_params
Sets ipcsem lock engine params. :param str|unicode ftok: Set the ipcsem key via ftok() for avoiding duplicates. :param bool persistent: Do not remove ipcsem's on shutdown.
uwsgiconf/options/locks.py
def set_ipcsem_params(self, ftok=None, persistent=None): """Sets ipcsem lock engine params. :param str|unicode ftok: Set the ipcsem key via ftok() for avoiding duplicates. :param bool persistent: Do not remove ipcsem's on shutdown. """ self._set('ftok', ftok) self._set...
def set_ipcsem_params(self, ftok=None, persistent=None): """Sets ipcsem lock engine params. :param str|unicode ftok: Set the ipcsem key via ftok() for avoiding duplicates. :param bool persistent: Do not remove ipcsem's on shutdown. """ self._set('ftok', ftok) self._set...
[ "Sets", "ipcsem", "lock", "engine", "params", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/locks.py#L32-L43
[ "def", "set_ipcsem_params", "(", "self", ",", "ftok", "=", "None", ",", "persistent", "=", "None", ")", ":", "self", ".", "_set", "(", "'ftok'", ",", "ftok", ")", "self", ".", "_set", "(", "'persistent-ipcsem'", ",", "persistent", ",", "cast", "=", "bo...
475407acb44199edbf7e0a66261bfeb51de1afae
train
Locks.lock_file
Locks the specified file. :param str|unicode fpath: File path. :param bool after_setup: True - after logging/daemon setup False - before starting :param bool wait: True - wait if locked False - exit if locked
uwsgiconf/options/locks.py
def lock_file(self, fpath, after_setup=False, wait=False): """Locks the specified file. :param str|unicode fpath: File path. :param bool after_setup: True - after logging/daemon setup False - before starting :param bool wait: True - wait if locked...
def lock_file(self, fpath, after_setup=False, wait=False): """Locks the specified file. :param str|unicode fpath: File path. :param bool after_setup: True - after logging/daemon setup False - before starting :param bool wait: True - wait if locked...
[ "Locks", "the", "specified", "file", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/locks.py#L45-L66
[ "def", "lock_file", "(", "self", ",", "fpath", ",", "after_setup", "=", "False", ",", "wait", "=", "False", ")", ":", "command", "=", "'flock-wait'", "if", "wait", "else", "'flock'", "if", "after_setup", ":", "command", "=", "'%s2'", "%", "command", "sel...
475407acb44199edbf7e0a66261bfeb51de1afae
train
register_rpc
Decorator. Allows registering a function for RPC. * http://uwsgi.readthedocs.io/en/latest/RPC.html Example: .. code-block:: python @register_rpc() def expose_me(): do() :param str|unicode name: RPC function name to associate with decorated functi...
uwsgiconf/runtime/rpc.py
def register_rpc(name=None): """Decorator. Allows registering a function for RPC. * http://uwsgi.readthedocs.io/en/latest/RPC.html Example: .. code-block:: python @register_rpc() def expose_me(): do() :param str|unicode name: RPC function name to ass...
def register_rpc(name=None): """Decorator. Allows registering a function for RPC. * http://uwsgi.readthedocs.io/en/latest/RPC.html Example: .. code-block:: python @register_rpc() def expose_me(): do() :param str|unicode name: RPC function name to ass...
[ "Decorator", ".", "Allows", "registering", "a", "function", "for", "RPC", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/runtime/rpc.py#L7-L36
[ "def", "register_rpc", "(", "name", "=", "None", ")", ":", "def", "wrapper", "(", "func", ")", ":", "func_name", "=", "func", ".", "__name__", "rpc_name", "=", "name", "or", "func_name", "uwsgi", ".", "register_rpc", "(", "rpc_name", ",", "func", ")", ...
475407acb44199edbf7e0a66261bfeb51de1afae
train
make_rpc_call
Performs an RPC function call (local or remote) with the given arguments. :param str|unicode func_name: RPC function name to call. :param Iterable args: Function arguments. :param str|unicode remote: :rtype: bytes|str :raises ValueError: If unable to call RPC function.
uwsgiconf/runtime/rpc.py
def make_rpc_call(func_name, args=None, remote=None): """Performs an RPC function call (local or remote) with the given arguments. :param str|unicode func_name: RPC function name to call. :param Iterable args: Function arguments. :param str|unicode remote: :rtype: bytes|str :raises ValueErr...
def make_rpc_call(func_name, args=None, remote=None): """Performs an RPC function call (local or remote) with the given arguments. :param str|unicode func_name: RPC function name to call. :param Iterable args: Function arguments. :param str|unicode remote: :rtype: bytes|str :raises ValueErr...
[ "Performs", "an", "RPC", "function", "call", "(", "local", "or", "remote", ")", "with", "the", "given", "arguments", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/runtime/rpc.py#L39-L61
[ "def", "make_rpc_call", "(", "func_name", ",", "args", "=", "None", ",", "remote", "=", "None", ")", ":", "args", "=", "args", "or", "[", "]", "args", "=", "[", "encode", "(", "str", "(", "arg", ")", ")", "for", "arg", "in", "args", "]", "if", ...
475407acb44199edbf7e0a66261bfeb51de1afae
train
Empire.set_emperor_command_params
Emperor commands related parameters. * http://uwsgi-docs.readthedocs.io/en/latest/tutorials/EmperorSubscriptions.html :param str|unicode command_socket: Enable the Emperor command socket. It is a channel allowing external process to govern vassals. :param bool wait_for_command: Al...
uwsgiconf/options/empire.py
def set_emperor_command_params( self, command_socket=None, wait_for_command=None, wait_for_command_exclude=None): """Emperor commands related parameters. * http://uwsgi-docs.readthedocs.io/en/latest/tutorials/EmperorSubscriptions.html :param str|unicode command_socket: ...
def set_emperor_command_params( self, command_socket=None, wait_for_command=None, wait_for_command_exclude=None): """Emperor commands related parameters. * http://uwsgi-docs.readthedocs.io/en/latest/tutorials/EmperorSubscriptions.html :param str|unicode command_socket: ...
[ "Emperor", "commands", "related", "parameters", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/empire.py#L62-L81
[ "def", "set_emperor_command_params", "(", "self", ",", "command_socket", "=", "None", ",", "wait_for_command", "=", "None", ",", "wait_for_command_exclude", "=", "None", ")", ":", "self", ".", "_set", "(", "'emperor-command-socket'", ",", "command_socket", ")", "s...
475407acb44199edbf7e0a66261bfeb51de1afae
train
Empire.set_vassals_wrapper_params
Binary wrapper for vassals parameters. :param str|unicode wrapper: Set a binary wrapper for vassals. :param str|unicode|list[str|unicode] overrides: Set a binary wrapper for vassals to try before the default one :param str|unicode|list[str|unicode] fallbacks: Set a binary wrapper for vassals ...
uwsgiconf/options/empire.py
def set_vassals_wrapper_params(self, wrapper=None, overrides=None, fallbacks=None): """Binary wrapper for vassals parameters. :param str|unicode wrapper: Set a binary wrapper for vassals. :param str|unicode|list[str|unicode] overrides: Set a binary wrapper for vassals to try before the default...
def set_vassals_wrapper_params(self, wrapper=None, overrides=None, fallbacks=None): """Binary wrapper for vassals parameters. :param str|unicode wrapper: Set a binary wrapper for vassals. :param str|unicode|list[str|unicode] overrides: Set a binary wrapper for vassals to try before the default...
[ "Binary", "wrapper", "for", "vassals", "parameters", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/empire.py#L83-L99
[ "def", "set_vassals_wrapper_params", "(", "self", ",", "wrapper", "=", "None", ",", "overrides", "=", "None", ",", "fallbacks", "=", "None", ")", ":", "self", ".", "_set", "(", "'emperor-wrapper'", ",", "wrapper", ")", "self", ".", "_set", "(", "'emperor-w...
475407acb44199edbf7e0a66261bfeb51de1afae
train
Empire.set_throttle_params
Throttling options. * http://uwsgi-docs.readthedocs.io/en/latest/Emperor.html#throttling * http://uwsgi-docs.readthedocs.io/en/latest/Emperor.html#loyalty :param int level: Set throttling level (in milliseconds) for bad behaving vassals. Default: 1000. :param int level_max: Set maximu...
uwsgiconf/options/empire.py
def set_throttle_params(self, level=None, level_max=None): """Throttling options. * http://uwsgi-docs.readthedocs.io/en/latest/Emperor.html#throttling * http://uwsgi-docs.readthedocs.io/en/latest/Emperor.html#loyalty :param int level: Set throttling level (in milliseconds) for bad beha...
def set_throttle_params(self, level=None, level_max=None): """Throttling options. * http://uwsgi-docs.readthedocs.io/en/latest/Emperor.html#throttling * http://uwsgi-docs.readthedocs.io/en/latest/Emperor.html#loyalty :param int level: Set throttling level (in milliseconds) for bad beha...
[ "Throttling", "options", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/empire.py#L101-L116
[ "def", "set_throttle_params", "(", "self", ",", "level", "=", "None", ",", "level_max", "=", "None", ")", ":", "self", ".", "_set", "(", "'emperor-throttle'", ",", "level", ")", "self", ".", "_set", "(", "'emperor-max-throttle'", ",", "level_max", ")", "re...
475407acb44199edbf7e0a66261bfeb51de1afae
train
Empire.set_tolerance_params
Various tolerance options. :param int for_heartbeat: Set the Emperor tolerance about heartbeats. * http://uwsgi-docs.readthedocs.io/en/latest/Emperor.html#heartbeat-system :param int for_cursed_vassals: Set the Emperor tolerance about cursed vassals. * http://uwsgi-docs.readt...
uwsgiconf/options/empire.py
def set_tolerance_params(self, for_heartbeat=None, for_cursed_vassals=None): """Various tolerance options. :param int for_heartbeat: Set the Emperor tolerance about heartbeats. * http://uwsgi-docs.readthedocs.io/en/latest/Emperor.html#heartbeat-system :param int for_cursed_vassals...
def set_tolerance_params(self, for_heartbeat=None, for_cursed_vassals=None): """Various tolerance options. :param int for_heartbeat: Set the Emperor tolerance about heartbeats. * http://uwsgi-docs.readthedocs.io/en/latest/Emperor.html#heartbeat-system :param int for_cursed_vassals...
[ "Various", "tolerance", "options", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/empire.py#L118-L133
[ "def", "set_tolerance_params", "(", "self", ",", "for_heartbeat", "=", "None", ",", "for_cursed_vassals", "=", "None", ")", ":", "self", ".", "_set", "(", "'emperor-required-heartbeat'", ",", "for_heartbeat", ")", "self", ".", "_set", "(", "'emperor-curse-toleranc...
475407acb44199edbf7e0a66261bfeb51de1afae
train
Empire.set_mode_tyrant_params
Tyrant mode (secure multi-user hosting). In Tyrant mode the Emperor will run the vassal using the UID/GID of the vassal configuration file. * http://uwsgi-docs.readthedocs.io/en/latest/Emperor.html#tyrant-mode-secure-multi-user-hosting :param enable: Puts the Emperor in Tyrant mode. ...
uwsgiconf/options/empire.py
def set_mode_tyrant_params(self, enable=None, links_no_follow=None, use_initgroups=None): """Tyrant mode (secure multi-user hosting). In Tyrant mode the Emperor will run the vassal using the UID/GID of the vassal configuration file. * http://uwsgi-docs.readthedocs.io/en/latest/Emperor....
def set_mode_tyrant_params(self, enable=None, links_no_follow=None, use_initgroups=None): """Tyrant mode (secure multi-user hosting). In Tyrant mode the Emperor will run the vassal using the UID/GID of the vassal configuration file. * http://uwsgi-docs.readthedocs.io/en/latest/Emperor....
[ "Tyrant", "mode", "(", "secure", "multi", "-", "user", "hosting", ")", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/empire.py#L135-L154
[ "def", "set_mode_tyrant_params", "(", "self", ",", "enable", "=", "None", ",", "links_no_follow", "=", "None", ",", "use_initgroups", "=", "None", ")", ":", "self", ".", "_set", "(", "'emperor-tyrant'", ",", "enable", ",", "cast", "=", "bool", ")", "self",...
475407acb44199edbf7e0a66261bfeb51de1afae
train
Empire.set_mode_broodlord_params
This mode is a way for a vassal to ask for reinforcements to the Emperor. Reinforcements are new vassals spawned on demand generally bound on the same socket. .. warning:: If you are looking for a way to dynamically adapt the number of workers of an instance, check the Cheaper subsystem - ...
uwsgiconf/options/empire.py
def set_mode_broodlord_params( self, zerg_count=None, vassal_overload_sos_interval=None, vassal_queue_items_sos=None): """This mode is a way for a vassal to ask for reinforcements to the Emperor. Reinforcements are new vassals spawned on demand generally bound on the same socket...
def set_mode_broodlord_params( self, zerg_count=None, vassal_overload_sos_interval=None, vassal_queue_items_sos=None): """This mode is a way for a vassal to ask for reinforcements to the Emperor. Reinforcements are new vassals spawned on demand generally bound on the same socket...
[ "This", "mode", "is", "a", "way", "for", "a", "vassal", "to", "ask", "for", "reinforcements", "to", "the", "Emperor", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/empire.py#L156-L181
[ "def", "set_mode_broodlord_params", "(", "self", ",", "zerg_count", "=", "None", ",", "vassal_overload_sos_interval", "=", "None", ",", "vassal_queue_items_sos", "=", "None", ")", ":", "self", ".", "_set", "(", "'emperor-broodlord'", ",", "zerg_count", ")", "self"...
475407acb44199edbf7e0a66261bfeb51de1afae
train
Workers.run_command_as_worker
Run the specified command as worker. :param str|unicode command: :param bool after_post_fork_hook: Whether to run it after `post_fork` hook.
uwsgiconf/options/workers.py
def run_command_as_worker(self, command, after_post_fork_hook=False): """Run the specified command as worker. :param str|unicode command: :param bool after_post_fork_hook: Whether to run it after `post_fork` hook. """ self._set('worker-exec2' if after_post_fork_hook else 'work...
def run_command_as_worker(self, command, after_post_fork_hook=False): """Run the specified command as worker. :param str|unicode command: :param bool after_post_fork_hook: Whether to run it after `post_fork` hook. """ self._set('worker-exec2' if after_post_fork_hook else 'work...
[ "Run", "the", "specified", "command", "as", "worker", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/workers.py#L106-L116
[ "def", "run_command_as_worker", "(", "self", ",", "command", ",", "after_post_fork_hook", "=", "False", ")", ":", "self", ".", "_set", "(", "'worker-exec2'", "if", "after_post_fork_hook", "else", "'worker-exec'", ",", "command", ",", "multi", "=", "True", ")", ...
475407acb44199edbf7e0a66261bfeb51de1afae
train
Workers.set_count_auto
Sets workers count. By default sets it to detected number of available cores :param int count:
uwsgiconf/options/workers.py
def set_count_auto(self, count=None): """Sets workers count. By default sets it to detected number of available cores :param int count: """ count = count or self._section.vars.CPU_CORES self._set('workers', count) return self._section
def set_count_auto(self, count=None): """Sets workers count. By default sets it to detected number of available cores :param int count: """ count = count or self._section.vars.CPU_CORES self._set('workers', count) return self._section
[ "Sets", "workers", "count", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/workers.py#L118-L129
[ "def", "set_count_auto", "(", "self", ",", "count", "=", "None", ")", ":", "count", "=", "count", "or", "self", ".", "_section", ".", "vars", ".", "CPU_CORES", "self", ".", "_set", "(", "'workers'", ",", "count", ")", "return", "self", ".", "_section" ...
475407acb44199edbf7e0a66261bfeb51de1afae
train
Workers.set_thread_params
Sets threads related params. :param bool enable: Enable threads in the embedded languages. This will allow to spawn threads in your app. .. warning:: Threads will simply *not work* if this option is not enabled. There will likely be no error, just no execution of your t...
uwsgiconf/options/workers.py
def set_thread_params( self, enable=None, count=None, count_offload=None, stack_size=None, no_wait=None): """Sets threads related params. :param bool enable: Enable threads in the embedded languages. This will allow to spawn threads in your app. .. warning:: Threads...
def set_thread_params( self, enable=None, count=None, count_offload=None, stack_size=None, no_wait=None): """Sets threads related params. :param bool enable: Enable threads in the embedded languages. This will allow to spawn threads in your app. .. warning:: Threads...
[ "Sets", "threads", "related", "params", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/workers.py#L131-L174
[ "def", "set_thread_params", "(", "self", ",", "enable", "=", "None", ",", "count", "=", "None", ",", "count_offload", "=", "None", ",", "stack_size", "=", "None", ",", "no_wait", "=", "None", ")", ":", "self", ".", "_set", "(", "'enable-threads'", ",", ...
475407acb44199edbf7e0a66261bfeb51de1afae
train
Workers.set_mules_params
Sets mules related params. http://uwsgi.readthedocs.io/en/latest/Mules.html Mules are worker processes living in the uWSGI stack but not reachable via socket connections, that can be used as a generic subsystem to offload tasks. :param int|list mules: Add the specified mules or number...
uwsgiconf/options/workers.py
def set_mules_params( self, mules=None, touch_reload=None, harakiri_timeout=None, farms=None, reload_mercy=None, msg_buffer=None, msg_buffer_recv=None): """Sets mules related params. http://uwsgi.readthedocs.io/en/latest/Mules.html Mules are worker processes living in t...
def set_mules_params( self, mules=None, touch_reload=None, harakiri_timeout=None, farms=None, reload_mercy=None, msg_buffer=None, msg_buffer_recv=None): """Sets mules related params. http://uwsgi.readthedocs.io/en/latest/Mules.html Mules are worker processes living in t...
[ "Sets", "mules", "related", "params", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/workers.py#L176-L241
[ "def", "set_mules_params", "(", "self", ",", "mules", "=", "None", ",", "touch_reload", "=", "None", ",", "harakiri_timeout", "=", "None", ",", "farms", "=", "None", ",", "reload_mercy", "=", "None", ",", "msg_buffer", "=", "None", ",", "msg_buffer_recv", ...
475407acb44199edbf7e0a66261bfeb51de1afae
train
Workers.set_reload_params
Sets workers reload parameters. :param int min_lifetime: A worker cannot be destroyed/reloaded unless it has been alive for N seconds (default 60). This is an anti-fork-bomb measure. Since 1.9 :param int max_lifetime: Reload workers after this many seconds. Disabled by default....
uwsgiconf/options/workers.py
def set_reload_params( self, min_lifetime=None, max_lifetime=None, max_requests=None, max_requests_delta=None, max_addr_space=None, max_rss=None, max_uss=None, max_pss=None, max_addr_space_forced=None, max_rss_forced=None, watch_interval_forced=None, mercy=Non...
def set_reload_params( self, min_lifetime=None, max_lifetime=None, max_requests=None, max_requests_delta=None, max_addr_space=None, max_rss=None, max_uss=None, max_pss=None, max_addr_space_forced=None, max_rss_forced=None, watch_interval_forced=None, mercy=Non...
[ "Sets", "workers", "reload", "parameters", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/workers.py#L243-L319
[ "def", "set_reload_params", "(", "self", ",", "min_lifetime", "=", "None", ",", "max_lifetime", "=", "None", ",", "max_requests", "=", "None", ",", "max_requests_delta", "=", "None", ",", "max_addr_space", "=", "None", ",", "max_rss", "=", "None", ",", "max_...
475407acb44199edbf7e0a66261bfeb51de1afae
train
Workers.set_reload_on_exception_params
Sets workers reload on exceptions parameters. :param bool do_reload: Reload a worker when an exception is raised. :param str etype: Reload a worker when a specific exception type is raised. :param str evalue: Reload a worker when a specific exception value is raised. :param str erepr...
uwsgiconf/options/workers.py
def set_reload_on_exception_params(self, do_reload=None, etype=None, evalue=None, erepr=None): """Sets workers reload on exceptions parameters. :param bool do_reload: Reload a worker when an exception is raised. :param str etype: Reload a worker when a specific exception type is raised. ...
def set_reload_on_exception_params(self, do_reload=None, etype=None, evalue=None, erepr=None): """Sets workers reload on exceptions parameters. :param bool do_reload: Reload a worker when an exception is raised. :param str etype: Reload a worker when a specific exception type is raised. ...
[ "Sets", "workers", "reload", "on", "exceptions", "parameters", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/workers.py#L321-L338
[ "def", "set_reload_on_exception_params", "(", "self", ",", "do_reload", "=", "None", ",", "etype", "=", "None", ",", "evalue", "=", "None", ",", "erepr", "=", "None", ")", ":", "self", ".", "_set", "(", "'reload-on-exception'", ",", "do_reload", ",", "cast...
475407acb44199edbf7e0a66261bfeb51de1afae
train
Workers.set_harakiri_params
Sets workers harakiri parameters. :param int timeout: Harakiri timeout in seconds. Every request that will take longer than the seconds specified in the harakiri timeout will be dropped and the corresponding worker is thereafter recycled. :param bool verbose: Haraki...
uwsgiconf/options/workers.py
def set_harakiri_params(self, timeout=None, verbose=None, disable_for_arh=None): """Sets workers harakiri parameters. :param int timeout: Harakiri timeout in seconds. Every request that will take longer than the seconds specified in the harakiri timeout will be dropped and the c...
def set_harakiri_params(self, timeout=None, verbose=None, disable_for_arh=None): """Sets workers harakiri parameters. :param int timeout: Harakiri timeout in seconds. Every request that will take longer than the seconds specified in the harakiri timeout will be dropped and the c...
[ "Sets", "workers", "harakiri", "parameters", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/workers.py#L340-L360
[ "def", "set_harakiri_params", "(", "self", ",", "timeout", "=", "None", ",", "verbose", "=", "None", ",", "disable_for_arh", "=", "None", ")", ":", "self", ".", "_set", "(", "'harakiri'", ",", "timeout", ")", "self", ".", "_set", "(", "'harakiri-verbose'",...
475407acb44199edbf7e0a66261bfeb51de1afae
train
Workers.set_zerg_server_params
Zerg mode. Zerg server params. When your site load is variable, it would be nice to be able to add workers dynamically. Enabling Zerg mode you can allow zerg clients to attach to your already running server and help it in the work. * http://uwsgi-docs.readthedocs.io/en/latest/Zerg.html...
uwsgiconf/options/workers.py
def set_zerg_server_params(self, socket, clients_socket_pool=None): """Zerg mode. Zerg server params. When your site load is variable, it would be nice to be able to add workers dynamically. Enabling Zerg mode you can allow zerg clients to attach to your already running server and help ...
def set_zerg_server_params(self, socket, clients_socket_pool=None): """Zerg mode. Zerg server params. When your site load is variable, it would be nice to be able to add workers dynamically. Enabling Zerg mode you can allow zerg clients to attach to your already running server and help ...
[ "Zerg", "mode", ".", "Zerg", "server", "params", "." ]
idlesign/uwsgiconf
python
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/workers.py#L362-L392
[ "def", "set_zerg_server_params", "(", "self", ",", "socket", ",", "clients_socket_pool", "=", "None", ")", ":", "if", "clients_socket_pool", ":", "self", ".", "_set", "(", "'zergpool'", ",", "'%s:%s'", "%", "(", "socket", ",", "','", ".", "join", "(", "lis...
475407acb44199edbf7e0a66261bfeb51de1afae