Skip to content

Commit

Permalink
style(pre-commit): auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Aug 12, 2024
1 parent a84304d commit 570f865
Show file tree
Hide file tree
Showing 17 changed files with 113 additions and 107 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
/.github/workflows/docs-localization-download.yml @Pycord-Dvelopment/maintain-translations
/.github/workflows/docs-localization-upload.yml @Pycord-Dvelopment/maintain-translations
/crowdin.yml @Pycord-Dvelopment/maintain-translations
/requirements/_locale.txt @Pycord-Dvelopment/maintain-translations
/requirements/_locale.txt @Pycord-Dvelopment/maintain-translations
94 changes: 49 additions & 45 deletions .github/workflows/docs-localization-download.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,54 @@
name: Multilingual Docs Download

on:
workflow_dispatch:
workflow_dispatch:

jobs:
localizse:
permissions: write-all
name: "Localisize Docs"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Install Python"
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
cache-dependency-path: "requirements/_locale.txt"
- name: "Install Dependencies"
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -r requirements/_locale.txt
pip install .[speed,voice,docs]
- name: "Get locales"
run: |
make html
sphinx-build -b gettext . ./build/locales
working-directory: ./docs
- name: "Build locales"
run: sphinx-intl update -p ./build/locales -l de -l ja -l de -l ja -l fr -l it -l hi -l ko -l pt -l es -l zh
working-directory: ./docs
- name: "Crowdin"
uses: crowdin/github-action@v2
with:
upload_sources: false
upload_translations: false
download_translations: false
download_bundle: ${{ secrets.CROWDIN_BUNDLE_ID }}
localization_branch_name: l10n_master
create_pull_request: true
pull_request_title: 'New Crowdin Translations'
pull_request_body: 'New Crowdin translations by [Crowdin GH Action](https://github.com/crowdin/github-action)'
pull_request_base_branch_name: 'master'
pull_request_reviewers: 'Lulalaby'
config: 'crowdin.yml'
base_path: '.'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_API_TOKEN }}
localizse:
permissions: write-all
name: "Localisize Docs"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Install Python"
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
cache-dependency-path: "requirements/_locale.txt"
- name: "Install Dependencies"
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -r requirements/_locale.txt
pip install .[speed,voice,docs]
- name: "Get locales"
run: |
make html
sphinx-build -b gettext . ./build/locales
working-directory: ./docs
- name: "Build locales"
run:
sphinx-intl update -p ./build/locales -l de -l ja -l de -l ja -l fr -l it -l
hi -l ko -l pt -l es -l zh
working-directory: ./docs
- name: "Crowdin"
uses: crowdin/github-action@v2
with:
upload_sources: false
upload_translations: false
download_translations: false
download_bundle: ${{ secrets.CROWDIN_BUNDLE_ID }}
localization_branch_name: l10n_master
create_pull_request: true
pull_request_title: "New Crowdin Translations"
pull_request_body:
"New Crowdin translations by [Crowdin GH
Action](https://github.com/crowdin/github-action)"
pull_request_base_branch_name: "master"
pull_request_reviewers: "Lulalaby"
config: "crowdin.yml"
base_path: "."
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_API_TOKEN }}
84 changes: 43 additions & 41 deletions .github/workflows/docs-localization-upload.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,48 @@
name: Multilingual Docs Upload

on:
push:
branches:
- master
push:
branches:
- master

jobs:
localizse:
permissions: write-all
name: "Localisize Docs"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Install Python"
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
cache-dependency-path: "requirements/_locale.txt"
- name: "Install Dependencies"
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -r requirements/_locale.txt
pip install .[speed,voice,docs]
- name: "Get locales"
run: |
make html
sphinx-build -b gettext . ./build/locales
working-directory: ./docs
- name: "Build locales"
run: sphinx-intl update -p ./build/locales -l de -l ja -l de -l ja -l fr -l it -l hi -l ko -l pt -l es -l zh
working-directory: ./docs
- name: "Crowdin"
uses: crowdin/github-action@v2
with:
upload_sources: true
upload_translations: false
download_translations: false
localization_branch_name: l10n_master
create_pull_request: false
config: 'crowdin.yml'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_API_TOKEN }}
localizse:
permissions: write-all
name: "Localisize Docs"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Install Python"
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
cache-dependency-path: "requirements/_locale.txt"
- name: "Install Dependencies"
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -r requirements/_locale.txt
pip install .[speed,voice,docs]
- name: "Get locales"
run: |
make html
sphinx-build -b gettext . ./build/locales
working-directory: ./docs
- name: "Build locales"
run:
sphinx-intl update -p ./build/locales -l de -l ja -l de -l ja -l fr -l it -l
hi -l ko -l pt -l es -l zh
working-directory: ./docs
- name: "Crowdin"
uses: crowdin/github-action@v2
with:
upload_sources: true
upload_translations: false
download_translations: false
localization_branch_name: l10n_master
create_pull_request: false
config: "crowdin.yml"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_API_TOKEN }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -190,4 +190,4 @@ docs/build/doctrees
*.mo
!docs/locales/*
/build/
/vscode/
/vscode/
4 changes: 2 additions & 2 deletions crowdin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ files:
[
{
source: "**/*.pot",
translation: "/docs/locales/%two_letters_code%/LC_MESSAGES/%original_path%/%file_name%.po"
}
translation: "/docs/locales/%two_letters_code%/LC_MESSAGES/%original_path%/%file_name%.po",
},
]
2 changes: 1 addition & 1 deletion discord/audit_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ class AuditLogDiff:
def __len__(self) -> int:
return len(self.__dict__)

