Repository: glotzerlab/signac

Issue:
view function regression in latest version
<!-- Please replace the text in the individual sections below. -->

### Description

"...there appears to be a regression affecting the view function in the latest version." per @csadorf  in the Gitter signac lobby

### To reproduce
```
# init.py
import signac

project = signac.init('fmria_project')

sp = {'monomer':'nfa'}
job = project.open_job(sp)
job.init()
```
`$ python3 init.py`
`$ signac view`

### Error output

`Error: <lambda>() takes 1 positional argument but 2 were given`

### System configuration

Please complete the following information:

 - Operating System [e.g. macOS]: CentOS `6.10 (final)`
 - Version of Python [e.g. 3.7]: `3.7.3`
 - Version of signac [e.g. 1.0]: `1.1.0`


Discussion:
codecov[bot]: # [Codecov](https://codecov.io/gh/glotzerlab/signac/pull/211?src=pr&el=h1) Report
> Merging [#211](https://codecov.io/gh/glotzerlab/signac/pull/211?src=pr&el=desc) into [master](https://codecov.io/gh/glotzerlab/signac/commit/f83f86d7436ad7c362deeb541230c7d1e3ac5cff?src=pr&el=desc) will **decrease** coverage by `4.43%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/glotzerlab/signac/pull/211/graphs/tree.svg?width=650&token=FghbjTyzgM&height=150&src=pr)](https://codecov.io/gh/glotzerlab/signac/pull/211?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master     #211      +/-   ##
==========================================
- Coverage   65.12%   60.69%   -4.44%     
==========================================
  Files          37       37              
  Lines        5594     5579      -15     
==========================================
- Hits         3643     3386     -257     
- Misses       1951     2193     +242
```


| [Impacted Files](https://codecov.io/gh/glotzerlab/signac/pull/211?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [signac/contrib/import\_export.py](https://codecov.io/gh/glotzerlab/signac/pull/211/diff?src=pr&el=tree#diff-c2lnbmFjL2NvbnRyaWIvaW1wb3J0X2V4cG9ydC5weQ==) | `84.93% <100%> (ø)` | :arrow_up: |
| [signac/core/h5store.py](https://codecov.io/gh/glotzerlab/signac/pull/211/diff?src=pr&el=tree#diff-c2lnbmFjL2NvcmUvaDVzdG9yZS5weQ==) | `27.11% <0%> (-63.39%)` | :arrow_down: |
| [signac/core/dict\_manager.py](https://codecov.io/gh/glotzerlab/signac/pull/211/diff?src=pr&el=tree#diff-c2lnbmFjL2NvcmUvZGljdF9tYW5hZ2VyLnB5) | `41.86% <0%> (-48.84%)` | :arrow_down: |
| [signac/contrib/job.py](https://codecov.io/gh/glotzerlab/signac/pull/211/diff?src=pr&el=tree#diff-c2lnbmFjL2NvbnRyaWIvam9iLnB5) | `83.54% <0%> (-6.99%)` | :arrow_down: |
| [signac/contrib/project.py](https://codecov.io/gh/glotzerlab/signac/pull/211/diff?src=pr&el=tree#diff-c2lnbmFjL2NvbnRyaWIvcHJvamVjdC5weQ==) | `89.93% <0%> (-0.76%)` | :arrow_down: |
| [signac/contrib/schema.py](https://codecov.io/gh/glotzerlab/signac/pull/211/diff?src=pr&el=tree#diff-c2lnbmFjL2NvbnRyaWIvc2NoZW1hLnB5) | `89.16% <0%> (-0.27%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/glotzerlab/signac/pull/211?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/glotzerlab/signac/pull/211?src=pr&el=footer). Last update [f83f86d...f5bf77f](https://codecov.io/gh/glotzerlab/signac/pull/211?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

codecov[bot]: # [Codecov](https://codecov.io/gh/glotzerlab/signac/pull/211?src=pr&el=h1) Report
> Merging [#211](https://codecov.io/gh/glotzerlab/signac/pull/211?src=pr&el=desc) into [master](https://codecov.io/gh/glotzerlab/signac/commit/f83f86d7436ad7c362deeb541230c7d1e3ac5cff?src=pr&el=desc) will **decrease** coverage by `4.43%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/glotzerlab/signac/pull/211/graphs/tree.svg?width=650&token=FghbjTyzgM&height=150&src=pr)](https://codecov.io/gh/glotzerlab/signac/pull/211?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master     #211      +/-   ##
==========================================
- Coverage   65.12%   60.69%   -4.44%     
==========================================
  Files          37       37              
  Lines        5594     5579      -15     
==========================================
- Hits         3643     3386     -257     
- Misses       1951     2193     +242
```


| [Impacted Files](https://codecov.io/gh/glotzerlab/signac/pull/211?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [signac/contrib/import\_export.py](https://codecov.io/gh/glotzerlab/signac/pull/211/diff?src=pr&el=tree#diff-c2lnbmFjL2NvbnRyaWIvaW1wb3J0X2V4cG9ydC5weQ==) | `84.93% <100%> (ø)` | :arrow_up: |
| [signac/core/h5store.py](https://codecov.io/gh/glotzerlab/signac/pull/211/diff?src=pr&el=tree#diff-c2lnbmFjL2NvcmUvaDVzdG9yZS5weQ==) | `27.11% <0%> (-63.39%)` | :arrow_down: |
| [signac/core/dict\_manager.py](https://codecov.io/gh/glotzerlab/signac/pull/211/diff?src=pr&el=tree#diff-c2lnbmFjL2NvcmUvZGljdF9tYW5hZ2VyLnB5) | `41.86% <0%> (-48.84%)` | :arrow_down: |
| [signac/contrib/job.py](https://codecov.io/gh/glotzerlab/signac/pull/211/diff?src=pr&el=tree#diff-c2lnbmFjL2NvbnRyaWIvam9iLnB5) | `83.54% <0%> (-6.99%)` | :arrow_down: |
| [signac/contrib/project.py](https://codecov.io/gh/glotzerlab/signac/pull/211/diff?src=pr&el=tree#diff-c2lnbmFjL2NvbnRyaWIvcHJvamVjdC5weQ==) | `89.93% <0%> (-0.76%)` | :arrow_down: |
| [signac/contrib/schema.py](https://codecov.io/gh/glotzerlab/signac/pull/211/diff?src=pr&el=tree#diff-c2lnbmFjL2NvbnRyaWIvc2NoZW1hLnB5) | `89.16% <0%> (-0.27%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/glotzerlab/signac/pull/211?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/glotzerlab/signac/pull/211?src=pr&el=footer). Last update [f83f86d...f5bf77f](https://codecov.io/gh/glotzerlab/signac/pull/211?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/changelog.txt b/changelog.txt
index daf2b1c6..145174d3 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -27,6 +27,7 @@ next
  - Fix issue causing a failure of the automatic conversion of valid key types (#168, #205).
  - Improve the 'dots in keys' error message to make it easier to fix related issues (#170, #205).
  - Update the ``__repr__`` and ``__repr_html__`` implementations of the ``Project`, ``Job``, and ``JobsCursor`` classes (#193).
+ - Fix issue with rendering views from the command line for single job project (#208).
  - Fix issue with heterogeneous types in state point values that are lists (#209).
 
 [1.1.0] -- 2019-05-19
diff --git a/signac/contrib/import_export.py b/signac/contrib/import_export.py
index 8a5a6053..b63d9a08 100644
--- a/signac/contrib/import_export.py
+++ b/signac/contrib/import_export.py
@@ -44,7 +44,9 @@ def _make_schema_based_path_function(jobs, exclude_keys=None, delimiter_nested='
     "Generate schema based paths as a function of the given jobs."
     from .schema import _build_job_statepoint_index
     if len(jobs) <= 1:
-        return lambda job: ''
+        # The lambda must (optionally) take a format spec argument to match the
+        # signature of the path function below.
+        return lambda job, sep=None: ''
 
     index = [{'_id': job._id, 'statepoint': job.sp()} for job in jobs]
     jsi = _build_job_statepoint_index(jobs=jobs, exclude_const=True, index=index)


Test patch:
diff --git a/tests/test_shell.py b/tests/test_shell.py
index 0b33d92c..a7a9dd5c 100644
--- a/tests/test_shell.py
+++ b/tests/test_shell.py
@@ -142,6 +142,21 @@ class BasicShellTest(unittest.TestCase):
         self.assertIn('b', doc)
         self.assertEqual(doc['b'], 0)
 
+    def test_view_single(self):
+        """Check whether command line views work for single job workspaces."""
+        self.call('python -m signac init my_project'.split())
+        project = signac.Project()
+        sps = [{'a': i} for i in range(1)]
+        for sp in sps:
+            project.open_job(sp).init()
+        os.mkdir('view')
+        self.call('python -m signac view'.split())
+        for sp in sps:
+            self.assertTrue(os.path.isdir('view/job'))
+            self.assertEqual(
+                os.path.realpath('view/job'),
+                os.path.realpath(project.open_job(sp).workspace()))
+
     def test_view(self):
         self.call('python -m signac init my_project'.split())
         project = signac.Project()