Skip to content

Commit 0f8d79b

Browse files
style(pre-commit): auto fixes from pre-commit.com hooks
1 parent 7107f01 commit 0f8d79b

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

discord/role.py

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525

2626
from __future__ import annotations
2727

28-
from enum import IntEnum, auto
29-
from typing import TYPE_CHECKING, Any, Final, TypeVar
28+
from enum import IntEnum
29+
from typing import TYPE_CHECKING, Any, TypeVar
3030

3131
from .asset import Asset
3232
from .colour import Colour
@@ -37,7 +37,9 @@
3737
from .utils import (
3838
MISSING,
3939
_bytes_to_base64_data,
40-
snowflake_time, cached_slot_property, deprecated,
40+
cached_slot_property,
41+
deprecated,
42+
snowflake_time,
4143
)
4244

4345
__all__ = (
@@ -109,13 +111,14 @@ def _parse_tag_int(data: RoleTagPayload, key: str) -> int | None:
109111
# value error means it's not an number string (None or "")
110112
return None
111113

114+
112115
class RoleType(IntEnum):
113116
"""Represents the type of role.
114-
117+
115118
This is NOT provided by discord but is rather computed by pycord based on the role tags.
116-
119+
117120
.. versionadded:: 2.7
118-
121+
119122
Attributes
120123
----------
121124
APPLICATION: :class:`int`
@@ -135,10 +138,11 @@ class RoleType(IntEnum):
135138
CONNECTION: :class:`int`
136139
The role is a guild connections role.
137140
"""
141+
138142
APPLICATION = 1
139143
BOOSTER = 2
140144
GUILD_PRODUCT = 3
141-
PREMIUM_SUBSCRIPTION_BASE = 4 # Not possible to determine currently, will be INTEGRATION if it's a base subscription
145+
PREMIUM_SUBSCRIPTION_BASE = 4 # Not possible to determine currently, will be INTEGRATION if it's a base subscription
142146
PREMIUM_SUBSCRIPTION_TIER = 5
143147
DRAFT_PREMIUM_SUBSCRIPTION_TIER = 5
144148
INTEGRATION = 7
@@ -200,9 +204,7 @@ def __init__(self, data: RoleTagPayload):
200204

201205
@cached_slot_property("_type")
202206
def type(self) -> RoleType:
203-
"""
204-
Determine the role type based on tag flags.
205-
"""
207+
"""Determine the role type based on tag flags."""
206208
# Bot role
207209
if self.bot_id is not None:
208210
return RoleType.APPLICATION
@@ -221,7 +223,10 @@ def type(self) -> RoleType:
221223

222224
# subscription roles
223225
if self.integration_id is not None:
224-
if self._premium_subscriber is None and self.subscription_listing_id is not None:
226+
if (
227+
self._premium_subscriber is None
228+
and self.subscription_listing_id is not None
229+
):
225230
if self._available_for_purchase is True:
226231
return RoleType.PREMIUM_SUBSCRIPTION_TIER
227232
return RoleType.DRAFT_PREMIUM_SUBSCRIPTION_TIER
@@ -251,15 +256,12 @@ def is_integration(self) -> bool:
251256

252257
@deprecated("RoleTags.type", "2.7")
253258
def is_available_for_purchase(self) -> bool:
254-
"""Whether the role is available for purchase.
255-
"""
259+
"""Whether the role is available for purchase."""
256260
return self._available_for_purchase is True
257261

258262
@deprecated("RoleTags.type", "2.7")
259263
def is_guild_connections_role(self) -> bool:
260-
"""Whether the role is a guild connections role.
261-
262-
"""
264+
"""Whether the role is a guild connections role."""
263265
return self._guild_connections is True
264266

265267
def __repr__(self) -> str:
@@ -463,7 +465,6 @@ def is_integration(self) -> bool:
463465
"""
464466
return self.tags is not None and self.tags.is_integration()
465467

466-
467468
def is_assignable(self) -> bool:
468469
"""Whether the role is able to be assigned or removed by the bot.
469470

0 commit comments

Comments
 (0)