Skip to content

Commit

Permalink
Merge branch 'master' into doc-restyle-2
Browse files Browse the repository at this point in the history
  • Loading branch information
BobDotCom committed Oct 15, 2022
2 parents 18d984d + 9b7f5c6 commit a703ea5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
8 changes: 4 additions & 4 deletions discord/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,12 @@ def releaselevel(self) -> Literal["alpha", "beta", "candidate", "final"]:
date_info = None

version_info: VersionInfo = VersionInfo(
major=raw_info["major"],
minor=raw_info["minor"],
micro=raw_info["patch"],
major=int(raw_info["major"] or 0) or None,
minor=int(raw_info["minor"] or 0) or None,
micro=int(raw_info["patch"] or 0) or None,
release_level=level_info,
serial=raw_info["serial"],
build=raw_info["build"],
build=int(raw_info["build"] or 0) or None,
commit=raw_info["commit"],
date=date_info,
)
14 changes: 7 additions & 7 deletions discord/ext/commands/flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from dataclasses import dataclass, field
from typing import TYPE_CHECKING, Any, Iterator, Literal, Pattern, TypeVar, Union

from discord.utils import MISSING, maybe_coroutine, resolve_annotation
from discord.utils import MISSING, MissingField, maybe_coroutine, resolve_annotation

from .converter import run_converters
from .errors import (
Expand Down Expand Up @@ -81,13 +81,13 @@ class Flag:
Whether multiple given values overrides the previous value.
"""

name: str = MISSING
name: str = MissingField
aliases: list[str] = field(default_factory=list)
attribute: str = MISSING
annotation: Any = MISSING
default: Any = MISSING
max_args: int = MISSING
override: bool = MISSING
attribute: str = MissingField
annotation: Any = MissingField
default: Any = MissingField
max_args: int = MissingField
override: bool = MissingField
cast_to_dict: bool = False

@property
Expand Down
6 changes: 6 additions & 0 deletions discord/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import warnings
from base64 import b64encode
from bisect import bisect_left
from dataclasses import field
from inspect import isawaitable as _isawaitable
from inspect import signature as _signature
from operator import attrgetter
Expand Down Expand Up @@ -114,6 +115,11 @@ def __repr__(self) -> str:


MISSING: Any = _MissingSentinel()
# As of 3.11, directly setting a dataclass field to MISSING causes a ValueError. Using
# field(default=MISSING) produces the same error, but passing a lambda to
# default_factory produces the same behavior as default=MISSING and does not raise an
# error.
MissingField = field(default_factory=lambda: MISSING)


class _cached_property:
Expand Down

0 comments on commit a703ea5

Please sign in to comment.