@@ -123,7 +123,6 @@ def task_meta(cls, **kwargs):
123123
124124import click
125125from click import Option , Argument
126- from doit import task_params
127126from doit .cmd_base import ModuleTaskLoader
128127from doit .reporter import ZeroReporter
129128from doit .exceptions import TaskError
@@ -269,7 +268,7 @@ def cli(ctx, **kwargs):
269268
270269 \b **python dev.py --build-dir my-build test -s stats**
271270
272- """
271+ """ # noqa: E501
273272 CLI .update_context (ctx , kwargs )
274273
275274
@@ -526,7 +525,7 @@ def install_project(cls, dirs, args):
526525 log_size = os .stat (log_filename ).st_size
527526 if log_size > last_log_size :
528527 elapsed = datetime .datetime .now () - start_time
529- print (" ... installation in progress ({0 } "
528+ print (" ... installation in progress ({} "
530529 "elapsed)" .format (elapsed ))
531530 last_blip = time .time ()
532531 last_log_size = log_size
@@ -539,7 +538,7 @@ def install_project(cls, dirs, args):
539538
540539 if ret != 0 :
541540 if not args .show_build_log :
542- with open (log_filename , 'r' ) as f :
541+ with open (log_filename ) as f :
543542 print (f .read ())
544543 print (f"Installation failed! ({ elapsed } elapsed)" )
545544 sys .exit (1 )
@@ -558,7 +557,7 @@ def copy_openblas(cls, dirs):
558557 default `_distributor_init.py` file with the one
559558 we use for wheels uploaded to PyPI so that DLL gets loaded.
560559
561- Assumes pkg-config is installed and aware of OpenBLAS.
560+ Assumes pkg-config is installed and aware of OpenBLAS.
562561
563562 The "dirs" parameter is typically a "Dirs" object with the
564563 structure as the following, say, if dev.py is run from the
@@ -652,7 +651,7 @@ class Test(Task):
652651 $ python dev.py test -s cluster -m full --durations 20
653652 $ python dev.py test -s stats -- --tb=line # `--` passes next args to pytest
654653 ```
655- """
654+ """ # noqa: E501
656655 ctx = CONTEXT
657656
658657 verbose = Option (
@@ -889,29 +888,14 @@ def emit_cmdstr(cmd):
889888 console .print (f"{ EMOJI .cmd } [cmd] { cmd } " )
890889
891890
892- @task_params ([{'name' : 'output_file' , 'long' : 'output-file' , 'default' : None ,
893- 'help' : 'Redirect report to a file' }])
894- def task_flake8 (output_file ):
895- """Run flake8 over the code base and benchmarks."""
896- opts = ''
897- if output_file :
898- opts += f'--output-file={ output_file } '
899-
900- cmd = f"flake8 { opts } scipy benchmarks/benchmarks"
901- emit_cmdstr (f"{ cmd } " )
902- return {
903- 'actions' : [cmd ],
904- 'doc' : 'Lint scipy and benchmarks directory' ,
905- }
906-
907-
908- def task_pep8diff ():
891+ def task_lint ():
909892 # Lint just the diff since branching off of main using a
910893 # stricter configuration.
911- emit_cmdstr (os .path .join ('tools' , 'lint_diff .py' ))
894+ emit_cmdstr (os .path .join ('tools' , 'lint .py' ) + ' --diff-against main' )
912895 return {
913- 'basename' : 'pep8-diff' ,
914- 'actions' : [str (Dirs ().root / 'tools' / 'lint_diff.py' )],
896+ 'basename' : 'lint' ,
897+ 'actions' : [str (Dirs ().root / 'tools' / 'lint.py' ) +
898+ ' --diff-against=main' ],
915899 'doc' : 'Lint only files modified since last commit (stricter rules)' ,
916900 }
917901
@@ -937,16 +921,11 @@ def task_check_test_name():
937921
938922@cli .cls_cmd ('lint' )
939923class Lint ():
940- """:dash: Run flake8, check PEP 8 compliance on branch diff and check for
924+ """:dash: Run linter on modified files and check for
941925 disallowed Unicode characters and possibly-invalid test names."""
942- output_file = Option (
943- ['--output-file' ], default = None , help = 'Redirect report to a file' )
944-
945- def run (output_file ):
946- opts = {'output_file' : output_file }
926+ def run ():
947927 run_doit_task ({
948- 'flake8' : opts ,
949- 'pep8-diff' : {},
928+ 'lint' : {},
950929 'unicode-check' : {},
951930 'check-testname' : {},
952931 })
@@ -1109,7 +1088,7 @@ def run(cls, pythonpath, extra_argv=None, **kwargs):
11091088 # Don't use subprocess, since we don't want to include the
11101089 # current path in PYTHONPATH.
11111090 sys .argv = extra_argv
1112- with open (extra_argv [0 ], 'r' ) as f :
1091+ with open (extra_argv [0 ]) as f :
11131092 script = f .read ()
11141093 sys .modules ['__main__' ] = new_module ('__main__' )
11151094 ns = dict (__name__ = '__main__' , __file__ = extra_argv [0 ])
0 commit comments