From b3b3e7f784a1363334fcec5f8c03c18ac6a0b643 Mon Sep 17 00:00:00 2001 From: Jim Pivarski Date: Fri, 18 Sep 2020 10:07:24 -0500 Subject: [PATCH] Ensure that we don't check in code with print statements. (#110) --- docs-sphinx/prepare_docstrings.py | 5 +++-- requirements-test.txt | 1 + setup.cfg | 2 +- uproot4/reading.py | 1 - uproot4/source/futures.py | 4 ++-- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/docs-sphinx/prepare_docstrings.py b/docs-sphinx/prepare_docstrings.py index d4dff3192..1708f68bb 100644 --- a/docs-sphinx/prepare_docstrings.py +++ b/docs-sphinx/prepare_docstrings.py @@ -4,6 +4,7 @@ import inspect import pkgutil import os.path +import sys order = [ @@ -41,9 +42,9 @@ def ensure(objname, filename, content): overwrite = open(filename, "r").read() != content if overwrite: open(filename, "w").write(content) - print(objname, "(OVERWRITTEN)") + sys.err.write(objname + " (OVERWRITTEN)\n") else: - print(objname) + sys.err.write(objname + "\n") def handle_module(modulename, module): diff --git a/requirements-test.txt b/requirements-test.txt index b9f9db914..c9f1939e1 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,5 +1,6 @@ pytest flake8 +flake8-print scikit-hep-testdata lz4 xxhash diff --git a/setup.cfg b/setup.cfg index 689f491f5..33917df10 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [flake8] -ignore = E203, W503, E501, E266 +ignore = E203, W503, E501, E266, N max-complexity = 100 exclude = tests, setup.py, uproot4/__init__.py diff --git a/uproot4/reading.py b/uproot4/reading.py index 47ec3343e..ea2b98932 100644 --- a/uproot4/reading.py +++ b/uproot4/reading.py @@ -112,7 +112,6 @@ def open( * :py:func:`~uproot4.behaviors.TBranch.lazy`: returns a lazily read array from ``TTrees``. """ - if isinstance(path, dict) and len(path) == 1: ((file_path, object_path),) = path.items() diff --git a/uproot4/source/futures.py b/uproot4/source/futures.py index 70ac3e829..4849f0dbf 100644 --- a/uproot4/source/futures.py +++ b/uproot4/source/futures.py @@ -167,7 +167,7 @@ def run(self): """ future = None while True: - del future # don't hang onto a reference while waiting for more work + del future # don't hang onto a reference while waiting for more work future = self._work_queue.get() if future is None: break @@ -323,7 +323,7 @@ def run(self): """ future = None while True: - del future # don't hang onto a reference while waiting for more work + del future # don't hang onto a reference while waiting for more work future = self._work_queue.get() if future is None: break