[v3 cog manager, utils] handle missing cogs correctly, add some helpful algorithms #1989

Merged
calebj merged 2 commits from v3/cog_manager_fix_async_utils into V3/develop 2018-08-21 03:26:05 +02:00
calebj commented 2018-08-07 04:10:04 +02:00 (Migrated from github.com)

Type

  • Bugfix
  • Enhancement
  • New feature

Description of the changes

For cog loading, only show "cog not found" if the module in question was the one that failed to import. ImportErrors within cogs will now show an error as they should.

Also:

  • Add a chain deduplicator, benchmarked to be the fastest method
  • Add a semaphore-bounded variant of asyncio.gather and an async as_completed
  • And of course, tests and docs for all additions
### Type - [x] Bugfix - [x] Enhancement - [x] New feature ### Description of the changes For cog loading, only show "cog not found" if the module in question was the one that failed to import. `ImportErrors` within cogs will now show an error as they should. Also: - Add a chain deduplicator, benchmarked to be the fastest method - Add a semaphore-bounded variant of `asyncio.gather` and an async `as_completed` - And of course, tests and docs for all additions
palmtree5 (Migrated from github.com) reviewed 2018-08-07 04:10:04 +02:00
tekulvw (Migrated from github.com) reviewed 2018-08-07 04:10:04 +02:00
Twentysix26 (Migrated from github.com) reviewed 2018-08-07 04:10:04 +02:00
calebj commented 2018-08-18 08:44:46 +02:00 (Migrated from github.com)

@Tobotimus rebased.

@Tobotimus rebased.
Tobotimus (Migrated from github.com) requested changes 2018-08-19 11:16:36 +02:00
Tobotimus (Migrated from github.com) left a comment

@calebj This PR adds a lot of really nice things, thank you. Just a few little things that can be fixed up and then I think it's good to go.

@calebj This PR adds a lot of really nice things, thank you. Just a few little things that can be fixed up and then I think it's good to go.
@ -209,11 +211,10 @@ class CogManager:
Tobotimus (Migrated from github.com) commented 2018-08-19 11:15:30 +02:00

paths() already deduplicates the paths before it returns, so you can remove the call to deduplicate here

`paths()` already deduplicates the paths before it returns, so you can remove the call to deduplicate here
Tobotimus (Migrated from github.com) commented 2018-08-19 11:06:52 +02:00

Unused import

Unused import
Tobotimus (Migrated from github.com) commented 2018-08-19 10:45:05 +02:00

Please use not isinstance instead of type() !=

Please use `not isinstance` instead of `type() !=`
Tobotimus (Migrated from github.com) commented 2018-08-19 10:47:15 +02:00

Not sure what's going on with this [] statement, would prefer the use of pass or contextlib.supress

Not sure what's going on with this `[]` statement, would prefer the use of `pass` or `contextlib.supress`
Tobotimus (Migrated from github.com) commented 2018-08-19 10:50:06 +02:00

Since this sem_wrapper is common to the one in bounded_gather_iter, it can be moved to the module-level and made private

Since this `sem_wrapper` is common to the one in `bounded_gather_iter`, it can be moved to the module-level and made private
Tobotimus (Migrated from github.com) commented 2018-08-19 10:50:29 +02:00

isinstance here too

`isinstance` here too
calebj (Migrated from github.com) reviewed 2018-08-19 22:43:24 +02:00
calebj (Migrated from github.com) commented 2018-08-19 22:43:24 +02:00

I think I had logic here for cancelling pending tasks, but I found something better (see the push)

I think I had logic here for cancelling pending tasks, but I found something better (see the push)
mikeshardmind (Migrated from github.com) approved these changes 2018-08-20 17:06:34 +02:00
mikeshardmind (Migrated from github.com) left a comment

I'm not seeing any issues with this after the changes made. I'm giving it a 👍

I'm not seeing any issues with this after the changes made. I'm giving it a :+1:
Tobotimus (Migrated from github.com) approved these changes 2018-08-21 03:25:23 +02:00
Tobotimus (Migrated from github.com) left a comment

Awesome. Thanks @calebj and thanks @mikeshardmind for reviewing

Awesome. Thanks @calebj and thanks @mikeshardmind for reviewing
Sign in to join this conversation.
No labels
Automated PR
Blocked
Blocked By: Damage Control
Blocked By: Dependency
Blocked By: Other PR
Breaking Change
Category: CI
Category: Cogs - Admin
Category: Cogs - Alias
Category: Cogs - Audio
Category: Cogs - Bank
Category: Cogs - Cleanup
Category: Cogs - CustomCommands
Category: Cogs - Dev
Category: Cogs - Downloader
Category: Cogs - Economy
Category: Cogs - Filter
Category: Cogs - General
Category: Cogs - Image
Category: Cogs - Mod
Category: Cogs - Modlog
Category: Cogs - Mutes
Category: Cogs - Permissions
Category: Cogs - Reports
Category: Cogs - Streams
Category: Cogs - Trivia
Category: Cogs - Trivia - Lists
Category: Cogs - Warnings
Category: Core - API - App Commands Package
Category: Core - API - Audio
Category: Core - API - Bank
Category: Core - API - Commands Package
Category: Core - API - Config
Category: Core - API - Other
Category: Core - API - Utils Package
Category: Core - Bot Class
Category: Core - Bot Commands
Category: Core - Command-line Interfaces
Category: Core - Downloader
Category: Core - Help
Category: Core - i18n
Category: Core - Modlog
Category: Core - Other Internals
Category: Core - RPC/ZMQ
Category: Docker
Category: Docs - Changelogs
Category: Docs - For Developers
Category: Docs - Install Guides
Category: Docs - Other
Category: Docs - User Guides
Category: Meta
Category: RPC/ZMQ methods
Category: Vendored Packages
Changelog Entry: Added
Changelog Entry: Pending
Changelog Entry: Skipped
Closed: Duplicate
Closed: External
Closed: Invalid
Closed: User Error
Closed: Won't Fix
Complex Issue
Docs-only
Feature Branch
Good First Issue
Help Wanted
High Priority
Needs Backport To stable-docs
No Activity
No Repro
QA: Bypassed
QA: Changes Requested
QA: Passed
Release Blocker
Status: Accepted
Status: Frozen
Status: In Progress
Status: Needs Discussion
Status: Needs Info
Status: Needs Triage
Status: PRs Welcome
Type: Bug
Type: Dependency Update
Type: Deprecation
Type: Enhancement
Type: Feature
Type: Informational
Type: Merge
Type: Optimisation
Type: Question
Type: Removal
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Mrcoolgamer11/Red-DiscordBot!1989
No description provided.