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
1 value
edublancas/sklearn-evaluation
docs/sphinxext/ipython_sphinxext/ipython_directive.py
block_parser
def block_parser(part, rgxin, rgxout, fmtin, fmtout): """ part is a string of ipython text, comprised of at most one input, one output, comments, and blank lines. The block parser parses the text into a list of:: blocks = [ (TOKEN0, data0), (TOKEN1, data1), ...] where TOKEN is one of [COMME...
python
def block_parser(part, rgxin, rgxout, fmtin, fmtout): """ part is a string of ipython text, comprised of at most one input, one output, comments, and blank lines. The block parser parses the text into a list of:: blocks = [ (TOKEN0, data0), (TOKEN1, data1), ...] where TOKEN is one of [COMME...
[ "def", "block_parser", "(", "part", ",", "rgxin", ",", "rgxout", ",", "fmtin", ",", "fmtout", ")", ":", "block", "=", "[", "]", "lines", "=", "part", ".", "split", "(", "'\\n'", ")", "N", "=", "len", "(", "lines", ")", "i", "=", "0", "decorator",...
part is a string of ipython text, comprised of at most one input, one output, comments, and blank lines. The block parser parses the text into a list of:: blocks = [ (TOKEN0, data0), (TOKEN1, data1), ...] where TOKEN is one of [COMMENT | INPUT | OUTPUT ] and data is, depending on the type of to...
[ "part", "is", "a", "string", "of", "ipython", "text", "comprised", "of", "at", "most", "one", "input", "one", "output", "comments", "and", "blank", "lines", ".", "The", "block", "parser", "parses", "the", "text", "into", "a", "list", "of", "::" ]
79ee6e4dfe911b5a5a9b78a5caaed7c73eef6f39
https://github.com/edublancas/sklearn-evaluation/blob/79ee6e4dfe911b5a5a9b78a5caaed7c73eef6f39/docs/sphinxext/ipython_sphinxext/ipython_directive.py#L165-L266
train
edublancas/sklearn-evaluation
docs/sphinxext/ipython_sphinxext/ipython_directive.py
EmbeddedSphinxShell.process_block
def process_block(self, block): """ process block from the block_parser and return a list of processed lines """ ret = [] output = None input_lines = None lineno = self.IP.execution_count input_prompt = self.promptin % lineno output_prompt = self....
python
def process_block(self, block): """ process block from the block_parser and return a list of processed lines """ ret = [] output = None input_lines = None lineno = self.IP.execution_count input_prompt = self.promptin % lineno output_prompt = self....
[ "def", "process_block", "(", "self", ",", "block", ")", ":", "ret", "=", "[", "]", "output", "=", "None", "input_lines", "=", "None", "lineno", "=", "self", ".", "IP", ".", "execution_count", "input_prompt", "=", "self", ".", "promptin", "%", "lineno", ...
process block from the block_parser and return a list of processed lines
[ "process", "block", "from", "the", "block_parser", "and", "return", "a", "list", "of", "processed", "lines" ]
79ee6e4dfe911b5a5a9b78a5caaed7c73eef6f39
https://github.com/edublancas/sklearn-evaluation/blob/79ee6e4dfe911b5a5a9b78a5caaed7c73eef6f39/docs/sphinxext/ipython_sphinxext/ipython_directive.py#L640-L708
train
edublancas/sklearn-evaluation
sklearn_evaluation/plot/grid_search.py
grid_search
def grid_search(grid_scores, change, subset=None, kind='line', cmap=None, ax=None): """ Plot results from a sklearn grid search by changing two parameters at most. Parameters ---------- grid_scores : list of named tuples Results from a sklearn grid search (get them using the...
python
def grid_search(grid_scores, change, subset=None, kind='line', cmap=None, ax=None): """ Plot results from a sklearn grid search by changing two parameters at most. Parameters ---------- grid_scores : list of named tuples Results from a sklearn grid search (get them using the...
[ "def", "grid_search", "(", "grid_scores", ",", "change", ",", "subset", "=", "None", ",", "kind", "=", "'line'", ",", "cmap", "=", "None", ",", "ax", "=", "None", ")", ":", "if", "change", "is", "None", ":", "raise", "ValueError", "(", "(", "'change ...
Plot results from a sklearn grid search by changing two parameters at most. Parameters ---------- grid_scores : list of named tuples Results from a sklearn grid search (get them using the `grid_scores_` parameter) change : str or iterable with len<=2 Parameter to change subs...
[ "Plot", "results", "from", "a", "sklearn", "grid", "search", "by", "changing", "two", "parameters", "at", "most", "." ]
79ee6e4dfe911b5a5a9b78a5caaed7c73eef6f39
https://github.com/edublancas/sklearn-evaluation/blob/79ee6e4dfe911b5a5a9b78a5caaed7c73eef6f39/sklearn_evaluation/plot/grid_search.py#L12-L64
train
edublancas/sklearn-evaluation
sklearn_evaluation/evaluator.py
ClassifierEvaluator.confusion_matrix
def confusion_matrix(self): """Confusion matrix plot """ return plot.confusion_matrix(self.y_true, self.y_pred, self.target_names, ax=_gen_ax())
python
def confusion_matrix(self): """Confusion matrix plot """ return plot.confusion_matrix(self.y_true, self.y_pred, self.target_names, ax=_gen_ax())
[ "def", "confusion_matrix", "(", "self", ")", ":", "return", "plot", ".", "confusion_matrix", "(", "self", ".", "y_true", ",", "self", ".", "y_pred", ",", "self", ".", "target_names", ",", "ax", "=", "_gen_ax", "(", ")", ")" ]
Confusion matrix plot
[ "Confusion", "matrix", "plot" ]
79ee6e4dfe911b5a5a9b78a5caaed7c73eef6f39
https://github.com/edublancas/sklearn-evaluation/blob/79ee6e4dfe911b5a5a9b78a5caaed7c73eef6f39/sklearn_evaluation/evaluator.py#L85-L89
train
edublancas/sklearn-evaluation
sklearn_evaluation/evaluator.py
ClassifierEvaluator.roc
def roc(self): """ROC plot """ return plot.roc(self.y_true, self.y_score, ax=_gen_ax())
python
def roc(self): """ROC plot """ return plot.roc(self.y_true, self.y_score, ax=_gen_ax())
[ "def", "roc", "(", "self", ")", ":", "return", "plot", ".", "roc", "(", "self", ".", "y_true", ",", "self", ".", "y_score", ",", "ax", "=", "_gen_ax", "(", ")", ")" ]
ROC plot
[ "ROC", "plot" ]
79ee6e4dfe911b5a5a9b78a5caaed7c73eef6f39
https://github.com/edublancas/sklearn-evaluation/blob/79ee6e4dfe911b5a5a9b78a5caaed7c73eef6f39/sklearn_evaluation/evaluator.py#L92-L95
train
edublancas/sklearn-evaluation
sklearn_evaluation/evaluator.py
ClassifierEvaluator.precision_recall
def precision_recall(self): """Precision-recall plot """ return plot.precision_recall(self.y_true, self.y_score, ax=_gen_ax())
python
def precision_recall(self): """Precision-recall plot """ return plot.precision_recall(self.y_true, self.y_score, ax=_gen_ax())
[ "def", "precision_recall", "(", "self", ")", ":", "return", "plot", ".", "precision_recall", "(", "self", ".", "y_true", ",", "self", ".", "y_score", ",", "ax", "=", "_gen_ax", "(", ")", ")" ]
Precision-recall plot
[ "Precision", "-", "recall", "plot" ]
79ee6e4dfe911b5a5a9b78a5caaed7c73eef6f39
https://github.com/edublancas/sklearn-evaluation/blob/79ee6e4dfe911b5a5a9b78a5caaed7c73eef6f39/sklearn_evaluation/evaluator.py#L98-L101
train
edublancas/sklearn-evaluation
sklearn_evaluation/evaluator.py
ClassifierEvaluator.feature_importances
def feature_importances(self): """Feature importances plot """ return plot.feature_importances(self.estimator, feature_names=self.feature_names, ax=_gen_ax())
python
def feature_importances(self): """Feature importances plot """ return plot.feature_importances(self.estimator, feature_names=self.feature_names, ax=_gen_ax())
[ "def", "feature_importances", "(", "self", ")", ":", "return", "plot", ".", "feature_importances", "(", "self", ".", "estimator", ",", "feature_names", "=", "self", ".", "feature_names", ",", "ax", "=", "_gen_ax", "(", ")", ")" ]
Feature importances plot
[ "Feature", "importances", "plot" ]
79ee6e4dfe911b5a5a9b78a5caaed7c73eef6f39
https://github.com/edublancas/sklearn-evaluation/blob/79ee6e4dfe911b5a5a9b78a5caaed7c73eef6f39/sklearn_evaluation/evaluator.py#L104-L109
train
edublancas/sklearn-evaluation
sklearn_evaluation/evaluator.py
ClassifierEvaluator.feature_importances_table
def feature_importances_table(self): """Feature importances table """ from . import table return table.feature_importances(self.estimator, feature_names=self.feature_names)
python
def feature_importances_table(self): """Feature importances table """ from . import table return table.feature_importances(self.estimator, feature_names=self.feature_names)
[ "def", "feature_importances_table", "(", "self", ")", ":", "from", ".", "import", "table", "return", "table", ".", "feature_importances", "(", "self", ".", "estimator", ",", "feature_names", "=", "self", ".", "feature_names", ")" ]
Feature importances table
[ "Feature", "importances", "table" ]
79ee6e4dfe911b5a5a9b78a5caaed7c73eef6f39
https://github.com/edublancas/sklearn-evaluation/blob/79ee6e4dfe911b5a5a9b78a5caaed7c73eef6f39/sklearn_evaluation/evaluator.py#L112-L118
train
edublancas/sklearn-evaluation
sklearn_evaluation/evaluator.py
ClassifierEvaluator.precision_at_proportions
def precision_at_proportions(self): """Precision at proportions plot """ return plot.precision_at_proportions(self.y_true, self.y_score, ax=_gen_ax())
python
def precision_at_proportions(self): """Precision at proportions plot """ return plot.precision_at_proportions(self.y_true, self.y_score, ax=_gen_ax())
[ "def", "precision_at_proportions", "(", "self", ")", ":", "return", "plot", ".", "precision_at_proportions", "(", "self", ".", "y_true", ",", "self", ".", "y_score", ",", "ax", "=", "_gen_ax", "(", ")", ")" ]
Precision at proportions plot
[ "Precision", "at", "proportions", "plot" ]
79ee6e4dfe911b5a5a9b78a5caaed7c73eef6f39
https://github.com/edublancas/sklearn-evaluation/blob/79ee6e4dfe911b5a5a9b78a5caaed7c73eef6f39/sklearn_evaluation/evaluator.py#L121-L125
train
edublancas/sklearn-evaluation
sklearn_evaluation/evaluator.py
ClassifierEvaluator.generate_report
def generate_report(self, template, path=None, style=None): """ Generate HTML report Parameters ---------- template : markdown-formatted string or path to the template file used for rendering the report. Any attribute of this object can be included in th...
python
def generate_report(self, template, path=None, style=None): """ Generate HTML report Parameters ---------- template : markdown-formatted string or path to the template file used for rendering the report. Any attribute of this object can be included in th...
[ "def", "generate_report", "(", "self", ",", "template", ",", "path", "=", "None", ",", "style", "=", "None", ")", ":", "from", ".", "report", "import", "generate", "return", "generate", "(", "self", ",", "template", ",", "path", ",", "style", ")" ]
Generate HTML report Parameters ---------- template : markdown-formatted string or path to the template file used for rendering the report. Any attribute of this object can be included in the report using the {tag} format. e.g.'# Report{estimator_name}{roc}{p...
[ "Generate", "HTML", "report" ]
79ee6e4dfe911b5a5a9b78a5caaed7c73eef6f39
https://github.com/edublancas/sklearn-evaluation/blob/79ee6e4dfe911b5a5a9b78a5caaed7c73eef6f39/sklearn_evaluation/evaluator.py#L127-L157
train
edublancas/sklearn-evaluation
sklearn_evaluation/plot/roc.py
roc
def roc(y_true, y_score, ax=None): """ Plot ROC curve. Parameters ---------- y_true : array-like, shape = [n_samples] Correct target values (ground truth). y_score : array-like, shape = [n_samples] or [n_samples, 2] for binary classification or [n_samples, n_classes] for m...
python
def roc(y_true, y_score, ax=None): """ Plot ROC curve. Parameters ---------- y_true : array-like, shape = [n_samples] Correct target values (ground truth). y_score : array-like, shape = [n_samples] or [n_samples, 2] for binary classification or [n_samples, n_classes] for m...
[ "def", "roc", "(", "y_true", ",", "y_score", ",", "ax", "=", "None", ")", ":", "if", "any", "(", "(", "val", "is", "None", "for", "val", "in", "(", "y_true", ",", "y_score", ")", ")", ")", ":", "raise", "ValueError", "(", "\"y_true and y_score are ne...
Plot ROC curve. Parameters ---------- y_true : array-like, shape = [n_samples] Correct target values (ground truth). y_score : array-like, shape = [n_samples] or [n_samples, 2] for binary classification or [n_samples, n_classes] for multiclass Target scores (estimator pre...
[ "Plot", "ROC", "curve", "." ]
79ee6e4dfe911b5a5a9b78a5caaed7c73eef6f39
https://github.com/edublancas/sklearn-evaluation/blob/79ee6e4dfe911b5a5a9b78a5caaed7c73eef6f39/sklearn_evaluation/plot/roc.py#L9-L69
train
edublancas/sklearn-evaluation
sklearn_evaluation/plot/roc.py
_roc
def _roc(y_true, y_score, ax=None): """ Plot ROC curve for binary classification. Parameters ---------- y_true : array-like, shape = [n_samples] Correct target values (ground truth). y_score : array-like, shape = [n_samples] Target scores (estimator predictions). ax: matplot...
python
def _roc(y_true, y_score, ax=None): """ Plot ROC curve for binary classification. Parameters ---------- y_true : array-like, shape = [n_samples] Correct target values (ground truth). y_score : array-like, shape = [n_samples] Target scores (estimator predictions). ax: matplot...
[ "def", "_roc", "(", "y_true", ",", "y_score", ",", "ax", "=", "None", ")", ":", "# check dimensions", "fpr", ",", "tpr", ",", "_", "=", "roc_curve", "(", "y_true", ",", "y_score", ")", "roc_auc", "=", "auc", "(", "fpr", ",", "tpr", ")", "ax", ".", ...
Plot ROC curve for binary classification. Parameters ---------- y_true : array-like, shape = [n_samples] Correct target values (ground truth). y_score : array-like, shape = [n_samples] Target scores (estimator predictions). ax: matplotlib Axes Axes object to draw the plot on...
[ "Plot", "ROC", "curve", "for", "binary", "classification", "." ]
79ee6e4dfe911b5a5a9b78a5caaed7c73eef6f39
https://github.com/edublancas/sklearn-evaluation/blob/79ee6e4dfe911b5a5a9b78a5caaed7c73eef6f39/sklearn_evaluation/plot/roc.py#L72-L98
train
edublancas/sklearn-evaluation
sklearn_evaluation/plot/roc.py
_roc_multi
def _roc_multi(y_true, y_score, ax=None): """ Plot ROC curve for multi classification. Parameters ---------- y_true : array-like, shape = [n_samples, n_classes] Correct target values (ground truth). y_score : array-like, shape = [n_samples, n_classes] Target scores (estimator pr...
python
def _roc_multi(y_true, y_score, ax=None): """ Plot ROC curve for multi classification. Parameters ---------- y_true : array-like, shape = [n_samples, n_classes] Correct target values (ground truth). y_score : array-like, shape = [n_samples, n_classes] Target scores (estimator pr...
[ "def", "_roc_multi", "(", "y_true", ",", "y_score", ",", "ax", "=", "None", ")", ":", "# Compute micro-average ROC curve and ROC area", "fpr", ",", "tpr", ",", "_", "=", "roc_curve", "(", "y_true", ".", "ravel", "(", ")", ",", "y_score", ".", "ravel", "(",...
Plot ROC curve for multi classification. Parameters ---------- y_true : array-like, shape = [n_samples, n_classes] Correct target values (ground truth). y_score : array-like, shape = [n_samples, n_classes] Target scores (estimator predictions). ax: matplotlib Axes Axes objec...
[ "Plot", "ROC", "curve", "for", "multi", "classification", "." ]
79ee6e4dfe911b5a5a9b78a5caaed7c73eef6f39
https://github.com/edublancas/sklearn-evaluation/blob/79ee6e4dfe911b5a5a9b78a5caaed7c73eef6f39/sklearn_evaluation/plot/roc.py#L101-L130
train
hubo1016/vlcp
vlcp/utils/redisclient.py
RedisClient.get_connection
async def get_connection(self, container): ''' Get an exclusive connection, useful for blocked commands and transactions. You must call release or shutdown (not recommanded) to return the connection after use. :param container: routine container :return...
python
async def get_connection(self, container): ''' Get an exclusive connection, useful for blocked commands and transactions. You must call release or shutdown (not recommanded) to return the connection after use. :param container: routine container :return...
[ "async", "def", "get_connection", "(", "self", ",", "container", ")", ":", "if", "self", ".", "_connpool", ":", "conn", "=", "self", ".", "_connpool", ".", "pop", "(", ")", "return", "RedisClientBase", "(", "conn", ",", "self", ")", "else", ":", "conn"...
Get an exclusive connection, useful for blocked commands and transactions. You must call release or shutdown (not recommanded) to return the connection after use. :param container: routine container :returns: RedisClientBase object, with some commands same as RedisClie...
[ "Get", "an", "exclusive", "connection", "useful", "for", "blocked", "commands", "and", "transactions", ".", "You", "must", "call", "release", "or", "shutdown", "(", "not", "recommanded", ")", "to", "return", "the", "connection", "after", "use", ".", ":", "pa...
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/utils/redisclient.py#L257-L275
train
hubo1016/vlcp
vlcp/utils/redisclient.py
RedisClient.execute_command
async def execute_command(self, container, *args): ''' Execute command on Redis server: - For (P)SUBSCRIBE/(P)UNSUBSCRIBE, the command is sent to the subscribe connection. It is recommended to use (p)subscribe/(p)unsubscribe method instead of directly call the command - F...
python
async def execute_command(self, container, *args): ''' Execute command on Redis server: - For (P)SUBSCRIBE/(P)UNSUBSCRIBE, the command is sent to the subscribe connection. It is recommended to use (p)subscribe/(p)unsubscribe method instead of directly call the command - F...
[ "async", "def", "execute_command", "(", "self", ",", "container", ",", "*", "args", ")", ":", "if", "args", ":", "cmd", "=", "_str", "(", "args", "[", "0", "]", ")", ".", "upper", "(", ")", "if", "cmd", "in", "(", "'SUBSCRIBE'", ",", "'UNSUBSCRIBE'...
Execute command on Redis server: - For (P)SUBSCRIBE/(P)UNSUBSCRIBE, the command is sent to the subscribe connection. It is recommended to use (p)subscribe/(p)unsubscribe method instead of directly call the command - For BLPOP, BRPOP, BRPOPLPUSH, the command is sent to a separated connect...
[ "Execute", "command", "on", "Redis", "server", ":", "-", "For", "(", "P", ")", "SUBSCRIBE", "/", "(", "P", ")", "UNSUBSCRIBE", "the", "command", "is", "sent", "to", "the", "subscribe", "connection", ".", "It", "is", "recommended", "to", "use", "(", "p"...
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/utils/redisclient.py#L296-L314
train
hubo1016/vlcp
vlcp/utils/redisclient.py
RedisClient.subscribe
async def subscribe(self, container, *keys): ''' Subscribe to specified channels :param container: routine container :param *keys: subscribed channels :returns: list of event matchers for the specified channels ''' await self._get_subscr...
python
async def subscribe(self, container, *keys): ''' Subscribe to specified channels :param container: routine container :param *keys: subscribed channels :returns: list of event matchers for the specified channels ''' await self._get_subscr...
[ "async", "def", "subscribe", "(", "self", ",", "container", ",", "*", "keys", ")", ":", "await", "self", ".", "_get_subscribe_connection", "(", "container", ")", "realkeys", "=", "[", "]", "for", "k", "in", "keys", ":", "count", "=", "self", ".", "_sub...
Subscribe to specified channels :param container: routine container :param *keys: subscribed channels :returns: list of event matchers for the specified channels
[ "Subscribe", "to", "specified", "channels", ":", "param", "container", ":", "routine", "container", ":", "param", "*", "keys", ":", "subscribed", "channels", ":", "returns", ":", "list", "of", "event", "matchers", "for", "the", "specified", "channels" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/utils/redisclient.py#L316-L335
train
hubo1016/vlcp
vlcp/utils/redisclient.py
RedisClient.unsubscribe
async def unsubscribe(self, container, *keys): ''' Unsubscribe specified channels. Every subscribed key should be unsubscribed exactly once, even if duplicated subscribed. :param container: routine container :param \*keys: subscribed channels ''' await s...
python
async def unsubscribe(self, container, *keys): ''' Unsubscribe specified channels. Every subscribed key should be unsubscribed exactly once, even if duplicated subscribed. :param container: routine container :param \*keys: subscribed channels ''' await s...
[ "async", "def", "unsubscribe", "(", "self", ",", "container", ",", "*", "keys", ")", ":", "await", "self", ".", "_get_subscribe_connection", "(", "container", ")", "realkeys", "=", "[", "]", "for", "k", "in", "keys", ":", "count", "=", "self", ".", "_s...
Unsubscribe specified channels. Every subscribed key should be unsubscribed exactly once, even if duplicated subscribed. :param container: routine container :param \*keys: subscribed channels
[ "Unsubscribe", "specified", "channels", ".", "Every", "subscribed", "key", "should", "be", "unsubscribed", "exactly", "once", "even", "if", "duplicated", "subscribed", ".", ":", "param", "container", ":", "routine", "container", ":", "param", "\\", "*", "keys", ...
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/utils/redisclient.py#L337-L358
train
hubo1016/vlcp
vlcp/utils/redisclient.py
RedisClient.psubscribe
async def psubscribe(self, container, *keys): ''' Subscribe to specified globs :param container: routine container :param \*keys: subscribed globs :returns: list of event matchers for the specified globs ''' await self._get_subscribe_co...
python
async def psubscribe(self, container, *keys): ''' Subscribe to specified globs :param container: routine container :param \*keys: subscribed globs :returns: list of event matchers for the specified globs ''' await self._get_subscribe_co...
[ "async", "def", "psubscribe", "(", "self", ",", "container", ",", "*", "keys", ")", ":", "await", "self", ".", "_get_subscribe_connection", "(", "container", ")", "realkeys", "=", "[", "]", "for", "k", "in", "keys", ":", "count", "=", "self", ".", "_ps...
Subscribe to specified globs :param container: routine container :param \*keys: subscribed globs :returns: list of event matchers for the specified globs
[ "Subscribe", "to", "specified", "globs", ":", "param", "container", ":", "routine", "container", ":", "param", "\\", "*", "keys", ":", "subscribed", "globs", ":", "returns", ":", "list", "of", "event", "matchers", "for", "the", "specified", "globs" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/utils/redisclient.py#L360-L378
train
hubo1016/vlcp
vlcp/utils/redisclient.py
RedisClient.shutdown
async def shutdown(self, container, force=False): ''' Shutdown all connections. Exclusive connections created by get_connection will shutdown after release() ''' p = self._connpool self._connpool = [] self._shutdown = True if self._defaultconn: p.appen...
python
async def shutdown(self, container, force=False): ''' Shutdown all connections. Exclusive connections created by get_connection will shutdown after release() ''' p = self._connpool self._connpool = [] self._shutdown = True if self._defaultconn: p.appen...
[ "async", "def", "shutdown", "(", "self", ",", "container", ",", "force", "=", "False", ")", ":", "p", "=", "self", ".", "_connpool", "self", ".", "_connpool", "=", "[", "]", "self", ".", "_shutdown", "=", "True", "if", "self", ".", "_defaultconn", ":...
Shutdown all connections. Exclusive connections created by get_connection will shutdown after release()
[ "Shutdown", "all", "connections", ".", "Exclusive", "connections", "created", "by", "get_connection", "will", "shutdown", "after", "release", "()" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/utils/redisclient.py#L399-L413
train
hubo1016/vlcp
vlcp/utils/redisclient.py
RedisClient.subscribe_state_matcher
def subscribe_state_matcher(self, container, connected = True): ''' Return a matcher to match the subscribe connection status. :param container: a routine container. NOTICE: this method is not a routine. :param connected: if True, the matcher matches connection up. If F...
python
def subscribe_state_matcher(self, container, connected = True): ''' Return a matcher to match the subscribe connection status. :param container: a routine container. NOTICE: this method is not a routine. :param connected: if True, the matcher matches connection up. If F...
[ "def", "subscribe_state_matcher", "(", "self", ",", "container", ",", "connected", "=", "True", ")", ":", "if", "not", "self", ".", "_subscribeconn", ":", "self", ".", "_subscribeconn", "=", "self", ".", "_create_client", "(", "container", ")", "return", "Re...
Return a matcher to match the subscribe connection status. :param container: a routine container. NOTICE: this method is not a routine. :param connected: if True, the matcher matches connection up. If False, the matcher matches connection down. :returns:...
[ "Return", "a", "matcher", "to", "match", "the", "subscribe", "connection", "status", ".", ":", "param", "container", ":", "a", "routine", "container", ".", "NOTICE", ":", "this", "method", "is", "not", "a", "routine", ".", ":", "param", "connected", ":", ...
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/utils/redisclient.py#L438-L454
train
hubo1016/vlcp
vlcp/service/connection/zookeeperdb.py
_escape_path
def _escape_path(key): ''' Replace '/', '\\' in key ''' return _tobytes(key).replace(b'$', b'$_').replace(b'/', b'$+').replace(b'\\', b'$$')
python
def _escape_path(key): ''' Replace '/', '\\' in key ''' return _tobytes(key).replace(b'$', b'$_').replace(b'/', b'$+').replace(b'\\', b'$$')
[ "def", "_escape_path", "(", "key", ")", ":", "return", "_tobytes", "(", "key", ")", ".", "replace", "(", "b'$'", ",", "b'$_'", ")", ".", "replace", "(", "b'/'", ",", "b'$+'", ")", ".", "replace", "(", "b'\\\\'", ",", "b'$$'", ")" ]
Replace '/', '\\' in key
[ "Replace", "/", "\\\\", "in", "key" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/service/connection/zookeeperdb.py#L56-L60
train
hubo1016/vlcp
vlcp/utils/dhcp.py
reassemble_options
def reassemble_options(payload): ''' Reassemble partial options to options, returns a list of dhcp_option DHCP options are basically `|tag|length|value|` structure. When an option is longer than 255 bytes, it can be splitted into multiple structures with the same tag. The splitted structures mu...
python
def reassemble_options(payload): ''' Reassemble partial options to options, returns a list of dhcp_option DHCP options are basically `|tag|length|value|` structure. When an option is longer than 255 bytes, it can be splitted into multiple structures with the same tag. The splitted structures mu...
[ "def", "reassemble_options", "(", "payload", ")", ":", "options", "=", "[", "]", "option_indices", "=", "{", "}", "def", "process_option_list", "(", "partials", ")", ":", "for", "p", "in", "partials", ":", "if", "p", ".", "tag", "==", "OPTION_END", ":", ...
Reassemble partial options to options, returns a list of dhcp_option DHCP options are basically `|tag|length|value|` structure. When an option is longer than 255 bytes, it can be splitted into multiple structures with the same tag. The splitted structures must be joined back to get the original opt...
[ "Reassemble", "partial", "options", "to", "options", "returns", "a", "list", "of", "dhcp_option", "DHCP", "options", "are", "basically", "|tag|length|value|", "structure", ".", "When", "an", "option", "is", "longer", "than", "255", "bytes", "it", "can", "be", ...
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/utils/dhcp.py#L248-L289
train
hubo1016/vlcp
vlcp/utils/dhcp.py
build_options
def build_options(payload, options, maxsize = 576, overload = OVERLOAD_FILE | OVERLOAD_SNAME, allowpartial = True): ''' Split a list of options This is the reverse operation of `reassemble_options`, it splits `dhcp_option` into `dhcp_option_partial` if necessary, and set overload option if field ov...
python
def build_options(payload, options, maxsize = 576, overload = OVERLOAD_FILE | OVERLOAD_SNAME, allowpartial = True): ''' Split a list of options This is the reverse operation of `reassemble_options`, it splits `dhcp_option` into `dhcp_option_partial` if necessary, and set overload option if field ov...
[ "def", "build_options", "(", "payload", ",", "options", ",", "maxsize", "=", "576", ",", "overload", "=", "OVERLOAD_FILE", "|", "OVERLOAD_SNAME", ",", "allowpartial", "=", "True", ")", ":", "if", "maxsize", "<", "576", ":", "maxsize", "=", "576", "max_opti...
Split a list of options This is the reverse operation of `reassemble_options`, it splits `dhcp_option` into `dhcp_option_partial` if necessary, and set overload option if field overloading is used. :param options: a list of `dhcp_option` :param maxsize: Limit the maximum DHCP message ...
[ "Split", "a", "list", "of", "options", "This", "is", "the", "reverse", "operation", "of", "reassemble_options", "it", "splits", "dhcp_option", "into", "dhcp_option_partial", "if", "necessary", "and", "set", "overload", "option", "if", "field", "overloading", "is",...
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/utils/dhcp.py#L291-L424
train
hubo1016/vlcp
vlcp/utils/dhcp.py
create_option_from_value
def create_option_from_value(tag, value): """ Set DHCP option with human friendly value """ dhcp_option.parser() fake_opt = dhcp_option(tag = tag) for c in dhcp_option.subclasses: if c.criteria(fake_opt): if hasattr(c, '_parse_from_value'): return c(tag = tag,...
python
def create_option_from_value(tag, value): """ Set DHCP option with human friendly value """ dhcp_option.parser() fake_opt = dhcp_option(tag = tag) for c in dhcp_option.subclasses: if c.criteria(fake_opt): if hasattr(c, '_parse_from_value'): return c(tag = tag,...
[ "def", "create_option_from_value", "(", "tag", ",", "value", ")", ":", "dhcp_option", ".", "parser", "(", ")", "fake_opt", "=", "dhcp_option", "(", "tag", "=", "tag", ")", "for", "c", "in", "dhcp_option", ".", "subclasses", ":", "if", "c", ".", "criteria...
Set DHCP option with human friendly value
[ "Set", "DHCP", "option", "with", "human", "friendly", "value" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/utils/dhcp.py#L427-L441
train
hubo1016/vlcp
vlcp/utils/dhcp.py
create_dhcp_options
def create_dhcp_options(input_dict, ignoreError = False, generateNone = False): """ Try best to create dhcp_options from human friendly values, ignoring invalid values """ retdict = {} for k,v in dict(input_dict).items(): try: if generateNone and v is None: re...
python
def create_dhcp_options(input_dict, ignoreError = False, generateNone = False): """ Try best to create dhcp_options from human friendly values, ignoring invalid values """ retdict = {} for k,v in dict(input_dict).items(): try: if generateNone and v is None: re...
[ "def", "create_dhcp_options", "(", "input_dict", ",", "ignoreError", "=", "False", ",", "generateNone", "=", "False", ")", ":", "retdict", "=", "{", "}", "for", "k", ",", "v", "in", "dict", "(", "input_dict", ")", ".", "items", "(", ")", ":", "try", ...
Try best to create dhcp_options from human friendly values, ignoring invalid values
[ "Try", "best", "to", "create", "dhcp_options", "from", "human", "friendly", "values", "ignoring", "invalid", "values" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/utils/dhcp.py#L444-L465
train
hubo1016/vlcp
vlcp/event/event.py
with_indices
def with_indices(*args): ''' Create indices for an event class. Every event class must be decorated with this decorator. ''' def decorator(cls): for c in cls.__bases__: if hasattr(c, '_indicesNames'): cls._classnameIndex = c._classnameIndex + 1 for i i...
python
def with_indices(*args): ''' Create indices for an event class. Every event class must be decorated with this decorator. ''' def decorator(cls): for c in cls.__bases__: if hasattr(c, '_indicesNames'): cls._classnameIndex = c._classnameIndex + 1 for i i...
[ "def", "with_indices", "(", "*", "args", ")", ":", "def", "decorator", "(", "cls", ")", ":", "for", "c", "in", "cls", ".", "__bases__", ":", "if", "hasattr", "(", "c", ",", "'_indicesNames'", ")", ":", "cls", ".", "_classnameIndex", "=", "c", ".", ...
Create indices for an event class. Every event class must be decorated with this decorator.
[ "Create", "indices", "for", "an", "event", "class", ".", "Every", "event", "class", "must", "be", "decorated", "with", "this", "decorator", "." ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/event/event.py#L208-L226
train
hubo1016/vlcp
vlcp/event/event.py
Diff_.two_way_difference
def two_way_difference(self, b, extra_add = (), extra_remove = ()): """ Return (self - b, b - self) """ if self is b: return ((), ()) if isinstance(b, DiffRef_): extra_remove = extra_remove + b.add b = b.origin if extra_add == extra_rem...
python
def two_way_difference(self, b, extra_add = (), extra_remove = ()): """ Return (self - b, b - self) """ if self is b: return ((), ()) if isinstance(b, DiffRef_): extra_remove = extra_remove + b.add b = b.origin if extra_add == extra_rem...
[ "def", "two_way_difference", "(", "self", ",", "b", ",", "extra_add", "=", "(", ")", ",", "extra_remove", "=", "(", ")", ")", ":", "if", "self", "is", "b", ":", "return", "(", "(", ")", ",", "(", ")", ")", "if", "isinstance", "(", "b", ",", "Di...
Return (self - b, b - self)
[ "Return", "(", "self", "-", "b", "b", "-", "self", ")" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/event/event.py#L166-L202
train
hubo1016/vlcp
vlcp/event/event.py
Event.getTypename
def getTypename(cls): ''' :returns: return the proper name to match ''' if cls is Event: return None else: for c in cls.__bases__: if issubclass(c, Event): if c is Event: return cls._getTypename()...
python
def getTypename(cls): ''' :returns: return the proper name to match ''' if cls is Event: return None else: for c in cls.__bases__: if issubclass(c, Event): if c is Event: return cls._getTypename()...
[ "def", "getTypename", "(", "cls", ")", ":", "if", "cls", "is", "Event", ":", "return", "None", "else", ":", "for", "c", "in", "cls", ".", "__bases__", ":", "if", "issubclass", "(", "c", ",", "Event", ")", ":", "if", "c", "is", "Event", ":", "retu...
:returns: return the proper name to match
[ ":", "returns", ":", "return", "the", "proper", "name", "to", "match" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/event/event.py#L292-L304
train
hubo1016/vlcp
vlcp/event/event.py
Event.createMatcher
def createMatcher(cls, *args, **kwargs): ''' :param _ismatch: user-defined function ismatch(event) for matching test :param \*args: indices :param \*\*kwargs: index_name=index_value for matching criteria ''' if kwargs and not args: return EventMatcher(tuple(ge...
python
def createMatcher(cls, *args, **kwargs): ''' :param _ismatch: user-defined function ismatch(event) for matching test :param \*args: indices :param \*\*kwargs: index_name=index_value for matching criteria ''' if kwargs and not args: return EventMatcher(tuple(ge...
[ "def", "createMatcher", "(", "cls", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "kwargs", "and", "not", "args", ":", "return", "EventMatcher", "(", "tuple", "(", "getattr", "(", "cls", ",", "ind", ")", "if", "ind", "[", ":", "10", ...
:param _ismatch: user-defined function ismatch(event) for matching test :param \*args: indices :param \*\*kwargs: index_name=index_value for matching criteria
[ ":", "param", "_ismatch", ":", "user", "-", "defined", "function", "ismatch", "(", "event", ")", "for", "matching", "test", ":", "param", "\\", "*", "args", ":", "indices", ":", "param", "\\", "*", "\\", "*", "kwargs", ":", "index_name", "=", "index_va...
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/event/event.py#L331-L340
train
hubo1016/vlcp
vlcp/event/ratelimiter.py
RateLimiter.limit
async def limit(self, use = 1): """ Acquire "resources", wait until enough "resources" are acquired. For each loop, `limit` number of "resources" are permitted. :param use: number of "resouces" to be used. :return: True if is limited """ c = self...
python
async def limit(self, use = 1): """ Acquire "resources", wait until enough "resources" are acquired. For each loop, `limit` number of "resources" are permitted. :param use: number of "resouces" to be used. :return: True if is limited """ c = self...
[ "async", "def", "limit", "(", "self", ",", "use", "=", "1", ")", ":", "c", "=", "self", ".", "_counter", "self", ".", "_counter", "=", "c", "+", "use", "if", "self", ".", "_task", "is", "None", ":", "self", ".", "_task", "=", "self", ".", "_con...
Acquire "resources", wait until enough "resources" are acquired. For each loop, `limit` number of "resources" are permitted. :param use: number of "resouces" to be used. :return: True if is limited
[ "Acquire", "resources", "wait", "until", "enough", "resources", "are", "acquired", ".", "For", "each", "loop", "limit", "number", "of", "resources", "are", "permitted", ".", ":", "param", "use", ":", "number", "of", "resouces", "to", "be", "used", ".", ":"...
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/event/ratelimiter.py#L55-L73
train
hubo1016/vlcp
vlcp/utils/connector.py
TaskPool.run_task
async def run_task(self, container, task, newthread = False): "Run task() in task pool. Raise an exception or return the return value" e = TaskEvent(self, task=task, newthread = newthread) await container.wait_for_send(e) ev = await TaskDoneEvent.createMatcher(e) if hasattr(ev, '...
python
async def run_task(self, container, task, newthread = False): "Run task() in task pool. Raise an exception or return the return value" e = TaskEvent(self, task=task, newthread = newthread) await container.wait_for_send(e) ev = await TaskDoneEvent.createMatcher(e) if hasattr(ev, '...
[ "async", "def", "run_task", "(", "self", ",", "container", ",", "task", ",", "newthread", "=", "False", ")", ":", "e", "=", "TaskEvent", "(", "self", ",", "task", "=", "task", ",", "newthread", "=", "newthread", ")", "await", "container", ".", "wait_fo...
Run task() in task pool. Raise an exception or return the return value
[ "Run", "task", "()", "in", "task", "pool", ".", "Raise", "an", "exception", "or", "return", "the", "return", "value" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/utils/connector.py#L450-L458
train
hubo1016/vlcp
vlcp/utils/connector.py
TaskPool.run_gen_task
async def run_gen_task(self, container, gentask, newthread = True): "Run generator gentask() in task pool, yield customized events" e = TaskEvent(self, gen_task = gentask, newthread = newthread) await container.wait_for_send(e) ev = await TaskDoneEvent.createMatcher(e) if hasattr...
python
async def run_gen_task(self, container, gentask, newthread = True): "Run generator gentask() in task pool, yield customized events" e = TaskEvent(self, gen_task = gentask, newthread = newthread) await container.wait_for_send(e) ev = await TaskDoneEvent.createMatcher(e) if hasattr...
[ "async", "def", "run_gen_task", "(", "self", ",", "container", ",", "gentask", ",", "newthread", "=", "True", ")", ":", "e", "=", "TaskEvent", "(", "self", ",", "gen_task", "=", "gentask", ",", "newthread", "=", "newthread", ")", "await", "container", "....
Run generator gentask() in task pool, yield customized events
[ "Run", "generator", "gentask", "()", "in", "task", "pool", "yield", "customized", "events" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/utils/connector.py#L462-L470
train
hubo1016/vlcp
vlcp/utils/connector.py
TaskPool.run_async_task
async def run_async_task(self, container, asynctask, newthread = True): "Run asynctask(sender) in task pool, call sender(events) to send customized events, return result" e = TaskEvent(self, async_task = asynctask, newthread = newthread) await container.wait_for_send(e) ev = await TaskDo...
python
async def run_async_task(self, container, asynctask, newthread = True): "Run asynctask(sender) in task pool, call sender(events) to send customized events, return result" e = TaskEvent(self, async_task = asynctask, newthread = newthread) await container.wait_for_send(e) ev = await TaskDo...
[ "async", "def", "run_async_task", "(", "self", ",", "container", ",", "asynctask", ",", "newthread", "=", "True", ")", ":", "e", "=", "TaskEvent", "(", "self", ",", "async_task", "=", "asynctask", ",", "newthread", "=", "newthread", ")", "await", "containe...
Run asynctask(sender) in task pool, call sender(events) to send customized events, return result
[ "Run", "asynctask", "(", "sender", ")", "in", "task", "pool", "call", "sender", "(", "events", ")", "to", "send", "customized", "events", "return", "result" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/utils/connector.py#L474-L482
train
hubo1016/vlcp
vlcp/event/lock.py
Lock.lock
async def lock(self, container = None): "Wait for lock acquire" if container is None: container = RoutineContainer.get_container(self.scheduler) if self.locked: pass elif self.lockroutine: await LockedEvent.createMatcher(self) else: ...
python
async def lock(self, container = None): "Wait for lock acquire" if container is None: container = RoutineContainer.get_container(self.scheduler) if self.locked: pass elif self.lockroutine: await LockedEvent.createMatcher(self) else: ...
[ "async", "def", "lock", "(", "self", ",", "container", "=", "None", ")", ":", "if", "container", "is", "None", ":", "container", "=", "RoutineContainer", ".", "get_container", "(", "self", ".", "scheduler", ")", "if", "self", ".", "locked", ":", "pass", ...
Wait for lock acquire
[ "Wait", "for", "lock", "acquire" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/event/lock.py#L54-L64
train
hubo1016/vlcp
vlcp/event/lock.py
Lock.trylock
def trylock(self): "Try to acquire lock and return True; if cannot acquire the lock at this moment, return False." if self.locked: return True if self.lockroutine: return False waiter = self.scheduler.send(LockEvent(self.context, self.key, self)) if waiter...
python
def trylock(self): "Try to acquire lock and return True; if cannot acquire the lock at this moment, return False." if self.locked: return True if self.lockroutine: return False waiter = self.scheduler.send(LockEvent(self.context, self.key, self)) if waiter...
[ "def", "trylock", "(", "self", ")", ":", "if", "self", ".", "locked", ":", "return", "True", "if", "self", ".", "lockroutine", ":", "return", "False", "waiter", "=", "self", ".", "scheduler", ".", "send", "(", "LockEvent", "(", "self", ".", "context", ...
Try to acquire lock and return True; if cannot acquire the lock at this moment, return False.
[ "Try", "to", "acquire", "lock", "and", "return", "True", ";", "if", "cannot", "acquire", "the", "lock", "at", "this", "moment", "return", "False", "." ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/event/lock.py#L65-L76
train
hubo1016/vlcp
vlcp/event/lock.py
Lock.beginlock
def beginlock(self, container): "Start to acquire lock in another routine. Call trylock or lock later to acquire the lock. Call unlock to cancel the lock routine" if self.locked: return True if self.lockroutine: return False self.lockroutine = container.subroutine...
python
def beginlock(self, container): "Start to acquire lock in another routine. Call trylock or lock later to acquire the lock. Call unlock to cancel the lock routine" if self.locked: return True if self.lockroutine: return False self.lockroutine = container.subroutine...
[ "def", "beginlock", "(", "self", ",", "container", ")", ":", "if", "self", ".", "locked", ":", "return", "True", "if", "self", ".", "lockroutine", ":", "return", "False", "self", ".", "lockroutine", "=", "container", ".", "subroutine", "(", "self", ".", ...
Start to acquire lock in another routine. Call trylock or lock later to acquire the lock. Call unlock to cancel the lock routine
[ "Start", "to", "acquire", "lock", "in", "another", "routine", ".", "Call", "trylock", "or", "lock", "later", "to", "acquire", "the", "lock", ".", "Call", "unlock", "to", "cancel", "the", "lock", "routine" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/event/lock.py#L80-L87
train
hubo1016/vlcp
vlcp/event/lock.py
Lock.unlock
def unlock(self): "Unlock the key" if self.lockroutine: self.lockroutine.close() self.lockroutine = None if self.locked: self.locked = False self.scheduler.ignore(LockEvent.createMatcher(self.context, self.key, self))
python
def unlock(self): "Unlock the key" if self.lockroutine: self.lockroutine.close() self.lockroutine = None if self.locked: self.locked = False self.scheduler.ignore(LockEvent.createMatcher(self.context, self.key, self))
[ "def", "unlock", "(", "self", ")", ":", "if", "self", ".", "lockroutine", ":", "self", ".", "lockroutine", ".", "close", "(", ")", "self", ".", "lockroutine", "=", "None", "if", "self", ".", "locked", ":", "self", ".", "locked", "=", "False", "self",...
Unlock the key
[ "Unlock", "the", "key" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/event/lock.py#L88-L95
train
hubo1016/vlcp
vlcp/event/lock.py
Semaphore.create
def create(self): """ Create the subqueue to change the default behavior of Lock to semaphore. """ self.queue = self.scheduler.queue.addSubQueue(self.priority, LockEvent.createMatcher(self.context, self.key), maxdefault = self.size, defaultQueueCl...
python
def create(self): """ Create the subqueue to change the default behavior of Lock to semaphore. """ self.queue = self.scheduler.queue.addSubQueue(self.priority, LockEvent.createMatcher(self.context, self.key), maxdefault = self.size, defaultQueueCl...
[ "def", "create", "(", "self", ")", ":", "self", ".", "queue", "=", "self", ".", "scheduler", ".", "queue", ".", "addSubQueue", "(", "self", ".", "priority", ",", "LockEvent", ".", "createMatcher", "(", "self", ".", "context", ",", "self", ".", "key", ...
Create the subqueue to change the default behavior of Lock to semaphore.
[ "Create", "the", "subqueue", "to", "change", "the", "default", "behavior", "of", "Lock", "to", "semaphore", "." ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/event/lock.py#L141-L146
train
hubo1016/vlcp
vlcp/event/lock.py
Semaphore.destroy
async def destroy(self, container = None): """ Destroy the created subqueue to change the behavior back to Lock """ if container is None: container = RoutineContainer(self.scheduler) if self.queue is not None: await container.syscall_noreturn(syscall_remov...
python
async def destroy(self, container = None): """ Destroy the created subqueue to change the behavior back to Lock """ if container is None: container = RoutineContainer(self.scheduler) if self.queue is not None: await container.syscall_noreturn(syscall_remov...
[ "async", "def", "destroy", "(", "self", ",", "container", "=", "None", ")", ":", "if", "container", "is", "None", ":", "container", "=", "RoutineContainer", "(", "self", ".", "scheduler", ")", "if", "self", ".", "queue", "is", "not", "None", ":", "awai...
Destroy the created subqueue to change the behavior back to Lock
[ "Destroy", "the", "created", "subqueue", "to", "change", "the", "behavior", "back", "to", "Lock" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/event/lock.py#L147-L155
train
hubo1016/vlcp
vlcp/event/connection.py
Connection.shutdown
async def shutdown(self, force = False, connmark = -1): ''' Can call without delegate ''' if connmark is None: connmark = self.connmark self.scheduler.emergesend(ConnectionControlEvent(self, ConnectionControlEvent.SHUTDOWN, force, connmark))
python
async def shutdown(self, force = False, connmark = -1): ''' Can call without delegate ''' if connmark is None: connmark = self.connmark self.scheduler.emergesend(ConnectionControlEvent(self, ConnectionControlEvent.SHUTDOWN, force, connmark))
[ "async", "def", "shutdown", "(", "self", ",", "force", "=", "False", ",", "connmark", "=", "-", "1", ")", ":", "if", "connmark", "is", "None", ":", "connmark", "=", "self", ".", "connmark", "self", ".", "scheduler", ".", "emergesend", "(", "ConnectionC...
Can call without delegate
[ "Can", "call", "without", "delegate" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/event/connection.py#L367-L373
train
hubo1016/vlcp
vlcp/event/connection.py
Connection.reconnect
async def reconnect(self, force = True, connmark = None): ''' Can call without delegate ''' if connmark is None: connmark = self.connmark self.scheduler.emergesend(ConnectionControlEvent(self, ConnectionControlEvent.RECONNECT, force, connmark))
python
async def reconnect(self, force = True, connmark = None): ''' Can call without delegate ''' if connmark is None: connmark = self.connmark self.scheduler.emergesend(ConnectionControlEvent(self, ConnectionControlEvent.RECONNECT, force, connmark))
[ "async", "def", "reconnect", "(", "self", ",", "force", "=", "True", ",", "connmark", "=", "None", ")", ":", "if", "connmark", "is", "None", ":", "connmark", "=", "self", ".", "connmark", "self", ".", "scheduler", ".", "emergesend", "(", "ConnectionContr...
Can call without delegate
[ "Can", "call", "without", "delegate" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/event/connection.py#L374-L380
train
hubo1016/vlcp
vlcp/event/connection.py
Connection.reset
async def reset(self, force = True, connmark = None): ''' Can call without delegate ''' if connmark is None: connmark = self.connmark self.scheduler.emergesend(ConnectionControlEvent(self, ConnectionControlEvent.RESET, force, connmark))
python
async def reset(self, force = True, connmark = None): ''' Can call without delegate ''' if connmark is None: connmark = self.connmark self.scheduler.emergesend(ConnectionControlEvent(self, ConnectionControlEvent.RESET, force, connmark))
[ "async", "def", "reset", "(", "self", ",", "force", "=", "True", ",", "connmark", "=", "None", ")", ":", "if", "connmark", "is", "None", ":", "connmark", "=", "self", ".", "connmark", "self", ".", "scheduler", ".", "emergesend", "(", "ConnectionControlEv...
Can call without delegate
[ "Can", "call", "without", "delegate" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/event/connection.py#L381-L387
train
hubo1016/vlcp
vlcp/event/connection.py
Connection.write
async def write(self, event, ignoreException = True): ''' Can call without delegate ''' connmark = self.connmark if self.connected: def _until(): if not self.connected or self.connmark != connmark: return True r = await ...
python
async def write(self, event, ignoreException = True): ''' Can call without delegate ''' connmark = self.connmark if self.connected: def _until(): if not self.connected or self.connmark != connmark: return True r = await ...
[ "async", "def", "write", "(", "self", ",", "event", ",", "ignoreException", "=", "True", ")", ":", "connmark", "=", "self", ".", "connmark", "if", "self", ".", "connected", ":", "def", "_until", "(", ")", ":", "if", "not", "self", ".", "connected", "...
Can call without delegate
[ "Can", "call", "without", "delegate" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/event/connection.py#L388-L405
train
hubo1016/vlcp
vlcp/event/connection.py
TcpServer.shutdown
async def shutdown(self, connmark = -1): ''' Can call without delegate ''' if connmark is None: connmark = self.connmark self.scheduler.emergesend(ConnectionControlEvent(self, ConnectionControlEvent.SHUTDOWN, True, connmark))
python
async def shutdown(self, connmark = -1): ''' Can call without delegate ''' if connmark is None: connmark = self.connmark self.scheduler.emergesend(ConnectionControlEvent(self, ConnectionControlEvent.SHUTDOWN, True, connmark))
[ "async", "def", "shutdown", "(", "self", ",", "connmark", "=", "-", "1", ")", ":", "if", "connmark", "is", "None", ":", "connmark", "=", "self", ".", "connmark", "self", ".", "scheduler", ".", "emergesend", "(", "ConnectionControlEvent", "(", "self", ","...
Can call without delegate
[ "Can", "call", "without", "delegate" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/event/connection.py#L1056-L1062
train
hubo1016/vlcp
vlcp/event/connection.py
TcpServer.stoplisten
async def stoplisten(self, connmark = -1): ''' Can call without delegate ''' if connmark is None: connmark = self.connmark self.scheduler.emergesend(ConnectionControlEvent(self, ConnectionControlEvent.STOPLISTEN, True, connmark))
python
async def stoplisten(self, connmark = -1): ''' Can call without delegate ''' if connmark is None: connmark = self.connmark self.scheduler.emergesend(ConnectionControlEvent(self, ConnectionControlEvent.STOPLISTEN, True, connmark))
[ "async", "def", "stoplisten", "(", "self", ",", "connmark", "=", "-", "1", ")", ":", "if", "connmark", "is", "None", ":", "connmark", "=", "self", ".", "connmark", "self", ".", "scheduler", ".", "emergesend", "(", "ConnectionControlEvent", "(", "self", "...
Can call without delegate
[ "Can", "call", "without", "delegate" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/event/connection.py#L1064-L1070
train
hubo1016/vlcp
vlcp/event/connection.py
TcpServer.startlisten
async def startlisten(self, connmark = -1): ''' Can call without delegate ''' if connmark is None: connmark = self.connmark self.scheduler.emergesend(ConnectionControlEvent(self, ConnectionControlEvent.STARTLISTEN, True, connmark))
python
async def startlisten(self, connmark = -1): ''' Can call without delegate ''' if connmark is None: connmark = self.connmark self.scheduler.emergesend(ConnectionControlEvent(self, ConnectionControlEvent.STARTLISTEN, True, connmark))
[ "async", "def", "startlisten", "(", "self", ",", "connmark", "=", "-", "1", ")", ":", "if", "connmark", "is", "None", ":", "connmark", "=", "self", ".", "connmark", "self", ".", "scheduler", ".", "emergesend", "(", "ConnectionControlEvent", "(", "self", ...
Can call without delegate
[ "Can", "call", "without", "delegate" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/event/connection.py#L1072-L1078
train
hubo1016/vlcp
vlcp/start.py
default_start
def default_start(): """ Use `sys.argv` for starting parameters. This is the entry-point of `vlcp-start` """ (config, daemon, pidfile, startup, fork) = parsearg() if config is None: if os.path.isfile('/etc/vlcp.conf'): config = '/etc/vlcp.conf' else: print('/e...
python
def default_start(): """ Use `sys.argv` for starting parameters. This is the entry-point of `vlcp-start` """ (config, daemon, pidfile, startup, fork) = parsearg() if config is None: if os.path.isfile('/etc/vlcp.conf'): config = '/etc/vlcp.conf' else: print('/e...
[ "def", "default_start", "(", ")", ":", "(", "config", ",", "daemon", ",", "pidfile", ",", "startup", ",", "fork", ")", "=", "parsearg", "(", ")", "if", "config", "is", "None", ":", "if", "os", ".", "path", ".", "isfile", "(", "'/etc/vlcp.conf'", ")",...
Use `sys.argv` for starting parameters. This is the entry-point of `vlcp-start`
[ "Use", "sys", ".", "argv", "for", "starting", "parameters", ".", "This", "is", "the", "entry", "-", "point", "of", "vlcp", "-", "start" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/start.py#L61-L73
train
hubo1016/vlcp
vlcp/utils/webclient.py
Response.close
def close(self): "Stop the output stream, but further download will still perform" if self.stream: self.stream.close(self.scheduler) self.stream = None
python
def close(self): "Stop the output stream, but further download will still perform" if self.stream: self.stream.close(self.scheduler) self.stream = None
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "stream", ":", "self", ".", "stream", ".", "close", "(", "self", ".", "scheduler", ")", "self", ".", "stream", "=", "None" ]
Stop the output stream, but further download will still perform
[ "Stop", "the", "output", "stream", "but", "further", "download", "will", "still", "perform" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/utils/webclient.py#L314-L318
train
hubo1016/vlcp
vlcp/utils/webclient.py
Response.shutdown
async def shutdown(self): "Force stop the output stream, if there are more data to download, shutdown the connection" if self.stream: if not self.stream.dataeof and not self.stream.dataerror: self.stream.close(self.scheduler) await self.connection.shutdown() ...
python
async def shutdown(self): "Force stop the output stream, if there are more data to download, shutdown the connection" if self.stream: if not self.stream.dataeof and not self.stream.dataerror: self.stream.close(self.scheduler) await self.connection.shutdown() ...
[ "async", "def", "shutdown", "(", "self", ")", ":", "if", "self", ".", "stream", ":", "if", "not", "self", ".", "stream", ".", "dataeof", "and", "not", "self", ".", "stream", ".", "dataerror", ":", "self", ".", "stream", ".", "close", "(", "self", "...
Force stop the output stream, if there are more data to download, shutdown the connection
[ "Force", "stop", "the", "output", "stream", "if", "there", "are", "more", "data", "to", "download", "shutdown", "the", "connection" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/utils/webclient.py#L319-L327
train
hubo1016/vlcp
vlcp/utils/networkplugin.py
createphysicalnetwork
def createphysicalnetwork(type, create_processor = partial(default_processor, excluding=('id', 'type')), reorder_dict = default_iterate_dict): """ :param type: physical network type :param create_processor: create_processor(physicalnetwork, walk, write, \*, paramet...
python
def createphysicalnetwork(type, create_processor = partial(default_processor, excluding=('id', 'type')), reorder_dict = default_iterate_dict): """ :param type: physical network type :param create_processor: create_processor(physicalnetwork, walk, write, \*, paramet...
[ "def", "createphysicalnetwork", "(", "type", ",", "create_processor", "=", "partial", "(", "default_processor", ",", "excluding", "=", "(", "'id'", ",", "'type'", ")", ")", ",", "reorder_dict", "=", "default_iterate_dict", ")", ":", "# create an new physical network...
:param type: physical network type :param create_processor: create_processor(physicalnetwork, walk, write, \*, parameters)
[ ":", "param", "type", ":", "physical", "network", "type", ":", "param", "create_processor", ":", "create_processor", "(", "physicalnetwork", "walk", "write", "\\", "*", "parameters", ")" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/utils/networkplugin.py#L43-L76
train
hubo1016/vlcp
vlcp/utils/networkplugin.py
deletephysicalnetwork
def deletephysicalnetwork(check_processor = default_physicalnetwork_delete_check, reorder_dict = default_iterate_dict): """ :param check_processor: check_processor(physicalnetwork, physicalnetworkmap, walk, write, \*, parameters) """ def walker(walk, write, timestamp, par...
python
def deletephysicalnetwork(check_processor = default_physicalnetwork_delete_check, reorder_dict = default_iterate_dict): """ :param check_processor: check_processor(physicalnetwork, physicalnetworkmap, walk, write, \*, parameters) """ def walker(walk, write, timestamp, par...
[ "def", "deletephysicalnetwork", "(", "check_processor", "=", "default_physicalnetwork_delete_check", ",", "reorder_dict", "=", "default_iterate_dict", ")", ":", "def", "walker", "(", "walk", ",", "write", ",", "timestamp", ",", "parameters_dict", ")", ":", "for", "k...
:param check_processor: check_processor(physicalnetwork, physicalnetworkmap, walk, write, \*, parameters)
[ ":", "param", "check_processor", ":", "check_processor", "(", "physicalnetwork", "physicalnetworkmap", "walk", "write", "\\", "*", "parameters", ")" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/utils/networkplugin.py#L104-L132
train
hubo1016/vlcp
vlcp/utils/networkplugin.py
createphysicalport
def createphysicalport(create_processor = partial(default_processor, excluding=('vhost', 'systemid', 'bridge', 'name', 'physicalnetwork')), ...
python
def createphysicalport(create_processor = partial(default_processor, excluding=('vhost', 'systemid', 'bridge', 'name', 'physicalnetwork')), ...
[ "def", "createphysicalport", "(", "create_processor", "=", "partial", "(", "default_processor", ",", "excluding", "=", "(", "'vhost'", ",", "'systemid'", ",", "'bridge'", ",", "'name'", ",", "'physicalnetwork'", ")", ")", ",", "reorder_dict", "=", "default_iterate...
:param create_processor: create_processor(physicalport, physicalnetwork, physicalnetworkmap, walk, write, \*, parameters)
[ ":", "param", "create_processor", ":", "create_processor", "(", "physicalport", "physicalnetwork", "physicalnetworkmap", "walk", "write", "\\", "*", "parameters", ")" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/utils/networkplugin.py#L141-L180
train
hubo1016/vlcp
vlcp/utils/networkplugin.py
updatephysicalport
def updatephysicalport(update_processor = partial(default_processor, excluding=('vhost', 'systemid', 'bridge', 'name'), disabled=('physicalnetwork',)), ...
python
def updatephysicalport(update_processor = partial(default_processor, excluding=('vhost', 'systemid', 'bridge', 'name'), disabled=('physicalnetwork',)), ...
[ "def", "updatephysicalport", "(", "update_processor", "=", "partial", "(", "default_processor", ",", "excluding", "=", "(", "'vhost'", ",", "'systemid'", ",", "'bridge'", ",", "'name'", ")", ",", "disabled", "=", "(", "'physicalnetwork'", ",", ")", ")", ",", ...
:param update_processor: update_processor(physcialport, walk, write, \*, parameters)
[ ":", "param", "update_processor", ":", "update_processor", "(", "physcialport", "walk", "write", "\\", "*", "parameters", ")" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/utils/networkplugin.py#L183-L200
train
hubo1016/vlcp
vlcp/utils/networkplugin.py
deletephysicalport
def deletephysicalport(check_processor=_false_processor, reorder_dict = default_iterate_dict): """ :param check_processor: check_processor(physicalport, physicalnetwork, physicalnetworkmap, walk, write \*, parameters) """ def walker(walk, write, timesta...
python
def deletephysicalport(check_processor=_false_processor, reorder_dict = default_iterate_dict): """ :param check_processor: check_processor(physicalport, physicalnetwork, physicalnetworkmap, walk, write \*, parameters) """ def walker(walk, write, timesta...
[ "def", "deletephysicalport", "(", "check_processor", "=", "_false_processor", ",", "reorder_dict", "=", "default_iterate_dict", ")", ":", "def", "walker", "(", "walk", ",", "write", ",", "timestamp", ",", "parameters_dict", ")", ":", "for", "key", ",", "paramete...
:param check_processor: check_processor(physicalport, physicalnetwork, physicalnetworkmap, walk, write \*, parameters)
[ ":", "param", "check_processor", ":", "check_processor", "(", "physicalport", "physicalnetwork", "physicalnetworkmap", "walk", "write", "\\", "*", "parameters", ")" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/utils/networkplugin.py#L203-L237
train
hubo1016/vlcp
vlcp/utils/networkplugin.py
createlogicalnetwork
def createlogicalnetwork(create_processor = partial(default_processor, excluding=('id', 'physicalnetwork')), reorder_dict = default_iterate_dict): """ :param create_processor: create_processor(logicalnetwork, logicalnetworkmap, physicalnetwork, physicalnetwo...
python
def createlogicalnetwork(create_processor = partial(default_processor, excluding=('id', 'physicalnetwork')), reorder_dict = default_iterate_dict): """ :param create_processor: create_processor(logicalnetwork, logicalnetworkmap, physicalnetwork, physicalnetwo...
[ "def", "createlogicalnetwork", "(", "create_processor", "=", "partial", "(", "default_processor", ",", "excluding", "=", "(", "'id'", ",", "'physicalnetwork'", ")", ")", ",", "reorder_dict", "=", "default_iterate_dict", ")", ":", "def", "walker", "(", "walk", ",...
:param create_processor: create_processor(logicalnetwork, logicalnetworkmap, physicalnetwork, physicalnetworkmap, walk, write, \*, parameters)
[ ":", "param", "create_processor", ":", "create_processor", "(", "logicalnetwork", "logicalnetworkmap", "physicalnetwork", "physicalnetworkmap", "walk", "write", "\\", "*", "parameters", ")" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/utils/networkplugin.py#L247-L287
train
hubo1016/vlcp
vlcp/utils/networkplugin.py
deletelogicalnetwork
def deletelogicalnetwork(check_processor=default_logicalnetwork_delete_check, reorder_dict = default_iterate_dict): """ :param check_processor: check_processor(logicalnetwork, logicalnetworkmap, physicalnetwork, physicalnetworkmap, ...
python
def deletelogicalnetwork(check_processor=default_logicalnetwork_delete_check, reorder_dict = default_iterate_dict): """ :param check_processor: check_processor(logicalnetwork, logicalnetworkmap, physicalnetwork, physicalnetworkmap, ...
[ "def", "deletelogicalnetwork", "(", "check_processor", "=", "default_logicalnetwork_delete_check", ",", "reorder_dict", "=", "default_iterate_dict", ")", ":", "def", "walker", "(", "walk", ",", "write", ",", "timestamp", ",", "parameters_dict", ")", ":", "for", "key...
:param check_processor: check_processor(logicalnetwork, logicalnetworkmap, physicalnetwork, physicalnetworkmap, walk, write, \*, parameters)
[ ":", "param", "check_processor", ":", "check_processor", "(", "logicalnetwork", "logicalnetworkmap", "physicalnetwork", "physicalnetworkmap", "walk", "write", "\\", "*", "parameters", ")" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/utils/networkplugin.py#L315-L356
train
hubo1016/vlcp
vlcp/utils/flowupdater.py
FlowUpdater.restart_walk
async def restart_walk(self): """ Force a re-walk """ if not self._restartwalk: self._restartwalk = True await self.wait_for_send(FlowUpdaterNotification(self, FlowUpdaterNotification.STARTWALK))
python
async def restart_walk(self): """ Force a re-walk """ if not self._restartwalk: self._restartwalk = True await self.wait_for_send(FlowUpdaterNotification(self, FlowUpdaterNotification.STARTWALK))
[ "async", "def", "restart_walk", "(", "self", ")", ":", "if", "not", "self", ".", "_restartwalk", ":", "self", ".", "_restartwalk", "=", "True", "await", "self", ".", "wait_for_send", "(", "FlowUpdaterNotification", "(", "self", ",", "FlowUpdaterNotification", ...
Force a re-walk
[ "Force", "a", "re", "-", "walk" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/utils/flowupdater.py#L106-L112
train
hubo1016/vlcp
vlcp/utils/flowupdater.py
FlowUpdater._dataobject_update_detect
async def _dataobject_update_detect(self, _initialkeys, _savedresult): """ Coroutine that wait for retrieved value update notification """ def expr(newvalues, updatedvalues): if any(v.getkey() in _initialkeys for v in updatedvalues if v is not None): return Tr...
python
async def _dataobject_update_detect(self, _initialkeys, _savedresult): """ Coroutine that wait for retrieved value update notification """ def expr(newvalues, updatedvalues): if any(v.getkey() in _initialkeys for v in updatedvalues if v is not None): return Tr...
[ "async", "def", "_dataobject_update_detect", "(", "self", ",", "_initialkeys", ",", "_savedresult", ")", ":", "def", "expr", "(", "newvalues", ",", "updatedvalues", ")", ":", "if", "any", "(", "v", ".", "getkey", "(", ")", "in", "_initialkeys", "for", "v",...
Coroutine that wait for retrieved value update notification
[ "Coroutine", "that", "wait", "for", "retrieved", "value", "update", "notification" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/utils/flowupdater.py#L114-L127
train
hubo1016/vlcp
vlcp/utils/flowupdater.py
FlowUpdater.updateobjects
def updateobjects(self, updatedvalues): """ Force a update notification on specified objects, even if they are not actually updated in ObjectDB """ if not self._updatedset: self.scheduler.emergesend(FlowUpdaterNotification(self, FlowUpdaterNotification.DATAUPDATED)) ...
python
def updateobjects(self, updatedvalues): """ Force a update notification on specified objects, even if they are not actually updated in ObjectDB """ if not self._updatedset: self.scheduler.emergesend(FlowUpdaterNotification(self, FlowUpdaterNotification.DATAUPDATED)) ...
[ "def", "updateobjects", "(", "self", ",", "updatedvalues", ")", ":", "if", "not", "self", ".", "_updatedset", ":", "self", ".", "scheduler", ".", "emergesend", "(", "FlowUpdaterNotification", "(", "self", ",", "FlowUpdaterNotification", ".", "DATAUPDATED", ")", ...
Force a update notification on specified objects, even if they are not actually updated in ObjectDB
[ "Force", "a", "update", "notification", "on", "specified", "objects", "even", "if", "they", "are", "not", "actually", "updated", "in", "ObjectDB" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/utils/flowupdater.py#L129-L136
train
hubo1016/vlcp
vlcp/utils/flowupdater.py
FlowUpdater._flowupdater
async def _flowupdater(self): """ Coroutine calling `updateflow()` """ lastresult = set(v for v in self._savedresult if v is not None and not v.isdeleted()) flowupdate = FlowUpdaterNotification.createMatcher(self, FlowUpdaterNotification.FLOWUPDATE) while True: ...
python
async def _flowupdater(self): """ Coroutine calling `updateflow()` """ lastresult = set(v for v in self._savedresult if v is not None and not v.isdeleted()) flowupdate = FlowUpdaterNotification.createMatcher(self, FlowUpdaterNotification.FLOWUPDATE) while True: ...
[ "async", "def", "_flowupdater", "(", "self", ")", ":", "lastresult", "=", "set", "(", "v", "for", "v", "in", "self", ".", "_savedresult", "if", "v", "is", "not", "None", "and", "not", "v", ".", "isdeleted", "(", ")", ")", "flowupdate", "=", "FlowUpda...
Coroutine calling `updateflow()`
[ "Coroutine", "calling", "updateflow", "()" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/utils/flowupdater.py#L138-L165
train
hubo1016/vlcp
vlcp/utils/flowupdater.py
FlowUpdater.main
async def main(self): """ Main coroutine """ try: lastkeys = set() dataupdate = FlowUpdaterNotification.createMatcher(self, FlowUpdaterNotification.DATAUPDATED) startwalk = FlowUpdaterNotification.createMatcher(self, FlowUpdaterNotification.STARTWALK) ...
python
async def main(self): """ Main coroutine """ try: lastkeys = set() dataupdate = FlowUpdaterNotification.createMatcher(self, FlowUpdaterNotification.DATAUPDATED) startwalk = FlowUpdaterNotification.createMatcher(self, FlowUpdaterNotification.STARTWALK) ...
[ "async", "def", "main", "(", "self", ")", ":", "try", ":", "lastkeys", "=", "set", "(", ")", "dataupdate", "=", "FlowUpdaterNotification", ".", "createMatcher", "(", "self", ",", "FlowUpdaterNotification", ".", "DATAUPDATED", ")", "startwalk", "=", "FlowUpdate...
Main coroutine
[ "Main", "coroutine" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/utils/flowupdater.py#L167-L248
train
hubo1016/vlcp
vlcp/event/core.py
syscall_direct
def syscall_direct(*events): ''' Directly process these events. This should never be used for normal events. ''' def _syscall(scheduler, processor): for e in events: processor(e) return _syscall
python
def syscall_direct(*events): ''' Directly process these events. This should never be used for normal events. ''' def _syscall(scheduler, processor): for e in events: processor(e) return _syscall
[ "def", "syscall_direct", "(", "*", "events", ")", ":", "def", "_syscall", "(", "scheduler", ",", "processor", ")", ":", "for", "e", "in", "events", ":", "processor", "(", "e", ")", "return", "_syscall" ]
Directly process these events. This should never be used for normal events.
[ "Directly", "process", "these", "events", ".", "This", "should", "never", "be", "used", "for", "normal", "events", "." ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/event/core.py#L520-L527
train
hubo1016/vlcp
vlcp/event/core.py
syscall_generator
def syscall_generator(generator): ''' Directly process events from a generator function. This should never be used for normal events. ''' def _syscall(scheduler, processor): for e in generator(): processor(e) return _syscall
python
def syscall_generator(generator): ''' Directly process events from a generator function. This should never be used for normal events. ''' def _syscall(scheduler, processor): for e in generator(): processor(e) return _syscall
[ "def", "syscall_generator", "(", "generator", ")", ":", "def", "_syscall", "(", "scheduler", ",", "processor", ")", ":", "for", "e", "in", "generator", "(", ")", ":", "processor", "(", "e", ")", "return", "_syscall" ]
Directly process events from a generator function. This should never be used for normal events.
[ "Directly", "process", "events", "from", "a", "generator", "function", ".", "This", "should", "never", "be", "used", "for", "normal", "events", "." ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/event/core.py#L529-L536
train
hubo1016/vlcp
vlcp/event/core.py
syscall_clearqueue
def syscall_clearqueue(queue): ''' Clear a queue ''' def _syscall(scheduler, processor): qes, qees = queue.clear() events = scheduler.queue.unblockqueue(queue) for e in events: scheduler.eventtree.remove(e) for e in qes: processor(e) for e ...
python
def syscall_clearqueue(queue): ''' Clear a queue ''' def _syscall(scheduler, processor): qes, qees = queue.clear() events = scheduler.queue.unblockqueue(queue) for e in events: scheduler.eventtree.remove(e) for e in qes: processor(e) for e ...
[ "def", "syscall_clearqueue", "(", "queue", ")", ":", "def", "_syscall", "(", "scheduler", ",", "processor", ")", ":", "qes", ",", "qees", "=", "queue", ".", "clear", "(", ")", "events", "=", "scheduler", ".", "queue", ".", "unblockqueue", "(", "queue", ...
Clear a queue
[ "Clear", "a", "queue" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/event/core.py#L538-L551
train
hubo1016/vlcp
vlcp/event/core.py
syscall_removequeue
def syscall_removequeue(queue, index): ''' Remove subqueue `queue[index]` from queue. ''' def _syscall(scheduler, processor): events = scheduler.queue.unblockqueue(queue[index]) for e in events: scheduler.eventtree.remove(e) qes, qees = queue.removeSubQueue(index) ...
python
def syscall_removequeue(queue, index): ''' Remove subqueue `queue[index]` from queue. ''' def _syscall(scheduler, processor): events = scheduler.queue.unblockqueue(queue[index]) for e in events: scheduler.eventtree.remove(e) qes, qees = queue.removeSubQueue(index) ...
[ "def", "syscall_removequeue", "(", "queue", ",", "index", ")", ":", "def", "_syscall", "(", "scheduler", ",", "processor", ")", ":", "events", "=", "scheduler", ".", "queue", ".", "unblockqueue", "(", "queue", "[", "index", "]", ")", "for", "e", "in", ...
Remove subqueue `queue[index]` from queue.
[ "Remove", "subqueue", "queue", "[", "index", "]", "from", "queue", "." ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/event/core.py#L553-L566
train
hubo1016/vlcp
vlcp/event/core.py
syscall_clearremovequeue
def syscall_clearremovequeue(queue, index): ''' Clear the subqueue `queue[index]` and remove it from queue. ''' def _syscall(scheduler, processor): qes, qees = queue[index].clear() events = scheduler.queue.unblockqueue(queue[index]) for e in events: scheduler.eventtre...
python
def syscall_clearremovequeue(queue, index): ''' Clear the subqueue `queue[index]` and remove it from queue. ''' def _syscall(scheduler, processor): qes, qees = queue[index].clear() events = scheduler.queue.unblockqueue(queue[index]) for e in events: scheduler.eventtre...
[ "def", "syscall_clearremovequeue", "(", "queue", ",", "index", ")", ":", "def", "_syscall", "(", "scheduler", ",", "processor", ")", ":", "qes", ",", "qees", "=", "queue", "[", "index", "]", ".", "clear", "(", ")", "events", "=", "scheduler", ".", "que...
Clear the subqueue `queue[index]` and remove it from queue.
[ "Clear", "the", "subqueue", "queue", "[", "index", "]", "and", "remove", "it", "from", "queue", "." ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/event/core.py#L568-L586
train
hubo1016/vlcp
vlcp/event/core.py
Scheduler.register
def register(self, matchers, runnable): ''' Register an iterator(runnable) to scheduler and wait for events :param matchers: sequence of EventMatchers :param runnable: an iterator that accept send method :param daemon: if True, the runnable will be regi...
python
def register(self, matchers, runnable): ''' Register an iterator(runnable) to scheduler and wait for events :param matchers: sequence of EventMatchers :param runnable: an iterator that accept send method :param daemon: if True, the runnable will be regi...
[ "def", "register", "(", "self", ",", "matchers", ",", "runnable", ")", ":", "if", "getattr", "(", "self", ",", "'syscallfunc'", ",", "None", ")", "is", "not", "None", "and", "getattr", "(", "self", ",", "'syscallrunnable'", ",", "None", ")", "is", "Non...
Register an iterator(runnable) to scheduler and wait for events :param matchers: sequence of EventMatchers :param runnable: an iterator that accept send method :param daemon: if True, the runnable will be registered as a daemon.
[ "Register", "an", "iterator", "(", "runnable", ")", "to", "scheduler", "and", "wait", "for", "events", ":", "param", "matchers", ":", "sequence", "of", "EventMatchers", ":", "param", "runnable", ":", "an", "iterator", "that", "accept", "send", "method", ":",...
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/event/core.py#L128-L149
train
hubo1016/vlcp
vlcp/event/core.py
Scheduler.unregister
def unregister(self, matchers, runnable): ''' Unregister an iterator(runnable) and stop waiting for events :param matchers: sequence of EventMatchers :param runnable: an iterator that accept send method ''' for m in matchers: self.matchtree.r...
python
def unregister(self, matchers, runnable): ''' Unregister an iterator(runnable) and stop waiting for events :param matchers: sequence of EventMatchers :param runnable: an iterator that accept send method ''' for m in matchers: self.matchtree.r...
[ "def", "unregister", "(", "self", ",", "matchers", ",", "runnable", ")", ":", "for", "m", "in", "matchers", ":", "self", ".", "matchtree", ".", "remove", "(", "m", ",", "runnable", ")", "if", "m", ".", "indices", "[", "0", "]", "==", "PollEvent", "...
Unregister an iterator(runnable) and stop waiting for events :param matchers: sequence of EventMatchers :param runnable: an iterator that accept send method
[ "Unregister", "an", "iterator", "(", "runnable", ")", "and", "stop", "waiting", "for", "events", ":", "param", "matchers", ":", "sequence", "of", "EventMatchers", ":", "param", "runnable", ":", "an", "iterator", "that", "accept", "send", "method" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/event/core.py#L150-L162
train
hubo1016/vlcp
vlcp/event/core.py
Scheduler.unregisterall
def unregisterall(self, runnable): ''' Unregister all matches and detach the runnable. Automatically called when runnable returns StopIteration. ''' if runnable in self.registerIndex: for m in self.registerIndex[runnable]: self.matchtree.remove(m, runnable) ...
python
def unregisterall(self, runnable): ''' Unregister all matches and detach the runnable. Automatically called when runnable returns StopIteration. ''' if runnable in self.registerIndex: for m in self.registerIndex[runnable]: self.matchtree.remove(m, runnable) ...
[ "def", "unregisterall", "(", "self", ",", "runnable", ")", ":", "if", "runnable", "in", "self", ".", "registerIndex", ":", "for", "m", "in", "self", ".", "registerIndex", "[", "runnable", "]", ":", "self", ".", "matchtree", ".", "remove", "(", "m", ","...
Unregister all matches and detach the runnable. Automatically called when runnable returns StopIteration.
[ "Unregister", "all", "matches", "and", "detach", "the", "runnable", ".", "Automatically", "called", "when", "runnable", "returns", "StopIteration", "." ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/event/core.py#L163-L173
train
hubo1016/vlcp
vlcp/event/core.py
Scheduler.ignore
def ignore(self, matcher): ''' Unblock and ignore the matched events, if any. ''' events = self.eventtree.findAndRemove(matcher) for e in events: self.queue.unblock(e) e.canignore = True
python
def ignore(self, matcher): ''' Unblock and ignore the matched events, if any. ''' events = self.eventtree.findAndRemove(matcher) for e in events: self.queue.unblock(e) e.canignore = True
[ "def", "ignore", "(", "self", ",", "matcher", ")", ":", "events", "=", "self", ".", "eventtree", ".", "findAndRemove", "(", "matcher", ")", "for", "e", "in", "events", ":", "self", ".", "queue", ".", "unblock", "(", "e", ")", "e", ".", "canignore", ...
Unblock and ignore the matched events, if any.
[ "Unblock", "and", "ignore", "the", "matched", "events", "if", "any", "." ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/event/core.py#L174-L181
train
hubo1016/vlcp
vlcp/event/core.py
Scheduler.quit
def quit(self, daemononly = False): ''' Send quit event to quit the main loop ''' if not self.quitting: self.quitting = True self.queue.append(SystemControlEvent(SystemControlEvent.QUIT, daemononly = daemononly), True)
python
def quit(self, daemononly = False): ''' Send quit event to quit the main loop ''' if not self.quitting: self.quitting = True self.queue.append(SystemControlEvent(SystemControlEvent.QUIT, daemononly = daemononly), True)
[ "def", "quit", "(", "self", ",", "daemononly", "=", "False", ")", ":", "if", "not", "self", ".", "quitting", ":", "self", ".", "quitting", "=", "True", "self", ".", "queue", ".", "append", "(", "SystemControlEvent", "(", "SystemControlEvent", ".", "QUIT"...
Send quit event to quit the main loop
[ "Send", "quit", "event", "to", "quit", "the", "main", "loop" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/event/core.py#L182-L188
train
hubo1016/vlcp
vlcp/event/core.py
Scheduler.setTimer
def setTimer(self, start, interval = None): ''' Generate a TimerEvent on specified time :param start: offset for time from now (seconds), or datetime for a fixed time :param interval: if not None, the timer is regenerated by interval seconds. :returns: ...
python
def setTimer(self, start, interval = None): ''' Generate a TimerEvent on specified time :param start: offset for time from now (seconds), or datetime for a fixed time :param interval: if not None, the timer is regenerated by interval seconds. :returns: ...
[ "def", "setTimer", "(", "self", ",", "start", ",", "interval", "=", "None", ")", ":", "if", "isinstance", "(", "start", ",", "datetime", ")", ":", "timestamp", "=", "(", "start", "-", "datetime", ".", "fromtimestamp", "(", "0", ")", ")", ".", "total_...
Generate a TimerEvent on specified time :param start: offset for time from now (seconds), or datetime for a fixed time :param interval: if not None, the timer is regenerated by interval seconds. :returns: a timer handle to wait or cancel the timer
[ "Generate", "a", "TimerEvent", "on", "specified", "time", ":", "param", "start", ":", "offset", "for", "time", "from", "now", "(", "seconds", ")", "or", "datetime", "for", "a", "fixed", "time", ":", "param", "interval", ":", "if", "not", "None", "the", ...
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/event/core.py#L201-L220
train
hubo1016/vlcp
vlcp/event/core.py
Scheduler.registerPolling
def registerPolling(self, fd, options = POLLING_IN|POLLING_OUT, daemon = False): ''' register a polling file descriptor :param fd: file descriptor or socket object :param options: bit mask flags. Polling object should ignore the incompatible flag. ''' se...
python
def registerPolling(self, fd, options = POLLING_IN|POLLING_OUT, daemon = False): ''' register a polling file descriptor :param fd: file descriptor or socket object :param options: bit mask flags. Polling object should ignore the incompatible flag. ''' se...
[ "def", "registerPolling", "(", "self", ",", "fd", ",", "options", "=", "POLLING_IN", "|", "POLLING_OUT", ",", "daemon", "=", "False", ")", ":", "self", ".", "polling", ".", "register", "(", "fd", ",", "options", ",", "daemon", ")" ]
register a polling file descriptor :param fd: file descriptor or socket object :param options: bit mask flags. Polling object should ignore the incompatible flag.
[ "register", "a", "polling", "file", "descriptor", ":", "param", "fd", ":", "file", "descriptor", "or", "socket", "object", ":", "param", "options", ":", "bit", "mask", "flags", ".", "Polling", "object", "should", "ignore", "the", "incompatible", "flag", "." ...
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/event/core.py#L230-L238
train
hubo1016/vlcp
vlcp/event/core.py
Scheduler.unregisterPolling
def unregisterPolling(self, fd, daemon = False): ''' Unregister a polling file descriptor :param fd: file descriptor or socket object ''' self.polling.unregister(fd, daemon)
python
def unregisterPolling(self, fd, daemon = False): ''' Unregister a polling file descriptor :param fd: file descriptor or socket object ''' self.polling.unregister(fd, daemon)
[ "def", "unregisterPolling", "(", "self", ",", "fd", ",", "daemon", "=", "False", ")", ":", "self", ".", "polling", ".", "unregister", "(", "fd", ",", "daemon", ")" ]
Unregister a polling file descriptor :param fd: file descriptor or socket object
[ "Unregister", "a", "polling", "file", "descriptor", ":", "param", "fd", ":", "file", "descriptor", "or", "socket", "object" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/event/core.py#L246-L252
train
hubo1016/vlcp
vlcp/event/core.py
Scheduler.setDaemon
def setDaemon(self, runnable, isdaemon, noregister = False): ''' If a runnable is a daemon, it will not keep the main loop running. The main loop will end when all alived runnables are daemons. ''' if not noregister and runnable not in self.registerIndex: self.register((), ru...
python
def setDaemon(self, runnable, isdaemon, noregister = False): ''' If a runnable is a daemon, it will not keep the main loop running. The main loop will end when all alived runnables are daemons. ''' if not noregister and runnable not in self.registerIndex: self.register((), ru...
[ "def", "setDaemon", "(", "self", ",", "runnable", ",", "isdaemon", ",", "noregister", "=", "False", ")", ":", "if", "not", "noregister", "and", "runnable", "not", "in", "self", ".", "registerIndex", ":", "self", ".", "register", "(", "(", ")", ",", "ru...
If a runnable is a daemon, it will not keep the main loop running. The main loop will end when all alived runnables are daemons.
[ "If", "a", "runnable", "is", "a", "daemon", "it", "will", "not", "keep", "the", "main", "loop", "running", ".", "The", "main", "loop", "will", "end", "when", "all", "alived", "runnables", "are", "daemons", "." ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/event/core.py#L259-L268
train
hubo1016/vlcp
vlcp/event/core.py
Scheduler.syscall
def syscall(self, func): ''' Call the func in core context (main loop). func should like:: def syscall_sample(scheduler, processor): something... where processor is a function which accept an event. When calling processor, scheduler directly...
python
def syscall(self, func): ''' Call the func in core context (main loop). func should like:: def syscall_sample(scheduler, processor): something... where processor is a function which accept an event. When calling processor, scheduler directly...
[ "def", "syscall", "(", "self", ",", "func", ")", ":", "if", "getattr", "(", "self", ",", "'syscallfunc'", ",", "None", ")", "is", "not", "None", ":", "return", "None", "self", ".", "syscallfunc", "=", "func", "self", ".", "syscallmatcher", "=", "Syscal...
Call the func in core context (main loop). func should like:: def syscall_sample(scheduler, processor): something... where processor is a function which accept an event. When calling processor, scheduler directly process this event without sending i...
[ "Call", "the", "func", "in", "core", "context", "(", "main", "loop", ")", ".", "func", "should", "like", "::", "def", "syscall_sample", "(", "scheduler", "processor", ")", ":", "something", "..." ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/event/core.py#L269-L294
train
hubo1016/vlcp
vlcp/event/core.py
Scheduler.main
def main(self, installsignal = True, sendinit = True): ''' Start main loop ''' if installsignal: sigterm = signal(SIGTERM, self._quitsignal) sigint = signal(SIGINT, self._quitsignal) try: from signal import SIGUSR1 sigus...
python
def main(self, installsignal = True, sendinit = True): ''' Start main loop ''' if installsignal: sigterm = signal(SIGTERM, self._quitsignal) sigint = signal(SIGINT, self._quitsignal) try: from signal import SIGUSR1 sigus...
[ "def", "main", "(", "self", ",", "installsignal", "=", "True", ",", "sendinit", "=", "True", ")", ":", "if", "installsignal", ":", "sigterm", "=", "signal", "(", "SIGTERM", ",", "self", ".", "_quitsignal", ")", "sigint", "=", "signal", "(", "SIGINT", "...
Start main loop
[ "Start", "main", "loop" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/event/core.py#L303-L518
train
hubo1016/vlcp
vlcp/service/connection/tcpserver.py
TcpServerBase.getservers
def getservers(self, vhost = None): ''' Return current servers :param vhost: return only servers of vhost if specified. '' to return only default servers. None for all servers. ''' if vhost is not None: return [s for s in self.connection...
python
def getservers(self, vhost = None): ''' Return current servers :param vhost: return only servers of vhost if specified. '' to return only default servers. None for all servers. ''' if vhost is not None: return [s for s in self.connection...
[ "def", "getservers", "(", "self", ",", "vhost", "=", "None", ")", ":", "if", "vhost", "is", "not", "None", ":", "return", "[", "s", "for", "s", "in", "self", ".", "connections", "if", "s", ".", "protocol", ".", "vhost", "==", "vhost", "]", "else", ...
Return current servers :param vhost: return only servers of vhost if specified. '' to return only default servers. None for all servers.
[ "Return", "current", "servers", ":", "param", "vhost", ":", "return", "only", "servers", "of", "vhost", "if", "specified", ".", "to", "return", "only", "default", "servers", ".", "None", "for", "all", "servers", "." ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/service/connection/tcpserver.py#L138-L148
train
hubo1016/vlcp
vlcp/service/connection/tcpserver.py
TcpServerBase.stoplisten
async def stoplisten(self, vhost = None): ''' Stop listen on current servers :param vhost: return only servers of vhost if specified. '' to return only default servers. None for all servers. ''' servers = self.getservers(vhost) for s in serv...
python
async def stoplisten(self, vhost = None): ''' Stop listen on current servers :param vhost: return only servers of vhost if specified. '' to return only default servers. None for all servers. ''' servers = self.getservers(vhost) for s in serv...
[ "async", "def", "stoplisten", "(", "self", ",", "vhost", "=", "None", ")", ":", "servers", "=", "self", ".", "getservers", "(", "vhost", ")", "for", "s", "in", "servers", ":", "await", "s", ".", "stoplisten", "(", ")", "return", "len", "(", "servers"...
Stop listen on current servers :param vhost: return only servers of vhost if specified. '' to return only default servers. None for all servers.
[ "Stop", "listen", "on", "current", "servers", ":", "param", "vhost", ":", "return", "only", "servers", "of", "vhost", "if", "specified", ".", "to", "return", "only", "default", "servers", ".", "None", "for", "all", "servers", "." ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/service/connection/tcpserver.py#L150-L160
train
hubo1016/vlcp
vlcp/service/connection/tcpserver.py
TcpServerBase.startlisten
async def startlisten(self, vhost = None): ''' Start listen on current servers :param vhost: return only servers of vhost if specified. '' to return only default servers. None for all servers. ''' servers = self.getservers(vhost) for s in se...
python
async def startlisten(self, vhost = None): ''' Start listen on current servers :param vhost: return only servers of vhost if specified. '' to return only default servers. None for all servers. ''' servers = self.getservers(vhost) for s in se...
[ "async", "def", "startlisten", "(", "self", ",", "vhost", "=", "None", ")", ":", "servers", "=", "self", ".", "getservers", "(", "vhost", ")", "for", "s", "in", "servers", ":", "await", "s", ".", "startlisten", "(", ")", "return", "len", "(", "server...
Start listen on current servers :param vhost: return only servers of vhost if specified. '' to return only default servers. None for all servers.
[ "Start", "listen", "on", "current", "servers", ":", "param", "vhost", ":", "return", "only", "servers", "of", "vhost", "if", "specified", ".", "to", "return", "only", "default", "servers", ".", "None", "for", "all", "servers", "." ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/service/connection/tcpserver.py#L162-L172
train
hubo1016/vlcp
vlcp/service/connection/tcpserver.py
TcpServerBase.updateconfig
async def updateconfig(self): "Reload configurations, remove non-exist servers, add new servers, and leave others unchanged" exists = {} for s in self.connections: exists[(s.protocol.vhost, s.rawurl)] = s self._createServers(self, '', exists = exists) for _,v in exist...
python
async def updateconfig(self): "Reload configurations, remove non-exist servers, add new servers, and leave others unchanged" exists = {} for s in self.connections: exists[(s.protocol.vhost, s.rawurl)] = s self._createServers(self, '', exists = exists) for _,v in exist...
[ "async", "def", "updateconfig", "(", "self", ")", ":", "exists", "=", "{", "}", "for", "s", "in", "self", ".", "connections", ":", "exists", "[", "(", "s", ".", "protocol", ".", "vhost", ",", "s", ".", "rawurl", ")", "]", "=", "s", "self", ".", ...
Reload configurations, remove non-exist servers, add new servers, and leave others unchanged
[ "Reload", "configurations", "remove", "non", "-", "exist", "servers", "add", "new", "servers", "and", "leave", "others", "unchanged" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/service/connection/tcpserver.py#L174-L182
train
hubo1016/vlcp
vlcp/service/connection/tcpserver.py
TcpServerBase.getconnections
def getconnections(self, vhost = None): "Return accepted connections, optionally filtered by vhost" if vhost is None: return list(self.managed_connections) else: return [c for c in self.managed_connections if c.protocol.vhost == vhost]
python
def getconnections(self, vhost = None): "Return accepted connections, optionally filtered by vhost" if vhost is None: return list(self.managed_connections) else: return [c for c in self.managed_connections if c.protocol.vhost == vhost]
[ "def", "getconnections", "(", "self", ",", "vhost", "=", "None", ")", ":", "if", "vhost", "is", "None", ":", "return", "list", "(", "self", ".", "managed_connections", ")", "else", ":", "return", "[", "c", "for", "c", "in", "self", ".", "managed_connec...
Return accepted connections, optionally filtered by vhost
[ "Return", "accepted", "connections", "optionally", "filtered", "by", "vhost" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/service/connection/tcpserver.py#L184-L189
train
hubo1016/vlcp
vlcp/service/sdn/dhcpserver.py
DHCPUpdater._dhcp_handler
async def _dhcp_handler(self): """ Mini DHCP server, respond DHCP packets from OpenFlow """ conn = self._connection ofdef = self._connection.openflowdef l3 = self._parent._gettableindex('l3input', self._connection.protocol.vhost) dhcp_packet_matcher = OpenflowAsyn...
python
async def _dhcp_handler(self): """ Mini DHCP server, respond DHCP packets from OpenFlow """ conn = self._connection ofdef = self._connection.openflowdef l3 = self._parent._gettableindex('l3input', self._connection.protocol.vhost) dhcp_packet_matcher = OpenflowAsyn...
[ "async", "def", "_dhcp_handler", "(", "self", ")", ":", "conn", "=", "self", ".", "_connection", "ofdef", "=", "self", ".", "_connection", ".", "openflowdef", "l3", "=", "self", ".", "_parent", ".", "_gettableindex", "(", "'l3input'", ",", "self", ".", "...
Mini DHCP server, respond DHCP packets from OpenFlow
[ "Mini", "DHCP", "server", "respond", "DHCP", "packets", "from", "OpenFlow" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/service/sdn/dhcpserver.py#L57-L266
train
hubo1016/vlcp
vlcp/service/utils/knowledge.py
return_self_updater
def return_self_updater(func): ''' Run func, but still return v. Useful for using knowledge.update with operates like append, extend, etc. e.g. return_self(lambda k,v: v.append('newobj')) ''' @functools.wraps(func) def decorator(k,v): func(k,v) return v return decorator
python
def return_self_updater(func): ''' Run func, but still return v. Useful for using knowledge.update with operates like append, extend, etc. e.g. return_self(lambda k,v: v.append('newobj')) ''' @functools.wraps(func) def decorator(k,v): func(k,v) return v return decorator
[ "def", "return_self_updater", "(", "func", ")", ":", "@", "functools", ".", "wraps", "(", "func", ")", "def", "decorator", "(", "k", ",", "v", ")", ":", "func", "(", "k", ",", "v", ")", "return", "v", "return", "decorator" ]
Run func, but still return v. Useful for using knowledge.update with operates like append, extend, etc. e.g. return_self(lambda k,v: v.append('newobj'))
[ "Run", "func", "but", "still", "return", "v", ".", "Useful", "for", "using", "knowledge", ".", "update", "with", "operates", "like", "append", "extend", "etc", ".", "e", ".", "g", ".", "return_self", "(", "lambda", "k", "v", ":", "v", ".", "append", ...
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/service/utils/knowledge.py#L182-L191
train
hubo1016/vlcp
vlcp/protocol/http.py
date_time_string
def date_time_string(timestamp=None): """Return the current date and time formatted for a message header.""" global _last_date_time_string _last_timestamp, _last_str = _last_date_time_string if timestamp is None: timestamp = time.time() _curr_timestamp = int(timestamp) if _curr_timestamp...
python
def date_time_string(timestamp=None): """Return the current date and time formatted for a message header.""" global _last_date_time_string _last_timestamp, _last_str = _last_date_time_string if timestamp is None: timestamp = time.time() _curr_timestamp = int(timestamp) if _curr_timestamp...
[ "def", "date_time_string", "(", "timestamp", "=", "None", ")", ":", "global", "_last_date_time_string", "_last_timestamp", ",", "_last_str", "=", "_last_date_time_string", "if", "timestamp", "is", "None", ":", "timestamp", "=", "time", ".", "time", "(", ")", "_c...
Return the current date and time formatted for a message header.
[ "Return", "the", "current", "date", "and", "time", "formatted", "for", "a", "message", "header", "." ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/protocol/http.py#L165-L181
train
hubo1016/vlcp
vlcp/protocol/http.py
escape_b
def escape_b(s, quote=True): '''Replace special characters "&", "<" and ">" to HTML-safe sequences. If the optional flag quote is true, the quotation mark character (") is also translated.''' s = s.replace(b"&", b"&amp;") # Must be done first! s = s.replace(b"<", b"&lt;") s = s.replace(b">", b"&...
python
def escape_b(s, quote=True): '''Replace special characters "&", "<" and ">" to HTML-safe sequences. If the optional flag quote is true, the quotation mark character (") is also translated.''' s = s.replace(b"&", b"&amp;") # Must be done first! s = s.replace(b"<", b"&lt;") s = s.replace(b">", b"&...
[ "def", "escape_b", "(", "s", ",", "quote", "=", "True", ")", ":", "s", "=", "s", ".", "replace", "(", "b\"&\"", ",", "b\"&amp;\"", ")", "# Must be done first!", "s", "=", "s", ".", "replace", "(", "b\"<\"", ",", "b\"&lt;\"", ")", "s", "=", "s", "."...
Replace special characters "&", "<" and ">" to HTML-safe sequences. If the optional flag quote is true, the quotation mark character (") is also translated.
[ "Replace", "special", "characters", "&", "<", "and", ">", "to", "HTML", "-", "safe", "sequences", ".", "If", "the", "optional", "flag", "quote", "is", "true", "the", "quotation", "mark", "character", "(", ")", "is", "also", "translated", "." ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/protocol/http.py#L184-L193
train
hubo1016/vlcp
vlcp/utils/dataobject.py
watch_context
def watch_context(keys, result, reqid, container, module = 'objectdb'): """ DEPRECATED - use request_context for most use cases """ try: keys = [k for k,r in zip(keys, result) if r is not None] yield result finally: if keys: async def clearup(): tr...
python
def watch_context(keys, result, reqid, container, module = 'objectdb'): """ DEPRECATED - use request_context for most use cases """ try: keys = [k for k,r in zip(keys, result) if r is not None] yield result finally: if keys: async def clearup(): tr...
[ "def", "watch_context", "(", "keys", ",", "result", ",", "reqid", ",", "container", ",", "module", "=", "'objectdb'", ")", ":", "try", ":", "keys", "=", "[", "k", "for", "k", ",", "r", "in", "zip", "(", "keys", ",", "result", ")", "if", "r", "is"...
DEPRECATED - use request_context for most use cases
[ "DEPRECATED", "-", "use", "request_context", "for", "most", "use", "cases" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/utils/dataobject.py#L446-L460
train
hubo1016/vlcp
vlcp/utils/dataobject.py
updater
def updater(f): "Decorate a function with named arguments into updater for transact" @functools.wraps(f) def wrapped_updater(keys, values): result = f(*values) return (keys[:len(result)], result) return wrapped_updater
python
def updater(f): "Decorate a function with named arguments into updater for transact" @functools.wraps(f) def wrapped_updater(keys, values): result = f(*values) return (keys[:len(result)], result) return wrapped_updater
[ "def", "updater", "(", "f", ")", ":", "@", "functools", ".", "wraps", "(", "f", ")", "def", "wrapped_updater", "(", "keys", ",", "values", ")", ":", "result", "=", "f", "(", "*", "values", ")", "return", "(", "keys", "[", ":", "len", "(", "result...
Decorate a function with named arguments into updater for transact
[ "Decorate", "a", "function", "with", "named", "arguments", "into", "updater", "for", "transact" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/utils/dataobject.py#L505-L511
train
hubo1016/vlcp
vlcp/utils/dataobject.py
list_updater
def list_updater(*args): """ Decorate a function with named lists into updater for transact. :params \*args: parameter list sizes. -1 means all other items. None means a single item instead of a list. only one -1 is allowed. """ neg_index = [i for v,i in izip(args, itertools...
python
def list_updater(*args): """ Decorate a function with named lists into updater for transact. :params \*args: parameter list sizes. -1 means all other items. None means a single item instead of a list. only one -1 is allowed. """ neg_index = [i for v,i in izip(args, itertools...
[ "def", "list_updater", "(", "*", "args", ")", ":", "neg_index", "=", "[", "i", "for", "v", ",", "i", "in", "izip", "(", "args", ",", "itertools", ".", "count", "(", ")", ")", "if", "v", "is", "not", "None", "and", "v", "<", "0", "]", "if", "l...
Decorate a function with named lists into updater for transact. :params \*args: parameter list sizes. -1 means all other items. None means a single item instead of a list. only one -1 is allowed.
[ "Decorate", "a", "function", "with", "named", "lists", "into", "updater", "for", "transact", ".", ":", "params", "\\", "*", "args", ":", "parameter", "list", "sizes", ".", "-", "1", "means", "all", "other", "items", ".", "None", "means", "a", "single", ...
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/utils/dataobject.py#L513-L561
train
hubo1016/vlcp
vlcp/utils/dataobject.py
create_new
def create_new(cls, oldvalue, *args): "Raise if the old value already exists" if oldvalue is not None: raise AlreadyExistsException('%r already exists' % (oldvalue,)) return cls.create_instance(*args)
python
def create_new(cls, oldvalue, *args): "Raise if the old value already exists" if oldvalue is not None: raise AlreadyExistsException('%r already exists' % (oldvalue,)) return cls.create_instance(*args)
[ "def", "create_new", "(", "cls", ",", "oldvalue", ",", "*", "args", ")", ":", "if", "oldvalue", "is", "not", "None", ":", "raise", "AlreadyExistsException", "(", "'%r already exists'", "%", "(", "oldvalue", ",", ")", ")", "return", "cls", ".", "create_inst...
Raise if the old value already exists
[ "Raise", "if", "the", "old", "value", "already", "exists" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/utils/dataobject.py#L566-L570
train
hubo1016/vlcp
vlcp/utils/dataobject.py
create_from_key
def create_from_key(cls, oldvalue, key): "Raise if the old value already exists" if oldvalue is not None: raise AlreadyExistsException('%r already exists' % (oldvalue,)) return cls.create_from_key(key)
python
def create_from_key(cls, oldvalue, key): "Raise if the old value already exists" if oldvalue is not None: raise AlreadyExistsException('%r already exists' % (oldvalue,)) return cls.create_from_key(key)
[ "def", "create_from_key", "(", "cls", ",", "oldvalue", ",", "key", ")", ":", "if", "oldvalue", "is", "not", "None", ":", "raise", "AlreadyExistsException", "(", "'%r already exists'", "%", "(", "oldvalue", ",", ")", ")", "return", "cls", ".", "create_from_ke...
Raise if the old value already exists
[ "Raise", "if", "the", "old", "value", "already", "exists" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/utils/dataobject.py#L572-L576
train
hubo1016/vlcp
vlcp/utils/dataobject.py
dump
def dump(obj, attributes = True, _refset = None): "Show full value of a data object" if _refset is None: _refset = set() if obj is None: return None elif isinstance(obj, DataObject): if id(obj) in _refset: attributes = False else: _refset.a...
python
def dump(obj, attributes = True, _refset = None): "Show full value of a data object" if _refset is None: _refset = set() if obj is None: return None elif isinstance(obj, DataObject): if id(obj) in _refset: attributes = False else: _refset.a...
[ "def", "dump", "(", "obj", ",", "attributes", "=", "True", ",", "_refset", "=", "None", ")", ":", "if", "_refset", "is", "None", ":", "_refset", "=", "set", "(", ")", "if", "obj", "is", "None", ":", "return", "None", "elif", "isinstance", "(", "obj...
Show full value of a data object
[ "Show", "full", "value", "of", "a", "data", "object" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/utils/dataobject.py#L583-L617
train
hubo1016/vlcp
vlcp/service/sdn/vxlanvtep.py
VXLANHandler.action_handler
async def action_handler(self): """ Call vtep controller in sequence, merge mutiple calls if possible When a bind relationship is updated, we always send all logical ports to a logicalswitch, to make sure it recovers from some failed updates (so called idempotency). When multipl...
python
async def action_handler(self): """ Call vtep controller in sequence, merge mutiple calls if possible When a bind relationship is updated, we always send all logical ports to a logicalswitch, to make sure it recovers from some failed updates (so called idempotency). When multipl...
[ "async", "def", "action_handler", "(", "self", ")", ":", "bind_event", "=", "VtepControllerCall", ".", "createMatcher", "(", "self", ".", "_conn", ")", "event_queue", "=", "[", "]", "timeout_flag", "=", "[", "False", "]", "async", "def", "handle_action", "("...
Call vtep controller in sequence, merge mutiple calls if possible When a bind relationship is updated, we always send all logical ports to a logicalswitch, to make sure it recovers from some failed updates (so called idempotency). When multiple calls are pending, we only need to send th...
[ "Call", "vtep", "controller", "in", "sequence", "merge", "mutiple", "calls", "if", "possible", "When", "a", "bind", "relationship", "is", "updated", "we", "always", "send", "all", "logical", "ports", "to", "a", "logicalswitch", "to", "make", "sure", "it", "r...
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/service/sdn/vxlanvtep.py#L300-L426
train
hubo1016/vlcp
vlcp/service/sdn/ioprocessing.py
IOFlowUpdater.update_ports
async def update_ports(self, ports, ovsdb_ports): """ Called from main module to update port information """ new_port_names = dict((p['name'], _to32bitport(p['ofport'])) for p in ovsdb_ports) new_port_ids = dict((p['id'], _to32bitport(p['ofport'])) for p in ovsdb_ports if p['id']...
python
async def update_ports(self, ports, ovsdb_ports): """ Called from main module to update port information """ new_port_names = dict((p['name'], _to32bitport(p['ofport'])) for p in ovsdb_ports) new_port_ids = dict((p['id'], _to32bitport(p['ofport'])) for p in ovsdb_ports if p['id']...
[ "async", "def", "update_ports", "(", "self", ",", "ports", ",", "ovsdb_ports", ")", ":", "new_port_names", "=", "dict", "(", "(", "p", "[", "'name'", "]", ",", "_to32bitport", "(", "p", "[", "'ofport'", "]", ")", ")", "for", "p", "in", "ovsdb_ports", ...
Called from main module to update port information
[ "Called", "from", "main", "module", "to", "update", "port", "information" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/service/sdn/ioprocessing.py#L97-L122
train
hubo1016/vlcp
doc/source/ext/listmodules.py
list_proxy
def list_proxy(root_package = 'vlcp'): ''' Walk through all the sub modules, find subclasses of vlcp.server.module._ProxyModule, list their default values ''' proxy_dict = OrderedDict() pkg = __import__(root_package, fromlist=['_']) for imp, module, _ in walk_packages(pkg.__path__, root_pack...
python
def list_proxy(root_package = 'vlcp'): ''' Walk through all the sub modules, find subclasses of vlcp.server.module._ProxyModule, list their default values ''' proxy_dict = OrderedDict() pkg = __import__(root_package, fromlist=['_']) for imp, module, _ in walk_packages(pkg.__path__, root_pack...
[ "def", "list_proxy", "(", "root_package", "=", "'vlcp'", ")", ":", "proxy_dict", "=", "OrderedDict", "(", ")", "pkg", "=", "__import__", "(", "root_package", ",", "fromlist", "=", "[", "'_'", "]", ")", "for", "imp", ",", "module", ",", "_", "in", "walk...
Walk through all the sub modules, find subclasses of vlcp.server.module._ProxyModule, list their default values
[ "Walk", "through", "all", "the", "sub", "modules", "find", "subclasses", "of", "vlcp", ".", "server", ".", "module", ".", "_ProxyModule", "list", "their", "default", "values" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/doc/source/ext/listmodules.py#L32-L50
train
hubo1016/vlcp
doc/source/ext/listmodules.py
list_modules
def list_modules(root_package = 'vlcp'): ''' Walk through all the sub modules, find subclasses of vlcp.server.module.Module, list their apis through apidefs ''' pkg = __import__(root_package, fromlist=['_']) module_dict = OrderedDict() _server = Server() for imp, module, _ in walk_packag...
python
def list_modules(root_package = 'vlcp'): ''' Walk through all the sub modules, find subclasses of vlcp.server.module.Module, list their apis through apidefs ''' pkg = __import__(root_package, fromlist=['_']) module_dict = OrderedDict() _server = Server() for imp, module, _ in walk_packag...
[ "def", "list_modules", "(", "root_package", "=", "'vlcp'", ")", ":", "pkg", "=", "__import__", "(", "root_package", ",", "fromlist", "=", "[", "'_'", "]", ")", "module_dict", "=", "OrderedDict", "(", ")", "_server", "=", "Server", "(", ")", "for", "imp",...
Walk through all the sub modules, find subclasses of vlcp.server.module.Module, list their apis through apidefs
[ "Walk", "through", "all", "the", "sub", "modules", "find", "subclasses", "of", "vlcp", ".", "server", ".", "module", ".", "Module", "list", "their", "apis", "through", "apidefs" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/doc/source/ext/listmodules.py#L53-L84
train
hubo1016/vlcp
vlcp/event/pqueue.py
CBQueue.append
def append(self, event, force = False): ''' Append an event to queue. The events are classified and appended to sub-queues :param event: input event :param force: if True, the event is appended even if the queue is full :returns: None if appended succes...
python
def append(self, event, force = False): ''' Append an event to queue. The events are classified and appended to sub-queues :param event: input event :param force: if True, the event is appended even if the queue is full :returns: None if appended succes...
[ "def", "append", "(", "self", ",", "event", ",", "force", "=", "False", ")", ":", "if", "self", ".", "tree", "is", "None", ":", "if", "self", ".", "parent", "is", "None", ":", "raise", "IndexError", "(", "'The queue is removed'", ")", "else", ":", "r...
Append an event to queue. The events are classified and appended to sub-queues :param event: input event :param force: if True, the event is appended even if the queue is full :returns: None if appended successfully, or a matcher to match a QueueCanWriteEvent otherwise
[ "Append", "an", "event", "to", "queue", ".", "The", "events", "are", "classified", "and", "appended", "to", "sub", "-", "queues", ":", "param", "event", ":", "input", "event", ":", "param", "force", ":", "if", "True", "the", "event", "is", "appended", ...
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/event/pqueue.py#L812-L828
train
hubo1016/vlcp
vlcp/event/pqueue.py
CBQueue.block
def block(self, event, emptyEvents = ()): ''' Return a recently popped event to queue, and block all later events until unblock. Only the sub-queue directly containing the event is blocked, so events in other queues may still be processed. It is illegal to call block and unblock...
python
def block(self, event, emptyEvents = ()): ''' Return a recently popped event to queue, and block all later events until unblock. Only the sub-queue directly containing the event is blocked, so events in other queues may still be processed. It is illegal to call block and unblock...
[ "def", "block", "(", "self", ",", "event", ",", "emptyEvents", "=", "(", ")", ")", ":", "q", "=", "self", ".", "tree", ".", "matchfirst", "(", "event", ")", "q", ".", "block", "(", "event", ")", "self", ".", "blockEvents", "[", "event", "]", "=",...
Return a recently popped event to queue, and block all later events until unblock. Only the sub-queue directly containing the event is blocked, so events in other queues may still be processed. It is illegal to call block and unblock in different queues with a same event. :para...
[ "Return", "a", "recently", "popped", "event", "to", "queue", "and", "block", "all", "later", "events", "until", "unblock", ".", "Only", "the", "sub", "-", "queue", "directly", "containing", "the", "event", "is", "blocked", "so", "events", "in", "other", "q...
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/event/pqueue.py#L839-L854
train
hubo1016/vlcp
vlcp/event/pqueue.py
CBQueue.unblock
def unblock(self, event): ''' Remove a block ''' if event not in self.blockEvents: return self.blockEvents[event].unblock(event) del self.blockEvents[event]
python
def unblock(self, event): ''' Remove a block ''' if event not in self.blockEvents: return self.blockEvents[event].unblock(event) del self.blockEvents[event]
[ "def", "unblock", "(", "self", ",", "event", ")", ":", "if", "event", "not", "in", "self", ".", "blockEvents", ":", "return", "self", ".", "blockEvents", "[", "event", "]", ".", "unblock", "(", "event", ")", "del", "self", ".", "blockEvents", "[", "e...
Remove a block
[ "Remove", "a", "block" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/event/pqueue.py#L855-L862
train
hubo1016/vlcp
vlcp/event/pqueue.py
CBQueue.unblockqueue
def unblockqueue(self, queue): ''' Remove blocked events from the queue and all subqueues. Usually used after queue clear/unblockall to prevent leak. :returns: the cleared events ''' subqueues = set() def allSubqueues(q): subqueues.add(q) ...
python
def unblockqueue(self, queue): ''' Remove blocked events from the queue and all subqueues. Usually used after queue clear/unblockall to prevent leak. :returns: the cleared events ''' subqueues = set() def allSubqueues(q): subqueues.add(q) ...
[ "def", "unblockqueue", "(", "self", ",", "queue", ")", ":", "subqueues", "=", "set", "(", ")", "def", "allSubqueues", "(", "q", ")", ":", "subqueues", ".", "add", "(", "q", ")", "subqueues", ".", "add", "(", "q", ".", "defaultQueue", ")", "for", "v...
Remove blocked events from the queue and all subqueues. Usually used after queue clear/unblockall to prevent leak. :returns: the cleared events
[ "Remove", "blocked", "events", "from", "the", "queue", "and", "all", "subqueues", ".", "Usually", "used", "after", "queue", "clear", "/", "unblockall", "to", "prevent", "leak", ".", ":", "returns", ":", "the", "cleared", "events" ]
239055229ec93a99cc7e15208075724ccf543bd1
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/event/pqueue.py#L863-L880
train