Commit fe22ebdb authored by Barry Warsaw's avatar Barry Warsaw

Use `atpublic` for @public instead of internal copy.

parent cb498d3e
Pipeline #5190539 failed with stage
in 5 minutes and 20 seconds
......@@ -106,6 +106,7 @@ case second `m'. Any other spelling is incorrect.""",
install_requires = [
'aiosmtpd',
'alembic',
'atpublic',
'falcon>=1.0.0rc1',
'flufl.bounce',
'flufl.i18n',
......
......@@ -29,20 +29,6 @@ except ImportError: # pragma: no cover
__path__ = pkgutil.extend_path(__path__, __name__)
# I hate myself: http://bugs.python.org/issue26632
def public(thing=None, **kws):
mdict = (sys._getframe(1).f_globals
if thing is None
else sys.modules[thing.__module__].__dict__)
dunder_all = mdict.setdefault('__all__', [])
if thing is not None:
dunder_all.append(thing.__name__)
for key, value in kws.items():
dunder_all.append(key)
mdict[key] = value
return thing
# We have to initialize the i18n subsystem before anything else happens,
# however, we'll initialize it differently for tests. We have to do it this
# early so that module contents is set up before anything that needs it is
......
......@@ -24,7 +24,6 @@ import logging
from email.mime.message import MIMEMessage
from email.mime.text import MIMEText
from email.utils import parseaddr
from mailman import public
from mailman.config import config
from mailman.core.i18n import _
from mailman.email.message import OwnerNotification, UserNotification
......@@ -35,6 +34,7 @@ from mailman.interfaces.subscriptions import ISubscriptionService
from mailman.interfaces.template import ITemplateLoader
from mailman.utilities.email import split_email
from mailman.utilities.string import expand, oneline, wrap
from public import public
from string import Template
from zope.component import getUtility
from zope.interface import implementer
......
......@@ -17,10 +17,10 @@
"""Initialize the email commands."""
from mailman import public
from mailman.config import config
from mailman.interfaces.command import IEmailCommand
from mailman.utilities.modules import find_components
from public import public
from zope.interface.verify import verifyObject
......
......@@ -19,11 +19,11 @@
import os
from mailman import public
from mailman.config import config
from mailman.email.message import Message
from mailman.interfaces.digests import DigestFrequency
from mailman.utilities.datetime import now as right_now
from public import public
@public
......
......@@ -17,9 +17,9 @@
"""Application level domain support."""
from mailman import public
from mailman.interfaces.domain import DomainDeletingEvent
from mailman.interfaces.listmanager import IListManager
from public import public
from zope.component import getUtility
......
......@@ -17,12 +17,12 @@
"""Global events."""
from mailman import public
from mailman.app import domain, membership, moderator, subscriptions
from mailman.core import i18n, switchboard
from mailman.languages import manager as language_manager
from mailman.styles import manager as style_manager
from mailman.utilities import passwords
from public import public
from zope import event
......
......@@ -19,10 +19,10 @@
from email import message_from_string
from email.utils import formatdate, make_msgid
from mailman import public
from mailman.config import config
from mailman.email.message import Message
from mailman.utilities.email import add_message_hash
from public import public
@public
......
......@@ -21,7 +21,6 @@ import shutil
import logging
from contextlib import suppress
from mailman import public
from mailman.config import config
from mailman.interfaces.address import IEmailValidator
from mailman.interfaces.domain import (
......@@ -31,6 +30,7 @@ from mailman.interfaces.member import MemberRole
from mailman.interfaces.styles import IStyleManager
from mailman.interfaces.usermanager import IUserManager
from mailman.utilities.modules import call_name
from public import public
from zope.component import getUtility
......
......@@ -18,7 +18,6 @@
"""Application support for membership management."""
from email.utils import formataddr
from mailman import public
from mailman.app.notifications import (
send_admin_subscription_notice, send_goodbye_message,
send_welcome_message)
......@@ -33,6 +32,7 @@ from mailman.interfaces.template import ITemplateLoader
from mailman.interfaces.user import IUser
from mailman.interfaces.usermanager import IUserManager
from mailman.utilities.string import expand
from public import public
from zope.component import getUtility
......
......@@ -21,7 +21,6 @@ import time
import logging
from email.utils import formatdate, getaddresses, make_msgid
from mailman import public
from mailman.app.membership import delete_member
from mailman.config import config
from mailman.core.i18n import _
......@@ -34,6 +33,7 @@ from mailman.interfaces.requests import IListRequests, RequestType
from mailman.interfaces.template import ITemplateLoader
from mailman.utilities.datetime import now
from mailman.utilities.string import expand, wrap
from public import public
from zope.component import getUtility
......
......@@ -21,13 +21,13 @@ import logging
from email.utils import formataddr
from lazr.config import as_boolean
from mailman import public
from mailman.config import config
from mailman.core.i18n import _
from mailman.email.message import OwnerNotification, UserNotification
from mailman.interfaces.member import DeliveryMode
from mailman.interfaces.template import ITemplateLoader
from mailman.utilities.string import expand, wrap
from public import public
from zope.component import getUtility
......
......@@ -17,7 +17,7 @@
"""Application level auto-reply code."""
from mailman import public
from public import public
@public
......
......@@ -23,7 +23,6 @@ import logging
from datetime import timedelta
from email.utils import formataddr
from enum import Enum
from mailman import public
from mailman.app.membership import delete_member
from mailman.app.workflow import Workflow
from mailman.core.i18n import _
......@@ -45,6 +44,7 @@ from mailman.interfaces.usermanager import IUserManager
from mailman.interfaces.workflow import IWorkflowStateManager
from mailman.utilities.datetime import now
from mailman.utilities.string import expand, wrap
from public import public
from zope.component import getUtility
from zope.event import notify
from zope.interface import implementer
......
......@@ -22,8 +22,8 @@ import json
import logging
from collections import deque
from mailman import public
from mailman.interfaces.workflow import IWorkflowStateManager
from public import public
from zope.component import getUtility
......
......@@ -17,10 +17,10 @@
"""The Mail-Archive.com archiver."""
from mailman import public
from mailman.config import config
from mailman.config.config import external_configuration
from mailman.interfaces.archiver import ArchivePolicy, IArchiver
from public import public
from urllib.parse import quote, urljoin
from zope.interface import implementer
......
......@@ -19,11 +19,11 @@
import logging
from mailman import public
from mailman.config import config
from mailman.config.config import external_configuration
from mailman.interfaces.archiver import IArchiver
from mailman.utilities.string import expand
from public import public
from subprocess import PIPE, Popen
from urllib.parse import urljoin
from zope.interface import implementer
......
......@@ -24,9 +24,9 @@ from contextlib import suppress
from datetime import timedelta
from flufl.lock import Lock, TimeOutError
from mailbox import Maildir
from mailman import public
from mailman.config import config
from mailman.interfaces.archiver import IArchiver
from public import public
from zope.interface import implementer
......
......@@ -21,13 +21,13 @@ import os
import argparse
from functools import cmp_to_key
from mailman import public
from mailman.core.i18n import _
from mailman.core.initialize import initialize
from mailman.database.transaction import transaction
from mailman.interfaces.command import ICLISubCommand
from mailman.utilities.modules import find_components
from mailman.version import MAILMAN_VERSION_FULL
from public import public
from zope.interface.verify import verifyObject
......
......@@ -28,11 +28,11 @@ from datetime import timedelta
from enum import Enum
from flufl.lock import Lock, NotLockedError, TimeOutError
from lazr.config import as_boolean
from mailman import public
from mailman.config import config
from mailman.core.i18n import _
from mailman.core.logging import reopen
from mailman.utilities.options import Options
from public import public
DOT = '.'
......
......@@ -24,12 +24,12 @@ import logging
import argparse
import traceback
from mailman import public
from mailman.config import config
from mailman.core.i18n import _
from mailman.core.initialize import initialize
from mailman.utilities.modules import find_name
from mailman.version import MAILMAN_VERSION_FULL
from public import public
log = None
......
......@@ -19,11 +19,11 @@
import logging
from mailman import public
from mailman.chains.base import TerminalChainBase
from mailman.config import config
from mailman.core.i18n import _
from mailman.interfaces.chain import AcceptEvent
from public import public
from zope.event import notify
......
......@@ -17,11 +17,11 @@
"""Base class for terminal chains."""
from mailman import public
from mailman.config import config
from mailman.interfaces.chain import (
IChain, IChainIterator, IChainLink, IMutableChain, LinkAction)
from mailman.interfaces.rules import IRule
from public import public
from zope.interface import implementer
......
......@@ -19,10 +19,10 @@
import logging
from mailman import public
from mailman.chains.base import Link
from mailman.core.i18n import _
from mailman.interfaces.chain import IChain, LinkAction
from public import public
from zope.interface import implementer
......
......@@ -19,10 +19,10 @@
import logging
from mailman import public
from mailman.chains.base import TerminalChainBase
from mailman.core.i18n import _
from mailman.interfaces.chain import DiscardEvent
from public import public
from zope.event import notify
......
......@@ -21,12 +21,12 @@ import re
import logging
from itertools import count
from mailman import public
from mailman.chains.base import Chain, Link
from mailman.config import config
from mailman.core.i18n import _
from mailman.interfaces.chain import LinkAction
from mailman.interfaces.rules import IRule
from public import public
from zope.interface import implementer
......
......@@ -22,7 +22,6 @@ import logging
from email.mime.message import MIMEMessage
from email.mime.text import MIMEText
from email.utils import formatdate, make_msgid
from mailman import public
from mailman.app.moderator import hold_message
from mailman.app.replybot import can_acknowledge
from mailman.chains.base import TerminalChainBase
......@@ -36,6 +35,7 @@ from mailman.interfaces.pending import IPendable, IPendings
from mailman.interfaces.template import ITemplateLoader
from mailman.interfaces.usermanager import IUserManager
from mailman.utilities.string import expand, oneline, wrap
from public import public
from zope.component import getUtility
from zope.event import notify
from zope.interface import implementer
......
......@@ -34,11 +34,11 @@ made as to the disposition of the message. `defer` is the default for
members, while `hold` is the default for nonmembers.
"""
from mailman import public
from mailman.chains.base import Link
from mailman.core.i18n import _
from mailman.interfaces.action import Action
from mailman.interfaces.chain import IChain, LinkAction
from public import public
from zope.interface import implementer
......
......@@ -19,11 +19,11 @@
import logging
from mailman import public
from mailman.chains.base import TerminalChainBase
from mailman.config import config
from mailman.core.i18n import _
from mailman.interfaces.chain import AcceptOwnerEvent
from public import public
from zope.event import notify
......
......@@ -19,12 +19,12 @@
import logging
from mailman import public
from mailman.app.bounces import bounce_message
from mailman.chains.base import TerminalChainBase
from mailman.core.i18n import _
from mailman.interfaces.chain import RejectEvent
from mailman.interfaces.pipeline import RejectMessage
from public import public
from zope.event import notify
......
......@@ -17,11 +17,11 @@
"""Generate Mailman alias files for your MTA."""
from mailman import public
from mailman.config import config
from mailman.core.i18n import _
from mailman.interfaces.command import ICLISubCommand
from mailman.utilities.modules import call_name
from public import public
from zope.interface import implementer
......
......@@ -21,10 +21,10 @@ import sys
from contextlib import closing
from lazr.config._config import Section
from mailman import public
from mailman.config import config
from mailman.core.i18n import _
from mailman.interfaces.command import ICLISubCommand
from public import public
from zope.interface import implementer
......
......@@ -23,11 +23,11 @@ import errno
import signal
import logging
from mailman import public
from mailman.bin.master import WatcherState, master_state
from mailman.config import config
from mailman.core.i18n import _
from mailman.interfaces.command import ICLISubCommand
from public import public
from zope.interface import implementer
......
......@@ -19,12 +19,12 @@
import sys
from mailman import public
from mailman.app.digests import (
bump_digest_number_and_volume, maybe_send_digest_now)
from mailman.core.i18n import _
from mailman.interfaces.command import ICLISubCommand
from mailman.interfaces.listmanager import IListManager
from public import public
from zope.component import getUtility
from zope.interface import implementer
......
......@@ -17,8 +17,8 @@
"""The 'help' subcommand."""
from mailman import public
from mailman.interfaces.command import ICLISubCommand
from public import public
from zope.interface import implementer
......
......@@ -21,12 +21,12 @@ import sys
import pickle
from contextlib import ExitStack, contextmanager
from mailman import public
from mailman.core.i18n import _
from mailman.database.transaction import transactional
from mailman.interfaces.command import ICLISubCommand
from mailman.interfaces.listmanager import IListManager
from mailman.utilities.importer import Import21Error, import_config_pck
from public import public
from zope.component import getUtility
from zope.interface import implementer
......
......@@ -20,12 +20,12 @@
import sys
from lazr.config import as_boolean
from mailman import public
from mailman.config import config
from mailman.core.api import API30, API31
from mailman.core.i18n import _
from mailman.interfaces.command import ICLISubCommand
from mailman.version import MAILMAN_VERSION_FULL
from public import public
from zope.interface import implementer
......
......@@ -19,12 +19,12 @@
import sys
from mailman import public
from mailman.app.inject import inject_text
from mailman.config import config
from mailman.core.i18n import _
from mailman.interfaces.command import ICLISubCommand
from mailman.interfaces.listmanager import IListManager
from public import public
from zope.component import getUtility
from zope.interface import implementer
......
......@@ -17,7 +17,6 @@
"""The 'lists' subcommand."""
from mailman import public
from mailman.app.lifecycle import create_list, remove_list
from mailman.core.constants import system_preferences
from mailman.core.i18n import _
......@@ -32,6 +31,7 @@ from mailman.interfaces.languages import ILanguageManager
from mailman.interfaces.listmanager import IListManager, ListAlreadyExistsError
from mailman.interfaces.template import ITemplateLoader
from mailman.utilities.string import expand, wrap
from public import public
from zope.component import getUtility
from zope.interface import implementer
......
......@@ -21,7 +21,6 @@ import sys
from contextlib import ExitStack
from email.utils import formataddr, parseaddr
from mailman import public
from mailman.app.membership import add_member
from mailman.core.i18n import _
from mailman.database.transaction import transactional
......@@ -31,6 +30,7 @@ from mailman.interfaces.member import (
AlreadySubscribedError, DeliveryMode, DeliveryStatus, MemberRole)
from mailman.interfaces.subscriptions import RequestRecord
from operator import attrgetter
from public import public
from zope.component import getUtility
from zope.interface import implementer
......
......@@ -19,11 +19,11 @@
import pickle
from mailman import public
from mailman.core.i18n import _
from mailman.interfaces.command import ICLISubCommand
from mailman.utilities.interact import interact
from pprint import PrettyPrinter
from public import public
from zope.interface import implementer
......
......@@ -19,10 +19,10 @@
import socket
from mailman import public
from mailman.bin.master import WatcherState, master_state
from mailman.core.i18n import _
from mailman.interfaces.command import ICLISubCommand
from public import public
from zope.interface import implementer
......
......@@ -19,10 +19,10 @@
import sys
from mailman import public
from mailman.config import config
from mailman.core.i18n import _
from mailman.interfaces.command import ICLISubCommand
from public import public
from zope.interface import implementer
......
......@@ -17,9 +17,9 @@
"""The Mailman version."""
from mailman import public
from mailman.interfaces.command import ICLISubCommand
from mailman.version import MAILMAN_VERSION_FULL
from public import public
from zope.interface import implementer
......
......@@ -23,13 +23,13 @@ import sys
from contextlib import ExitStack, suppress
from functools import partial
from lazr.config import as_boolean
from mailman import public
from mailman.config import config
from mailman.core.i18n import _
from mailman.interfaces.command import ICLISubCommand
from mailman.interfaces.listmanager import IListManager
from mailman.utilities.interact import DEFAULT_BANNER, interact
from mailman.utilities.modules import call_name
from public import public
from string import Template
from traceback import print_exc
from zope.component import getUtility
......