repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
3 values
summary
stringlengths
4
350
cfobel/webcam-recorder
webcam_recorder/caps.py
caps_str_to_df
def caps_str_to_df(caps_str): ''' Parse caps string (as returned by `Gst.Pad.query_caps().to_string()`) into `pandas.DataFrame` table, with one row per configuration. ''' structures = [dict([process_dict(v.groupdict()) for v in re.finditer( r'(?P<key>[^ ]*)=...
python
def caps_str_to_df(caps_str): ''' Parse caps string (as returned by `Gst.Pad.query_caps().to_string()`) into `pandas.DataFrame` table, with one row per configuration. ''' structures = [dict([process_dict(v.groupdict()) for v in re.finditer( r'(?P<key>[^ ]*)=...
[ "def", "caps_str_to_df", "(", "caps_str", ")", ":", "structures", "=", "[", "dict", "(", "[", "process_dict", "(", "v", ".", "groupdict", "(", ")", ")", "for", "v", "in", "re", ".", "finditer", "(", "r'(?P<key>[^ ]*)=\\((?P<type>.*?)\\)((?P<value>[^{].*?)|{(?P<v...
Parse caps string (as returned by `Gst.Pad.query_caps().to_string()`) into `pandas.DataFrame` table, with one row per configuration.
[ "Parse", "caps", "string", "(", "as", "returned", "by", "Gst", ".", "Pad", ".", "query_caps", "()", ".", "to_string", "()", ")", "into", "pandas", ".", "DataFrame", "table", "with", "one", "row", "per", "configuration", "." ]
ffeb57c9044033fbea6372b3e642b83fd42dea87
https://github.com/cfobel/webcam-recorder/blob/ffeb57c9044033fbea6372b3e642b83fd42dea87/webcam_recorder/caps.py#L73-L112
train
Parse a string containing a set of caps into a pandas. DataFrame.
cfobel/webcam-recorder
webcam_recorder/caps.py
get_device_configs
def get_device_configs(): ''' Return a `pandas.DataFrame`, where each row corresponds to an available device configuration, including the `device` (i.e., the name of the device). ''' frames = [] for i in range(2): for device in get_video_sources(): df_device_i = get_conf...
python
def get_device_configs(): ''' Return a `pandas.DataFrame`, where each row corresponds to an available device configuration, including the `device` (i.e., the name of the device). ''' frames = [] for i in range(2): for device in get_video_sources(): df_device_i = get_conf...
[ "def", "get_device_configs", "(", ")", ":", "frames", "=", "[", "]", "for", "i", "in", "range", "(", "2", ")", ":", "for", "device", "in", "get_video_sources", "(", ")", ":", "df_device_i", "=", "get_configs", "(", "device", ")", "df_device_i", ".", "i...
Return a `pandas.DataFrame`, where each row corresponds to an available device configuration, including the `device` (i.e., the name of the device).
[ "Return", "a", "pandas", ".", "DataFrame", "where", "each", "row", "corresponds", "to", "an", "available", "device", "configuration", "including", "the", "device", "(", "i", ".", "e", ".", "the", "name", "of", "the", "device", ")", "." ]
ffeb57c9044033fbea6372b3e642b83fd42dea87
https://github.com/cfobel/webcam-recorder/blob/ffeb57c9044033fbea6372b3e642b83fd42dea87/webcam_recorder/caps.py#L202-L220
train
Return a pandas. DataFrame where each row corresponds to an available device configuration including the device.
evolbioinfo/pastml
pastml/parsimony.py
initialise_parsimonious_states
def initialise_parsimonious_states(tree, feature, states): """ Initializes the bottom-up state arrays for tips based on their states given by the feature. :param tree: ete3.Tree, tree for which the tip states are to be initialized :param feature: str, feature in which the tip states are stored (the val...
python
def initialise_parsimonious_states(tree, feature, states): """ Initializes the bottom-up state arrays for tips based on their states given by the feature. :param tree: ete3.Tree, tree for which the tip states are to be initialized :param feature: str, feature in which the tip states are stored (the val...
[ "def", "initialise_parsimonious_states", "(", "tree", ",", "feature", ",", "states", ")", ":", "ps_feature_down", "=", "get_personalized_feature_name", "(", "feature", ",", "BU_PARS_STATES", ")", "ps_feature", "=", "get_personalized_feature_name", "(", "feature", ",", ...
Initializes the bottom-up state arrays for tips based on their states given by the feature. :param tree: ete3.Tree, tree for which the tip states are to be initialized :param feature: str, feature in which the tip states are stored (the value could be None for a missing state) :param states: numpy array, p...
[ "Initializes", "the", "bottom", "-", "up", "state", "arrays", "for", "tips", "based", "on", "their", "states", "given", "by", "the", "feature", "." ]
df8a375841525738383e59548eed3441b07dbd3e
https://github.com/evolbioinfo/pastml/blob/df8a375841525738383e59548eed3441b07dbd3e/pastml/parsimony.py#L48-L67
train
Initialises the bottom - up state arrays for tips based on their states given by the feature.
evolbioinfo/pastml
pastml/parsimony.py
get_most_common_states
def get_most_common_states(state_iterable): """ Gets the set of most common states among the state sets contained in the iterable argument :param state_iterable: iterable of state sets :return: set of most common states """ state_counter = Counter() for states in state_iterable: stat...
python
def get_most_common_states(state_iterable): """ Gets the set of most common states among the state sets contained in the iterable argument :param state_iterable: iterable of state sets :return: set of most common states """ state_counter = Counter() for states in state_iterable: stat...
[ "def", "get_most_common_states", "(", "state_iterable", ")", ":", "state_counter", "=", "Counter", "(", ")", "for", "states", "in", "state_iterable", ":", "state_counter", ".", "update", "(", "states", ")", "max_count", "=", "state_counter", ".", "most_common", ...
Gets the set of most common states among the state sets contained in the iterable argument :param state_iterable: iterable of state sets :return: set of most common states
[ "Gets", "the", "set", "of", "most", "common", "states", "among", "the", "state", "sets", "contained", "in", "the", "iterable", "argument", ":", "param", "state_iterable", ":", "iterable", "of", "state", "sets", ":", "return", ":", "set", "of", "most", "com...
df8a375841525738383e59548eed3441b07dbd3e
https://github.com/evolbioinfo/pastml/blob/df8a375841525738383e59548eed3441b07dbd3e/pastml/parsimony.py#L70-L80
train
Gets the set of most common states among the state sets contained in the iterable argument
evolbioinfo/pastml
pastml/parsimony.py
uppass
def uppass(tree, feature): """ UPPASS traverses the tree starting from the tips and going up till the root, and assigns to each parent node a state based on the states of its child nodes. if N is a tip: S(N) <- state of N else: L, R <- left and right children of N UPPASS(L) UP...
python
def uppass(tree, feature): """ UPPASS traverses the tree starting from the tips and going up till the root, and assigns to each parent node a state based on the states of its child nodes. if N is a tip: S(N) <- state of N else: L, R <- left and right children of N UPPASS(L) UP...
[ "def", "uppass", "(", "tree", ",", "feature", ")", ":", "ps_feature", "=", "get_personalized_feature_name", "(", "feature", ",", "BU_PARS_STATES", ")", "for", "node", "in", "tree", ".", "traverse", "(", "'postorder'", ")", ":", "if", "not", "node", ".", "i...
UPPASS traverses the tree starting from the tips and going up till the root, and assigns to each parent node a state based on the states of its child nodes. if N is a tip: S(N) <- state of N else: L, R <- left and right children of N UPPASS(L) UPPASS(R) if S(L) intersects with S...
[ "UPPASS", "traverses", "the", "tree", "starting", "from", "the", "tips", "and", "going", "up", "till", "the", "root", "and", "assigns", "to", "each", "parent", "node", "a", "state", "based", "on", "the", "states", "of", "its", "child", "nodes", "." ]
df8a375841525738383e59548eed3441b07dbd3e
https://github.com/evolbioinfo/pastml/blob/df8a375841525738383e59548eed3441b07dbd3e/pastml/parsimony.py#L83-L111
train
UPPASS traverses the tree and assigns each node a state based on the states of its children.
evolbioinfo/pastml
pastml/parsimony.py
acctran
def acctran(tree, character, feature=PARS_STATES): """ ACCTRAN (accelerated transformation) (Farris, 1970) aims at reducing the number of ambiguities in the parsimonious result. ACCTRAN forces the state changes to be performed as close to the root as possible, and therefore prioritises the reverse mutat...
python
def acctran(tree, character, feature=PARS_STATES): """ ACCTRAN (accelerated transformation) (Farris, 1970) aims at reducing the number of ambiguities in the parsimonious result. ACCTRAN forces the state changes to be performed as close to the root as possible, and therefore prioritises the reverse mutat...
[ "def", "acctran", "(", "tree", ",", "character", ",", "feature", "=", "PARS_STATES", ")", ":", "ps_feature_down", "=", "get_personalized_feature_name", "(", "character", ",", "BU_PARS_STATES", ")", "for", "node", "in", "tree", ".", "traverse", "(", "'preorder'",...
ACCTRAN (accelerated transformation) (Farris, 1970) aims at reducing the number of ambiguities in the parsimonious result. ACCTRAN forces the state changes to be performed as close to the root as possible, and therefore prioritises the reverse mutations. if N is not a tip: L, R <- left and right ch...
[ "ACCTRAN", "(", "accelerated", "transformation", ")", "(", "Farris", "1970", ")", "aims", "at", "reducing", "the", "number", "of", "ambiguities", "in", "the", "parsimonious", "result", ".", "ACCTRAN", "forces", "the", "state", "changes", "to", "be", "performed...
df8a375841525738383e59548eed3441b07dbd3e
https://github.com/evolbioinfo/pastml/blob/df8a375841525738383e59548eed3441b07dbd3e/pastml/parsimony.py#L114-L143
train
acctran - computes the tree nodes and their children and adds the feature to the tree nodes and their children.
evolbioinfo/pastml
pastml/parsimony.py
downpass
def downpass(tree, feature, states): """ DOWNPASS traverses the tree starting from the root and going down till the tips, and for each node combines the state information from its supertree and its subtree (calculated at UPPASS). As the root state was already the most parsimonious after the UPPASS, ...
python
def downpass(tree, feature, states): """ DOWNPASS traverses the tree starting from the root and going down till the tips, and for each node combines the state information from its supertree and its subtree (calculated at UPPASS). As the root state was already the most parsimonious after the UPPASS, ...
[ "def", "downpass", "(", "tree", ",", "feature", ",", "states", ")", ":", "ps_feature_down", "=", "get_personalized_feature_name", "(", "feature", ",", "BU_PARS_STATES", ")", "ps_feature_up", "=", "get_personalized_feature_name", "(", "feature", ",", "TD_PARS_STATES", ...
DOWNPASS traverses the tree starting from the root and going down till the tips, and for each node combines the state information from its supertree and its subtree (calculated at UPPASS). As the root state was already the most parsimonious after the UPPASS, we skip it and start directly with the root child...
[ "DOWNPASS", "traverses", "the", "tree", "starting", "from", "the", "root", "and", "going", "down", "till", "the", "tips", "and", "for", "each", "node", "combines", "the", "state", "information", "from", "its", "supertree", "and", "its", "subtree", "(", "calc...
df8a375841525738383e59548eed3441b07dbd3e
https://github.com/evolbioinfo/pastml/blob/df8a375841525738383e59548eed3441b07dbd3e/pastml/parsimony.py#L146-L191
train
This function traverses the tree and adds the state information from the root to the tree and the tree of interest to the UPPASS.
evolbioinfo/pastml
pastml/parsimony.py
deltran
def deltran(tree, feature): """ DELTRAN (delayed transformation) (Swofford & Maddison, 1987) aims at reducing the number of ambiguities in the parsimonious result. DELTRAN makes the changes as close as possible to the leaves, hence prioritizing parallel mutations. DELTRAN is performed after DOWNPASS. ...
python
def deltran(tree, feature): """ DELTRAN (delayed transformation) (Swofford & Maddison, 1987) aims at reducing the number of ambiguities in the parsimonious result. DELTRAN makes the changes as close as possible to the leaves, hence prioritizing parallel mutations. DELTRAN is performed after DOWNPASS. ...
[ "def", "deltran", "(", "tree", ",", "feature", ")", ":", "ps_feature", "=", "get_personalized_feature_name", "(", "feature", ",", "PARS_STATES", ")", "for", "node", "in", "tree", ".", "traverse", "(", "'preorder'", ")", ":", "if", "not", "node", ".", "is_r...
DELTRAN (delayed transformation) (Swofford & Maddison, 1987) aims at reducing the number of ambiguities in the parsimonious result. DELTRAN makes the changes as close as possible to the leaves, hence prioritizing parallel mutations. DELTRAN is performed after DOWNPASS. if N is not a root: P <- pare...
[ "DELTRAN", "(", "delayed", "transformation", ")", "(", "Swofford", "&", "Maddison", "1987", ")", "aims", "at", "reducing", "the", "number", "of", "ambiguities", "in", "the", "parsimonious", "result", ".", "DELTRAN", "makes", "the", "changes", "as", "close", ...
df8a375841525738383e59548eed3441b07dbd3e
https://github.com/evolbioinfo/pastml/blob/df8a375841525738383e59548eed3441b07dbd3e/pastml/parsimony.py#L194-L221
train
This function is used to remove the parsimonious states from the tree.
evolbioinfo/pastml
pastml/parsimony.py
parsimonious_acr
def parsimonious_acr(tree, character, prediction_method, states, num_nodes, num_tips): """ Calculates parsimonious states on the tree and stores them in the corresponding feature. :param states: numpy array of possible states :param prediction_method: str, ACCTRAN (accelerated transformation), DELTRAN ...
python
def parsimonious_acr(tree, character, prediction_method, states, num_nodes, num_tips): """ Calculates parsimonious states on the tree and stores them in the corresponding feature. :param states: numpy array of possible states :param prediction_method: str, ACCTRAN (accelerated transformation), DELTRAN ...
[ "def", "parsimonious_acr", "(", "tree", ",", "character", ",", "prediction_method", ",", "states", ",", "num_nodes", ",", "num_tips", ")", ":", "initialise_parsimonious_states", "(", "tree", ",", "character", ",", "states", ")", "uppass", "(", "tree", ",", "ch...
Calculates parsimonious states on the tree and stores them in the corresponding feature. :param states: numpy array of possible states :param prediction_method: str, ACCTRAN (accelerated transformation), DELTRAN (delayed transformation) or DOWNPASS :param tree: ete3.Tree, the tree of interest :param ch...
[ "Calculates", "parsimonious", "states", "on", "the", "tree", "and", "stores", "them", "in", "the", "corresponding", "feature", "." ]
df8a375841525738383e59548eed3441b07dbd3e
https://github.com/evolbioinfo/pastml/blob/df8a375841525738383e59548eed3441b07dbd3e/pastml/parsimony.py#L224-L289
train
Calculates the parsimonious states on the tree and stores them in the corresponding feature.
evolbioinfo/pastml
pastml/parsimony.py
choose_parsimonious_states
def choose_parsimonious_states(tree, ps_feature, out_feature): """ Converts the content of the get_personalized_feature_name(feature, PARS_STATES) node feature to the predicted states and stores them in the `feature` feature to each node. The get_personalized_feature_name(feature, PARS_STATES) is delete...
python
def choose_parsimonious_states(tree, ps_feature, out_feature): """ Converts the content of the get_personalized_feature_name(feature, PARS_STATES) node feature to the predicted states and stores them in the `feature` feature to each node. The get_personalized_feature_name(feature, PARS_STATES) is delete...
[ "def", "choose_parsimonious_states", "(", "tree", ",", "ps_feature", ",", "out_feature", ")", ":", "num_scenarios", "=", "1", "unresolved_nodes", "=", "0", "num_states", "=", "0", "for", "node", "in", "tree", ".", "traverse", "(", ")", ":", "states", "=", ...
Converts the content of the get_personalized_feature_name(feature, PARS_STATES) node feature to the predicted states and stores them in the `feature` feature to each node. The get_personalized_feature_name(feature, PARS_STATES) is deleted. :param feature: str, character for which the parsimonious states ar...
[ "Converts", "the", "content", "of", "the", "get_personalized_feature_name", "(", "feature", "PARS_STATES", ")", "node", "feature", "to", "the", "predicted", "states", "and", "stores", "them", "in", "the", "feature", "feature", "to", "each", "node", ".", "The", ...
df8a375841525738383e59548eed3441b07dbd3e
https://github.com/evolbioinfo/pastml/blob/df8a375841525738383e59548eed3441b07dbd3e/pastml/parsimony.py#L292-L314
train
This function converts the content of the get_personalized_feature_name ( feature PARS_STATES node feature to the predicted states and stores them in the out_feature node.
frasertweedale/ledgertools
ltlib/chart.py
balance_to_ringchart_items
def balance_to_ringchart_items(balance, account='', show=SHOW_CREDIT): """Convert a balance data structure into RingChartItem objects.""" show = show if show else SHOW_CREDIT # cannot show all in ring chart rcis = [] for item in balance: subaccount = item['account_fragment'] if not account \ ...
python
def balance_to_ringchart_items(balance, account='', show=SHOW_CREDIT): """Convert a balance data structure into RingChartItem objects.""" show = show if show else SHOW_CREDIT # cannot show all in ring chart rcis = [] for item in balance: subaccount = item['account_fragment'] if not account \ ...
[ "def", "balance_to_ringchart_items", "(", "balance", ",", "account", "=", "''", ",", "show", "=", "SHOW_CREDIT", ")", ":", "show", "=", "show", "if", "show", "else", "SHOW_CREDIT", "# cannot show all in ring chart", "rcis", "=", "[", "]", "for", "item", "in", ...
Convert a balance data structure into RingChartItem objects.
[ "Convert", "a", "balance", "data", "structure", "into", "RingChartItem", "objects", "." ]
a695f8667d72253e5448693c12f0282d09902aaa
https://github.com/frasertweedale/ledgertools/blob/a695f8667d72253e5448693c12f0282d09902aaa/ltlib/chart.py#L27-L45
train
Convert a balance data structure into a list of RingChartItem objects.
orlandodiaz/log3
log3/log.py
log_to_file
def log_to_file(log_path, log_urllib=False, limit=None): """ Add file_handler to logger""" log_path = log_path file_handler = logging.FileHandler(log_path) if limit: file_handler = RotatingFileHandler( log_path, mode='a', maxBytes=limit * 1024 * 1024, ...
python
def log_to_file(log_path, log_urllib=False, limit=None): """ Add file_handler to logger""" log_path = log_path file_handler = logging.FileHandler(log_path) if limit: file_handler = RotatingFileHandler( log_path, mode='a', maxBytes=limit * 1024 * 1024, ...
[ "def", "log_to_file", "(", "log_path", ",", "log_urllib", "=", "False", ",", "limit", "=", "None", ")", ":", "log_path", "=", "log_path", "file_handler", "=", "logging", ".", "FileHandler", "(", "log_path", ")", "if", "limit", ":", "file_handler", "=", "Ro...
Add file_handler to logger
[ "Add", "file_handler", "to", "logger" ]
aeedf83159be8dd3d4757e0d9240f9cdbc9c3ea2
https://github.com/orlandodiaz/log3/blob/aeedf83159be8dd3d4757e0d9240f9cdbc9c3ea2/log3/log.py#L34-L53
train
Add file_handler to logger
YosaiProject/yosai_alchemystore
yosai_alchemystore/accountstore/accountstore.py
session_context
def session_context(fn): """ Handles session setup and teardown """ @functools.wraps(fn) def wrap(*args, **kwargs): session = args[0].Session() # obtain from self result = fn(*args, session=session, **kwargs) session.close() return result return wrap
python
def session_context(fn): """ Handles session setup and teardown """ @functools.wraps(fn) def wrap(*args, **kwargs): session = args[0].Session() # obtain from self result = fn(*args, session=session, **kwargs) session.close() return result return wrap
[ "def", "session_context", "(", "fn", ")", ":", "@", "functools", ".", "wraps", "(", "fn", ")", "def", "wrap", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "session", "=", "args", "[", "0", "]", ".", "Session", "(", ")", "# obtain from self"...
Handles session setup and teardown
[ "Handles", "session", "setup", "and", "teardown" ]
6479c159ab2ac357e6b70cdd71a2d673279e86bb
https://github.com/YosaiProject/yosai_alchemystore/blob/6479c159ab2ac357e6b70cdd71a2d673279e86bb/yosai_alchemystore/accountstore/accountstore.py#L66-L76
train
A decorator that returns a function that opens a session and returns it.
YosaiProject/yosai_alchemystore
yosai_alchemystore/accountstore/accountstore.py
AlchemyAccountStore._get_permissions_query
def _get_permissions_query(self, session, identifier): """ select domain, json_agg(parts) as permissions from (select domain, row_to_json(r) as parts from (select domain, action, array_agg(distinct target) as target from (select (case when domain i...
python
def _get_permissions_query(self, session, identifier): """ select domain, json_agg(parts) as permissions from (select domain, row_to_json(r) as parts from (select domain, action, array_agg(distinct target) as target from (select (case when domain i...
[ "def", "_get_permissions_query", "(", "self", ",", "session", ",", "identifier", ")", ":", "thedomain", "=", "case", "(", "[", "(", "Domain", ".", "name", "==", "None", ",", "'*'", ")", "]", ",", "else_", "=", "Domain", ".", "name", ")", "theaction", ...
select domain, json_agg(parts) as permissions from (select domain, row_to_json(r) as parts from (select domain, action, array_agg(distinct target) as target from (select (case when domain is null then '*' else domain end) as domain, ...
[ "select", "domain", "json_agg", "(", "parts", ")", "as", "permissions", "from", "(", "select", "domain", "row_to_json", "(", "r", ")", "as", "parts", "from", "(", "select", "domain", "action", "array_agg", "(", "distinct", "target", ")", "as", "target", "f...
6479c159ab2ac357e6b70cdd71a2d673279e86bb
https://github.com/YosaiProject/yosai_alchemystore/blob/6479c159ab2ac357e6b70cdd71a2d673279e86bb/yosai_alchemystore/accountstore/accountstore.py#L106-L157
train
Get all the permissions for the given identifier.
YosaiProject/yosai_alchemystore
yosai_alchemystore/accountstore/accountstore.py
AlchemyAccountStore._get_roles_query
def _get_roles_query(self, session, identifier): """ :type identifier: string """ return (session.query(Role). join(role_membership_table, Role.pk_id == role_membership_table.c.role_id). join(User, role_membership_table.c.user_id == User.pk_id). ...
python
def _get_roles_query(self, session, identifier): """ :type identifier: string """ return (session.query(Role). join(role_membership_table, Role.pk_id == role_membership_table.c.role_id). join(User, role_membership_table.c.user_id == User.pk_id). ...
[ "def", "_get_roles_query", "(", "self", ",", "session", ",", "identifier", ")", ":", "return", "(", "session", ".", "query", "(", "Role", ")", ".", "join", "(", "role_membership_table", ",", "Role", ".", "pk_id", "==", "role_membership_table", ".", "c", "....
:type identifier: string
[ ":", "type", "identifier", ":", "string" ]
6479c159ab2ac357e6b70cdd71a2d673279e86bb
https://github.com/YosaiProject/yosai_alchemystore/blob/6479c159ab2ac357e6b70cdd71a2d673279e86bb/yosai_alchemystore/accountstore/accountstore.py#L159-L166
train
Get the query for the roles table.
YosaiProject/yosai_alchemystore
yosai_alchemystore/accountstore/accountstore.py
AlchemyAccountStore.get_authc_info
def get_authc_info(self, identifier, session=None): """ If an Account requires credentials from multiple data stores, this AccountStore is responsible for aggregating them (composite) and returning the results in a single account object. :returns: a dict of account attributes ...
python
def get_authc_info(self, identifier, session=None): """ If an Account requires credentials from multiple data stores, this AccountStore is responsible for aggregating them (composite) and returning the results in a single account object. :returns: a dict of account attributes ...
[ "def", "get_authc_info", "(", "self", ",", "identifier", ",", "session", "=", "None", ")", ":", "user", "=", "self", ".", "_get_user_query", "(", "session", ",", "identifier", ")", ".", "first", "(", ")", "creds", "=", "self", ".", "_get_credential_query",...
If an Account requires credentials from multiple data stores, this AccountStore is responsible for aggregating them (composite) and returning the results in a single account object. :returns: a dict of account attributes
[ "If", "an", "Account", "requires", "credentials", "from", "multiple", "data", "stores", "this", "AccountStore", "is", "responsible", "for", "aggregating", "them", "(", "composite", ")", "and", "returning", "the", "results", "in", "a", "single", "account", "objec...
6479c159ab2ac357e6b70cdd71a2d673279e86bb
https://github.com/YosaiProject/yosai_alchemystore/blob/6479c159ab2ac357e6b70cdd71a2d673279e86bb/yosai_alchemystore/accountstore/accountstore.py#L175-L194
train
Get the authentication information for a single account.
geophysics-ubonn/reda
lib/reda/exporters/syscal.py
_syscal_write_electrode_coords
def _syscal_write_electrode_coords(fid, spacing, N): """helper function that writes out electrode positions to a file descriptor Parameters ---------- fid: file descriptor data is written here spacing: float spacing of electrodes N: int number of electrodes """ f...
python
def _syscal_write_electrode_coords(fid, spacing, N): """helper function that writes out electrode positions to a file descriptor Parameters ---------- fid: file descriptor data is written here spacing: float spacing of electrodes N: int number of electrodes """ f...
[ "def", "_syscal_write_electrode_coords", "(", "fid", ",", "spacing", ",", "N", ")", ":", "fid", ".", "write", "(", "'# X Y Z\\n'", ")", "for", "i", "in", "range", "(", "0", ",", "N", ")", ":", "fid", ".", "write", "(", "'{0} {1} {2} {3}\\n'", ".", "for...
helper function that writes out electrode positions to a file descriptor Parameters ---------- fid: file descriptor data is written here spacing: float spacing of electrodes N: int number of electrodes
[ "helper", "function", "that", "writes", "out", "electrode", "positions", "to", "a", "file", "descriptor" ]
46a939729e40c7c4723315c03679c40761152e9e
https://github.com/geophysics-ubonn/reda/blob/46a939729e40c7c4723315c03679c40761152e9e/lib/reda/exporters/syscal.py#L5-L19
train
helper function that writes out electrode positions to a file descriptor fid
geophysics-ubonn/reda
lib/reda/exporters/syscal.py
_syscal_write_quadpoles
def _syscal_write_quadpoles(fid, quadpoles): """helper function that writes the actual measurement configurations to a file descriptor. Parameters ---------- fid: file descriptor data is written here quadpoles: numpy.ndarray measurement configurations """ fid.write('# A...
python
def _syscal_write_quadpoles(fid, quadpoles): """helper function that writes the actual measurement configurations to a file descriptor. Parameters ---------- fid: file descriptor data is written here quadpoles: numpy.ndarray measurement configurations """ fid.write('# A...
[ "def", "_syscal_write_quadpoles", "(", "fid", ",", "quadpoles", ")", ":", "fid", ".", "write", "(", "'# A B M N\\n'", ")", "for", "nr", ",", "quadpole", "in", "enumerate", "(", "quadpoles", ")", ":", "fid", ".", "write", "(", "'{0} {1} {2} {3} {4}\\n'", ".",...
helper function that writes the actual measurement configurations to a file descriptor. Parameters ---------- fid: file descriptor data is written here quadpoles: numpy.ndarray measurement configurations
[ "helper", "function", "that", "writes", "the", "actual", "measurement", "configurations", "to", "a", "file", "descriptor", "." ]
46a939729e40c7c4723315c03679c40761152e9e
https://github.com/geophysics-ubonn/reda/blob/46a939729e40c7c4723315c03679c40761152e9e/lib/reda/exporters/syscal.py#L22-L38
train
helper function that writes the actual measurement configurations to a file descriptor.
geophysics-ubonn/reda
lib/reda/exporters/syscal.py
syscal_save_to_config_txt
def syscal_save_to_config_txt(filename, configs, spacing=1): """Write configurations to a Syscal ascii file that can be read by the Electre Pro program. Parameters ---------- filename: string output filename configs: numpy.ndarray Nx4 array with measurement configurations A-B-M-...
python
def syscal_save_to_config_txt(filename, configs, spacing=1): """Write configurations to a Syscal ascii file that can be read by the Electre Pro program. Parameters ---------- filename: string output filename configs: numpy.ndarray Nx4 array with measurement configurations A-B-M-...
[ "def", "syscal_save_to_config_txt", "(", "filename", ",", "configs", ",", "spacing", "=", "1", ")", ":", "print", "(", "'Number of measurements: '", ",", "configs", ".", "shape", "[", "0", "]", ")", "number_of_electrodes", "=", "configs", ".", "max", "(", ")...
Write configurations to a Syscal ascii file that can be read by the Electre Pro program. Parameters ---------- filename: string output filename configs: numpy.ndarray Nx4 array with measurement configurations A-B-M-N
[ "Write", "configurations", "to", "a", "Syscal", "ascii", "file", "that", "can", "be", "read", "by", "the", "Electre", "Pro", "program", "." ]
46a939729e40c7c4723315c03679c40761152e9e
https://github.com/geophysics-ubonn/reda/blob/46a939729e40c7c4723315c03679c40761152e9e/lib/reda/exporters/syscal.py#L41-L58
train
Write configurations to a Syscal ascii file that can be read by the Electre Pro program.
geophysics-ubonn/reda
lib/reda/utils/mpl.py
setup
def setup(use_latex=False, overwrite=False): """Set up matplotlib imports and settings. Parameters ---------- use_latex: bool, optional Determine if Latex output should be used. Latex will only be enable if a 'latex' binary is found in the system. overwrite: bool, optional O...
python
def setup(use_latex=False, overwrite=False): """Set up matplotlib imports and settings. Parameters ---------- use_latex: bool, optional Determine if Latex output should be used. Latex will only be enable if a 'latex' binary is found in the system. overwrite: bool, optional O...
[ "def", "setup", "(", "use_latex", "=", "False", ",", "overwrite", "=", "False", ")", ":", "# just make sure we can access matplotlib as mpl", "import", "matplotlib", "as", "mpl", "# general settings", "if", "overwrite", ":", "mpl", ".", "rcParams", "[", "\"lines.lin...
Set up matplotlib imports and settings. Parameters ---------- use_latex: bool, optional Determine if Latex output should be used. Latex will only be enable if a 'latex' binary is found in the system. overwrite: bool, optional Overwrite some matplotlib config values. Returns...
[ "Set", "up", "matplotlib", "imports", "and", "settings", "." ]
46a939729e40c7c4723315c03679c40761152e9e
https://github.com/geophysics-ubonn/reda/blob/46a939729e40c7c4723315c03679c40761152e9e/lib/reda/utils/mpl.py#L19-L64
train
Set up matplotlib imports and settings.
geophysics-ubonn/reda
lib/reda/importers/crtomo.py
load_mod_file
def load_mod_file(filename): """Load a .mod file (sometimes also called volt.dat or data.crt). This file contains the number of measurements in the first line, and in the following lines measurements. Each line consists of 4 columns: * the first column contains the current injection electrodes a and b,...
python
def load_mod_file(filename): """Load a .mod file (sometimes also called volt.dat or data.crt). This file contains the number of measurements in the first line, and in the following lines measurements. Each line consists of 4 columns: * the first column contains the current injection electrodes a and b,...
[ "def", "load_mod_file", "(", "filename", ")", ":", "df_raw", "=", "pd", ".", "read_csv", "(", "filename", ",", "skiprows", "=", "1", ",", "delim_whitespace", "=", "True", ",", "names", "=", "[", "'ab'", ",", "'mn'", ",", "'r'", ",", "'rpha'", "]", ")...
Load a .mod file (sometimes also called volt.dat or data.crt). This file contains the number of measurements in the first line, and in the following lines measurements. Each line consists of 4 columns: * the first column contains the current injection electrodes a and b, stored as one integer using t...
[ "Load", "a", ".", "mod", "file", "(", "sometimes", "also", "called", "volt", ".", "dat", "or", "data", ".", "crt", ")", ".", "This", "file", "contains", "the", "number", "of", "measurements", "in", "the", "first", "line", "and", "in", "the", "following...
46a939729e40c7c4723315c03679c40761152e9e
https://github.com/geophysics-ubonn/reda/blob/46a939729e40c7c4723315c03679c40761152e9e/lib/reda/importers/crtomo.py#L13-L55
train
Load a. mod file and return a DataFrame.
geophysics-ubonn/reda
lib/reda/importers/crtomo.py
load_seit_data
def load_seit_data(directory, frequency_file='frequencies.dat', data_prefix='volt_', **kwargs): """Load sEIT data from data directory. This function loads data previously exported from reda using reda.exporters.crtomo.write_files_to_directory Parameters ---------- directory : str...
python
def load_seit_data(directory, frequency_file='frequencies.dat', data_prefix='volt_', **kwargs): """Load sEIT data from data directory. This function loads data previously exported from reda using reda.exporters.crtomo.write_files_to_directory Parameters ---------- directory : str...
[ "def", "load_seit_data", "(", "directory", ",", "frequency_file", "=", "'frequencies.dat'", ",", "data_prefix", "=", "'volt_'", ",", "*", "*", "kwargs", ")", ":", "frequencies", "=", "np", ".", "loadtxt", "(", "directory", "+", "os", ".", "sep", "+", "freq...
Load sEIT data from data directory. This function loads data previously exported from reda using reda.exporters.crtomo.write_files_to_directory Parameters ---------- directory : string input directory frequency_file : string, optional file (located in directory) that contains the fr...
[ "Load", "sEIT", "data", "from", "data", "directory", ".", "This", "function", "loads", "data", "previously", "exported", "from", "reda", "using", "reda", ".", "exporters", ".", "crtomo", ".", "write_files_to_directory" ]
46a939729e40c7c4723315c03679c40761152e9e
https://github.com/geophysics-ubonn/reda/blob/46a939729e40c7c4723315c03679c40761152e9e/lib/reda/importers/crtomo.py#L59-L100
train
Loads data from a directory containing the sEIT electrodes and topography data files.
evolbioinfo/pastml
pastml/models/generator.py
get_diagonalisation
def get_diagonalisation(frequencies, rate_matrix=None): """ Normalises and diagonalises the rate matrix. :param frequencies: character state frequencies. :type frequencies: numpy.array :param rate_matrix: (optional) rate matrix (by default an all-equal-rate matrix is used) :type rate_matrix: nu...
python
def get_diagonalisation(frequencies, rate_matrix=None): """ Normalises and diagonalises the rate matrix. :param frequencies: character state frequencies. :type frequencies: numpy.array :param rate_matrix: (optional) rate matrix (by default an all-equal-rate matrix is used) :type rate_matrix: nu...
[ "def", "get_diagonalisation", "(", "frequencies", ",", "rate_matrix", "=", "None", ")", ":", "Q", "=", "get_normalised_generator", "(", "frequencies", ",", "rate_matrix", ")", "d", ",", "A", "=", "np", ".", "linalg", ".", "eig", "(", "Q", ")", "return", ...
Normalises and diagonalises the rate matrix. :param frequencies: character state frequencies. :type frequencies: numpy.array :param rate_matrix: (optional) rate matrix (by default an all-equal-rate matrix is used) :type rate_matrix: numpy.ndarray :return: matrix diagonalisation (d, A, A^{-1}) ...
[ "Normalises", "and", "diagonalises", "the", "rate", "matrix", "." ]
df8a375841525738383e59548eed3441b07dbd3e
https://github.com/evolbioinfo/pastml/blob/df8a375841525738383e59548eed3441b07dbd3e/pastml/models/generator.py#L4-L18
train
Returns the diagonalisation matrix for a single character state.
evolbioinfo/pastml
pastml/models/generator.py
get_normalised_generator
def get_normalised_generator(frequencies, rate_matrix=None): """ Calculates the normalised generator from the rate matrix and character state frequencies. :param frequencies: character state frequencies. :type frequencies: numpy.array :param rate_matrix: (optional) rate matrix (by default an all-eq...
python
def get_normalised_generator(frequencies, rate_matrix=None): """ Calculates the normalised generator from the rate matrix and character state frequencies. :param frequencies: character state frequencies. :type frequencies: numpy.array :param rate_matrix: (optional) rate matrix (by default an all-eq...
[ "def", "get_normalised_generator", "(", "frequencies", ",", "rate_matrix", "=", "None", ")", ":", "if", "rate_matrix", "is", "None", ":", "n", "=", "len", "(", "frequencies", ")", "rate_matrix", "=", "np", ".", "ones", "(", "shape", "=", "(", "n", ",", ...
Calculates the normalised generator from the rate matrix and character state frequencies. :param frequencies: character state frequencies. :type frequencies: numpy.array :param rate_matrix: (optional) rate matrix (by default an all-equal-rate matrix is used) :type rate_matrix: numpy.ndarray :return...
[ "Calculates", "the", "normalised", "generator", "from", "the", "rate", "matrix", "and", "character", "state", "frequencies", "." ]
df8a375841525738383e59548eed3441b07dbd3e
https://github.com/evolbioinfo/pastml/blob/df8a375841525738383e59548eed3441b07dbd3e/pastml/models/generator.py#L21-L39
train
Calculates the normalised generator from the rate matrix and character state frequencies.
evolbioinfo/pastml
pastml/models/generator.py
get_pij_matrix
def get_pij_matrix(t, diag, A, A_inv): """ Calculates the probability matrix of substitutions i->j over time t, given the normalised generator diagonalisation. :param t: time :type t: float :return: probability matrix :rtype: numpy.ndarray """ return A.dot(np.diag(np.exp(diag * t))...
python
def get_pij_matrix(t, diag, A, A_inv): """ Calculates the probability matrix of substitutions i->j over time t, given the normalised generator diagonalisation. :param t: time :type t: float :return: probability matrix :rtype: numpy.ndarray """ return A.dot(np.diag(np.exp(diag * t))...
[ "def", "get_pij_matrix", "(", "t", ",", "diag", ",", "A", ",", "A_inv", ")", ":", "return", "A", ".", "dot", "(", "np", ".", "diag", "(", "np", ".", "exp", "(", "diag", "*", "t", ")", ")", ")", ".", "dot", "(", "A_inv", ")" ]
Calculates the probability matrix of substitutions i->j over time t, given the normalised generator diagonalisation. :param t: time :type t: float :return: probability matrix :rtype: numpy.ndarray
[ "Calculates", "the", "probability", "matrix", "of", "substitutions", "i", "-", ">", "j", "over", "time", "t", "given", "the", "normalised", "generator", "diagonalisation", "." ]
df8a375841525738383e59548eed3441b07dbd3e
https://github.com/evolbioinfo/pastml/blob/df8a375841525738383e59548eed3441b07dbd3e/pastml/models/generator.py#L42-L53
train
Calculates the probability matrix of substitutions i - > j over time t given the normalised generator diagonalisation.
lambdalisue/notify
src/notify/arguments.py
split_arguments
def split_arguments(args): """ Split specified arguments to two list. This is used to distinguish the options of the program and execution command/arguments. Parameters ---------- args : list Command line arguments Returns ------- list : options, arguments opti...
python
def split_arguments(args): """ Split specified arguments to two list. This is used to distinguish the options of the program and execution command/arguments. Parameters ---------- args : list Command line arguments Returns ------- list : options, arguments opti...
[ "def", "split_arguments", "(", "args", ")", ":", "prev", "=", "False", "for", "i", ",", "value", "in", "enumerate", "(", "args", "[", "1", ":", "]", ")", ":", "if", "value", ".", "startswith", "(", "'-'", ")", ":", "prev", "=", "True", "elif", "p...
Split specified arguments to two list. This is used to distinguish the options of the program and execution command/arguments. Parameters ---------- args : list Command line arguments Returns ------- list : options, arguments options indicate the optional arguments for...
[ "Split", "specified", "arguments", "to", "two", "list", "." ]
1b6d7d1faa2cea13bfaa1f35130f279a0115e686
https://github.com/lambdalisue/notify/blob/1b6d7d1faa2cea13bfaa1f35130f279a0115e686/src/notify/arguments.py#L8-L34
train
Split specified arguments into two lists.
lambdalisue/notify
src/notify/arguments.py
parse_arguments
def parse_arguments(args, config): """ Parse specified arguments via config Parameters ---------- args : list Command line arguments config : object ConfigParser instance which values are used as default values of options Returns ------- list : arguments, op...
python
def parse_arguments(args, config): """ Parse specified arguments via config Parameters ---------- args : list Command line arguments config : object ConfigParser instance which values are used as default values of options Returns ------- list : arguments, op...
[ "def", "parse_arguments", "(", "args", ",", "config", ")", ":", "import", "notify", "from", "conf", "import", "config_to_options", "opts", "=", "config_to_options", "(", "config", ")", "usage", "=", "(", "\"%(prog)s \"", "\"[-h] [-t TO_ADDR] [-f FROM_ADDR] [-e ENCODIN...
Parse specified arguments via config Parameters ---------- args : list Command line arguments config : object ConfigParser instance which values are used as default values of options Returns ------- list : arguments, options options indicate the return value...
[ "Parse", "specified", "arguments", "via", "config" ]
1b6d7d1faa2cea13bfaa1f35130f279a0115e686
https://github.com/lambdalisue/notify/blob/1b6d7d1faa2cea13bfaa1f35130f279a0115e686/src/notify/arguments.py#L36-L117
train
Parse command line arguments via config and return a list of ArgumentParser and options
jonashaag/httpauth
httpauth.py
reconstruct_uri
def reconstruct_uri(environ): """ Reconstruct the relative part of the request URI. I.e. if the requested URL is https://foo.bar/spam?eggs, ``reconstruct_uri`` returns ``'/spam?eggs'``. """ uri = environ.get('SCRIPT_NAME', '') + environ['PATH_INFO'] if environ.get('QUERY_STRING'): uri +=...
python
def reconstruct_uri(environ): """ Reconstruct the relative part of the request URI. I.e. if the requested URL is https://foo.bar/spam?eggs, ``reconstruct_uri`` returns ``'/spam?eggs'``. """ uri = environ.get('SCRIPT_NAME', '') + environ['PATH_INFO'] if environ.get('QUERY_STRING'): uri +=...
[ "def", "reconstruct_uri", "(", "environ", ")", ":", "uri", "=", "environ", ".", "get", "(", "'SCRIPT_NAME'", ",", "''", ")", "+", "environ", "[", "'PATH_INFO'", "]", "if", "environ", ".", "get", "(", "'QUERY_STRING'", ")", ":", "uri", "+=", "'?'", "+",...
Reconstruct the relative part of the request URI. I.e. if the requested URL is https://foo.bar/spam?eggs, ``reconstruct_uri`` returns ``'/spam?eggs'``.
[ "Reconstruct", "the", "relative", "part", "of", "the", "request", "URI", ".", "I", ".", "e", ".", "if", "the", "requested", "URL", "is", "https", ":", "//", "foo", ".", "bar", "/", "spam?eggs", "reconstruct_uri", "returns", "/", "spam?eggs", "." ]
1b2ab9cb5192b474c9723182690c352337f754bc
https://github.com/jonashaag/httpauth/blob/1b2ab9cb5192b474c9723182690c352337f754bc/httpauth.py#L32-L40
train
Reconstruct the relative part of the request URI.
jonashaag/httpauth
httpauth.py
BaseHttpAuthMiddleware.should_require_authentication
def should_require_authentication(self, url): """ Returns True if we should require authentication for the URL given """ return (not self.routes # require auth for all URLs or any(route.match(url) for route in self.routes))
python
def should_require_authentication(self, url): """ Returns True if we should require authentication for the URL given """ return (not self.routes # require auth for all URLs or any(route.match(url) for route in self.routes))
[ "def", "should_require_authentication", "(", "self", ",", "url", ")", ":", "return", "(", "not", "self", ".", "routes", "# require auth for all URLs", "or", "any", "(", "route", ".", "match", "(", "url", ")", "for", "route", "in", "self", ".", "routes", ")...
Returns True if we should require authentication for the URL given
[ "Returns", "True", "if", "we", "should", "require", "authentication", "for", "the", "URL", "given" ]
1b2ab9cb5192b474c9723182690c352337f754bc
https://github.com/jonashaag/httpauth/blob/1b2ab9cb5192b474c9723182690c352337f754bc/httpauth.py#L99-L102
train
Returns True if we should require authentication for the given URL
jonashaag/httpauth
httpauth.py
BaseHttpAuthMiddleware.authenticate
def authenticate(self, environ): """ Returns True if the credentials passed in the Authorization header are valid, False otherwise. """ try: hd = parse_dict_header(environ['HTTP_AUTHORIZATION']) except (KeyError, ValueError): return False ...
python
def authenticate(self, environ): """ Returns True if the credentials passed in the Authorization header are valid, False otherwise. """ try: hd = parse_dict_header(environ['HTTP_AUTHORIZATION']) except (KeyError, ValueError): return False ...
[ "def", "authenticate", "(", "self", ",", "environ", ")", ":", "try", ":", "hd", "=", "parse_dict_header", "(", "environ", "[", "'HTTP_AUTHORIZATION'", "]", ")", "except", "(", "KeyError", ",", "ValueError", ")", ":", "return", "False", "return", "self", "....
Returns True if the credentials passed in the Authorization header are valid, False otherwise.
[ "Returns", "True", "if", "the", "credentials", "passed", "in", "the", "Authorization", "header", "are", "valid", "False", "otherwise", "." ]
1b2ab9cb5192b474c9723182690c352337f754bc
https://github.com/jonashaag/httpauth/blob/1b2ab9cb5192b474c9723182690c352337f754bc/httpauth.py#L104-L120
train
Returns True if the credentials passed in the Authorization header are valid False otherwise.
jonashaag/httpauth
httpauth.py
DigestFileHttpAuthMiddleware.parse_htdigest_file
def parse_htdigest_file(self, filelike): """ .htdigest files consist of lines in the following format:: username:realm:passwordhash where both `username` and `realm` are plain-text without any colons and `passwordhash` is the result of ``md5(username : realm : password)`` ...
python
def parse_htdigest_file(self, filelike): """ .htdigest files consist of lines in the following format:: username:realm:passwordhash where both `username` and `realm` are plain-text without any colons and `passwordhash` is the result of ``md5(username : realm : password)`` ...
[ "def", "parse_htdigest_file", "(", "self", ",", "filelike", ")", ":", "realm", "=", "None", "user_HA1_map", "=", "{", "}", "for", "lineno", ",", "line", "in", "enumerate", "(", "filter", "(", "None", ",", "filelike", ".", "read", "(", ")", ".", "splitl...
.htdigest files consist of lines in the following format:: username:realm:passwordhash where both `username` and `realm` are plain-text without any colons and `passwordhash` is the result of ``md5(username : realm : password)`` and thus `passwordhash` == HA1.
[ ".", "htdigest", "files", "consist", "of", "lines", "in", "the", "following", "format", "::" ]
1b2ab9cb5192b474c9723182690c352337f754bc
https://github.com/jonashaag/httpauth/blob/1b2ab9cb5192b474c9723182690c352337f754bc/httpauth.py#L153-L177
train
Parse the HA1 hash file and return the realm and user_HA1_map.
frasertweedale/ledgertools
ltlib/readers/CSV.py
Reader.next
def next(self): """Return the next transaction object. StopIteration will be propagated from self.csvreader.next() """ try: return self.dict_to_xn(self.csvreader.next()) except MetadataException: # row was metadata; proceed to next row return ...
python
def next(self): """Return the next transaction object. StopIteration will be propagated from self.csvreader.next() """ try: return self.dict_to_xn(self.csvreader.next()) except MetadataException: # row was metadata; proceed to next row return ...
[ "def", "next", "(", "self", ")", ":", "try", ":", "return", "self", ".", "dict_to_xn", "(", "self", ".", "csvreader", ".", "next", "(", ")", ")", "except", "MetadataException", ":", "# row was metadata; proceed to next row", "return", "next", "(", "self", ")...
Return the next transaction object. StopIteration will be propagated from self.csvreader.next()
[ "Return", "the", "next", "transaction", "object", "." ]
a695f8667d72253e5448693c12f0282d09902aaa
https://github.com/frasertweedale/ledgertools/blob/a695f8667d72253e5448693c12f0282d09902aaa/ltlib/readers/CSV.py#L92-L101
train
Return the next transaction object. StopIteration will be propagated from self. csvreader. next
frasertweedale/ledgertools
ltlib/readers/CSV.py
Reader.parse_date
def parse_date(self, date): """Parse the date and return a datetime object The heuristic for determining the date is: - if ``date_format`` is set, parse using strptime - if one field of 8 digits, YYYYMMDD - split by '-' or '/' - (TODO: substitute string months with t...
python
def parse_date(self, date): """Parse the date and return a datetime object The heuristic for determining the date is: - if ``date_format`` is set, parse using strptime - if one field of 8 digits, YYYYMMDD - split by '-' or '/' - (TODO: substitute string months with t...
[ "def", "parse_date", "(", "self", ",", "date", ")", ":", "if", "self", ".", "date_format", "is", "not", "None", ":", "return", "datetime", ".", "datetime", ".", "strptime", "(", "date", ",", "self", ".", "date_format", ")", ".", "date", "(", ")", "if...
Parse the date and return a datetime object The heuristic for determining the date is: - if ``date_format`` is set, parse using strptime - if one field of 8 digits, YYYYMMDD - split by '-' or '/' - (TODO: substitute string months with their numbers) - if (2, 2, 4), ...
[ "Parse", "the", "date", "and", "return", "a", "datetime", "object" ]
a695f8667d72253e5448693c12f0282d09902aaa
https://github.com/frasertweedale/ledgertools/blob/a695f8667d72253e5448693c12f0282d09902aaa/ltlib/readers/CSV.py#L103-L140
train
Parse the date and return a datetime object.
moonso/query_phenomizer
query_phenomizer/utils.py
parse_result
def parse_result(line): """ Parse the result line of a phenomizer request. Arguments: line (str): A raw output line from phenomizer Returns: result (dict): A dictionary with the phenomizer info: { 'p_value': float, 'gene_symbols': l...
python
def parse_result(line): """ Parse the result line of a phenomizer request. Arguments: line (str): A raw output line from phenomizer Returns: result (dict): A dictionary with the phenomizer info: { 'p_value': float, 'gene_symbols': l...
[ "def", "parse_result", "(", "line", ")", ":", "if", "line", ".", "startswith", "(", "\"Problem\"", ")", ":", "raise", "RuntimeError", "(", "\"Login credentials seems to be wrong\"", ")", "result", "=", "{", "'p_value'", ":", "None", ",", "'gene_symbols'", ":", ...
Parse the result line of a phenomizer request. Arguments: line (str): A raw output line from phenomizer Returns: result (dict): A dictionary with the phenomizer info: { 'p_value': float, 'gene_symbols': list(str), 'disease_n...
[ "Parse", "the", "result", "line", "of", "a", "phenomizer", "request", ".", "Arguments", ":", "line", "(", "str", ")", ":", "A", "raw", "output", "line", "from", "phenomizer", "Returns", ":", "result", "(", "dict", ")", ":", "A", "dictionary", "with", "...
19883ed125e224fc17cbb71240428fd60082e017
https://github.com/moonso/query_phenomizer/blob/19883ed125e224fc17cbb71240428fd60082e017/query_phenomizer/utils.py#L21-L78
train
Parse the result line of a log - in request.
moonso/query_phenomizer
query_phenomizer/utils.py
query_phenomizer
def query_phenomizer(usr, pwd, *hpo_terms): """ Query the phenomizer web tool Arguments: usr (str): A username for phenomizer pwd (str): A password for phenomizer hpo_terms (list): A list with hpo terms Returns: raw_answer : The raw result from phenomizer "...
python
def query_phenomizer(usr, pwd, *hpo_terms): """ Query the phenomizer web tool Arguments: usr (str): A username for phenomizer pwd (str): A password for phenomizer hpo_terms (list): A list with hpo terms Returns: raw_answer : The raw result from phenomizer "...
[ "def", "query_phenomizer", "(", "usr", ",", "pwd", ",", "*", "hpo_terms", ")", ":", "base_string", "=", "'http://compbio.charite.de/phenomizer/phenomizer/PhenomizerServiceURI'", "questions", "=", "{", "'mobilequery'", ":", "'true'", ",", "'terms'", ":", "','", ".", ...
Query the phenomizer web tool Arguments: usr (str): A username for phenomizer pwd (str): A password for phenomizer hpo_terms (list): A list with hpo terms Returns: raw_answer : The raw result from phenomizer
[ "Query", "the", "phenomizer", "web", "tool", "Arguments", ":", "usr", "(", "str", ")", ":", "A", "username", "for", "phenomizer", "pwd", "(", "str", ")", ":", "A", "password", "for", "phenomizer", "hpo_terms", "(", "list", ")", ":", "A", "list", "with"...
19883ed125e224fc17cbb71240428fd60082e017
https://github.com/moonso/query_phenomizer/blob/19883ed125e224fc17cbb71240428fd60082e017/query_phenomizer/utils.py#L80-L104
train
Query the phenomizer web tool for a list of hpo terms.
moonso/query_phenomizer
query_phenomizer/utils.py
query
def query(usr, pwd, *hpo_terms): """ Query the phenomizer web tool Arguments: usr (str): A username for phenomizer pwd (str): A password for phenomizer hpo_terms (list): A list with hpo terms yields: parsed_term (dict): A dictionary with the parsed information ...
python
def query(usr, pwd, *hpo_terms): """ Query the phenomizer web tool Arguments: usr (str): A username for phenomizer pwd (str): A password for phenomizer hpo_terms (list): A list with hpo terms yields: parsed_term (dict): A dictionary with the parsed information ...
[ "def", "query", "(", "usr", ",", "pwd", ",", "*", "hpo_terms", ")", ":", "raw_result", "=", "query_phenomizer", "(", "usr", ",", "pwd", ",", "*", "hpo_terms", ")", "for", "line", "in", "raw_result", ".", "text", ".", "split", "(", "'\\n'", ")", ":", ...
Query the phenomizer web tool Arguments: usr (str): A username for phenomizer pwd (str): A password for phenomizer hpo_terms (list): A list with hpo terms yields: parsed_term (dict): A dictionary with the parsed information from phenomizer
[ "Query", "the", "phenomizer", "web", "tool", "Arguments", ":", "usr", "(", "str", ")", ":", "A", "username", "for", "phenomizer", "pwd", "(", "str", ")", ":", "A", "password", "for", "phenomizer", "hpo_terms", "(", "list", ")", ":", "A", "list", "with"...
19883ed125e224fc17cbb71240428fd60082e017
https://github.com/moonso/query_phenomizer/blob/19883ed125e224fc17cbb71240428fd60082e017/query_phenomizer/utils.py#L106-L125
train
Query the phenomizer web tool and return a list of parsed information for each entry in the result set.
moonso/query_phenomizer
query_phenomizer/utils.py
validate_term
def validate_term(usr, pwd, hpo_term): """ Validate if the HPO term exists. Check if there are any result when querying phenomizer. Arguments: usr (str): A username for phenomizer pwd (str): A password for phenomizer hpo_term (string): Represents the hpo term Re...
python
def validate_term(usr, pwd, hpo_term): """ Validate if the HPO term exists. Check if there are any result when querying phenomizer. Arguments: usr (str): A username for phenomizer pwd (str): A password for phenomizer hpo_term (string): Represents the hpo term Re...
[ "def", "validate_term", "(", "usr", ",", "pwd", ",", "hpo_term", ")", ":", "result", "=", "True", "try", ":", "for", "line", "in", "query", "(", "usr", ",", "pwd", ",", "hpo_term", ")", ":", "pass", "except", "RuntimeError", "as", "err", ":", "raise"...
Validate if the HPO term exists. Check if there are any result when querying phenomizer. Arguments: usr (str): A username for phenomizer pwd (str): A password for phenomizer hpo_term (string): Represents the hpo term Returns: result (boolean): True if term exist...
[ "Validate", "if", "the", "HPO", "term", "exists", ".", "Check", "if", "there", "are", "any", "result", "when", "querying", "phenomizer", ".", "Arguments", ":", "usr", "(", "str", ")", ":", "A", "username", "for", "phenomizer", "pwd", "(", "str", ")", "...
19883ed125e224fc17cbb71240428fd60082e017
https://github.com/moonso/query_phenomizer/blob/19883ed125e224fc17cbb71240428fd60082e017/query_phenomizer/utils.py#L128-L151
train
Validate if the HPO term exists.
pennlabs/penn-sdk-python
penn/base.py
WrapperBase._request
def _request(self, url, params=None): """Make a signed request to the API, raise any API errors, and returning a tuple of (data, metadata) """ response = get(url, params=params, headers=self.headers, timeout=30) if response.status_code != 200: raise APIError('Reques...
python
def _request(self, url, params=None): """Make a signed request to the API, raise any API errors, and returning a tuple of (data, metadata) """ response = get(url, params=params, headers=self.headers, timeout=30) if response.status_code != 200: raise APIError('Reques...
[ "def", "_request", "(", "self", ",", "url", ",", "params", "=", "None", ")", ":", "response", "=", "get", "(", "url", ",", "params", "=", "params", ",", "headers", "=", "self", ".", "headers", ",", "timeout", "=", "30", ")", "if", "response", ".", ...
Make a signed request to the API, raise any API errors, and returning a tuple of (data, metadata)
[ "Make", "a", "signed", "request", "to", "the", "API", "raise", "any", "API", "errors", "and", "returning", "a", "tuple", "of", "(", "data", "metadata", ")" ]
31ff12c20d69438d63bc7a796f83ce4f4c828396
https://github.com/pennlabs/penn-sdk-python/blob/31ff12c20d69438d63bc7a796f83ce4f4c828396/penn/base.py#L23-L39
train
Make a signed request to the API raise any API errors and and raise an APIError
digidotcom/python-wvalib
wva/subscriptions.py
WVASubscription.create
def create(self, uri, buffer="queue", interval=10): """Create a subscription with this short name and the provided parameters For more information on what the parameters required here mean, please refer to the `WVA Documentation <http://goo.gl/DRcOQf>`_. :raises WVAError: If there is a...
python
def create(self, uri, buffer="queue", interval=10): """Create a subscription with this short name and the provided parameters For more information on what the parameters required here mean, please refer to the `WVA Documentation <http://goo.gl/DRcOQf>`_. :raises WVAError: If there is a...
[ "def", "create", "(", "self", ",", "uri", ",", "buffer", "=", "\"queue\"", ",", "interval", "=", "10", ")", ":", "return", "self", ".", "_http_client", ".", "put_json", "(", "\"subscriptions/{}\"", ".", "format", "(", "self", ".", "short_name", ")", ",",...
Create a subscription with this short name and the provided parameters For more information on what the parameters required here mean, please refer to the `WVA Documentation <http://goo.gl/DRcOQf>`_. :raises WVAError: If there is a problem creating the new subscription
[ "Create", "a", "subscription", "with", "this", "short", "name", "and", "the", "provided", "parameters" ]
4252735e2775f80ebaffd813fbe84046d26906b3
https://github.com/digidotcom/python-wvalib/blob/4252735e2775f80ebaffd813fbe84046d26906b3/wva/subscriptions.py#L15-L29
train
Create a new subscription with this short name and the provided parameters.
geophysics-ubonn/reda
lib/reda/importers/bert.py
import_ohm
def import_ohm(filename, verbose=False, reciprocals=False): """Construct pandas data frame from BERT`s unified data format (.ohm). Parameters ---------- filename : string File path to .ohm file verbose : bool, optional Enables extended debug output reciprocals : int, optional ...
python
def import_ohm(filename, verbose=False, reciprocals=False): """Construct pandas data frame from BERT`s unified data format (.ohm). Parameters ---------- filename : string File path to .ohm file verbose : bool, optional Enables extended debug output reciprocals : int, optional ...
[ "def", "import_ohm", "(", "filename", ",", "verbose", "=", "False", ",", "reciprocals", "=", "False", ")", ":", "if", "verbose", ":", "print", "(", "(", "\"Reading in %s... \\n\"", "%", "filename", ")", ")", "file", "=", "open", "(", "filename", ")", "el...
Construct pandas data frame from BERT`s unified data format (.ohm). Parameters ---------- filename : string File path to .ohm file verbose : bool, optional Enables extended debug output reciprocals : int, optional if provided, then assume that this is a reciprocal measuremen...
[ "Construct", "pandas", "data", "frame", "from", "BERT", "s", "unified", "data", "format", "(", ".", "ohm", ")", "." ]
46a939729e40c7c4723315c03679c40761152e9e
https://github.com/geophysics-ubonn/reda/blob/46a939729e40c7c4723315c03679c40761152e9e/lib/reda/importers/bert.py#L11-L101
train
Read in a BERT - style unified data file and return a pandas dataframe.
south-coast-science/scs_core
src/scs_core/position/nmea/gpdatetime.py
GPDateTime.as_iso8601
def as_iso8601(self): """ example: 2016-08-13T00:38:05.210+00:00 """ if self.__date is None or self.__time is None: return None return "20%s-%s-%sT%s:%s:%s0Z" % \ (self.__date[4:], self.__date[2:4], self.__date[:2], self.__time[:2], self.__time[2:4], s...
python
def as_iso8601(self): """ example: 2016-08-13T00:38:05.210+00:00 """ if self.__date is None or self.__time is None: return None return "20%s-%s-%sT%s:%s:%s0Z" % \ (self.__date[4:], self.__date[2:4], self.__date[:2], self.__time[:2], self.__time[2:4], s...
[ "def", "as_iso8601", "(", "self", ")", ":", "if", "self", ".", "__date", "is", "None", "or", "self", ".", "__time", "is", "None", ":", "return", "None", "return", "\"20%s-%s-%sT%s:%s:%s0Z\"", "%", "(", "self", ".", "__date", "[", "4", ":", "]", ",", ...
example: 2016-08-13T00:38:05.210+00:00
[ "example", ":", "2016", "-", "08", "-", "13T00", ":", "38", ":", "05", ".", "210", "+", "00", ":", "00" ]
a4152b0bbed6acbbf257e1bba6a912f6ebe578e5
https://github.com/south-coast-science/scs_core/blob/a4152b0bbed6acbbf257e1bba6a912f6ebe578e5/src/scs_core/position/nmea/gpdatetime.py#L30-L38
train
returns ISO 8601 date string
south-coast-science/scs_core
src/scs_core/gas/d4_datum.py
D4Datum.__we_c
def __we_c(cls, calib, tc, temp, we_v): """ Compute weC from sensor temperature compensation of weV, aeV """ we_t = we_v - (calib.we_elc_mv / 1000.0) # remove electronic we zero we_c = tc.correct(calib, temp, we_t) # print("D4Datum__we_c: we_t:%f we_c:%s" % (we_t...
python
def __we_c(cls, calib, tc, temp, we_v): """ Compute weC from sensor temperature compensation of weV, aeV """ we_t = we_v - (calib.we_elc_mv / 1000.0) # remove electronic we zero we_c = tc.correct(calib, temp, we_t) # print("D4Datum__we_c: we_t:%f we_c:%s" % (we_t...
[ "def", "__we_c", "(", "cls", ",", "calib", ",", "tc", ",", "temp", ",", "we_v", ")", ":", "we_t", "=", "we_v", "-", "(", "calib", ".", "we_elc_mv", "/", "1000.0", ")", "# remove electronic we zero", "we_c", "=", "tc", ".", "correct", "(", "calib", ",...
Compute weC from sensor temperature compensation of weV, aeV
[ "Compute", "weC", "from", "sensor", "temperature", "compensation", "of", "weV", "aeV" ]
a4152b0bbed6acbbf257e1bba6a912f6ebe578e5
https://github.com/south-coast-science/scs_core/blob/a4152b0bbed6acbbf257e1bba6a912f6ebe578e5/src/scs_core/gas/d4_datum.py#L52-L62
train
Compute weC from sensor temperature compensation of weV
Starlink/palpy
support/palvers.py
read_pal_version
def read_pal_version(): """ Scans the PAL configure.ac looking for the version number. (vers, maj, min, patchlevel) = read_pal_version() Returns the version as a string and the major, minor and patchlevel version integers """ verfile = os.path.join("cextern", "pal", "configure.ac") ve...
python
def read_pal_version(): """ Scans the PAL configure.ac looking for the version number. (vers, maj, min, patchlevel) = read_pal_version() Returns the version as a string and the major, minor and patchlevel version integers """ verfile = os.path.join("cextern", "pal", "configure.ac") ve...
[ "def", "read_pal_version", "(", ")", ":", "verfile", "=", "os", ".", "path", ".", "join", "(", "\"cextern\"", ",", "\"pal\"", ",", "\"configure.ac\"", ")", "verstring", "=", "\"-1.-1.-1\"", "for", "line", "in", "open", "(", "verfile", ")", ":", "if", "li...
Scans the PAL configure.ac looking for the version number. (vers, maj, min, patchlevel) = read_pal_version() Returns the version as a string and the major, minor and patchlevel version integers
[ "Scans", "the", "PAL", "configure", ".", "ac", "looking", "for", "the", "version", "number", "." ]
a7ad77058614a93b29a004bbad6bc0e61c73b6e0
https://github.com/Starlink/palpy/blob/a7ad77058614a93b29a004bbad6bc0e61c73b6e0/support/palvers.py#L35-L55
train
Reads the version number from the PAL configure. ac file and returns it as a string major minor and patchlevel version integers.
cloudbase/python-hnvclient
hnv/client.py
_BaseHNVModel._reset_model
def _reset_model(self, response): """Update the fields value with the received information.""" # pylint: disable=no-member # Reset the model to the initial state self._provision_done = False # Set back the provision flag self._changes.clear() # Clear the changes ...
python
def _reset_model(self, response): """Update the fields value with the received information.""" # pylint: disable=no-member # Reset the model to the initial state self._provision_done = False # Set back the provision flag self._changes.clear() # Clear the changes ...
[ "def", "_reset_model", "(", "self", ",", "response", ")", ":", "# pylint: disable=no-member", "# Reset the model to the initial state", "self", ".", "_provision_done", "=", "False", "# Set back the provision flag", "self", ".", "_changes", ".", "clear", "(", ")", "# Cle...
Update the fields value with the received information.
[ "Update", "the", "fields", "value", "with", "the", "received", "information", "." ]
b019452af01db22629809b8930357a2ebf6494be
https://github.com/cloudbase/python-hnvclient/blob/b019452af01db22629809b8930357a2ebf6494be/hnv/client.py#L105-L120
train
Update the fields value with the received information.
cloudbase/python-hnvclient
hnv/client.py
_BaseHNVModel.is_ready
def is_ready(self): """Check if the current model is ready to be used.""" if not self.provisioning_state: raise exception.ServiceException("The object doesn't contain " "`provisioningState`.") elif self.provisioning_state == constant.FAILE...
python
def is_ready(self): """Check if the current model is ready to be used.""" if not self.provisioning_state: raise exception.ServiceException("The object doesn't contain " "`provisioningState`.") elif self.provisioning_state == constant.FAILE...
[ "def", "is_ready", "(", "self", ")", ":", "if", "not", "self", ".", "provisioning_state", ":", "raise", "exception", ".", "ServiceException", "(", "\"The object doesn't contain \"", "\"`provisioningState`.\"", ")", "elif", "self", ".", "provisioning_state", "==", "c...
Check if the current model is ready to be used.
[ "Check", "if", "the", "current", "model", "is", "ready", "to", "be", "used", "." ]
b019452af01db22629809b8930357a2ebf6494be
https://github.com/cloudbase/python-hnvclient/blob/b019452af01db22629809b8930357a2ebf6494be/hnv/client.py#L122-L136
train
Check if the current model is ready to be used.
cloudbase/python-hnvclient
hnv/client.py
_BaseHNVModel._get_client
def _get_client(): """Create a new client for the HNV REST API.""" return utils.get_client(url=CONFIG.HNV.url, username=CONFIG.HNV.username, password=CONFIG.HNV.password, allow_insecure=CONFIG.HNV.https_allow...
python
def _get_client(): """Create a new client for the HNV REST API.""" return utils.get_client(url=CONFIG.HNV.url, username=CONFIG.HNV.username, password=CONFIG.HNV.password, allow_insecure=CONFIG.HNV.https_allow...
[ "def", "_get_client", "(", ")", ":", "return", "utils", ".", "get_client", "(", "url", "=", "CONFIG", ".", "HNV", ".", "url", ",", "username", "=", "CONFIG", ".", "HNV", ".", "username", ",", "password", "=", "CONFIG", ".", "HNV", ".", "password", ",...
Create a new client for the HNV REST API.
[ "Create", "a", "new", "client", "for", "the", "HNV", "REST", "API", "." ]
b019452af01db22629809b8930357a2ebf6494be
https://github.com/cloudbase/python-hnvclient/blob/b019452af01db22629809b8930357a2ebf6494be/hnv/client.py#L139-L145
train
Create a new client for the HNV REST API.
cloudbase/python-hnvclient
hnv/client.py
_BaseHNVModel._get_all
def _get_all(cls, parent_id=None, grandparent_id=None): """Retrives all the required resources.""" client = cls._get_client() endpoint = cls._endpoint.format(resource_id="", parent_id=parent_id or "", grandparent_id=...
python
def _get_all(cls, parent_id=None, grandparent_id=None): """Retrives all the required resources.""" client = cls._get_client() endpoint = cls._endpoint.format(resource_id="", parent_id=parent_id or "", grandparent_id=...
[ "def", "_get_all", "(", "cls", ",", "parent_id", "=", "None", ",", "grandparent_id", "=", "None", ")", ":", "client", "=", "cls", ".", "_get_client", "(", ")", "endpoint", "=", "cls", ".", "_endpoint", ".", "format", "(", "resource_id", "=", "\"\"", ",...
Retrives all the required resources.
[ "Retrives", "all", "the", "required", "resources", "." ]
b019452af01db22629809b8930357a2ebf6494be
https://github.com/cloudbase/python-hnvclient/blob/b019452af01db22629809b8930357a2ebf6494be/hnv/client.py#L148-L164
train
Retrives all the required resources.
cloudbase/python-hnvclient
hnv/client.py
_BaseHNVModel._get
def _get(cls, resource_id, parent_id, grandparent_id): """"Retrieves the required resource.""" client = cls._get_client() endpoint = cls._endpoint.format(resource_id=resource_id or "", parent_id=parent_id or "", gran...
python
def _get(cls, resource_id, parent_id, grandparent_id): """"Retrieves the required resource.""" client = cls._get_client() endpoint = cls._endpoint.format(resource_id=resource_id or "", parent_id=parent_id or "", gran...
[ "def", "_get", "(", "cls", ",", "resource_id", ",", "parent_id", ",", "grandparent_id", ")", ":", "client", "=", "cls", ".", "_get_client", "(", ")", "endpoint", "=", "cls", ".", "_endpoint", ".", "format", "(", "resource_id", "=", "resource_id", "or", "...
Retrieves the required resource.
[ "Retrieves", "the", "required", "resource", "." ]
b019452af01db22629809b8930357a2ebf6494be
https://github.com/cloudbase/python-hnvclient/blob/b019452af01db22629809b8930357a2ebf6494be/hnv/client.py#L167-L176
train
Retrieves the required resource.
cloudbase/python-hnvclient
hnv/client.py
_BaseHNVModel.get
def get(cls, resource_id=None, parent_id=None, grandparent_id=None): """Retrieves the required resources. :param resource_id: The identifier for the specific resource within the resource type. :param parent_id: The identifier for the specific ancesto...
python
def get(cls, resource_id=None, parent_id=None, grandparent_id=None): """Retrieves the required resources. :param resource_id: The identifier for the specific resource within the resource type. :param parent_id: The identifier for the specific ancesto...
[ "def", "get", "(", "cls", ",", "resource_id", "=", "None", ",", "parent_id", "=", "None", ",", "grandparent_id", "=", "None", ")", ":", "if", "not", "resource_id", ":", "return", "cls", ".", "_get_all", "(", "parent_id", ",", "grandparent_id", ")", "else...
Retrieves the required resources. :param resource_id: The identifier for the specific resource within the resource type. :param parent_id: The identifier for the specific ancestor resource within the resource type. :p...
[ "Retrieves", "the", "required", "resources", "." ]
b019452af01db22629809b8930357a2ebf6494be
https://github.com/cloudbase/python-hnvclient/blob/b019452af01db22629809b8930357a2ebf6494be/hnv/client.py#L179-L194
train
Retrieves the required resources.
cloudbase/python-hnvclient
hnv/client.py
_BaseHNVModel.remove
def remove(cls, resource_id, parent_id=None, grandparent_id=None, wait=True, timeout=None): """Delete the required resource. :param resource_id: The identifier for the specific resource within the resource type. :param parent_id: The i...
python
def remove(cls, resource_id, parent_id=None, grandparent_id=None, wait=True, timeout=None): """Delete the required resource. :param resource_id: The identifier for the specific resource within the resource type. :param parent_id: The i...
[ "def", "remove", "(", "cls", ",", "resource_id", ",", "parent_id", "=", "None", ",", "grandparent_id", "=", "None", ",", "wait", "=", "True", ",", "timeout", "=", "None", ")", ":", "client", "=", "cls", ".", "_get_client", "(", ")", "endpoint", "=", ...
Delete the required resource. :param resource_id: The identifier for the specific resource within the resource type. :param parent_id: The identifier for the specific ancestor resource within the resource type. :param...
[ "Delete", "the", "required", "resource", "." ]
b019452af01db22629809b8930357a2ebf6494be
https://github.com/cloudbase/python-hnvclient/blob/b019452af01db22629809b8930357a2ebf6494be/hnv/client.py#L197-L243
train
Delete the required resource.
cloudbase/python-hnvclient
hnv/client.py
_BaseHNVModel.refresh
def refresh(self): """Get the latest representation of the current model.""" client = self._get_client() endpoint = self._endpoint.format( resource_id=self.resource_id or "", parent_id=self.parent_id or "", grandparent_id=self.grandparent_id or "") res...
python
def refresh(self): """Get the latest representation of the current model.""" client = self._get_client() endpoint = self._endpoint.format( resource_id=self.resource_id or "", parent_id=self.parent_id or "", grandparent_id=self.grandparent_id or "") res...
[ "def", "refresh", "(", "self", ")", ":", "client", "=", "self", ".", "_get_client", "(", ")", "endpoint", "=", "self", ".", "_endpoint", ".", "format", "(", "resource_id", "=", "self", ".", "resource_id", "or", "\"\"", ",", "parent_id", "=", "self", "....
Get the latest representation of the current model.
[ "Get", "the", "latest", "representation", "of", "the", "current", "model", "." ]
b019452af01db22629809b8930357a2ebf6494be
https://github.com/cloudbase/python-hnvclient/blob/b019452af01db22629809b8930357a2ebf6494be/hnv/client.py#L245-L253
train
Get the latest representation of the current model.
cloudbase/python-hnvclient
hnv/client.py
_BaseHNVModel.commit
def commit(self, if_match=None, wait=True, timeout=None): """Apply all the changes on the current model. :param wait: Whether to wait until the operation is completed :param timeout: The maximum amount of time required for this operation to be completed. If o...
python
def commit(self, if_match=None, wait=True, timeout=None): """Apply all the changes on the current model. :param wait: Whether to wait until the operation is completed :param timeout: The maximum amount of time required for this operation to be completed. If o...
[ "def", "commit", "(", "self", ",", "if_match", "=", "None", ",", "wait", "=", "True", ",", "timeout", "=", "None", ")", ":", "if", "not", "self", ".", "_changes", ":", "LOG", ".", "debug", "(", "\"No changes available for %s: %s\"", ",", "self", ".", "...
Apply all the changes on the current model. :param wait: Whether to wait until the operation is completed :param timeout: The maximum amount of time required for this operation to be completed. If optional :param wait: is True and timeout is None (the default), ...
[ "Apply", "all", "the", "changes", "on", "the", "current", "model", "." ]
b019452af01db22629809b8930357a2ebf6494be
https://github.com/cloudbase/python-hnvclient/blob/b019452af01db22629809b8930357a2ebf6494be/hnv/client.py#L255-L303
train
Apply all the changes on the current model.
cloudbase/python-hnvclient
hnv/client.py
_BaseHNVModel.process_raw_data
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" properties = raw_data.get("properties", {}) raw_metadata = raw_data.get("resourceMetadata", None) if raw_metadata is not None: metadata = ResourceMetadata.from_raw_data(raw_metadata) ...
python
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" properties = raw_data.get("properties", {}) raw_metadata = raw_data.get("resourceMetadata", None) if raw_metadata is not None: metadata = ResourceMetadata.from_raw_data(raw_metadata) ...
[ "def", "process_raw_data", "(", "cls", ",", "raw_data", ")", ":", "properties", "=", "raw_data", ".", "get", "(", "\"properties\"", ",", "{", "}", ")", "raw_metadata", "=", "raw_data", ".", "get", "(", "\"resourceMetadata\"", ",", "None", ")", "if", "raw_m...
Create a new model using raw API response.
[ "Create", "a", "new", "model", "using", "raw", "API", "response", "." ]
b019452af01db22629809b8930357a2ebf6494be
https://github.com/cloudbase/python-hnvclient/blob/b019452af01db22629809b8930357a2ebf6494be/hnv/client.py#L306-L320
train
Create a new model using raw API response.
cloudbase/python-hnvclient
hnv/client.py
_BaseHNVModel._set_fields
def _set_fields(self, fields): """Set or update the fields value.""" super(_BaseHNVModel, self)._set_fields(fields) if not self.resource_ref: endpoint = self._endpoint.format( resource_id=self.resource_id, parent_id=self.parent_id, grandparent_id=self....
python
def _set_fields(self, fields): """Set or update the fields value.""" super(_BaseHNVModel, self)._set_fields(fields) if not self.resource_ref: endpoint = self._endpoint.format( resource_id=self.resource_id, parent_id=self.parent_id, grandparent_id=self....
[ "def", "_set_fields", "(", "self", ",", "fields", ")", ":", "super", "(", "_BaseHNVModel", ",", "self", ")", ".", "_set_fields", "(", "fields", ")", "if", "not", "self", ".", "resource_ref", ":", "endpoint", "=", "self", ".", "_endpoint", ".", "format", ...
Set or update the fields value.
[ "Set", "or", "update", "the", "fields", "value", "." ]
b019452af01db22629809b8930357a2ebf6494be
https://github.com/cloudbase/python-hnvclient/blob/b019452af01db22629809b8930357a2ebf6494be/hnv/client.py#L322-L329
train
Set or update the fields value.
cloudbase/python-hnvclient
hnv/client.py
Resource.get_resource
def get_resource(self): """Return the associated resource.""" references = {"resource_id": None, "parent_id": None, "grandparent_id": None} for model_cls, regexp in self._regexp.iteritems(): match = regexp.search(self.resource_ref) if match is not No...
python
def get_resource(self): """Return the associated resource.""" references = {"resource_id": None, "parent_id": None, "grandparent_id": None} for model_cls, regexp in self._regexp.iteritems(): match = regexp.search(self.resource_ref) if match is not No...
[ "def", "get_resource", "(", "self", ")", ":", "references", "=", "{", "\"resource_id\"", ":", "None", ",", "\"parent_id\"", ":", "None", ",", "\"grandparent_id\"", ":", "None", "}", "for", "model_cls", ",", "regexp", "in", "self", ".", "_regexp", ".", "ite...
Return the associated resource.
[ "Return", "the", "associated", "resource", "." ]
b019452af01db22629809b8930357a2ebf6494be
https://github.com/cloudbase/python-hnvclient/blob/b019452af01db22629809b8930357a2ebf6494be/hnv/client.py#L364-L375
train
Return the associated resource.
cloudbase/python-hnvclient
hnv/client.py
LogicalSubnetworks.process_raw_data
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" properties = raw_data["properties"] ip_pools = [] for raw_content in properties.get("ipPools", []): raw_content["parentResourceID"] = raw_data["resourceId"] raw_content["grandPa...
python
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" properties = raw_data["properties"] ip_pools = [] for raw_content in properties.get("ipPools", []): raw_content["parentResourceID"] = raw_data["resourceId"] raw_content["grandPa...
[ "def", "process_raw_data", "(", "cls", ",", "raw_data", ")", ":", "properties", "=", "raw_data", "[", "\"properties\"", "]", "ip_pools", "=", "[", "]", "for", "raw_content", "in", "properties", ".", "get", "(", "\"ipPools\"", ",", "[", "]", ")", ":", "ra...
Create a new model using raw API response.
[ "Create", "a", "new", "model", "using", "raw", "API", "response", "." ]
b019452af01db22629809b8930357a2ebf6494be
https://github.com/cloudbase/python-hnvclient/blob/b019452af01db22629809b8930357a2ebf6494be/hnv/client.py#L542-L565
train
Create a new model using raw API response.
cloudbase/python-hnvclient
hnv/client.py
LogicalNetworks.process_raw_data
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" properties = raw_data["properties"] subnetworks = [] for raw_subnet in properties.get("subnets", []): raw_subnet["parentResourceID"] = raw_data["resourceId"] subnetworks.append(...
python
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" properties = raw_data["properties"] subnetworks = [] for raw_subnet in properties.get("subnets", []): raw_subnet["parentResourceID"] = raw_data["resourceId"] subnetworks.append(...
[ "def", "process_raw_data", "(", "cls", ",", "raw_data", ")", ":", "properties", "=", "raw_data", "[", "\"properties\"", "]", "subnetworks", "=", "[", "]", "for", "raw_subnet", "in", "properties", ".", "get", "(", "\"subnets\"", ",", "[", "]", ")", ":", "...
Create a new model using raw API response.
[ "Create", "a", "new", "model", "using", "raw", "API", "response", "." ]
b019452af01db22629809b8930357a2ebf6494be
https://github.com/cloudbase/python-hnvclient/blob/b019452af01db22629809b8930357a2ebf6494be/hnv/client.py#L597-L612
train
Create a new model using raw API response.
cloudbase/python-hnvclient
hnv/client.py
IPConfiguration.process_raw_data
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" properties = raw_data["properties"] address_pools = [] for content in properties.get("loadBalancerBackendAddressPools", []): resource = Resource.from_raw_data(content) address_p...
python
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" properties = raw_data["properties"] address_pools = [] for content in properties.get("loadBalancerBackendAddressPools", []): resource = Resource.from_raw_data(content) address_p...
[ "def", "process_raw_data", "(", "cls", ",", "raw_data", ")", ":", "properties", "=", "raw_data", "[", "\"properties\"", "]", "address_pools", "=", "[", "]", "for", "content", "in", "properties", ".", "get", "(", "\"loadBalancerBackendAddressPools\"", ",", "[", ...
Create a new model using raw API response.
[ "Create", "a", "new", "model", "using", "raw", "API", "response", "." ]
b019452af01db22629809b8930357a2ebf6494be
https://github.com/cloudbase/python-hnvclient/blob/b019452af01db22629809b8930357a2ebf6494be/hnv/client.py#L679-L710
train
Create a new model using raw API response.
cloudbase/python-hnvclient
hnv/client.py
PortSettings.process_raw_data
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" raw_settings = raw_data.get("qosSettings", {}) qos_settings = QosSettings.from_raw_data(raw_settings) raw_data["qosSettings"] = qos_settings return super(PortSettings, cls).process_raw_data(raw_...
python
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" raw_settings = raw_data.get("qosSettings", {}) qos_settings = QosSettings.from_raw_data(raw_settings) raw_data["qosSettings"] = qos_settings return super(PortSettings, cls).process_raw_data(raw_...
[ "def", "process_raw_data", "(", "cls", ",", "raw_data", ")", ":", "raw_settings", "=", "raw_data", ".", "get", "(", "\"qosSettings\"", ",", "{", "}", ")", "qos_settings", "=", "QosSettings", ".", "from_raw_data", "(", "raw_settings", ")", "raw_data", "[", "\...
Create a new model using raw API response.
[ "Create", "a", "new", "model", "using", "raw", "API", "response", "." ]
b019452af01db22629809b8930357a2ebf6494be
https://github.com/cloudbase/python-hnvclient/blob/b019452af01db22629809b8930357a2ebf6494be/hnv/client.py#L811-L816
train
Create a new model using raw API response.
cloudbase/python-hnvclient
hnv/client.py
NetworkInterfaces.process_raw_data
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" properties = raw_data["properties"] ip_configurations = [] raw_settings = properties.get("ipConfigurations", []) for raw_configuration in raw_settings: raw_configuration["parentReso...
python
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" properties = raw_data["properties"] ip_configurations = [] raw_settings = properties.get("ipConfigurations", []) for raw_configuration in raw_settings: raw_configuration["parentReso...
[ "def", "process_raw_data", "(", "cls", ",", "raw_data", ")", ":", "properties", "=", "raw_data", "[", "\"properties\"", "]", "ip_configurations", "=", "[", "]", "raw_settings", "=", "properties", ".", "get", "(", "\"ipConfigurations\"", ",", "[", "]", ")", "...
Create a new model using raw API response.
[ "Create", "a", "new", "model", "using", "raw", "API", "response", "." ]
b019452af01db22629809b8930357a2ebf6494be
https://github.com/cloudbase/python-hnvclient/blob/b019452af01db22629809b8930357a2ebf6494be/hnv/client.py#L903-L923
train
Create a new model using raw API response.
cloudbase/python-hnvclient
hnv/client.py
SubNetworks.process_raw_data
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" properties = raw_data["properties"] raw_content = properties.get("accessControlList", None) if raw_content is not None: resource = Resource.from_raw_data(raw_content) properties...
python
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" properties = raw_data["properties"] raw_content = properties.get("accessControlList", None) if raw_content is not None: resource = Resource.from_raw_data(raw_content) properties...
[ "def", "process_raw_data", "(", "cls", ",", "raw_data", ")", ":", "properties", "=", "raw_data", "[", "\"properties\"", "]", "raw_content", "=", "properties", ".", "get", "(", "\"accessControlList\"", ",", "None", ")", "if", "raw_content", "is", "not", "None",...
Create a new model using raw API response.
[ "Create", "a", "new", "model", "using", "raw", "API", "response", "." ]
b019452af01db22629809b8930357a2ebf6494be
https://github.com/cloudbase/python-hnvclient/blob/b019452af01db22629809b8930357a2ebf6494be/hnv/client.py#L979-L1004
train
Create a new model using raw API response.
cloudbase/python-hnvclient
hnv/client.py
VirtualNetworks.process_raw_data
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" properties = raw_data["properties"] raw_content = properties.get("addressSpace", None) if raw_content is not None: address_space = AddressSpace.from_raw_data(raw_content) proper...
python
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" properties = raw_data["properties"] raw_content = properties.get("addressSpace", None) if raw_content is not None: address_space = AddressSpace.from_raw_data(raw_content) proper...
[ "def", "process_raw_data", "(", "cls", ",", "raw_data", ")", ":", "properties", "=", "raw_data", "[", "\"properties\"", "]", "raw_content", "=", "properties", ".", "get", "(", "\"addressSpace\"", ",", "None", ")", "if", "raw_content", "is", "not", "None", ":...
Create a new model using raw API response.
[ "Create", "a", "new", "model", "using", "raw", "API", "response", "." ]
b019452af01db22629809b8930357a2ebf6494be
https://github.com/cloudbase/python-hnvclient/blob/b019452af01db22629809b8930357a2ebf6494be/hnv/client.py#L1071-L1095
train
Create a new model using raw API response.
cloudbase/python-hnvclient
hnv/client.py
AccessControlLists.process_raw_data
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" properties = raw_data["properties"] ip_configurations = [] for raw_content in properties.get("ipConfigurations", []): resource = Resource.from_raw_data(raw_content) ip_configura...
python
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" properties = raw_data["properties"] ip_configurations = [] for raw_content in properties.get("ipConfigurations", []): resource = Resource.from_raw_data(raw_content) ip_configura...
[ "def", "process_raw_data", "(", "cls", ",", "raw_data", ")", ":", "properties", "=", "raw_data", "[", "\"properties\"", "]", "ip_configurations", "=", "[", "]", "for", "raw_content", "in", "properties", ".", "get", "(", "\"ipConfigurations\"", ",", "[", "]", ...
Create a new model using raw API response.
[ "Create", "a", "new", "model", "using", "raw", "API", "response", "." ]
b019452af01db22629809b8930357a2ebf6494be
https://github.com/cloudbase/python-hnvclient/blob/b019452af01db22629809b8930357a2ebf6494be/hnv/client.py#L1218-L1239
train
Create a new model using raw API response.
cloudbase/python-hnvclient
hnv/client.py
VirtualSwitchManager.get
def get(cls, resource_id=None, parent_id=None, grandparent_id=None): """"Retrieves the required resource.""" return cls._get(resource_id, parent_id, grandparent_id)
python
def get(cls, resource_id=None, parent_id=None, grandparent_id=None): """"Retrieves the required resource.""" return cls._get(resource_id, parent_id, grandparent_id)
[ "def", "get", "(", "cls", ",", "resource_id", "=", "None", ",", "parent_id", "=", "None", ",", "grandparent_id", "=", "None", ")", ":", "return", "cls", ".", "_get", "(", "resource_id", ",", "parent_id", ",", "grandparent_id", ")" ]
Retrieves the required resource.
[ "Retrieves", "the", "required", "resource", "." ]
b019452af01db22629809b8930357a2ebf6494be
https://github.com/cloudbase/python-hnvclient/blob/b019452af01db22629809b8930357a2ebf6494be/hnv/client.py#L1305-L1307
train
Retrieves the required resource.
cloudbase/python-hnvclient
hnv/client.py
VirtualSwitchManager.process_raw_data
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" properties = raw_data["properties"] qos_settings = properties.get("qosSettings", {}) properties["qosSettings"] = VirtualSwtichQosSettings.from_raw_data( raw_data=qos_settings) return...
python
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" properties = raw_data["properties"] qos_settings = properties.get("qosSettings", {}) properties["qosSettings"] = VirtualSwtichQosSettings.from_raw_data( raw_data=qos_settings) return...
[ "def", "process_raw_data", "(", "cls", ",", "raw_data", ")", ":", "properties", "=", "raw_data", "[", "\"properties\"", "]", "qos_settings", "=", "properties", ".", "get", "(", "\"qosSettings\"", ",", "{", "}", ")", "properties", "[", "\"qosSettings\"", "]", ...
Create a new model using raw API response.
[ "Create", "a", "new", "model", "using", "raw", "API", "response", "." ]
b019452af01db22629809b8930357a2ebf6494be
https://github.com/cloudbase/python-hnvclient/blob/b019452af01db22629809b8930357a2ebf6494be/hnv/client.py#L1310-L1316
train
Create a new model using raw API response.
cloudbase/python-hnvclient
hnv/client.py
VirtualSwitchManager.remove
def remove(cls, resource_id, parent_id=None, grandparent_id=None, wait=True, timeout=None): """Delete the required resource.""" raise exception.NotSupported(feature="DELETE", context="VirtualSwitchManager")
python
def remove(cls, resource_id, parent_id=None, grandparent_id=None, wait=True, timeout=None): """Delete the required resource.""" raise exception.NotSupported(feature="DELETE", context="VirtualSwitchManager")
[ "def", "remove", "(", "cls", ",", "resource_id", ",", "parent_id", "=", "None", ",", "grandparent_id", "=", "None", ",", "wait", "=", "True", ",", "timeout", "=", "None", ")", ":", "raise", "exception", ".", "NotSupported", "(", "feature", "=", "\"DELETE...
Delete the required resource.
[ "Delete", "the", "required", "resource", "." ]
b019452af01db22629809b8930357a2ebf6494be
https://github.com/cloudbase/python-hnvclient/blob/b019452af01db22629809b8930357a2ebf6494be/hnv/client.py#L1319-L1323
train
Delete the required resource.
cloudbase/python-hnvclient
hnv/client.py
RouteTables.process_raw_data
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" properties = raw_data["properties"] routes = [] raw_routes = properties.get("routes", []) for raw_route in raw_routes: raw_route["parentResourceID"] = raw_data["resourceId"] ...
python
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" properties = raw_data["properties"] routes = [] raw_routes = properties.get("routes", []) for raw_route in raw_routes: raw_route["parentResourceID"] = raw_data["resourceId"] ...
[ "def", "process_raw_data", "(", "cls", ",", "raw_data", ")", ":", "properties", "=", "raw_data", "[", "\"properties\"", "]", "routes", "=", "[", "]", "raw_routes", "=", "properties", ".", "get", "(", "\"routes\"", ",", "[", "]", ")", "for", "raw_route", ...
Create a new model using raw API response.
[ "Create", "a", "new", "model", "using", "raw", "API", "response", "." ]
b019452af01db22629809b8930357a2ebf6494be
https://github.com/cloudbase/python-hnvclient/blob/b019452af01db22629809b8930357a2ebf6494be/hnv/client.py#L1395-L1412
train
Create a new model using raw API response.
cloudbase/python-hnvclient
hnv/client.py
IPSecConfiguration.process_raw_data
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" raw_main = raw_data.get("mainMode", None) if raw_main is not None: main_mode = MainMode.from_raw_data(raw_main) raw_data["mainMode"] = main_mode raw_quick = raw_data.get("quickM...
python
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" raw_main = raw_data.get("mainMode", None) if raw_main is not None: main_mode = MainMode.from_raw_data(raw_main) raw_data["mainMode"] = main_mode raw_quick = raw_data.get("quickM...
[ "def", "process_raw_data", "(", "cls", ",", "raw_data", ")", ":", "raw_main", "=", "raw_data", ".", "get", "(", "\"mainMode\"", ",", "None", ")", "if", "raw_main", "is", "not", "None", ":", "main_mode", "=", "MainMode", ".", "from_raw_data", "(", "raw_main...
Create a new model using raw API response.
[ "Create", "a", "new", "model", "using", "raw", "API", "response", "." ]
b019452af01db22629809b8930357a2ebf6494be
https://github.com/cloudbase/python-hnvclient/blob/b019452af01db22629809b8930357a2ebf6494be/hnv/client.py#L1592-L1616
train
Create a new model using raw API response.
cloudbase/python-hnvclient
hnv/client.py
NetworkConnections.process_raw_data
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" properties = raw_data.get("properties", {}) raw_content = properties.get("ipSecConfiguration", None) if raw_content is not None: ip_sec = IPSecConfiguration.from_raw_data(raw_content) ...
python
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" properties = raw_data.get("properties", {}) raw_content = properties.get("ipSecConfiguration", None) if raw_content is not None: ip_sec = IPSecConfiguration.from_raw_data(raw_content) ...
[ "def", "process_raw_data", "(", "cls", ",", "raw_data", ")", ":", "properties", "=", "raw_data", ".", "get", "(", "\"properties\"", ",", "{", "}", ")", "raw_content", "=", "properties", ".", "get", "(", "\"ipSecConfiguration\"", ",", "None", ")", "if", "ra...
Create a new model using raw API response.
[ "Create", "a", "new", "model", "using", "raw", "API", "response", "." ]
b019452af01db22629809b8930357a2ebf6494be
https://github.com/cloudbase/python-hnvclient/blob/b019452af01db22629809b8930357a2ebf6494be/hnv/client.py#L1862-L1902
train
Create a new model using raw API response.
cloudbase/python-hnvclient
hnv/client.py
PublicIPAddresses.process_raw_data
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" properties = raw_data.get("properties", {}) raw_content = properties.get("ipConfiguration", None) if raw_content is not None: resource = Resource.from_raw_data(raw_content) prop...
python
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" properties = raw_data.get("properties", {}) raw_content = properties.get("ipConfiguration", None) if raw_content is not None: resource = Resource.from_raw_data(raw_content) prop...
[ "def", "process_raw_data", "(", "cls", ",", "raw_data", ")", ":", "properties", "=", "raw_data", ".", "get", "(", "\"properties\"", ",", "{", "}", ")", "raw_content", "=", "properties", ".", "get", "(", "\"ipConfiguration\"", ",", "None", ")", "if", "raw_c...
Create a new model using raw API response.
[ "Create", "a", "new", "model", "using", "raw", "API", "response", "." ]
b019452af01db22629809b8930357a2ebf6494be
https://github.com/cloudbase/python-hnvclient/blob/b019452af01db22629809b8930357a2ebf6494be/hnv/client.py#L1964-L1973
train
Create a new model using raw API response.
cloudbase/python-hnvclient
hnv/client.py
BackendAddressPools.process_raw_data
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" properties = raw_data.get("properties", {}) backend_ip_configurations = [] for raw_content in properties.get("backendIPConfigurations", []): resource = Resource.from_raw_data(raw_content) ...
python
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" properties = raw_data.get("properties", {}) backend_ip_configurations = [] for raw_content in properties.get("backendIPConfigurations", []): resource = Resource.from_raw_data(raw_content) ...
[ "def", "process_raw_data", "(", "cls", ",", "raw_data", ")", ":", "properties", "=", "raw_data", ".", "get", "(", "\"properties\"", ",", "{", "}", ")", "backend_ip_configurations", "=", "[", "]", "for", "raw_content", "in", "properties", ".", "get", "(", "...
Create a new model using raw API response.
[ "Create", "a", "new", "model", "using", "raw", "API", "response", "." ]
b019452af01db22629809b8930357a2ebf6494be
https://github.com/cloudbase/python-hnvclient/blob/b019452af01db22629809b8930357a2ebf6494be/hnv/client.py#L2023-L2045
train
Create a new model using raw API response.
cloudbase/python-hnvclient
hnv/client.py
FrontendIPConfigurations.process_raw_data
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" properties = raw_data.get("properties", {}) load_balancing_rules = [] for raw_content in properties.get("loadBalancingRules", []): resource = Resource.from_raw_data(raw_content) ...
python
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" properties = raw_data.get("properties", {}) load_balancing_rules = [] for raw_content in properties.get("loadBalancingRules", []): resource = Resource.from_raw_data(raw_content) ...
[ "def", "process_raw_data", "(", "cls", ",", "raw_data", ")", ":", "properties", "=", "raw_data", ".", "get", "(", "\"properties\"", ",", "{", "}", ")", "load_balancing_rules", "=", "[", "]", "for", "raw_content", "in", "properties", ".", "get", "(", "\"loa...
Create a new model using raw API response.
[ "Create", "a", "new", "model", "using", "raw", "API", "response", "." ]
b019452af01db22629809b8930357a2ebf6494be
https://github.com/cloudbase/python-hnvclient/blob/b019452af01db22629809b8930357a2ebf6494be/hnv/client.py#L2130-L2157
train
Create a new model using raw API response.
cloudbase/python-hnvclient
hnv/client.py
InboundNATRules.process_raw_data
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" properties = raw_data.get("properties", {}) raw_ip_configuration = properties.get("backendIPConfiguration", []) if isinstance(raw_ip_configuration, dict): raw_ip_configuration = [raw_ip_con...
python
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" properties = raw_data.get("properties", {}) raw_ip_configuration = properties.get("backendIPConfiguration", []) if isinstance(raw_ip_configuration, dict): raw_ip_configuration = [raw_ip_con...
[ "def", "process_raw_data", "(", "cls", ",", "raw_data", ")", ":", "properties", "=", "raw_data", ".", "get", "(", "\"properties\"", ",", "{", "}", ")", "raw_ip_configuration", "=", "properties", ".", "get", "(", "\"backendIPConfiguration\"", ",", "[", "]", "...
Create a new model using raw API response.
[ "Create", "a", "new", "model", "using", "raw", "API", "response", "." ]
b019452af01db22629809b8930357a2ebf6494be
https://github.com/cloudbase/python-hnvclient/blob/b019452af01db22629809b8930357a2ebf6494be/hnv/client.py#L2244-L2262
train
Create a new model using raw API response.
cloudbase/python-hnvclient
hnv/client.py
LoadBalancingRules.process_raw_data
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" properties = raw_data.get("properties", {}) frontend_ip_configurations = [] for raw_content in properties.get("frontendIPConfigurations", []): resource = Resource.from_raw_data(raw_content)...
python
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" properties = raw_data.get("properties", {}) frontend_ip_configurations = [] for raw_content in properties.get("frontendIPConfigurations", []): resource = Resource.from_raw_data(raw_content)...
[ "def", "process_raw_data", "(", "cls", ",", "raw_data", ")", ":", "properties", "=", "raw_data", ".", "get", "(", "\"properties\"", ",", "{", "}", ")", "frontend_ip_configurations", "=", "[", "]", "for", "raw_content", "in", "properties", ".", "get", "(", ...
Create a new model using raw API response.
[ "Create", "a", "new", "model", "using", "raw", "API", "response", "." ]
b019452af01db22629809b8930357a2ebf6494be
https://github.com/cloudbase/python-hnvclient/blob/b019452af01db22629809b8930357a2ebf6494be/hnv/client.py#L2385-L2405
train
Create a new model using raw API response.
cloudbase/python-hnvclient
hnv/client.py
Probes.process_raw_data
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" properties = raw_data.get("properties", {}) load_balancing_rules = [] for raw_content in properties.get("loadBalancingRules", []): resource = Resource.from_raw_data(raw_content) ...
python
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" properties = raw_data.get("properties", {}) load_balancing_rules = [] for raw_content in properties.get("loadBalancingRules", []): resource = Resource.from_raw_data(raw_content) ...
[ "def", "process_raw_data", "(", "cls", ",", "raw_data", ")", ":", "properties", "=", "raw_data", ".", "get", "(", "\"properties\"", ",", "{", "}", ")", "load_balancing_rules", "=", "[", "]", "for", "raw_content", "in", "properties", ".", "get", "(", "\"loa...
Create a new model using raw API response.
[ "Create", "a", "new", "model", "using", "raw", "API", "response", "." ]
b019452af01db22629809b8930357a2ebf6494be
https://github.com/cloudbase/python-hnvclient/blob/b019452af01db22629809b8930357a2ebf6494be/hnv/client.py#L2536-L2546
train
Create a new model using raw API response.
cloudbase/python-hnvclient
hnv/client.py
BGPPeersStatistics.process_raw_data
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" # pylint: disable=redefined-variable-type raw_content = raw_data.get("updateMessageStats", None) if raw_content is not None: statistics = UpdateMessageStatistics.from_raw_data(raw_content)...
python
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" # pylint: disable=redefined-variable-type raw_content = raw_data.get("updateMessageStats", None) if raw_content is not None: statistics = UpdateMessageStatistics.from_raw_data(raw_content)...
[ "def", "process_raw_data", "(", "cls", ",", "raw_data", ")", ":", "# pylint: disable=redefined-variable-type", "raw_content", "=", "raw_data", ".", "get", "(", "\"updateMessageStats\"", ",", "None", ")", "if", "raw_content", "is", "not", "None", ":", "statistics", ...
Create a new model using raw API response.
[ "Create", "a", "new", "model", "using", "raw", "API", "response", "." ]
b019452af01db22629809b8930357a2ebf6494be
https://github.com/cloudbase/python-hnvclient/blob/b019452af01db22629809b8930357a2ebf6494be/hnv/client.py#L2809-L2851
train
Create a new model using raw API response.
cloudbase/python-hnvclient
hnv/client.py
BGPPeers.process_raw_data
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" properties = raw_data.get("properties", {}) raw_content = properties.get("statistics", None) if raw_content is not None: statistics = BGPPeersStatistics.from_raw_data(raw_content) ...
python
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" properties = raw_data.get("properties", {}) raw_content = properties.get("statistics", None) if raw_content is not None: statistics = BGPPeersStatistics.from_raw_data(raw_content) ...
[ "def", "process_raw_data", "(", "cls", ",", "raw_data", ")", ":", "properties", "=", "raw_data", ".", "get", "(", "\"properties\"", ",", "{", "}", ")", "raw_content", "=", "properties", ".", "get", "(", "\"statistics\"", ",", "None", ")", "if", "raw_conten...
Create a new model using raw API response.
[ "Create", "a", "new", "model", "using", "raw", "API", "response", "." ]
b019452af01db22629809b8930357a2ebf6494be
https://github.com/cloudbase/python-hnvclient/blob/b019452af01db22629809b8930357a2ebf6494be/hnv/client.py#L2920-L2929
train
Create a new model using raw API response.
cloudbase/python-hnvclient
hnv/client.py
BGPRouters.process_raw_data
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" properties = raw_data.get("properties", {}) bgp_peers = [] for raw_content in properties.get("bgpPeers", []): raw_content["parentResourceID"] = raw_data["resourceId"] raw_conten...
python
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" properties = raw_data.get("properties", {}) bgp_peers = [] for raw_content in properties.get("bgpPeers", []): raw_content["parentResourceID"] = raw_data["resourceId"] raw_conten...
[ "def", "process_raw_data", "(", "cls", ",", "raw_data", ")", ":", "properties", "=", "raw_data", ".", "get", "(", "\"properties\"", ",", "{", "}", ")", "bgp_peers", "=", "[", "]", "for", "raw_content", "in", "properties", ".", "get", "(", "\"bgpPeers\"", ...
Create a new model using raw API response.
[ "Create", "a", "new", "model", "using", "raw", "API", "response", "." ]
b019452af01db22629809b8930357a2ebf6494be
https://github.com/cloudbase/python-hnvclient/blob/b019452af01db22629809b8930357a2ebf6494be/hnv/client.py#L2983-L2994
train
Create a new model using raw API response.
cloudbase/python-hnvclient
hnv/client.py
LoadBalancerManager.process_raw_data
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" properties = raw_data.get("properties", {}) vip_ip_pools = [] for raw_content in properties.get("vipIpPools", []): resource = Resource.from_raw_data(raw_content) vip_ip_pools.ap...
python
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" properties = raw_data.get("properties", {}) vip_ip_pools = [] for raw_content in properties.get("vipIpPools", []): resource = Resource.from_raw_data(raw_content) vip_ip_pools.ap...
[ "def", "process_raw_data", "(", "cls", ",", "raw_data", ")", ":", "properties", "=", "raw_data", ".", "get", "(", "\"properties\"", ",", "{", "}", ")", "vip_ip_pools", "=", "[", "]", "for", "raw_content", "in", "properties", ".", "get", "(", "\"vipIpPools\...
Create a new model using raw API response.
[ "Create", "a", "new", "model", "using", "raw", "API", "response", "." ]
b019452af01db22629809b8930357a2ebf6494be
https://github.com/cloudbase/python-hnvclient/blob/b019452af01db22629809b8930357a2ebf6494be/hnv/client.py#L3038-L3048
train
Create a new model using raw API response.
geophysics-ubonn/reda
lib/reda/plotters/histograms.py
_get_nr_bins
def _get_nr_bins(count): """depending on the number of data points, compute a best guess for an optimal number of bins https://en.wikipedia.org/wiki/Histogram#Number_of_bins_and_width """ if count <= 30: # use the square-root choice, used by Excel and Co k = np.ceil(np.sqrt(count)) ...
python
def _get_nr_bins(count): """depending on the number of data points, compute a best guess for an optimal number of bins https://en.wikipedia.org/wiki/Histogram#Number_of_bins_and_width """ if count <= 30: # use the square-root choice, used by Excel and Co k = np.ceil(np.sqrt(count)) ...
[ "def", "_get_nr_bins", "(", "count", ")", ":", "if", "count", "<=", "30", ":", "# use the square-root choice, used by Excel and Co", "k", "=", "np", ".", "ceil", "(", "np", ".", "sqrt", "(", "count", ")", ")", "else", ":", "# use Sturges' formula", "k", "=",...
depending on the number of data points, compute a best guess for an optimal number of bins https://en.wikipedia.org/wiki/Histogram#Number_of_bins_and_width
[ "depending", "on", "the", "number", "of", "data", "points", "compute", "a", "best", "guess", "for", "an", "optimal", "number", "of", "bins" ]
46a939729e40c7c4723315c03679c40761152e9e
https://github.com/geophysics-ubonn/reda/blob/46a939729e40c7c4723315c03679c40761152e9e/lib/reda/plotters/histograms.py#L14-L26
train
Compute the number of bins for a given number of data points
geophysics-ubonn/reda
lib/reda/plotters/histograms.py
plot_histograms
def plot_histograms(ertobj, keys, **kwargs): """Generate histograms for one or more keys in the given container. Parameters ---------- ertobj : container instance or :class:`pandas.DataFrame` data object which contains the data. keys : str or list of strings which keys (column names...
python
def plot_histograms(ertobj, keys, **kwargs): """Generate histograms for one or more keys in the given container. Parameters ---------- ertobj : container instance or :class:`pandas.DataFrame` data object which contains the data. keys : str or list of strings which keys (column names...
[ "def", "plot_histograms", "(", "ertobj", ",", "keys", ",", "*", "*", "kwargs", ")", ":", "# you can either provide a DataFrame or an ERT object", "if", "isinstance", "(", "ertobj", ",", "pd", ".", "DataFrame", ")", ":", "df", "=", "ertobj", "else", ":", "df", ...
Generate histograms for one or more keys in the given container. Parameters ---------- ertobj : container instance or :class:`pandas.DataFrame` data object which contains the data. keys : str or list of strings which keys (column names) to plot merge : bool, optional if True...
[ "Generate", "histograms", "for", "one", "or", "more", "keys", "in", "the", "given", "container", "." ]
46a939729e40c7c4723315c03679c40761152e9e
https://github.com/geophysics-ubonn/reda/blob/46a939729e40c7c4723315c03679c40761152e9e/lib/reda/plotters/histograms.py#L29-L130
train
Generate histograms for one or more keys in the given container.
geophysics-ubonn/reda
lib/reda/plotters/histograms.py
plot_histograms_extra_dims
def plot_histograms_extra_dims(dataobj, keys, **kwargs): """Produce histograms grouped by the extra dimensions. Extra dimensions are: * timesteps * frequency Parameters ---------- dataobj : :py:class:`pandas.DataFrame` or reda container The data container/data frame which holds th...
python
def plot_histograms_extra_dims(dataobj, keys, **kwargs): """Produce histograms grouped by the extra dimensions. Extra dimensions are: * timesteps * frequency Parameters ---------- dataobj : :py:class:`pandas.DataFrame` or reda container The data container/data frame which holds th...
[ "def", "plot_histograms_extra_dims", "(", "dataobj", ",", "keys", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "dataobj", ",", "pd", ".", "DataFrame", ")", ":", "df_raw", "=", "dataobj", "else", ":", "df_raw", "=", "dataobj", ".", "data", ...
Produce histograms grouped by the extra dimensions. Extra dimensions are: * timesteps * frequency Parameters ---------- dataobj : :py:class:`pandas.DataFrame` or reda container The data container/data frame which holds the data keys: list|tuple|iterable The keys (columns...
[ "Produce", "histograms", "grouped", "by", "the", "extra", "dimensions", "." ]
46a939729e40c7c4723315c03679c40761152e9e
https://github.com/geophysics-ubonn/reda/blob/46a939729e40c7c4723315c03679c40761152e9e/lib/reda/plotters/histograms.py#L133-L252
train
Produce histograms grouped by the extra dimensions.
geophysics-ubonn/reda
lib/reda/plotters/histograms.py
plot_histograms_it_extra_dims
def plot_histograms_it_extra_dims(dataobj, keys, extra_dims, **kwargs): """Produce histograms for each group of extra dimensions. \*\*kwargs are directly passed on to plot_histograms(). """ if isinstance(dataobj, pd.DataFrame): df = dataobj else: df = dataobj.df g = df.groupby...
python
def plot_histograms_it_extra_dims(dataobj, keys, extra_dims, **kwargs): """Produce histograms for each group of extra dimensions. \*\*kwargs are directly passed on to plot_histograms(). """ if isinstance(dataobj, pd.DataFrame): df = dataobj else: df = dataobj.df g = df.groupby...
[ "def", "plot_histograms_it_extra_dims", "(", "dataobj", ",", "keys", ",", "extra_dims", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "dataobj", ",", "pd", ".", "DataFrame", ")", ":", "df", "=", "dataobj", "else", ":", "df", "=", "dataobj",...
Produce histograms for each group of extra dimensions. \*\*kwargs are directly passed on to plot_histograms().
[ "Produce", "histograms", "for", "each", "group", "of", "extra", "dimensions", ".", "\\", "*", "\\", "*", "kwargs", "are", "directly", "passed", "on", "to", "plot_histograms", "()", "." ]
46a939729e40c7c4723315c03679c40761152e9e
https://github.com/geophysics-ubonn/reda/blob/46a939729e40c7c4723315c03679c40761152e9e/lib/reda/plotters/histograms.py#L255-L274
train
Produce histograms for each group of extra dimensions.
geophysics-ubonn/reda
lib/reda/importers/geotom.py
_parse_wenner_file
def _parse_wenner_file(filename, settings): """Parse a Geotom .wen (Wenner configuration) file Parsing problems ---------------- Due to column overflows it is necessary to make sure that spaces are present around the ; character. Example: 8.000 14.000 10835948.70; 0.001 -123.1853 -...
python
def _parse_wenner_file(filename, settings): """Parse a Geotom .wen (Wenner configuration) file Parsing problems ---------------- Due to column overflows it is necessary to make sure that spaces are present around the ; character. Example: 8.000 14.000 10835948.70; 0.001 -123.1853 -...
[ "def", "_parse_wenner_file", "(", "filename", ",", "settings", ")", ":", "# read data", "with", "open", "(", "filename", ",", "'r'", ")", "as", "fid2", ":", "geotom_data_orig", "=", "fid2", ".", "read", "(", ")", "# replace all ';' by ' ; '", "geotom_data", "=...
Parse a Geotom .wen (Wenner configuration) file Parsing problems ---------------- Due to column overflows it is necessary to make sure that spaces are present around the ; character. Example: 8.000 14.000 10835948.70; 0.001 -123.1853 -1.0 23.10.2014
[ "Parse", "a", "Geotom", ".", "wen", "(", "Wenner", "configuration", ")", "file" ]
46a939729e40c7c4723315c03679c40761152e9e
https://github.com/geophysics-ubonn/reda/blob/46a939729e40c7c4723315c03679c40761152e9e/lib/reda/importers/geotom.py#L12-L73
train
Parse a Geotom. wen file and return a dictionary of the data.
geophysics-ubonn/reda
lib/reda/importers/legacy/eit160.py
import_medusa_data
def import_medusa_data(mat_filename, config_file): """Import measurement data (a .mat file) of the FZJ EIT160 system. This data format is identified as 'FZJ-EZ-2017'. Parameters ---------- mat_filename: string filename to the .mat data file. Note that only MNU0 single-potentials are...
python
def import_medusa_data(mat_filename, config_file): """Import measurement data (a .mat file) of the FZJ EIT160 system. This data format is identified as 'FZJ-EZ-2017'. Parameters ---------- mat_filename: string filename to the .mat data file. Note that only MNU0 single-potentials are...
[ "def", "import_medusa_data", "(", "mat_filename", ",", "config_file", ")", ":", "df_emd", ",", "df_md", "=", "_read_mat_mnu0", "(", "mat_filename", ")", "# 'configs' can be a numpy array or a filename", "if", "not", "isinstance", "(", "config_file", ",", "np", ".", ...
Import measurement data (a .mat file) of the FZJ EIT160 system. This data format is identified as 'FZJ-EZ-2017'. Parameters ---------- mat_filename: string filename to the .mat data file. Note that only MNU0 single-potentials are supported! config_file: string filename for c...
[ "Import", "measurement", "data", "(", "a", ".", "mat", "file", ")", "of", "the", "FZJ", "EIT160", "system", ".", "This", "data", "format", "is", "identified", "as", "FZJ", "-", "EZ", "-", "2017", "." ]
46a939729e40c7c4723315c03679c40761152e9e
https://github.com/geophysics-ubonn/reda/blob/46a939729e40c7c4723315c03679c40761152e9e/lib/reda/importers/legacy/eit160.py#L61-L145
train
Imports the MNU0 measurement data from the given MNU0 file into a list of the n - point ones.
geophysics-ubonn/reda
lib/reda/importers/legacy/eit160.py
_read_mat_mnu0
def _read_mat_mnu0(filename): """Import a .mat file with single potentials (a b m) into a pandas DataFrame Also export some variables of the MD struct into a separate structure """ print('read_mag_single_file: {0}'.format(filename)) mat = sio.loadmat(filename, squeeze_me=True) # check the ...
python
def _read_mat_mnu0(filename): """Import a .mat file with single potentials (a b m) into a pandas DataFrame Also export some variables of the MD struct into a separate structure """ print('read_mag_single_file: {0}'.format(filename)) mat = sio.loadmat(filename, squeeze_me=True) # check the ...
[ "def", "_read_mat_mnu0", "(", "filename", ")", ":", "print", "(", "'read_mag_single_file: {0}'", ".", "format", "(", "filename", ")", ")", "mat", "=", "sio", ".", "loadmat", "(", "filename", ",", "squeeze_me", "=", "True", ")", "# check the version", "version"...
Import a .mat file with single potentials (a b m) into a pandas DataFrame Also export some variables of the MD struct into a separate structure
[ "Import", "a", ".", "mat", "file", "with", "single", "potentials", "(", "a", "b", "m", ")", "into", "a", "pandas", "DataFrame" ]
46a939729e40c7c4723315c03679c40761152e9e
https://github.com/geophysics-ubonn/reda/blob/46a939729e40c7c4723315c03679c40761152e9e/lib/reda/importers/legacy/eit160.py#L148-L168
train
Read a. mat file with single potentials and return a DataFrame containing the EMD and EMDs.
geophysics-ubonn/reda
lib/reda/importers/legacy/eit160.py
_extract_emd
def _extract_emd(mat, filename): """Extract the data from the EMD substruct, given a medusa-created MNU0-mat file Parameters ---------- mat: matlab-imported struct """ emd = mat['EMD'].squeeze() # Labview epoch epoch = datetime.datetime(1904, 1, 1) def convert_epoch(x): ...
python
def _extract_emd(mat, filename): """Extract the data from the EMD substruct, given a medusa-created MNU0-mat file Parameters ---------- mat: matlab-imported struct """ emd = mat['EMD'].squeeze() # Labview epoch epoch = datetime.datetime(1904, 1, 1) def convert_epoch(x): ...
[ "def", "_extract_emd", "(", "mat", ",", "filename", ")", ":", "emd", "=", "mat", "[", "'EMD'", "]", ".", "squeeze", "(", ")", "# Labview epoch", "epoch", "=", "datetime", ".", "datetime", "(", "1904", ",", "1", ",", "1", ")", "def", "convert_epoch", ...
Extract the data from the EMD substruct, given a medusa-created MNU0-mat file Parameters ---------- mat: matlab-imported struct
[ "Extract", "the", "data", "from", "the", "EMD", "substruct", "given", "a", "medusa", "-", "created", "MNU0", "-", "mat", "file" ]
46a939729e40c7c4723315c03679c40761152e9e
https://github.com/geophysics-ubonn/reda/blob/46a939729e40c7c4723315c03679c40761152e9e/lib/reda/importers/legacy/eit160.py#L284-L445
train
Extract the data from the EMD substruct given a MNU0 - mat file.
davidcarboni/Flask-Sleuth
regex/regex.py
parse
def parse(line): """ Parses a log line using the regexices above. :param line: A log line to be parsed. :return: If no match is found, None, otherwise a dict containing the values parsed from the log line. """ values = None matches = re.search(regex, line) if matches: # Standard...
python
def parse(line): """ Parses a log line using the regexices above. :param line: A log line to be parsed. :return: If no match is found, None, otherwise a dict containing the values parsed from the log line. """ values = None matches = re.search(regex, line) if matches: # Standard...
[ "def", "parse", "(", "line", ")", ":", "values", "=", "None", "matches", "=", "re", ".", "search", "(", "regex", ",", "line", ")", "if", "matches", ":", "# Standard values", "values", "=", "{", "'date_time'", ":", "matches", ".", "group", "(", "DATE_TI...
Parses a log line using the regexices above. :param line: A log line to be parsed. :return: If no match is found, None, otherwise a dict containing the values parsed from the log line.
[ "Parses", "a", "log", "line", "using", "the", "regexices", "above", ".", ":", "param", "line", ":", "A", "log", "line", "to", "be", "parsed", ".", ":", "return", ":", "If", "no", "match", "is", "found", "None", "otherwise", "a", "dict", "containing", ...
2191aa2a929ec43c0176ec51c7abef924b12d015
https://github.com/davidcarboni/Flask-Sleuth/blob/2191aa2a929ec43c0176ec51c7abef924b12d015/regex/regex.py#L76-L105
train
Parses a log line into a dict containing the values parsed from the log line.
gitenberg-dev/gitberg
gitenberg/book.py
Book.remote_path
def remote_path(self): """ turns an ebook_id into a path on PG's server(s) 4443 -> 4/4/4/4443/ """ # TODO: move this property into independent object for PG if len(self.book_id) > 1: path_parts = list(self.book_id[:-1]) else: path_parts = ['0'] ...
python
def remote_path(self): """ turns an ebook_id into a path on PG's server(s) 4443 -> 4/4/4/4443/ """ # TODO: move this property into independent object for PG if len(self.book_id) > 1: path_parts = list(self.book_id[:-1]) else: path_parts = ['0'] ...
[ "def", "remote_path", "(", "self", ")", ":", "# TODO: move this property into independent object for PG", "if", "len", "(", "self", ".", "book_id", ")", ">", "1", ":", "path_parts", "=", "list", "(", "self", ".", "book_id", "[", ":", "-", "1", "]", ")", "e...
turns an ebook_id into a path on PG's server(s) 4443 -> 4/4/4/4443/
[ "turns", "an", "ebook_id", "into", "a", "path", "on", "PG", "s", "server", "(", "s", ")", "4443", "-", ">", "4", "/", "4", "/", "4", "/", "4443", "/" ]
3f6db8b5a22ccdd2110d3199223c30db4e558b5c
https://github.com/gitenberg-dev/gitberg/blob/3f6db8b5a22ccdd2110d3199223c30db4e558b5c/gitenberg/book.py#L163-L172
train
turns an ebook_id into a path on PG s server s
gitenberg-dev/gitberg
gitenberg/book.py
Book.fetch
def fetch(self): """ just pull files from PG """ if not self.local_path: self.make_local_path() fetcher = BookFetcher(self) fetcher.fetch()
python
def fetch(self): """ just pull files from PG """ if not self.local_path: self.make_local_path() fetcher = BookFetcher(self) fetcher.fetch()
[ "def", "fetch", "(", "self", ")", ":", "if", "not", "self", ".", "local_path", ":", "self", ".", "make_local_path", "(", ")", "fetcher", "=", "BookFetcher", "(", "self", ")", "fetcher", ".", "fetch", "(", ")" ]
just pull files from PG
[ "just", "pull", "files", "from", "PG" ]
3f6db8b5a22ccdd2110d3199223c30db4e558b5c
https://github.com/gitenberg-dev/gitberg/blob/3f6db8b5a22ccdd2110d3199223c30db4e558b5c/gitenberg/book.py#L174-L180
train
just pull files from PG
gitenberg-dev/gitberg
gitenberg/book.py
Book.make
def make(self): """ turn fetched files into a local repo, make auxiliary files """ logger.debug("preparing to add all git files") num_added = self.local_repo.add_all_files() if num_added: self.local_repo.commit("Initial import from Project Gutenberg") file_ha...
python
def make(self): """ turn fetched files into a local repo, make auxiliary files """ logger.debug("preparing to add all git files") num_added = self.local_repo.add_all_files() if num_added: self.local_repo.commit("Initial import from Project Gutenberg") file_ha...
[ "def", "make", "(", "self", ")", ":", "logger", ".", "debug", "(", "\"preparing to add all git files\"", ")", "num_added", "=", "self", ".", "local_repo", ".", "add_all_files", "(", ")", "if", "num_added", ":", "self", ".", "local_repo", ".", "commit", "(", ...
turn fetched files into a local repo, make auxiliary files
[ "turn", "fetched", "files", "into", "a", "local", "repo", "make", "auxiliary", "files" ]
3f6db8b5a22ccdd2110d3199223c30db4e558b5c
https://github.com/gitenberg-dev/gitberg/blob/3f6db8b5a22ccdd2110d3199223c30db4e558b5c/gitenberg/book.py#L193-L208
train
turn fetched files into a local repo make auxiliary files
gitenberg-dev/gitberg
gitenberg/book.py
Book.push
def push(self): """ create a github repo and push the local repo into it """ self.github_repo.create_and_push() self._repo = self.github_repo.repo return self._repo
python
def push(self): """ create a github repo and push the local repo into it """ self.github_repo.create_and_push() self._repo = self.github_repo.repo return self._repo
[ "def", "push", "(", "self", ")", ":", "self", ".", "github_repo", ".", "create_and_push", "(", ")", "self", ".", "_repo", "=", "self", ".", "github_repo", ".", "repo", "return", "self", ".", "_repo" ]
create a github repo and push the local repo into it
[ "create", "a", "github", "repo", "and", "push", "the", "local", "repo", "into", "it" ]
3f6db8b5a22ccdd2110d3199223c30db4e558b5c
https://github.com/gitenberg-dev/gitberg/blob/3f6db8b5a22ccdd2110d3199223c30db4e558b5c/gitenberg/book.py#L213-L218
train
create a github repo and push the local repo into it
gitenberg-dev/gitberg
gitenberg/book.py
Book.tag
def tag(self, version='bump', message=''): """ tag and commit """ self.clone_from_github() self.github_repo.tag(version, message=message)
python
def tag(self, version='bump', message=''): """ tag and commit """ self.clone_from_github() self.github_repo.tag(version, message=message)
[ "def", "tag", "(", "self", ",", "version", "=", "'bump'", ",", "message", "=", "''", ")", ":", "self", ".", "clone_from_github", "(", ")", "self", ".", "github_repo", ".", "tag", "(", "version", ",", "message", "=", "message", ")" ]
tag and commit
[ "tag", "and", "commit" ]
3f6db8b5a22ccdd2110d3199223c30db4e558b5c
https://github.com/gitenberg-dev/gitberg/blob/3f6db8b5a22ccdd2110d3199223c30db4e558b5c/gitenberg/book.py#L225-L229
train
tag the current branch
gitenberg-dev/gitberg
gitenberg/book.py
Book.format_title
def format_title(self): def asciify(_title): _title = unicodedata.normalize('NFD', unicode(_title)) ascii = True out = [] ok = u"1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM- '," for ch in _title: if ch in ok: ...
python
def format_title(self): def asciify(_title): _title = unicodedata.normalize('NFD', unicode(_title)) ascii = True out = [] ok = u"1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM- '," for ch in _title: if ch in ok: ...
[ "def", "format_title", "(", "self", ")", ":", "def", "asciify", "(", "_title", ")", ":", "_title", "=", "unicodedata", ".", "normalize", "(", "'NFD'", ",", "unicode", "(", "_title", ")", ")", "ascii", "=", "True", "out", "=", "[", "]", "ok", "=", "...
Takes a string and sanitizes it for Github's url name format
[ "Takes", "a", "string", "and", "sanitizes", "it", "for", "Github", "s", "url", "name", "format" ]
3f6db8b5a22ccdd2110d3199223c30db4e558b5c
https://github.com/gitenberg-dev/gitberg/blob/3f6db8b5a22ccdd2110d3199223c30db4e558b5c/gitenberg/book.py#L266-L296
train
Takes a string and sanitizes it for Github s url name format
LiftoffSoftware/htmltag
htmltag.py
strip_xss
def strip_xss(html, whitelist=None, replacement="(removed)"): """ This function returns a tuple containing: * *html* with all non-whitelisted HTML tags replaced with *replacement*. * A `set()` containing the tags that were removed. Any tags that contain JavaScript, VBScript, or other known...
python
def strip_xss(html, whitelist=None, replacement="(removed)"): """ This function returns a tuple containing: * *html* with all non-whitelisted HTML tags replaced with *replacement*. * A `set()` containing the tags that were removed. Any tags that contain JavaScript, VBScript, or other known...
[ "def", "strip_xss", "(", "html", ",", "whitelist", "=", "None", ",", "replacement", "=", "\"(removed)\"", ")", ":", "re_html_tag", "=", "re", ".", "compile", "(", "# This matches HTML tags (if used correctly)", "\"(?i)<\\/?\\w+((\\s+\\w+(\\s*=\\s*(?:\\\".*?\\\"|'.*?'|[^'\\\...
This function returns a tuple containing: * *html* with all non-whitelisted HTML tags replaced with *replacement*. * A `set()` containing the tags that were removed. Any tags that contain JavaScript, VBScript, or other known XSS/executable functions will also be removed. If *whitelist* is...
[ "This", "function", "returns", "a", "tuple", "containing", ":" ]
f6989f9a3301e7c96ee613e5dbbe43b2bde615c7
https://github.com/LiftoffSoftware/htmltag/blob/f6989f9a3301e7c96ee613e5dbbe43b2bde615c7/htmltag.py#L194-L300
train
This function strips the given HTML string and returns a tuple containing all non - whitelisted HTML tags replaced with replacement.
LiftoffSoftware/htmltag
htmltag.py
HTML.append
def append(self, *strings): """ Adds any number of supplied *strings* to `self` (we're a subclass of `str` remember) just before the last closing tag and returns a new instance of `~htmltag.HTML` with the result. Example:: >>> from htmltag import span, b ...
python
def append(self, *strings): """ Adds any number of supplied *strings* to `self` (we're a subclass of `str` remember) just before the last closing tag and returns a new instance of `~htmltag.HTML` with the result. Example:: >>> from htmltag import span, b ...
[ "def", "append", "(", "self", ",", "*", "strings", ")", ":", "close_tag_start", "=", "self", ".", "rfind", "(", "'</'", ")", "if", "self", ".", "tagname", ":", "# More accurate", "close_tag_start", "=", "self", ".", "rfind", "(", "'</'", "+", "self", "...
Adds any number of supplied *strings* to `self` (we're a subclass of `str` remember) just before the last closing tag and returns a new instance of `~htmltag.HTML` with the result. Example:: >>> from htmltag import span, b >>> html = span('Test:') >>> print(h...
[ "Adds", "any", "number", "of", "supplied", "*", "strings", "*", "to", "self", "(", "we", "re", "a", "subclass", "of", "str", "remember", ")", "just", "before", "the", "last", "closing", "tag", "and", "returns", "a", "new", "instance", "of", "~htmltag", ...
f6989f9a3301e7c96ee613e5dbbe43b2bde615c7
https://github.com/LiftoffSoftware/htmltag/blob/f6989f9a3301e7c96ee613e5dbbe43b2bde615c7/htmltag.py#L330-L369
train
Adds any number of supplied strings to self and returns a new ~htmltag. HTML instance with the result.
LiftoffSoftware/htmltag
htmltag.py
TagWrap.escape
def escape(self, string): """ Returns *string* with all instances of '<', '>', and '&' converted into HTML entities. """ html_entities = {"&": "&amp;", '<': '&lt;', '>': '&gt;'} return HTML("".join(html_entities.get(c, c) for c in string))
python
def escape(self, string): """ Returns *string* with all instances of '<', '>', and '&' converted into HTML entities. """ html_entities = {"&": "&amp;", '<': '&lt;', '>': '&gt;'} return HTML("".join(html_entities.get(c, c) for c in string))
[ "def", "escape", "(", "self", ",", "string", ")", ":", "html_entities", "=", "{", "\"&\"", ":", "\"&amp;\"", ",", "'<'", ":", "'&lt;'", ",", "'>'", ":", "'&gt;'", "}", "return", "HTML", "(", "\"\"", ".", "join", "(", "html_entities", ".", "get", "(",...
Returns *string* with all instances of '<', '>', and '&' converted into HTML entities.
[ "Returns", "*", "string", "*", "with", "all", "instances", "of", "<", ">", "and", "&", "converted", "into", "HTML", "entities", "." ]
f6989f9a3301e7c96ee613e5dbbe43b2bde615c7
https://github.com/LiftoffSoftware/htmltag/blob/f6989f9a3301e7c96ee613e5dbbe43b2bde615c7/htmltag.py#L442-L448
train
Returns a string with all instances of < > and '&' converted into HTML entities.
LiftoffSoftware/htmltag
htmltag.py
TagWrap.wrap
def wrap(self, tag, *args, **kwargs): """ Returns all *args* (strings) wrapped in HTML tags like so:: >>> b = TagWrap('b') >>> print(b('bold text')) <b>bold text</b> To add attributes to the tag you can pass them as keyword arguments:: >>> a = T...
python
def wrap(self, tag, *args, **kwargs): """ Returns all *args* (strings) wrapped in HTML tags like so:: >>> b = TagWrap('b') >>> print(b('bold text')) <b>bold text</b> To add attributes to the tag you can pass them as keyword arguments:: >>> a = T...
[ "def", "wrap", "(", "self", ",", "tag", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "template", "=", "\"<{tagstart}>{content}</{tag}>\"", "if", "tag", "in", "self_closing_tags", ":", "template", "=", "\"<{tagstart}>\"", "# self-closing tags don't have con...
Returns all *args* (strings) wrapped in HTML tags like so:: >>> b = TagWrap('b') >>> print(b('bold text')) <b>bold text</b> To add attributes to the tag you can pass them as keyword arguments:: >>> a = TagWrap('a') >>> print(a('awesome software', hr...
[ "Returns", "all", "*", "args", "*", "(", "strings", ")", "wrapped", "in", "HTML", "tags", "like", "so", "::" ]
f6989f9a3301e7c96ee613e5dbbe43b2bde615c7
https://github.com/LiftoffSoftware/htmltag/blob/f6989f9a3301e7c96ee613e5dbbe43b2bde615c7/htmltag.py#L450-L501
train
Wraps the given tag with the given arguments and returns the resulting HTML string.
LiftoffSoftware/htmltag
htmltag.py
TagWrap.copy
def copy(self, tagname, **kwargs): """ Returns a new instance of `TagWrap` using the given *tagname* that has all the same attributes as this instance. If *kwargs* is given they will override the attributes of the created instance. """ new_kwargs = { 'replace...
python
def copy(self, tagname, **kwargs): """ Returns a new instance of `TagWrap` using the given *tagname* that has all the same attributes as this instance. If *kwargs* is given they will override the attributes of the created instance. """ new_kwargs = { 'replace...
[ "def", "copy", "(", "self", ",", "tagname", ",", "*", "*", "kwargs", ")", ":", "new_kwargs", "=", "{", "'replacement'", ":", "self", ".", "replacement", ",", "'whitelist'", ":", "self", ".", "whitelist", ",", "'safe_mode'", ":", "self", ".", "safe_mode",...
Returns a new instance of `TagWrap` using the given *tagname* that has all the same attributes as this instance. If *kwargs* is given they will override the attributes of the created instance.
[ "Returns", "a", "new", "instance", "of", "TagWrap", "using", "the", "given", "*", "tagname", "*", "that", "has", "all", "the", "same", "attributes", "as", "this", "instance", ".", "If", "*", "kwargs", "*", "is", "given", "they", "will", "override", "the"...
f6989f9a3301e7c96ee613e5dbbe43b2bde615c7
https://github.com/LiftoffSoftware/htmltag/blob/f6989f9a3301e7c96ee613e5dbbe43b2bde615c7/htmltag.py#L503-L517
train
Returns a copy of this instance with the given tagname and any additional keyword arguments.
ponty/psidialogs
psidialogs/api/tksimpledialog_api.py
askstring
def askstring(title, prompt, **kw): """Original doc: get a string from the user Arguments: title -- the dialog title prompt -- the label text **kw -- see SimpleDialog class Return value is a string """ return psidialogs.ask_string(title=title, message=prompt)
python
def askstring(title, prompt, **kw): """Original doc: get a string from the user Arguments: title -- the dialog title prompt -- the label text **kw -- see SimpleDialog class Return value is a string """ return psidialogs.ask_string(title=title, message=prompt)
[ "def", "askstring", "(", "title", ",", "prompt", ",", "*", "*", "kw", ")", ":", "return", "psidialogs", ".", "ask_string", "(", "title", "=", "title", ",", "message", "=", "prompt", ")" ]
Original doc: get a string from the user Arguments: title -- the dialog title prompt -- the label text **kw -- see SimpleDialog class Return value is a string
[ "Original", "doc", ":", "get", "a", "string", "from", "the", "user" ]
e385ab6b48cb43af52b810a1bf76a8135f4585b8
https://github.com/ponty/psidialogs/blob/e385ab6b48cb43af52b810a1bf76a8135f4585b8/psidialogs/api/tksimpledialog_api.py#L5-L16
train
Original doc : get a string from the user s user s list