-
-
Notifications
You must be signed in to change notification settings - Fork 601
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
Providers cleanup #8604
Providers cleanup #8604
Changes from 4 commits
28c3687
8f202be
116d6db
a57ae37
5d73af1
a382db6
ada9b46
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#-------------------------------------------------------------------------------# | ||
# Qodana analysis is configured by qodana.yaml file # | ||
# https://www.jetbrains.com/help/qodana/qodana-yaml.html # | ||
#-------------------------------------------------------------------------------# | ||
version: "1.0" | ||
|
||
#Specify inspection profile for code analysis | ||
profile: | ||
name: qodana.starter | ||
|
||
#Enable inspections | ||
#include: | ||
# - name: <SomeEnabledInspectionId> | ||
|
||
#Disable inspections | ||
#exclude: | ||
# - name: <SomeDisabledInspectionId> | ||
# paths: | ||
# - <path/where/not/run/inspection> | ||
|
||
#Execute shell command before Qodana execution (Applied in CI/CD pipeline) | ||
#bootstrap: sh ./prepare-qodana.sh | ||
|
||
#Install IDE plugins before Qodana execution (Applied in CI/CD pipeline) | ||
#plugins: | ||
# - id: <plugin.id> #(plugin id can be found at https://plugins.jetbrains.com) | ||
|
||
#Specify Qodana linter for analysis (Applied in CI/CD pipeline) | ||
linter: jetbrains/qodana-python:latest |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -132,9 +132,10 @@ | |||||||||||||||||||||||||||||||||||||||
] | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
def sorted_provider_list(randomize=False) -> List[Union[TorrentProvider, NZBProvider, TorrentRssProvider, NZBProvider, GenericProvider]]: | ||||||||||||||||||||||||||||||||||||||||
initialList = settings.providerList + settings.newznab_provider_list + settings.torrent_rss_provider_list | ||||||||||||||||||||||||||||||||||||||||
provider_dict = {x.get_id(): x for x in initialList} | ||||||||||||||||||||||||||||||||||||||||
def sorted_provider_list(randomize=False, only_enabled=False) -> List[Union[TorrentProvider, NZBProvider, TorrentRssProvider, NZBProvider, GenericProvider]]: | ||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The return type of the function ProviderType = Union[TorrentProvider, NZBProvider, TorrentRssProvider, NZBProvider, GenericProvider]
def sorted_provider_list(randomize=False, only_enabled=False) -> List[ProviderType]: |
||||||||||||||||||||||||||||||||||||||||
initial_list = settings.providerList + settings.newznab_provider_list + settings.torrent_rss_provider_list | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
provider_dict = {x.get_id(): x for x in initial_list} | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
new_provider_list = [] | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
|
@@ -145,14 +146,17 @@ def sorted_provider_list(randomize=False) -> List[Union[TorrentProvider, NZBProv | |||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
# add all enabled providers first | ||||||||||||||||||||||||||||||||||||||||
for current_module in provider_dict: | ||||||||||||||||||||||||||||||||||||||||
if provider_dict[current_module] not in new_provider_list and provider_dict[current_module].is_enabled: | ||||||||||||||||||||||||||||||||||||||||
if current_module not in new_provider_list and provider_dict[current_module].is_enabled: | ||||||||||||||||||||||||||||||||||||||||
new_provider_list.append(provider_dict[current_module]) | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
# add any modules that are missing from that list | ||||||||||||||||||||||||||||||||||||||||
for current_module in provider_dict: | ||||||||||||||||||||||||||||||||||||||||
if provider_dict[current_module] not in new_provider_list: | ||||||||||||||||||||||||||||||||||||||||
new_provider_list.append(provider_dict[current_module]) | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
miigotu marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The logic for adding enabled providers to the - if current_module not in new_provider_list and provider_dict[current_module].is_enabled:
+ if provider_dict[current_module].is_enabled:
- if provider_dict[current_module] not in new_provider_list:
+ new_provider_list.append(provider_dict[current_module]) Commitable suggestion (Beta)
Suggested change
|
||||||||||||||||||||||||||||||||||||||||
if only_enabled: | ||||||||||||||||||||||||||||||||||||||||
new_provider_list = [provider for provider in new_provider_list if (provider.provider_type == GenericProvider.TORRENT and settings.USE_TORRENTS) or (provider.provider_type == GenericProvider.NZB and settings.USE_NZBS)] | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
if randomize: | ||||||||||||||||||||||||||||||||||||||||
shuffle(new_provider_list) | ||||||||||||||||||||||||||||||||||||||||
Comment on lines
166
to
167
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
filter_shows_being_removed
function is well written and follows the set comprehension syntax. It filters out shows that are either in the remove queue or are being removed. However, it's a good practice to add a docstring to explain what the function does.Commitable suggestion (Beta)