-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[v2, multi] remove from __main__ import ... statements #1956
Merged
Tobotimus
merged 1 commit into
Cog-Creators:develop
from
calebj:remove_from_main_import
Dec 16, 2018
Merged
[v2, multi] remove from __main__ import ... statements #1956
Tobotimus
merged 1 commit into
Cog-Creators:develop
from
calebj:remove_from_main_import
Dec 16, 2018
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
calebj
added a commit
to calebj/calebj-cogs
that referenced
this pull request
Jul 24, 2018
Closes #62. Also threw in some new stuff, speedups and sanity checks: - docs (seriously I think I need some help with these) - check all filters in one call to the executor - don't check individual messages in multi-message filters - subgroup support for blacklist mode filters - act upon white-mode non-matches when no black-mode filters apply (d'oh!) - continue checking blacklist filters upon a white match - handle 'inherit' argument correctly on asciify and priv-exempt - read past newlines when setting pattern - copy new feature parameters when copying a filter - remove typing.Type annotation because Python <3.5.2 don't have it - use ThreadPoolExecutor on Windows because of an upstream Red issue - ProcessPoolExecutor doesn't get along with `from __main__ import ...` - See Cog-Creators/Red-DiscordBot#1956
calebj
added a commit
to calebj/calebj-cogs
that referenced
this pull request
Jul 24, 2018
Closes #62. Also threw in some new stuff, speedups and sanity checks: - add command layout to docs (seriously I think I need some help with these) - add enable and disable commands (hidden to not clutter the help list) - check all filters in one call to the executor - don't check individual messages in multi-message filters - subgroup support for blacklist mode filters - act upon white-mode non-matches when no black-mode filters apply (d'oh!) - continue checking blacklist filters upon a white match - handle 'inherit' argument correctly on asciify and priv-exempt - read past newlines when setting pattern - copy new feature parameters when copying a filter - remove typing.Type annotation because Python <3.5.2 don't have it - use ThreadPoolExecutor on Windows because of an upstream Red issue - ProcessPoolExecutor doesn't get along with `from __main__ import ...` - See Cog-Creators/Red-DiscordBot#1956
calebj
added a commit
to calebj/calebj-cogs
that referenced
this pull request
Jul 24, 2018
Closes #62. Also threw in some new stuff, speedups and sanity checks: - add command layout to docs (seriously I think I need some help with these) - add enable and disable commands (hidden to not clutter the help list) - check all filters in one call to the executor - don't check individual messages in multi-message filters - subgroup support for blacklist mode filters - act upon white-mode non-matches when no black-mode filters apply (d'oh!) - continue checking blacklist filters upon a white match - handle 'inherit' argument correctly on asciify and priv-exempt - read past newlines when setting pattern - copy new feature parameters when copying a filter - remove typing.Type annotation because Python <3.5.2 don't have it - use ThreadPoolExecutor on Windows because of an upstream Red issue - ProcessPoolExecutor doesn't get along with `from __main__ import ...` - See Cog-Creators/Red-DiscordBot#1956
calebj
added a commit
to calebj/calebj-cogs
that referenced
this pull request
Jul 24, 2018
Closes #62. Also threw in some new stuff, speedups and sanity checks: - add command layout to docs (seriously I think I need some help with these) - add enable and disable commands (hidden to not clutter the help list) - check all filters in one call to the executor - don't check individual messages in multi-message filters - subgroup support for blacklist mode filters - act upon white-mode non-matches when no black-mode filters apply (d'oh!) - continue checking blacklist filters upon a white match - handle 'inherit' argument correctly on asciify and priv-exempt - read past newlines when setting pattern - copy new feature parameters when copying a filter - remove typing.Type annotation because Python <3.5.2 don't have it - use ThreadPoolExecutor on Windows because of an upstream Red issue - ProcessPoolExecutor doesn't get along with `from __main__ import ...` - See Cog-Creators/Red-DiscordBot#1956
Tobotimus
approved these changes
Jul 25, 2018
Bump! |
Redjumpman
approved these changes
Sep 4, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Type
Description of the changes
Removed problematic
from __main__ import ...
statements from core cogs and checks.py.red.py and all applicable core cogs have been refactored to function without any reference to
__main__
. Cogs which rely on importinguser_allowed
,send_cmd_help
,set_cog
orsettings
from__main__
will still continue to function.Rationale
The
from __main__
import in checks.py causes issues with ProcessPoolExecutors configured to use thespawn
start method, which is the only option on Windows sincefork
is only present on UNIX.Because the spawned child processes are sent a pickled representation of the cog's module as a part of their task(s), the child process must re-execute the cog's module before the task can be invoked. Because the spawned processes don't have red.py as their base module,
__main__
is undefined, and the top-level import ofcogs.utils.checks
fails.