text stringlengths 81 112k |
|---|
Like channel, but for softmax layers.
Args:
layer: A layer name string.
label: Either a string (refering to a label in model.labels) or an int
label position.
Returns:
Objective maximizing a logit.
def class_logit(layer, label):
"""Like channel, but for softmax layers.
Args:
layer: A l... |
Convert obj into Objective class.
Strings of the form "layer:n" become the Objective channel(layer, n).
Objectives are returned unchanged.
Args:
obj: string or Objective.
Returns:
Objective
def as_objective(obj):
"""Convert obj into Objective class.
Strings of the form "layer:n" become the Obje... |
Gradient for constrained optimization on an L2 unit ball.
This function projects the gradient onto the ball if you are on the boundary
(or outside!), but leaves it untouched if you are inside the ball.
Args:
op: the tensorflow op we're computing the gradient for.
grad: gradient we need to backprop
Re... |
A tensorflow variable tranfomed to be constrained in a L2 unit ball.
EXPERIMENTAL: Do not use for adverserial examples if you need to be confident
they are strong attacks. We are not yet confident in this code.
def unit_ball_L2(shape):
"""A tensorflow variable tranfomed to be constrained in a L2 unit ball.
E... |
A tensorflow variable tranfomed to be constrained in a L_inf unit ball.
Note that this code also preconditions the gradient to go in the L_inf
direction of steepest descent.
EXPERIMENTAL: Do not use for adverserial examples if you need to be confident
they are strong attacks. We are not yet confident in this ... |
Flexible optimization-base feature vis.
There's a lot of ways one might wish to customize otpimization-based
feature visualization. It's hard to create an abstraction that stands up
to all the things one might wish to try.
This function probably can't do *everything* you want, but it's much more
flexible th... |
Even more flexible optimization-base feature vis.
This function is the inner core of render_vis(), and can be used
when render_vis() isn't flexible enough. Unfortunately, it's a bit more
tedious to use:
> with tf.Graph().as_default() as graph, tf.Session() as sess:
>
> T = make_vis_T(model, "mixed4a_p... |
layout: numpy arrays x, y
metadata: user-defined numpy arrays with metadata
n_layer: number of cells in the layer (squared)
n_tile: number of cells in the tile (squared)
def grid(metadata, layout, params):
"""
layout: numpy arrays x, y
metadata: user-defined numpy arrays with metadata
n_layer: number of ... |
Write a file for each tile
def write_grid_local(tiles, params):
"""
Write a file for each tile
"""
# TODO: this isn't being used right now, will need to be
# ported to gfile if we want to keep it
for ti,tj,tile in enumerate_tiles(tiles):
filename = "{directory}/{name}/tile_{n_layer}_{n_tile}_{ti}_{tj}"... |
Convenience
def enumerate_tiles(tiles):
"""
Convenience
"""
enumerated = []
for key in tiles.keys():
enumerated.append((key[0], key[1], tiles[key]))
return enumerated |
Load image file as numpy array.
def _load_img(handle, target_dtype=np.float32, size=None, **kwargs):
"""Load image file as numpy array."""
image_pil = PIL.Image.open(handle, **kwargs)
# resize the image to the requested size, if one was specified
if size is not None:
if len(size) > 2:
... |
Load and decode a string.
def _load_text(handle, split=False, encoding="utf-8"):
"""Load and decode a string."""
string = handle.read().decode(encoding)
return string.splitlines() if split else string |
Load GraphDef from a binary proto file.
def _load_graphdef_protobuf(handle, **kwargs):
"""Load GraphDef from a binary proto file."""
# as_graph_def
graph_def = tf.GraphDef.FromString(handle.read())
# check if this is a lucid-saved model
# metadata = modelzoo.util.extract_metadata(graph_def)
# ... |
Load a file.
File format is inferred from url. File retrieval strategy is inferred from
URL. Returned object type is inferred from url extension.
Args:
url_or_handle: a (reachable) URL, or an already open file handle
Raises:
RuntimeError: If file extension or URL is not supported.
def lo... |
Ensures the specified spatial shape by either padding or cropping.
Meant to be used as a last transform for architectures insisting on a specific
spatial shape of their inputs.
def crop_or_pad_to(height, width):
"""Ensures the specified spatial shape by either padding or cropping.
Meant to be used as a... |
Given an arbitrary rank-3 NumPy array, produce one representing an image.
This ensures the resulting array has a dtype of uint8 and a domain of 0-255.
Args:
array: NumPy array representing the image
domain: expected range of values in array,
defaults to (0, 1), if explicitly set to None will use the... |
Given a normalized array, returns byte representation of image encoding.
Args:
array: NumPy array of dtype uint8 and range 0 to 255
fmt: string describing desired file format, defaults to 'png'
quality: specifies compression quality from 0 to 100 for lossy formats
Returns:
image data as BytesIO bu... |
Given an arbitrary rank-3 NumPy array,
returns the byte representation of the encoded image.
Args:
array: NumPy array of dtype uint8 and range 0 to 255
domain: expected range of values in array, see `_normalize_array()`
fmt: string describing desired file format, defaults to 'png'
quality: specifie... |
Serialize 1d NumPy array to JS TypedArray.
Data is serialized to base64-encoded string, which is much faster
and memory-efficient than json list serialization.
Args:
array: 1d NumPy array, dtype must be one of JS_ARRAY_TYPES.
Returns:
JS code that evaluates to a TypedArray as string.
Raises:
T... |
Utility for applying f to inner dimension of acts.
Flattens acts into a 2D tensor, applies f, then unflattens so that all
dimesnions except innermost are unchanged.
def _apply_flat(cls, f, acts):
"""Utility for applying f to inner dimension of acts.
Flattens acts into a 2D tensor, applies f, then unf... |
Set target style variables.
Expected usage:
style_loss = StyleLoss(style_layers)
...
init_op = tf.global_variables_initializer()
init_op.run()
feeds = {... session.run() 'feeds' argument that will make 'style_layers'
tensors evaluate to activation values of ... |
Create a data URL representing an image from a PIL.Image.
Args:
image: a numpy
mode: presently only supports "data" for data URL
Returns:
URL representing image
def _image_url(array, fmt='png', mode="data", quality=90, domain=None):
"""Create a data URL representing an image from a PIL.Image.
Ar... |
Display an image.
Args:
array: NumPy array representing the image
fmt: Image format e.g. png, jpeg
domain: Domain of pixel values, inferred from min & max values if None
w: width of output image, scaled using nearest neighbor interpolation.
size unchanged if None
def image(array, domain=None, ... |
Display a list of images with optional labels.
Args:
arrays: A list of NumPy arrays representing images
labels: A list of strings to label each image.
Defaults to show index if None
domain: Domain of pixel values, inferred from min & max values if None
w: width of output image, scaled using nea... |
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.
def show(thing, domain=(0, 1), **kwargs):
"""Display a nupmy arr... |
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
def _strip_consts(graph_def, max_const_size=32):
"""Strip large constant values ... |
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
def graph(graph_def, max_const_size=32):
"""Visualize a TensorFlow graph.
This functio... |
Resize an ndarray image of rank 3 or 4.
target_size can be a tuple `(width, height)` or scalar `width`.
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):
targe... |
Takes two images and composites them.
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... |
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 ... |
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.
def create_ses... |
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... |
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... |
Returns the path that remote_url would be cached at locally.
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) |
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:
... |
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... |
Renders an Activation Atlas of the given model's layer.
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 = ... |
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.
def aligned_activation_atlas(
model1,
layer1,
model2,
layer2,
grid_size=10,
icon_size=80,
num_... |
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... |
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.
def bin_laid_out_activations(layout, activations, grid_size, threshold=5):
... |
Load GraphDef from a binary proto file.
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 |
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.
def forget_xy(t):
"""Ignore sizes of dimen... |
Return frozen and simplified graph_def of default graph.
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.remov... |
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`.
def infuse_metadata(graph_def, info):
"""Embed meta data as a string constant in a TF graph.
This function takes info, converts it i... |
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.
def extract_metadata(graph_def):
"""Attempt to extract meta data hidden in graph_def.
Looks for a `__lucid_met... |
Am I really handcoding graph traversal please no
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 i... |
Retrieve messages using before parameter.
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):
... |
Retrieve messages using after parameter.
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):
... |
Retrieve messages using around parameter.
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=... |
Retrieve guilds using before parameter.
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.limi... |
Retrieve guilds using after parameter.
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... |
|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... |
Constructs a :class:`Colour` from an HSV tuple.
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)) |
:class:`str`: Returns the cog's description, typically the cleaned docstring.
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__ =... |
An iterator that recursively walks through this cog's commands and subcommands.
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... |
Returns a :class:`list` of (name, function) listener pairs that are defined in this cog.
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__] |
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
-... |
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... |
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... |
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... |
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:... |
Converts this embed object into a dict.
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)
}
... |
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... |
Checks if the user is mentioned in the specified message.
Parameters
-----------
message: :class:`Message`
The message to check if you're mentioned in.
def mentioned_in(self, message):
"""Checks if the user is mentioned in the specified message.
Parameters
... |
r"""Returns a :class:`list` of :class:`User`\s that the user is friends with.
.. note::
This only applies to non-bot accounts.
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 acco... |
r"""Returns a :class:`list` of :class:`User`\s that the user has blocked.
.. note::
This only applies to non-bot accounts.
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.
... |
|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... |
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... |
|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... |
Creates a :class:`DMChannel` with this user.
This should be rarely called, as this is done transparently for most
people.
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.
... |
|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
... |
:class:`bool`: Checks if the user is your friend.
.. note::
This only applies to non-bot accounts.
def is_friend(self):
""":class:`bool`: Checks if the user is your friend.
.. note::
This only applies to non-bot accounts.
"""
r = self.relationship
... |
:class:`bool`: Checks if the user is blocked.
.. note::
This only applies to non-bot accounts.
def is_blocked(self):
""":class:`bool`: Checks if the user is blocked.
.. note::
This only applies to non-bot accounts.
"""
r = self.relationship
if... |
|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.
async def block(self):
"""|coro|
Blocks the ... |
|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.
async def send_fri... |
|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... |
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
... |
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... |
Returns string's width.
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... |
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.
def resolve_invite(invite):
"""
Resolves an invite from a :class:`Invite... |
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
... |
Adds two numbers together.
async def add(ctx, left: int, right: int):
"""Adds two numbers together."""
await ctx.send(left + right) |
Rolls a dice in NdN format.
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)... |
Repeats a message multiple times.
async def repeat(ctx, times: int, content='repeating...'):
"""Repeats a message multiple times."""
for i in range(times):
await ctx.send(content) |
Joins a voice channel
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() |
Plays a file from the local filesystem
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)
awa... |
Streams from a url (same as yt, but doesn't predownload)
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(p... |
Changes the player's 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 {... |
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.
def duration(self):
"""Queries the duration of the call.
If... |
A property that returns the :class:`list` of :class:`User` that are currently in this call.
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... |
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... |
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` ... |
Optional[:class:`TextChannel`]: The text channel this webhook belongs to.
If this is a partial webhook, then this will always return ``None``.
def channel(self):
"""Optional[:class:`TextChannel`]: The text channel this webhook belongs to.
If this is a partial webhook, then this will always re... |
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
... |
|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`]... |
|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 ... |
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... |
Returns a :class:`list` of :class:`Member` that can see this channel.
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] |
|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... |
|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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.