Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 26 additions & 16 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,35 @@
name: Lint

on: [push, pull_request]
on: [push]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9]

python-version: ["3.9"]
steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade pre-commit
- name: Lint
run: pre-commit run --all-files --show-diff-on-failure
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flynt black pip install isort[requirements_deprecated_finder]
- name: isort
run: isort . --profile black
- name: Black
run: black ./ --line-length=120
- name: Flynt
run: flynt ./ -tc
- name: Setup Git
run: |
git config user.name "Pycord Automated Linter"
- name: Push To Git
run: |
git pull
git add .
git commit --reuse-message=HEAD
git push
20 changes: 0 additions & 20 deletions .pre-commit-config.yaml

This file was deleted.

6 changes: 2 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,13 @@

version = ""
with open("../discord/__init__.py") as f:
version = re.search(
r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', f.read(), re.MULTILINE
).group(1)
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', f.read(), re.MULTILINE).group(1)

# The full version, including alpha/beta/rc tags.
release = version

# This assumes a tag is available for final releases
branch = "master" if version.endswith("a") or version.endswith("b") else "v" + version
branch = "master" if version.endswith("a") or version.endswith("b") else f"v{version}"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
14 changes: 4 additions & 10 deletions docs/extensions/attributetable.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,7 @@ def parse_name(self, content):
if not modulename:
modulename = self.env.ref_context.get("py:module")
if modulename is None:
raise RuntimeError(
f"modulename somehow None for {content} in {self.env.docname}."
)
raise RuntimeError(f"modulename somehow None for {content} in {self.env.docname}.")

return modulename, name

Expand Down Expand Up @@ -185,9 +183,7 @@ def process_attributetable(app, doctree, fromdocname):
for label, subitems in groups.items():
if not subitems:
continue
table.append(
class_results_to_node(label, sorted(subitems, key=lambda c: c.label))
)
table.append(class_results_to_node(label, sorted(subitems, key=lambda c: c.label)))

table["python-class"] = fullname

Expand Down Expand Up @@ -260,7 +256,7 @@ def class_results_to_node(key, elements):
"",
"",
internal=True,
refuri="#" + element.fullname,
refuri=f"#{element.fullname}",
anchorname="",
*[nodes.Text(element.label)],
)
Expand All @@ -275,9 +271,7 @@ def class_results_to_node(key, elements):

def setup(app):
app.add_directive("attributetable", PyAttributeTable)
app.add_node(
attributetable, html=(visit_attributetable_node, depart_attributetable_node)
)
app.add_node(attributetable, html=(visit_attributetable_node, depart_attributetable_node))
app.add_node(
attributetablecolumn,
html=(visit_attributetablecolumn_node, depart_attributetablecolumn_node),
Expand Down
9 changes: 3 additions & 6 deletions docs/extensions/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ def write_genindex(self) -> None:
genindex = IndexEntries(self.env).create_index(self, group_entries=False)
indexcounts = []
for _k, entries in genindex:
indexcounts.append(
sum(1 + len(subitems) for _, (_, subitems, _) in entries)
)
indexcounts.append(sum(1 + len(subitems) for _, (_, subitems, _) in entries))

genindexcontext = {
"genindexentries": genindex,
Expand All @@ -49,7 +47,7 @@ def write_genindex(self) -> None:
"count": count,
"genindexentries": genindex,
}
self.handle_page("genindex-" + key, ctx, "genindex-single.html")
self.handle_page(f"genindex-{key}", ctx, "genindex-single.html")
else:
self.handle_page("genindex", genindexcontext, "genindex.html")

Expand All @@ -71,8 +69,7 @@ def add_builders(app) -> None:
pass
else:
injected_mro = tuple(
base if base is not StandaloneHTMLBuilder else DPYStandaloneHTMLBuilder
for base in original.mro()[1:]
base if base is not StandaloneHTMLBuilder else DPYStandaloneHTMLBuilder for base in original.mro()[1:]
)
new_builder = type(original.__name__, injected_mro, {"name": "readthedocs"})
app.set_translator("readthedocs", DPYHTML5Translator, override=True)
Expand Down
8 changes: 2 additions & 6 deletions docs/extensions/details.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,11 @@ class summary(nodes.General, nodes.Element):


def visit_details_node(self, node):
self.body.append(
self.starttag(node, "details", CLASS=node.attributes.get("class", ""))
)
self.body.append(self.starttag(node, "details", CLASS=node.attributes.get("class", "")))


def visit_summary_node(self, node):
self.body.append(
self.starttag(node, "summary", CLASS=node.attributes.get("summary-class", ""))
)
self.body.append(self.starttag(node, "summary", CLASS=node.attributes.get("summary-class", "")))
self.body.append(node.rawsource)


Expand Down
5 changes: 1 addition & 4 deletions docs/extensions/nitpick_file_ignorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ def __init__(self, app: Sphinx) -> None:

def filter(self, record: sphinx_logging.SphinxLogRecord) -> bool:
if getattr(record, "type", None) == "ref":
return (
record.location.get("refdoc")
not in self.app.config.nitpick_ignore_files
)
return record.location.get("refdoc") not in self.app.config.nitpick_ignore_files
return True


Expand Down
2 changes: 0 additions & 2 deletions requirements-dev.txt

This file was deleted.

6 changes: 2 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
version = ""
with open("discord/__init__.py") as f:

search = re.search(
r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', f.read(), re.MULTILINE
)
search = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', f.read(), re.MULTILINE)

if search is not None:
version = search.group(1)
Expand Down Expand Up @@ -44,7 +42,7 @@
)
out, err = p.communicate()
if out:
version += "+g" + out.decode("utf-8").strip()
version += f"+g{out.decode('utf-8').strip()}"
except Exception:
pass

Expand Down