From 4e30b35a4a1fbe7be898558d01688d8bcc924642 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Fri, 10 Feb 2023 18:07:08 -0600 Subject: [PATCH] quote extras in docstrings and warnings --- src/pyhf/cli/complete.py | 8 ++++---- src/pyhf/cli/rootio.py | 4 ++-- src/pyhf/contrib/cli.py | 4 ++-- src/pyhf/contrib/utils.py | 2 +- tests/test_scripts.py | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/pyhf/cli/complete.py b/src/pyhf/cli/complete.py index 4b21bd3bff..58fda5604f 100644 --- a/src/pyhf/cli/complete.py +++ b/src/pyhf/cli/complete.py @@ -21,9 +21,9 @@ def cli(shell): @click.command(help='Generate shell completion code.', name='completions') @click.argument('shell', default=None) def cli(shell): - '''Placeholder for shell completion code generatioon function if necessary dependency is missing.''' + """Placeholder for shell completion code generatioon function if necessary dependency is missing.""" click.secho( - 'This requires the click_completion module.\n' - 'You can install it with the shellcomplete extra:\n' - 'python -m pip install pyhf[shellcomplete]' + "This requires the click_completion module.\n" + "You can install it with the shellcomplete extra:\n" + "python -m pip install 'pyhf[shellcomplete]'" ) diff --git a/src/pyhf/cli/rootio.py b/src/pyhf/cli/rootio.py index 053304f381..95d8872a84 100644 --- a/src/pyhf/cli/rootio.py +++ b/src/pyhf/cli/rootio.py @@ -50,7 +50,7 @@ def xml2json( except ImportError: log.error( "xml2json requires uproot, please install pyhf using the " - "xmlio extra: python -m pip install pyhf[xmlio]", + "xmlio extra: python -m pip install 'pyhf[xmlio]'", exc_info=True, ) from pyhf import readxml @@ -86,7 +86,7 @@ def json2xml(workspace, output_dir, specroot, dataroot, resultprefix, patch): except ImportError: log.error( "json2xml requires uproot, please install pyhf using the " - "xmlio extra: python -m pip install pyhf[xmlio]", + "xmlio extra: python -m pip install 'pyhf[xmlio]'", exc_info=True, ) from pyhf import writexml diff --git a/src/pyhf/contrib/cli.py b/src/pyhf/contrib/cli.py index 967cb43902..eaf2bb7e23 100644 --- a/src/pyhf/contrib/cli.py +++ b/src/pyhf/contrib/cli.py @@ -24,7 +24,7 @@ def cli(): .. code-block:: shell - $ python -m pip install pyhf[contrib] + $ python -m pip install 'pyhf[contrib]' """ from pyhf.contrib import utils # Guard CLI from missing extra # noqa: F401 @@ -72,6 +72,6 @@ def download(archive_url, output_directory, verbose, force, compress): except AttributeError: log.error( "\nInstallation of the contrib extra is required to use the contrib CLI API" - + "\nPlease install with: python -m pip install pyhf[contrib]\n", + + "\nPlease install with: python -m pip install 'pyhf[contrib]'\n", exc_info=True, ) diff --git a/src/pyhf/contrib/utils.py b/src/pyhf/contrib/utils.py index be9694d094..87ca46d33e 100644 --- a/src/pyhf/contrib/utils.py +++ b/src/pyhf/contrib/utils.py @@ -128,6 +128,6 @@ def download(archive_url, output_directory, force=False, compress=False): except ModuleNotFoundError: log.error( "\nInstallation of the contrib extra is required to use pyhf.contrib.utils.download" - + "\nPlease install with: python -m pip install pyhf[contrib]\n", + + "\nPlease install with: python -m pip install 'pyhf[contrib]'\n", exc_info=True, ) diff --git a/tests/test_scripts.py b/tests/test_scripts.py index d2135523a6..dc0dd602a9 100644 --- a/tests/test_scripts.py +++ b/tests/test_scripts.py @@ -632,7 +632,7 @@ def test_missing_contrib_extra(caplog): for line in [ "import of requests halted; None in sys.modules", "Installation of the contrib extra is required to use pyhf.contrib.utils.download", - "Please install with: python -m pip install pyhf[contrib]", + "Please install with: python -m pip install 'pyhf[contrib]'", ]: assert line in caplog.text caplog.clear() @@ -672,7 +672,7 @@ def test_missing_contrib_download(caplog): for line in [ "module 'pyhf.contrib.utils' has no attribute 'download'", "Installation of the contrib extra is required to use the contrib CLI API", - "Please install with: python -m pip install pyhf[contrib]", + "Please install with: python -m pip install 'pyhf[contrib]'", ]: assert line in caplog.text caplog.clear()