Skip to content

Commit 221ea71

Browse files
authored
Merge pull request numpy#26857 from DimitriPapadopoulos/24994
MAINT: Start applying ruff/Pycodestyle rules
2 parents 392baea + 694b862 commit 221ea71

File tree

90 files changed

+162
-179
lines changed

Some content is hidden

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

90 files changed

+162
-179
lines changed

.spin/cmds.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import os
22
import shutil
33
import pathlib
4-
import shutil
5-
import pathlib
64
import importlib
75
import subprocess
86

@@ -263,7 +261,7 @@ def test(ctx, pytest_args, markexpr, n_jobs, tests, verbose, *args, **kwargs):
263261
if (n_jobs != "1") and ('-n' not in pytest_args):
264262
pytest_args = ('-n', str(n_jobs)) + pytest_args
265263

266-
if tests and not ('--pyargs' in pytest_args):
264+
if tests and '--pyargs' not in pytest_args:
267265
pytest_args = ('--pyargs', tests) + pytest_args
268266

269267
if verbose:
@@ -774,7 +772,7 @@ def notes(ctx, version_override):
774772
# Check if `towncrier` is installed
775773
if not shutil.which("towncrier"):
776774
raise click.ClickException(
777-
f"please install `towncrier` to use this command"
775+
"please install `towncrier` to use this command"
778776
)
779777

780778
click.secho(

benchmarks/asv_pip_nopep517.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
"""
22
This file is used by asv_compare.conf.json.tpl.
33
"""
4-
import subprocess, sys
4+
import subprocess
5+
import sys
56
# pip ignores '--global-option' when pep517 is enabled therefore we disable it.
67
cmd = [sys.executable, '-mpip', 'wheel', '--no-use-pep517']
78
try:

benchmarks/benchmarks/common.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import numpy as np
22
import random
3-
import os
43
from functools import lru_cache
54
from pathlib import Path
65

doc/neps/conf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
# add these directories to sys.path here. If the directory is relative to the
1616
# documentation root, use os.path.abspath to make it absolute, like shown here.
1717
#
18-
import os
1918
from datetime import datetime
2019
# import sys
2120
# sys.path.insert(0, os.path.abspath('.'))

doc/neps/tools/build_index.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def render(tpl_path, context):
1919
def nep_metadata():
2020
ignore = ('nep-template.rst')
2121
sources = sorted(glob.glob(r'nep-*.rst'))
22-
sources = [s for s in sources if not s in ignore]
22+
sources = [s for s in sources if s not in ignore]
2323

2424
meta_re = r':([a-zA-Z\-]*): (.*)'
2525

@@ -55,7 +55,7 @@ def nep_metadata():
5555
f' {tags["Title"]!r}')
5656

5757
if tags['Status'] in ('Accepted', 'Rejected', 'Withdrawn'):
58-
if not 'Resolution' in tags:
58+
if 'Resolution' not in tags:
5959
raise RuntimeError(
6060
f'NEP {nr} is Accepted/Rejected/Withdrawn but '
6161
'has no Resolution tag'
@@ -70,15 +70,15 @@ def nep_metadata():
7070

7171
for nr, tags in neps.items():
7272
if tags['Status'] == 'Superseded':
73-
if not 'Replaced-By' in tags:
73+
if 'Replaced-By' not in tags:
7474
raise RuntimeError(
7575
f'NEP {nr} has been Superseded, but has no Replaced-By tag'
7676
)
7777

7878
replaced_by = int(re.findall(r'\d+', tags['Replaced-By'])[0])
7979
replacement_nep = neps[replaced_by]
8080

81-
if not 'Replaces' in replacement_nep:
81+
if 'Replaces' not in replacement_nep:
8282
raise RuntimeError(
8383
f'NEP {nr} is superseded by {replaced_by}, but that NEP has '
8484
f"no Replaces tag."

doc/preprocess.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#!/usr/bin/env python3
2-
import subprocess
32
import os
4-
import sys
53
from string import Template
64

75
def main():

doc/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ def linkcode_resolve(domain, info):
575575
numpy.__version__, fn, linespec)
576576

577577
from pygments.lexers import CLexer
578-
from pygments.lexer import inherit, bygroups
578+
from pygments.lexer import inherit
579579
from pygments.token import Comment
580580

581581
class NumPyLexer(CLexer):

doc/source/reference/simd/gen_features.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
Generate CPU features tables from CCompilerOpt
33
"""
4-
from os import sys, path
4+
from os import path
55
from numpy.distutils.ccompiler_opt import CCompilerOpt
66

77
class FakeCCompilerOpt(CCompilerOpt):

numpy/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@
144144
frexp, from_dlpack, frombuffer, fromfile, fromfunction, fromiter,
145145
frompyfunc, fromstring, full, full_like, gcd, generic, geomspace,
146146
get_printoptions, getbufsize, geterr, geterrcall, greater,
147-
greater_equal, half, heaviside, hstack, hypot, identity, iinfo, iinfo,
147+
greater_equal, half, heaviside, hstack, hypot, identity, iinfo,
148148
indices, inexact, inf, inner, int16, int32, int64, int8, int_, intc,
149149
integer, intp, invert, is_busday, isclose, isdtype, isfinite,
150150
isfortran, isinf, isnan, isnat, isscalar, issubdtype, lcm, ldexp,

numpy/_build_utils/gcc_build_bitness.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""
44

55
import re
6-
from subprocess import run, PIPE
6+
from subprocess import run
77

88

99
def main():

0 commit comments

Comments
 (0)