aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorRapptz <[email protected]>2021-04-17 19:40:23 -0400
committerRapptz <[email protected]>2021-04-17 19:40:40 -0400
commitc2afa984ff3acfaf9280ca9ee225b918da97f4d9 (patch)
tree6f9e95e00658119ee53f62011d07473278717685 /docs
parentAdd inherited members to (Partial)Emoji docs (diff)
downloaddiscord.py-c2afa984ff3acfaf9280ca9ee225b918da97f4d9.tar.xz
discord.py-c2afa984ff3acfaf9280ca9ee225b918da97f4d9.zip
Use f-strings for attributetable
Diffstat (limited to 'docs')
-rw-r--r--docs/extensions/attributetable.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/docs/extensions/attributetable.py b/docs/extensions/attributetable.py
index 9af83981..c38aeb57 100644
--- a/docs/extensions/attributetable.py
+++ b/docs/extensions/attributetable.py
@@ -28,7 +28,8 @@ class attributetable_item(nodes.Part, nodes.Element):
pass
def visit_attributetable_node(self, node):
- self.body.append('<div class="py-attribute-table" data-move-to-id="%s">' % node['python-class'])
+ class_ = node["python-class"]
+ self.body.append(f'<div class="py-attribute-table" data-move-to-id="{class_}">')
def visit_attributetablecolumn_node(self, node):
self.body.append(self.starttag(node, 'div', CLASS='py-attribute-table-column'))
@@ -113,9 +114,10 @@ class PyAttributeTable(SphinxDirective):
content = self.arguments[0].strip()
node = attributetableplaceholder('')
modulename, name = self.parse_name(content)
+ node['python-doc'] = self.env.docname
node['python-module'] = modulename
node['python-class'] = name
- node['python-full-name'] = '%s.%s' % (modulename, name)
+ node['python-full-name'] = f'{modulename}.{name}'
return [node]
def build_lookup_table(env):
@@ -178,10 +180,11 @@ def get_class_results(lookup, modulename, name, fullname):
return groups
for attr in members:
- attrlookup = '%s.%s' % (fullname, attr)
+ attrlookup = f'{fullname}.{attr}'
key = _('Attributes')
badge = None
label = attr
+ value = None
for base in cls.__mro__:
value = base.__dict__.get(attr)
@@ -196,7 +199,7 @@ def get_class_results(lookup, modulename, name, fullname):
badge['badge-type'] = _('coroutine')
elif isinstance(value, classmethod):
key = _('Methods')
- label = '%s.%s' % (name, attr)
+ label = f'{name}.{attr}'
badge = attributetablebadge('cls', 'cls')
badge['badge-type'] = _('classmethod')
elif inspect.isfunction(value):