partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
show
Display a nupmy array without having to specify what it represents. This module will attempt to infer how to display your tensor based on its rank, shape and dtype. rank 4 tensors will be displayed as image grids, rank 2 and 3 tensors as images.
lucid/misc/io/showing.py
def show(thing, domain=(0, 1), **kwargs): """Display a nupmy array without having to specify what it represents. This module will attempt to infer how to display your tensor based on its rank, shape and dtype. rank 4 tensors will be displayed as image grids, rank 2 and 3 tensors as images. """ if isinstanc...
def show(thing, domain=(0, 1), **kwargs): """Display a nupmy array without having to specify what it represents. This module will attempt to infer how to display your tensor based on its rank, shape and dtype. rank 4 tensors will be displayed as image grids, rank 2 and 3 tensors as images. """ if isinstanc...
[ "Display", "a", "nupmy", "array", "without", "having", "to", "specify", "what", "it", "represents", "." ]
tensorflow/lucid
python
https://github.com/tensorflow/lucid/blob/d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e/lucid/misc/io/showing.py#L102-L125
[ "def", "show", "(", "thing", ",", "domain", "=", "(", "0", ",", "1", ")", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "thing", ",", "np", ".", "ndarray", ")", ":", "rank", "=", "len", "(", "thing", ".", "shape", ")", "if", "ra...
d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e
train
_strip_consts
Strip large constant values from graph_def. This is mostly a utility function for graph(), and also originates here: https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/tutorials/deepdream/deepdream.ipynb
lucid/misc/io/showing.py
def _strip_consts(graph_def, max_const_size=32): """Strip large constant values from graph_def. This is mostly a utility function for graph(), and also originates here: https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/tutorials/deepdream/deepdream.ipynb """ strip_def = tf.Gr...
def _strip_consts(graph_def, max_const_size=32): """Strip large constant values from graph_def. This is mostly a utility function for graph(), and also originates here: https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/tutorials/deepdream/deepdream.ipynb """ strip_def = tf.Gr...
[ "Strip", "large", "constant", "values", "from", "graph_def", "." ]
tensorflow/lucid
python
https://github.com/tensorflow/lucid/blob/d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e/lucid/misc/io/showing.py#L272-L287
[ "def", "_strip_consts", "(", "graph_def", ",", "max_const_size", "=", "32", ")", ":", "strip_def", "=", "tf", ".", "GraphDef", "(", ")", "for", "n0", "in", "graph_def", ".", "node", ":", "n", "=", "strip_def", ".", "node", ".", "add", "(", ")", "n", ...
d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e
train
graph
Visualize a TensorFlow graph. This function was originally found in this notebook (also Apache licensed): https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/tutorials/deepdream/deepdream.ipynb
lucid/misc/io/showing.py
def graph(graph_def, max_const_size=32): """Visualize a TensorFlow graph. This function was originally found in this notebook (also Apache licensed): https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/tutorials/deepdream/deepdream.ipynb """ if hasattr(graph_def, 'as_graph_def'...
def graph(graph_def, max_const_size=32): """Visualize a TensorFlow graph. This function was originally found in this notebook (also Apache licensed): https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/tutorials/deepdream/deepdream.ipynb """ if hasattr(graph_def, 'as_graph_def'...
[ "Visualize", "a", "TensorFlow", "graph", "." ]
tensorflow/lucid
python
https://github.com/tensorflow/lucid/blob/d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e/lucid/misc/io/showing.py#L290-L314
[ "def", "graph", "(", "graph_def", ",", "max_const_size", "=", "32", ")", ":", "if", "hasattr", "(", "graph_def", ",", "'as_graph_def'", ")", ":", "graph_def", "=", "graph_def", ".", "as_graph_def", "(", ")", "strip_def", "=", "_strip_consts", "(", "graph_def...
d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e
train
resize
Resize an ndarray image of rank 3 or 4. target_size can be a tuple `(width, height)` or scalar `width`.
lucid/misc/ndimage_utils.py
def resize(image, target_size, **kwargs): """Resize an ndarray image of rank 3 or 4. target_size can be a tuple `(width, height)` or scalar `width`.""" if isinstance(target_size, int): target_size = (target_size, target_size) if not isinstance(target_size, (list, tuple, np.ndarray)): m...
def resize(image, target_size, **kwargs): """Resize an ndarray image of rank 3 or 4. target_size can be a tuple `(width, height)` or scalar `width`.""" if isinstance(target_size, int): target_size = (target_size, target_size) if not isinstance(target_size, (list, tuple, np.ndarray)): m...
[ "Resize", "an", "ndarray", "image", "of", "rank", "3", "or", "4", ".", "target_size", "can", "be", "a", "tuple", "(", "width", "height", ")", "or", "scalar", "width", "." ]
tensorflow/lucid
python
https://github.com/tensorflow/lucid/blob/d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e/lucid/misc/ndimage_utils.py#L20-L48
[ "def", "resize", "(", "image", ",", "target_size", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "target_size", ",", "int", ")", ":", "target_size", "=", "(", "target_size", ",", "target_size", ")", "if", "not", "isinstance", "(", "target_s...
d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e
train
composite
Takes two images and composites them.
lucid/misc/ndimage_utils.py
def composite( background_image, foreground_image, foreground_width_ratio=0.25, foreground_position=(0.0, 0.0), ): """Takes two images and composites them.""" if foreground_width_ratio <= 0: return background_image composite = background_image.copy() width = int(foreground_widt...
def composite( background_image, foreground_image, foreground_width_ratio=0.25, foreground_position=(0.0, 0.0), ): """Takes two images and composites them.""" if foreground_width_ratio <= 0: return background_image composite = background_image.copy() width = int(foreground_widt...
[ "Takes", "two", "images", "and", "composites", "them", "." ]
tensorflow/lucid
python
https://github.com/tensorflow/lucid/blob/d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e/lucid/misc/ndimage_utils.py#L51-L73
[ "def", "composite", "(", "background_image", ",", "foreground_image", ",", "foreground_width_ratio", "=", "0.25", ",", "foreground_position", "=", "(", "0.0", ",", "0.0", ")", ",", ")", ":", "if", "foreground_width_ratio", "<=", "0", ":", "return", "background_i...
d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e
train
lowres_tensor
Produces a tensor paramaterized by a interpolated lower resolution tensor. This is like what is done in a laplacian pyramid, but a bit more general. It can be a powerful way to describe images. Args: shape: desired shape of resulting tensor underlying_shape: shape of the tensor being resized into final ...
lucid/optvis/param/lowres.py
def lowres_tensor(shape, underlying_shape, offset=None, sd=None): """Produces a tensor paramaterized by a interpolated lower resolution tensor. This is like what is done in a laplacian pyramid, but a bit more general. It can be a powerful way to describe images. Args: shape: desired shape of resulting t...
def lowres_tensor(shape, underlying_shape, offset=None, sd=None): """Produces a tensor paramaterized by a interpolated lower resolution tensor. This is like what is done in a laplacian pyramid, but a bit more general. It can be a powerful way to describe images. Args: shape: desired shape of resulting t...
[ "Produces", "a", "tensor", "paramaterized", "by", "a", "interpolated", "lower", "resolution", "tensor", "." ]
tensorflow/lucid
python
https://github.com/tensorflow/lucid/blob/d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e/lucid/optvis/param/lowres.py#L24-L66
[ "def", "lowres_tensor", "(", "shape", ",", "underlying_shape", ",", "offset", "=", "None", ",", "sd", "=", "None", ")", ":", "sd", "=", "sd", "or", "0.01", "init_val", "=", "sd", "*", "np", ".", "random", ".", "randn", "(", "*", "underlying_shape", "...
d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e
train
create_session
Create an intractive TensorFlow session. Helper function that creates TF session that uses growing GPU memory allocation and opration timeout. 'allow_growth' flag prevents TF from allocating the whole GPU memory an once, which is useful when having multiple python sessions sharing the same GPU.
lucid/misc/tfutil.py
def create_session(target='', timeout_sec=10): '''Create an intractive TensorFlow session. Helper function that creates TF session that uses growing GPU memory allocation and opration timeout. 'allow_growth' flag prevents TF from allocating the whole GPU memory an once, which is useful when having multiple p...
def create_session(target='', timeout_sec=10): '''Create an intractive TensorFlow session. Helper function that creates TF session that uses growing GPU memory allocation and opration timeout. 'allow_growth' flag prevents TF from allocating the whole GPU memory an once, which is useful when having multiple p...
[ "Create", "an", "intractive", "TensorFlow", "session", "." ]
tensorflow/lucid
python
https://github.com/tensorflow/lucid/blob/d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e/lucid/misc/tfutil.py#L19-L31
[ "def", "create_session", "(", "target", "=", "''", ",", "timeout_sec", "=", "10", ")", ":", "graph", "=", "tf", ".", "Graph", "(", ")", "config", "=", "tf", ".", "ConfigProto", "(", ")", "config", ".", "gpu_options", ".", "allow_growth", "=", "True", ...
d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e
train
read
Read from any URL. Internally differentiates between URLs supported by tf.gfile, such as URLs with the Google Cloud Storage scheme ('gs://...') or local paths, and HTTP URLs. This way users don't need to know about the underlying fetch mechanism. Args: url: a URL including scheme or a local pa...
lucid/misc/io/reading.py
def read(url, encoding=None, cache=None, mode="rb"): """Read from any URL. Internally differentiates between URLs supported by tf.gfile, such as URLs with the Google Cloud Storage scheme ('gs://...') or local paths, and HTTP URLs. This way users don't need to know about the underlying fetch mechanism. ...
def read(url, encoding=None, cache=None, mode="rb"): """Read from any URL. Internally differentiates between URLs supported by tf.gfile, such as URLs with the Google Cloud Storage scheme ('gs://...') or local paths, and HTTP URLs. This way users don't need to know about the underlying fetch mechanism. ...
[ "Read", "from", "any", "URL", "." ]
tensorflow/lucid
python
https://github.com/tensorflow/lucid/blob/d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e/lucid/misc/io/reading.py#L48-L71
[ "def", "read", "(", "url", ",", "encoding", "=", "None", ",", "cache", "=", "None", ",", "mode", "=", "\"rb\"", ")", ":", "with", "read_handle", "(", "url", ",", "cache", ",", "mode", "=", "mode", ")", "as", "handle", ":", "data", "=", "handle", ...
d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e
train
read_handle
Read from any URL with a file handle. Use this to get a handle to a file rather than eagerly load the data: ``` with read_handle(url) as handle: result = something.load(handle) result.do_something() ``` When program execution leaves this `with` block, the handle will be closed autom...
lucid/misc/io/reading.py
def read_handle(url, cache=None, mode="rb"): """Read from any URL with a file handle. Use this to get a handle to a file rather than eagerly load the data: ``` with read_handle(url) as handle: result = something.load(handle) result.do_something() ``` When program execution leaves th...
def read_handle(url, cache=None, mode="rb"): """Read from any URL with a file handle. Use this to get a handle to a file rather than eagerly load the data: ``` with read_handle(url) as handle: result = something.load(handle) result.do_something() ``` When program execution leaves th...
[ "Read", "from", "any", "URL", "with", "a", "file", "handle", "." ]
tensorflow/lucid
python
https://github.com/tensorflow/lucid/blob/d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e/lucid/misc/io/reading.py#L75-L118
[ "def", "read_handle", "(", "url", ",", "cache", "=", "None", ",", "mode", "=", "\"rb\"", ")", ":", "scheme", "=", "urlparse", "(", "url", ")", ".", "scheme", "if", "cache", "==", "'purge'", ":", "_purge_cached", "(", "url", ")", "cache", "=", "None",...
d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e
train
local_cache_path
Returns the path that remote_url would be cached at locally.
lucid/misc/io/reading.py
def local_cache_path(remote_url): """Returns the path that remote_url would be cached at locally.""" local_name = RESERVED_PATH_CHARS.sub("_", remote_url) return os.path.join(gettempdir(), local_name)
def local_cache_path(remote_url): """Returns the path that remote_url would be cached at locally.""" local_name = RESERVED_PATH_CHARS.sub("_", remote_url) return os.path.join(gettempdir(), local_name)
[ "Returns", "the", "path", "that", "remote_url", "would", "be", "cached", "at", "locally", "." ]
tensorflow/lucid
python
https://github.com/tensorflow/lucid/blob/d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e/lucid/misc/io/reading.py#L142-L145
[ "def", "local_cache_path", "(", "remote_url", ")", ":", "local_name", "=", "RESERVED_PATH_CHARS", ".", "sub", "(", "\"_\"", ",", "remote_url", ")", "return", "os", ".", "path", ".", "join", "(", "gettempdir", "(", ")", ",", "local_name", ")" ]
d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e
train
cppn
Compositional Pattern Producing Network Args: width: width of resulting image, equals height batch: batch dimension of output, note that all params share the same weights! num_output_channels: num_hidden_channels: num_layers: activation_func: normalize: Returns: ...
lucid/optvis/param/cppn.py
def cppn( width, batch=1, num_output_channels=3, num_hidden_channels=24, num_layers=8, activation_func=_composite_activation, normalize=False, ): """Compositional Pattern Producing Network Args: width: width of resulting image, equals height batch: batch dimension of out...
def cppn( width, batch=1, num_output_channels=3, num_hidden_channels=24, num_layers=8, activation_func=_composite_activation, normalize=False, ): """Compositional Pattern Producing Network Args: width: width of resulting image, equals height batch: batch dimension of out...
[ "Compositional", "Pattern", "Producing", "Network" ]
tensorflow/lucid
python
https://github.com/tensorflow/lucid/blob/d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e/lucid/optvis/param/cppn.py#L54-L100
[ "def", "cppn", "(", "width", ",", "batch", "=", "1", ",", "num_output_channels", "=", "3", ",", "num_hidden_channels", "=", "24", ",", "num_layers", "=", "8", ",", "activation_func", "=", "_composite_activation", ",", "normalize", "=", "False", ",", ")", "...
d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e
train
get_model
Returns a model instance such as `model = vision_models.InceptionV1()`. In the future may be expanded to filter by additional criteria, such as architecture, dataset, and task the model was trained on. Args: name: The name of the model, as given by the class name in vision_models. Returns: A...
lucid/modelzoo/nets_factory.py
def get_model(name): """Returns a model instance such as `model = vision_models.InceptionV1()`. In the future may be expanded to filter by additional criteria, such as architecture, dataset, and task the model was trained on. Args: name: The name of the model, as given by the class name in vision_...
def get_model(name): """Returns a model instance such as `model = vision_models.InceptionV1()`. In the future may be expanded to filter by additional criteria, such as architecture, dataset, and task the model was trained on. Args: name: The name of the model, as given by the class name in vision_...
[ "Returns", "a", "model", "instance", "such", "as", "model", "=", "vision_models", ".", "InceptionV1", "()", ".", "In", "the", "future", "may", "be", "expanded", "to", "filter", "by", "additional", "criteria", "such", "as", "architecture", "dataset", "and", "...
tensorflow/lucid
python
https://github.com/tensorflow/lucid/blob/d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e/lucid/modelzoo/nets_factory.py#L44-L68
[ "def", "get_model", "(", "name", ")", ":", "if", "name", "not", "in", "models_map", ":", "candidates", "=", "filter", "(", "lambda", "key", ":", "name", "in", "key", ",", "models_map", ".", "keys", "(", ")", ")", "candidates_string", "=", "\", \"", "."...
d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e
train
activation_atlas
Renders an Activation Atlas of the given model's layer.
lucid/recipes/activation_atlas/main.py
def activation_atlas( model, layer, grid_size=10, icon_size=96, number_activations=NUMBER_OF_AVAILABLE_SAMPLES, icon_batch_size=32, verbose=False, ): """Renders an Activation Atlas of the given model's layer.""" activations = layer.activations[:number_activations, ...] layout, =...
def activation_atlas( model, layer, grid_size=10, icon_size=96, number_activations=NUMBER_OF_AVAILABLE_SAMPLES, icon_batch_size=32, verbose=False, ): """Renders an Activation Atlas of the given model's layer.""" activations = layer.activations[:number_activations, ...] layout, =...
[ "Renders", "an", "Activation", "Atlas", "of", "the", "given", "model", "s", "layer", "." ]
tensorflow/lucid
python
https://github.com/tensorflow/lucid/blob/d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e/lucid/recipes/activation_atlas/main.py#L30-L54
[ "def", "activation_atlas", "(", "model", ",", "layer", ",", "grid_size", "=", "10", ",", "icon_size", "=", "96", ",", "number_activations", "=", "NUMBER_OF_AVAILABLE_SAMPLES", ",", "icon_batch_size", "=", "32", ",", "verbose", "=", "False", ",", ")", ":", "a...
d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e
train
aligned_activation_atlas
Renders two aligned Activation Atlases of the given models' layers. Returns a generator of the two atlasses, and a nested generator for intermediate atlasses while they're being rendered.
lucid/recipes/activation_atlas/main.py
def aligned_activation_atlas( model1, layer1, model2, layer2, grid_size=10, icon_size=80, num_steps=1024, whiten_layers=True, number_activations=NUMBER_OF_AVAILABLE_SAMPLES, icon_batch_size=32, verbose=False, ): """Renders two aligned Activation Atlases of the given model...
def aligned_activation_atlas( model1, layer1, model2, layer2, grid_size=10, icon_size=80, num_steps=1024, whiten_layers=True, number_activations=NUMBER_OF_AVAILABLE_SAMPLES, icon_batch_size=32, verbose=False, ): """Renders two aligned Activation Atlases of the given model...
[ "Renders", "two", "aligned", "Activation", "Atlases", "of", "the", "given", "models", "layers", "." ]
tensorflow/lucid
python
https://github.com/tensorflow/lucid/blob/d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e/lucid/recipes/activation_atlas/main.py#L57-L100
[ "def", "aligned_activation_atlas", "(", "model1", ",", "layer1", ",", "model2", ",", "layer2", ",", "grid_size", "=", "10", ",", "icon_size", "=", "80", ",", "num_steps", "=", "1024", ",", "whiten_layers", "=", "True", ",", "number_activations", "=", "NUMBER...
d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e
train
_combine_activations
Given two layers, combines their activations according to mode. ActivationTranslation.ONE_TO_TWO: Translate activations of layer1 into the space of layer2, and return a tuple of the translated activations and the original layer2 activations. ActivationTranslation.BIDIRECTIONAL: Translate act...
lucid/recipes/activation_atlas/main.py
def _combine_activations( layer1, layer2, activations1=None, activations2=None, mode=ActivationTranslation.BIDIRECTIONAL, number_activations=NUMBER_OF_AVAILABLE_SAMPLES, ): """Given two layers, combines their activations according to mode. ActivationTranslation.ONE_TO_TWO: Transla...
def _combine_activations( layer1, layer2, activations1=None, activations2=None, mode=ActivationTranslation.BIDIRECTIONAL, number_activations=NUMBER_OF_AVAILABLE_SAMPLES, ): """Given two layers, combines their activations according to mode. ActivationTranslation.ONE_TO_TWO: Transla...
[ "Given", "two", "layers", "combines", "their", "activations", "according", "to", "mode", "." ]
tensorflow/lucid
python
https://github.com/tensorflow/lucid/blob/d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e/lucid/recipes/activation_atlas/main.py#L111-L146
[ "def", "_combine_activations", "(", "layer1", ",", "layer2", ",", "activations1", "=", "None", ",", "activations2", "=", "None", ",", "mode", "=", "ActivationTranslation", ".", "BIDIRECTIONAL", ",", "number_activations", "=", "NUMBER_OF_AVAILABLE_SAMPLES", ",", ")",...
d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e
train
bin_laid_out_activations
Given a layout and activations, overlays a grid on the layout and returns averaged activations for each grid cell. If a cell contains less than `threshold` activations it will be discarded, so the number of returned data is variable.
lucid/recipes/activation_atlas/main.py
def bin_laid_out_activations(layout, activations, grid_size, threshold=5): """Given a layout and activations, overlays a grid on the layout and returns averaged activations for each grid cell. If a cell contains less than `threshold` activations it will be discarded, so the number of returned data is variab...
def bin_laid_out_activations(layout, activations, grid_size, threshold=5): """Given a layout and activations, overlays a grid on the layout and returns averaged activations for each grid cell. If a cell contains less than `threshold` activations it will be discarded, so the number of returned data is variab...
[ "Given", "a", "layout", "and", "activations", "overlays", "a", "grid", "on", "the", "layout", "and", "returns", "averaged", "activations", "for", "each", "grid", "cell", ".", "If", "a", "cell", "contains", "less", "than", "threshold", "activations", "it", "w...
tensorflow/lucid
python
https://github.com/tensorflow/lucid/blob/d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e/lucid/recipes/activation_atlas/main.py#L149-L180
[ "def", "bin_laid_out_activations", "(", "layout", ",", "activations", ",", "grid_size", ",", "threshold", "=", "5", ")", ":", "assert", "layout", ".", "shape", "[", "0", "]", "==", "activations", ".", "shape", "[", "0", "]", "# calculate which grid cells each ...
d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e
train
load_graphdef
Load GraphDef from a binary proto file.
lucid/modelzoo/util.py
def load_graphdef(model_url, reset_device=True): """Load GraphDef from a binary proto file.""" graph_def = load(model_url) if reset_device: for n in graph_def.node: n.device = "" return graph_def
def load_graphdef(model_url, reset_device=True): """Load GraphDef from a binary proto file.""" graph_def = load(model_url) if reset_device: for n in graph_def.node: n.device = "" return graph_def
[ "Load", "GraphDef", "from", "a", "binary", "proto", "file", "." ]
tensorflow/lucid
python
https://github.com/tensorflow/lucid/blob/d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e/lucid/modelzoo/util.py#L39-L47
[ "def", "load_graphdef", "(", "model_url", ",", "reset_device", "=", "True", ")", ":", "graph_def", "=", "load", "(", "model_url", ")", "if", "reset_device", ":", "for", "n", "in", "graph_def", ".", "node", ":", "n", ".", "device", "=", "\"\"", "return", ...
d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e
train
forget_xy
Ignore sizes of dimensions (1, 2) of a 4d tensor in shape inference. This allows using smaller input sizes, which create an invalid graph at higher layers (for example because a spatial dimension becomes smaller than a conv filter) when we only use early parts of it.
lucid/modelzoo/util.py
def forget_xy(t): """Ignore sizes of dimensions (1, 2) of a 4d tensor in shape inference. This allows using smaller input sizes, which create an invalid graph at higher layers (for example because a spatial dimension becomes smaller than a conv filter) when we only use early parts of it. """ shape = (t.sha...
def forget_xy(t): """Ignore sizes of dimensions (1, 2) of a 4d tensor in shape inference. This allows using smaller input sizes, which create an invalid graph at higher layers (for example because a spatial dimension becomes smaller than a conv filter) when we only use early parts of it. """ shape = (t.sha...
[ "Ignore", "sizes", "of", "dimensions", "(", "1", "2", ")", "of", "a", "4d", "tensor", "in", "shape", "inference", "." ]
tensorflow/lucid
python
https://github.com/tensorflow/lucid/blob/d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e/lucid/modelzoo/util.py#L50-L58
[ "def", "forget_xy", "(", "t", ")", ":", "shape", "=", "(", "t", ".", "shape", "[", "0", "]", ",", "None", ",", "None", ",", "t", ".", "shape", "[", "3", "]", ")", "return", "tf", ".", "placeholder_with_default", "(", "t", ",", "shape", ")" ]
d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e
train
frozen_default_graph_def
Return frozen and simplified graph_def of default graph.
lucid/modelzoo/util.py
def frozen_default_graph_def(input_node_names, output_node_names): """Return frozen and simplified graph_def of default graph.""" sess = tf.get_default_session() input_graph_def = tf.get_default_graph().as_graph_def() pruned_graph = tf.graph_util.remove_training_nodes( input_graph_def, protected_nodes=(...
def frozen_default_graph_def(input_node_names, output_node_names): """Return frozen and simplified graph_def of default graph.""" sess = tf.get_default_session() input_graph_def = tf.get_default_graph().as_graph_def() pruned_graph = tf.graph_util.remove_training_nodes( input_graph_def, protected_nodes=(...
[ "Return", "frozen", "and", "simplified", "graph_def", "of", "default", "graph", "." ]
tensorflow/lucid
python
https://github.com/tensorflow/lucid/blob/d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e/lucid/modelzoo/util.py#L61-L84
[ "def", "frozen_default_graph_def", "(", "input_node_names", ",", "output_node_names", ")", ":", "sess", "=", "tf", ".", "get_default_session", "(", ")", "input_graph_def", "=", "tf", ".", "get_default_graph", "(", ")", ".", "as_graph_def", "(", ")", "pruned_graph"...
d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e
train
infuse_metadata
Embed meta data as a string constant in a TF graph. This function takes info, converts it into json, and embeds it in graph_def as a constant op called `__lucid_metadata_json`.
lucid/modelzoo/util.py
def infuse_metadata(graph_def, info): """Embed meta data as a string constant in a TF graph. This function takes info, converts it into json, and embeds it in graph_def as a constant op called `__lucid_metadata_json`. """ temp_graph = tf.Graph() with temp_graph.as_default(): tf.constant(json.dumps(info...
def infuse_metadata(graph_def, info): """Embed meta data as a string constant in a TF graph. This function takes info, converts it into json, and embeds it in graph_def as a constant op called `__lucid_metadata_json`. """ temp_graph = tf.Graph() with temp_graph.as_default(): tf.constant(json.dumps(info...
[ "Embed", "meta", "data", "as", "a", "string", "constant", "in", "a", "TF", "graph", "." ]
tensorflow/lucid
python
https://github.com/tensorflow/lucid/blob/d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e/lucid/modelzoo/util.py#L89-L99
[ "def", "infuse_metadata", "(", "graph_def", ",", "info", ")", ":", "temp_graph", "=", "tf", ".", "Graph", "(", ")", "with", "temp_graph", ".", "as_default", "(", ")", ":", "tf", ".", "constant", "(", "json", ".", "dumps", "(", "info", ",", "cls", "="...
d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e
train
extract_metadata
Attempt to extract meta data hidden in graph_def. Looks for a `__lucid_metadata_json` constant string op. If present, extract it's content and convert it from json to python. If not, returns None.
lucid/modelzoo/util.py
def extract_metadata(graph_def): """Attempt to extract meta data hidden in graph_def. Looks for a `__lucid_metadata_json` constant string op. If present, extract it's content and convert it from json to python. If not, returns None. """ meta_matches = [n for n in graph_def.node if n.name==metadata_node_nam...
def extract_metadata(graph_def): """Attempt to extract meta data hidden in graph_def. Looks for a `__lucid_metadata_json` constant string op. If present, extract it's content and convert it from json to python. If not, returns None. """ meta_matches = [n for n in graph_def.node if n.name==metadata_node_nam...
[ "Attempt", "to", "extract", "meta", "data", "hidden", "in", "graph_def", "." ]
tensorflow/lucid
python
https://github.com/tensorflow/lucid/blob/d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e/lucid/modelzoo/util.py#L102-L115
[ "def", "extract_metadata", "(", "graph_def", ")", ":", "meta_matches", "=", "[", "n", "for", "n", "in", "graph_def", ".", "node", "if", "n", ".", "name", "==", "metadata_node_name", "]", "if", "meta_matches", ":", "assert", "len", "(", "meta_matches", ")",...
d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e
train
GraphDefHelper.neighborhood
Am I really handcoding graph traversal please no
lucid/modelzoo/util.py
def neighborhood(self, node, degree=4): """Am I really handcoding graph traversal please no""" assert self.by_name[node.name] == node already_visited = frontier = set([node.name]) for _ in range(degree): neighbor_names = set() for node_name in frontier: outgoing = set(n.name for n in...
def neighborhood(self, node, degree=4): """Am I really handcoding graph traversal please no""" assert self.by_name[node.name] == node already_visited = frontier = set([node.name]) for _ in range(degree): neighbor_names = set() for node_name in frontier: outgoing = set(n.name for n in...
[ "Am", "I", "really", "handcoding", "graph", "traversal", "please", "no" ]
tensorflow/lucid
python
https://github.com/tensorflow/lucid/blob/d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e/lucid/modelzoo/util.py#L135-L147
[ "def", "neighborhood", "(", "self", ",", "node", ",", "degree", "=", "4", ")", ":", "assert", "self", ".", "by_name", "[", "node", ".", "name", "]", "==", "node", "already_visited", "=", "frontier", "=", "set", "(", "[", "node", ".", "name", "]", "...
d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e
train
HistoryIterator._retrieve_messages_before_strategy
Retrieve messages using before parameter.
discord/iterators.py
async def _retrieve_messages_before_strategy(self, retrieve): """Retrieve messages using before parameter.""" before = self.before.id if self.before else None data = await self.logs_from(self.channel.id, retrieve, before=before) if len(data): if self.limit is not None: ...
async def _retrieve_messages_before_strategy(self, retrieve): """Retrieve messages using before parameter.""" before = self.before.id if self.before else None data = await self.logs_from(self.channel.id, retrieve, before=before) if len(data): if self.limit is not None: ...
[ "Retrieve", "messages", "using", "before", "parameter", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/iterators.py#L325-L333
[ "async", "def", "_retrieve_messages_before_strategy", "(", "self", ",", "retrieve", ")", ":", "before", "=", "self", ".", "before", ".", "id", "if", "self", ".", "before", "else", "None", "data", "=", "await", "self", ".", "logs_from", "(", "self", ".", ...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
HistoryIterator._retrieve_messages_after_strategy
Retrieve messages using after parameter.
discord/iterators.py
async def _retrieve_messages_after_strategy(self, retrieve): """Retrieve messages using after parameter.""" after = self.after.id if self.after else None data = await self.logs_from(self.channel.id, retrieve, after=after) if len(data): if self.limit is not None: ...
async def _retrieve_messages_after_strategy(self, retrieve): """Retrieve messages using after parameter.""" after = self.after.id if self.after else None data = await self.logs_from(self.channel.id, retrieve, after=after) if len(data): if self.limit is not None: ...
[ "Retrieve", "messages", "using", "after", "parameter", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/iterators.py#L335-L343
[ "async", "def", "_retrieve_messages_after_strategy", "(", "self", ",", "retrieve", ")", ":", "after", "=", "self", ".", "after", ".", "id", "if", "self", ".", "after", "else", "None", "data", "=", "await", "self", ".", "logs_from", "(", "self", ".", "cha...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
HistoryIterator._retrieve_messages_around_strategy
Retrieve messages using around parameter.
discord/iterators.py
async def _retrieve_messages_around_strategy(self, retrieve): """Retrieve messages using around parameter.""" if self.around: around = self.around.id if self.around else None data = await self.logs_from(self.channel.id, retrieve, around=around) self.around = None ...
async def _retrieve_messages_around_strategy(self, retrieve): """Retrieve messages using around parameter.""" if self.around: around = self.around.id if self.around else None data = await self.logs_from(self.channel.id, retrieve, around=around) self.around = None ...
[ "Retrieve", "messages", "using", "around", "parameter", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/iterators.py#L345-L352
[ "async", "def", "_retrieve_messages_around_strategy", "(", "self", ",", "retrieve", ")", ":", "if", "self", ".", "around", ":", "around", "=", "self", ".", "around", ".", "id", "if", "self", ".", "around", "else", "None", "data", "=", "await", "self", "....
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
GuildIterator._retrieve_guilds_before_strategy
Retrieve guilds using before parameter.
discord/iterators.py
async def _retrieve_guilds_before_strategy(self, retrieve): """Retrieve guilds using before parameter.""" before = self.before.id if self.before else None data = await self.get_guilds(retrieve, before=before) if len(data): if self.limit is not None: self.limit...
async def _retrieve_guilds_before_strategy(self, retrieve): """Retrieve guilds using before parameter.""" before = self.before.id if self.before else None data = await self.get_guilds(retrieve, before=before) if len(data): if self.limit is not None: self.limit...
[ "Retrieve", "guilds", "using", "before", "parameter", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/iterators.py#L571-L579
[ "async", "def", "_retrieve_guilds_before_strategy", "(", "self", ",", "retrieve", ")", ":", "before", "=", "self", ".", "before", ".", "id", "if", "self", ".", "before", "else", "None", "data", "=", "await", "self", ".", "get_guilds", "(", "retrieve", ",",...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
GuildIterator._retrieve_guilds_after_strategy
Retrieve guilds using after parameter.
discord/iterators.py
async def _retrieve_guilds_after_strategy(self, retrieve): """Retrieve guilds using after parameter.""" after = self.after.id if self.after else None data = await self.get_guilds(retrieve, after=after) if len(data): if self.limit is not None: self.limit -= ret...
async def _retrieve_guilds_after_strategy(self, retrieve): """Retrieve guilds using after parameter.""" after = self.after.id if self.after else None data = await self.get_guilds(retrieve, after=after) if len(data): if self.limit is not None: self.limit -= ret...
[ "Retrieve", "guilds", "using", "after", "parameter", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/iterators.py#L581-L589
[ "async", "def", "_retrieve_guilds_after_strategy", "(", "self", ",", "retrieve", ")", ":", "after", "=", "self", ".", "after", ".", "id", "if", "self", ".", "after", "else", "None", "data", "=", "await", "self", ".", "get_guilds", "(", "retrieve", ",", "...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
Widget.fetch_invite
|coro| Retrieves an :class:`Invite` from a invite URL or ID. This is the same as :meth:`Client.get_invite`; the invite code is abstracted away. Parameters ----------- with_counts: :class:`bool` Whether to include count information in the invite. This fills t...
discord/widget.py
async def fetch_invite(self, *, with_counts=True): """|coro| Retrieves an :class:`Invite` from a invite URL or ID. This is the same as :meth:`Client.get_invite`; the invite code is abstracted away. Parameters ----------- with_counts: :class:`bool` Wh...
async def fetch_invite(self, *, with_counts=True): """|coro| Retrieves an :class:`Invite` from a invite URL or ID. This is the same as :meth:`Client.get_invite`; the invite code is abstracted away. Parameters ----------- with_counts: :class:`bool` Wh...
[ "|coro|" ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/widget.py#L228-L250
[ "async", "def", "fetch_invite", "(", "self", ",", "*", ",", "with_counts", "=", "True", ")", ":", "if", "self", ".", "_invite", ":", "invite_id", "=", "resolve_invite", "(", "self", ".", "_invite", ")", "data", "=", "await", "self", ".", "_state", ".",...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
Colour.from_hsv
Constructs a :class:`Colour` from an HSV tuple.
discord/colour.py
def from_hsv(cls, h, s, v): """Constructs a :class:`Colour` from an HSV tuple.""" rgb = colorsys.hsv_to_rgb(h, s, v) return cls.from_rgb(*(int(x * 255) for x in rgb))
def from_hsv(cls, h, s, v): """Constructs a :class:`Colour` from an HSV tuple.""" rgb = colorsys.hsv_to_rgb(h, s, v) return cls.from_rgb(*(int(x * 255) for x in rgb))
[ "Constructs", "a", ":", "class", ":", "Colour", "from", "an", "HSV", "tuple", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/colour.py#L110-L113
[ "def", "from_hsv", "(", "cls", ",", "h", ",", "s", ",", "v", ")", ":", "rgb", "=", "colorsys", ".", "hsv_to_rgb", "(", "h", ",", "s", ",", "v", ")", "return", "cls", ".", "from_rgb", "(", "*", "(", "int", "(", "x", "*", "255", ")", "for", "...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
Cog.description
:class:`str`: Returns the cog's description, typically the cleaned docstring.
discord/ext/commands/cog.py
def description(self): """:class:`str`: Returns the cog's description, typically the cleaned docstring.""" try: return self.__cog_cleaned_doc__ except AttributeError: self.__cog_cleaned_doc__ = cleaned = inspect.getdoc(self) return cleaned
def description(self): """:class:`str`: Returns the cog's description, typically the cleaned docstring.""" try: return self.__cog_cleaned_doc__ except AttributeError: self.__cog_cleaned_doc__ = cleaned = inspect.getdoc(self) return cleaned
[ ":", "class", ":", "str", ":", "Returns", "the", "cog", "s", "description", "typically", "the", "cleaned", "docstring", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/cog.py#L206-L212
[ "def", "description", "(", "self", ")", ":", "try", ":", "return", "self", ".", "__cog_cleaned_doc__", "except", "AttributeError", ":", "self", ".", "__cog_cleaned_doc__", "=", "cleaned", "=", "inspect", ".", "getdoc", "(", "self", ")", "return", "cleaned" ]
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
Cog.walk_commands
An iterator that recursively walks through this cog's commands and subcommands.
discord/ext/commands/cog.py
def walk_commands(self): """An iterator that recursively walks through this cog's commands and subcommands.""" from .core import GroupMixin for command in self.__cog_commands__: if command.parent is None: yield command if isinstance(command, GroupMixin...
def walk_commands(self): """An iterator that recursively walks through this cog's commands and subcommands.""" from .core import GroupMixin for command in self.__cog_commands__: if command.parent is None: yield command if isinstance(command, GroupMixin...
[ "An", "iterator", "that", "recursively", "walks", "through", "this", "cog", "s", "commands", "and", "subcommands", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/cog.py#L214-L221
[ "def", "walk_commands", "(", "self", ")", ":", "from", ".", "core", "import", "GroupMixin", "for", "command", "in", "self", ".", "__cog_commands__", ":", "if", "command", ".", "parent", "is", "None", ":", "yield", "command", "if", "isinstance", "(", "comma...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
Cog.get_listeners
Returns a :class:`list` of (name, function) listener pairs that are defined in this cog.
discord/ext/commands/cog.py
def get_listeners(self): """Returns a :class:`list` of (name, function) listener pairs that are defined in this cog.""" return [(name, getattr(self, method_name)) for name, method_name in self.__cog_listeners__]
def get_listeners(self): """Returns a :class:`list` of (name, function) listener pairs that are defined in this cog.""" return [(name, getattr(self, method_name)) for name, method_name in self.__cog_listeners__]
[ "Returns", "a", ":", "class", ":", "list", "of", "(", "name", "function", ")", "listener", "pairs", "that", "are", "defined", "in", "this", "cog", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/cog.py#L223-L225
[ "def", "get_listeners", "(", "self", ")", ":", "return", "[", "(", "name", ",", "getattr", "(", "self", ",", "method_name", ")", ")", "for", "name", ",", "method_name", "in", "self", ".", "__cog_listeners__", "]" ]
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
Cog.listener
A decorator that marks a function as a listener. This is the cog equivalent of :meth:`.Bot.listen`. Parameters ------------ name: :class:`str` The name of the event being listened to. If not provided, it defaults to the function's name. Raises -...
discord/ext/commands/cog.py
def listener(cls, name=None): """A decorator that marks a function as a listener. This is the cog equivalent of :meth:`.Bot.listen`. Parameters ------------ name: :class:`str` The name of the event being listened to. If not provided, it defaults to the f...
def listener(cls, name=None): """A decorator that marks a function as a listener. This is the cog equivalent of :meth:`.Bot.listen`. Parameters ------------ name: :class:`str` The name of the event being listened to. If not provided, it defaults to the f...
[ "A", "decorator", "that", "marks", "a", "function", "as", "a", "listener", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/cog.py#L233-L271
[ "def", "listener", "(", "cls", ",", "name", "=", "None", ")", ":", "if", "name", "is", "not", "None", "and", "not", "isinstance", "(", "name", ",", "str", ")", ":", "raise", "TypeError", "(", "'Cog.listener expected str but received {0.__class__.__name__!r} inst...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
Embed.set_footer
Sets the footer for the embed content. This function returns the class instance to allow for fluent-style chaining. Parameters ----------- text: :class:`str` The footer text. icon_url: :class:`str` The URL of the footer icon. Only HTTP(S) is supp...
discord/embeds.py
def set_footer(self, *, text=EmptyEmbed, icon_url=EmptyEmbed): """Sets the footer for the embed content. This function returns the class instance to allow for fluent-style chaining. Parameters ----------- text: :class:`str` The footer text. icon_url:...
def set_footer(self, *, text=EmptyEmbed, icon_url=EmptyEmbed): """Sets the footer for the embed content. This function returns the class instance to allow for fluent-style chaining. Parameters ----------- text: :class:`str` The footer text. icon_url:...
[ "Sets", "the", "footer", "for", "the", "embed", "content", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/embeds.py#L233-L254
[ "def", "set_footer", "(", "self", ",", "*", ",", "text", "=", "EmptyEmbed", ",", "icon_url", "=", "EmptyEmbed", ")", ":", "self", ".", "_footer", "=", "{", "}", "if", "text", "is", "not", "EmptyEmbed", ":", "self", ".", "_footer", "[", "'text'", "]",...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
Embed.set_author
Sets the author for the embed content. This function returns the class instance to allow for fluent-style chaining. Parameters ----------- name: :class:`str` The name of the author. url: :class:`str` The URL for the author. icon_url: :cla...
discord/embeds.py
def set_author(self, *, name, url=EmptyEmbed, icon_url=EmptyEmbed): """Sets the author for the embed content. This function returns the class instance to allow for fluent-style chaining. Parameters ----------- name: :class:`str` The name of the author. ...
def set_author(self, *, name, url=EmptyEmbed, icon_url=EmptyEmbed): """Sets the author for the embed content. This function returns the class instance to allow for fluent-style chaining. Parameters ----------- name: :class:`str` The name of the author. ...
[ "Sets", "the", "author", "for", "the", "embed", "content", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/embeds.py#L356-L382
[ "def", "set_author", "(", "self", ",", "*", ",", "name", ",", "url", "=", "EmptyEmbed", ",", "icon_url", "=", "EmptyEmbed", ")", ":", "self", ".", "_author", "=", "{", "'name'", ":", "str", "(", "name", ")", "}", "if", "url", "is", "not", "EmptyEmb...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
Embed.add_field
Adds a field to the embed object. This function returns the class instance to allow for fluent-style chaining. Parameters ----------- name: :class:`str` The name of the field. value: :class:`str` The value of the field. inline: :class:`bo...
discord/embeds.py
def add_field(self, *, name, value, inline=True): """Adds a field to the embed object. This function returns the class instance to allow for fluent-style chaining. Parameters ----------- name: :class:`str` The name of the field. value: :class:`str` ...
def add_field(self, *, name, value, inline=True): """Adds a field to the embed object. This function returns the class instance to allow for fluent-style chaining. Parameters ----------- name: :class:`str` The name of the field. value: :class:`str` ...
[ "Adds", "a", "field", "to", "the", "embed", "object", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/embeds.py#L394-L421
[ "def", "add_field", "(", "self", ",", "*", ",", "name", ",", "value", ",", "inline", "=", "True", ")", ":", "field", "=", "{", "'inline'", ":", "inline", ",", "'name'", ":", "str", "(", "name", ")", ",", "'value'", ":", "str", "(", "value", ")", ...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
Embed.set_field_at
Modifies a field to the embed object. The index must point to a valid pre-existing field. This function returns the class instance to allow for fluent-style chaining. Parameters ----------- index: :class:`int` The index of the field to modify. name:...
discord/embeds.py
def set_field_at(self, index, *, name, value, inline=True): """Modifies a field to the embed object. The index must point to a valid pre-existing field. This function returns the class instance to allow for fluent-style chaining. Parameters ----------- index: :...
def set_field_at(self, index, *, name, value, inline=True): """Modifies a field to the embed object. The index must point to a valid pre-existing field. This function returns the class instance to allow for fluent-style chaining. Parameters ----------- index: :...
[ "Modifies", "a", "field", "to", "the", "embed", "object", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/embeds.py#L451-L484
[ "def", "set_field_at", "(", "self", ",", "index", ",", "*", ",", "name", ",", "value", ",", "inline", "=", "True", ")", ":", "try", ":", "field", "=", "self", ".", "_fields", "[", "index", "]", "except", "(", "TypeError", ",", "IndexError", ",", "A...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
Embed.to_dict
Converts this embed object into a dict.
discord/embeds.py
def to_dict(self): """Converts this embed object into a dict.""" # add in the raw data into the dict result = { key[1:]: getattr(self, key) for key in self.__slots__ if key[0] == '_' and hasattr(self, key) } # deal with basic convenience wrap...
def to_dict(self): """Converts this embed object into a dict.""" # add in the raw data into the dict result = { key[1:]: getattr(self, key) for key in self.__slots__ if key[0] == '_' and hasattr(self, key) } # deal with basic convenience wrap...
[ "Converts", "this", "embed", "object", "into", "a", "dict", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/embeds.py#L486-L530
[ "def", "to_dict", "(", "self", ")", ":", "# add in the raw data into the dict", "result", "=", "{", "key", "[", "1", ":", "]", ":", "getattr", "(", "self", ",", "key", ")", "for", "key", "in", "self", ".", "__slots__", "if", "key", "[", "0", "]", "==...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
BaseUser.avatar_url_as
Returns a friendly URL version of the avatar the user has. If the user does not have a traditional avatar, their default avatar URL is returned instead. The format must be one of 'webp', 'jpeg', 'jpg', 'png' or 'gif', and 'gif' is only valid for animated avatars. The size must be a pow...
discord/user.py
def avatar_url_as(self, *, format=None, static_format='webp', size=1024): """Returns a friendly URL version of the avatar the user has. If the user does not have a traditional avatar, their default avatar URL is returned instead. The format must be one of 'webp', 'jpeg', 'jpg', 'png' o...
def avatar_url_as(self, *, format=None, static_format='webp', size=1024): """Returns a friendly URL version of the avatar the user has. If the user does not have a traditional avatar, their default avatar URL is returned instead. The format must be one of 'webp', 'jpeg', 'jpg', 'png' o...
[ "Returns", "a", "friendly", "URL", "version", "of", "the", "avatar", "the", "user", "has", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/user.py#L131-L165
[ "def", "avatar_url_as", "(", "self", ",", "*", ",", "format", "=", "None", ",", "static_format", "=", "'webp'", ",", "size", "=", "1024", ")", ":", "return", "Asset", ".", "_from_avatar", "(", "self", ".", "_state", ",", "self", ",", "format", "=", "...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
BaseUser.mentioned_in
Checks if the user is mentioned in the specified message. Parameters ----------- message: :class:`Message` The message to check if you're mentioned in.
discord/user.py
def mentioned_in(self, message): """Checks if the user is mentioned in the specified message. Parameters ----------- message: :class:`Message` The message to check if you're mentioned in. """ if message.mention_everyone: return True for ...
def mentioned_in(self, message): """Checks if the user is mentioned in the specified message. Parameters ----------- message: :class:`Message` The message to check if you're mentioned in. """ if message.mention_everyone: return True for ...
[ "Checks", "if", "the", "user", "is", "mentioned", "in", "the", "specified", "message", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/user.py#L226-L242
[ "def", "mentioned_in", "(", "self", ",", "message", ")", ":", "if", "message", ".", "mention_everyone", ":", "return", "True", "for", "user", "in", "message", ".", "mentions", ":", "if", "user", ".", "id", "==", "self", ".", "id", ":", "return", "True"...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
ClientUser.friends
r"""Returns a :class:`list` of :class:`User`\s that the user is friends with. .. note:: This only applies to non-bot accounts.
discord/user.py
def friends(self): r"""Returns a :class:`list` of :class:`User`\s that the user is friends with. .. note:: This only applies to non-bot accounts. """ return [r.user for r in self._relationships.values() if r.type is RelationshipType.friend]
def friends(self): r"""Returns a :class:`list` of :class:`User`\s that the user is friends with. .. note:: This only applies to non-bot accounts. """ return [r.user for r in self._relationships.values() if r.type is RelationshipType.friend]
[ "r", "Returns", "a", ":", "class", ":", "list", "of", ":", "class", ":", "User", "\\", "s", "that", "the", "user", "is", "friends", "with", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/user.py#L342-L349
[ "def", "friends", "(", "self", ")", ":", "return", "[", "r", ".", "user", "for", "r", "in", "self", ".", "_relationships", ".", "values", "(", ")", "if", "r", ".", "type", "is", "RelationshipType", ".", "friend", "]" ]
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
ClientUser.blocked
r"""Returns a :class:`list` of :class:`User`\s that the user has blocked. .. note:: This only applies to non-bot accounts.
discord/user.py
def blocked(self): r"""Returns a :class:`list` of :class:`User`\s that the user has blocked. .. note:: This only applies to non-bot accounts. """ return [r.user for r in self._relationships.values() if r.type is RelationshipType.blocked]
def blocked(self): r"""Returns a :class:`list` of :class:`User`\s that the user has blocked. .. note:: This only applies to non-bot accounts. """ return [r.user for r in self._relationships.values() if r.type is RelationshipType.blocked]
[ "r", "Returns", "a", ":", "class", ":", "list", "of", ":", "class", ":", "User", "\\", "s", "that", "the", "user", "has", "blocked", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/user.py#L352-L359
[ "def", "blocked", "(", "self", ")", ":", "return", "[", "r", ".", "user", "for", "r", "in", "self", ".", "_relationships", ".", "values", "(", ")", "if", "r", ".", "type", "is", "RelationshipType", ".", "blocked", "]" ]
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
ClientUser.edit
|coro| Edits the current profile of the client. If a bot account is used then a password field is optional, otherwise it is required. Note ----- To upload an avatar, a :term:`py:bytes-like object` must be passed in that represents the image being uploaded. If t...
discord/user.py
async def edit(self, **fields): """|coro| Edits the current profile of the client. If a bot account is used then a password field is optional, otherwise it is required. Note ----- To upload an avatar, a :term:`py:bytes-like object` must be passed in that ...
async def edit(self, **fields): """|coro| Edits the current profile of the client. If a bot account is used then a password field is optional, otherwise it is required. Note ----- To upload an avatar, a :term:`py:bytes-like object` must be passed in that ...
[ "|coro|" ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/user.py#L361-L458
[ "async", "def", "edit", "(", "self", ",", "*", "*", "fields", ")", ":", "try", ":", "avatar_bytes", "=", "fields", "[", "'avatar'", "]", "except", "KeyError", ":", "avatar", "=", "self", ".", "avatar", "else", ":", "if", "avatar_bytes", "is", "not", ...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
ClientUser.create_group
r"""|coro| Creates a group direct message with the recipients provided. These recipients must be have a relationship of type :attr:`RelationshipType.friend`. .. note:: This only applies to non-bot accounts. Parameters ----------- \*recipients: :cla...
discord/user.py
async def create_group(self, *recipients): r"""|coro| Creates a group direct message with the recipients provided. These recipients must be have a relationship of type :attr:`RelationshipType.friend`. .. note:: This only applies to non-bot accounts. Parame...
async def create_group(self, *recipients): r"""|coro| Creates a group direct message with the recipients provided. These recipients must be have a relationship of type :attr:`RelationshipType.friend`. .. note:: This only applies to non-bot accounts. Parame...
[ "r", "|coro|" ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/user.py#L460-L498
[ "async", "def", "create_group", "(", "self", ",", "*", "recipients", ")", ":", "from", ".", "channel", "import", "GroupChannel", "if", "len", "(", "recipients", ")", "<", "2", ":", "raise", "ClientException", "(", "'You must have two or more recipients to create a...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
ClientUser.edit_settings
|coro| Edits the client user's settings. .. note:: This only applies to non-bot accounts. Parameters ------- afk_timeout: :class:`int` How long (in seconds) the user needs to be AFK until Discord sends push notifications to your mobile devi...
discord/user.py
async def edit_settings(self, **kwargs): """|coro| Edits the client user's settings. .. note:: This only applies to non-bot accounts. Parameters ------- afk_timeout: :class:`int` How long (in seconds) the user needs to be AFK until Discord ...
async def edit_settings(self, **kwargs): """|coro| Edits the client user's settings. .. note:: This only applies to non-bot accounts. Parameters ------- afk_timeout: :class:`int` How long (in seconds) the user needs to be AFK until Discord ...
[ "|coro|" ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/user.py#L500-L609
[ "async", "def", "edit_settings", "(", "self", ",", "*", "*", "kwargs", ")", ":", "payload", "=", "{", "}", "content_filter", "=", "kwargs", ".", "pop", "(", "'explicit_content_filter'", ",", "None", ")", "if", "content_filter", ":", "payload", ".", "update...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
User.create_dm
Creates a :class:`DMChannel` with this user. This should be rarely called, as this is done transparently for most people.
discord/user.py
async def create_dm(self): """Creates a :class:`DMChannel` with this user. This should be rarely called, as this is done transparently for most people. """ found = self.dm_channel if found is not None: return found state = self._state data = ...
async def create_dm(self): """Creates a :class:`DMChannel` with this user. This should be rarely called, as this is done transparently for most people. """ found = self.dm_channel if found is not None: return found state = self._state data = ...
[ "Creates", "a", ":", "class", ":", "DMChannel", "with", "this", "user", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/user.py#L664-L676
[ "async", "def", "create_dm", "(", "self", ")", ":", "found", "=", "self", ".", "dm_channel", "if", "found", "is", "not", "None", ":", "return", "found", "state", "=", "self", ".", "_state", "data", "=", "await", "state", ".", "http", ".", "start_privat...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
User.mutual_friends
|coro| Gets all mutual friends of this user. .. note:: This only applies to non-bot accounts. Raises ------- Forbidden Not allowed to get mutual friends of this user. HTTPException Getting mutual friends failed. Returns ...
discord/user.py
async def mutual_friends(self): """|coro| Gets all mutual friends of this user. .. note:: This only applies to non-bot accounts. Raises ------- Forbidden Not allowed to get mutual friends of this user. HTTPException Getting ...
async def mutual_friends(self): """|coro| Gets all mutual friends of this user. .. note:: This only applies to non-bot accounts. Raises ------- Forbidden Not allowed to get mutual friends of this user. HTTPException Getting ...
[ "|coro|" ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/user.py#L688-L711
[ "async", "def", "mutual_friends", "(", "self", ")", ":", "state", "=", "self", ".", "_state", "mutuals", "=", "await", "state", ".", "http", ".", "get_mutual_friends", "(", "self", ".", "id", ")", "return", "[", "User", "(", "state", "=", "state", ",",...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
User.is_friend
:class:`bool`: Checks if the user is your friend. .. note:: This only applies to non-bot accounts.
discord/user.py
def is_friend(self): """:class:`bool`: Checks if the user is your friend. .. note:: This only applies to non-bot accounts. """ r = self.relationship if r is None: return False return r.type is RelationshipType.friend
def is_friend(self): """:class:`bool`: Checks if the user is your friend. .. note:: This only applies to non-bot accounts. """ r = self.relationship if r is None: return False return r.type is RelationshipType.friend
[ ":", "class", ":", "bool", ":", "Checks", "if", "the", "user", "is", "your", "friend", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/user.py#L713-L723
[ "def", "is_friend", "(", "self", ")", ":", "r", "=", "self", ".", "relationship", "if", "r", "is", "None", ":", "return", "False", "return", "r", ".", "type", "is", "RelationshipType", ".", "friend" ]
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
User.is_blocked
:class:`bool`: Checks if the user is blocked. .. note:: This only applies to non-bot accounts.
discord/user.py
def is_blocked(self): """:class:`bool`: Checks if the user is blocked. .. note:: This only applies to non-bot accounts. """ r = self.relationship if r is None: return False return r.type is RelationshipType.blocked
def is_blocked(self): """:class:`bool`: Checks if the user is blocked. .. note:: This only applies to non-bot accounts. """ r = self.relationship if r is None: return False return r.type is RelationshipType.blocked
[ ":", "class", ":", "bool", ":", "Checks", "if", "the", "user", "is", "blocked", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/user.py#L725-L735
[ "def", "is_blocked", "(", "self", ")", ":", "r", "=", "self", ".", "relationship", "if", "r", "is", "None", ":", "return", "False", "return", "r", ".", "type", "is", "RelationshipType", ".", "blocked" ]
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
User.block
|coro| Blocks the user. .. note:: This only applies to non-bot accounts. Raises ------- Forbidden Not allowed to block this user. HTTPException Blocking the user failed.
discord/user.py
async def block(self): """|coro| Blocks the user. .. note:: This only applies to non-bot accounts. Raises ------- Forbidden Not allowed to block this user. HTTPException Blocking the user failed. """ await s...
async def block(self): """|coro| Blocks the user. .. note:: This only applies to non-bot accounts. Raises ------- Forbidden Not allowed to block this user. HTTPException Blocking the user failed. """ await s...
[ "|coro|" ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/user.py#L737-L754
[ "async", "def", "block", "(", "self", ")", ":", "await", "self", ".", "_state", ".", "http", ".", "add_relationship", "(", "self", ".", "id", ",", "type", "=", "RelationshipType", ".", "blocked", ".", "value", ")" ]
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
User.send_friend_request
|coro| Sends the user a friend request. .. note:: This only applies to non-bot accounts. Raises ------- Forbidden Not allowed to send a friend request to the user. HTTPException Sending the friend request failed.
discord/user.py
async def send_friend_request(self): """|coro| Sends the user a friend request. .. note:: This only applies to non-bot accounts. Raises ------- Forbidden Not allowed to send a friend request to the user. HTTPException Sendin...
async def send_friend_request(self): """|coro| Sends the user a friend request. .. note:: This only applies to non-bot accounts. Raises ------- Forbidden Not allowed to send a friend request to the user. HTTPException Sendin...
[ "|coro|" ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/user.py#L792-L808
[ "async", "def", "send_friend_request", "(", "self", ")", ":", "await", "self", ".", "_state", ".", "http", ".", "send_friend_request", "(", "username", "=", "self", ".", "name", ",", "discriminator", "=", "self", ".", "discriminator", ")" ]
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
User.profile
|coro| Gets the user's profile. .. note:: This only applies to non-bot accounts. Raises ------- Forbidden Not allowed to fetch profiles. HTTPException Fetching the profile failed. Returns -------- :class:`Pr...
discord/user.py
async def profile(self): """|coro| Gets the user's profile. .. note:: This only applies to non-bot accounts. Raises ------- Forbidden Not allowed to fetch profiles. HTTPException Fetching the profile failed. Returns...
async def profile(self): """|coro| Gets the user's profile. .. note:: This only applies to non-bot accounts. Raises ------- Forbidden Not allowed to fetch profiles. HTTPException Fetching the profile failed. Returns...
[ "|coro|" ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/user.py#L810-L844
[ "async", "def", "profile", "(", "self", ")", ":", "state", "=", "self", ".", "_state", "data", "=", "await", "state", ".", "http", ".", "get_user_profile", "(", "self", ".", "id", ")", "def", "transform", "(", "d", ")", ":", "return", "state", ".", ...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
time_snowflake
Returns a numeric snowflake pretending to be created at the given date. When using as the lower end of a range, use time_snowflake(high=False) - 1 to be inclusive, high=True to be exclusive When using as the higher end of a range, use time_snowflake(high=True) + 1 to be inclusive, high=False to be exclusive ...
discord/utils.py
def time_snowflake(datetime_obj, high=False): """Returns a numeric snowflake pretending to be created at the given date. When using as the lower end of a range, use time_snowflake(high=False) - 1 to be inclusive, high=True to be exclusive When using as the higher end of a range, use time_snowflake(high=Tru...
def time_snowflake(datetime_obj, high=False): """Returns a numeric snowflake pretending to be created at the given date. When using as the lower end of a range, use time_snowflake(high=False) - 1 to be inclusive, high=True to be exclusive When using as the higher end of a range, use time_snowflake(high=Tru...
[ "Returns", "a", "numeric", "snowflake", "pretending", "to", "be", "created", "at", "the", "given", "date", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/utils.py#L160-L176
[ "def", "time_snowflake", "(", "datetime_obj", ",", "high", "=", "False", ")", ":", "unix_seconds", "=", "(", "datetime_obj", "-", "type", "(", "datetime_obj", ")", "(", "1970", ",", "1", ",", "1", ")", ")", ".", "total_seconds", "(", ")", "discord_millis...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
get
r"""A helper that returns the first element in the iterable that meets all the traits passed in ``attrs``. This is an alternative for :func:`discord.utils.find`. When multiple attributes are specified, they are checked using logical AND, not logical OR. Meaning they have to meet every attribute pas...
discord/utils.py
def get(iterable, **attrs): r"""A helper that returns the first element in the iterable that meets all the traits passed in ``attrs``. This is an alternative for :func:`discord.utils.find`. When multiple attributes are specified, they are checked using logical AND, not logical OR. Meaning they have...
def get(iterable, **attrs): r"""A helper that returns the first element in the iterable that meets all the traits passed in ``attrs``. This is an alternative for :func:`discord.utils.find`. When multiple attributes are specified, they are checked using logical AND, not logical OR. Meaning they have...
[ "r", "A", "helper", "that", "returns", "the", "first", "element", "in", "the", "iterable", "that", "meets", "all", "the", "traits", "passed", "in", "attrs", ".", "This", "is", "an", "alternative", "for", ":", "func", ":", "discord", ".", "utils", ".", ...
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/utils.py#L206-L261
[ "def", "get", "(", "iterable", ",", "*", "*", "attrs", ")", ":", "def", "predicate", "(", "elem", ")", ":", "for", "attr", ",", "val", "in", "attrs", ".", "items", "(", ")", ":", "nested", "=", "attr", ".", "split", "(", "'__'", ")", "obj", "="...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
_string_width
Returns string's width.
discord/utils.py
def _string_width(string, *, _IS_ASCII=_IS_ASCII): """Returns string's width.""" match = _IS_ASCII.match(string) if match: return match.endpos UNICODE_WIDE_CHAR_TYPE = 'WFA' width = 0 func = unicodedata.east_asian_width for char in string: width += 2 if func(char) in UNICODE...
def _string_width(string, *, _IS_ASCII=_IS_ASCII): """Returns string's width.""" match = _IS_ASCII.match(string) if match: return match.endpos UNICODE_WIDE_CHAR_TYPE = 'WFA' width = 0 func = unicodedata.east_asian_width for char in string: width += 2 if func(char) in UNICODE...
[ "Returns", "string", "s", "width", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/utils.py#L359-L370
[ "def", "_string_width", "(", "string", ",", "*", ",", "_IS_ASCII", "=", "_IS_ASCII", ")", ":", "match", "=", "_IS_ASCII", ".", "match", "(", "string", ")", "if", "match", ":", "return", "match", ".", "endpos", "UNICODE_WIDE_CHAR_TYPE", "=", "'WFA'", "width...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
resolve_invite
Resolves an invite from a :class:`Invite`, URL or ID Parameters ----------- invite: Union[:class:`Invite`, :class:`Object`, :class:`str`] The invite. Returns -------- :class:`str` The invite code.
discord/utils.py
def resolve_invite(invite): """ Resolves an invite from a :class:`Invite`, URL or ID Parameters ----------- invite: Union[:class:`Invite`, :class:`Object`, :class:`str`] The invite. Returns -------- :class:`str` The invite code. """ from .invite import Invite #...
def resolve_invite(invite): """ Resolves an invite from a :class:`Invite`, URL or ID Parameters ----------- invite: Union[:class:`Invite`, :class:`Object`, :class:`str`] The invite. Returns -------- :class:`str` The invite code. """ from .invite import Invite #...
[ "Resolves", "an", "invite", "from", "a", ":", "class", ":", "Invite", "URL", "or", "ID" ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/utils.py#L372-L394
[ "def", "resolve_invite", "(", "invite", ")", ":", "from", ".", "invite", "import", "Invite", "# circular import", "if", "isinstance", "(", "invite", ",", "Invite", ")", "or", "isinstance", "(", "invite", ",", "Object", ")", ":", "return", "invite", ".", "i...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
escape_markdown
r"""A helper function that escapes Discord's markdown. Parameters ----------- text: :class:`str` The text to escape markdown from. as_needed: :class:`bool` Whether to escape the markdown characters as needed. This means that it does not escape extraneous characters if it's ...
discord/utils.py
def escape_markdown(text, *, as_needed=False, ignore_links=True): r"""A helper function that escapes Discord's markdown. Parameters ----------- text: :class:`str` The text to escape markdown from. as_needed: :class:`bool` Whether to escape the markdown characters as needed. This ...
def escape_markdown(text, *, as_needed=False, ignore_links=True): r"""A helper function that escapes Discord's markdown. Parameters ----------- text: :class:`str` The text to escape markdown from. as_needed: :class:`bool` Whether to escape the markdown characters as needed. This ...
[ "r", "A", "helper", "function", "that", "escapes", "Discord", "s", "markdown", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/utils.py#L401-L441
[ "def", "escape_markdown", "(", "text", ",", "*", ",", "as_needed", "=", "False", ",", "ignore_links", "=", "True", ")", ":", "if", "not", "as_needed", ":", "url_regex", "=", "r'(?P<url>(?:https?|steam)://(?:-\\.)?(?:[^\\s/?\\.#-]+\\.?)+(?:/[^\\s]*)?)'", "def", "replac...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
add
Adds two numbers together.
examples/basic_bot.py
async def add(ctx, left: int, right: int): """Adds two numbers together.""" await ctx.send(left + right)
async def add(ctx, left: int, right: int): """Adds two numbers together.""" await ctx.send(left + right)
[ "Adds", "two", "numbers", "together", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/examples/basic_bot.py#L19-L21
[ "async", "def", "add", "(", "ctx", ",", "left", ":", "int", ",", "right", ":", "int", ")", ":", "await", "ctx", ".", "send", "(", "left", "+", "right", ")" ]
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
roll
Rolls a dice in NdN format.
examples/basic_bot.py
async def roll(ctx, dice: str): """Rolls a dice in NdN format.""" try: rolls, limit = map(int, dice.split('d')) except Exception: await ctx.send('Format has to be in NdN!') return result = ', '.join(str(random.randint(1, limit)) for r in range(rolls)) await ctx.send(result)
async def roll(ctx, dice: str): """Rolls a dice in NdN format.""" try: rolls, limit = map(int, dice.split('d')) except Exception: await ctx.send('Format has to be in NdN!') return result = ', '.join(str(random.randint(1, limit)) for r in range(rolls)) await ctx.send(result)
[ "Rolls", "a", "dice", "in", "NdN", "format", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/examples/basic_bot.py#L24-L33
[ "async", "def", "roll", "(", "ctx", ",", "dice", ":", "str", ")", ":", "try", ":", "rolls", ",", "limit", "=", "map", "(", "int", ",", "dice", ".", "split", "(", "'d'", ")", ")", "except", "Exception", ":", "await", "ctx", ".", "send", "(", "'F...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
repeat
Repeats a message multiple times.
examples/basic_bot.py
async def repeat(ctx, times: int, content='repeating...'): """Repeats a message multiple times.""" for i in range(times): await ctx.send(content)
async def repeat(ctx, times: int, content='repeating...'): """Repeats a message multiple times.""" for i in range(times): await ctx.send(content)
[ "Repeats", "a", "message", "multiple", "times", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/examples/basic_bot.py#L41-L44
[ "async", "def", "repeat", "(", "ctx", ",", "times", ":", "int", ",", "content", "=", "'repeating...'", ")", ":", "for", "i", "in", "range", "(", "times", ")", ":", "await", "ctx", ".", "send", "(", "content", ")" ]
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
Music.join
Joins a voice channel
examples/basic_voice.py
async def join(self, ctx, *, channel: discord.VoiceChannel): """Joins a voice channel""" if ctx.voice_client is not None: return await ctx.voice_client.move_to(channel) await channel.connect()
async def join(self, ctx, *, channel: discord.VoiceChannel): """Joins a voice channel""" if ctx.voice_client is not None: return await ctx.voice_client.move_to(channel) await channel.connect()
[ "Joins", "a", "voice", "channel" ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/examples/basic_voice.py#L60-L66
[ "async", "def", "join", "(", "self", ",", "ctx", ",", "*", ",", "channel", ":", "discord", ".", "VoiceChannel", ")", ":", "if", "ctx", ".", "voice_client", "is", "not", "None", ":", "return", "await", "ctx", ".", "voice_client", ".", "move_to", "(", ...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
Music.play
Plays a file from the local filesystem
examples/basic_voice.py
async def play(self, ctx, *, query): """Plays a file from the local filesystem""" source = discord.PCMVolumeTransformer(discord.FFmpegPCMAudio(query)) ctx.voice_client.play(source, after=lambda e: print('Player error: %s' % e) if e else None) await ctx.send('Now playing: {}'.format(que...
async def play(self, ctx, *, query): """Plays a file from the local filesystem""" source = discord.PCMVolumeTransformer(discord.FFmpegPCMAudio(query)) ctx.voice_client.play(source, after=lambda e: print('Player error: %s' % e) if e else None) await ctx.send('Now playing: {}'.format(que...
[ "Plays", "a", "file", "from", "the", "local", "filesystem" ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/examples/basic_voice.py#L69-L75
[ "async", "def", "play", "(", "self", ",", "ctx", ",", "*", ",", "query", ")", ":", "source", "=", "discord", ".", "PCMVolumeTransformer", "(", "discord", ".", "FFmpegPCMAudio", "(", "query", ")", ")", "ctx", ".", "voice_client", ".", "play", "(", "sour...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
Music.stream
Streams from a url (same as yt, but doesn't predownload)
examples/basic_voice.py
async def stream(self, ctx, *, url): """Streams from a url (same as yt, but doesn't predownload)""" async with ctx.typing(): player = await YTDLSource.from_url(url, loop=self.bot.loop, stream=True) ctx.voice_client.play(player, after=lambda e: print('Player error: %s' % e) if e ...
async def stream(self, ctx, *, url): """Streams from a url (same as yt, but doesn't predownload)""" async with ctx.typing(): player = await YTDLSource.from_url(url, loop=self.bot.loop, stream=True) ctx.voice_client.play(player, after=lambda e: print('Player error: %s' % e) if e ...
[ "Streams", "from", "a", "url", "(", "same", "as", "yt", "but", "doesn", "t", "predownload", ")" ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/examples/basic_voice.py#L88-L95
[ "async", "def", "stream", "(", "self", ",", "ctx", ",", "*", ",", "url", ")", ":", "async", "with", "ctx", ".", "typing", "(", ")", ":", "player", "=", "await", "YTDLSource", ".", "from_url", "(", "url", ",", "loop", "=", "self", ".", "bot", ".",...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
Music.volume
Changes the player's volume
examples/basic_voice.py
async def volume(self, ctx, volume: int): """Changes the player's volume""" if ctx.voice_client is None: return await ctx.send("Not connected to a voice channel.") ctx.voice_client.source.volume = volume / 100 await ctx.send("Changed volume to {}%".format(volume))
async def volume(self, ctx, volume: int): """Changes the player's volume""" if ctx.voice_client is None: return await ctx.send("Not connected to a voice channel.") ctx.voice_client.source.volume = volume / 100 await ctx.send("Changed volume to {}%".format(volume))
[ "Changes", "the", "player", "s", "volume" ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/examples/basic_voice.py#L98-L105
[ "async", "def", "volume", "(", "self", ",", "ctx", ",", "volume", ":", "int", ")", ":", "if", "ctx", ".", "voice_client", "is", "None", ":", "return", "await", "ctx", ".", "send", "(", "\"Not connected to a voice channel.\"", ")", "ctx", ".", "voice_client...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
CallMessage.duration
Queries the duration of the call. If the call has not ended then the current duration will be returned. Returns --------- datetime.timedelta The timedelta object representing the duration.
discord/calls.py
def duration(self): """Queries the duration of the call. If the call has not ended then the current duration will be returned. Returns --------- datetime.timedelta The timedelta object representing the duration. """ if self.ended_timestamp is...
def duration(self): """Queries the duration of the call. If the call has not ended then the current duration will be returned. Returns --------- datetime.timedelta The timedelta object representing the duration. """ if self.ended_timestamp is...
[ "Queries", "the", "duration", "of", "the", "call", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/calls.py#L65-L79
[ "def", "duration", "(", "self", ")", ":", "if", "self", ".", "ended_timestamp", "is", "None", ":", "return", "datetime", ".", "datetime", ".", "utcnow", "(", ")", "-", "self", ".", "message", ".", "created_at", "else", ":", "return", "self", ".", "ende...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
GroupCall.connected
A property that returns the :class:`list` of :class:`User` that are currently in this call.
discord/calls.py
def connected(self): """A property that returns the :class:`list` of :class:`User` that are currently in this call.""" ret = [u for u in self.channel.recipients if self.voice_state_for(u) is not None] me = self.channel.me if self.voice_state_for(me) is not None: ret.append(me...
def connected(self): """A property that returns the :class:`list` of :class:`User` that are currently in this call.""" ret = [u for u in self.channel.recipients if self.voice_state_for(u) is not None] me = self.channel.me if self.voice_state_for(me) is not None: ret.append(me...
[ "A", "property", "that", "returns", "the", ":", "class", ":", "list", "of", ":", "class", ":", "User", "that", "are", "currently", "in", "this", "call", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/calls.py#L124-L131
[ "def", "connected", "(", "self", ")", ":", "ret", "=", "[", "u", "for", "u", "in", "self", ".", "channel", ".", "recipients", "if", "self", ".", "voice_state_for", "(", "u", ")", "is", "not", "None", "]", "me", "=", "self", ".", "channel", ".", "...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
Webhook.partial
Creates a partial :class:`Webhook`. A partial webhook is just a webhook object with an ID and a token. Parameters ----------- id: :class:`int` The ID of the webhook. token: :class:`str` The authentication token of the webhook. adapter: :class:`We...
discord/webhook.py
def partial(cls, id, token, *, adapter): """Creates a partial :class:`Webhook`. A partial webhook is just a webhook object with an ID and a token. Parameters ----------- id: :class:`int` The ID of the webhook. token: :class:`str` The authenticati...
def partial(cls, id, token, *, adapter): """Creates a partial :class:`Webhook`. A partial webhook is just a webhook object with an ID and a token. Parameters ----------- id: :class:`int` The ID of the webhook. token: :class:`str` The authenticati...
[ "Creates", "a", "partial", ":", "class", ":", "Webhook", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/webhook.py#L446-L471
[ "def", "partial", "(", "cls", ",", "id", ",", "token", ",", "*", ",", "adapter", ")", ":", "if", "not", "isinstance", "(", "adapter", ",", "WebhookAdapter", ")", ":", "raise", "TypeError", "(", "'adapter must be a subclass of WebhookAdapter'", ")", "data", "...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
Webhook.from_url
Creates a partial :class:`Webhook` from a webhook URL. Parameters ------------ url: :class:`str` The URL of the webhook. adapter: :class:`WebhookAdapter` The webhook adapter to use when sending requests. This is typically :class:`AsyncWebhookAdapter` ...
discord/webhook.py
def from_url(cls, url, *, adapter): """Creates a partial :class:`Webhook` from a webhook URL. Parameters ------------ url: :class:`str` The URL of the webhook. adapter: :class:`WebhookAdapter` The webhook adapter to use when sending requests. This is ...
def from_url(cls, url, *, adapter): """Creates a partial :class:`Webhook` from a webhook URL. Parameters ------------ url: :class:`str` The URL of the webhook. adapter: :class:`WebhookAdapter` The webhook adapter to use when sending requests. This is ...
[ "Creates", "a", "partial", ":", "class", ":", "Webhook", "from", "a", "webhook", "URL", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/webhook.py#L474-L495
[ "def", "from_url", "(", "cls", ",", "url", ",", "*", ",", "adapter", ")", ":", "m", "=", "re", ".", "search", "(", "r'discordapp.com/api/webhooks/(?P<id>[0-9]{17,21})/(?P<token>[A-Za-z0-9\\.\\-\\_]{60,68})'", ",", "url", ")", "if", "m", "is", "None", ":", "raise...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
Webhook.channel
Optional[:class:`TextChannel`]: The text channel this webhook belongs to. If this is a partial webhook, then this will always return ``None``.
discord/webhook.py
def channel(self): """Optional[:class:`TextChannel`]: The text channel this webhook belongs to. If this is a partial webhook, then this will always return ``None``. """ guild = self.guild return guild and guild.get_channel(self.channel_id)
def channel(self): """Optional[:class:`TextChannel`]: The text channel this webhook belongs to. If this is a partial webhook, then this will always return ``None``. """ guild = self.guild return guild and guild.get_channel(self.channel_id)
[ "Optional", "[", ":", "class", ":", "TextChannel", "]", ":", "The", "text", "channel", "this", "webhook", "belongs", "to", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/webhook.py#L511-L517
[ "def", "channel", "(", "self", ")", ":", "guild", "=", "self", ".", "guild", "return", "guild", "and", "guild", ".", "get_channel", "(", "self", ".", "channel_id", ")" ]
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
Webhook.avatar_url_as
Returns a friendly URL version of the avatar the webhook has. If the webhook does not have a traditional avatar, their default avatar URL is returned instead. The format must be one of 'jpeg', 'jpg', or 'png'. The size must be a power of 2 between 16 and 1024. Parameters ...
discord/webhook.py
def avatar_url_as(self, *, format=None, size=1024): """Returns a friendly URL version of the avatar the webhook has. If the webhook does not have a traditional avatar, their default avatar URL is returned instead. The format must be one of 'jpeg', 'jpg', or 'png'. The size must...
def avatar_url_as(self, *, format=None, size=1024): """Returns a friendly URL version of the avatar the webhook has. If the webhook does not have a traditional avatar, their default avatar URL is returned instead. The format must be one of 'jpeg', 'jpg', or 'png'. The size must...
[ "Returns", "a", "friendly", "URL", "version", "of", "the", "avatar", "the", "webhook", "has", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/webhook.py#L536-L576
[ "def", "avatar_url_as", "(", "self", ",", "*", ",", "format", "=", "None", ",", "size", "=", "1024", ")", ":", "if", "self", ".", "avatar", "is", "None", ":", "# Default is always blurple apparently", "return", "Asset", "(", "self", ".", "_state", ",", "...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
Webhook.edit
|maybecoro| Edits this Webhook. If the webhook is constructed with a :class:`RequestsWebhookAdapter` then this is not a coroutine. Parameters ------------- name: Optional[:class:`str`] The webhook's new default name. avatar: Optional[:class:`bytes`]...
discord/webhook.py
def edit(self, **kwargs): """|maybecoro| Edits this Webhook. If the webhook is constructed with a :class:`RequestsWebhookAdapter` then this is not a coroutine. Parameters ------------- name: Optional[:class:`str`] The webhook's new default name. ...
def edit(self, **kwargs): """|maybecoro| Edits this Webhook. If the webhook is constructed with a :class:`RequestsWebhookAdapter` then this is not a coroutine. Parameters ------------- name: Optional[:class:`str`] The webhook's new default name. ...
[ "|maybecoro|" ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/webhook.py#L597-L643
[ "def", "edit", "(", "self", ",", "*", "*", "kwargs", ")", ":", "payload", "=", "{", "}", "try", ":", "name", "=", "kwargs", "[", "'name'", "]", "except", "KeyError", ":", "pass", "else", ":", "if", "name", "is", "not", "None", ":", "payload", "["...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
Webhook.send
|maybecoro| Sends a message using the webhook. If the webhook is constructed with a :class:`RequestsWebhookAdapter` then this is not a coroutine. The content must be a type that can convert to a string through ``str(content)``. To upload a single file, the ``file`` parameter ...
discord/webhook.py
def send(self, content=None, *, wait=False, username=None, avatar_url=None, tts=False, file=None, files=None, embed=None, embeds=None): """|maybecoro| Sends a message using the webhook. If the webhook is constructed with a :class:`RequestsWebhookAdapter` the...
def send(self, content=None, *, wait=False, username=None, avatar_url=None, tts=False, file=None, files=None, embed=None, embeds=None): """|maybecoro| Sends a message using the webhook. If the webhook is constructed with a :class:`RequestsWebhookAdapter` the...
[ "|maybecoro|" ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/webhook.py#L645-L733
[ "def", "send", "(", "self", ",", "content", "=", "None", ",", "*", ",", "wait", "=", "False", ",", "username", "=", "None", ",", "avatar_url", "=", "None", ",", "tts", "=", "False", ",", "file", "=", "None", ",", "files", "=", "None", ",", "embed...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
Reaction.users
Returns an :class:`AsyncIterator` representing the users that have reacted to the message. The ``after`` parameter must represent a member and meet the :class:`abc.Snowflake` abc. Examples --------- Usage :: # I do not actually recommend doing this. as...
discord/reaction.py
def users(self, limit=None, after=None): """Returns an :class:`AsyncIterator` representing the users that have reacted to the message. The ``after`` parameter must represent a member and meet the :class:`abc.Snowflake` abc. Examples --------- Usage :: # I ...
def users(self, limit=None, after=None): """Returns an :class:`AsyncIterator` representing the users that have reacted to the message. The ``after`` parameter must represent a member and meet the :class:`abc.Snowflake` abc. Examples --------- Usage :: # I ...
[ "Returns", "an", ":", "class", ":", "AsyncIterator", "representing", "the", "users", "that", "have", "reacted", "to", "the", "message", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/reaction.py#L124-L177
[ "def", "users", "(", "self", ",", "limit", "=", "None", ",", "after", "=", "None", ")", ":", "if", "self", ".", "custom_emoji", ":", "emoji", "=", "'{0.name}:{0.id}'", ".", "format", "(", "self", ".", "emoji", ")", "else", ":", "emoji", "=", "self", ...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
TextChannel.members
Returns a :class:`list` of :class:`Member` that can see this channel.
discord/channel.py
def members(self): """Returns a :class:`list` of :class:`Member` that can see this channel.""" return [m for m in self.guild.members if self.permissions_for(m).read_messages]
def members(self): """Returns a :class:`list` of :class:`Member` that can see this channel.""" return [m for m in self.guild.members if self.permissions_for(m).read_messages]
[ "Returns", "a", ":", "class", ":", "list", "of", ":", "class", ":", "Member", "that", "can", "see", "this", "channel", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/channel.py#L143-L145
[ "def", "members", "(", "self", ")", ":", "return", "[", "m", "for", "m", "in", "self", ".", "guild", ".", "members", "if", "self", ".", "permissions_for", "(", "m", ")", ".", "read_messages", "]" ]
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
TextChannel.delete_messages
|coro| Deletes a list of messages. This is similar to :meth:`Message.delete` except it bulk deletes multiple messages. As a special case, if the number of messages is 0, then nothing is done. If the number of messages is 1 then single message delete is done. If it's more than t...
discord/channel.py
async def delete_messages(self, messages): """|coro| Deletes a list of messages. This is similar to :meth:`Message.delete` except it bulk deletes multiple messages. As a special case, if the number of messages is 0, then nothing is done. If the number of messages is 1 then sing...
async def delete_messages(self, messages): """|coro| Deletes a list of messages. This is similar to :meth:`Message.delete` except it bulk deletes multiple messages. As a special case, if the number of messages is 0, then nothing is done. If the number of messages is 1 then sing...
[ "|coro|" ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/channel.py#L226-L274
[ "async", "def", "delete_messages", "(", "self", ",", "messages", ")", ":", "if", "not", "isinstance", "(", "messages", ",", "(", "list", ",", "tuple", ")", ")", ":", "messages", "=", "list", "(", "messages", ")", "if", "len", "(", "messages", ")", "=...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
TextChannel.purge
|coro| Purges a list of messages that meet the criteria given by the predicate ``check``. If a ``check`` is not provided then all messages are deleted without discrimination. You must have the :attr:`~Permissions.manage_messages` permission to delete messages even if they are y...
discord/channel.py
async def purge(self, *, limit=100, check=None, before=None, after=None, around=None, oldest_first=False, bulk=True): """|coro| Purges a list of messages that meet the criteria given by the predicate ``check``. If a ``check`` is not provided then all messages are deleted without discrim...
async def purge(self, *, limit=100, check=None, before=None, after=None, around=None, oldest_first=False, bulk=True): """|coro| Purges a list of messages that meet the criteria given by the predicate ``check``. If a ``check`` is not provided then all messages are deleted without discrim...
[ "|coro|" ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/channel.py#L276-L383
[ "async", "def", "purge", "(", "self", ",", "*", ",", "limit", "=", "100", ",", "check", "=", "None", ",", "before", "=", "None", ",", "after", "=", "None", ",", "around", "=", "None", ",", "oldest_first", "=", "False", ",", "bulk", "=", "True", "...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
TextChannel.webhooks
|coro| Gets the list of webhooks from this channel. Requires :attr:`~.Permissions.manage_webhooks` permissions. Raises ------- Forbidden You don't have permissions to get the webhooks. Returns -------- List[:class:`Webhook`] The...
discord/channel.py
async def webhooks(self): """|coro| Gets the list of webhooks from this channel. Requires :attr:`~.Permissions.manage_webhooks` permissions. Raises ------- Forbidden You don't have permissions to get the webhooks. Returns -------- L...
async def webhooks(self): """|coro| Gets the list of webhooks from this channel. Requires :attr:`~.Permissions.manage_webhooks` permissions. Raises ------- Forbidden You don't have permissions to get the webhooks. Returns -------- L...
[ "|coro|" ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/channel.py#L385-L404
[ "async", "def", "webhooks", "(", "self", ")", ":", "data", "=", "await", "self", ".", "_state", ".", "http", ".", "channel_webhooks", "(", "self", ".", "id", ")", "return", "[", "Webhook", ".", "from_state", "(", "d", ",", "state", "=", "self", ".", ...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
TextChannel.create_webhook
|coro| Creates a webhook for this channel. Requires :attr:`~.Permissions.manage_webhooks` permissions. .. versionchanged:: 1.1.0 Added the ``reason`` keyword-only parameter. Parameters ------------- name: :class:`str` The webhook's name. ...
discord/channel.py
async def create_webhook(self, *, name, avatar=None, reason=None): """|coro| Creates a webhook for this channel. Requires :attr:`~.Permissions.manage_webhooks` permissions. .. versionchanged:: 1.1.0 Added the ``reason`` keyword-only parameter. Parameters -...
async def create_webhook(self, *, name, avatar=None, reason=None): """|coro| Creates a webhook for this channel. Requires :attr:`~.Permissions.manage_webhooks` permissions. .. versionchanged:: 1.1.0 Added the ``reason`` keyword-only parameter. Parameters -...
[ "|coro|" ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/channel.py#L406-L443
[ "async", "def", "create_webhook", "(", "self", ",", "*", ",", "name", ",", "avatar", "=", "None", ",", "reason", "=", "None", ")", ":", "if", "avatar", "is", "not", "None", ":", "avatar", "=", "utils", ".", "_bytes_to_base64_data", "(", "avatar", ")", ...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
VoiceChannel.members
Returns a list of :class:`Member` that are currently inside this voice channel.
discord/channel.py
def members(self): """Returns a list of :class:`Member` that are currently inside this voice channel.""" ret = [] for user_id, state in self.guild._voice_states.items(): if state.channel.id == self.id: member = self.guild.get_member(user_id) if member ...
def members(self): """Returns a list of :class:`Member` that are currently inside this voice channel.""" ret = [] for user_id, state in self.guild._voice_states.items(): if state.channel.id == self.id: member = self.guild.get_member(user_id) if member ...
[ "Returns", "a", "list", "of", ":", "class", ":", "Member", "that", "are", "currently", "inside", "this", "voice", "channel", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/channel.py#L520-L528
[ "def", "members", "(", "self", ")", ":", "ret", "=", "[", "]", "for", "user_id", ",", "state", "in", "self", ".", "guild", ".", "_voice_states", ".", "items", "(", ")", ":", "if", "state", ".", "channel", ".", "id", "==", "self", ".", "id", ":", ...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
CategoryChannel.edit
|coro| Edits the channel. You must have the :attr:`~Permissions.manage_channels` permission to use this. Parameters ---------- name: :class:`str` The new category's name. position: :class:`int` The new category's position. nsfw: ...
discord/channel.py
async def edit(self, *, reason=None, **options): """|coro| Edits the channel. You must have the :attr:`~Permissions.manage_channels` permission to use this. Parameters ---------- name: :class:`str` The new category's name. position: :class:`...
async def edit(self, *, reason=None, **options): """|coro| Edits the channel. You must have the :attr:`~Permissions.manage_channels` permission to use this. Parameters ---------- name: :class:`str` The new category's name. position: :class:`...
[ "|coro|" ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/channel.py#L661-L700
[ "async", "def", "edit", "(", "self", ",", "*", ",", "reason", "=", "None", ",", "*", "*", "options", ")", ":", "try", ":", "position", "=", "options", ".", "pop", "(", "'position'", ")", "except", "KeyError", ":", "pass", "else", ":", "await", "sel...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
CategoryChannel.channels
List[:class:`abc.GuildChannel`]: Returns the channels that are under this category. These are sorted by the official Discord UI, which places voice channels below the text channels.
discord/channel.py
def channels(self): """List[:class:`abc.GuildChannel`]: Returns the channels that are under this category. These are sorted by the official Discord UI, which places voice channels below the text channels. """ def comparator(channel): return (not isinstance(channel, TextChann...
def channels(self): """List[:class:`abc.GuildChannel`]: Returns the channels that are under this category. These are sorted by the official Discord UI, which places voice channels below the text channels. """ def comparator(channel): return (not isinstance(channel, TextChann...
[ "List", "[", ":", "class", ":", "abc", ".", "GuildChannel", "]", ":", "Returns", "the", "channels", "that", "are", "under", "this", "category", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/channel.py#L703-L713
[ "def", "channels", "(", "self", ")", ":", "def", "comparator", "(", "channel", ")", ":", "return", "(", "not", "isinstance", "(", "channel", ",", "TextChannel", ")", ",", "channel", ".", "position", ")", "ret", "=", "[", "c", "for", "c", "in", "self"...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
CategoryChannel.text_channels
List[:class:`TextChannel`]: Returns the text channels that are under this category.
discord/channel.py
def text_channels(self): """List[:class:`TextChannel`]: Returns the text channels that are under this category.""" ret = [c for c in self.guild.channels if c.category_id == self.id and isinstance(c, TextChannel)] ret.sort(key=lambda c: (c.position, c.id)) return r...
def text_channels(self): """List[:class:`TextChannel`]: Returns the text channels that are under this category.""" ret = [c for c in self.guild.channels if c.category_id == self.id and isinstance(c, TextChannel)] ret.sort(key=lambda c: (c.position, c.id)) return r...
[ "List", "[", ":", "class", ":", "TextChannel", "]", ":", "Returns", "the", "text", "channels", "that", "are", "under", "this", "category", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/channel.py#L716-L722
[ "def", "text_channels", "(", "self", ")", ":", "ret", "=", "[", "c", "for", "c", "in", "self", ".", "guild", ".", "channels", "if", "c", ".", "category_id", "==", "self", ".", "id", "and", "isinstance", "(", "c", ",", "TextChannel", ")", "]", "ret"...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
CategoryChannel.voice_channels
List[:class:`VoiceChannel`]: Returns the voice channels that are under this category.
discord/channel.py
def voice_channels(self): """List[:class:`VoiceChannel`]: Returns the voice channels that are under this category.""" ret = [c for c in self.guild.channels if c.category_id == self.id and isinstance(c, VoiceChannel)] ret.sort(key=lambda c: (c.position, c.id)) retu...
def voice_channels(self): """List[:class:`VoiceChannel`]: Returns the voice channels that are under this category.""" ret = [c for c in self.guild.channels if c.category_id == self.id and isinstance(c, VoiceChannel)] ret.sort(key=lambda c: (c.position, c.id)) retu...
[ "List", "[", ":", "class", ":", "VoiceChannel", "]", ":", "Returns", "the", "voice", "channels", "that", "are", "under", "this", "category", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/channel.py#L725-L731
[ "def", "voice_channels", "(", "self", ")", ":", "ret", "=", "[", "c", "for", "c", "in", "self", ".", "guild", ".", "channels", "if", "c", ".", "category_id", "==", "self", ".", "id", "and", "isinstance", "(", "c", ",", "VoiceChannel", ")", "]", "re...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
CategoryChannel.create_text_channel
|coro| A shortcut method to :meth:`Guild.create_text_channel` to create a :class:`TextChannel` in the category.
discord/channel.py
async def create_text_channel(self, name, *, overwrites=None, reason=None, **options): """|coro| A shortcut method to :meth:`Guild.create_text_channel` to create a :class:`TextChannel` in the category. """ return await self.guild.create_text_channel(name, overwrites=overwrites, category...
async def create_text_channel(self, name, *, overwrites=None, reason=None, **options): """|coro| A shortcut method to :meth:`Guild.create_text_channel` to create a :class:`TextChannel` in the category. """ return await self.guild.create_text_channel(name, overwrites=overwrites, category...
[ "|coro|" ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/channel.py#L733-L738
[ "async", "def", "create_text_channel", "(", "self", ",", "name", ",", "*", ",", "overwrites", "=", "None", ",", "reason", "=", "None", ",", "*", "*", "options", ")", ":", "return", "await", "self", ".", "guild", ".", "create_text_channel", "(", "name", ...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
CategoryChannel.create_voice_channel
|coro| A shortcut method to :meth:`Guild.create_voice_channel` to create a :class:`VoiceChannel` in the category.
discord/channel.py
async def create_voice_channel(self, name, *, overwrites=None, reason=None, **options): """|coro| A shortcut method to :meth:`Guild.create_voice_channel` to create a :class:`VoiceChannel` in the category. """ return await self.guild.create_voice_channel(name, overwrites=overwrites, cate...
async def create_voice_channel(self, name, *, overwrites=None, reason=None, **options): """|coro| A shortcut method to :meth:`Guild.create_voice_channel` to create a :class:`VoiceChannel` in the category. """ return await self.guild.create_voice_channel(name, overwrites=overwrites, cate...
[ "|coro|" ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/channel.py#L740-L745
[ "async", "def", "create_voice_channel", "(", "self", ",", "name", ",", "*", ",", "overwrites", "=", "None", ",", "reason", "=", "None", ",", "*", "*", "options", ")", ":", "return", "await", "self", ".", "guild", ".", "create_voice_channel", "(", "name",...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
DMChannel.permissions_for
Handles permission resolution for a :class:`User`. This function is there for compatibility with other channel types. Actual direct messages do not really have the concept of permissions. This returns all the Text related permissions set to true except: - send_tts_messages: You canno...
discord/channel.py
def permissions_for(self, user=None): """Handles permission resolution for a :class:`User`. This function is there for compatibility with other channel types. Actual direct messages do not really have the concept of permissions. This returns all the Text related permissions set to tru...
def permissions_for(self, user=None): """Handles permission resolution for a :class:`User`. This function is there for compatibility with other channel types. Actual direct messages do not really have the concept of permissions. This returns all the Text related permissions set to tru...
[ "Handles", "permission", "resolution", "for", "a", ":", "class", ":", "User", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/channel.py#L923-L950
[ "def", "permissions_for", "(", "self", ",", "user", "=", "None", ")", ":", "base", "=", "Permissions", ".", "text", "(", ")", "base", ".", "send_tts_messages", "=", "False", "base", ".", "manage_messages", "=", "False", "return", "base" ]
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
GroupChannel.permissions_for
Handles permission resolution for a :class:`User`. This function is there for compatibility with other channel types. Actual direct messages do not really have the concept of permissions. This returns all the Text related permissions set to true except: - send_tts_messages: You canno...
discord/channel.py
def permissions_for(self, user): """Handles permission resolution for a :class:`User`. This function is there for compatibility with other channel types. Actual direct messages do not really have the concept of permissions. This returns all the Text related permissions set to true exc...
def permissions_for(self, user): """Handles permission resolution for a :class:`User`. This function is there for compatibility with other channel types. Actual direct messages do not really have the concept of permissions. This returns all the Text related permissions set to true exc...
[ "Handles", "permission", "resolution", "for", "a", ":", "class", ":", "User", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/channel.py#L1041-L1074
[ "def", "permissions_for", "(", "self", ",", "user", ")", ":", "base", "=", "Permissions", ".", "text", "(", ")", "base", ".", "send_tts_messages", "=", "False", "base", ".", "manage_messages", "=", "False", "base", ".", "mention_everyone", "=", "True", "if...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
GroupChannel.add_recipients
r"""|coro| Adds recipients to this group. A group can only have a maximum of 10 members. Attempting to add more ends up in an exception. To add a recipient to the group, you must have a relationship with the user of type :attr:`RelationshipType.friend`. Parameters ...
discord/channel.py
async def add_recipients(self, *recipients): r"""|coro| Adds recipients to this group. A group can only have a maximum of 10 members. Attempting to add more ends up in an exception. To add a recipient to the group, you must have a relationship with the user of type :att...
async def add_recipients(self, *recipients): r"""|coro| Adds recipients to this group. A group can only have a maximum of 10 members. Attempting to add more ends up in an exception. To add a recipient to the group, you must have a relationship with the user of type :att...
[ "r", "|coro|" ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/channel.py#L1076-L1101
[ "async", "def", "add_recipients", "(", "self", ",", "*", "recipients", ")", ":", "# TODO: wait for the corresponding WS event", "req", "=", "self", ".", "_state", ".", "http", ".", "add_group_recipient", "for", "recipient", "in", "recipients", ":", "await", "req",...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
GroupChannel.remove_recipients
r"""|coro| Removes recipients from this group. Parameters ----------- \*recipients: :class:`User` An argument list of users to remove from this group. Raises ------- HTTPException Removing a recipient from this group failed.
discord/channel.py
async def remove_recipients(self, *recipients): r"""|coro| Removes recipients from this group. Parameters ----------- \*recipients: :class:`User` An argument list of users to remove from this group. Raises ------- HTTPException R...
async def remove_recipients(self, *recipients): r"""|coro| Removes recipients from this group. Parameters ----------- \*recipients: :class:`User` An argument list of users to remove from this group. Raises ------- HTTPException R...
[ "r", "|coro|" ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/channel.py#L1103-L1123
[ "async", "def", "remove_recipients", "(", "self", ",", "*", "recipients", ")", ":", "# TODO: wait for the corresponding WS event", "req", "=", "self", ".", "_state", ".", "http", ".", "remove_group_recipient", "for", "recipient", "in", "recipients", ":", "await", ...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
GroupChannel.edit
|coro| Edits the group. Parameters ----------- name: Optional[:class:`str`] The new name to change the group to. Could be ``None`` to remove the name. icon: Optional[:class:`bytes`] A :term:`py:bytes-like object` representing the new icon. ...
discord/channel.py
async def edit(self, **fields): """|coro| Edits the group. Parameters ----------- name: Optional[:class:`str`] The new name to change the group to. Could be ``None`` to remove the name. icon: Optional[:class:`bytes`] A :term:`py:bytes...
async def edit(self, **fields): """|coro| Edits the group. Parameters ----------- name: Optional[:class:`str`] The new name to change the group to. Could be ``None`` to remove the name. icon: Optional[:class:`bytes`] A :term:`py:bytes...
[ "|coro|" ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/channel.py#L1125-L1154
[ "async", "def", "edit", "(", "self", ",", "*", "*", "fields", ")", ":", "try", ":", "icon_bytes", "=", "fields", "[", "'icon'", "]", "except", "KeyError", ":", "pass", "else", ":", "if", "icon_bytes", "is", "not", "None", ":", "fields", "[", "'icon'"...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
GuildChannel.changed_roles
Returns a :class:`list` of :class:`Roles` that have been overridden from their default values in the :attr:`Guild.roles` attribute.
discord/abc.py
def changed_roles(self): """Returns a :class:`list` of :class:`Roles` that have been overridden from their default values in the :attr:`Guild.roles` attribute.""" ret = [] g = self.guild for overwrite in filter(lambda o: o.type == 'role', self._overwrites): role = g.g...
def changed_roles(self): """Returns a :class:`list` of :class:`Roles` that have been overridden from their default values in the :attr:`Guild.roles` attribute.""" ret = [] g = self.guild for overwrite in filter(lambda o: o.type == 'role', self._overwrites): role = g.g...
[ "Returns", "a", ":", "class", ":", "list", "of", ":", "class", ":", "Roles", "that", "have", "been", "overridden", "from", "their", "default", "values", "in", "the", ":", "attr", ":", "Guild", ".", "roles", "attribute", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/abc.py#L290-L303
[ "def", "changed_roles", "(", "self", ")", ":", "ret", "=", "[", "]", "g", "=", "self", ".", "guild", "for", "overwrite", "in", "filter", "(", "lambda", "o", ":", "o", ".", "type", "==", "'role'", ",", "self", ".", "_overwrites", ")", ":", "role", ...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
GuildChannel.overwrites_for
Returns the channel-specific overwrites for a member or a role. Parameters ----------- obj The :class:`Role` or :class:`abc.User` denoting whose overwrite to get. Returns --------- :class:`PermissionOverwrite` The permission overwrite...
discord/abc.py
def overwrites_for(self, obj): """Returns the channel-specific overwrites for a member or a role. Parameters ----------- obj The :class:`Role` or :class:`abc.User` denoting whose overwrite to get. Returns --------- :class:`PermissionOverw...
def overwrites_for(self, obj): """Returns the channel-specific overwrites for a member or a role. Parameters ----------- obj The :class:`Role` or :class:`abc.User` denoting whose overwrite to get. Returns --------- :class:`PermissionOverw...
[ "Returns", "the", "channel", "-", "specific", "overwrites", "for", "a", "member", "or", "a", "role", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/abc.py#L315-L343
[ "def", "overwrites_for", "(", "self", ",", "obj", ")", ":", "if", "isinstance", "(", "obj", ",", "User", ")", ":", "predicate", "=", "lambda", "p", ":", "p", ".", "type", "==", "'member'", "elif", "isinstance", "(", "obj", ",", "Role", ")", ":", "p...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
GuildChannel.overwrites
Returns all of the channel's overwrites. This is returned as a dictionary where the key contains the target which can be either a :class:`Role` or a :class:`Member` and the key is the overwrite as a :class:`PermissionOverwrite`. Returns -------- Mapping[Union[:class:`Ro...
discord/abc.py
def overwrites(self): """Returns all of the channel's overwrites. This is returned as a dictionary where the key contains the target which can be either a :class:`Role` or a :class:`Member` and the key is the overwrite as a :class:`PermissionOverwrite`. Returns --------...
def overwrites(self): """Returns all of the channel's overwrites. This is returned as a dictionary where the key contains the target which can be either a :class:`Role` or a :class:`Member` and the key is the overwrite as a :class:`PermissionOverwrite`. Returns --------...
[ "Returns", "all", "of", "the", "channel", "s", "overwrites", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/abc.py#L346-L376
[ "def", "overwrites", "(", "self", ")", ":", "ret", "=", "{", "}", "for", "ow", "in", "self", ".", "_overwrites", ":", "allow", "=", "Permissions", "(", "ow", ".", "allow", ")", "deny", "=", "Permissions", "(", "ow", ".", "deny", ")", "overwrite", "...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
GuildChannel.permissions_for
Handles permission resolution for the current :class:`Member`. This function takes into consideration the following cases: - Guild owner - Guild roles - Channel overrides - Member overrides Parameters ---------- member: :class:`Member` The m...
discord/abc.py
def permissions_for(self, member): """Handles permission resolution for the current :class:`Member`. This function takes into consideration the following cases: - Guild owner - Guild roles - Channel overrides - Member overrides Parameters ---------- ...
def permissions_for(self, member): """Handles permission resolution for the current :class:`Member`. This function takes into consideration the following cases: - Guild owner - Guild roles - Channel overrides - Member overrides Parameters ---------- ...
[ "Handles", "permission", "resolution", "for", "the", "current", ":", "class", ":", "Member", "." ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/abc.py#L386-L486
[ "def", "permissions_for", "(", "self", ",", "member", ")", ":", "# The current cases can be explained as:", "# Guild owner get all permissions -- no questions asked. Otherwise...", "# The @everyone role gets the first application.", "# After that, the applied roles that the user has in the cha...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
GuildChannel.delete
|coro| Deletes the channel. You must have :attr:`~.Permissions.manage_channels` permission to use this. Parameters ----------- reason: Optional[:class:`str`] The reason for deleting this channel. Shows up on the audit log. Raises ------...
discord/abc.py
async def delete(self, *, reason=None): """|coro| Deletes the channel. You must have :attr:`~.Permissions.manage_channels` permission to use this. Parameters ----------- reason: Optional[:class:`str`] The reason for deleting this channel. Shows ...
async def delete(self, *, reason=None): """|coro| Deletes the channel. You must have :attr:`~.Permissions.manage_channels` permission to use this. Parameters ----------- reason: Optional[:class:`str`] The reason for deleting this channel. Shows ...
[ "|coro|" ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/abc.py#L488-L510
[ "async", "def", "delete", "(", "self", ",", "*", ",", "reason", "=", "None", ")", ":", "await", "self", ".", "_state", ".", "http", ".", "delete_channel", "(", "self", ".", "id", ",", "reason", "=", "reason", ")" ]
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
GuildChannel.set_permissions
r"""|coro| Sets the channel specific permission overwrites for a target in the channel. The ``target`` parameter should either be a :class:`Member` or a :class:`Role` that belongs to guild. The ``overwrite`` parameter, if given, must either be ``None`` or :class:`Permi...
discord/abc.py
async def set_permissions(self, target, *, overwrite=_undefined, reason=None, **permissions): r"""|coro| Sets the channel specific permission overwrites for a target in the channel. The ``target`` parameter should either be a :class:`Member` or a :class:`Role` that belongs to g...
async def set_permissions(self, target, *, overwrite=_undefined, reason=None, **permissions): r"""|coro| Sets the channel specific permission overwrites for a target in the channel. The ``target`` parameter should either be a :class:`Member` or a :class:`Role` that belongs to g...
[ "r", "|coro|" ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/abc.py#L512-L604
[ "async", "def", "set_permissions", "(", "self", ",", "target", ",", "*", ",", "overwrite", "=", "_undefined", ",", "reason", "=", "None", ",", "*", "*", "permissions", ")", ":", "http", "=", "self", ".", "_state", ".", "http", "if", "isinstance", "(", ...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
GuildChannel.create_invite
|coro| Creates an instant invite. You must have :attr:`~.Permissions.create_instant_invite` permission to do this. Parameters ------------ max_age: :class:`int` How long the invite should last. If it's 0 then the invite doesn't expire. Defaults ...
discord/abc.py
async def create_invite(self, *, reason=None, **fields): """|coro| Creates an instant invite. You must have :attr:`~.Permissions.create_instant_invite` permission to do this. Parameters ------------ max_age: :class:`int` How long the invite should l...
async def create_invite(self, *, reason=None, **fields): """|coro| Creates an instant invite. You must have :attr:`~.Permissions.create_instant_invite` permission to do this. Parameters ------------ max_age: :class:`int` How long the invite should l...
[ "|coro|" ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/abc.py#L646-L684
[ "async", "def", "create_invite", "(", "self", ",", "*", ",", "reason", "=", "None", ",", "*", "*", "fields", ")", ":", "data", "=", "await", "self", ".", "_state", ".", "http", ".", "create_invite", "(", "self", ".", "id", ",", "reason", "=", "reas...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
GuildChannel.invites
|coro| Returns a list of all active instant invites from this channel. You must have :attr:`~.Permissions.manage_guild` to get this information. Raises ------- Forbidden You do not have proper permissions to get the information. HTTPException An...
discord/abc.py
async def invites(self): """|coro| Returns a list of all active instant invites from this channel. You must have :attr:`~.Permissions.manage_guild` to get this information. Raises ------- Forbidden You do not have proper permissions to get the information. ...
async def invites(self): """|coro| Returns a list of all active instant invites from this channel. You must have :attr:`~.Permissions.manage_guild` to get this information. Raises ------- Forbidden You do not have proper permissions to get the information. ...
[ "|coro|" ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/abc.py#L686-L715
[ "async", "def", "invites", "(", "self", ")", ":", "state", "=", "self", ".", "_state", "data", "=", "await", "state", ".", "http", ".", "invites_from_channel", "(", "self", ".", "id", ")", "result", "=", "[", "]", "for", "invite", "in", "data", ":", ...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
Messageable.send
|coro| Sends a message to the destination with the content given. The content must be a type that can convert to a string through ``str(content)``. If the content is set to ``None`` (the default), then the ``embed`` parameter must be provided. To upload a single file, the ``fi...
discord/abc.py
async def send(self, content=None, *, tts=False, embed=None, file=None, files=None, delete_after=None, nonce=None): """|coro| Sends a message to the destination with the content given. The content must be a type that can convert to a string through ``str(content)``. If the content is s...
async def send(self, content=None, *, tts=False, embed=None, file=None, files=None, delete_after=None, nonce=None): """|coro| Sends a message to the destination with the content given. The content must be a type that can convert to a string through ``str(content)``. If the content is s...
[ "|coro|" ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/abc.py#L738-L828
[ "async", "def", "send", "(", "self", ",", "content", "=", "None", ",", "*", ",", "tts", "=", "False", ",", "embed", "=", "None", ",", "file", "=", "None", ",", "files", "=", "None", ",", "delete_after", "=", "None", ",", "nonce", "=", "None", ")"...
05d4f7f9620ef33635d6ac965b26528e09cdaf5b
train
Messageable.trigger_typing
|coro| Triggers a *typing* indicator to the destination. *Typing* indicator will go away after 10 seconds, or after a message is sent.
discord/abc.py
async def trigger_typing(self): """|coro| Triggers a *typing* indicator to the destination. *Typing* indicator will go away after 10 seconds, or after a message is sent. """ channel = await self._get_channel() await self._state.http.send_typing(channel.id)
async def trigger_typing(self): """|coro| Triggers a *typing* indicator to the destination. *Typing* indicator will go away after 10 seconds, or after a message is sent. """ channel = await self._get_channel() await self._state.http.send_typing(channel.id)
[ "|coro|" ]
Rapptz/discord.py
python
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/abc.py#L830-L839
[ "async", "def", "trigger_typing", "(", "self", ")", ":", "channel", "=", "await", "self", ".", "_get_channel", "(", ")", "await", "self", ".", "_state", ".", "http", ".", "send_typing", "(", "channel", ".", "id", ")" ]
05d4f7f9620ef33635d6ac965b26528e09cdaf5b