Skip to content

Commit

Permalink
Merge branch 'master' into ci/ubuntu-image-deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
shiftinv authored Jan 28, 2025
2 parents 5fd8a95 + 38ba687 commit 776c8b3
Show file tree
Hide file tree
Showing 70 changed files with 420 additions and 708 deletions.
2 changes: 1 addition & 1 deletion .libcst.codemod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ generated_code_marker: '@generated_module'
# Command line and arguments for invoking a code formatter. Anything
# specified here must be capable of taking code via stdin and returning
# formatted code via stdout.
formatter: ['black', '-q' , '-']
formatter: ['ruff', 'format' , '-']
# List of regex patterns which LibCST will evaluate against filenames to
# determine if the module should be touched.
blacklist_patterns: []
Expand Down
9 changes: 2 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,9 @@ repos:
exclude_types: [json, pofile]
exclude: 'changelog/|py.typed|disnake/bin/COPYING|.github/PULL_REQUEST_TEMPLATE.md|.github/CODEOWNERS|LICENSE|MANIFEST.in'

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.9.1
hooks:
- id: black
name: "run black in all files"

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.8.0
rev: v0.9.3
hooks:
- id: ruff-format
- id: ruff
args: [--fix, --fixable=I]
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Once PDM is installed, use the following command to initialize a virtual environ
$ pdm run setup_env
```

Other tools used in this project include [black](https://black.readthedocs.io/en/stable/) (formatter), [ruff](https://beta.ruff.rs/docs/) (linter), and [pyright](https://microsoft.github.io/pyright/#/) (type-checker). For the most part, these automatically run on every commit with no additional action required - see below for details.
Other tools used in this project include [ruff](https://docs.astral.sh/ruff) (formatter and linter), and [pyright](https://microsoft.github.io/pyright/#/) (type-checker). For the most part, these automatically run on every commit with no additional action required - see below for details.

All of the following checks also automatically run for every PR on GitHub, so don't worry if you're not sure whether you missed anything. A PR cannot be merged as long as there are any failing checks.

Expand Down
33 changes: 11 additions & 22 deletions disnake/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,7 @@ class GuildChannel(ABC):

def __init__(
self, *, state: ConnectionState, guild: Guild, data: Mapping[str, Any]
) -> None:
...
) -> None: ...

def __str__(self) -> str:
return self.name
Expand Down Expand Up @@ -843,8 +842,7 @@ async def set_permissions(
*,
overwrite: Optional[PermissionOverwrite] = ...,
reason: Optional[str] = ...,
) -> None:
...
) -> None: ...

@overload
@_overload_with_permissions
Expand Down Expand Up @@ -911,8 +909,7 @@ async def set_permissions(
view_channel: Optional[bool] = ...,
view_creator_monetization_analytics: Optional[bool] = ...,
view_guild_insights: Optional[bool] = ...,
) -> None:
...
) -> None: ...

async def set_permissions(
self,
Expand Down Expand Up @@ -1118,8 +1115,7 @@ async def move(
category: Optional[Snowflake] = ...,
sync_permissions: bool = ...,
reason: Optional[str] = ...,
) -> None:
...
) -> None: ...

@overload
async def move(
Expand All @@ -1130,8 +1126,7 @@ async def move(
category: Optional[Snowflake] = ...,
sync_permissions: bool = ...,
reason: Optional[str] = ...,
) -> None:
...
) -> None: ...

@overload
async def move(
Expand All @@ -1142,8 +1137,7 @@ async def move(
category: Optional[Snowflake] = ...,
sync_permissions: bool = ...,
reason: Optional[str] = ...,
) -> None:
...
) -> None: ...

@overload
async def move(
Expand All @@ -1154,8 +1148,7 @@ async def move(
category: Optional[Snowflake] = ...,
sync_permissions: bool = ...,
reason: Optional[str] = ...,
) -> None:
...
) -> None: ...

async def move(self, **kwargs: Any) -> None:
"""|coro|
Expand Down Expand Up @@ -1442,8 +1435,7 @@ async def send(
view: View = ...,
components: Components[MessageUIComponent] = ...,
poll: Poll = ...,
) -> Message:
...
) -> Message: ...

@overload
async def send(
Expand All @@ -1464,8 +1456,7 @@ async def send(
view: View = ...,
components: Components[MessageUIComponent] = ...,
poll: Poll = ...,
) -> Message:
...
) -> Message: ...

@overload
async def send(
Expand All @@ -1486,8 +1477,7 @@ async def send(
view: View = ...,
components: Components[MessageUIComponent] = ...,
poll: Poll = ...,
) -> Message:
...
) -> Message: ...

@overload
async def send(
Expand All @@ -1508,8 +1498,7 @@ async def send(
view: View = ...,
components: Components[MessageUIComponent] = ...,
poll: Poll = ...,
) -> Message:
...
) -> Message: ...

async def send(
self,
Expand Down
6 changes: 2 additions & 4 deletions disnake/activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -890,13 +890,11 @@ def __repr__(self) -> str:
@overload
def create_activity(
data: Union[ActivityPayload, WidgetActivityPayload], *, state: Optional[ConnectionState] = None
) -> ActivityTypes:
...
) -> ActivityTypes: ...


@overload
def create_activity(data: None, *, state: Optional[ConnectionState] = None) -> None:
...
def create_activity(data: None, *, state: Optional[ConnectionState] = None) -> None: ...


def create_activity(
Expand Down
8 changes: 3 additions & 5 deletions disnake/audit_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def _transform(entry: AuditLogEntry, data: Optional[int]) -> Optional[FlagsT]:


def _list_transformer(
func: Callable[[AuditLogEntry, Any], T]
func: Callable[[AuditLogEntry, Any], T],
) -> Callable[[AuditLogEntry, Any], List[T]]:
def _transform(entry: AuditLogEntry, data: Any) -> List[T]:
if not data:
Expand Down Expand Up @@ -303,11 +303,9 @@ def __repr__(self) -> str:

if TYPE_CHECKING:

def __getattr__(self, item: str) -> Any:
...
def __getattr__(self, item: str) -> Any: ...

def __setattr__(self, key: str, value: Any) -> Any:
...
def __setattr__(self, key: str, value: Any) -> Any: ...


Transformer = Callable[["AuditLogEntry", Any], Any]
Expand Down
12 changes: 4 additions & 8 deletions disnake/automod.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,7 @@ def __init__(
keyword_filter: Optional[Sequence[str]],
regex_patterns: Optional[Sequence[str]] = None,
allow_list: Optional[Sequence[str]] = None,
) -> None:
...
) -> None: ...

@overload
def __init__(
Expand All @@ -306,23 +305,20 @@ def __init__(
keyword_filter: Optional[Sequence[str]] = None,
regex_patterns: Optional[Sequence[str]],
allow_list: Optional[Sequence[str]] = None,
) -> None:
...
) -> None: ...

@overload
def __init__(
self,
*,
presets: AutoModKeywordPresets,
allow_list: Optional[Sequence[str]] = None,
) -> None:
...
) -> None: ...

@overload
def __init__(
self, *, mention_total_limit: int, mention_raid_protection_enabled: bool = False
) -> None:
...
) -> None: ...

def __init__(
self,
Expand Down
9 changes: 3 additions & 6 deletions disnake/backoff.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,13 @@ def __init__(self, base: int = 1, *, integral: T = False) -> None:
)

@overload
def delay(self: ExponentialBackoff[Literal[False]]) -> float:
...
def delay(self: ExponentialBackoff[Literal[False]]) -> float: ...

@overload
def delay(self: ExponentialBackoff[Literal[True]]) -> int:
...
def delay(self: ExponentialBackoff[Literal[True]]) -> int: ...

@overload
def delay(self: ExponentialBackoff[bool]) -> Union[int, float]:
...
def delay(self: ExponentialBackoff[bool]) -> Union[int, float]: ...

def delay(self) -> Union[int, float]:
"""Compute the next delay
Expand Down
Loading

0 comments on commit 776c8b3

Please sign in to comment.