Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e58dd58

Browse files
committed
Enable the PLR6201 lint in Ruff
1 parent 903da20 commit e58dd58

52 files changed

Lines changed: 219 additions & 207 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.ruff.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ ignore = [
5151
"PLR2004", # Magic value used in comparison, consider replacing `{value}` with a constant variable
5252
"PLR5501", # Use `elif` instead of `else` then `if`, to reduce indentation
5353
"PLR6104", # Use `{operator}` to perform an augmented assignment directly
54-
"PLR6201", # Use a set literal when testing for membership
5554
"PLR6301", # Method `{method_name}` could be a function, class method, or static method
5655
# pylint ('PLW')
5756
"PLW2901", # Outer {outer_kind} variable `{name}` overwritten by inner {inner_kind} target

sphinx/application.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1673,7 +1673,7 @@ def set_html_assets_policy(self, policy: Literal['always', 'per_page']) -> None:
16731673
16741674
.. versionadded: 4.1
16751675
"""
1676-
if policy not in ('always', 'per_page'):
1676+
if policy not in {'always', 'per_page'}:
16771677
raise ValueError('policy %s is not supported' % policy)
16781678
self.registry.html_assets_policy = policy
16791679

sphinx/builders/_epub_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ def build_content(self) -> None:
580580
if ext not in self.media_types:
581581
# we always have JS and potentially OpenSearch files, don't
582582
# always warn about them
583-
if ext not in ('.js', '.xml'):
583+
if ext not in {'.js', '.xml'}:
584584
logger.warning(
585585
__('unknown mimetype for %s, ignoring'),
586586
filename,

sphinx/builders/latex/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ def validate_latex_theme_options(app: Sphinx, config: Config) -> None:
555555

556556
def install_packages_for_ja(app: Sphinx) -> None:
557557
"""Install packages for Japanese."""
558-
if app.config.language == 'ja' and app.config.latex_engine in ('platex', 'uplatex'):
558+
if app.config.language == 'ja' and app.config.latex_engine in {'platex', 'uplatex'}:
559559
app.add_latex_package('pxjahyper', after_hyperref=True)
560560

561561

sphinx/builders/latex/theming.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def __init__(self, name: str, config: Config) -> None:
5555
else:
5656
self.docclass = config.latex_docclass.get('manual', 'report')
5757

58-
if name in ('manual', 'howto'):
58+
if name in {'manual', 'howto'}:
5959
self.wrapperclass = 'sphinx' + name
6060
else:
6161
self.wrapperclass = name

sphinx/builders/latex/transforms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ class MathReferenceTransform(SphinxPostTransform):
566566
def run(self, **kwargs: Any) -> None:
567567
equations = self.env.domains.math_domain.data['objects']
568568
for node in self.document.findall(addnodes.pending_xref):
569-
if node['refdomain'] == 'math' and node['reftype'] in ('eq', 'numref'):
569+
if node['refdomain'] == 'math' and node['reftype'] in {'eq', 'numref'}:
570570
docname, _ = equations.get(node['reftarget'], (None, None))
571571
if docname:
572572
refnode = math_reference(

sphinx/builders/linkcheck.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ def __init__(self, search_anchor: str) -> None:
681681

682682
def handle_starttag(self, tag: Any, attrs: Any) -> None:
683683
for key, value in attrs:
684-
if key in ('id', 'name') and value == self.search_anchor:
684+
if key in {'id', 'name'} and value == self.search_anchor:
685685
self.found = True
686686
break
687687

sphinx/cmd/quickstart.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ def val(x: str) -> str:
121121

122122

123123
def boolean(x: str) -> bool:
124-
if x.upper() not in ('Y', 'YES', 'N', 'NO'):
124+
if x.upper() not in {'Y', 'YES', 'N', 'NO'}:
125125
raise ValidationError(__("Please enter either 'y' or 'n'."))
126-
return x.upper() in ('Y', 'YES')
126+
return x.upper() in {'Y', 'YES'}
127127

128128

129129
def suffix(x: str) -> str:

sphinx/domains/c/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ class CMemberObject(CObject):
290290
@property
291291
def display_object_type(self) -> str:
292292
# the distinction between var and member is only cosmetic
293-
assert self.objtype in ('member', 'var')
293+
assert self.objtype in {'member', 'var'}
294294
return self.objtype
295295

296296

@@ -354,7 +354,7 @@ class CNamespaceObject(SphinxDirective):
354354

355355
def run(self) -> list[Node]:
356356
rootSymbol = self.env.domaindata['c']['root_symbol']
357-
if self.arguments[0].strip() in ('NULL', '0', 'nullptr'):
357+
if self.arguments[0].strip() in {'NULL', '0', 'nullptr'}:
358358
symbol = rootSymbol
359359
stack: list[Symbol] = []
360360
else:
@@ -383,7 +383,7 @@ class CNamespacePushObject(SphinxDirective):
383383
option_spec: ClassVar[OptionSpec] = {}
384384

385385
def run(self) -> list[Node]:
386-
if self.arguments[0].strip() in ('NULL', '0', 'nullptr'):
386+
if self.arguments[0].strip() in {'NULL', '0', 'nullptr'}:
387387
return []
388388
parser = DefinitionParser(self.arguments[0],
389389
location=self.get_location(),

sphinx/domains/c/_ast.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def describe_signature(self, signode: TextElement, mode: str,
151151
assert not self.rooted, str(self)
152152
assert len(self.names) == 1
153153
self.names[0].describe_signature(signode, 'noneIsName', env, '', symbol)
154-
elif mode in ('markType', 'lastIsName', 'markName'):
154+
elif mode in {'markType', 'lastIsName', 'markName'}:
155155
# Each element should be a pending xref targeting the complete
156156
# prefix.
157157
prefix = ''

0 commit comments

Comments
 (0)