def __iter__(self) -> Generator[tuple[str, Any], None, None]:
def __iter__(self) -> Generator[tuple[str, Any]]:
yield from self.__dict__.items()

def __repr__(self) -> str:
Expand Down
2 changes: 1 addition & 1 deletion discord/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,7 @@ def inner(cls: type[SlashCommandGroup]) -> SlashCommandGroup:

slash_group = group

def walk_application_commands(self) -> Generator[ApplicationCommand, None, None]:
def walk_application_commands(self) -> Generator[ApplicationCommand]:
"""An iterator that recursively walks through all application commands and subcommands.
Yields
Expand Down
4 changes: 2 additions & 2 deletions discord/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1041,7 +1041,7 @@ def get_poll(self, id: int, /) -> Poll | None:
"""
return self._connection.get_poll(id)

def get_all_channels(self) -> Generator[GuildChannel, None, None]:
def get_all_channels(self) -> Generator[GuildChannel]:
"""A generator that retrieves every :class:`.abc.GuildChannel` the client can 'access'.
This is equivalent to: ::
Expand All @@ -1065,7 +1065,7 @@ def get_all_channels(self) -> Generator[GuildChannel, None, None]:
for guild in self.guilds:
yield from guild.channels

def get_all_members(self) -> Generator[Member, None, None]:
def get_all_members(self) -> Generator[Member]:
"""Returns a generator with every :class:`.Member` the client can see.
This is equivalent to: ::
Expand Down
2 changes: 1 addition & 1 deletion discord/cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ def description(self) -> str:
def description(self, description: str) -> None:
self.__cog_description__ = description

def walk_commands(self) -> Generator[ApplicationCommand, None, None]:
def walk_commands(self) -> Generator[ApplicationCommand]:
"""An iterator that recursively walks through this cog's commands and subcommands.
Yields
Expand Down
2 changes: 1 addition & 1 deletion discord/commands/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1513,7 +1513,7 @@ async def call_after_hooks(self, ctx: ApplicationContext) -> None:
else:
await self._after_invoke(ctx) # type: ignore

def walk_commands(self) -> Generator[SlashCommand | SlashCommandGroup, None, None]:
def walk_commands(self) -> Generator[SlashCommand | SlashCommandGroup]:
"""An iterator that recursively walks through all slash commands and groups in this group.
Yields
Expand Down
2 changes: 1 addition & 1 deletion discord/ext/commands/cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def __new__(cls: type[CogT], *args: Any, **kwargs: Any) -> CogT:
# To do this, we need to interfere with the Cog creation process.
return super().__new__(cls)

def walk_commands(self) -> Generator[Command, None, None]:
def walk_commands(self) -> Generator[Command]:
"""An iterator that recursively walks through this cog's commands and subcommands.
Yields
Expand Down
2 changes: 1 addition & 1 deletion discord/ext/commands/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1326,7 +1326,7 @@ def remove_command(self, name: str) -> Command[CogT, Any, Any] | None:
self.prefixed_commands[alias] = cmd
return command

def walk_commands(self) -> Generator[Command[CogT, Any, Any], None, None]:
def walk_commands(self) -> Generator[Command[CogT, Any, Any]]:
"""An iterator that recursively walks through all commands and subcommands.
.. versionchanged:: 1.4
Expand Down
6 changes: 3 additions & 3 deletions discord/oggparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def __init__(self, stream: IO[bytes]) -> None:
except Exception:
raise OggError("bad data stream") from None

def iter_packets(self) -> Generator[tuple[bytes, bool], None, None]:
def iter_packets(self) -> Generator[tuple[bytes, bool]]:
packetlen = offset = 0
partial = True

Expand Down Expand Up @@ -106,13 +106,13 @@ def _next_page(self) -> OggPage | None:
else:
raise OggError("invalid header magic")

def _iter_pages(self) -> Generator[OggPage, None, None]:
def _iter_pages(self) -> Generator[OggPage]:
page = self._next_page()
while page:
yield page
page = self._next_page()

def iter_packets(self) -> Generator[bytes, None, None]:
def iter_packets(self) -> Generator[bytes]:
partial = b""
for page in self._iter_pages():
for data, complete in page.iter_packets():
Expand Down
6 changes: 3 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def write_new():

gettext_compact = False
gettext_uuid = True
locale_dirs = ['locales/'] # Added locale directory
locale_dirs = ["locales/"] # Added locale directory

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
Expand Down Expand Up @@ -378,7 +378,7 @@ def write_new():
# Sphinx supports the following languages:
# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr'
html_search_language = 'en'
html_search_language = "en"

# A dictionary with options for the search language support, empty by default.
# Now only 'ja' uses this config value
Expand Down Expand Up @@ -481,7 +481,7 @@ def write_new():
]

modindex_common_prefix = ["discord."]
#suppress_warnings = ['autosectionlabel.*']
# suppress_warnings = ['autosectionlabel.*']
myst_enable_extensions = [
"amsmath",
"attrs_inline",
Expand Down
2 changes: 1 addition & 1 deletion requirements/_.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
aiohttp>=3.6.0,<4.0
typing_extensions>=4,<5; python_version < "3.11"
typing_extensions>=4,<5; python_version < "3.11"
2 changes: 1 addition & 1 deletion requirements/_locale.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
-r all.txt
build==1.2.1
build==1.2.1
2 changes: 1 addition & 1 deletion requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ coverage~=7.6
pre-commit==3.5.0
codespell==2.3.0
bandit==1.7.9
flake8==7.1.1
flake8==7.1.1

0 comments on commit 570f865

Please sign in to comment.