partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
test
imshow
Show an image. Args: img (str or ndarray): The image to be displayed. win_name (str): The window name. wait_time (int): Value of waitKey param.
mmcv/visualization/image.py
def imshow(img, win_name='', wait_time=0): """Show an image. Args: img (str or ndarray): The image to be displayed. win_name (str): The window name. wait_time (int): Value of waitKey param. """ cv2.imshow(win_name, imread(img)) cv2.waitKey(wait_time)
def imshow(img, win_name='', wait_time=0): """Show an image. Args: img (str or ndarray): The image to be displayed. win_name (str): The window name. wait_time (int): Value of waitKey param. """ cv2.imshow(win_name, imread(img)) cv2.waitKey(wait_time)
[ "Show", "an", "image", "." ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/visualization/image.py#L8-L17
[ "def", "imshow", "(", "img", ",", "win_name", "=", "''", ",", "wait_time", "=", "0", ")", ":", "cv2", ".", "imshow", "(", "win_name", ",", "imread", "(", "img", ")", ")", "cv2", ".", "waitKey", "(", "wait_time", ")" ]
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
imshow_bboxes
Draw bboxes on an image. Args: img (str or ndarray): The image to be displayed. bboxes (list or ndarray): A list of ndarray of shape (k, 4). colors (list[str or tuple or Color]): A list of colors. top_k (int): Plot the first k bboxes only if set positive. thickness (int): Th...
mmcv/visualization/image.py
def imshow_bboxes(img, bboxes, colors='green', top_k=-1, thickness=1, show=True, win_name='', wait_time=0, out_file=None): """Draw bboxes on an image. Args: im...
def imshow_bboxes(img, bboxes, colors='green', top_k=-1, thickness=1, show=True, win_name='', wait_time=0, out_file=None): """Draw bboxes on an image. Args: im...
[ "Draw", "bboxes", "on", "an", "image", "." ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/visualization/image.py#L20-L66
[ "def", "imshow_bboxes", "(", "img", ",", "bboxes", ",", "colors", "=", "'green'", ",", "top_k", "=", "-", "1", ",", "thickness", "=", "1", ",", "show", "=", "True", ",", "win_name", "=", "''", ",", "wait_time", "=", "0", ",", "out_file", "=", "None...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
imshow_det_bboxes
Draw bboxes and class labels (with scores) on an image. Args: img (str or ndarray): The image to be displayed. bboxes (ndarray): Bounding boxes (with scores), shaped (n, 4) or (n, 5). labels (ndarray): Labels of bboxes. class_names (list[str]): Names of each classes. ...
mmcv/visualization/image.py
def imshow_det_bboxes(img, bboxes, labels, class_names=None, score_thr=0, bbox_color='green', text_color='green', thickness=1, font_scale=0.5, ...
def imshow_det_bboxes(img, bboxes, labels, class_names=None, score_thr=0, bbox_color='green', text_color='green', thickness=1, font_scale=0.5, ...
[ "Draw", "bboxes", "and", "class", "labels", "(", "with", "scores", ")", "on", "an", "image", "." ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/visualization/image.py#L69-L132
[ "def", "imshow_det_bboxes", "(", "img", ",", "bboxes", ",", "labels", ",", "class_names", "=", "None", ",", "score_thr", "=", "0", ",", "bbox_color", "=", "'green'", ",", "text_color", "=", "'green'", ",", "thickness", "=", "1", ",", "font_scale", "=", "...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
flowread
Read an optical flow map. Args: flow_or_path (ndarray or str): A flow map or filepath. quantize (bool): whether to read quantized pair, if set to True, remaining args will be passed to :func:`dequantize_flow`. concat_axis (int): The axis that dx and dy are concatenated, ...
mmcv/video/optflow.py
def flowread(flow_or_path, quantize=False, concat_axis=0, *args, **kwargs): """Read an optical flow map. Args: flow_or_path (ndarray or str): A flow map or filepath. quantize (bool): whether to read quantized pair, if set to True, remaining args will be passed to :func:`dequantize_f...
def flowread(flow_or_path, quantize=False, concat_axis=0, *args, **kwargs): """Read an optical flow map. Args: flow_or_path (ndarray or str): A flow map or filepath. quantize (bool): whether to read quantized pair, if set to True, remaining args will be passed to :func:`dequantize_f...
[ "Read", "an", "optical", "flow", "map", "." ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/video/optflow.py#L8-L57
[ "def", "flowread", "(", "flow_or_path", ",", "quantize", "=", "False", ",", "concat_axis", "=", "0", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "flow_or_path", ",", "np", ".", "ndarray", ")", ":", "if", "(", "flow_o...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
flowwrite
Write optical flow to file. If the flow is not quantized, it will be saved as a .flo file losslessly, otherwise a jpeg image which is lossy but of much smaller size. (dx and dy will be concatenated horizontally into a single image if quantize is True.) Args: flow (ndarray): (h, w, 2) array of ...
mmcv/video/optflow.py
def flowwrite(flow, filename, quantize=False, concat_axis=0, *args, **kwargs): """Write optical flow to file. If the flow is not quantized, it will be saved as a .flo file losslessly, otherwise a jpeg image which is lossy but of much smaller size. (dx and dy will be concatenated horizontally into a sin...
def flowwrite(flow, filename, quantize=False, concat_axis=0, *args, **kwargs): """Write optical flow to file. If the flow is not quantized, it will be saved as a .flo file losslessly, otherwise a jpeg image which is lossy but of much smaller size. (dx and dy will be concatenated horizontally into a sin...
[ "Write", "optical", "flow", "to", "file", "." ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/video/optflow.py#L60-L87
[ "def", "flowwrite", "(", "flow", ",", "filename", ",", "quantize", "=", "False", ",", "concat_axis", "=", "0", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "quantize", ":", "with", "open", "(", "filename", ",", "'wb'", ")", "as...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
quantize_flow
Quantize flow to [0, 255]. After this step, the size of flow will be much smaller, and can be dumped as jpeg images. Args: flow (ndarray): (h, w, 2) array of optical flow. max_val (float): Maximum value of flow, values beyond [-max_val, max_val] will be truncated. ...
mmcv/video/optflow.py
def quantize_flow(flow, max_val=0.02, norm=True): """Quantize flow to [0, 255]. After this step, the size of flow will be much smaller, and can be dumped as jpeg images. Args: flow (ndarray): (h, w, 2) array of optical flow. max_val (float): Maximum value of flow, values beyond ...
def quantize_flow(flow, max_val=0.02, norm=True): """Quantize flow to [0, 255]. After this step, the size of flow will be much smaller, and can be dumped as jpeg images. Args: flow (ndarray): (h, w, 2) array of optical flow. max_val (float): Maximum value of flow, values beyond ...
[ "Quantize", "flow", "to", "[", "0", "255", "]", "." ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/video/optflow.py#L90-L115
[ "def", "quantize_flow", "(", "flow", ",", "max_val", "=", "0.02", ",", "norm", "=", "True", ")", ":", "h", ",", "w", ",", "_", "=", "flow", ".", "shape", "dx", "=", "flow", "[", "...", ",", "0", "]", "dy", "=", "flow", "[", "...", ",", "1", ...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
dequantize_flow
Recover from quantized flow. Args: dx (ndarray): Quantized dx. dy (ndarray): Quantized dy. max_val (float): Maximum value used when quantizing. denorm (bool): Whether to multiply flow values with width/height. Returns: ndarray: Dequantized flow.
mmcv/video/optflow.py
def dequantize_flow(dx, dy, max_val=0.02, denorm=True): """Recover from quantized flow. Args: dx (ndarray): Quantized dx. dy (ndarray): Quantized dy. max_val (float): Maximum value used when quantizing. denorm (bool): Whether to multiply flow values with width/height. Retur...
def dequantize_flow(dx, dy, max_val=0.02, denorm=True): """Recover from quantized flow. Args: dx (ndarray): Quantized dx. dy (ndarray): Quantized dy. max_val (float): Maximum value used when quantizing. denorm (bool): Whether to multiply flow values with width/height. Retur...
[ "Recover", "from", "quantized", "flow", "." ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/video/optflow.py#L118-L139
[ "def", "dequantize_flow", "(", "dx", ",", "dy", ",", "max_val", "=", "0.02", ",", "denorm", "=", "True", ")", ":", "assert", "dx", ".", "shape", "==", "dy", ".", "shape", "assert", "dx", ".", "ndim", "==", "2", "or", "(", "dx", ".", "ndim", "==",...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
load_state_dict
Load state_dict to a module. This method is modified from :meth:`torch.nn.Module.load_state_dict`. Default value for ``strict`` is set to ``False`` and the message for param mismatch will be shown even if strict is False. Args: module (Module): Module that receives the state_dict. stat...
mmcv/runner/checkpoint.py
def load_state_dict(module, state_dict, strict=False, logger=None): """Load state_dict to a module. This method is modified from :meth:`torch.nn.Module.load_state_dict`. Default value for ``strict`` is set to ``False`` and the message for param mismatch will be shown even if strict is False. Args:...
def load_state_dict(module, state_dict, strict=False, logger=None): """Load state_dict to a module. This method is modified from :meth:`torch.nn.Module.load_state_dict`. Default value for ``strict`` is set to ``False`` and the message for param mismatch will be shown even if strict is False. Args:...
[ "Load", "state_dict", "to", "a", "module", "." ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/runner/checkpoint.py#L31-L81
[ "def", "load_state_dict", "(", "module", ",", "state_dict", ",", "strict", "=", "False", ",", "logger", "=", "None", ")", ":", "unexpected_keys", "=", "[", "]", "own_state", "=", "module", ".", "state_dict", "(", ")", "for", "name", ",", "param", "in", ...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
load_checkpoint
Load checkpoint from a file or URI. Args: model (Module): Module to load checkpoint. filename (str): Either a filepath or URL or modelzoo://xxxxxxx. map_location (str): Same as :func:`torch.load`. strict (bool): Whether to allow different params for the model and checkpo...
mmcv/runner/checkpoint.py
def load_checkpoint(model, filename, map_location=None, strict=False, logger=None): """Load checkpoint from a file or URI. Args: model (Module): Module to load checkpoint. filename (str): Either a filepath or URL or...
def load_checkpoint(model, filename, map_location=None, strict=False, logger=None): """Load checkpoint from a file or URI. Args: model (Module): Module to load checkpoint. filename (str): Either a filepath or URL or...
[ "Load", "checkpoint", "from", "a", "file", "or", "URI", "." ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/runner/checkpoint.py#L84-L139
[ "def", "load_checkpoint", "(", "model", ",", "filename", ",", "map_location", "=", "None", ",", "strict", "=", "False", ",", "logger", "=", "None", ")", ":", "# load checkpoint from modelzoo or file or url", "if", "filename", ".", "startswith", "(", "'modelzoo://'...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
weights_to_cpu
Copy a model state_dict to cpu. Args: state_dict (OrderedDict): Model weights on GPU. Returns: OrderedDict: Model weights on GPU.
mmcv/runner/checkpoint.py
def weights_to_cpu(state_dict): """Copy a model state_dict to cpu. Args: state_dict (OrderedDict): Model weights on GPU. Returns: OrderedDict: Model weights on GPU. """ state_dict_cpu = OrderedDict() for key, val in state_dict.items(): state_dict_cpu[key] = val.cpu() ...
def weights_to_cpu(state_dict): """Copy a model state_dict to cpu. Args: state_dict (OrderedDict): Model weights on GPU. Returns: OrderedDict: Model weights on GPU. """ state_dict_cpu = OrderedDict() for key, val in state_dict.items(): state_dict_cpu[key] = val.cpu() ...
[ "Copy", "a", "model", "state_dict", "to", "cpu", "." ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/runner/checkpoint.py#L142-L154
[ "def", "weights_to_cpu", "(", "state_dict", ")", ":", "state_dict_cpu", "=", "OrderedDict", "(", ")", "for", "key", ",", "val", "in", "state_dict", ".", "items", "(", ")", ":", "state_dict_cpu", "[", "key", "]", "=", "val", ".", "cpu", "(", ")", "retur...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
save_checkpoint
Save checkpoint to file. The checkpoint will have 3 fields: ``meta``, ``state_dict`` and ``optimizer``. By default ``meta`` will contain version and time info. Args: model (Module): Module whose params are to be saved. filename (str): Checkpoint filename. optimizer (:obj:`Optimizer...
mmcv/runner/checkpoint.py
def save_checkpoint(model, filename, optimizer=None, meta=None): """Save checkpoint to file. The checkpoint will have 3 fields: ``meta``, ``state_dict`` and ``optimizer``. By default ``meta`` will contain version and time info. Args: model (Module): Module whose params are to be saved. ...
def save_checkpoint(model, filename, optimizer=None, meta=None): """Save checkpoint to file. The checkpoint will have 3 fields: ``meta``, ``state_dict`` and ``optimizer``. By default ``meta`` will contain version and time info. Args: model (Module): Module whose params are to be saved. ...
[ "Save", "checkpoint", "to", "file", "." ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/runner/checkpoint.py#L157-L187
[ "def", "save_checkpoint", "(", "model", ",", "filename", ",", "optimizer", "=", "None", ",", "meta", "=", "None", ")", ":", "if", "meta", "is", "None", ":", "meta", "=", "{", "}", "elif", "not", "isinstance", "(", "meta", ",", "dict", ")", ":", "ra...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
Runner.init_optimizer
Init the optimizer. Args: optimizer (dict or :obj:`~torch.optim.Optimizer`): Either an optimizer object or a dict used for constructing the optimizer. Returns: :obj:`~torch.optim.Optimizer`: An optimizer object. Examples: >>> optimizer = dic...
mmcv/runner/runner.py
def init_optimizer(self, optimizer): """Init the optimizer. Args: optimizer (dict or :obj:`~torch.optim.Optimizer`): Either an optimizer object or a dict used for constructing the optimizer. Returns: :obj:`~torch.optim.Optimizer`: An optimizer object. ...
def init_optimizer(self, optimizer): """Init the optimizer. Args: optimizer (dict or :obj:`~torch.optim.Optimizer`): Either an optimizer object or a dict used for constructing the optimizer. Returns: :obj:`~torch.optim.Optimizer`: An optimizer object. ...
[ "Init", "the", "optimizer", "." ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/runner/runner.py#L126-L148
[ "def", "init_optimizer", "(", "self", ",", "optimizer", ")", ":", "if", "isinstance", "(", "optimizer", ",", "dict", ")", ":", "optimizer", "=", "obj_from_dict", "(", "optimizer", ",", "torch", ".", "optim", ",", "dict", "(", "params", "=", "self", ".", ...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
Runner.init_logger
Init the logger. Args: log_dir(str, optional): Log file directory. If not specified, no log file will be used. level (int or str): See the built-in python logging module. Returns: :obj:`~logging.Logger`: Python logger.
mmcv/runner/runner.py
def init_logger(self, log_dir=None, level=logging.INFO): """Init the logger. Args: log_dir(str, optional): Log file directory. If not specified, no log file will be used. level (int or str): See the built-in python logging module. Returns: :o...
def init_logger(self, log_dir=None, level=logging.INFO): """Init the logger. Args: log_dir(str, optional): Log file directory. If not specified, no log file will be used. level (int or str): See the built-in python logging module. Returns: :o...
[ "Init", "the", "logger", "." ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/runner/runner.py#L163-L181
[ "def", "init_logger", "(", "self", ",", "log_dir", "=", "None", ",", "level", "=", "logging", ".", "INFO", ")", ":", "logging", ".", "basicConfig", "(", "format", "=", "'%(asctime)s - %(levelname)s - %(message)s'", ",", "level", "=", "level", ")", "logger", ...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
Runner.current_lr
Get current learning rates. Returns: list: Current learning rate of all param groups.
mmcv/runner/runner.py
def current_lr(self): """Get current learning rates. Returns: list: Current learning rate of all param groups. """ if self.optimizer is None: raise RuntimeError( 'lr is not applicable because optimizer does not exist.') return [group['lr']...
def current_lr(self): """Get current learning rates. Returns: list: Current learning rate of all param groups. """ if self.optimizer is None: raise RuntimeError( 'lr is not applicable because optimizer does not exist.') return [group['lr']...
[ "Get", "current", "learning", "rates", "." ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/runner/runner.py#L183-L192
[ "def", "current_lr", "(", "self", ")", ":", "if", "self", ".", "optimizer", "is", "None", ":", "raise", "RuntimeError", "(", "'lr is not applicable because optimizer does not exist.'", ")", "return", "[", "group", "[", "'lr'", "]", "for", "group", "in", "self", ...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
Runner.register_hook
Register a hook into the hook list. Args: hook (:obj:`Hook`): The hook to be registered. priority (int or str or :obj:`Priority`): Hook priority. Lower value means higher priority.
mmcv/runner/runner.py
def register_hook(self, hook, priority='NORMAL'): """Register a hook into the hook list. Args: hook (:obj:`Hook`): The hook to be registered. priority (int or str or :obj:`Priority`): Hook priority. Lower value means higher priority. """ assert is...
def register_hook(self, hook, priority='NORMAL'): """Register a hook into the hook list. Args: hook (:obj:`Hook`): The hook to be registered. priority (int or str or :obj:`Priority`): Hook priority. Lower value means higher priority. """ assert is...
[ "Register", "a", "hook", "into", "the", "hook", "list", "." ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/runner/runner.py#L194-L215
[ "def", "register_hook", "(", "self", ",", "hook", ",", "priority", "=", "'NORMAL'", ")", ":", "assert", "isinstance", "(", "hook", ",", "Hook", ")", "if", "hasattr", "(", "hook", ",", "'priority'", ")", ":", "raise", "ValueError", "(", "'\"priority\" is a ...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
Runner.run
Start running. Args: data_loaders (list[:obj:`DataLoader`]): Dataloaders for training and validation. workflow (list[tuple]): A list of (phase, epochs) to specify the running order and epochs. E.g, [('train', 2), ('val', 1)] means running ...
mmcv/runner/runner.py
def run(self, data_loaders, workflow, max_epochs, **kwargs): """Start running. Args: data_loaders (list[:obj:`DataLoader`]): Dataloaders for training and validation. workflow (list[tuple]): A list of (phase, epochs) to specify the running order an...
def run(self, data_loaders, workflow, max_epochs, **kwargs): """Start running. Args: data_loaders (list[:obj:`DataLoader`]): Dataloaders for training and validation. workflow (list[tuple]): A list of (phase, epochs) to specify the running order an...
[ "Start", "running", "." ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/runner/runner.py#L315-L359
[ "def", "run", "(", "self", ",", "data_loaders", ",", "workflow", ",", "max_epochs", ",", "*", "*", "kwargs", ")", ":", "assert", "isinstance", "(", "data_loaders", ",", "list", ")", "assert", "mmcv", ".", "is_list_of", "(", "workflow", ",", "tuple", ")",...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
Runner.register_training_hooks
Register default hooks for training. Default hooks include: - LrUpdaterHook - OptimizerStepperHook - CheckpointSaverHook - IterTimerHook - LoggerHook(s)
mmcv/runner/runner.py
def register_training_hooks(self, lr_config, optimizer_config=None, checkpoint_config=None, log_config=None): """Register default hooks for training. Default hooks include: ...
def register_training_hooks(self, lr_config, optimizer_config=None, checkpoint_config=None, log_config=None): """Register default hooks for training. Default hooks include: ...
[ "Register", "default", "hooks", "for", "training", "." ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/runner/runner.py#L383-L407
[ "def", "register_training_hooks", "(", "self", ",", "lr_config", ",", "optimizer_config", "=", "None", ",", "checkpoint_config", "=", "None", ",", "log_config", "=", "None", ")", ":", "if", "optimizer_config", "is", "None", ":", "optimizer_config", "=", "{", "...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
convert_video
Convert a video with ffmpeg. This provides a general api to ffmpeg, the executed command is:: `ffmpeg -y <pre_options> -i <in_file> <options> <out_file>` Options(kwargs) are mapped to ffmpeg commands with the following rules: - key=val: "-key val" - key=True: "-key" - key=False: "" ...
mmcv/video/processing.py
def convert_video(in_file, out_file, print_cmd=False, pre_options='', **kwargs): """Convert a video with ffmpeg. This provides a general api to ffmpeg, the executed command is:: `ffmpeg -y <pre_options> -i <in_file> <options> <out_file>` Options(kwargs) are mapped to ffmpeg comm...
def convert_video(in_file, out_file, print_cmd=False, pre_options='', **kwargs): """Convert a video with ffmpeg. This provides a general api to ffmpeg, the executed command is:: `ffmpeg -y <pre_options> -i <in_file> <options> <out_file>` Options(kwargs) are mapped to ffmpeg comm...
[ "Convert", "a", "video", "with", "ffmpeg", "." ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/video/processing.py#L10-L47
[ "def", "convert_video", "(", "in_file", ",", "out_file", ",", "print_cmd", "=", "False", ",", "pre_options", "=", "''", ",", "*", "*", "kwargs", ")", ":", "options", "=", "[", "]", "for", "k", ",", "v", "in", "kwargs", ".", "items", "(", ")", ":", ...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
resize_video
Resize a video. Args: in_file (str): Input video filename. out_file (str): Output video filename. size (tuple): Expected size (w, h), eg, (320, 240) or (320, -1). ratio (tuple or float): Expected resize ratio, (2, 0.5) means (w*2, h*0.5). keep_ar (bool): Whether ...
mmcv/video/processing.py
def resize_video(in_file, out_file, size=None, ratio=None, keep_ar=False, log_level='info', print_cmd=False, **kwargs): """Resize a video. Args: in_file (str): Input video filename. ...
def resize_video(in_file, out_file, size=None, ratio=None, keep_ar=False, log_level='info', print_cmd=False, **kwargs): """Resize a video. Args: in_file (str): Input video filename. ...
[ "Resize", "a", "video", "." ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/video/processing.py#L51-L87
[ "def", "resize_video", "(", "in_file", ",", "out_file", ",", "size", "=", "None", ",", "ratio", "=", "None", ",", "keep_ar", "=", "False", ",", "log_level", "=", "'info'", ",", "print_cmd", "=", "False", ",", "*", "*", "kwargs", ")", ":", "if", "size...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
cut_video
Cut a clip from a video. Args: in_file (str): Input video filename. out_file (str): Output video filename. start (None or float): Start time (in seconds). end (None or float): End time (in seconds). vcodec (None or str): Output video codec, None for unchanged. acodec...
mmcv/video/processing.py
def cut_video(in_file, out_file, start=None, end=None, vcodec=None, acodec=None, log_level='info', print_cmd=False, **kwargs): """Cut a clip from a video. Args: in_file (str): Input video fil...
def cut_video(in_file, out_file, start=None, end=None, vcodec=None, acodec=None, log_level='info', print_cmd=False, **kwargs): """Cut a clip from a video. Args: in_file (str): Input video fil...
[ "Cut", "a", "clip", "from", "a", "video", "." ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/video/processing.py#L91-L123
[ "def", "cut_video", "(", "in_file", ",", "out_file", ",", "start", "=", "None", ",", "end", "=", "None", ",", "vcodec", "=", "None", ",", "acodec", "=", "None", ",", "log_level", "=", "'info'", ",", "print_cmd", "=", "False", ",", "*", "*", "kwargs",...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
concat_video
Concatenate multiple videos into a single one. Args: video_list (list): A list of video filenames out_file (str): Output video filename vcodec (None or str): Output video codec, None for unchanged acodec (None or str): Output audio codec, None for unchanged log_level (str): ...
mmcv/video/processing.py
def concat_video(video_list, out_file, vcodec=None, acodec=None, log_level='info', print_cmd=False, **kwargs): """Concatenate multiple videos into a single one. Args: video_list (list): A list of video...
def concat_video(video_list, out_file, vcodec=None, acodec=None, log_level='info', print_cmd=False, **kwargs): """Concatenate multiple videos into a single one. Args: video_list (list): A list of video...
[ "Concatenate", "multiple", "videos", "into", "a", "single", "one", "." ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/video/processing.py#L127-L159
[ "def", "concat_video", "(", "video_list", ",", "out_file", ",", "vcodec", "=", "None", ",", "acodec", "=", "None", ",", "log_level", "=", "'info'", ",", "print_cmd", "=", "False", ",", "*", "*", "kwargs", ")", ":", "_", ",", "tmp_filename", "=", "tempf...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
list_from_file
Load a text file and parse the content as a list of strings. Args: filename (str): Filename. prefix (str): The prefix to be inserted to the begining of each item. offset (int): The offset of lines. max_num (int): The maximum number of lines to be read, zeros and negative...
mmcv/fileio/parse.py
def list_from_file(filename, prefix='', offset=0, max_num=0): """Load a text file and parse the content as a list of strings. Args: filename (str): Filename. prefix (str): The prefix to be inserted to the begining of each item. offset (int): The offset of lines. max_num (int): T...
def list_from_file(filename, prefix='', offset=0, max_num=0): """Load a text file and parse the content as a list of strings. Args: filename (str): Filename. prefix (str): The prefix to be inserted to the begining of each item. offset (int): The offset of lines. max_num (int): T...
[ "Load", "a", "text", "file", "and", "parse", "the", "content", "as", "a", "list", "of", "strings", "." ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/fileio/parse.py#L1-L24
[ "def", "list_from_file", "(", "filename", ",", "prefix", "=", "''", ",", "offset", "=", "0", ",", "max_num", "=", "0", ")", ":", "cnt", "=", "0", "item_list", "=", "[", "]", "with", "open", "(", "filename", ",", "'r'", ")", "as", "f", ":", "for",...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
dict_from_file
Load a text file and parse the content as a dict. Each line of the text file will be two or more columns splited by whitespaces or tabs. The first column will be parsed as dict keys, and the following columns will be parsed as dict values. Args: filename(str): Filename. key_type(type):...
mmcv/fileio/parse.py
def dict_from_file(filename, key_type=str): """Load a text file and parse the content as a dict. Each line of the text file will be two or more columns splited by whitespaces or tabs. The first column will be parsed as dict keys, and the following columns will be parsed as dict values. Args: ...
def dict_from_file(filename, key_type=str): """Load a text file and parse the content as a dict. Each line of the text file will be two or more columns splited by whitespaces or tabs. The first column will be parsed as dict keys, and the following columns will be parsed as dict values. Args: ...
[ "Load", "a", "text", "file", "and", "parse", "the", "content", "as", "a", "dict", "." ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/fileio/parse.py#L27-L50
[ "def", "dict_from_file", "(", "filename", ",", "key_type", "=", "str", ")", ":", "mapping", "=", "{", "}", "with", "open", "(", "filename", ",", "'r'", ")", "as", "f", ":", "for", "line", "in", "f", ":", "items", "=", "line", ".", "rstrip", "(", ...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
conv3x3
3x3 convolution with padding
mmcv/cnn/vgg.py
def conv3x3(in_planes, out_planes, dilation=1): "3x3 convolution with padding" return nn.Conv2d( in_planes, out_planes, kernel_size=3, padding=dilation, dilation=dilation)
def conv3x3(in_planes, out_planes, dilation=1): "3x3 convolution with padding" return nn.Conv2d( in_planes, out_planes, kernel_size=3, padding=dilation, dilation=dilation)
[ "3x3", "convolution", "with", "padding" ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/cnn/vgg.py#L9-L16
[ "def", "conv3x3", "(", "in_planes", ",", "out_planes", ",", "dilation", "=", "1", ")", ":", "return", "nn", ".", "Conv2d", "(", "in_planes", ",", "out_planes", ",", "kernel_size", "=", "3", ",", "padding", "=", "dilation", ",", "dilation", "=", "dilation...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
obj_from_dict
Initialize an object from dict. The dict must contain the key "type", which indicates the object type, it can be either a string or type, such as "list" or ``list``. Remaining fields are treated as the arguments for constructing the object. Args: info (dict): Object types and arguments. ...
mmcv/runner/utils.py
def obj_from_dict(info, parent=None, default_args=None): """Initialize an object from dict. The dict must contain the key "type", which indicates the object type, it can be either a string or type, such as "list" or ``list``. Remaining fields are treated as the arguments for constructing the object. ...
def obj_from_dict(info, parent=None, default_args=None): """Initialize an object from dict. The dict must contain the key "type", which indicates the object type, it can be either a string or type, such as "list" or ``list``. Remaining fields are treated as the arguments for constructing the object. ...
[ "Initialize", "an", "object", "from", "dict", "." ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/runner/utils.py#L45-L77
[ "def", "obj_from_dict", "(", "info", ",", "parent", "=", "None", ",", "default_args", "=", "None", ")", ":", "assert", "isinstance", "(", "info", ",", "dict", ")", "and", "'type'", "in", "info", "assert", "isinstance", "(", "default_args", ",", "dict", "...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
imread
Read an image. Args: img_or_path (ndarray or str): Either a numpy array or image path. If it is a numpy array (loaded image), then it will be returned as is. flag (str): Flags specifying the color type of a loaded image, candidates are `color`, `grayscale` and `u...
mmcv/image/io.py
def imread(img_or_path, flag='color'): """Read an image. Args: img_or_path (ndarray or str): Either a numpy array or image path. If it is a numpy array (loaded image), then it will be returned as is. flag (str): Flags specifying the color type of a loaded image, ...
def imread(img_or_path, flag='color'): """Read an image. Args: img_or_path (ndarray or str): Either a numpy array or image path. If it is a numpy array (loaded image), then it will be returned as is. flag (str): Flags specifying the color type of a loaded image, ...
[ "Read", "an", "image", "." ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/image/io.py#L23-L44
[ "def", "imread", "(", "img_or_path", ",", "flag", "=", "'color'", ")", ":", "if", "isinstance", "(", "img_or_path", ",", "np", ".", "ndarray", ")", ":", "return", "img_or_path", "elif", "is_str", "(", "img_or_path", ")", ":", "flag", "=", "imread_flags", ...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
imfrombytes
Read an image from bytes. Args: content (bytes): Image bytes got from files or other streams. flag (str): Same as :func:`imread`. Returns: ndarray: Loaded image array.
mmcv/image/io.py
def imfrombytes(content, flag='color'): """Read an image from bytes. Args: content (bytes): Image bytes got from files or other streams. flag (str): Same as :func:`imread`. Returns: ndarray: Loaded image array. """ img_np = np.frombuffer(content, np.uint8) flag = imread...
def imfrombytes(content, flag='color'): """Read an image from bytes. Args: content (bytes): Image bytes got from files or other streams. flag (str): Same as :func:`imread`. Returns: ndarray: Loaded image array. """ img_np = np.frombuffer(content, np.uint8) flag = imread...
[ "Read", "an", "image", "from", "bytes", "." ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/image/io.py#L47-L60
[ "def", "imfrombytes", "(", "content", ",", "flag", "=", "'color'", ")", ":", "img_np", "=", "np", ".", "frombuffer", "(", "content", ",", "np", ".", "uint8", ")", "flag", "=", "imread_flags", "[", "flag", "]", "if", "is_str", "(", "flag", ")", "else"...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
imwrite
Write image to file Args: img (ndarray): Image array to be written. file_path (str): Image file path. params (None or list): Same as opencv's :func:`imwrite` interface. auto_mkdir (bool): If the parent folder of `file_path` does not exist, whether to create it automatica...
mmcv/image/io.py
def imwrite(img, file_path, params=None, auto_mkdir=True): """Write image to file Args: img (ndarray): Image array to be written. file_path (str): Image file path. params (None or list): Same as opencv's :func:`imwrite` interface. auto_mkdir (bool): If the parent folder of `file...
def imwrite(img, file_path, params=None, auto_mkdir=True): """Write image to file Args: img (ndarray): Image array to be written. file_path (str): Image file path. params (None or list): Same as opencv's :func:`imwrite` interface. auto_mkdir (bool): If the parent folder of `file...
[ "Write", "image", "to", "file" ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/image/io.py#L63-L79
[ "def", "imwrite", "(", "img", ",", "file_path", ",", "params", "=", "None", ",", "auto_mkdir", "=", "True", ")", ":", "if", "auto_mkdir", ":", "dir_name", "=", "osp", ".", "abspath", "(", "osp", ".", "dirname", "(", "file_path", ")", ")", "mkdir_or_exi...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
bgr2gray
Convert a BGR image to grayscale image. Args: img (ndarray): The input image. keepdim (bool): If False (by default), then return the grayscale image with 2 dims, otherwise 3 dims. Returns: ndarray: The converted grayscale image.
mmcv/image/transforms/colorspace.py
def bgr2gray(img, keepdim=False): """Convert a BGR image to grayscale image. Args: img (ndarray): The input image. keepdim (bool): If False (by default), then return the grayscale image with 2 dims, otherwise 3 dims. Returns: ndarray: The converted grayscale image. ...
def bgr2gray(img, keepdim=False): """Convert a BGR image to grayscale image. Args: img (ndarray): The input image. keepdim (bool): If False (by default), then return the grayscale image with 2 dims, otherwise 3 dims. Returns: ndarray: The converted grayscale image. ...
[ "Convert", "a", "BGR", "image", "to", "grayscale", "image", "." ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/image/transforms/colorspace.py#L16-L30
[ "def", "bgr2gray", "(", "img", ",", "keepdim", "=", "False", ")", ":", "out_img", "=", "cv2", ".", "cvtColor", "(", "img", ",", "cv2", ".", "COLOR_BGR2GRAY", ")", "if", "keepdim", ":", "out_img", "=", "out_img", "[", "...", ",", "None", "]", "return"...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
gray2bgr
Convert a grayscale image to BGR image. Args: img (ndarray or str): The input image. Returns: ndarray: The converted BGR image.
mmcv/image/transforms/colorspace.py
def gray2bgr(img): """Convert a grayscale image to BGR image. Args: img (ndarray or str): The input image. Returns: ndarray: The converted BGR image. """ img = img[..., None] if img.ndim == 2 else img out_img = cv2.cvtColor(img, cv2.COLOR_GRAY2BGR) return out_img
def gray2bgr(img): """Convert a grayscale image to BGR image. Args: img (ndarray or str): The input image. Returns: ndarray: The converted BGR image. """ img = img[..., None] if img.ndim == 2 else img out_img = cv2.cvtColor(img, cv2.COLOR_GRAY2BGR) return out_img
[ "Convert", "a", "grayscale", "image", "to", "BGR", "image", "." ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/image/transforms/colorspace.py#L33-L44
[ "def", "gray2bgr", "(", "img", ")", ":", "img", "=", "img", "[", "...", ",", "None", "]", "if", "img", ".", "ndim", "==", "2", "else", "img", "out_img", "=", "cv2", ".", "cvtColor", "(", "img", ",", "cv2", ".", "COLOR_GRAY2BGR", ")", "return", "o...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
iter_cast
Cast elements of an iterable object into some type. Args: inputs (Iterable): The input object. dst_type (type): Destination type. return_type (type, optional): If specified, the output object will be converted to this type, otherwise an iterator. Returns: iterator o...
mmcv/utils/misc.py
def iter_cast(inputs, dst_type, return_type=None): """Cast elements of an iterable object into some type. Args: inputs (Iterable): The input object. dst_type (type): Destination type. return_type (type, optional): If specified, the output object will be converted to this typ...
def iter_cast(inputs, dst_type, return_type=None): """Cast elements of an iterable object into some type. Args: inputs (Iterable): The input object. dst_type (type): Destination type. return_type (type, optional): If specified, the output object will be converted to this typ...
[ "Cast", "elements", "of", "an", "iterable", "object", "into", "some", "type", "." ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/utils/misc.py#L21-L43
[ "def", "iter_cast", "(", "inputs", ",", "dst_type", ",", "return_type", "=", "None", ")", ":", "if", "not", "isinstance", "(", "inputs", ",", "collections_abc", ".", "Iterable", ")", ":", "raise", "TypeError", "(", "'inputs must be an iterable object'", ")", "...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
is_seq_of
Check whether it is a sequence of some type. Args: seq (Sequence): The sequence to be checked. expected_type (type): Expected type of sequence items. seq_type (type, optional): Expected sequence type. Returns: bool: Whether the sequence is valid.
mmcv/utils/misc.py
def is_seq_of(seq, expected_type, seq_type=None): """Check whether it is a sequence of some type. Args: seq (Sequence): The sequence to be checked. expected_type (type): Expected type of sequence items. seq_type (type, optional): Expected sequence type. Returns: bool: Wheth...
def is_seq_of(seq, expected_type, seq_type=None): """Check whether it is a sequence of some type. Args: seq (Sequence): The sequence to be checked. expected_type (type): Expected type of sequence items. seq_type (type, optional): Expected sequence type. Returns: bool: Wheth...
[ "Check", "whether", "it", "is", "a", "sequence", "of", "some", "type", "." ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/utils/misc.py#L62-L83
[ "def", "is_seq_of", "(", "seq", ",", "expected_type", ",", "seq_type", "=", "None", ")", ":", "if", "seq_type", "is", "None", ":", "exp_seq_type", "=", "collections_abc", ".", "Sequence", "else", ":", "assert", "isinstance", "(", "seq_type", ",", "type", "...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
slice_list
Slice a list into several sub lists by a list of given length. Args: in_list (list): The list to be sliced. lens(int or list): The expected length of each out list. Returns: list: A list of sliced list.
mmcv/utils/misc.py
def slice_list(in_list, lens): """Slice a list into several sub lists by a list of given length. Args: in_list (list): The list to be sliced. lens(int or list): The expected length of each out list. Returns: list: A list of sliced list. """ if not isinstance(lens, list): ...
def slice_list(in_list, lens): """Slice a list into several sub lists by a list of given length. Args: in_list (list): The list to be sliced. lens(int or list): The expected length of each out list. Returns: list: A list of sliced list. """ if not isinstance(lens, list): ...
[ "Slice", "a", "list", "into", "several", "sub", "lists", "by", "a", "list", "of", "given", "length", "." ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/utils/misc.py#L102-L123
[ "def", "slice_list", "(", "in_list", ",", "lens", ")", ":", "if", "not", "isinstance", "(", "lens", ",", "list", ")", ":", "raise", "TypeError", "(", "'\"indices\" must be a list of integers'", ")", "elif", "sum", "(", "lens", ")", "!=", "len", "(", "in_li...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
check_prerequisites
A decorator factory to check if prerequisites are satisfied. Args: prerequisites (str of list[str]): Prerequisites to be checked. checker (callable): The checker method that returns True if a prerequisite is meet, False otherwise. msg_tmpl (str): The message template with two va...
mmcv/utils/misc.py
def check_prerequisites( prerequisites, checker, msg_tmpl='Prerequisites "{}" are required in method "{}" but not ' 'found, please install them first.'): """A decorator factory to check if prerequisites are satisfied. Args: prerequisites (str of list[str]): Prerequisites...
def check_prerequisites( prerequisites, checker, msg_tmpl='Prerequisites "{}" are required in method "{}" but not ' 'found, please install them first.'): """A decorator factory to check if prerequisites are satisfied. Args: prerequisites (str of list[str]): Prerequisites...
[ "A", "decorator", "factory", "to", "check", "if", "prerequisites", "are", "satisfied", "." ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/utils/misc.py#L138-L173
[ "def", "check_prerequisites", "(", "prerequisites", ",", "checker", ",", "msg_tmpl", "=", "'Prerequisites \"{}\" are required in method \"{}\" but not '", "'found, please install them first.'", ")", ":", "def", "wrap", "(", "func", ")", ":", "@", "functools", ".", "wraps"...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
LogBuffer.average
Average latest n values or all values
mmcv/runner/log_buffer.py
def average(self, n=0): """Average latest n values or all values""" assert n >= 0 for key in self.val_history: values = np.array(self.val_history[key][-n:]) nums = np.array(self.n_history[key][-n:]) avg = np.sum(values * nums) / np.sum(nums) self.o...
def average(self, n=0): """Average latest n values or all values""" assert n >= 0 for key in self.val_history: values = np.array(self.val_history[key][-n:]) nums = np.array(self.n_history[key][-n:]) avg = np.sum(values * nums) / np.sum(nums) self.o...
[ "Average", "latest", "n", "values", "or", "all", "values" ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/runner/log_buffer.py#L32-L40
[ "def", "average", "(", "self", ",", "n", "=", "0", ")", ":", "assert", "n", ">=", "0", "for", "key", "in", "self", ".", "val_history", ":", "values", "=", "np", ".", "array", "(", "self", ".", "val_history", "[", "key", "]", "[", "-", "n", ":",...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
scatter
Scatters tensor across multiple GPUs.
mmcv/parallel/_functions.py
def scatter(input, devices, streams=None): """Scatters tensor across multiple GPUs. """ if streams is None: streams = [None] * len(devices) if isinstance(input, list): chunk_size = (len(input) - 1) // len(devices) + 1 outputs = [ scatter(input[i], [devices[i // chunk...
def scatter(input, devices, streams=None): """Scatters tensor across multiple GPUs. """ if streams is None: streams = [None] * len(devices) if isinstance(input, list): chunk_size = (len(input) - 1) // len(devices) + 1 outputs = [ scatter(input[i], [devices[i // chunk...
[ "Scatters", "tensor", "across", "multiple", "GPUs", "." ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/parallel/_functions.py#L5-L26
[ "def", "scatter", "(", "input", ",", "devices", ",", "streams", "=", "None", ")", ":", "if", "streams", "is", "None", ":", "streams", "=", "[", "None", "]", "*", "len", "(", "devices", ")", "if", "isinstance", "(", "input", ",", "list", ")", ":", ...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
color_val
Convert various input to color tuples. Args: color (:obj:`Color`/str/tuple/int/ndarray): Color inputs Returns: tuple[int]: A tuple of 3 integers indicating BGR channels.
mmcv/visualization/color.py
def color_val(color): """Convert various input to color tuples. Args: color (:obj:`Color`/str/tuple/int/ndarray): Color inputs Returns: tuple[int]: A tuple of 3 integers indicating BGR channels. """ if is_str(color): return Color[color].value elif isinstance(color, Colo...
def color_val(color): """Convert various input to color tuples. Args: color (:obj:`Color`/str/tuple/int/ndarray): Color inputs Returns: tuple[int]: A tuple of 3 integers indicating BGR channels. """ if is_str(color): return Color[color].value elif isinstance(color, Colo...
[ "Convert", "various", "input", "to", "color", "tuples", "." ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/visualization/color.py#L23-L50
[ "def", "color_val", "(", "color", ")", ":", "if", "is_str", "(", "color", ")", ":", "return", "Color", "[", "color", "]", ".", "value", "elif", "isinstance", "(", "color", ",", "Color", ")", ":", "return", "color", ".", "value", "elif", "isinstance", ...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
check_time
Add check points in a single line. This method is suitable for running a task on a list of items. A timer will be registered when the method is called for the first time. :Example: >>> import time >>> import mmcv >>> for i in range(1, 6): >>> # simulate a code block >>> time.s...
mmcv/utils/timer.py
def check_time(timer_id): """Add check points in a single line. This method is suitable for running a task on a list of items. A timer will be registered when the method is called for the first time. :Example: >>> import time >>> import mmcv >>> for i in range(1, 6): >>> # simulat...
def check_time(timer_id): """Add check points in a single line. This method is suitable for running a task on a list of items. A timer will be registered when the method is called for the first time. :Example: >>> import time >>> import mmcv >>> for i in range(1, 6): >>> # simulat...
[ "Add", "check", "points", "in", "a", "single", "line", "." ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/utils/timer.py#L91-L117
[ "def", "check_time", "(", "timer_id", ")", ":", "if", "timer_id", "not", "in", "_g_timers", ":", "_g_timers", "[", "timer_id", "]", "=", "Timer", "(", ")", "return", "0", "else", ":", "return", "_g_timers", "[", "timer_id", "]", ".", "since_last_check", ...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
Timer.start
Start the timer.
mmcv/utils/timer.py
def start(self): """Start the timer.""" if not self._is_running: self._t_start = time() self._is_running = True self._t_last = time()
def start(self): """Start the timer.""" if not self._is_running: self._t_start = time() self._is_running = True self._t_last = time()
[ "Start", "the", "timer", "." ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/utils/timer.py#L56-L61
[ "def", "start", "(", "self", ")", ":", "if", "not", "self", ".", "_is_running", ":", "self", ".", "_t_start", "=", "time", "(", ")", "self", ".", "_is_running", "=", "True", "self", ".", "_t_last", "=", "time", "(", ")" ]
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
Timer.since_start
Total time since the timer is started. Returns (float): Time in seconds.
mmcv/utils/timer.py
def since_start(self): """Total time since the timer is started. Returns (float): Time in seconds. """ if not self._is_running: raise TimerError('timer is not running') self._t_last = time() return self._t_last - self._t_start
def since_start(self): """Total time since the timer is started. Returns (float): Time in seconds. """ if not self._is_running: raise TimerError('timer is not running') self._t_last = time() return self._t_last - self._t_start
[ "Total", "time", "since", "the", "timer", "is", "started", "." ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/utils/timer.py#L63-L71
[ "def", "since_start", "(", "self", ")", ":", "if", "not", "self", ".", "_is_running", ":", "raise", "TimerError", "(", "'timer is not running'", ")", "self", ".", "_t_last", "=", "time", "(", ")", "return", "self", ".", "_t_last", "-", "self", ".", "_t_s...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
Timer.since_last_check
Time since the last checking. Either :func:`since_start` or :func:`since_last_check` is a checking operation. Returns (float): Time in seconds.
mmcv/utils/timer.py
def since_last_check(self): """Time since the last checking. Either :func:`since_start` or :func:`since_last_check` is a checking operation. Returns (float): Time in seconds. """ if not self._is_running: raise TimerError('timer is not running') dur =...
def since_last_check(self): """Time since the last checking. Either :func:`since_start` or :func:`since_last_check` is a checking operation. Returns (float): Time in seconds. """ if not self._is_running: raise TimerError('timer is not running') dur =...
[ "Time", "since", "the", "last", "checking", "." ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/utils/timer.py#L73-L85
[ "def", "since_last_check", "(", "self", ")", ":", "if", "not", "self", ".", "_is_running", ":", "raise", "TimerError", "(", "'timer is not running'", ")", "dur", "=", "time", "(", ")", "-", "self", ".", "_t_last", "self", ".", "_t_last", "=", "time", "("...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
flowshow
Show optical flow. Args: flow (ndarray or str): The optical flow to be displayed. win_name (str): The window name. wait_time (int): Value of waitKey param.
mmcv/visualization/optflow.py
def flowshow(flow, win_name='', wait_time=0): """Show optical flow. Args: flow (ndarray or str): The optical flow to be displayed. win_name (str): The window name. wait_time (int): Value of waitKey param. """ flow = flowread(flow) flow_img = flow2rgb(flow) imshow(rgb2bgr...
def flowshow(flow, win_name='', wait_time=0): """Show optical flow. Args: flow (ndarray or str): The optical flow to be displayed. win_name (str): The window name. wait_time (int): Value of waitKey param. """ flow = flowread(flow) flow_img = flow2rgb(flow) imshow(rgb2bgr...
[ "Show", "optical", "flow", "." ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/visualization/optflow.py#L10-L20
[ "def", "flowshow", "(", "flow", ",", "win_name", "=", "''", ",", "wait_time", "=", "0", ")", ":", "flow", "=", "flowread", "(", "flow", ")", "flow_img", "=", "flow2rgb", "(", "flow", ")", "imshow", "(", "rgb2bgr", "(", "flow_img", ")", ",", "win_name...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
flow2rgb
Convert flow map to RGB image. Args: flow (ndarray): Array of optical flow. color_wheel (ndarray or None): Color wheel used to map flow field to RGB colorspace. Default color wheel will be used if not specified. unknown_thr (str): Values above this threshold will be marked as ...
mmcv/visualization/optflow.py
def flow2rgb(flow, color_wheel=None, unknown_thr=1e6): """Convert flow map to RGB image. Args: flow (ndarray): Array of optical flow. color_wheel (ndarray or None): Color wheel used to map flow field to RGB colorspace. Default color wheel will be used if not specified. unkno...
def flow2rgb(flow, color_wheel=None, unknown_thr=1e6): """Convert flow map to RGB image. Args: flow (ndarray): Array of optical flow. color_wheel (ndarray or None): Color wheel used to map flow field to RGB colorspace. Default color wheel will be used if not specified. unkno...
[ "Convert", "flow", "map", "to", "RGB", "image", "." ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/visualization/optflow.py#L23-L73
[ "def", "flow2rgb", "(", "flow", ",", "color_wheel", "=", "None", ",", "unknown_thr", "=", "1e6", ")", ":", "assert", "flow", ".", "ndim", "==", "3", "and", "flow", ".", "shape", "[", "-", "1", "]", "==", "2", "if", "color_wheel", "is", "None", ":",...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
make_color_wheel
Build a color wheel. Args: bins(list or tuple, optional): Specify the number of bins for each color range, corresponding to six ranges: red -> yellow, yellow -> green, green -> cyan, cyan -> blue, blue -> magenta, magenta -> red. [15, 6, 4, 11, 13, 6] is used for default...
mmcv/visualization/optflow.py
def make_color_wheel(bins=None): """Build a color wheel. Args: bins(list or tuple, optional): Specify the number of bins for each color range, corresponding to six ranges: red -> yellow, yellow -> green, green -> cyan, cyan -> blue, blue -> magenta, magenta -> red. [...
def make_color_wheel(bins=None): """Build a color wheel. Args: bins(list or tuple, optional): Specify the number of bins for each color range, corresponding to six ranges: red -> yellow, yellow -> green, green -> cyan, cyan -> blue, blue -> magenta, magenta -> red. [...
[ "Build", "a", "color", "wheel", "." ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/visualization/optflow.py#L76-L112
[ "def", "make_color_wheel", "(", "bins", "=", "None", ")", ":", "if", "bins", "is", "None", ":", "bins", "=", "[", "15", ",", "6", ",", "4", ",", "11", ",", "13", ",", "6", "]", "assert", "len", "(", "bins", ")", "==", "6", "RY", ",", "YG", ...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
accuracy
Computes the precision@k for the specified values of k
examples/train_cifar10.py
def accuracy(output, target, topk=(1, )): """Computes the precision@k for the specified values of k""" with torch.no_grad(): maxk = max(topk) batch_size = target.size(0) _, pred = output.topk(maxk, 1, True, True) pred = pred.t() correct = pred.eq(target.view(1, -1).expan...
def accuracy(output, target, topk=(1, )): """Computes the precision@k for the specified values of k""" with torch.no_grad(): maxk = max(topk) batch_size = target.size(0) _, pred = output.topk(maxk, 1, True, True) pred = pred.t() correct = pred.eq(target.view(1, -1).expan...
[ "Computes", "the", "precision" ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/examples/train_cifar10.py#L20-L34
[ "def", "accuracy", "(", "output", ",", "target", ",", "topk", "=", "(", "1", ",", ")", ")", ":", "with", "torch", ".", "no_grad", "(", ")", ":", "maxk", "=", "max", "(", "topk", ")", "batch_size", "=", "target", ".", "size", "(", "0", ")", "_",...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
scatter
Scatter inputs to target gpus. The only difference from original :func:`scatter` is to add support for :type:`~mmcv.parallel.DataContainer`.
mmcv/parallel/scatter_gather.py
def scatter(inputs, target_gpus, dim=0): """Scatter inputs to target gpus. The only difference from original :func:`scatter` is to add support for :type:`~mmcv.parallel.DataContainer`. """ def scatter_map(obj): if isinstance(obj, torch.Tensor): return OrigScatter.apply(target_g...
def scatter(inputs, target_gpus, dim=0): """Scatter inputs to target gpus. The only difference from original :func:`scatter` is to add support for :type:`~mmcv.parallel.DataContainer`. """ def scatter_map(obj): if isinstance(obj, torch.Tensor): return OrigScatter.apply(target_g...
[ "Scatter", "inputs", "to", "target", "gpus", "." ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/parallel/scatter_gather.py#L8-L41
[ "def", "scatter", "(", "inputs", ",", "target_gpus", ",", "dim", "=", "0", ")", ":", "def", "scatter_map", "(", "obj", ")", ":", "if", "isinstance", "(", "obj", ",", "torch", ".", "Tensor", ")", ":", "return", "OrigScatter", ".", "apply", "(", "targe...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
scatter_kwargs
Scatter with support for kwargs dictionary
mmcv/parallel/scatter_gather.py
def scatter_kwargs(inputs, kwargs, target_gpus, dim=0): """Scatter with support for kwargs dictionary""" inputs = scatter(inputs, target_gpus, dim) if inputs else [] kwargs = scatter(kwargs, target_gpus, dim) if kwargs else [] if len(inputs) < len(kwargs): inputs.extend([() for _ in range(len(kw...
def scatter_kwargs(inputs, kwargs, target_gpus, dim=0): """Scatter with support for kwargs dictionary""" inputs = scatter(inputs, target_gpus, dim) if inputs else [] kwargs = scatter(kwargs, target_gpus, dim) if kwargs else [] if len(inputs) < len(kwargs): inputs.extend([() for _ in range(len(kw...
[ "Scatter", "with", "support", "for", "kwargs", "dictionary" ]
open-mmlab/mmcv
python
https://github.com/open-mmlab/mmcv/blob/0d77f61450aab4dde8b8585a577cc496acb95d7f/mmcv/parallel/scatter_gather.py#L44-L54
[ "def", "scatter_kwargs", "(", "inputs", ",", "kwargs", ",", "target_gpus", ",", "dim", "=", "0", ")", ":", "inputs", "=", "scatter", "(", "inputs", ",", "target_gpus", ",", "dim", ")", "if", "inputs", "else", "[", "]", "kwargs", "=", "scatter", "(", ...
0d77f61450aab4dde8b8585a577cc496acb95d7f
test
Request.fetch
Fetch all the information by using aiohttp
ruia/request.py
async def fetch(self) -> Response: """Fetch all the information by using aiohttp""" if self.request_config.get('DELAY', 0) > 0: await asyncio.sleep(self.request_config['DELAY']) timeout = self.request_config.get('TIMEOUT', 10) try: async with async_timeout.timeou...
async def fetch(self) -> Response: """Fetch all the information by using aiohttp""" if self.request_config.get('DELAY', 0) > 0: await asyncio.sleep(self.request_config['DELAY']) timeout = self.request_config.get('TIMEOUT', 10) try: async with async_timeout.timeou...
[ "Fetch", "all", "the", "information", "by", "using", "aiohttp" ]
howie6879/ruia
python
https://github.com/howie6879/ruia/blob/2dc5262fc9c3e902a8faa7d5fa2f046f9d9ee1fa/ruia/request.py#L85-L126
[ "async", "def", "fetch", "(", "self", ")", "->", "Response", ":", "if", "self", ".", "request_config", ".", "get", "(", "'DELAY'", ",", "0", ")", ">", "0", ":", "await", "asyncio", ".", "sleep", "(", "self", ".", "request_config", "[", "'DELAY'", "]"...
2dc5262fc9c3e902a8faa7d5fa2f046f9d9ee1fa
test
Middleware.request
Define a Decorate to be called before a request. eg: @middleware.request
ruia/middleware.py
def request(self, *args, **kwargs): """ Define a Decorate to be called before a request. eg: @middleware.request """ middleware = args[0] @wraps(middleware) def register_middleware(*args, **kwargs): self.request_middleware.append(middleware) ...
def request(self, *args, **kwargs): """ Define a Decorate to be called before a request. eg: @middleware.request """ middleware = args[0] @wraps(middleware) def register_middleware(*args, **kwargs): self.request_middleware.append(middleware) ...
[ "Define", "a", "Decorate", "to", "be", "called", "before", "a", "request", ".", "eg", ":" ]
howie6879/ruia
python
https://github.com/howie6879/ruia/blob/2dc5262fc9c3e902a8faa7d5fa2f046f9d9ee1fa/ruia/middleware.py#L19-L31
[ "def", "request", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "middleware", "=", "args", "[", "0", "]", "@", "wraps", "(", "middleware", ")", "def", "register_middleware", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", ...
2dc5262fc9c3e902a8faa7d5fa2f046f9d9ee1fa
test
Middleware.response
Define a Decorate to be called after a response. eg: @middleware.response
ruia/middleware.py
def response(self, *args, **kwargs): """ Define a Decorate to be called after a response. eg: @middleware.response """ middleware = args[0] @wraps(middleware) def register_middleware(*args, **kwargs): self.response_middleware.appendleft(middleware) ...
def response(self, *args, **kwargs): """ Define a Decorate to be called after a response. eg: @middleware.response """ middleware = args[0] @wraps(middleware) def register_middleware(*args, **kwargs): self.response_middleware.appendleft(middleware) ...
[ "Define", "a", "Decorate", "to", "be", "called", "after", "a", "response", ".", "eg", ":" ]
howie6879/ruia
python
https://github.com/howie6879/ruia/blob/2dc5262fc9c3e902a8faa7d5fa2f046f9d9ee1fa/ruia/middleware.py#L33-L45
[ "def", "response", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "middleware", "=", "args", "[", "0", "]", "@", "wraps", "(", "middleware", ")", "def", "register_middleware", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", ...
2dc5262fc9c3e902a8faa7d5fa2f046f9d9ee1fa
test
Response.json
Read and decodes JSON response.
ruia/response.py
async def json(self, *, encoding: str = None, loads: JSONDecoder = DEFAULT_JSON_DECODER, content_type: Optional[str] = 'application/json') -> Any: """Read and decodes JSON response.""" return await self._aws_json( en...
async def json(self, *, encoding: str = None, loads: JSONDecoder = DEFAULT_JSON_DECODER, content_type: Optional[str] = 'application/json') -> Any: """Read and decodes JSON response.""" return await self._aws_json( en...
[ "Read", "and", "decodes", "JSON", "response", "." ]
howie6879/ruia
python
https://github.com/howie6879/ruia/blob/2dc5262fc9c3e902a8faa7d5fa2f046f9d9ee1fa/ruia/response.py#L123-L130
[ "async", "def", "json", "(", "self", ",", "*", ",", "encoding", ":", "str", "=", "None", ",", "loads", ":", "JSONDecoder", "=", "DEFAULT_JSON_DECODER", ",", "content_type", ":", "Optional", "[", "str", "]", "=", "'application/json'", ")", "->", "Any", ":...
2dc5262fc9c3e902a8faa7d5fa2f046f9d9ee1fa
test
Response.text
Read response payload and decode.
ruia/response.py
async def text(self, *, encoding: Optional[str] = None, errors: str = 'strict') -> str: """Read response payload and decode.""" return await self._aws_text(encoding=encoding, errors=errors)
async def text(self, *, encoding: Optional[str] = None, errors: str = 'strict') -> str: """Read response payload and decode.""" return await self._aws_text(encoding=encoding, errors=errors)
[ "Read", "response", "payload", "and", "decode", "." ]
howie6879/ruia
python
https://github.com/howie6879/ruia/blob/2dc5262fc9c3e902a8faa7d5fa2f046f9d9ee1fa/ruia/response.py#L136-L141
[ "async", "def", "text", "(", "self", ",", "*", ",", "encoding", ":", "Optional", "[", "str", "]", "=", "None", ",", "errors", ":", "str", "=", "'strict'", ")", "->", "str", ":", "return", "await", "self", ".", "_aws_text", "(", "encoding", "=", "en...
2dc5262fc9c3e902a8faa7d5fa2f046f9d9ee1fa
test
SpiderHook._run_spider_hook
Run hook before/after spider start crawling :param hook_func: aws function :return:
ruia/spider.py
async def _run_spider_hook(self, hook_func): """ Run hook before/after spider start crawling :param hook_func: aws function :return: """ if callable(hook_func): try: aws_hook_func = hook_func(weakref.proxy(self)) if isawaitable(...
async def _run_spider_hook(self, hook_func): """ Run hook before/after spider start crawling :param hook_func: aws function :return: """ if callable(hook_func): try: aws_hook_func = hook_func(weakref.proxy(self)) if isawaitable(...
[ "Run", "hook", "before", "/", "after", "spider", "start", "crawling", ":", "param", "hook_func", ":", "aws", "function", ":", "return", ":" ]
howie6879/ruia
python
https://github.com/howie6879/ruia/blob/2dc5262fc9c3e902a8faa7d5fa2f046f9d9ee1fa/ruia/spider.py#L37-L49
[ "async", "def", "_run_spider_hook", "(", "self", ",", "hook_func", ")", ":", "if", "callable", "(", "hook_func", ")", ":", "try", ":", "aws_hook_func", "=", "hook_func", "(", "weakref", ".", "proxy", "(", "self", ")", ")", "if", "isawaitable", "(", "aws_...
2dc5262fc9c3e902a8faa7d5fa2f046f9d9ee1fa
test
SpiderHook.process_callback_result
Corresponding processing for the invalid callback result :param item: :return:
ruia/spider.py
async def process_callback_result(self, callback_result): """ Corresponding processing for the invalid callback result :param item: :return: """ callback_result_name = type(callback_result).__name__ process_func_name = self.callback_result_map.get( cal...
async def process_callback_result(self, callback_result): """ Corresponding processing for the invalid callback result :param item: :return: """ callback_result_name = type(callback_result).__name__ process_func_name = self.callback_result_map.get( cal...
[ "Corresponding", "processing", "for", "the", "invalid", "callback", "result", ":", "param", "item", ":", ":", "return", ":" ]
howie6879/ruia
python
https://github.com/howie6879/ruia/blob/2dc5262fc9c3e902a8faa7d5fa2f046f9d9ee1fa/ruia/spider.py#L77-L92
[ "async", "def", "process_callback_result", "(", "self", ",", "callback_result", ")", ":", "callback_result_name", "=", "type", "(", "callback_result", ")", ".", "__name__", "process_func_name", "=", "self", ".", "callback_result_map", ".", "get", "(", "callback_resu...
2dc5262fc9c3e902a8faa7d5fa2f046f9d9ee1fa
test
Spider.async_start
Start an async spider :param middleware: customize middleware or a list of middleware :param loop: :param after_start: hook :param before_stop: hook :return:
ruia/spider.py
async def async_start( cls, middleware: typing.Union[typing.Iterable, Middleware] = None, loop=None, after_start=None, before_stop=None, **kwargs): """ Start an async spider :param middleware: customize middleware or a list ...
async def async_start( cls, middleware: typing.Union[typing.Iterable, Middleware] = None, loop=None, after_start=None, before_stop=None, **kwargs): """ Start an async spider :param middleware: customize middleware or a list ...
[ "Start", "an", "async", "spider", ":", "param", "middleware", ":", "customize", "middleware", "or", "a", "list", "of", "middleware", ":", "param", "loop", ":", ":", "param", "after_start", ":", "hook", ":", "param", "before_stop", ":", "hook", ":", "return...
howie6879/ruia
python
https://github.com/howie6879/ruia/blob/2dc5262fc9c3e902a8faa7d5fa2f046f9d9ee1fa/ruia/spider.py#L265-L283
[ "async", "def", "async_start", "(", "cls", ",", "middleware", ":", "typing", ".", "Union", "[", "typing", ".", "Iterable", ",", "Middleware", "]", "=", "None", ",", "loop", "=", "None", ",", "after_start", "=", "None", ",", "before_stop", "=", "None", ...
2dc5262fc9c3e902a8faa7d5fa2f046f9d9ee1fa
test
Spider.start
Start a spider :param after_start: hook :param before_stop: hook :param middleware: customize middleware or a list of middleware :param loop: event loop :param close_event_loop: bool :return:
ruia/spider.py
def start(cls, middleware: typing.Union[typing.Iterable, Middleware] = None, loop=None, after_start=None, before_stop=None, close_event_loop=True, **kwargs): """ Start a spider :param after_start: hook :p...
def start(cls, middleware: typing.Union[typing.Iterable, Middleware] = None, loop=None, after_start=None, before_stop=None, close_event_loop=True, **kwargs): """ Start a spider :param after_start: hook :p...
[ "Start", "a", "spider", ":", "param", "after_start", ":", "hook", ":", "param", "before_stop", ":", "hook", ":", "param", "middleware", ":", "customize", "middleware", "or", "a", "list", "of", "middleware", ":", "param", "loop", ":", "event", "loop", ":", ...
howie6879/ruia
python
https://github.com/howie6879/ruia/blob/2dc5262fc9c3e902a8faa7d5fa2f046f9d9ee1fa/ruia/spider.py#L286-L313
[ "def", "start", "(", "cls", ",", "middleware", ":", "typing", ".", "Union", "[", "typing", ".", "Iterable", ",", "Middleware", "]", "=", "None", ",", "loop", "=", "None", ",", "after_start", "=", "None", ",", "before_stop", "=", "None", ",", "close_eve...
2dc5262fc9c3e902a8faa7d5fa2f046f9d9ee1fa
test
Spider.handle_callback
Process coroutine callback function
ruia/spider.py
async def handle_callback(self, aws_callback: typing.Coroutine, response): """Process coroutine callback function""" callback_result = None try: callback_result = await aws_callback except NothingMatchedError as e: self.logger.error(f'<Item: {str(e).lower()}>') ...
async def handle_callback(self, aws_callback: typing.Coroutine, response): """Process coroutine callback function""" callback_result = None try: callback_result = await aws_callback except NothingMatchedError as e: self.logger.error(f'<Item: {str(e).lower()}>') ...
[ "Process", "coroutine", "callback", "function" ]
howie6879/ruia
python
https://github.com/howie6879/ruia/blob/2dc5262fc9c3e902a8faa7d5fa2f046f9d9ee1fa/ruia/spider.py#L315-L325
[ "async", "def", "handle_callback", "(", "self", ",", "aws_callback", ":", "typing", ".", "Coroutine", ",", "response", ")", ":", "callback_result", "=", "None", "try", ":", "callback_result", "=", "await", "aws_callback", "except", "NothingMatchedError", "as", "...
2dc5262fc9c3e902a8faa7d5fa2f046f9d9ee1fa
test
Spider.handle_request
Wrap request with middleware. :param request: :return:
ruia/spider.py
async def handle_request(self, request: Request ) -> typing.Tuple[AsyncGeneratorType, Response]: """ Wrap request with middleware. :param request: :return: """ callback_result, response = None, None await self._run_request_middleware(...
async def handle_request(self, request: Request ) -> typing.Tuple[AsyncGeneratorType, Response]: """ Wrap request with middleware. :param request: :return: """ callback_result, response = None, None await self._run_request_middleware(...
[ "Wrap", "request", "with", "middleware", ".", ":", "param", "request", ":", ":", "return", ":" ]
howie6879/ruia
python
https://github.com/howie6879/ruia/blob/2dc5262fc9c3e902a8faa7d5fa2f046f9d9ee1fa/ruia/spider.py#L327-L347
[ "async", "def", "handle_request", "(", "self", ",", "request", ":", "Request", ")", "->", "typing", ".", "Tuple", "[", "AsyncGeneratorType", ",", "Response", "]", ":", "callback_result", ",", "response", "=", "None", ",", "None", "await", "self", ".", "_ru...
2dc5262fc9c3e902a8faa7d5fa2f046f9d9ee1fa
test
Spider.multiple_request
For crawling multiple urls
ruia/spider.py
async def multiple_request(self, urls, is_gather=False, **kwargs): """For crawling multiple urls""" if is_gather: resp_results = await asyncio.gather( *[ self.handle_request(self.request(url=url, **kwargs)) for url in urls ...
async def multiple_request(self, urls, is_gather=False, **kwargs): """For crawling multiple urls""" if is_gather: resp_results = await asyncio.gather( *[ self.handle_request(self.request(url=url, **kwargs)) for url in urls ...
[ "For", "crawling", "multiple", "urls" ]
howie6879/ruia
python
https://github.com/howie6879/ruia/blob/2dc5262fc9c3e902a8faa7d5fa2f046f9d9ee1fa/ruia/spider.py#L349-L368
[ "async", "def", "multiple_request", "(", "self", ",", "urls", ",", "is_gather", "=", "False", ",", "*", "*", "kwargs", ")", ":", "if", "is_gather", ":", "resp_results", "=", "await", "asyncio", ".", "gather", "(", "*", "[", "self", ".", "handle_request",...
2dc5262fc9c3e902a8faa7d5fa2f046f9d9ee1fa
test
Spider.request
Init a Request class for crawling html
ruia/spider.py
def request(self, url: str, method: str = 'GET', *, callback=None, encoding: typing.Optional[str] = None, headers: dict = None, metadata: dict = None, request_config: dict = None, ...
def request(self, url: str, method: str = 'GET', *, callback=None, encoding: typing.Optional[str] = None, headers: dict = None, metadata: dict = None, request_config: dict = None, ...
[ "Init", "a", "Request", "class", "for", "crawling", "html" ]
howie6879/ruia
python
https://github.com/howie6879/ruia/blob/2dc5262fc9c3e902a8faa7d5fa2f046f9d9ee1fa/ruia/spider.py#L378-L408
[ "def", "request", "(", "self", ",", "url", ":", "str", ",", "method", ":", "str", "=", "'GET'", ",", "*", ",", "callback", "=", "None", ",", "encoding", ":", "typing", ".", "Optional", "[", "str", "]", "=", "None", ",", "headers", ":", "dict", "=...
2dc5262fc9c3e902a8faa7d5fa2f046f9d9ee1fa
test
Spider.start_master
Actually start crawling.
ruia/spider.py
async def start_master(self): """Actually start crawling.""" for url in self.start_urls: request_ins = self.request( url=url, callback=self.parse, metadata=self.metadata) self.request_queue.put_nowait(self.handle_request(request_ins)) workers = [ ...
async def start_master(self): """Actually start crawling.""" for url in self.start_urls: request_ins = self.request( url=url, callback=self.parse, metadata=self.metadata) self.request_queue.put_nowait(self.handle_request(request_ins)) workers = [ ...
[ "Actually", "start", "crawling", "." ]
howie6879/ruia
python
https://github.com/howie6879/ruia/blob/2dc5262fc9c3e902a8faa7d5fa2f046f9d9ee1fa/ruia/spider.py#L410-L427
[ "async", "def", "start_master", "(", "self", ")", ":", "for", "url", "in", "self", ".", "start_urls", ":", "request_ins", "=", "self", ".", "request", "(", "url", "=", "url", ",", "callback", "=", "self", ".", "parse", ",", "metadata", "=", "self", "...
2dc5262fc9c3e902a8faa7d5fa2f046f9d9ee1fa
test
Spider.stop
Finish all running tasks, cancel remaining tasks, then stop loop. :param _signal: :return:
ruia/spider.py
async def stop(self, _signal): """ Finish all running tasks, cancel remaining tasks, then stop loop. :param _signal: :return: """ self.logger.info(f'Stopping spider: {self.name}') await self._cancel_tasks() self.loop.stop()
async def stop(self, _signal): """ Finish all running tasks, cancel remaining tasks, then stop loop. :param _signal: :return: """ self.logger.info(f'Stopping spider: {self.name}') await self._cancel_tasks() self.loop.stop()
[ "Finish", "all", "running", "tasks", "cancel", "remaining", "tasks", "then", "stop", "loop", ".", ":", "param", "_signal", ":", ":", "return", ":" ]
howie6879/ruia
python
https://github.com/howie6879/ruia/blob/2dc5262fc9c3e902a8faa7d5fa2f046f9d9ee1fa/ruia/spider.py#L446-L454
[ "async", "def", "stop", "(", "self", ",", "_signal", ")", ":", "self", ".", "logger", ".", "info", "(", "f'Stopping spider: {self.name}'", ")", "await", "self", ".", "_cancel_tasks", "(", ")", "self", ".", "loop", ".", "stop", "(", ")" ]
2dc5262fc9c3e902a8faa7d5fa2f046f9d9ee1fa
test
RegexField._parse_match
If there is a group dict, return the dict; even if there's only one value in the dict, return a dictionary; If there is a group in match, return the group; if there is only one value in the group, return the value; if there has no group, return the whole matched string; i...
ruia/field.py
def _parse_match(self, match): """ If there is a group dict, return the dict; even if there's only one value in the dict, return a dictionary; If there is a group in match, return the group; if there is only one value in the group, return the value; if there has n...
def _parse_match(self, match): """ If there is a group dict, return the dict; even if there's only one value in the dict, return a dictionary; If there is a group in match, return the group; if there is only one value in the group, return the value; if there has n...
[ "If", "there", "is", "a", "group", "dict", "return", "the", "dict", ";", "even", "if", "there", "s", "only", "one", "value", "in", "the", "dict", "return", "a", "dictionary", ";", "If", "there", "is", "a", "group", "in", "match", "return", "the", "gr...
howie6879/ruia
python
https://github.com/howie6879/ruia/blob/2dc5262fc9c3e902a8faa7d5fa2f046f9d9ee1fa/ruia/field.py#L132-L158
[ "def", "_parse_match", "(", "self", ",", "match", ")", ":", "if", "not", "match", ":", "if", "self", ".", "default", ":", "return", "self", ".", "default", "else", ":", "raise", "NothingMatchedError", "(", "f\"Extract `{self._re_select}` error, \"", "f\"please c...
2dc5262fc9c3e902a8faa7d5fa2f046f9d9ee1fa
test
MotorBase.get_db
Get a db instance :param db: database name :return: the motor db instance
examples/hacker_news_spider/db.py
def get_db(self, db='test'): """ Get a db instance :param db: database name :return: the motor db instance """ if db not in self._db: self._db[db] = self.client(db)[db] return self._db[db]
def get_db(self, db='test'): """ Get a db instance :param db: database name :return: the motor db instance """ if db not in self._db: self._db[db] = self.client(db)[db] return self._db[db]
[ "Get", "a", "db", "instance", ":", "param", "db", ":", "database", "name", ":", "return", ":", "the", "motor", "db", "instance" ]
howie6879/ruia
python
https://github.com/howie6879/ruia/blob/2dc5262fc9c3e902a8faa7d5fa2f046f9d9ee1fa/examples/hacker_news_spider/db.py#L27-L36
[ "def", "get_db", "(", "self", ",", "db", "=", "'test'", ")", ":", "if", "db", "not", "in", "self", ".", "_db", ":", "self", ".", "_db", "[", "db", "]", "=", "self", ".", "client", "(", "db", ")", "[", "db", "]", "return", "self", ".", "_db", ...
2dc5262fc9c3e902a8faa7d5fa2f046f9d9ee1fa
test
normalize_task_v2
Ensures tasks have an action key and strings are converted to python objects
lib/ansiblelint/utils.py
def normalize_task_v2(task): '''Ensures tasks have an action key and strings are converted to python objects''' result = dict() mod_arg_parser = ModuleArgsParser(task) try: action, arguments, result['delegate_to'] = mod_arg_parser.parse() except AnsibleParserError as e: try: ...
def normalize_task_v2(task): '''Ensures tasks have an action key and strings are converted to python objects''' result = dict() mod_arg_parser = ModuleArgsParser(task) try: action, arguments, result['delegate_to'] = mod_arg_parser.parse() except AnsibleParserError as e: try: ...
[ "Ensures", "tasks", "have", "an", "action", "key", "and", "strings", "are", "converted", "to", "python", "objects" ]
ansible/ansible-lint
python
https://github.com/ansible/ansible-lint/blob/b4a8743794e592698c32e760bc774a85f8eebeb5/lib/ansiblelint/utils.py#L368-L416
[ "def", "normalize_task_v2", "(", "task", ")", ":", "result", "=", "dict", "(", ")", "mod_arg_parser", "=", "ModuleArgsParser", "(", "task", ")", "try", ":", "action", ",", "arguments", ",", "result", "[", "'delegate_to'", "]", "=", "mod_arg_parser", ".", "...
b4a8743794e592698c32e760bc774a85f8eebeb5
test
parse_yaml_linenumbers
Parses yaml as ansible.utils.parse_yaml but with linenumbers. The line numbers are stored in each node's LINE_NUMBER_KEY key.
lib/ansiblelint/utils.py
def parse_yaml_linenumbers(data, filename): """Parses yaml as ansible.utils.parse_yaml but with linenumbers. The line numbers are stored in each node's LINE_NUMBER_KEY key. """ def compose_node(parent, index): # the line number where the previous token has ended (plus empty lines) line...
def parse_yaml_linenumbers(data, filename): """Parses yaml as ansible.utils.parse_yaml but with linenumbers. The line numbers are stored in each node's LINE_NUMBER_KEY key. """ def compose_node(parent, index): # the line number where the previous token has ended (plus empty lines) line...
[ "Parses", "yaml", "as", "ansible", ".", "utils", ".", "parse_yaml", "but", "with", "linenumbers", "." ]
ansible/ansible-lint
python
https://github.com/ansible/ansible-lint/blob/b4a8743794e592698c32e760bc774a85f8eebeb5/lib/ansiblelint/utils.py#L546-L585
[ "def", "parse_yaml_linenumbers", "(", "data", ",", "filename", ")", ":", "def", "compose_node", "(", "parent", ",", "index", ")", ":", "# the line number where the previous token has ended (plus empty lines)", "line", "=", "loader", ".", "line", "node", "=", "Composer...
b4a8743794e592698c32e760bc774a85f8eebeb5
test
append_skipped_rules
Uses ruamel.yaml to parse comments then adds a skipped_rules list to the task (or meta yaml block)
lib/ansiblelint/utils.py
def append_skipped_rules(pyyaml_data, file_text, file_type): """ Uses ruamel.yaml to parse comments then adds a skipped_rules list to the task (or meta yaml block) """ yaml = ruamel.yaml.YAML() ruamel_data = yaml.load(file_text) if file_type in ('tasks', 'handlers'): ruamel_tasks = ...
def append_skipped_rules(pyyaml_data, file_text, file_type): """ Uses ruamel.yaml to parse comments then adds a skipped_rules list to the task (or meta yaml block) """ yaml = ruamel.yaml.YAML() ruamel_data = yaml.load(file_text) if file_type in ('tasks', 'handlers'): ruamel_tasks = ...
[ "Uses", "ruamel", ".", "yaml", "to", "parse", "comments", "then", "adds", "a", "skipped_rules", "list", "to", "the", "task", "(", "or", "meta", "yaml", "block", ")" ]
ansible/ansible-lint
python
https://github.com/ansible/ansible-lint/blob/b4a8743794e592698c32e760bc774a85f8eebeb5/lib/ansiblelint/utils.py#L599-L634
[ "def", "append_skipped_rules", "(", "pyyaml_data", ",", "file_text", ",", "file_type", ")", ":", "yaml", "=", "ruamel", ".", "yaml", ".", "YAML", "(", ")", "ruamel_data", "=", "yaml", ".", "load", "(", "file_text", ")", "if", "file_type", "in", "(", "'ta...
b4a8743794e592698c32e760bc774a85f8eebeb5
test
MemoryStorage.__should_write_changes
Helper method that compares two StoreItems and their e_tags and returns True if the new_value should overwrite the old_value. Otherwise returns False. :param old_value: :param new_value: :return:
libraries/botbuilder-core/botbuilder/core/memory_storage.py
def __should_write_changes(self, old_value: StoreItem, new_value: StoreItem) -> bool: """ Helper method that compares two StoreItems and their e_tags and returns True if the new_value should overwrite the old_value. Otherwise returns False. :param old_value: :param new_value: ...
def __should_write_changes(self, old_value: StoreItem, new_value: StoreItem) -> bool: """ Helper method that compares two StoreItems and their e_tags and returns True if the new_value should overwrite the old_value. Otherwise returns False. :param old_value: :param new_value: ...
[ "Helper", "method", "that", "compares", "two", "StoreItems", "and", "their", "e_tags", "and", "returns", "True", "if", "the", "new_value", "should", "overwrite", "the", "old_value", ".", "Otherwise", "returns", "False", ".", ":", "param", "old_value", ":", ":"...
Microsoft/botbuilder-python
python
https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botbuilder-core/botbuilder/core/memory_storage.py#L68-L90
[ "def", "__should_write_changes", "(", "self", ",", "old_value", ":", "StoreItem", ",", "new_value", ":", "StoreItem", ")", "->", "bool", ":", "# If old_value is none or if the new_value's e_tag is '*', then we return True", "if", "old_value", "is", "None", "or", "(", "h...
274663dd91c811bae6ac4488915ba5880771b0a7
test
BotAdapter.run_middleware
Called by the parent class to run the adapters middleware set and calls the passed in `callback()` handler at the end of the chain. :param context: :param callback: :return:
libraries/botbuilder-core/botbuilder/core/bot_adapter.py
async def run_middleware(self, context: TurnContext, callback: Callable=None): """ Called by the parent class to run the adapters middleware set and calls the passed in `callback()` handler at the end of the chain. :param context: :param callback: :return: """ ...
async def run_middleware(self, context: TurnContext, callback: Callable=None): """ Called by the parent class to run the adapters middleware set and calls the passed in `callback()` handler at the end of the chain. :param context: :param callback: :return: """ ...
[ "Called", "by", "the", "parent", "class", "to", "run", "the", "adapters", "middleware", "set", "and", "calls", "the", "passed", "in", "callback", "()", "handler", "at", "the", "end", "of", "the", "chain", ".", ":", "param", "context", ":", ":", "param", ...
Microsoft/botbuilder-python
python
https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botbuilder-core/botbuilder/core/bot_adapter.py#L51-L59
[ "async", "def", "run_middleware", "(", "self", ",", "context", ":", "TurnContext", ",", "callback", ":", "Callable", "=", "None", ")", ":", "return", "await", "self", ".", "_middleware", ".", "receive_activity_with_status", "(", "context", ",", "callback", ")"...
274663dd91c811bae6ac4488915ba5880771b0a7
test
MiddlewareSet.use
Registers middleware plugin(s) with the bot or set. :param middleware : :return:
libraries/botbuilder-core/botbuilder/core/middleware_set.py
def use(self, *middleware: Middleware): """ Registers middleware plugin(s) with the bot or set. :param middleware : :return: """ for (idx, m) in enumerate(middleware): if hasattr(m, 'on_process_request') and callable(m.on_process_request): self...
def use(self, *middleware: Middleware): """ Registers middleware plugin(s) with the bot or set. :param middleware : :return: """ for (idx, m) in enumerate(middleware): if hasattr(m, 'on_process_request') and callable(m.on_process_request): self...
[ "Registers", "middleware", "plugin", "(", "s", ")", "with", "the", "bot", "or", "set", ".", ":", "param", "middleware", ":", ":", "return", ":" ]
Microsoft/botbuilder-python
python
https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botbuilder-core/botbuilder/core/middleware_set.py#L35-L46
[ "def", "use", "(", "self", ",", "*", "middleware", ":", "Middleware", ")", ":", "for", "(", "idx", ",", "m", ")", "in", "enumerate", "(", "middleware", ")", ":", "if", "hasattr", "(", "m", ",", "'on_process_request'", ")", "and", "callable", "(", "m"...
274663dd91c811bae6ac4488915ba5880771b0a7
test
ApplicationInsightsTelemetryClient.track_pageview
Send information about the page viewed in the application (a web page for instance). :param name: the name of the page that was viewed. :param url: the URL of the page that was viewed. :param duration: the duration of the page view in milliseconds. (defaults to: 0) :param properties: the...
libraries/botbuilder-applicationinsights/botbuilder/applicationinsights/application_insights_telemetry_client.py
def track_pageview(self, name: str, url:str, duration: int = 0, properties : Dict[str, object]=None, measurements: Dict[str, object]=None) -> None: """ Send information about the page viewed in the application (a web page for instance). :param name: the name of the page ...
def track_pageview(self, name: str, url:str, duration: int = 0, properties : Dict[str, object]=None, measurements: Dict[str, object]=None) -> None: """ Send information about the page viewed in the application (a web page for instance). :param name: the name of the page ...
[ "Send", "information", "about", "the", "page", "viewed", "in", "the", "application", "(", "a", "web", "page", "for", "instance", ")", ".", ":", "param", "name", ":", "the", "name", "of", "the", "page", "that", "was", "viewed", ".", ":", "param", "url",...
Microsoft/botbuilder-python
python
https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botbuilder-applicationinsights/botbuilder/applicationinsights/application_insights_telemetry_client.py#L38-L48
[ "def", "track_pageview", "(", "self", ",", "name", ":", "str", ",", "url", ":", "str", ",", "duration", ":", "int", "=", "0", ",", "properties", ":", "Dict", "[", "str", ",", "object", "]", "=", "None", ",", "measurements", ":", "Dict", "[", "str",...
274663dd91c811bae6ac4488915ba5880771b0a7
test
ApplicationInsightsTelemetryClient.track_exception
Send information about a single exception that occurred in the application. :param type_exception: the type of the exception that was thrown. :param value: the exception that the client wants to send. :param tb: the traceback information as returned by :func:`sys.exc_info`. :param proper...
libraries/botbuilder-applicationinsights/botbuilder/applicationinsights/application_insights_telemetry_client.py
def track_exception(self, type_exception: type = None, value : Exception =None, tb : traceback =None, properties: Dict[str, object]=None, measurements: Dict[str, object]=None) -> None: """ Send information about a single exception that occurred in the application. :para...
def track_exception(self, type_exception: type = None, value : Exception =None, tb : traceback =None, properties: Dict[str, object]=None, measurements: Dict[str, object]=None) -> None: """ Send information about a single exception that occurred in the application. :para...
[ "Send", "information", "about", "a", "single", "exception", "that", "occurred", "in", "the", "application", ".", ":", "param", "type_exception", ":", "the", "type", "of", "the", "exception", "that", "was", "thrown", ".", ":", "param", "value", ":", "the", ...
Microsoft/botbuilder-python
python
https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botbuilder-applicationinsights/botbuilder/applicationinsights/application_insights_telemetry_client.py#L50-L60
[ "def", "track_exception", "(", "self", ",", "type_exception", ":", "type", "=", "None", ",", "value", ":", "Exception", "=", "None", ",", "tb", ":", "traceback", "=", "None", ",", "properties", ":", "Dict", "[", "str", ",", "object", "]", "=", "None", ...
274663dd91c811bae6ac4488915ba5880771b0a7
test
ApplicationInsightsTelemetryClient.track_event
Send information about a single event that has occurred in the context of the application. :param name: the data to associate to this event. :param properties: the set of custom properties the client wants attached to this data item. (defaults to: None) :param measurements: the set of custom mea...
libraries/botbuilder-applicationinsights/botbuilder/applicationinsights/application_insights_telemetry_client.py
def track_event(self, name: str, properties: Dict[str, object] = None, measurements: Dict[str, object] = None) -> None: """ Send information about a single event that has occurred in the context of the application. :param name: the data to associate to this event. :...
def track_event(self, name: str, properties: Dict[str, object] = None, measurements: Dict[str, object] = None) -> None: """ Send information about a single event that has occurred in the context of the application. :param name: the data to associate to this event. :...
[ "Send", "information", "about", "a", "single", "event", "that", "has", "occurred", "in", "the", "context", "of", "the", "application", ".", ":", "param", "name", ":", "the", "data", "to", "associate", "to", "this", "event", ".", ":", "param", "properties",...
Microsoft/botbuilder-python
python
https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botbuilder-applicationinsights/botbuilder/applicationinsights/application_insights_telemetry_client.py#L62-L70
[ "def", "track_event", "(", "self", ",", "name", ":", "str", ",", "properties", ":", "Dict", "[", "str", ",", "object", "]", "=", "None", ",", "measurements", ":", "Dict", "[", "str", ",", "object", "]", "=", "None", ")", "->", "None", ":", "self", ...
274663dd91c811bae6ac4488915ba5880771b0a7
test
ApplicationInsightsTelemetryClient.track_metric
Send information about a single metric data point that was captured for the application. :param name: The name of the metric that was captured. :param value: The value of the metric that was captured. :param type: The type of the metric. (defaults to: TelemetryDataPointType.aggregation`) ...
libraries/botbuilder-applicationinsights/botbuilder/applicationinsights/application_insights_telemetry_client.py
def track_metric(self, name: str, value: float, type: TelemetryDataPointType =None, count: int =None, min: float=None, max: float=None, std_dev: float=None, properties: Dict[str, object]=None) -> NotImplemented: """ Send information about a single metric data poi...
def track_metric(self, name: str, value: float, type: TelemetryDataPointType =None, count: int =None, min: float=None, max: float=None, std_dev: float=None, properties: Dict[str, object]=None) -> NotImplemented: """ Send information about a single metric data poi...
[ "Send", "information", "about", "a", "single", "metric", "data", "point", "that", "was", "captured", "for", "the", "application", ".", ":", "param", "name", ":", "The", "name", "of", "the", "metric", "that", "was", "captured", ".", ":", "param", "value", ...
Microsoft/botbuilder-python
python
https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botbuilder-applicationinsights/botbuilder/applicationinsights/application_insights_telemetry_client.py#L72-L86
[ "def", "track_metric", "(", "self", ",", "name", ":", "str", ",", "value", ":", "float", ",", "type", ":", "TelemetryDataPointType", "=", "None", ",", "count", ":", "int", "=", "None", ",", "min", ":", "float", "=", "None", ",", "max", ":", "float", ...
274663dd91c811bae6ac4488915ba5880771b0a7
test
ApplicationInsightsTelemetryClient.track_trace
Sends a single trace statement. :param name: the trace statement.\n :param properties: the set of custom properties the client wants attached to this data item. (defaults to: None)\n :param severity: the severity level of this trace, one of DEBUG, INFO, WARNING, ERROR, CRITICAL
libraries/botbuilder-applicationinsights/botbuilder/applicationinsights/application_insights_telemetry_client.py
def track_trace(self, name: str, properties: Dict[str, object]=None, severity=None): """ Sends a single trace statement. :param name: the trace statement.\n :param properties: the set of custom properties the client wants attached to this data item. (defaults to: None)\n :param s...
def track_trace(self, name: str, properties: Dict[str, object]=None, severity=None): """ Sends a single trace statement. :param name: the trace statement.\n :param properties: the set of custom properties the client wants attached to this data item. (defaults to: None)\n :param s...
[ "Sends", "a", "single", "trace", "statement", ".", ":", "param", "name", ":", "the", "trace", "statement", ".", "\\", "n", ":", "param", "properties", ":", "the", "set", "of", "custom", "properties", "the", "client", "wants", "attached", "to", "this", "d...
Microsoft/botbuilder-python
python
https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botbuilder-applicationinsights/botbuilder/applicationinsights/application_insights_telemetry_client.py#L88-L95
[ "def", "track_trace", "(", "self", ",", "name", ":", "str", ",", "properties", ":", "Dict", "[", "str", ",", "object", "]", "=", "None", ",", "severity", "=", "None", ")", ":", "self", ".", "_client", ".", "track_trace", "(", "name", ",", "properties...
274663dd91c811bae6ac4488915ba5880771b0a7
test
ApplicationInsightsTelemetryClient.track_request
Sends a single request that was captured for the application. :param name: The name for this request. All requests with the same name will be grouped together. :param url: The actual URL for this request (to show in individual request instances). :param success: True if the request ended in succ...
libraries/botbuilder-applicationinsights/botbuilder/applicationinsights/application_insights_telemetry_client.py
def track_request(self, name: str, url: str, success: bool, start_time: str=None, duration: int=None, response_code: str =None, http_method: str=None, properties: Dict[str, object]=None, measurements: Dict[str, object]=None, request_id: str=None): "...
def track_request(self, name: str, url: str, success: bool, start_time: str=None, duration: int=None, response_code: str =None, http_method: str=None, properties: Dict[str, object]=None, measurements: Dict[str, object]=None, request_id: str=None): "...
[ "Sends", "a", "single", "request", "that", "was", "captured", "for", "the", "application", ".", ":", "param", "name", ":", "The", "name", "for", "this", "request", ".", "All", "requests", "with", "the", "same", "name", "will", "be", "grouped", "together", ...
Microsoft/botbuilder-python
python
https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botbuilder-applicationinsights/botbuilder/applicationinsights/application_insights_telemetry_client.py#L97-L115
[ "def", "track_request", "(", "self", ",", "name", ":", "str", ",", "url", ":", "str", ",", "success", ":", "bool", ",", "start_time", ":", "str", "=", "None", ",", "duration", ":", "int", "=", "None", ",", "response_code", ":", "str", "=", "None", ...
274663dd91c811bae6ac4488915ba5880771b0a7
test
ApplicationInsightsTelemetryClient.track_dependency
Sends a single dependency telemetry that was captured for the application. :param name: the name of the command initiated with this dependency call. Low cardinality value. Examples are stored procedure name and URL path template. :param data: the command initiated by this dependency call. Examples are S...
libraries/botbuilder-applicationinsights/botbuilder/applicationinsights/application_insights_telemetry_client.py
def track_dependency(self, name:str, data:str, type:str=None, target:str=None, duration:int=None, success:bool=None, result_code:str=None, properties:Dict[str, object]=None, measurements:Dict[str, object]=None, dependency_id:str=None): """ Sends a single...
def track_dependency(self, name:str, data:str, type:str=None, target:str=None, duration:int=None, success:bool=None, result_code:str=None, properties:Dict[str, object]=None, measurements:Dict[str, object]=None, dependency_id:str=None): """ Sends a single...
[ "Sends", "a", "single", "dependency", "telemetry", "that", "was", "captured", "for", "the", "application", ".", ":", "param", "name", ":", "the", "name", "of", "the", "command", "initiated", "with", "this", "dependency", "call", ".", "Low", "cardinality", "v...
Microsoft/botbuilder-python
python
https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botbuilder-applicationinsights/botbuilder/applicationinsights/application_insights_telemetry_client.py#L117-L134
[ "def", "track_dependency", "(", "self", ",", "name", ":", "str", ",", "data", ":", "str", ",", "type", ":", "str", "=", "None", ",", "target", ":", "str", "=", "None", ",", "duration", ":", "int", "=", "None", ",", "success", ":", "bool", "=", "N...
274663dd91c811bae6ac4488915ba5880771b0a7
test
BotState.create_property
Create a property definition and register it with this BotState. :param name: The name of the property. :param force: :return: If successful, the state property accessor created.
libraries/botbuilder-core/botbuilder/core/bot_state.py
def create_property(self, name:str) -> StatePropertyAccessor: """ Create a property definition and register it with this BotState. :param name: The name of the property. :param force: :return: If successful, the state property accessor created. """ if not name: ...
def create_property(self, name:str) -> StatePropertyAccessor: """ Create a property definition and register it with this BotState. :param name: The name of the property. :param force: :return: If successful, the state property accessor created. """ if not name: ...
[ "Create", "a", "property", "definition", "and", "register", "it", "with", "this", "BotState", ".", ":", "param", "name", ":", "The", "name", "of", "the", "property", ".", ":", "param", "force", ":", ":", "return", ":", "If", "successful", "the", "state",...
Microsoft/botbuilder-python
python
https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botbuilder-core/botbuilder/core/bot_state.py#L55-L64
[ "def", "create_property", "(", "self", ",", "name", ":", "str", ")", "->", "StatePropertyAccessor", ":", "if", "not", "name", ":", "raise", "TypeError", "(", "'BotState.create_property(): BotState cannot be None or empty.'", ")", "return", "BotStatePropertyAccessor", "(...
274663dd91c811bae6ac4488915ba5880771b0a7
test
BotState.load
Reads in the current state object and caches it in the context object for this turm. :param turn_context: The context object for this turn. :param force: Optional. True to bypass the cache.
libraries/botbuilder-core/botbuilder/core/bot_state.py
async def load(self, turn_context: TurnContext, force: bool = False) -> None: """ Reads in the current state object and caches it in the context object for this turm. :param turn_context: The context object for this turn. :param force: Optional. True to bypass the cache. """ ...
async def load(self, turn_context: TurnContext, force: bool = False) -> None: """ Reads in the current state object and caches it in the context object for this turm. :param turn_context: The context object for this turn. :param force: Optional. True to bypass the cache. """ ...
[ "Reads", "in", "the", "current", "state", "object", "and", "caches", "it", "in", "the", "context", "object", "for", "this", "turm", ".", ":", "param", "turn_context", ":", "The", "context", "object", "for", "this", "turn", ".", ":", "param", "force", ":"...
Microsoft/botbuilder-python
python
https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botbuilder-core/botbuilder/core/bot_state.py#L72-L87
[ "async", "def", "load", "(", "self", ",", "turn_context", ":", "TurnContext", ",", "force", ":", "bool", "=", "False", ")", "->", "None", ":", "if", "turn_context", "==", "None", ":", "raise", "TypeError", "(", "'BotState.load(): turn_context cannot be None.'", ...
274663dd91c811bae6ac4488915ba5880771b0a7
test
BotState.save_changes
If it has changed, writes to storage the state object that is cached in the current context object for this turn. :param turn_context: The context object for this turn. :param force: Optional. True to save state to storage whether or not there are changes.
libraries/botbuilder-core/botbuilder/core/bot_state.py
async def save_changes(self, turn_context: TurnContext, force: bool = False) -> None: """ If it has changed, writes to storage the state object that is cached in the current context object for this turn. :param turn_context: The context object for this turn. :param force: Optional. True ...
async def save_changes(self, turn_context: TurnContext, force: bool = False) -> None: """ If it has changed, writes to storage the state object that is cached in the current context object for this turn. :param turn_context: The context object for this turn. :param force: Optional. True ...
[ "If", "it", "has", "changed", "writes", "to", "storage", "the", "state", "object", "that", "is", "cached", "in", "the", "current", "context", "object", "for", "this", "turn", ".", ":", "param", "turn_context", ":", "The", "context", "object", "for", "this"...
Microsoft/botbuilder-python
python
https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botbuilder-core/botbuilder/core/bot_state.py#L89-L104
[ "async", "def", "save_changes", "(", "self", ",", "turn_context", ":", "TurnContext", ",", "force", ":", "bool", "=", "False", ")", "->", "None", ":", "if", "turn_context", "==", "None", ":", "raise", "TypeError", "(", "'BotState.save_changes(): turn_context can...
274663dd91c811bae6ac4488915ba5880771b0a7
test
BotState.clear_state
Clears any state currently stored in this state scope. NOTE: that save_changes must be called in order for the cleared state to be persisted to the underlying store. :param turn_context: The context object for this turn. :return: None
libraries/botbuilder-core/botbuilder/core/bot_state.py
async def clear_state(self, turn_context: TurnContext): """ Clears any state currently stored in this state scope. NOTE: that save_changes must be called in order for the cleared state to be persisted to the underlying store. :param turn_context: The context object for this turn...
async def clear_state(self, turn_context: TurnContext): """ Clears any state currently stored in this state scope. NOTE: that save_changes must be called in order for the cleared state to be persisted to the underlying store. :param turn_context: The context object for this turn...
[ "Clears", "any", "state", "currently", "stored", "in", "this", "state", "scope", ".", "NOTE", ":", "that", "save_changes", "must", "be", "called", "in", "order", "for", "the", "cleared", "state", "to", "be", "persisted", "to", "the", "underlying", "store", ...
Microsoft/botbuilder-python
python
https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botbuilder-core/botbuilder/core/bot_state.py#L106-L120
[ "async", "def", "clear_state", "(", "self", ",", "turn_context", ":", "TurnContext", ")", ":", "if", "turn_context", "==", "None", ":", "raise", "TypeError", "(", "'BotState.clear_state(): turn_context cannot be None.'", ")", "# Explicitly setting the hash will mean IsChan...
274663dd91c811bae6ac4488915ba5880771b0a7
test
BotState.delete
Delete any state currently stored in this state scope. :param turn_context: The context object for this turn. :return: None
libraries/botbuilder-core/botbuilder/core/bot_state.py
async def delete(self, turn_context: TurnContext) -> None: """ Delete any state currently stored in this state scope. :param turn_context: The context object for this turn. :return: None """ if turn_context == None: raise TypeError('BotState.delete():...
async def delete(self, turn_context: TurnContext) -> None: """ Delete any state currently stored in this state scope. :param turn_context: The context object for this turn. :return: None """ if turn_context == None: raise TypeError('BotState.delete():...
[ "Delete", "any", "state", "currently", "stored", "in", "this", "state", "scope", ".", ":", "param", "turn_context", ":", "The", "context", "object", "for", "this", "turn", ".", ":", "return", ":", "None" ]
Microsoft/botbuilder-python
python
https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botbuilder-core/botbuilder/core/bot_state.py#L122-L135
[ "async", "def", "delete", "(", "self", ",", "turn_context", ":", "TurnContext", ")", "->", "None", ":", "if", "turn_context", "==", "None", ":", "raise", "TypeError", "(", "'BotState.delete(): turn_context cannot be None.'", ")", "turn_context", ".", "turn_state", ...
274663dd91c811bae6ac4488915ba5880771b0a7
test
BotState.set_property_value
Deletes a property from the state cache in the turn context. :param turn_context: The context object for this turn. :param property_name: The value to set on the property. :return: None
libraries/botbuilder-core/botbuilder/core/bot_state.py
async def set_property_value(self, turn_context: TurnContext, property_name: str, value: object) -> None: """ Deletes a property from the state cache in the turn context. :param turn_context: The context object for this turn. :param property_name: The value to set on the propert...
async def set_property_value(self, turn_context: TurnContext, property_name: str, value: object) -> None: """ Deletes a property from the state cache in the turn context. :param turn_context: The context object for this turn. :param property_name: The value to set on the propert...
[ "Deletes", "a", "property", "from", "the", "state", "cache", "in", "the", "turn", "context", ".", ":", "param", "turn_context", ":", "The", "context", "object", "for", "this", "turn", ".", ":", "param", "property_name", ":", "The", "value", "to", "set", ...
Microsoft/botbuilder-python
python
https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botbuilder-core/botbuilder/core/bot_state.py#L168-L182
[ "async", "def", "set_property_value", "(", "self", ",", "turn_context", ":", "TurnContext", ",", "property_name", ":", "str", ",", "value", ":", "object", ")", "->", "None", ":", "if", "turn_context", "==", "None", ":", "raise", "TypeError", "(", "'BotState....
274663dd91c811bae6ac4488915ba5880771b0a7
test
BotFrameworkAdapter.continue_conversation
Continues a conversation with a user. This is often referred to as the bots "Proactive Messaging" flow as its lets the bot proactively send messages to a conversation or user that its already communicated with. Scenarios like sending notifications or coupons to a user are enabled by this method....
libraries/botbuilder-core/botbuilder/core/bot_framework_adapter.py
async def continue_conversation(self, reference: ConversationReference, logic): """ Continues a conversation with a user. This is often referred to as the bots "Proactive Messaging" flow as its lets the bot proactively send messages to a conversation or user that its already communicated...
async def continue_conversation(self, reference: ConversationReference, logic): """ Continues a conversation with a user. This is often referred to as the bots "Proactive Messaging" flow as its lets the bot proactively send messages to a conversation or user that its already communicated...
[ "Continues", "a", "conversation", "with", "a", "user", ".", "This", "is", "often", "referred", "to", "as", "the", "bots", "Proactive", "Messaging", "flow", "as", "its", "lets", "the", "bot", "proactively", "send", "messages", "to", "a", "conversation", "or",...
Microsoft/botbuilder-python
python
https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botbuilder-core/botbuilder/core/bot_framework_adapter.py#L35-L47
[ "async", "def", "continue_conversation", "(", "self", ",", "reference", ":", "ConversationReference", ",", "logic", ")", ":", "request", "=", "TurnContext", ".", "apply_conversation_reference", "(", "Activity", "(", ")", ",", "reference", ",", "is_incoming", "=", ...
274663dd91c811bae6ac4488915ba5880771b0a7
test
BotFrameworkAdapter.create_conversation
Starts a new conversation with a user. This is typically used to Direct Message (DM) a member of a group. :param reference: :param logic: :return:
libraries/botbuilder-core/botbuilder/core/bot_framework_adapter.py
async def create_conversation(self, reference: ConversationReference, logic): """ Starts a new conversation with a user. This is typically used to Direct Message (DM) a member of a group. :param reference: :param logic: :return: """ try: if ref...
async def create_conversation(self, reference: ConversationReference, logic): """ Starts a new conversation with a user. This is typically used to Direct Message (DM) a member of a group. :param reference: :param logic: :return: """ try: if ref...
[ "Starts", "a", "new", "conversation", "with", "a", "user", ".", "This", "is", "typically", "used", "to", "Direct", "Message", "(", "DM", ")", "a", "member", "of", "a", "group", ".", ":", "param", "reference", ":", ":", "param", "logic", ":", ":", "re...
Microsoft/botbuilder-python
python
https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botbuilder-core/botbuilder/core/bot_framework_adapter.py#L49-L75
[ "async", "def", "create_conversation", "(", "self", ",", "reference", ":", "ConversationReference", ",", "logic", ")", ":", "try", ":", "if", "reference", ".", "service_url", "is", "None", ":", "raise", "TypeError", "(", "'BotFrameworkAdapter.create_conversation(): ...
274663dd91c811bae6ac4488915ba5880771b0a7
test
BotFrameworkAdapter.process_activity
Processes an activity received by the bots web server. This includes any messages sent from a user and is the method that drives what's often referred to as the bots "Reactive Messaging" flow. :param req: :param auth_header: :param logic: :return:
libraries/botbuilder-core/botbuilder/core/bot_framework_adapter.py
async def process_activity(self, req, auth_header: str, logic: Callable): """ Processes an activity received by the bots web server. This includes any messages sent from a user and is the method that drives what's often referred to as the bots "Reactive Messaging" flow. :param re...
async def process_activity(self, req, auth_header: str, logic: Callable): """ Processes an activity received by the bots web server. This includes any messages sent from a user and is the method that drives what's often referred to as the bots "Reactive Messaging" flow. :param re...
[ "Processes", "an", "activity", "received", "by", "the", "bots", "web", "server", ".", "This", "includes", "any", "messages", "sent", "from", "a", "user", "and", "is", "the", "method", "that", "drives", "what", "s", "often", "referred", "to", "as", "the", ...
Microsoft/botbuilder-python
python
https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botbuilder-core/botbuilder/core/bot_framework_adapter.py#L77-L93
[ "async", "def", "process_activity", "(", "self", ",", "req", ",", "auth_header", ":", "str", ",", "logic", ":", "Callable", ")", ":", "activity", "=", "await", "self", ".", "parse_request", "(", "req", ")", "auth_header", "=", "auth_header", "or", "''", ...
274663dd91c811bae6ac4488915ba5880771b0a7
test
BotFrameworkAdapter.authenticate_request
Allows for the overriding of authentication in unit tests. :param request: :param auth_header: :return:
libraries/botbuilder-core/botbuilder/core/bot_framework_adapter.py
async def authenticate_request(self, request: Activity, auth_header: str): """ Allows for the overriding of authentication in unit tests. :param request: :param auth_header: :return: """ await JwtTokenValidation.authenticate_request(request, auth_header, self._cre...
async def authenticate_request(self, request: Activity, auth_header: str): """ Allows for the overriding of authentication in unit tests. :param request: :param auth_header: :return: """ await JwtTokenValidation.authenticate_request(request, auth_header, self._cre...
[ "Allows", "for", "the", "overriding", "of", "authentication", "in", "unit", "tests", ".", ":", "param", "request", ":", ":", "param", "auth_header", ":", ":", "return", ":" ]
Microsoft/botbuilder-python
python
https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botbuilder-core/botbuilder/core/bot_framework_adapter.py#L95-L102
[ "async", "def", "authenticate_request", "(", "self", ",", "request", ":", "Activity", ",", "auth_header", ":", "str", ")", ":", "await", "JwtTokenValidation", ".", "authenticate_request", "(", "request", ",", "auth_header", ",", "self", ".", "_credential_provider"...
274663dd91c811bae6ac4488915ba5880771b0a7
test
BotFrameworkAdapter.parse_request
Parses and validates request :param req: :return:
libraries/botbuilder-core/botbuilder/core/bot_framework_adapter.py
async def parse_request(req): """ Parses and validates request :param req: :return: """ async def validate_activity(activity: Activity): if not isinstance(activity.type, str): raise TypeError('BotFrameworkAdapter.parse_request(): invalid or mi...
async def parse_request(req): """ Parses and validates request :param req: :return: """ async def validate_activity(activity: Activity): if not isinstance(activity.type, str): raise TypeError('BotFrameworkAdapter.parse_request(): invalid or mi...
[ "Parses", "and", "validates", "request", ":", "param", "req", ":", ":", "return", ":" ]
Microsoft/botbuilder-python
python
https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botbuilder-core/botbuilder/core/bot_framework_adapter.py#L113-L149
[ "async", "def", "parse_request", "(", "req", ")", ":", "async", "def", "validate_activity", "(", "activity", ":", "Activity", ")", ":", "if", "not", "isinstance", "(", "activity", ".", "type", ",", "str", ")", ":", "raise", "TypeError", "(", "'BotFramework...
274663dd91c811bae6ac4488915ba5880771b0a7
test
BotFrameworkAdapter.update_activity
Replaces an activity that was previously sent to a channel. It should be noted that not all channels support this feature. :param context: :param activity: :return:
libraries/botbuilder-core/botbuilder/core/bot_framework_adapter.py
async def update_activity(self, context: TurnContext, activity: Activity): """ Replaces an activity that was previously sent to a channel. It should be noted that not all channels support this feature. :param context: :param activity: :return: """ try: ...
async def update_activity(self, context: TurnContext, activity: Activity): """ Replaces an activity that was previously sent to a channel. It should be noted that not all channels support this feature. :param context: :param activity: :return: """ try: ...
[ "Replaces", "an", "activity", "that", "was", "previously", "sent", "to", "a", "channel", ".", "It", "should", "be", "noted", "that", "not", "all", "channels", "support", "this", "feature", ".", ":", "param", "context", ":", ":", "param", "activity", ":", ...
Microsoft/botbuilder-python
python
https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botbuilder-core/botbuilder/core/bot_framework_adapter.py#L151-L166
[ "async", "def", "update_activity", "(", "self", ",", "context", ":", "TurnContext", ",", "activity", ":", "Activity", ")", ":", "try", ":", "client", "=", "self", ".", "create_connector_client", "(", "activity", ".", "service_url", ")", "return", "await", "c...
274663dd91c811bae6ac4488915ba5880771b0a7
test
BotFrameworkAdapter.delete_activity
Deletes an activity that was previously sent to a channel. It should be noted that not all channels support this feature. :param context: :param conversation_reference: :return:
libraries/botbuilder-core/botbuilder/core/bot_framework_adapter.py
async def delete_activity(self, context: TurnContext, conversation_reference: ConversationReference): """ Deletes an activity that was previously sent to a channel. It should be noted that not all channels support this feature. :param context: :param conversation_reference: ...
async def delete_activity(self, context: TurnContext, conversation_reference: ConversationReference): """ Deletes an activity that was previously sent to a channel. It should be noted that not all channels support this feature. :param context: :param conversation_reference: ...
[ "Deletes", "an", "activity", "that", "was", "previously", "sent", "to", "a", "channel", ".", "It", "should", "be", "noted", "that", "not", "all", "channels", "support", "this", "feature", ".", ":", "param", "context", ":", ":", "param", "conversation_referen...
Microsoft/botbuilder-python
python
https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botbuilder-core/botbuilder/core/bot_framework_adapter.py#L168-L181
[ "async", "def", "delete_activity", "(", "self", ",", "context", ":", "TurnContext", ",", "conversation_reference", ":", "ConversationReference", ")", ":", "try", ":", "client", "=", "self", ".", "create_connector_client", "(", "conversation_reference", ".", "service...
274663dd91c811bae6ac4488915ba5880771b0a7
test
BotFrameworkAdapter.delete_conversation_member
Deletes a member from the current conversation. :param context: :param member_id: :return:
libraries/botbuilder-core/botbuilder/core/bot_framework_adapter.py
async def delete_conversation_member(self, context: TurnContext, member_id: str) -> None: """ Deletes a member from the current conversation. :param context: :param member_id: :return: """ try: if not context.activity.service_url: raise...
async def delete_conversation_member(self, context: TurnContext, member_id: str) -> None: """ Deletes a member from the current conversation. :param context: :param member_id: :return: """ try: if not context.activity.service_url: raise...
[ "Deletes", "a", "member", "from", "the", "current", "conversation", ".", ":", "param", "context", ":", ":", "param", "member_id", ":", ":", "return", ":" ]
Microsoft/botbuilder-python
python
https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botbuilder-core/botbuilder/core/bot_framework_adapter.py#L201-L221
[ "async", "def", "delete_conversation_member", "(", "self", ",", "context", ":", "TurnContext", ",", "member_id", ":", "str", ")", "->", "None", ":", "try", ":", "if", "not", "context", ".", "activity", ".", "service_url", ":", "raise", "TypeError", "(", "'...
274663dd91c811bae6ac4488915ba5880771b0a7
test
BotFrameworkAdapter.get_activity_members
Lists the members of a given activity. :param context: :param activity_id: :return:
libraries/botbuilder-core/botbuilder/core/bot_framework_adapter.py
async def get_activity_members(self, context: TurnContext, activity_id: str): """ Lists the members of a given activity. :param context: :param activity_id: :return: """ try: if not activity_id: activity_id = context.activity.id ...
async def get_activity_members(self, context: TurnContext, activity_id: str): """ Lists the members of a given activity. :param context: :param activity_id: :return: """ try: if not activity_id: activity_id = context.activity.id ...
[ "Lists", "the", "members", "of", "a", "given", "activity", ".", ":", "param", "context", ":", ":", "param", "activity_id", ":", ":", "return", ":" ]
Microsoft/botbuilder-python
python
https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botbuilder-core/botbuilder/core/bot_framework_adapter.py#L223-L245
[ "async", "def", "get_activity_members", "(", "self", ",", "context", ":", "TurnContext", ",", "activity_id", ":", "str", ")", ":", "try", ":", "if", "not", "activity_id", ":", "activity_id", "=", "context", ".", "activity", ".", "id", "if", "not", "context...
274663dd91c811bae6ac4488915ba5880771b0a7
test
BotFrameworkAdapter.get_conversation_members
Lists the members of a current conversation. :param context: :return:
libraries/botbuilder-core/botbuilder/core/bot_framework_adapter.py
async def get_conversation_members(self, context: TurnContext): """ Lists the members of a current conversation. :param context: :return: """ try: if not context.activity.service_url: raise TypeError('BotFrameworkAdapter.get_conversation_member...
async def get_conversation_members(self, context: TurnContext): """ Lists the members of a current conversation. :param context: :return: """ try: if not context.activity.service_url: raise TypeError('BotFrameworkAdapter.get_conversation_member...
[ "Lists", "the", "members", "of", "a", "current", "conversation", ".", ":", "param", "context", ":", ":", "return", ":" ]
Microsoft/botbuilder-python
python
https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botbuilder-core/botbuilder/core/bot_framework_adapter.py#L247-L264
[ "async", "def", "get_conversation_members", "(", "self", ",", "context", ":", "TurnContext", ")", ":", "try", ":", "if", "not", "context", ".", "activity", ".", "service_url", ":", "raise", "TypeError", "(", "'BotFrameworkAdapter.get_conversation_members(): missing se...
274663dd91c811bae6ac4488915ba5880771b0a7
test
BotFrameworkAdapter.get_conversations
Lists the Conversations in which this bot has participated for a given channel server. The channel server returns results in pages and each page will include a `continuationToken` that can be used to fetch the next page of results from the server. :param service_url: :param continuation_...
libraries/botbuilder-core/botbuilder/core/bot_framework_adapter.py
async def get_conversations(self, service_url: str, continuation_token: str=None): """ Lists the Conversations in which this bot has participated for a given channel server. The channel server returns results in pages and each page will include a `continuationToken` that can be used to fetch the...
async def get_conversations(self, service_url: str, continuation_token: str=None): """ Lists the Conversations in which this bot has participated for a given channel server. The channel server returns results in pages and each page will include a `continuationToken` that can be used to fetch the...
[ "Lists", "the", "Conversations", "in", "which", "this", "bot", "has", "participated", "for", "a", "given", "channel", "server", ".", "The", "channel", "server", "returns", "results", "in", "pages", "and", "each", "page", "will", "include", "a", "continuationTo...
Microsoft/botbuilder-python
python
https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botbuilder-core/botbuilder/core/bot_framework_adapter.py#L266-L276
[ "async", "def", "get_conversations", "(", "self", ",", "service_url", ":", "str", ",", "continuation_token", ":", "str", "=", "None", ")", ":", "client", "=", "self", ".", "create_connector_client", "(", "service_url", ")", "return", "await", "client", ".", ...
274663dd91c811bae6ac4488915ba5880771b0a7
test
BotFrameworkAdapter.create_connector_client
Allows for mocking of the connector client in unit tests. :param service_url: :return:
libraries/botbuilder-core/botbuilder/core/bot_framework_adapter.py
def create_connector_client(self, service_url: str) -> ConnectorClient: """ Allows for mocking of the connector client in unit tests. :param service_url: :return: """ client = ConnectorClient(self._credentials, base_url=service_url) client.config.add_user_agent(US...
def create_connector_client(self, service_url: str) -> ConnectorClient: """ Allows for mocking of the connector client in unit tests. :param service_url: :return: """ client = ConnectorClient(self._credentials, base_url=service_url) client.config.add_user_agent(US...
[ "Allows", "for", "mocking", "of", "the", "connector", "client", "in", "unit", "tests", ".", ":", "param", "service_url", ":", ":", "return", ":" ]
Microsoft/botbuilder-python
python
https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botbuilder-core/botbuilder/core/bot_framework_adapter.py#L278-L286
[ "def", "create_connector_client", "(", "self", ",", "service_url", ":", "str", ")", "->", "ConnectorClient", ":", "client", "=", "ConnectorClient", "(", "self", ".", "_credentials", ",", "base_url", "=", "service_url", ")", "client", ".", "config", ".", "add_u...
274663dd91c811bae6ac4488915ba5880771b0a7
test
ComponentDialog.add_dialog
Adds a dialog to the component dialog. Adding a new dialog will inherit the BotTelemetryClient of the ComponentDialog. :param dialog: The dialog to add. :return: The updated ComponentDialog
libraries/botbuilder-dialogs/botbuilder/dialogs/component_dialog.py
def add_dialog(self, dialog: Dialog) -> object: """ Adds a dialog to the component dialog. Adding a new dialog will inherit the BotTelemetryClient of the ComponentDialog. :param dialog: The dialog to add. :return: The updated ComponentDialog """ self._dialogs.add(...
def add_dialog(self, dialog: Dialog) -> object: """ Adds a dialog to the component dialog. Adding a new dialog will inherit the BotTelemetryClient of the ComponentDialog. :param dialog: The dialog to add. :return: The updated ComponentDialog """ self._dialogs.add(...
[ "Adds", "a", "dialog", "to", "the", "component", "dialog", ".", "Adding", "a", "new", "dialog", "will", "inherit", "the", "BotTelemetryClient", "of", "the", "ComponentDialog", ".", ":", "param", "dialog", ":", "The", "dialog", "to", "add", ".", ":", "retur...
Microsoft/botbuilder-python
python
https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botbuilder-dialogs/botbuilder/dialogs/component_dialog.py#L111-L121
[ "def", "add_dialog", "(", "self", ",", "dialog", ":", "Dialog", ")", "->", "object", ":", "self", ".", "_dialogs", ".", "add", "(", "dialog", ")", "if", "not", "self", ".", "initial_dialog_id", ":", "self", ".", "initial_dialog_id", "=", "dialog", ".", ...
274663dd91c811bae6ac4488915ba5880771b0a7
test
JwtTokenValidation.authenticate_request
Authenticates the request and sets the service url in the set of trusted urls. :param activity: The incoming Activity from the Bot Framework or the Emulator :type activity: ~botframework.connector.models.Activity :param auth_header: The Bearer token included as part of the request ...
libraries/botframework-connector/botframework/connector/auth/jwt_token_validation.py
async def authenticate_request(activity: Activity, auth_header: str, credentials: CredentialProvider) -> ClaimsIdentity: """Authenticates the request and sets the service url in the set of trusted urls. :param activity: The incoming Activity from the Bot Framework or the Emulator :type ...
async def authenticate_request(activity: Activity, auth_header: str, credentials: CredentialProvider) -> ClaimsIdentity: """Authenticates the request and sets the service url in the set of trusted urls. :param activity: The incoming Activity from the Bot Framework or the Emulator :type ...
[ "Authenticates", "the", "request", "and", "sets", "the", "service", "url", "in", "the", "set", "of", "trusted", "urls", ".", ":", "param", "activity", ":", "The", "incoming", "Activity", "from", "the", "Bot", "Framework", "or", "the", "Emulator", ":", "typ...
Microsoft/botbuilder-python
python
https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botframework-connector/botframework/connector/auth/jwt_token_validation.py#L12-L39
[ "async", "def", "authenticate_request", "(", "activity", ":", "Activity", ",", "auth_header", ":", "str", ",", "credentials", ":", "CredentialProvider", ")", "->", "ClaimsIdentity", ":", "if", "not", "auth_header", ":", "# No auth header was sent. We might be on the ano...
274663dd91c811bae6ac4488915ba5880771b0a7
test
bdist_wheel.wheel_dist_name
Return distribution full name with - replaced with _
libraries/botframework-connector/azure_bdist_wheel.py
def wheel_dist_name(self): """Return distribution full name with - replaced with _""" return '-'.join((safer_name(self.distribution.get_name()), safer_version(self.distribution.get_version())))
def wheel_dist_name(self): """Return distribution full name with - replaced with _""" return '-'.join((safer_name(self.distribution.get_name()), safer_version(self.distribution.get_version())))
[ "Return", "distribution", "full", "name", "with", "-", "replaced", "with", "_" ]
Microsoft/botbuilder-python
python
https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botframework-connector/azure_bdist_wheel.py#L153-L156
[ "def", "wheel_dist_name", "(", "self", ")", ":", "return", "'-'", ".", "join", "(", "(", "safer_name", "(", "self", ".", "distribution", ".", "get_name", "(", ")", ")", ",", "safer_version", "(", "self", ".", "distribution", ".", "get_version", "(", ")",...
274663dd91c811bae6ac4488915ba5880771b0a7
test
bdist_wheel.get_archive_basename
Return archive name without extension
libraries/botframework-connector/azure_bdist_wheel.py
def get_archive_basename(self): """Return archive name without extension""" impl_tag, abi_tag, plat_tag = self.get_tag() archive_basename = "%s-%s-%s-%s" % ( self.wheel_dist_name, impl_tag, abi_tag, plat_tag) return archive_basename
def get_archive_basename(self): """Return archive name without extension""" impl_tag, abi_tag, plat_tag = self.get_tag() archive_basename = "%s-%s-%s-%s" % ( self.wheel_dist_name, impl_tag, abi_tag, plat_tag) return archive_basename
[ "Return", "archive", "name", "without", "extension" ]
Microsoft/botbuilder-python
python
https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botframework-connector/azure_bdist_wheel.py#L190-L200
[ "def", "get_archive_basename", "(", "self", ")", ":", "impl_tag", ",", "abi_tag", ",", "plat_tag", "=", "self", ".", "get_tag", "(", ")", "archive_basename", "=", "\"%s-%s-%s-%s\"", "%", "(", "self", ".", "wheel_dist_name", ",", "impl_tag", ",", "abi_tag", "...
274663dd91c811bae6ac4488915ba5880771b0a7
test
bdist_wheel.setupcfg_requirements
Generate requirements from setup.cfg as ('Requires-Dist', 'requirement; qualifier') tuples. From a metadata section in setup.cfg: [metadata] provides-extra = extra1 extra2 requires-dist = requirement; qualifier another; qualifier2 unqualified ...
libraries/botframework-connector/azure_bdist_wheel.py
def setupcfg_requirements(self): """Generate requirements from setup.cfg as ('Requires-Dist', 'requirement; qualifier') tuples. From a metadata section in setup.cfg: [metadata] provides-extra = extra1 extra2 requires-dist = requirement; qualifier ...
def setupcfg_requirements(self): """Generate requirements from setup.cfg as ('Requires-Dist', 'requirement; qualifier') tuples. From a metadata section in setup.cfg: [metadata] provides-extra = extra1 extra2 requires-dist = requirement; qualifier ...
[ "Generate", "requirements", "from", "setup", ".", "cfg", "as", "(", "Requires", "-", "Dist", "requirement", ";", "qualifier", ")", "tuples", ".", "From", "a", "metadata", "section", "in", "setup", ".", "cfg", ":" ]
Microsoft/botbuilder-python
python
https://github.com/Microsoft/botbuilder-python/blob/274663dd91c811bae6ac4488915ba5880771b0a7/libraries/botframework-connector/azure_bdist_wheel.py#L321-L353
[ "def", "setupcfg_requirements", "(", "self", ")", ":", "metadata", "=", "self", ".", "distribution", ".", "get_option_dict", "(", "'metadata'", ")", "# our .ini parser folds - to _ in key names:", "for", "key", ",", "title", "in", "(", "(", "'provides_extra'", ",", ...
274663dd91c811bae6ac4488915ba5880771b0a7