Skip to content

Commit

Permalink
General maintenance (#166)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
No767 and pre-commit-ci[bot] authored Apr 20, 2024
1 parent 8c826d3 commit 003f377
Show file tree
Hide file tree
Showing 18 changed files with 75 additions and 1,782 deletions.
File renamed without changes.
File renamed without changes.
26 changes: 26 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Summary

<!-- What is this pull request for? Does it fix any issues? -->

## Types of changes

What types of changes does your code introduce to Catherine-Chan
_Put an `x` in the boxes that apply_

- [ ] Bugfix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Documentation Update (Updates to README.md, the documentation, etc)
- [ ] Other (if none of the other choices apply)


## Checklist

<!-- Put an x inside [ ] to check it, like so: [x] -->

_Put an `x` in the boxes that apply_

- [ ] If code changes were made then they have been tested.
- [ ] I have updated the documentation to reflect the changes. (if appropriate)
- [ ] All workflows (except pre-commit.ci) pass with my new changes
- [ ] This PR does **not** address a duplicate issue or PR
8 changes: 2 additions & 6 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,15 @@ updates:
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "daily"
interval: "weekly"
commit-message:
prefix: "[pip]"
include: "scope"
target-branch: "main"
ignore:
# Ignore cystemd bc the newest release breaks all workflows
- dependency-name: "cysystemd"
update-types: ["version-update:semver-minor", "version-update:semver-major"]
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
interval: "weekly"
commit-message:
prefix: "[Actions]"
include: "scope"
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: "CodeQL"
on:
push:
branches:
- stable
- main

pull_request:
Expand Down Expand Up @@ -49,7 +48,6 @@ jobs:
uses: github/codeql-action/init@v3
with:
languages: python
setup-python-dependencies: false

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Release
on:
push:
branches:
- stable
- main
jobs:
Release:
runs-on: ubuntu-latest
Expand All @@ -18,7 +18,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
WITH_V: true
RELEASE_BRANCHES: stable
RELEASE_BRANCHES: main

- name: Release New Version
uses: ncipollo/release-action@v1
Expand Down
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ exclude: ".env,.yml,.gitignore,.git,.md,.txt"
default_stages: [push, commit]
repos:
- repo: https://github.com/PyCQA/bandit
rev: 1.7.5
rev: 1.7.8
hooks:
- id: bandit
args: ["-c", "pyproject.toml"]
Expand All @@ -14,14 +14,14 @@ repos:
additional_dependencies: ["bandit[toml]"]

- repo: https://github.com/psf/black
rev: 23.7.0
rev: 24.4.0
hooks:
- id: black
name: Black
stages: [commit]

- repo: https://github.com/PyCQA/autoflake
rev: v2.2.0
rev: v2.3.1
hooks:
- id: autoflake
args: ["--in-place", "--remove-unused-variables", "--recursive"]
Expand All @@ -30,14 +30,14 @@ repos:
stages: [commit]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.292
rev: v0.4.1
hooks:
- id: ruff
name: Ruff
args: ["--fix", "--exit-non-zero-on-fix", "--config", "pyproject.toml"]

- repo: https://github.com/PyCQA/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
name: ISort
Expand Down
7 changes: 0 additions & 7 deletions Makefile

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# Catherine-Chan

[![Required Python Version](https://img.shields.io/badge/Python-3.8%20|%203.9%20|%203.10%20|%203.11-blue?logo=python&logoColor=white)](https://github.com/No767/Catherine-Chan/blob/main/pyproject.toml) [![CodeQL](https://github.com/No767/Catherine-Chan/actions/workflows/codeql.yml/badge.svg)](https://github.com/No767/Catherine-Chan/actions/workflows/codeql.yml) [![Lint](https://github.com/No767/Catherine-Chan/actions/workflows/lint.yml/badge.svg)](https://github.com/No767/Catherine-Chan/actions/workflows/lint.yml) [![Tests](https://github.com/No767/Catherine-Chan/actions/workflows/tests.yml/badge.svg)](https://github.com/No767/Catherine-Chan/actions/workflows/tests.yml) ![Read the Docs](https://img.shields.io/readthedocs/catherine-chan?label=Docs&logo=readthedocs&logoColor=white) [![codecov](https://codecov.io/gh/No767/Catherine-Chan/graph/badge.svg?token=mAPjhFgiGE)](https://codecov.io/gh/No767/Catherine-Chan) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=No767_Catherine-Chan&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=No767_Catherine-Chan) [![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=No767_Catherine-Chan&metric=ncloc)](https://sonarcloud.io/summary/new_code?id=No767_Catherine-Chan) ![GitHub release (with filter)](https://img.shields.io/github/v/release/No767/Catherine-Chan?label=Release&logo=github&sort=semver) ![GitHub](https://img.shields.io/github/license/No767/Catherine-Chan?logo=github&logoColor=white&label=License) [![Discord](https://img.shields.io/discord/1145897416160194590?logo=discord&logoColor=white&label=Discord&color=%235865F2)](https://discord.gg/ns3e74frqn) [![Catherine](https://img.shields.io/badge/Catherine-Kano%20(穫野)-pink)]()
[![Required Python Version](https://img.shields.io/badge/Python-3.9%20|%203.10%20|%203.11%20|%203.12-blue?logo=python&logoColor=white)](https://github.com/No767/Catherine-Chan/blob/main/pyproject.toml) [![CodeQL](https://github.com/No767/Catherine-Chan/actions/workflows/codeql.yml/badge.svg)](https://github.com/No767/Catherine-Chan/actions/workflows/codeql.yml) [![Lint](https://github.com/No767/Catherine-Chan/actions/workflows/lint.yml/badge.svg)](https://github.com/No767/Catherine-Chan/actions/workflows/lint.yml) ![Read the Docs](https://img.shields.io/readthedocs/catherine-chan?label=Docs&logo=readthedocs&logoColor=white) [![codecov](https://codecov.io/gh/No767/Catherine-Chan/graph/badge.svg?token=mAPjhFgiGE)](https://codecov.io/gh/No767/Catherine-Chan) [![pre-commit.ci status](https://results.pre-commit.ci/badge/github/No767/Catherine-Chan/main.svg)](https://results.pre-commit.ci/latest/github/No767/Catherine-Chan/main) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=No767_Catherine-Chan&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=No767_Catherine-Chan) [![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=No767_Catherine-Chan&metric=ncloc)](https://sonarcloud.io/summary/new_code?id=No767_Catherine-Chan) ![GitHub release (with filter)](https://img.shields.io/github/v/release/No767/Catherine-Chan?label=Release&logo=github&sort=semver) ![GitHub](https://img.shields.io/github/license/No767/Catherine-Chan?logo=github&logoColor=white&label=License) [![Discord](https://img.shields.io/discord/1145897416160194590?logo=discord&logoColor=white&label=Discord&color=%235865F2)](https://discord.gg/ns3e74frqn) [![Catherine](https://img.shields.io/badge/Catherine-Kano%20(穫野)-pink)]()

The modern all-in-one toolkit for LGBTQ+ folks

Expand Down Expand Up @@ -43,7 +43,7 @@ If you would like to support me with projects like these, please consider starri

If you would like to get started (either with development or as an end user), here are some links to help you with that:

- [Contributing](./CONTRIBUTING.md)
- [Contributing](./.github/CONTRIBUTING.md)
- [Documentation](https://catherine-chan.readthedocs.io)

## Licensing
Expand Down
9 changes: 6 additions & 3 deletions bot/catherinebot.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@


async def main() -> None:
async with ClientSession() as session, asyncpg.create_pool(
dsn=POSTGRES_URI, min_size=25, max_size=25, command_timeout=60
) as pool:
async with (
ClientSession() as session,
asyncpg.create_pool(
dsn=POSTGRES_URI, min_size=25, max_size=25, command_timeout=60
) as pool,
):
async with Catherine(
config=config,
intents=intents,
Expand Down
24 changes: 13 additions & 11 deletions bot/cogs/pronouns.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,17 +169,19 @@ async def profile(self, interaction: discord.Interaction, username: str) -> None
for words in v["words"]
],
timezone=v["timezone"]["tz"],
circle=[
PronounsProfileCircleEntry(
username=member["username"],
avatar=member["avatar"],
mutual=member["circleMutual"],
relationship=member["relationship"],
)
for member in v["circle"]
]
if len(v["circle"]) != 0
else None,
circle=(
[
PronounsProfileCircleEntry(
username=member["username"],
avatar=member["avatar"],
mutual=member["circleMutual"],
relationship=member["relationship"],
)
for member in v["circle"]
]
if len(v["circle"]) != 0
else None
),
)
for k, v in data["profiles"].items()
}
Expand Down
2 changes: 1 addition & 1 deletion bot/libs/ui/blacklist/pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def __init__(
entries: List[Dict[int, bool]],
*,
ctx: commands.Context,
per_page: int = 10
per_page: int = 10,
):
converted = [BlacklistPageEntry(entry) for entry in entries]
super().__init__(converted, per_page=per_page, ctx=ctx)
8 changes: 4 additions & 4 deletions bot/libs/ui/dictionary/pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def __init__(
entries: List[TermEntity],
*,
interaction: discord.Interaction,
per_page: int = 1
per_page: int = 1,
):
converted = [TermEntityEntry(entry).to_dict() for entry in entries]
super().__init__(
Expand All @@ -33,7 +33,7 @@ def __init__(
entries: List[InclusiveEntity],
*,
interaction: discord.Interaction,
per_page: int = 1
per_page: int = 1,
):
converted = [InclusiveEntityEntry(entry).to_dict() for entry in entries]
super().__init__(
Expand All @@ -48,7 +48,7 @@ def __init__(
entries: List[NounEntity],
*,
interaction: discord.Interaction,
per_page: int = 1
per_page: int = 1,
):
converted = [NounEntityEntry(entry).to_dict() for entry in entries]
super().__init__(
Expand All @@ -63,7 +63,7 @@ def __init__(
entries: List[PronounsEntity],
*,
interaction: discord.Interaction,
per_page: int = 1
per_page: int = 1,
):
converted = [PronounsEntityEntry(entry).to_dict() for entry in entries]
super().__init__(
Expand Down
8 changes: 5 additions & 3 deletions bot/libs/ui/dictionary/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,11 @@ def format_inclusive_content(content: InclusiveContent):
f"### Instead of \n{format_instead_of_options(content.instead_of)}",
f"### Better Say\n{format_title_options(content.say)}",
f"### Because\n{content.because}",
f"### Clarification\n{content.clarification}"
if content.clarification is not None
else "",
(
f"### Clarification\n{content.clarification}"
if content.clarification is not None
else ""
),
)

return "\n".join(final_content)
Expand Down
4 changes: 2 additions & 2 deletions bot/libs/ui/pride_profiles/pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def __init__(
entries: List[SimpleProfileEntry],
*,
interaction: discord.Interaction,
per_page=1
per_page=1,
):
converted = [SimpleProfilesPageEntry(entry) for entry in entries]
super().__init__(
Expand All @@ -30,7 +30,7 @@ def __init__(
entries: List[SimpleViewsEntry],
*,
interaction: discord.Interaction,
per_page=1
per_page=1,
):
converted = [ViewsProfilePageEntry(entry) for entry in entries]
super().__init__(
Expand Down
10 changes: 5 additions & 5 deletions bot/libs/ui/tonetags/pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def __init__(
entries: List[ToneTagInfo],
*,
interaction: discord.Interaction,
per_page: int = 1
per_page: int = 1,
):
converted = [ToneTagInfoPageEntry(entry).to_dict() for entry in entries]
super().__init__(
Expand All @@ -34,7 +34,7 @@ def __init__(
self,
entries: List[ExactAndSimilarTonetags],
*,
interaction: discord.Interaction
interaction: discord.Interaction,
):
converted = [ESTonetagsPageEntry(entry).to_dict() for entry in entries]
super().__init__(
Expand All @@ -49,7 +49,7 @@ def __init__(
entries: List[SimpleToneTag],
*,
interaction: discord.Interaction,
per_page: int = 12
per_page: int = 12,
):
converted = [SimpleToneTagPageEntry(entry) for entry in entries]
super().__init__(converted, per_page=per_page, interaction=interaction)
Expand All @@ -61,7 +61,7 @@ def __init__(
entries: List[BareToneTag],
*,
interaction: discord.Interaction,
per_page: int = 12
per_page: int = 12,
):
converted = [BareToneTagPageEntry(entry) for entry in entries]
super().__init__(converted, per_page=per_page, interaction=interaction)
Expand All @@ -73,7 +73,7 @@ def __init__(
entries: List[StatsBareToneTag],
*,
interaction: discord.Interaction,
per_page: int = 10
per_page: int = 10,
):
converted = [StatsBareToneTagPageEntry(entry) for entry in entries]
super().__init__(converted, per_page=per_page, interaction=interaction)
6 changes: 2 additions & 4 deletions bot/libs/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,10 @@ def postgres(self) -> _T:
return self._config["postgres"]

@overload
def get(self, key: Any) -> Optional[Union[_T, Any]]:
...
def get(self, key: Any) -> Optional[Union[_T, Any]]: ...

@overload
def get(self, key: Any, default: Any) -> Union[_T, Any]:
...
def get(self, key: Any, default: Any) -> Union[_T, Any]: ...

def get(self, key: Any, default: Any = None) -> Optional[Union[_T, Any]]:
"""Retrieves a config entry."""
Expand Down
Loading

0 comments on commit 003f377

Please sign in to comment.