revisit 0.0.16__py2.py3-none-any.whl → 0.0.17__py2.py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
revisit/revisit.py CHANGED
@@ -10,8 +10,7 @@ import re
10
10
  import os
11
11
  import shutil
12
12
  from . import widget as _widget
13
- import ast
14
- import time
13
+
15
14
 
16
15
  __all__ = [
17
16
  "component",
@@ -170,6 +169,16 @@ class _WrappedComponentBlock(_JSONableBaseModel):
170
169
  numSamples: Optional[int] = None,
171
170
  component_function=None
172
171
  ) -> None:
172
+
173
+ # Initialize components list with blank component if empty
174
+ make_comp_block = True
175
+ if len(self.component_objects__) == 0:
176
+ self = self + __component__(type='questionnaire', component_name__='place-holder-component')
177
+ # If there only exists one component (either existing one or placeholder),
178
+ # do not create the first component blocks.
179
+ if len(self.component_objects__) == 1:
180
+ make_comp_block = False
181
+
173
182
  # Convert to JSON
174
183
  self_json = json.loads(self.__str__())
175
184
  # Get all current component dictionaries
@@ -181,7 +190,8 @@ class _WrappedComponentBlock(_JSONableBaseModel):
181
190
  order=order,
182
191
  numSamples=numSamples,
183
192
  input_components=components_dict,
184
- component_function=component_function
193
+ component_function=component_function,
194
+ make_comp_block=make_comp_block
185
195
  )
186
196
  # Set new objects
187
197
  self.component_objects__ = new_permuted_component_block.component_objects__
@@ -700,11 +710,12 @@ def _recursive_json_permutation(
700
710
  input_json: dict,
701
711
  factors: List[str],
702
712
  order: rvt_models.Order,
703
- numSamples: int,
704
713
  input_components: dict,
705
- component_function=None
714
+ numSamples: Optional[int] = None,
715
+ component_function=None,
716
+ make_comp_block=True
706
717
  ):
707
- new_seq = __sequence__(order=order, numSamples=numSamples)
718
+ new_seq = __sequence__(order=input_json['order'], numSamples=input_json.get('numSamples'))
708
719
  while input_json['components']:
709
720
  c = input_json['components'].pop()
710
721
  # If component name
@@ -749,5 +760,9 @@ def _recursive_json_permutation(
749
760
  curr_seq.root.order = new_input_json['order']
750
761
  curr_seq.root.numSamples = temp_num_samples
751
762
  new_seq = new_seq + curr_seq
752
- return new_seq
753
-
763
+
764
+ # Only return curr sequence if not making the comp block.
765
+ if make_comp_block is True:
766
+ return new_seq
767
+ else:
768
+ return curr_seq
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: revisit
3
- Version: 0.0.16
3
+ Version: 0.0.17
4
4
  Requires-Dist: altair[all]>=5.5.0
5
5
  Requires-Dist: anywidget
6
6
  Requires-Dist: ipykernel>=6.29.5
@@ -1,10 +1,10 @@
1
1
  revisit/StudyConfigSchema.json,sha256=xtzwZifuPJoiHASx0o8PHqBuh5L30mjBlhQ5eqsYm10,132168
2
2
  revisit/__init__.py,sha256=QCvYt8m9QwpjcK4dv6GlLMUDCzRXGy16cua1r2biNCg,255
3
3
  revisit/models.py,sha256=FRy8IlUAtDS3gdmZwwvqR935lbViTPnnr7k0CAkDkzI,134084
4
- revisit/revisit.py,sha256=JhlIKjaXfQmmqmSii7WSJSjJ5F1smoOBwZmk_nuMVOk,27015
4
+ revisit/revisit.py,sha256=EMumwz59lFXXWD_Tv10VKVoGSNGj1ZhGjbZjD2osbUc,27708
5
5
  revisit/widget.py,sha256=VvFqRvvvn86fW8ASe1pxaAvh5ZLvvSRThI5XtlCdgcg,915
6
6
  revisit/static/widget.css,sha256=GlTPXc8vQmM78wYzPsTppy3r_zOqG7sqY1hKSmmmZNk,2769
7
7
  revisit/static/widget.js,sha256=g1wG7qkotTDfDJ3F91jluJGQknDvYR3aL5DTrsOdY5w,1358091
8
- revisit-0.0.16.dist-info/METADATA,sha256=m1PxawsvA6wKBBdXTKy-BJmjKiGCOXRbUw2sSp5jOBs,8943
9
- revisit-0.0.16.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
10
- revisit-0.0.16.dist-info/RECORD,,
8
+ revisit-0.0.17.dist-info/METADATA,sha256=5clOydYRA8ZkEZyFKm-YDRYmBJpAF7kuoTMn2idFAgA,8943
9
+ revisit-0.0.17.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
10
+ revisit-0.0.17.dist-info/RECORD,,