Skip to content

Commit

Permalink
MNT: Fix flake8 errors
Browse files Browse the repository at this point in the history
  • Loading branch information
kernc committed Mar 11, 2024
1 parent 75d2c5f commit da13281
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
wget -O/tmp/pandoc.deb https://github.com/jgm/pandoc/releases/download/2.10/pandoc-2.10-1-amd64.deb && sudo dpkg -i /tmp/pandoc.deb
- run: find -name '*.md' | xargs .github/lint-markdown.sh
- run: flake8
- run: flake8 pdoc setup.py
- run: mypy -p pdoc
- run: time coverage run -m unittest -v pdoc.test
- run: bash <(curl -s https://codecov.io/bash)
Expand Down
3 changes: 2 additions & 1 deletion pdoc/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,12 +524,13 @@ def main(_args=None):
httpd.server_close()
sys.exit(0)

docfilter = None
if args.filter and args.filter.strip():
def docfilter(obj, _filters=args.filter.strip().split(',')):
return any(f in obj.refname or
isinstance(obj, pdoc.Class) and f in obj.doc
for f in _filters)
else:
docfilter = None

modules = [pdoc.Module(module, docfilter=docfilter,
skip_errors=args.skip_errors)
Expand Down
12 changes: 6 additions & 6 deletions pdoc/test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,13 +250,13 @@ def test_html_ref_links(self):
)

def test_docformat(self):
with self.assertWarns(UserWarning) as cm,\
with self.assertWarns(UserWarning) as cm, \
run_html(EXAMPLE_MODULE, config='docformat="restructuredtext"'):
self._basic_html_assertions()
self.assertIn('numpy', cm.warning.args[0])

def test_html_no_source(self):
with self.assertWarns(DeprecationWarning),\
with self.assertWarns(DeprecationWarning), \
run_html(EXAMPLE_MODULE, html_no_source=None):
self._basic_html_assertions()
self._check_files(exclude_patterns=['class="source"', 'Hidden'])
Expand Down Expand Up @@ -301,7 +301,7 @@ def test_external_links(self):
self._basic_html_assertions()
self._check_files(exclude_patterns=['<a href="/sys.version.ext"'])

with self.assertWarns(DeprecationWarning),\
with self.assertWarns(DeprecationWarning), \
run_html(EXAMPLE_MODULE, external_links=None):
self._basic_html_assertions()
self._check_files(['<a title="sys.version" href="/sys.version.ext"'])
Expand All @@ -319,7 +319,7 @@ def test_template_dir(self):
pdoc.tpl_lookup._collection.clear()

def test_link_prefix(self):
with self.assertWarns(DeprecationWarning),\
with self.assertWarns(DeprecationWarning), \
run_html(EXAMPLE_MODULE, link_prefix='/foobar/'):
self._basic_html_assertions()
self._check_files(['/foobar/' + EXAMPLE_MODULE])
Expand Down Expand Up @@ -445,8 +445,8 @@ def test_relative_dir_path(self):
self._check_files(())

def test_skip_errors(self):
with chdir(os.path.join(TESTS_BASEDIR, EXAMPLE_MODULE, '_skip_errors')),\
redirect_streams(),\
with chdir(os.path.join(TESTS_BASEDIR, EXAMPLE_MODULE, '_skip_errors')), \
redirect_streams(), \
self.assertWarns(pdoc.Module.ImportWarning) as cm:
run('.', skip_errors=None)
self.assertIn('ZeroDivision', cm.warning.args[0])
Expand Down

0 comments on commit da13281

Please sign in to comment.