Privatize APIs by renaming or removing them from __all__ (#6021)

This commit is contained in:
Jakub Kuczys
2023-04-17 23:44:33 +02:00
committed by GitHub
parent eafbb06756
commit f051eae92d
126 changed files with 508 additions and 157 deletions

View File

@@ -40,6 +40,8 @@ if TYPE_CHECKING:
DMMessageable = Union[commands.DMContext, discord.Member, discord.User, discord.DMChannel]
__all__ = (
"async_filter",
"async_enumerate",
"bounded_gather",
"bounded_gather_iter",
"deduplicate_iterables",

View File

@@ -2,6 +2,8 @@ from datetime import datetime, timedelta
from typing import Tuple, List
from collections import namedtuple
__all__ = ("AntiSpam",)
_AntiSpamInterval = namedtuple("_AntiSpamInterval", ["period", "frequency"])

View File

@@ -13,6 +13,29 @@ from babel.numbers import format_decimal
from redbot.core.i18n import Translator, get_babel_locale, get_babel_regional_format
__all__ = (
"error",
"warning",
"info",
"success",
"question",
"bold",
"box",
"inline",
"italics",
"spoiler",
"pagify",
"strikethrough",
"underline",
"quote",
"escape",
"humanize_list",
"format_perms_list",
"humanize_timedelta",
"humanize_number",
"text_to_file",
)
_ = Translator("UtilsChatFormatting", __file__)

View File

@@ -2,6 +2,8 @@ import discord
import random
__all__ = ("randomize_colour", "randomize_color")
def randomize_colour(embed: discord.Embed) -> discord.Embed:
"""

View File

@@ -14,6 +14,15 @@ from .. import commands
from .predicates import ReactionPredicate
from .views import SimpleMenu, _SimplePageSource
__all__ = (
"menu",
"next_page",
"prev_page",
"close_menu",
"start_adding_reactions",
"DEFAULT_CONTROLS",
)
_T = TypeVar("_T")
_PageList = TypeVar("_PageList", List[str], List[discord.Embed])
_ReactableEmoji = Union[str, discord.Emoji]

View File

@@ -8,6 +8,16 @@ if TYPE_CHECKING:
from ..bot import Red
from ..commands import Context
__all__ = (
"mass_purge",
"slow_deletion",
"get_audit_reason",
"is_mod_or_superior",
"strfdelta",
"is_admin_or_superior",
"check_permissions",
)
async def mass_purge(
messages: List[discord.Message],

View File

@@ -8,6 +8,8 @@ from discord.ext import commands as dpy_commands
from redbot.core import commands
__all__ = ("MessagePredicate", "ReactionPredicate")
_ID_RE = re.compile(r"([0-9]{15,20})$")
_USER_MENTION_RE = re.compile(r"<@!?([0-9]{15,20})>$")
_CHAN_MENTION_RE = re.compile(r"<#([0-9]{15,20})>$")

View File

@@ -7,6 +7,8 @@ import weakref
from typing import List, Optional, Union
from .common_filters import filter_mass_mentions
__all__ = ("Tunnel",)
_instances = weakref.WeakValueDictionary({})

View File

@@ -8,10 +8,11 @@ from redbot.core.i18n import Translator
from redbot.vendored.discord.ext import menus
from redbot.core.commands.converter import get_dict_converter
if TYPE_CHECKING:
from redbot.core.commands import Context
__all__ = ("SimpleMenu", "SetApiModal", "SetApiView")
_ = Translator("UtilsViews", __file__)
_ACCEPTABLE_PAGE_TYPES = Union[Dict[str, Union[str, discord.Embed]], discord.Embed, str]