Skip to content

Commit

Permalink
Removed '__all__' from init
Browse files Browse the repository at this point in the history
  • Loading branch information
Nekokatt committed Aug 18, 2020
1 parent 127c777 commit a5debac
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 120 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ Make sure you have removed your bot token (if visible).
- [ ] I have made sure to remove ANY sensitive information (bot token, passwords,
credentials, personal details, etc).
- [ ] I have searched the issue tracker and have made sure it's not a duplicate.
If it is a follow up of another issue, I have specified it.
If it is a follow up of another issue, I have specified it.
4 changes: 2 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
- [ ] I have made unittests according to the code I have added/modified/deleted.

### Related issues
<!--
<!--
To mention an issue use `#issue-id` and to mention a merge request use `!merge-request-id`
To close/fix an issue use `Close #issue-id` or `Fix #issue-id` (depending on the merge request)
-->
-->
9 changes: 9 additions & 0 deletions docs/patched_pdoc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# -*- coding: utf-8 -*-
def main():
from pdoc import cli

cli.main()


if __name__ == "__main__":
main()
37 changes: 2 additions & 35 deletions hikari/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,8 @@
the REST API.
"""

# We need these imported explicitly for the __all__ to be visible due to
# Python's weird import visibility system.
from hikari import config
from hikari import errors
from hikari import events
from hikari import models
from __future__ import annotations

from hikari._about import __author__
from hikari._about import __ci__
from hikari._about import __copyright__
Expand Down Expand Up @@ -63,32 +59,3 @@
from hikari.utilities.undefined import UNDEFINED
from hikari.utilities.undefined import UndefinedNoneOr
from hikari.utilities.undefined import UndefinedOr

_presorted_all = [
"File",
"Pathish",
"Rawish",
"LazyByteIteratorish",
"Resourceish",
"Snowflake",
"Snowflakeish",
"SnowflakeishOr",
"SearchableSnowflakeish",
"SearchableSnowflakeishOr",
"Unique",
"UNDEFINED",
"UndefinedOr",
"UndefinedNoneOr",
*config.__all__,
*events.__all__,
*errors.__all__,
*models.__all__,
]

# This may seem a bit dirty, but I have added an edge case to the documentation
# logic to *ignore* the sorting member rules for the root `hikari` module
# (this file) specifically. This way, we can force `Bot` and `RESTClientFactory`
# to the top of the list.
__all__ = ["Bot", "REST", *sorted(_presorted_all)]

del _presorted_all
2 changes: 1 addition & 1 deletion hikari/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@
relying on a distributed event bus or cache.
"""

__all__ = [] # type: ignore[var-annotated]
from __future__ import annotations
28 changes: 0 additions & 28 deletions hikari/events/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,6 @@

from __future__ import annotations

import typing

from hikari.events import channel_events
from hikari.events import guild_events
from hikari.events import lifetime_events
from hikari.events import member_events
from hikari.events import message_events
from hikari.events import reaction_events
from hikari.events import role_events
from hikari.events import shard_events
from hikari.events import typing_events
from hikari.events import user_events
from hikari.events import voice_events
from hikari.events.base_events import Event
from hikari.events.base_events import ExceptionEvent
from hikari.events.channel_events import *
Expand All @@ -49,18 +36,3 @@
from hikari.events.typing_events import *
from hikari.events.user_events import *
from hikari.events.voice_events import *

__all__: typing.List[str] = (
["Event", "ExceptionEvent"]
+ channel_events.__all__
+ guild_events.__all__
+ lifetime_events.__all__
+ member_events.__all__
+ message_events.__all__
+ reaction_events.__all__
+ role_events.__all__
+ shard_events.__all__
+ typing_events.__all__
+ user_events.__all__
+ voice_events.__all__
)
2 changes: 1 addition & 1 deletion hikari/impl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@
implementations.
"""

__all__ = [] # type: ignore[var-annotated]
from __future__ import annotations
39 changes: 2 additions & 37 deletions hikari/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,8 @@
# SOFTWARE.
"""Data classes representing Discord entities."""

from hikari.models import applications
from hikari.models import audit_logs
from hikari.models import channels
from hikari.models import colors
from hikari.models import colours
from hikari.models import embeds
from hikari.models import emojis
from hikari.models import gateway
from hikari.models import guilds
from hikari.models import intents
from hikari.models import invites
from hikari.models import messages
from hikari.models import permissions
from hikari.models import presences
from hikari.models import users
from hikari.models import voices
from hikari.models import webhooks
from __future__ import annotations

from hikari.models.applications import *
from hikari.models.audit_logs import *
from hikari.models.channels import *
Expand All @@ -55,23 +40,3 @@
from hikari.models.users import *
from hikari.models.voices import *
from hikari.models.webhooks import *

__all__ = (
applications.__all__
+ audit_logs.__all__
+ channels.__all__
+ colors.__all__
+ colours.__all__
+ embeds.__all__
+ emojis.__all__
+ gateway.__all__
+ guilds.__all__
+ intents.__all__
+ invites.__all__
+ messages.__all__
+ permissions.__all__
+ presences.__all__
+ users.__all__
+ voices.__all__
+ webhooks.__all__
)
2 changes: 1 addition & 1 deletion hikari/utilities/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
# SOFTWARE.
"""Package containing internal utilities used within this API."""

__all__ = [] # type: ignore[var-annotated]
from __future__ import annotations
3 changes: 1 addition & 2 deletions pipelines/pdoc.nox.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ def pdoc(session: nox.Session) -> None:

session.run(
"python",
"-m",
"pdoc",
"docs/patched_pdoc.py",
config.MAIN_PACKAGE,
"--html",
"--output-dir",
Expand Down
12 changes: 0 additions & 12 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ python -m pip install \
setuptools \
wheel \
nox \
mypy \
twine \
requests \
-r requirements.txt
Expand All @@ -31,17 +30,6 @@ echo "==========================================================================
cat hikari/_about.py
echo "=========================================================================="

echo "===== GENERATING MYPY STUBS FOR --strict SUPPORT ====="

find hikari -name "__init__.py" | while read -r f; do
base=$(dirname "${f}")
echo "Generating stub for ${f} as module ${base}"
stubgen -m "${base}" -o "."
done

echo "===== REFORMATTING GENERATED MYPY STUBS ====="
python -m nox --sessions reformat-code

echo "===== DEPLOYING TO PYPI ====="
python setup.py sdist bdist_wheel
echo "-- Contents of . --"
Expand Down

0 comments on commit a5debac

Please sign in to comment.