Search is not available for this dataset
identifier
stringlengths
1
155
parameters
stringlengths
2
6.09k
docstring
stringlengths
11
63.4k
docstring_summary
stringlengths
0
63.4k
function
stringlengths
29
99.8k
function_tokens
list
start_point
list
end_point
list
language
stringclasses
1 value
docstring_language
stringlengths
2
7
docstring_language_predictions
stringlengths
18
23
is_langid_reliable
stringclasses
2 values
EvCell.get_min_height
(self)
Get the minimum possible height of cell, including at least one line for data. Returns: min_height (int): The mininum height of cell.
Get the minimum possible height of cell, including at least one line for data.
def get_min_height(self): """ Get the minimum possible height of cell, including at least one line for data. Returns: min_height (int): The mininum height of cell. """ return self.pad_top + self.pad_bottom + self.border_bottom + self.border_top + 1
[ "def", "get_min_height", "(", "self", ")", ":", "return", "self", ".", "pad_top", "+", "self", ".", "pad_bottom", "+", "self", ".", "border_bottom", "+", "self", ".", "border_top", "+", "1" ]
[ 682, 4 ]
[ 691, 88 ]
python
en
['en', 'error', 'th']
False
EvCell.get_min_width
(self)
Get the minimum possible width of cell, including at least one character-width for data. Returns: min_width (int): The minimum width of cell.
Get the minimum possible width of cell, including at least one character-width for data.
def get_min_width(self): """ Get the minimum possible width of cell, including at least one character-width for data. Returns: min_width (int): The minimum width of cell. """ return self.pad_left + self.pad_right + self.border_left + self.border_right + 1
[ "def", "get_min_width", "(", "self", ")", ":", "return", "self", ".", "pad_left", "+", "self", ".", "pad_right", "+", "self", ".", "border_left", "+", "self", ".", "border_right", "+", "1" ]
[ 693, 4 ]
[ 702, 88 ]
python
en
['en', 'error', 'th']
False
EvCell.get_height
(self)
Get natural height of cell, including padding. Returns: natural_height (int): Height of cell.
Get natural height of cell, including padding.
def get_height(self): """ Get natural height of cell, including padding. Returns: natural_height (int): Height of cell. """ return len(self.formatted)
[ "def", "get_height", "(", "self", ")", ":", "return", "len", "(", "self", ".", "formatted", ")" ]
[ 704, 4 ]
[ 712, 34 ]
python
en
['en', 'error', 'th']
False
EvCell.get_width
(self)
Get natural width of cell, including padding. Returns: natural_width (int): Width of cell.
Get natural width of cell, including padding.
def get_width(self): """ Get natural width of cell, including padding. Returns: natural_width (int): Width of cell. """ return m_len(self.formatted[0])
[ "def", "get_width", "(", "self", ")", ":", "return", "m_len", "(", "self", ".", "formatted", "[", "0", "]", ")" ]
[ 714, 4 ]
[ 722, 39 ]
python
en
['en', 'error', 'th']
False
EvCell.replace_data
(self, data, **kwargs)
Replace cell data. This causes a full reformat of the cell. Args: data (str): Cell data. Notes: The available keyword arguments are the same as for `EvCell.__init__`.
Replace cell data. This causes a full reformat of the cell.
def replace_data(self, data, **kwargs): """ Replace cell data. This causes a full reformat of the cell. Args: data (str): Cell data. Notes: The available keyword arguments are the same as for `EvCell.__init__`. """ # self.data = self...
[ "def", "replace_data", "(", "self", ",", "data", ",", "*", "*", "kwargs", ")", ":", "# self.data = self._split_lines(unicode(data))", "self", ".", "data", "=", "self", ".", "_split_lines", "(", "_to_ansi", "(", "data", ")", ")", "self", ".", "raw_width", "="...
[ 724, 4 ]
[ 740, 31 ]
python
en
['en', 'error', 'th']
False
EvCell.reformat
(self, **kwargs)
Reformat the EvCell with new options Kwargs: The available keyword arguments are the same as for `EvCell.__init__`. Raises: Exception: If the cells cannot shrink enough to accomodate the options or the data given.
Reformat the EvCell with new options
def reformat(self, **kwargs): """ Reformat the EvCell with new options Kwargs: The available keyword arguments are the same as for `EvCell.__init__`. Raises: Exception: If the cells cannot shrink enough to accomodate the options or the data given...
[ "def", "reformat", "(", "self", ",", "*", "*", "kwargs", ")", ":", "# keywords that require manipulation", "padwidth", "=", "kwargs", ".", "get", "(", "\"pad_width\"", ",", "None", ")", "padwidth", "=", "int", "(", "padwidth", ")", "if", "padwidth", "is", ...
[ 742, 4 ]
[ 831, 41 ]
python
en
['en', 'error', 'th']
False
EvCell.get
(self)
Get data, padded and aligned in the form of a list of lines.
Get data, padded and aligned in the form of a list of lines.
def get(self): """ Get data, padded and aligned in the form of a list of lines. """ self.formatted = self._reformat() return self.formatted
[ "def", "get", "(", "self", ")", ":", "self", ".", "formatted", "=", "self", ".", "_reformat", "(", ")", "return", "self", ".", "formatted" ]
[ 833, 4 ]
[ 839, 29 ]
python
en
['en', 'error', 'th']
False
EvCell.__str__
(self)
returns cell contents on string form
returns cell contents on string form
def __str__(self): "returns cell contents on string form" self.formatted = self._reformat() return str(unicode(ANSIString("\n").join(self.formatted)))
[ "def", "__str__", "(", "self", ")", ":", "self", ".", "formatted", "=", "self", ".", "_reformat", "(", ")", "return", "str", "(", "unicode", "(", "ANSIString", "(", "\"\\n\"", ")", ".", "join", "(", "self", ".", "formatted", ")", ")", ")" ]
[ 845, 4 ]
[ 848, 66 ]
python
en
['en', 'en', 'en']
True
EvCell.__unicode__
(self)
returns cell contents
returns cell contents
def __unicode__(self): "returns cell contents" self.formatted = self._reformat() return unicode(ANSIString("\n").join(self.formatted))
[ "def", "__unicode__", "(", "self", ")", ":", "self", ".", "formatted", "=", "self", ".", "_reformat", "(", ")", "return", "unicode", "(", "ANSIString", "(", "\"\\n\"", ")", ".", "join", "(", "self", ".", "formatted", ")", ")" ]
[ 850, 4 ]
[ 853, 61 ]
python
en
['en', 'en', 'en']
True
EvColumn.__init__
(self, *args, **kwargs)
Args: Text for each row in the column Kwargs: All `EvCell.__init_` keywords are available, these settings will be persistently applied to every Cell in the column.
Args: Text for each row in the column
def __init__(self, *args, **kwargs): """ Args: Text for each row in the column Kwargs: All `EvCell.__init_` keywords are available, these settings will be persistently applied to every Cell in the column. """ self.options = kwargs...
[ "def", "__init__", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "options", "=", "kwargs", "# column-specific options", "self", ".", "column", "=", "[", "EvCell", "(", "data", ",", "*", "*", "kwargs", ")", "for", "dat...
[ 869, 4 ]
[ 881, 63 ]
python
en
['en', 'error', 'th']
False
EvColumn._balance
(self, **kwargs)
Make sure to adjust the width of all cells so we form a coherent and lined-up column. Will enforce column-specific options to cells. Kwargs: Extra keywords to modify the column setting. Same keywords as in `EvCell.__init__`.
Make sure to adjust the width of all cells so we form a coherent and lined-up column. Will enforce column-specific options to cells.
def _balance(self, **kwargs): """ Make sure to adjust the width of all cells so we form a coherent and lined-up column. Will enforce column-specific options to cells. Kwargs: Extra keywords to modify the column setting. Same keywords as in `EvCell.__init_...
[ "def", "_balance", "(", "self", ",", "*", "*", "kwargs", ")", ":", "col", "=", "self", ".", "column", "# fixed options for the column will override those requested in the call!", "# this is particularly relevant to things like width/height, to avoid", "# fixed-widths columns from b...
[ 883, 4 ]
[ 903, 49 ]
python
en
['en', 'error', 'th']
False
EvColumn.add_rows
(self, *args, **kwargs)
Add new cells to column. They will be inserted as a series of rows. It will inherit the options of the rest of the column's cells (use update to change options). Args: Texts for the new cells ypos (int, optional): Index position in table before which to ...
Add new cells to column. They will be inserted as a series of rows. It will inherit the options of the rest of the column's cells (use update to change options).
def add_rows(self, *args, **kwargs): """ Add new cells to column. They will be inserted as a series of rows. It will inherit the options of the rest of the column's cells (use update to change options). Args: Texts for the new cells ypos (int, opt...
[ "def", "add_rows", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "ypos", "=", "kwargs", ".", "get", "(", "\"ypos\"", ",", "None", ")", "if", "ypos", "is", "None", "or", "ypos", ">", "len", "(", "self", ".", "column", ")", ":...
[ 905, 4 ]
[ 931, 77 ]
python
en
['en', 'error', 'th']
False
EvColumn.reformat
(self, **kwargs)
Change the options for the column. Kwargs: Keywords as per `EvCell.__init__`.
Change the options for the column.
def reformat(self, **kwargs): """ Change the options for the column. Kwargs: Keywords as per `EvCell.__init__`. """ self._balance(**kwargs)
[ "def", "reformat", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_balance", "(", "*", "*", "kwargs", ")" ]
[ 934, 4 ]
[ 942, 31 ]
python
en
['en', 'error', 'th']
False
EvColumn.reformat_cell
(self, index, **kwargs)
reformat cell at given index, keeping column options if necessary. Args: index (int): Index location of the cell in the column, starting from 0 for the first row to Nrows-1. Kwargs: Keywords as per `EvCell.__init__`.
reformat cell at given index, keeping column options if necessary.
def reformat_cell(self, index, **kwargs): """ reformat cell at given index, keeping column options if necessary. Args: index (int): Index location of the cell in the column, starting from 0 for the first row to Nrows-1. Kwargs: Keywords a...
[ "def", "reformat_cell", "(", "self", ",", "index", ",", "*", "*", "kwargs", ")", ":", "kwargs", ".", "update", "(", "self", ".", "options", ")", "self", ".", "column", "[", "index", "]", ".", "reformat", "(", "*", "*", "kwargs", ")" ]
[ 944, 4 ]
[ 958, 45 ]
python
en
['en', 'error', 'th']
False
EvTable.__init__
(self, *args, **kwargs)
Args: Header texts for the table. Kwargs: table (list of lists or list of `EvColumns`, optional): This is used to build the table in a quick way. If not given, the table will start out empty and `add_` methods need to be used to ...
Args: Header texts for the table.
def __init__(self, *args, **kwargs): """ Args: Header texts for the table. Kwargs: table (list of lists or list of `EvColumns`, optional): This is used to build the table in a quick way. If not given, the table will start out empty and `a...
[ "def", "__init__", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# at this point table is a 2D grid - a list of columns", "# x is the column position, y the row", "table", "=", "kwargs", ".", "pop", "(", "\"table\"", ",", "[", "]", ")", "# hea...
[ 987, 4 ]
[ 1117, 29 ]
python
en
['en', 'error', 'th']
False
EvTable._cellborders
(self, ix, iy, nx, ny, **kwargs)
Adds borders to the table by adjusting the input kwarg to instruct cells to build a border in the right positions. Args: ix (int): x index positions in table. iy (int): y index positions in table. nx (int): x size of table. ny (int): y size of ta...
Adds borders to the table by adjusting the input kwarg to instruct cells to build a border in the right positions.
def _cellborders(self, ix, iy, nx, ny, **kwargs): """ Adds borders to the table by adjusting the input kwarg to instruct cells to build a border in the right positions. Args: ix (int): x index positions in table. iy (int): y index positions in table. ...
[ "def", "_cellborders", "(", "self", ",", "ix", ",", "iy", ",", "nx", ",", "ny", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "kwargs", ".", "copy", "(", ")", "# handle the various border modes", "border", "=", "self", ".", "border", "header", "=", ...
[ 1122, 4 ]
[ 1228, 18 ]
python
en
['en', 'error', 'th']
False
EvTable._borders
(self)
Add borders to table. This is called from self._balance.
Add borders to table. This is called from self._balance.
def _borders(self): """ Add borders to table. This is called from self._balance. """ nx, ny = self.ncols - 1, self.nrows - 1 options = self.options for ix, col in enumerate(self.worktable): for iy, cell in enumerate(col): col.reformat_cell(iy, ...
[ "def", "_borders", "(", "self", ")", ":", "nx", ",", "ny", "=", "self", ".", "ncols", "-", "1", ",", "self", ".", "nrows", "-", "1", "options", "=", "self", ".", "options", "for", "ix", ",", "col", "in", "enumerate", "(", "self", ".", "worktable"...
[ 1230, 4 ]
[ 1238, 85 ]
python
en
['en', 'error', 'th']
False
EvTable._balance
(self)
Balance the table. This means to make sure all cells on the same row have the same height, that all columns have the same number of rows and that the table fits within the given width.
Balance the table. This means to make sure all cells on the same row have the same height, that all columns have the same number of rows and that the table fits within the given width.
def _balance(self): """ Balance the table. This means to make sure all cells on the same row have the same height, that all columns have the same number of rows and that the table fits within the given width. """ # we make all modifications on a working copy of t...
[ "def", "_balance", "(", "self", ")", ":", "# we make all modifications on a working copy of the", "# actual table. This allows us to add columns/rows", "# and re-balance over and over without issue.", "self", ".", "worktable", "=", "deepcopy", "(", "self", ".", "table", ")", "#...
[ 1240, 4 ]
[ 1418, 36 ]
python
en
['en', 'error', 'th']
False
EvTable._generate_lines
(self)
Generates lines across all columns (each cell may contain multiple lines) This will also balance the table.
Generates lines across all columns (each cell may contain multiple lines) This will also balance the table.
def _generate_lines(self): """ Generates lines across all columns (each cell may contain multiple lines) This will also balance the table. """ self._balance() for iy in range(self.nrows): cell_row = [col[iy] for col in self.worktable] # thi...
[ "def", "_generate_lines", "(", "self", ")", ":", "self", ".", "_balance", "(", ")", "for", "iy", "in", "range", "(", "self", ".", "nrows", ")", ":", "cell_row", "=", "[", "col", "[", "iy", "]", "for", "col", "in", "self", ".", "worktable", "]", "...
[ 1420, 4 ]
[ 1433, 94 ]
python
en
['en', 'error', 'th']
False
EvTable.add_header
(self, *args, **kwargs)
Add header to table. This is a number of texts to be put at the top of the table. They will replace an existing header. Args: args (str): These strings will be used as the header texts. Kwargs: Same keywords as per `EvTable.__init__`. Will be applied ...
Add header to table. This is a number of texts to be put at the top of the table. They will replace an existing header.
def add_header(self, *args, **kwargs): """ Add header to table. This is a number of texts to be put at the top of the table. They will replace an existing header. Args: args (str): These strings will be used as the header texts. Kwargs: Same keywords as ...
[ "def", "add_header", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "header", "=", "True", "self", ".", "add_row", "(", "ypos", "=", "0", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
[ 1435, 4 ]
[ 1449, 45 ]
python
en
['en', 'error', 'th']
False
EvTable.add_column
(self, *args, **kwargs)
Add a column to table. If there are more rows in new column than there are rows in the current table, the table will expand with empty rows in the other columns. If too few, the new column with get new empty rows. All filling rows are added to the end. Args: ...
Add a column to table. If there are more rows in new column than there are rows in the current table, the table will expand with empty rows in the other columns. If too few, the new column with get new empty rows. All filling rows are added to the end.
def add_column(self, *args, **kwargs): """ Add a column to table. If there are more rows in new column than there are rows in the current table, the table will expand with empty rows in the other columns. If too few, the new column with get new empty rows. All filling rows are ad...
[ "def", "add_column", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# this will replace default options with new ones without changing default", "options", "=", "dict", "(", "listitems", "(", "self", ".", "options", ")", "+", "listitems", "(", ...
[ 1451, 4 ]
[ 1512, 23 ]
python
en
['en', 'error', 'th']
False
EvTable.add_row
(self, *args, **kwargs)
Add a row to table (not a header). If there are more cells in the given row than there are cells in the current table the table will be expanded with empty columns to match. These will be added to the end of the table. In the same way, adding a line with too few cells will lead ...
Add a row to table (not a header). If there are more cells in the given row than there are cells in the current table the table will be expanded with empty columns to match. These will be added to the end of the table. In the same way, adding a line with too few cells will lead ...
def add_row(self, *args, **kwargs): """ Add a row to table (not a header). If there are more cells in the given row than there are cells in the current table the table will be expanded with empty columns to match. These will be added to the end of the table. In the same way, addi...
[ "def", "add_row", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# this will replace default options with new ones without changing default", "row", "=", "list", "(", "args", ")", "options", "=", "dict", "(", "listitems", "(", "self", ".", ...
[ 1515, 4 ]
[ 1563, 23 ]
python
en
['en', 'error', 'th']
False
EvTable.reformat
(self, **kwargs)
Force a re-shape of the entire table. Kwargs: Table options as per `EvTable.__init__`.
Force a re-shape of the entire table.
def reformat(self, **kwargs): """ Force a re-shape of the entire table. Kwargs: Table options as per `EvTable.__init__`. """ self.width = kwargs.pop("width", self.width) self.height = kwargs.pop("height", self.height) for key, value in kwargs.items()...
[ "def", "reformat", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "width", "=", "kwargs", ".", "pop", "(", "\"width\"", ",", "self", ".", "width", ")", "self", ".", "height", "=", "kwargs", ".", "pop", "(", "\"height\"", ",", "self", ...
[ 1566, 4 ]
[ 1592, 35 ]
python
en
['en', 'error', 'th']
False
EvTable.reformat_column
(self, index, **kwargs)
Sends custom options to a specific column in the table. Args: index (int): Which column to reformat. The column index is given from 0 to Ncolumns-1. Kwargs: Column options as per `EvCell.__init__`. Raises: Exception: if an invalid i...
Sends custom options to a specific column in the table.
def reformat_column(self, index, **kwargs): """ Sends custom options to a specific column in the table. Args: index (int): Which column to reformat. The column index is given from 0 to Ncolumns-1. Kwargs: Column options as per `EvCell.__init__`. ...
[ "def", "reformat_column", "(", "self", ",", "index", ",", "*", "*", "kwargs", ")", ":", "if", "index", ">", "len", "(", "self", ".", "table", ")", ":", "raise", "Exception", "(", "\"Not a valid column index\"", ")", "# we update the columns' options which means ...
[ 1594, 4 ]
[ 1614, 44 ]
python
en
['en', 'error', 'th']
False
EvTable.get
(self)
Return lines of table as a list. Returns: table_lines (list): The lines of the table, in order.
Return lines of table as a list.
def get(self): """ Return lines of table as a list. Returns: table_lines (list): The lines of the table, in order. """ return [line for line in self._generate_lines()]
[ "def", "get", "(", "self", ")", ":", "return", "[", "line", "for", "line", "in", "self", ".", "_generate_lines", "(", ")", "]" ]
[ 1616, 4 ]
[ 1624, 56 ]
python
en
['en', 'error', 'th']
False
EvTable.__str__
(self)
print table (this also balances it)
print table (this also balances it)
def __str__(self): """print table (this also balances it)""" # h = "12345678901234567890123456789012345678901234567890123456789012345678901234567890" return str(unicode(ANSIString("\n").join([line for line in self._generate_lines()])))
[ "def", "__str__", "(", "self", ")", ":", "# h = \"12345678901234567890123456789012345678901234567890123456789012345678901234567890\"", "return", "str", "(", "unicode", "(", "ANSIString", "(", "\"\\n\"", ")", ".", "join", "(", "[", "line", "for", "line", "in", "self", ...
[ 1626, 4 ]
[ 1629, 93 ]
python
en
['en', 'en', 'en']
True
QueuedMessage.__init__
(self, msg: OutboundMessage)
Create Wrapper for queued message. Automatically sets timestamp on create.
Create Wrapper for queued message.
def __init__(self, msg: OutboundMessage): """ Create Wrapper for queued message. Automatically sets timestamp on create. """ self.msg = msg self.timestamp = time.time()
[ "def", "__init__", "(", "self", ",", "msg", ":", "OutboundMessage", ")", ":", "self", ".", "msg", "=", "msg", "self", ".", "timestamp", "=", "time", ".", "time", "(", ")" ]
[ 19, 4 ]
[ 26, 36 ]
python
en
['en', 'error', 'th']
False
QueuedMessage.older_than
(self, compare_timestamp: float)
Age Comparison. Allows you to test age as compared to the provided timestamp. Args: compare_timestamp: The timestamp to compare
Age Comparison.
def older_than(self, compare_timestamp: float) -> bool: """ Age Comparison. Allows you to test age as compared to the provided timestamp. Args: compare_timestamp: The timestamp to compare """ return self.timestamp < compare_timestamp
[ "def", "older_than", "(", "self", ",", "compare_timestamp", ":", "float", ")", "->", "bool", ":", "return", "self", ".", "timestamp", "<", "compare_timestamp" ]
[ 28, 4 ]
[ 37, 49 ]
python
en
['en', 'error', 'th']
False
DeliveryQueue.__init__
(self)
Initialize an instance of DeliveryQueue. This uses an in memory structure to queue messages.
Initialize an instance of DeliveryQueue.
def __init__(self) -> None: """ Initialize an instance of DeliveryQueue. This uses an in memory structure to queue messages. """ self.queue_by_key = {} self.ttl_seconds = 604800
[ "def", "__init__", "(", "self", ")", "->", "None", ":", "self", ".", "queue_by_key", "=", "{", "}", "self", ".", "ttl_seconds", "=", "604800" ]
[ 47, 4 ]
[ 55, 33 ]
python
en
['en', 'error', 'th']
False
DeliveryQueue.expire_messages
(self, ttl=None)
Expire messages that are past the time limit. Args: ttl: Optional. Allows override of configured ttl
Expire messages that are past the time limit.
def expire_messages(self, ttl=None): """ Expire messages that are past the time limit. Args: ttl: Optional. Allows override of configured ttl """ ttl_seconds = ttl or self.ttl_seconds horizon = time.time() - ttl_seconds for key in self.queue_by_key.k...
[ "def", "expire_messages", "(", "self", ",", "ttl", "=", "None", ")", ":", "ttl_seconds", "=", "ttl", "or", "self", ".", "ttl_seconds", "horizon", "=", "time", ".", "time", "(", ")", "-", "ttl_seconds", "for", "key", "in", "self", ".", "queue_by_key", "...
[ 57, 4 ]
[ 70, 13 ]
python
en
['en', 'error', 'th']
False
DeliveryQueue.add_message
(self, msg: OutboundMessage)
Add an OutboundMessage to delivery queue. The message is added once per recipient key Args: msg: The OutboundMessage to add
Add an OutboundMessage to delivery queue.
def add_message(self, msg: OutboundMessage): """ Add an OutboundMessage to delivery queue. The message is added once per recipient key Args: msg: The OutboundMessage to add """ keys = set() if msg.target: keys.update(msg.target.recipient_...
[ "def", "add_message", "(", "self", ",", "msg", ":", "OutboundMessage", ")", ":", "keys", "=", "set", "(", ")", "if", "msg", ".", "target", ":", "keys", ".", "update", "(", "msg", ".", "target", ".", "recipient_keys", ")", "if", "msg", ".", "reply_to_...
[ 72, 4 ]
[ 90, 64 ]
python
en
['en', 'error', 'th']
False
DeliveryQueue.has_message_for_key
(self, key: str)
Check for queued messages by key. Args: key: The key to use for lookup
Check for queued messages by key.
def has_message_for_key(self, key: str): """ Check for queued messages by key. Args: key: The key to use for lookup """ if key in self.queue_by_key and len(self.queue_by_key[key]): return True return False
[ "def", "has_message_for_key", "(", "self", ",", "key", ":", "str", ")", ":", "if", "key", "in", "self", ".", "queue_by_key", "and", "len", "(", "self", ".", "queue_by_key", "[", "key", "]", ")", ":", "return", "True", "return", "False" ]
[ 92, 4 ]
[ 101, 20 ]
python
en
['en', 'error', 'th']
False
DeliveryQueue.message_count_for_key
(self, key: str)
Count of queued messages by key. Args: key: The key to use for lookup
Count of queued messages by key.
def message_count_for_key(self, key: str): """ Count of queued messages by key. Args: key: The key to use for lookup """ if key in self.queue_by_key: return len(self.queue_by_key[key]) else: return 0
[ "def", "message_count_for_key", "(", "self", ",", "key", ":", "str", ")", ":", "if", "key", "in", "self", ".", "queue_by_key", ":", "return", "len", "(", "self", ".", "queue_by_key", "[", "key", "]", ")", "else", ":", "return", "0" ]
[ 103, 4 ]
[ 113, 20 ]
python
en
['en', 'error', 'th']
False
DeliveryQueue.get_one_message_for_key
(self, key: str)
Remove and return a matching message. Args: key: The key to use for lookup
Remove and return a matching message.
def get_one_message_for_key(self, key: str): """ Remove and return a matching message. Args: key: The key to use for lookup """ if key in self.queue_by_key: return self.queue_by_key[key].pop(0).msg
[ "def", "get_one_message_for_key", "(", "self", ",", "key", ":", "str", ")", ":", "if", "key", "in", "self", ".", "queue_by_key", ":", "return", "self", ".", "queue_by_key", "[", "key", "]", ".", "pop", "(", "0", ")", ".", "msg" ]
[ 115, 4 ]
[ 123, 52 ]
python
en
['en', 'error', 'th']
False
DeliveryQueue.inspect_all_messages_for_key
(self, key: str)
Return all messages for key. Args: key: The key to use for lookup
Return all messages for key.
def inspect_all_messages_for_key(self, key: str): """ Return all messages for key. Args: key: The key to use for lookup """ if key in self.queue_by_key: for wrapped_msg in self.queue_by_key[key]: yield wrapped_msg.msg
[ "def", "inspect_all_messages_for_key", "(", "self", ",", "key", ":", "str", ")", ":", "if", "key", "in", "self", ".", "queue_by_key", ":", "for", "wrapped_msg", "in", "self", ".", "queue_by_key", "[", "key", "]", ":", "yield", "wrapped_msg", ".", "msg" ]
[ 125, 4 ]
[ 134, 37 ]
python
en
['en', 'error', 'th']
False
DeliveryQueue.remove_message_for_key
(self, key: str, msg: OutboundMessage)
Remove specified message from queue for key. Args: key: The key to use for lookup msg: The message to remove from the queue
Remove specified message from queue for key.
def remove_message_for_key(self, key: str, msg: OutboundMessage): """ Remove specified message from queue for key. Args: key: The key to use for lookup msg: The message to remove from the queue """ if key in self.queue_by_key: for wrapped_msg ...
[ "def", "remove_message_for_key", "(", "self", ",", "key", ":", "str", ",", "msg", ":", "OutboundMessage", ")", ":", "if", "key", "in", "self", ".", "queue_by_key", ":", "for", "wrapped_msg", "in", "self", ".", "queue_by_key", "[", "key", "]", ":", "if", ...
[ 136, 4 ]
[ 150, 25 ]
python
en
['en', 'error', 'th']
False
PolicyLearner.__init__
( self, outcome_learner=GradientBoostingRegressor(), treatment_learner=GradientBoostingClassifier(), policy_learner=DecisionTreeClassifier(), clip_bounds=(1e-3, 1 - 1e-3), n_fold=5, random_state=None, calibration=False, )
Initialize a treatment assignment policy learner. Args: outcome_learner (optional): a regression model to estimate outcomes policy_learner (optional): a classification model to estimate treatment assignment. It needs to take `sample_weight` as an input argument for `fit(...
Initialize a treatment assignment policy learner.
def __init__( self, outcome_learner=GradientBoostingRegressor(), treatment_learner=GradientBoostingClassifier(), policy_learner=DecisionTreeClassifier(), clip_bounds=(1e-3, 1 - 1e-3), n_fold=5, random_state=None, calibration=False, ): """Initia...
[ "def", "__init__", "(", "self", ",", "outcome_learner", "=", "GradientBoostingRegressor", "(", ")", ",", "treatment_learner", "=", "GradientBoostingClassifier", "(", ")", ",", "policy_learner", "=", "DecisionTreeClassifier", "(", ")", ",", "clip_bounds", "=", "(", ...
[ 21, 4 ]
[ 54, 9 ]
python
en
['en', 'en', 'en']
True
PolicyLearner.fit
(self, X, treatment, y, p=None, dhat=None)
Fit the treatment assignment policy learner. Args: X (np.matrix): a feature matrix treatment (np.array): a treatment vector (1 if treated, otherwise 0) y (np.array): an outcome vector p (optional, np.array): user provided propensity score vector between 0 and 1 ...
Fit the treatment assignment policy learner.
def fit(self, X, treatment, y, p=None, dhat=None): """Fit the treatment assignment policy learner. Args: X (np.matrix): a feature matrix treatment (np.array): a treatment vector (1 if treated, otherwise 0) y (np.array): an outcome vector p (optional, np.a...
[ "def", "fit", "(", "self", ",", "X", ",", "treatment", ",", "y", ",", "p", "=", "None", ",", "dhat", "=", "None", ")", ":", "logger", ".", "info", "(", "\"generating out-of-fold CV outcome estimates with {}\"", ".", "format", "(", "self", ".", "model_mu", ...
[ 108, 4 ]
[ 146, 19 ]
python
en
['en', 'en', 'en']
True
PolicyLearner.predict
(self, X)
Predict treatment assignment that optimizes the outcome. Args: X (np.matrix): a feature matrix Returns: (numpy.ndarray): predictions of treatment assignment.
Predict treatment assignment that optimizes the outcome.
def predict(self, X): """Predict treatment assignment that optimizes the outcome. Args: X (np.matrix): a feature matrix Returns: (numpy.ndarray): predictions of treatment assignment. """ return self.model_pi.predict(X)
[ "def", "predict", "(", "self", ",", "X", ")", ":", "return", "self", ".", "model_pi", ".", "predict", "(", "X", ")" ]
[ 148, 4 ]
[ 158, 39 ]
python
en
['en', 'en', 'en']
True
PolicyLearner.predict_proba
(self, X)
Predict treatment assignment score that optimizes the outcome. Args: X (np.matrix): a feature matrix Returns: (numpy.ndarray): predictions of treatment assignment score.
Predict treatment assignment score that optimizes the outcome.
def predict_proba(self, X): """Predict treatment assignment score that optimizes the outcome. Args: X (np.matrix): a feature matrix Returns: (numpy.ndarray): predictions of treatment assignment score. """ pi_hat = self.model_pi.predict_proba(X)[:, 1] ...
[ "def", "predict_proba", "(", "self", ",", "X", ")", ":", "pi_hat", "=", "self", ".", "model_pi", ".", "predict_proba", "(", "X", ")", "[", ":", ",", "1", "]", "return", "pi_hat" ]
[ 160, 4 ]
[ 172, 21 ]
python
en
['en', 'en', 'en']
True
main
(args=sys.argv)
Main command line entry point.
Main command line entry point.
def main(args=sys.argv): """ Main command line entry point. """ usage = USAGE % ((args[0],) * 6) try: popts, args = getopt.getopt(args[1:], "l:f:F:o:O:P:LS:a:N:vhVHgs") except getopt.GetoptError: print(usage, file=sys.stderr) return 2 try: return main_inner(...
[ "def", "main", "(", "args", "=", "sys", ".", "argv", ")", ":", "usage", "=", "USAGE", "%", "(", "(", "args", "[", "0", "]", ",", ")", "*", "6", ")", "try", ":", "popts", ",", "args", "=", "getopt", ".", "getopt", "(", "args", "[", "1", ":",...
[ 490, 0 ]
[ 528, 16 ]
python
en
['en', 'error', 'th']
False
NumbersTest.test_even
(self)
Test that numbers between 0 and 5 are all even.
Test that numbers between 0 and 5 are all even.
def test_even(self): """Test that numbers between 0 and 5 are all even. """ for i in range(0, 2): with self.subTest(i=i): self.assertEqual(i % 2, 0)
[ "def", "test_even", "(", "self", ")", ":", "for", "i", "in", "range", "(", "0", ",", "2", ")", ":", "with", "self", ".", "subTest", "(", "i", "=", "i", ")", ":", "self", ".", "assertEqual", "(", "i", "%", "2", ",", "0", ")" ]
[ 10, 4 ]
[ 15, 42 ]
python
en
['en', 'en', 'en']
True
Resource.from_resource
(cls: Type[R], other: R, rkey: Optional[str]=None, location: Optional[str]=None, kind: Optional[str]=None, serialization: Optional[str]=None, **kwargs)
Create a Resource by copying another Resource, possibly overriding elements along the way. NOTE WELL: if you pass in kwargs, we assume that any values are safe to use as-is and DO NOT COPY THEM. Otherwise, we SHALLOW COPY other.attrs for the new Resource. :param other: the bas...
Create a Resource by copying another Resource, possibly overriding elements along the way.
def from_resource(cls: Type[R], other: R, rkey: Optional[str]=None, location: Optional[str]=None, kind: Optional[str]=None, serialization: Optional[str]=None, **kwargs) -> R: """ Create a Resour...
[ "def", "from_resource", "(", "cls", ":", "Type", "[", "R", "]", ",", "other", ":", "R", ",", "rkey", ":", "Optional", "[", "str", "]", "=", "None", ",", "location", ":", "Optional", "[", "str", "]", "=", "None", ",", "kind", ":", "Optional", "[",...
[ 111, 4 ]
[ 160, 55 ]
python
en
['en', 'error', 'th']
False
Resource.from_dict
(cls: Type[R], rkey: str, location: str, serialization: Optional[str], attrs: Dict)
Create a Resource or subclass thereof from a dictionary. The new Resource's rkey and location must be handed in explicitly. The difference between this and simply intializing a Resource object is that from_dict will introspect the attrs passed in and create whatever kind of Resource ...
Create a Resource or subclass thereof from a dictionary. The new Resource's rkey and location must be handed in explicitly.
def from_dict(cls: Type[R], rkey: str, location: str, serialization: Optional[str], attrs: Dict) -> R: """ Create a Resource or subclass thereof from a dictionary. The new Resource's rkey and location must be handed in explicitly. The difference between this and simply intializing a Res...
[ "def", "from_dict", "(", "cls", ":", "Type", "[", "R", "]", ",", "rkey", ":", "str", ",", "location", ":", "str", ",", "serialization", ":", "Optional", "[", "str", "]", ",", "attrs", ":", "Dict", ")", "->", "R", ":", "# So this is a touch odd but here...
[ 163, 4 ]
[ 190, 92 ]
python
en
['en', 'error', 'th']
False
Resource.from_yaml
(cls: Type[R], rkey: str, location: str, serialization: str)
Create a Resource from a YAML serialization. The new Resource's rkey and location must be handed in explicitly, and of course in this case the serialization is mandatory. Raises an exception if the serialization is not parseable. :param rkey: unique identifier for this source,...
Create a Resource from a YAML serialization. The new Resource's rkey and location must be handed in explicitly, and of course in this case the serialization is mandatory.
def from_yaml(cls: Type[R], rkey: str, location: str, serialization: str) -> R: """ Create a Resource from a YAML serialization. The new Resource's rkey and location must be handed in explicitly, and of course in this case the serialization is mandatory. Raises an exception if t...
[ "def", "from_yaml", "(", "cls", ":", "Type", "[", "R", "]", ",", "rkey", ":", "str", ",", "location", ":", "str", ",", "serialization", ":", "str", ")", "->", "R", ":", "attrs", "=", "parse_yaml", "(", "serialization", ")", "return", "cls", ".", "f...
[ 193, 4 ]
[ 208, 66 ]
python
en
['en', 'error', 'th']
False
Monitor.__init__
(self)
Creates a Web server on a background thread.
Creates a Web server on a background thread.
def __init__(self): """Creates a Web server on a background thread.""" self.server = HTTPServer((MONITOR_HOST, MONITOR_PORT), self.MonitorHandler) self.thread = Thread(target=self.server.serve_forever) self.thread.daemon = True
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "server", "=", "HTTPServer", "(", "(", "MONITOR_HOST", ",", "MONITOR_PORT", ")", ",", "self", ".", "MonitorHandler", ")", "self", ".", "thread", "=", "Thread", "(", "target", "=", "self", ".", "ser...
[ 41, 4 ]
[ 47, 33 ]
python
en
['en', 'ga', 'en']
True
Monitor.start
(self)
Starts the Web server background thread.
Starts the Web server background thread.
def start(self): """Starts the Web server background thread.""" self.thread.start()
[ "def", "start", "(", "self", ")", ":", "self", ".", "thread", ".", "start", "(", ")" ]
[ 49, 4 ]
[ 52, 27 ]
python
en
['en', 'en', 'en']
True
Monitor.stop
(self)
Stops the Web server and background thread.
Stops the Web server and background thread.
def stop(self): """Stops the Web server and background thread.""" self.server.shutdown() self.server.server_close()
[ "def", "stop", "(", "self", ")", ":", "self", ".", "server", ".", "shutdown", "(", ")", "self", ".", "server", ".", "server_close", "(", ")" ]
[ 54, 4 ]
[ 58, 34 ]
python
en
['en', 'en', 'en']
True
Main.twitter_callback
(self, tweet)
Analyzes Trump tweets, trades stocks, and tweets about it.
Analyzes Trump tweets, trades stocks, and tweets about it.
def twitter_callback(self, tweet): """Analyzes Trump tweets, trades stocks, and tweets about it.""" # Initialize the Analysis, Logs, Trading, and Twitter instances inside # the callback to create separate httplib2 instances per thread. analysis = Analysis(logs_to_cloud=LOGS_TO_CLOUD) ...
[ "def", "twitter_callback", "(", "self", ",", "tweet", ")", ":", "# Initialize the Analysis, Logs, Trading, and Twitter instances inside", "# the callback to create separate httplib2 instances per thread.", "analysis", "=", "Analysis", "(", "logs_to_cloud", "=", "LOGS_TO_CLOUD", ")"...
[ 83, 4 ]
[ 103, 39 ]
python
en
['en', 'en', 'en']
True
Main.run_session
(self)
Runs a single streaming session. Logs and cleans up after exceptions.
Runs a single streaming session. Logs and cleans up after exceptions.
def run_session(self): """Runs a single streaming session. Logs and cleans up after exceptions. """ self.logs.info('Starting new session.') try: self.twitter.start_streaming(self.twitter_callback) except: self.logs.catch() finally: ...
[ "def", "run_session", "(", "self", ")", ":", "self", ".", "logs", ".", "info", "(", "'Starting new session.'", ")", "try", ":", "self", ".", "twitter", ".", "start_streaming", "(", "self", ".", "twitter_callback", ")", "except", ":", "self", ".", "logs", ...
[ 105, 4 ]
[ 117, 45 ]
python
en
['en', 'en', 'en']
True
Main.backoff
(self, tries)
Sleeps an exponential number of seconds based on the number of tries.
Sleeps an exponential number of seconds based on the number of tries.
def backoff(self, tries): """Sleeps an exponential number of seconds based on the number of tries. """ delay = BACKOFF_STEP_S * pow(2, tries) self.logs.warn('Waiting for %.1f seconds.' % delay) sleep(delay)
[ "def", "backoff", "(", "self", ",", "tries", ")", ":", "delay", "=", "BACKOFF_STEP_S", "*", "pow", "(", "2", ",", "tries", ")", "self", ".", "logs", ".", "warn", "(", "'Waiting for %.1f seconds.'", "%", "delay", ")", "sleep", "(", "delay", ")" ]
[ 119, 4 ]
[ 126, 20 ]
python
en
['en', 'en', 'en']
True
Main.run
(self)
Runs the main retry loop with exponential backoff.
Runs the main retry loop with exponential backoff.
def run(self): """Runs the main retry loop with exponential backoff.""" tries = 0 while True: # The session blocks until an error occurs. self.run_session() # Remember the first time a backoff sequence starts. now = datetime.now() if...
[ "def", "run", "(", "self", ")", ":", "tries", "=", "0", "while", "True", ":", "# The session blocks until an error occurs.", "self", ".", "run_session", "(", ")", "# Remember the first time a backoff sequence starts.", "now", "=", "datetime", ".", "now", "(", ")", ...
[ 128, 4 ]
[ 158, 22 ]
python
en
['en', 'en', 'en']
True
quote
(arg)
r""" >>> quote('\t') '\\\t' >>> quote('foo bar') 'foo\\ bar'
r""" >>> quote('\t') '\\\t' >>> quote('foo bar') 'foo\\ bar'
def quote(arg): r""" >>> quote('\t') '\\\t' >>> quote('foo bar') 'foo\\ bar' """ # This is the logic emacs uses if arg: return _quote_pos.sub('\\\\', arg).replace('\n', "'\n'") else: return "''"
[ "def", "quote", "(", "arg", ")", ":", "# This is the logic emacs uses", "if", "arg", ":", "return", "_quote_pos", ".", "sub", "(", "'\\\\\\\\'", ",", "arg", ")", ".", "replace", "(", "'\\n'", ",", "\"'\\n'\"", ")", "else", ":", "return", "\"''\"" ]
[ 10, 0 ]
[ 22, 19 ]
python
cy
['en', 'cy', 'hi']
False
SiteBuilder.build
(self, resource_identifiers=None, build_index: bool = True)
:param resource_identifiers: a list of resource identifiers (ExpectationSuiteIdentifier, ValidationResultIdentifier). If specified, rebuild HTML(or other views the data docs site renders) only for the resources in this...
def build(self, resource_identifiers=None, build_index: bool = True): """ :param resource_identifiers: a list of resource identifiers (ExpectationSuiteIdentifier, ValidationResultIdentifier). If specified, rebuild HTML(or other views the d...
[ "def", "build", "(", "self", ",", "resource_identifiers", "=", "None", ",", "build_index", ":", "bool", "=", "True", ")", ":", "# copy static assets", "self", ".", "target_store", ".", "copy_static_assets", "(", ")", "for", "site_section", ",", "site_section_bui...
[ 271, 4 ]
[ 300, 9 ]
python
en
['en', 'error', 'th']
False
SiteBuilder.get_resource_url
(self, resource_identifier=None, only_if_exists=True)
Return the URL of the HTML document that renders a resource (e.g., an expectation suite or a validation result). :param resource_identifier: ExpectationSuiteIdentifier, ValidationResultIdentifier or any other type's identifier. The argument is optional - when not supplied, the ...
Return the URL of the HTML document that renders a resource (e.g., an expectation suite or a validation result).
def get_resource_url(self, resource_identifier=None, only_if_exists=True): """ Return the URL of the HTML document that renders a resource (e.g., an expectation suite or a validation result). :param resource_identifier: ExpectationSuiteIdentifier, ValidationResultIdentifier or a...
[ "def", "get_resource_url", "(", "self", ",", "resource_identifier", "=", "None", ",", "only_if_exists", "=", "True", ")", ":", "return", "self", ".", "target_store", ".", "get_url_for_resource", "(", "resource_identifier", "=", "resource_identifier", ",", "only_if_e...
[ 302, 4 ]
[ 316, 9 ]
python
en
['en', 'error', 'th']
False
DefaultSiteIndexBuilder._get_call_to_action_buttons
(self, usage_statistics)
Build project and user specific calls to action buttons. This can become progressively smarter about project and user specific calls to action.
Build project and user specific calls to action buttons.
def _get_call_to_action_buttons(self, usage_statistics): """ Build project and user specific calls to action buttons. This can become progressively smarter about project and user specific calls to action. """ create_expectations = CallToActionButton( "How to ...
[ "def", "_get_call_to_action_buttons", "(", "self", ",", "usage_statistics", ")", ":", "create_expectations", "=", "CallToActionButton", "(", "\"How to Create Expectations\"", ",", "# TODO update this link to a proper tutorial", "\"https://docs.greatexpectations.io/en/latest/guides/how_...
[ 642, 4 ]
[ 688, 22 ]
python
en
['en', 'error', 'th']
False
DefaultSiteIndexBuilder.build
(self, skip_and_clean_missing=True, build_index: bool = True)
:param skip_and_clean_missing: if True, target html store keys without corresponding source store keys will be skipped and removed from the target store :param build_index: a flag if False, skips building the index page :return: tuple(index_page_url, index_links_dict)
:param skip_and_clean_missing: if True, target html store keys without corresponding source store keys will be skipped and removed from the target store :param build_index: a flag if False, skips building the index page :return: tuple(index_page_url, index_links_dict)
def build(self, skip_and_clean_missing=True, build_index: bool = True): """ :param skip_and_clean_missing: if True, target html store keys without corresponding source store keys will be skipped and removed from the target store :param build_index: a flag if False, skips building the ind...
[ "def", "build", "(", "self", ",", "skip_and_clean_missing", "=", "True", ",", "build_index", ":", "bool", "=", "True", ")", ":", "# Loop over sections in the HtmlStore", "logger", ".", "debug", "(", "\"DefaultSiteIndexBuilder.build\"", ")", "if", "not", "build_index...
[ 691, 4 ]
[ 913, 87 ]
python
en
['en', 'error', 'th']
False
gather_3d_metrics
(expected, actual)
:param expected: Predicted pose :param actual: Ground Truth :return: evaluation results
def gather_3d_metrics(expected, actual): """ :param expected: Predicted pose :param actual: Ground Truth :return: evaluation results """ unaligned_pck = pck(actual, expected) unaligned_auc = auc(actual, expected) expect_np = expected.cpu().numpy().reshape(-1, expected.shape[-2], expecte...
[ "def", "gather_3d_metrics", "(", "expected", ",", "actual", ")", ":", "unaligned_pck", "=", "pck", "(", "actual", ",", "expected", ")", "unaligned_auc", "=", "auc", "(", "actual", ",", "expected", ")", "expect_np", "=", "expected", ".", "cpu", "(", ")", ...
[ 6, 0 ]
[ 27, 5 ]
python
en
['en', 'error', 'th']
False
is_str
(string)
Python 2 and 3 compatible string checker. Args: string (str | basestring): the string to check Returns: bool: True or False
Python 2 and 3 compatible string checker.
def is_str(string): """ Python 2 and 3 compatible string checker. Args: string (str | basestring): the string to check Returns: bool: True or False """ if sys.version_info >= (3, 0): return isinstance(string, str) else: return isinstance(string, basestring)
[ "def", "is_str", "(", "string", ")", ":", "if", "sys", ".", "version_info", ">=", "(", "3", ",", "0", ")", ":", "return", "isinstance", "(", "string", ",", "str", ")", "else", ":", "return", "isinstance", "(", "string", ",", "basestring", ")" ]
[ 16, 0 ]
[ 30, 45 ]
python
en
['en', 'error', 'th']
False
find_xml_generator
(name=None)
Try to find a c++ parser. Returns path and name. :param name: name of the c++ parser: castxml or gccxml :type name: str If no name is given the function first looks for castxml, then for gccxml. If no c++ parser is found the function raises an exception.
Try to find a c++ parser. Returns path and name.
def find_xml_generator(name=None): """ Try to find a c++ parser. Returns path and name. :param name: name of the c++ parser: castxml or gccxml :type name: str If no name is given the function first looks for castxml, then for gccxml. If no c++ parser is found the function raises an excepti...
[ "def", "find_xml_generator", "(", "name", "=", "None", ")", ":", "if", "platform", ".", "system", "(", ")", "==", "\"Windows\"", ":", "command", "=", "\"where\"", "else", ":", "command", "=", "\"which\"", "if", "name", "is", "None", ":", "name", "=", "...
[ 33, 0 ]
[ 77, 34 ]
python
en
['en', 'error', 'th']
False
_create_logger_
(name)
Implementation detail, creates a logger.
Implementation detail, creates a logger.
def _create_logger_(name): """Implementation detail, creates a logger.""" logger = logging.getLogger(name) handler = logging.StreamHandler() handler.setFormatter(logging.Formatter('%(levelname)s %(message)s')) logger.addHandler(handler) logger.setLevel(logging.INFO) return logger
[ "def", "_create_logger_", "(", "name", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", "name", ")", "handler", "=", "logging", ".", "StreamHandler", "(", ")", "handler", ".", "setFormatter", "(", "logging", ".", "Formatter", "(", "'%(levelname)s %...
[ 80, 0 ]
[ 87, 17 ]
python
en
['es', 'en', 'en']
True
remove_file_no_raise
(file_name, config)
Removes file from disk if exception is raised.
Removes file from disk if exception is raised.
def remove_file_no_raise(file_name, config): """Removes file from disk if exception is raised.""" # The removal can be disabled by the config for debugging purposes. if config.keep_xml: return True try: if os.path.exists(file_name): os.remove(file_name) except IOError as...
[ "def", "remove_file_no_raise", "(", "file_name", ",", "config", ")", ":", "# The removal can be disabled by the config for debugging purposes.", "if", "config", ".", "keep_xml", ":", "return", "True", "try", ":", "if", "os", ".", "path", ".", "exists", "(", "file_na...
[ 151, 0 ]
[ 163, 34 ]
python
en
['en', 'en', 'en']
True
create_temp_file_name
(suffix, prefix=None, dir=None, directory=None)
Small convenience function that creates temporary files. This function is a wrapper around the Python built-in function tempfile.mkstemp.
Small convenience function that creates temporary files.
def create_temp_file_name(suffix, prefix=None, dir=None, directory=None): """ Small convenience function that creates temporary files. This function is a wrapper around the Python built-in function tempfile.mkstemp. """ if dir is not None: warnings.warn( "The dir argument i...
[ "def", "create_temp_file_name", "(", "suffix", ",", "prefix", "=", "None", ",", "dir", "=", "None", ",", "directory", "=", "None", ")", ":", "if", "dir", "is", "not", "None", ":", "warnings", ".", "warn", "(", "\"The dir argument is deprecated.\\n\"", "+", ...
[ 167, 0 ]
[ 187, 15 ]
python
en
['en', 'error', 'th']
False
normalize_path
(some_path)
Return os.path.normpath(os.path.normcase(some_path)).
Return os.path.normpath(os.path.normcase(some_path)).
def normalize_path(some_path): """Return os.path.normpath(os.path.normcase(some_path)).""" return os.path.normpath(os.path.normcase(some_path))
[ "def", "normalize_path", "(", "some_path", ")", ":", "return", "os", ".", "path", ".", "normpath", "(", "os", ".", "path", ".", "normcase", "(", "some_path", ")", ")" ]
[ 190, 0 ]
[ 192, 56 ]
python
en
['en', 'en', 'en']
False
contains_parent_dir
(fpath, dirs)
Returns true if paths in dirs start with fpath. Precondition: dirs and fpath should be normalized before calling this function.
Returns true if paths in dirs start with fpath.
def contains_parent_dir(fpath, dirs): """ Returns true if paths in dirs start with fpath. Precondition: dirs and fpath should be normalized before calling this function. """ # Note: this function is used nowhere in pygccxml but is used # at least by pypluplus; so it should stay here. ...
[ "def", "contains_parent_dir", "(", "fpath", ",", "dirs", ")", ":", "# Note: this function is used nowhere in pygccxml but is used", "# at least by pypluplus; so it should stay here.", "return", "bool", "(", "[", "x", "for", "x", "in", "dirs", "if", "_f", "(", "fpath", "...
[ 195, 0 ]
[ 206, 50 ]
python
en
['en', 'error', 'th']
False
_f
(fpath, dir_)
Helper function for contains_parent_dir function.
Helper function for contains_parent_dir function.
def _f(fpath, dir_): """Helper function for contains_parent_dir function.""" return fpath.startswith(dir_)
[ "def", "_f", "(", "fpath", ",", "dir_", ")", ":", "return", "fpath", ".", "startswith", "(", "dir_", ")" ]
[ 209, 0 ]
[ 211, 33 ]
python
en
['en', 'fr', 'en']
True
get_architecture
()
Returns computer architecture: 32 or 64. The guess is based on maxint.
Returns computer architecture: 32 or 64.
def get_architecture(): """ Returns computer architecture: 32 or 64. The guess is based on maxint. """ if sys.maxsize == 2147483647: return 32 elif sys.maxsize == 9223372036854775807: return 64 else: raise RuntimeError("Unknown architecture")
[ "def", "get_architecture", "(", ")", ":", "if", "sys", ".", "maxsize", "==", "2147483647", ":", "return", "32", "elif", "sys", ".", "maxsize", "==", "9223372036854775807", ":", "return", "64", "else", ":", "raise", "RuntimeError", "(", "\"Unknown architecture\...
[ 214, 0 ]
[ 226, 50 ]
python
en
['en', 'error', 'th']
False
get_tr1
(name)
In libstd++ the tr1 namespace needs special care. Return either an empty string or tr1::, useful for appending to search patterns. Args: name (str): the name of the declaration Returns: str: an empty string or "tr1::"
In libstd++ the tr1 namespace needs special care.
def get_tr1(name): """In libstd++ the tr1 namespace needs special care. Return either an empty string or tr1::, useful for appending to search patterns. Args: name (str): the name of the declaration Returns: str: an empty string or "tr1::" """ tr1 = "" if "tr1" in name...
[ "def", "get_tr1", "(", "name", ")", ":", "tr1", "=", "\"\"", "if", "\"tr1\"", "in", "name", ":", "tr1", "=", "\"tr1::\"", "return", "tr1" ]
[ 260, 0 ]
[ 275, 14 ]
python
en
['en', 'en', 'en']
True
loggers.set_level
(level)
Set the same logging level for all the loggers at once.
Set the same logging level for all the loggers at once.
def set_level(level): """Set the same logging level for all the loggers at once.""" for logger in loggers.all_loggers: logger.setLevel(level)
[ "def", "set_level", "(", "level", ")", ":", "for", "logger", "in", "loggers", ".", "all_loggers", ":", "logger", ".", "setLevel", "(", "level", ")" ]
[ 145, 4 ]
[ 148, 34 ]
python
en
['en', 'en', 'en']
True
cxx_standard.__init__
(self, cflags)
Class constructor that parses the XML generator's command line Args: cflags (str): cflags command line arguments passed to the XML generator
Class constructor that parses the XML generator's command line
def __init__(self, cflags): """Class constructor that parses the XML generator's command line Args: cflags (str): cflags command line arguments passed to the XML generator """ super(cxx_standard, self).__init__() self._stdcxx = None self._is_...
[ "def", "__init__", "(", "self", ",", "cflags", ")", ":", "super", "(", "cxx_standard", ",", "self", ")", ".", "__init__", "(", ")", "self", ".", "_stdcxx", "=", "None", "self", ".", "_is_implicit", "=", "False", "for", "key", "in", "cxx_standard", ".",...
[ 303, 4 ]
[ 326, 36 ]
python
en
['en', 'en', 'en']
True
cxx_standard.stdcxx
(self)
Returns the -std=c++xx option passed to the constructor
Returns the -std=c++xx option passed to the constructor
def stdcxx(self): """Returns the -std=c++xx option passed to the constructor""" return self._stdcxx
[ "def", "stdcxx", "(", "self", ")", ":", "return", "self", ".", "_stdcxx" ]
[ 329, 4 ]
[ 331, 27 ]
python
en
['en', 'en', 'en']
True
cxx_standard.is_implicit
(self)
Indicates whether a -std=c++xx was specified
Indicates whether a -std=c++xx was specified
def is_implicit(self): """Indicates whether a -std=c++xx was specified""" return self._is_implicit
[ "def", "is_implicit", "(", "self", ")", ":", "return", "self", ".", "_is_implicit" ]
[ 334, 4 ]
[ 336, 32 ]
python
en
['en', 'en', 'en']
True
cxx_standard.is_cxx03
(self)
Returns true if -std=c++03 is being used
Returns true if -std=c++03 is being used
def is_cxx03(self): """Returns true if -std=c++03 is being used""" return self._cplusplus == cxx_standard.__STD_CXX['-std=c++03']
[ "def", "is_cxx03", "(", "self", ")", ":", "return", "self", ".", "_cplusplus", "==", "cxx_standard", ".", "__STD_CXX", "[", "'-std=c++03'", "]" ]
[ 339, 4 ]
[ 341, 70 ]
python
en
['en', 'en', 'en']
True
cxx_standard.is_cxx11
(self)
Returns true if -std=c++11 is being used
Returns true if -std=c++11 is being used
def is_cxx11(self): """Returns true if -std=c++11 is being used""" return self._cplusplus == cxx_standard.__STD_CXX['-std=c++11']
[ "def", "is_cxx11", "(", "self", ")", ":", "return", "self", ".", "_cplusplus", "==", "cxx_standard", ".", "__STD_CXX", "[", "'-std=c++11'", "]" ]
[ 344, 4 ]
[ 346, 70 ]
python
en
['en', 'en', 'en']
True
cxx_standard.is_cxx11_or_greater
(self)
Returns true if -std=c++11 or a newer standard is being used
Returns true if -std=c++11 or a newer standard is being used
def is_cxx11_or_greater(self): """Returns true if -std=c++11 or a newer standard is being used""" return self._cplusplus >= cxx_standard.__STD_CXX['-std=c++11']
[ "def", "is_cxx11_or_greater", "(", "self", ")", ":", "return", "self", ".", "_cplusplus", ">=", "cxx_standard", ".", "__STD_CXX", "[", "'-std=c++11'", "]" ]
[ 349, 4 ]
[ 351, 70 ]
python
en
['en', 'en', 'en']
True
cxx_standard.is_cxx14
(self)
Returns true if -std=c++14 is being used
Returns true if -std=c++14 is being used
def is_cxx14(self): """Returns true if -std=c++14 is being used""" return self._cplusplus == cxx_standard.__STD_CXX['-std=c++14']
[ "def", "is_cxx14", "(", "self", ")", ":", "return", "self", ".", "_cplusplus", "==", "cxx_standard", ".", "__STD_CXX", "[", "'-std=c++14'", "]" ]
[ 354, 4 ]
[ 356, 70 ]
python
en
['en', 'en', 'en']
True
cxx_standard.is_cxx14_or_greater
(self)
Returns true if -std=c++14 or a newer standard is being used
Returns true if -std=c++14 or a newer standard is being used
def is_cxx14_or_greater(self): """Returns true if -std=c++14 or a newer standard is being used""" return self._cplusplus >= cxx_standard.__STD_CXX['-std=c++14']
[ "def", "is_cxx14_or_greater", "(", "self", ")", ":", "return", "self", ".", "_cplusplus", ">=", "cxx_standard", ".", "__STD_CXX", "[", "'-std=c++14'", "]" ]
[ 359, 4 ]
[ 361, 70 ]
python
en
['en', 'en', 'en']
True
cxx_standard.is_cxx1z
(self)
Returns true if -std=c++1z is being used
Returns true if -std=c++1z is being used
def is_cxx1z(self): """Returns true if -std=c++1z is being used""" return self._cplusplus == cxx_standard.__STD_CXX['-std=c++1z']
[ "def", "is_cxx1z", "(", "self", ")", ":", "return", "self", ".", "_cplusplus", "==", "cxx_standard", ".", "__STD_CXX", "[", "'-std=c++1z'", "]" ]
[ 364, 4 ]
[ 366, 70 ]
python
en
['de', 'en', 'en']
True
UserProfileManager.create_user
(self, email, name, password=None)
Create a new user profile
Create a new user profile
def create_user(self, email, name, password=None): """Create a new user profile""" if not email: raise ValueError("User must have an email address!") email = self.normalize_email(email) user = self.model(email=email, name=name) user.set_password(password) u...
[ "def", "create_user", "(", "self", ",", "email", ",", "name", ",", "password", "=", "None", ")", ":", "if", "not", "email", ":", "raise", "ValueError", "(", "\"User must have an email address!\"", ")", "email", "=", "self", ".", "normalize_email", "(", "emai...
[ 11, 4 ]
[ 23, 19 ]
python
en
['en', 'it', 'en']
True
UserProfileManager.create_superuser
(self, email, name, password)
Create and save superuser with given details
Create and save superuser with given details
def create_superuser(self, email, name, password): """Create and save superuser with given details""" user = self.create_user(email, name, password) user.is_superuser = True user.is_staff = True user.save(using=self._db) return user
[ "def", "create_superuser", "(", "self", ",", "email", ",", "name", ",", "password", ")", ":", "user", "=", "self", ".", "create_user", "(", "email", ",", "name", ",", "password", ")", "user", ".", "is_superuser", "=", "True", "user", ".", "is_staff", "...
[ 25, 4 ]
[ 35, 19 ]
python
en
['en', 'en', 'en']
True
UserProfile.get_full_name
(self)
Retrieve full name of the user
Retrieve full name of the user
def get_full_name(self): """Retrieve full name of the user""" return self.name
[ "def", "get_full_name", "(", "self", ")", ":", "return", "self", ".", "name" ]
[ 50, 4 ]
[ 53, 24 ]
python
en
['en', 'no', 'en']
True
UserProfile.get_short_name
(self)
Retrieve short name of the user
Retrieve short name of the user
def get_short_name(self): """Retrieve short name of the user""" return self.name
[ "def", "get_short_name", "(", "self", ")", ":", "return", "self", ".", "name" ]
[ 55, 4 ]
[ 58, 24 ]
python
en
['en', 'pt', 'en']
True
UserProfile.__str__
(self)
Return string representation of the user's email.
Return string representation of the user's email.
def __str__(self): """Return string representation of the user's email.""" return self.email
[ "def", "__str__", "(", "self", ")", ":", "return", "self", ".", "email" ]
[ 60, 4 ]
[ 62, 25 ]
python
en
['en', 'en', 'en']
True
ProfileFeedItem.__str__
(self)
Return the model as a string.
Return the model as a string.
def __str__(self): """Return the model as a string.""" return self.status_text
[ "def", "__str__", "(", "self", ")", ":", "return", "self", ".", "status_text" ]
[ 75, 4 ]
[ 78, 31 ]
python
en
['en', 'en', 'en']
True
ExecutionEngine.configure_validator
(self, validator)
Optionally configure the validator as appropriate for the execution engine.
Optionally configure the validator as appropriate for the execution engine.
def configure_validator(self, validator): """Optionally configure the validator as appropriate for the execution engine.""" pass
[ "def", "configure_validator", "(", "self", ",", "validator", ")", ":", "pass" ]
[ 116, 4 ]
[ 118, 12 ]
python
en
['en', 'en', 'en']
True
ExecutionEngine.active_batch_data_id
(self)
The batch id for the default batch data. When an execution engine is asked to process a compute domain that does not include a specific batch_id, then the data associated with the active_batch_data_id will be used as the default.
The batch id for the default batch data.
def active_batch_data_id(self): """The batch id for the default batch data. When an execution engine is asked to process a compute domain that does not include a specific batch_id, then the data associated with the active_batch_data_id will be used as the default. """ if...
[ "def", "active_batch_data_id", "(", "self", ")", ":", "if", "self", ".", "_active_batch_data_id", "is", "not", "None", ":", "return", "self", ".", "_active_batch_data_id", "elif", "len", "(", "self", ".", "loaded_batch_data_dict", ")", "==", "1", ":", "return"...
[ 121, 4 ]
[ 133, 23 ]
python
en
['en', 'en', 'en']
True
ExecutionEngine.active_batch_data
(self)
The data from the currently-active batch.
The data from the currently-active batch.
def active_batch_data(self): """The data from the currently-active batch.""" if self.active_batch_data_id is None: return None else: return self.loaded_batch_data_dict.get(self.active_batch_data_id)
[ "def", "active_batch_data", "(", "self", ")", ":", "if", "self", ".", "active_batch_data_id", "is", "None", ":", "return", "None", "else", ":", "return", "self", ".", "loaded_batch_data_dict", ".", "get", "(", "self", ".", "active_batch_data_id", ")" ]
[ 145, 4 ]
[ 150, 77 ]
python
en
['en', 'en', 'en']
True
ExecutionEngine.loaded_batch_data_dict
(self)
The current dictionary of batches.
The current dictionary of batches.
def loaded_batch_data_dict(self): """The current dictionary of batches.""" return self._batch_data_dict
[ "def", "loaded_batch_data_dict", "(", "self", ")", ":", "return", "self", ".", "_batch_data_dict" ]
[ 153, 4 ]
[ 155, 36 ]
python
en
['en', 'en', 'en']
True
ExecutionEngine.get_batch_data
( self, batch_spec: BatchSpec, )
Interprets batch_data and returns the appropriate data. This method is primarily useful for utility cases (e.g. testing) where data is being fetched without a DataConnector and metadata like batch_markers is unwanted Note: this method is currently a thin wrapper for get_batch_data_and_...
Interprets batch_data and returns the appropriate data.
def get_batch_data( self, batch_spec: BatchSpec, ) -> Any: """Interprets batch_data and returns the appropriate data. This method is primarily useful for utility cases (e.g. testing) where data is being fetched without a DataConnector and metadata like batch_markers ...
[ "def", "get_batch_data", "(", "self", ",", "batch_spec", ":", "BatchSpec", ",", ")", "->", "Any", ":", "batch_data", ",", "_", "=", "self", ".", "get_batch_data_and_markers", "(", "batch_spec", ")", "return", "batch_data" ]
[ 169, 4 ]
[ 183, 25 ]
python
en
['en', 'co', 'en']
True
ExecutionEngine.load_batch_data
(self, batch_id: str, batch_data: Any)
Loads the specified batch_data into the execution engine
Loads the specified batch_data into the execution engine
def load_batch_data(self, batch_id: str, batch_data: Any) -> None: """ Loads the specified batch_data into the execution engine """ self._batch_data_dict[batch_id] = batch_data self._active_batch_data_id = batch_id
[ "def", "load_batch_data", "(", "self", ",", "batch_id", ":", "str", ",", "batch_data", ":", "Any", ")", "->", "None", ":", "self", ".", "_batch_data_dict", "[", "batch_id", "]", "=", "batch_data", "self", ".", "_active_batch_data_id", "=", "batch_id" ]
[ 189, 4 ]
[ 194, 45 ]
python
en
['en', 'error', 'th']
False
ExecutionEngine._load_batch_data_from_dict
(self, batch_data_dict)
Loads all data in batch_data_dict into load_batch_data
Loads all data in batch_data_dict into load_batch_data
def _load_batch_data_from_dict(self, batch_data_dict): """ Loads all data in batch_data_dict into load_batch_data """ for batch_id, batch_data in batch_data_dict.items(): self.load_batch_data(batch_id, batch_data)
[ "def", "_load_batch_data_from_dict", "(", "self", ",", "batch_data_dict", ")", ":", "for", "batch_id", ",", "batch_data", "in", "batch_data_dict", ".", "items", "(", ")", ":", "self", ".", "load_batch_data", "(", "batch_id", ",", "batch_data", ")" ]
[ 196, 4 ]
[ 201, 54 ]
python
en
['en', 'error', 'th']
False
ExecutionEngine.resolve_metrics
( self, metrics_to_resolve: Iterable[MetricConfiguration], metrics: Dict[Tuple, Any] = None, runtime_configuration: dict = None, )
resolve_metrics is the main entrypoint for an execution engine. The execution engine will compute the value of the provided metrics. Args: metrics_to_resolve: the metrics to evaluate metrics: already-computed metrics currently available to the engine runtime_configur...
resolve_metrics is the main entrypoint for an execution engine. The execution engine will compute the value of the provided metrics.
def resolve_metrics( self, metrics_to_resolve: Iterable[MetricConfiguration], metrics: Dict[Tuple, Any] = None, runtime_configuration: dict = None, ) -> dict: """resolve_metrics is the main entrypoint for an execution engine. The execution engine will compute the value ...
[ "def", "resolve_metrics", "(", "self", ",", "metrics_to_resolve", ":", "Iterable", "[", "MetricConfiguration", "]", ",", "metrics", ":", "Dict", "[", "Tuple", ",", "Any", "]", "=", "None", ",", "runtime_configuration", ":", "dict", "=", "None", ",", ")", "...
[ 203, 4 ]
[ 297, 31 ]
python
en
['en', 'en', 'en']
True
ExecutionEngine.resolve_metric_bundle
(self, metric_fn_bundle)
Resolve a bundle of metrics with the same compute domain as part of a single trip to the compute engine.
Resolve a bundle of metrics with the same compute domain as part of a single trip to the compute engine.
def resolve_metric_bundle(self, metric_fn_bundle): """Resolve a bundle of metrics with the same compute domain as part of a single trip to the compute engine.""" raise NotImplementedError
[ "def", "resolve_metric_bundle", "(", "self", ",", "metric_fn_bundle", ")", ":", "raise", "NotImplementedError" ]
[ 299, 4 ]
[ 301, 33 ]
python
en
['en', 'en', 'en']
True
ExecutionEngine.get_compute_domain
( self, domain_kwargs: dict, domain_type: Union[str, MetricDomainTypes], )
get_compute_domain computes the optimal domain_kwargs for computing metrics based on the given domain_kwargs and specific engine semantics. Returns: A tuple consisting of three elements: 1. data corresponding to the compute domain; 2. a modified copy of domain_kwarg...
get_compute_domain computes the optimal domain_kwargs for computing metrics based on the given domain_kwargs and specific engine semantics.
def get_compute_domain( self, domain_kwargs: dict, domain_type: Union[str, MetricDomainTypes], ) -> Tuple[Any, dict, dict]: """get_compute_domain computes the optimal domain_kwargs for computing metrics based on the given domain_kwargs and specific engine semantics. ...
[ "def", "get_compute_domain", "(", "self", ",", "domain_kwargs", ":", "dict", ",", "domain_type", ":", "Union", "[", "str", ",", "MetricDomainTypes", "]", ",", ")", "->", "Tuple", "[", "Any", ",", "dict", ",", "dict", "]", ":", "raise", "NotImplementedError...
[ 303, 4 ]
[ 323, 33 ]
python
en
['en', 'en', 'en']
True
ExecutionEngine.add_column_row_condition
( self, domain_kwargs, column_name=None, filter_null=True, filter_nan=False )
EXPERIMENTAL Add a row condition for handling null filter. Args: domain_kwargs: the domain kwargs to use as the base and to which to add the condition column_name: if provided, use this name to add the condition; otherwise, will use "column" key from table_domain_kwargs ...
EXPERIMENTAL
def add_column_row_condition( self, domain_kwargs, column_name=None, filter_null=True, filter_nan=False ): """EXPERIMENTAL Add a row condition for handling null filter. Args: domain_kwargs: the domain kwargs to use as the base and to which to add the condition ...
[ "def", "add_column_row_condition", "(", "self", ",", "domain_kwargs", ",", "column_name", "=", "None", ",", "filter_null", "=", "True", ",", "filter_nan", "=", "False", ")", ":", "if", "filter_null", "is", "False", "and", "filter_nan", "is", "False", ":", "l...
[ 325, 4 ]
[ 362, 32 ]
python
ca
['en', 'ca', 'pt']
False
instantiate_class_from_config
(config, runtime_environment, config_defaults=None)
Build a GE class from configuration dictionaries.
Build a GE class from configuration dictionaries.
def instantiate_class_from_config(config, runtime_environment, config_defaults=None): """Build a GE class from configuration dictionaries.""" if config_defaults is None: config_defaults = {} config = copy.deepcopy(config) module_name = config.pop("module_name", None) if module_name is Non...
[ "def", "instantiate_class_from_config", "(", "config", ",", "runtime_environment", ",", "config_defaults", "=", "None", ")", ":", "if", "config_defaults", "is", "None", ":", "config_defaults", "=", "{", "}", "config", "=", "copy", ".", "deepcopy", "(", "config",...
[ 54, 0 ]
[ 129, 25 ]
python
en
['en', 'en', 'en']
True
substitute_config_variable
( template_str, config_variables_dict, dollar_sign_escape_string: str = r"\$" )
This method takes a string, and if it contains a pattern ${SOME_VARIABLE} or $SOME_VARIABLE, returns a string where the pattern is replaced with the value of SOME_VARIABLE, otherwise returns the string unchanged. These patterns are case sensitive. There can be multiple patterns in a string, e.g. all 3 ...
This method takes a string, and if it contains a pattern ${SOME_VARIABLE} or $SOME_VARIABLE, returns a string where the pattern is replaced with the value of SOME_VARIABLE, otherwise returns the string unchanged. These patterns are case sensitive. There can be multiple patterns in a string, e.g. all 3 ...
def substitute_config_variable( template_str, config_variables_dict, dollar_sign_escape_string: str = r"\$" ): """ This method takes a string, and if it contains a pattern ${SOME_VARIABLE} or $SOME_VARIABLE, returns a string where the pattern is replaced with the value of SOME_VARIABLE, otherwise re...
[ "def", "substitute_config_variable", "(", "template_str", ",", "config_variables_dict", ",", "dollar_sign_escape_string", ":", "str", "=", "r\"\\$\"", ")", ":", "if", "template_str", "is", "None", ":", "return", "template_str", "# 1. Make substitutions for non-escaped patte...
[ 171, 0 ]
[ 233, 23 ]
python
en
['en', 'error', 'th']
False
substitute_value_from_secret_store
(value)
This method takes a value, tries to parse the value to fetch a secret from a secret manager and returns the secret's value only if the input value is a string and contains one of the following patterns: - AWS Secrets Manager: the input value starts with ``secret|arn:aws:secretsmanager`` - GCP Secret ...
This method takes a value, tries to parse the value to fetch a secret from a secret manager and returns the secret's value only if the input value is a string and contains one of the following patterns:
def substitute_value_from_secret_store(value): """ This method takes a value, tries to parse the value to fetch a secret from a secret manager and returns the secret's value only if the input value is a string and contains one of the following patterns: - AWS Secrets Manager: the input value starts wit...
[ "def", "substitute_value_from_secret_store", "(", "value", ")", ":", "if", "isinstance", "(", "value", ",", "str", ")", "and", "value", ".", "startswith", "(", "\"secret|\"", ")", ":", "if", "value", ".", "startswith", "(", "\"secret|arn:aws:secretsmanager\"", "...
[ 237, 0 ]
[ 270, 16 ]
python
en
['en', 'error', 'th']
False
substitute_value_from_aws_secrets_manager
(value)
This methods uses a boto3 client and the secretsmanager service to try to retrieve the secret value from the elements it is able to parse from the input value. - value: string with pattern ``secret|arn:aws:secretsmanager:${region_name}:${account_id}:secret:${secret_name}`` optional : after the va...
This methods uses a boto3 client and the secretsmanager service to try to retrieve the secret value from the elements it is able to parse from the input value.
def substitute_value_from_aws_secrets_manager(value): """ This methods uses a boto3 client and the secretsmanager service to try to retrieve the secret value from the elements it is able to parse from the input value. - value: string with pattern ``secret|arn:aws:secretsmanager:${region_name}:${account...
[ "def", "substitute_value_from_aws_secrets_manager", "(", "value", ")", ":", "regex", "=", "re", ".", "compile", "(", "r\"^secret\\|arn:aws:secretsmanager:([a-z\\-0-9]+):([0-9]{12}):secret:([a-zA-Z0-9\\/_\\+=\\.@\\-]+)\"", "r\"(?:\\:([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{...
[ 273, 0 ]
[ 337, 17 ]
python
en
['en', 'error', 'th']
False
substitute_value_from_gcp_secret_manager
(value)
This methods uses a google.cloud.secretmanager.SecretManagerServiceClient to try to retrieve the secret value from the elements it is able to parse from the input value. value: string with pattern ``secret|projects/${project_id}/secrets/${secret_name}`` optional : after the value above, a secret ...
This methods uses a google.cloud.secretmanager.SecretManagerServiceClient to try to retrieve the secret value from the elements it is able to parse from the input value.
def substitute_value_from_gcp_secret_manager(value): """ This methods uses a google.cloud.secretmanager.SecretManagerServiceClient to try to retrieve the secret value from the elements it is able to parse from the input value. value: string with pattern ``secret|projects/${project_id}/secrets/${secret_...
[ "def", "substitute_value_from_gcp_secret_manager", "(", "value", ")", ":", "regex", "=", "re", ".", "compile", "(", "r\"^secret\\|projects\\/([a-z0-9\\_\\-]{6,30})\\/secrets/([a-zA-Z\\_\\-]{1,255})\"", "r\"(?:\\/versions\\/([a-z0-9]+))?(?:\\|([^\\|]+))?$\"", ")", "if", "not", "secr...
[ 340, 0 ]
[ 395, 17 ]
python
en
['en', 'error', 'th']
False