-
Notifications
You must be signed in to change notification settings - Fork 111
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
Linter: Enable more ruff format/linter rules #2010
Merged
Merged
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
37 | for v in items: 38 | yield i, v 39 | i += 1 | ^^^^^^ SIM113 40 | 41 | else:
…`pass` 22 | # Delete environment to ensure consistent tests 23 | for key in config.env_keys: 24 | try: | _____^ 25 | | del environ[key] 26 | | except KeyError: 27 | | pass | |____________^ SIM105 | = help: Replace with `contextlib.suppress(KeyError)`
…`pass` 12 | """ 13 | for key in keys or []: 14 | try: | _____________^ 15 | | del self.__dict__[key] 16 | | except KeyError: 17 | | pass | |____________________^ SIM105 18 | 19 | @cached_property | = help: Replace with `contextlib.suppress(KeyError)`
…cept`-`pass` 49 | root = ElementTree.fromstring(data) 50 | try: | _____^ 51 | | # requires python 3.9 52 | | # https://stackoverflow.com/a/39482716/2314626 53 | | ElementTree.indent(root) 54 | | except AttributeError: 55 | | pass | |____________^ SIM105 56 | 57 | return ElementTree.tostring(root, encoding="utf8").decode("utf8") | = help: Replace with `contextlib.suppress(AttributeError)`
83 | return False 84 | id_from_trakt = getattr(episode, guid.provider, None) 85 | if str(id_from_trakt) != guid.id: | _________^ 86 | | return True 87 | | return False | |____________________^ SIM103 88 | 89 | def from_number(self, season: int, number: int): | = help: Replace with `return str(id_from_trakt) != guid.id`
134 | show_id = ep.show_id 135 | ep.show = plex_shows[show_id] 136 | show = show_cache[show_id] if show_id in show_cache else None | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM401 137 | m = self.mf.resolve_any(ep, show) 138 | if not m: | = help: Replace with `show_cache.get(show_id, None)`
122 | def is_collected(self, trakt_id, season, episode): 123 | if trakt_id not in self.shows.keys(): | _________^ 124 | | return False 125 | | elif season not in self.shows[trakt_id].seasons.keys(): 126 | | return False | |________________________^ SIM114 127 | return episode in self.shows[trakt_id].seasons[season].episodes.keys() | = help: Combine `if` branches
= help: Remove `.keys()`
35 | def make(cls=None, **kwargs) -> Union[TVShow]: | ^^^^^^^^^^^^^ UP007 36 | cls = cls if cls is not None else "object" 37 | # https://stackoverflow.com/a/2827726/2314626 | = help: Convert to `X | Y`
30 | def limit_iterator(items, limit: int): 31 | if not limit or limit <= 0: 32 | for i, v in enumerate(items): | _________^ 33 | | yield i, v | |______________________^ UP028 34 | 35 | else: | = help: Replace with `yield from`
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.
Inspired by hugovk/humanize@7cfa397