summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2022-08-15 19:05:15 +0200
committerAnton Khirnov <anton@khirnov.net>2022-08-15 19:05:15 +0200
commit8f07b260661afd9d74b8cb7f1f40be3153e7aa47 (patch)
treec40f0d6864abb02a64de4a94fbb23a84171fcc94
parent815a13a6719e54c31f6e8130b3746d7523005955 (diff)
datafile: more thorough detection of when c=<n> is needed
-rw-r--r--datafile.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/datafile.py b/datafile.py
index 0436e2a..f9f758f 100644
--- a/datafile.py
+++ b/datafile.py
@@ -84,6 +84,7 @@ class _DataSet(object):
### private ###
_df = None
+ _need_c = False
def __init__(self, df, name):
self._df = df
@@ -95,6 +96,7 @@ class _DataSet(object):
self._slice_single_component(first_iter, 0)
self.nb_components = 1
except KeyError:
+ self._need_c = True
c = 0
while True:
try:
@@ -119,6 +121,9 @@ class _DataSet(object):
def _slice_single_component(self, it, rl, component = None):
querystr = b'%s it=%d tl=0 rl=%d' % (self.name.encode('ascii'), it, rl)
+ if component is None and self._need_c:
+ component = 0
+
if component is not None:
querystr += b' c=%d' % component