revisit 0.0.15__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__
@@ -450,7 +460,6 @@ def widget(study: _WrappedStudyConfig, revisitPath: str):
450
460
  extracted_paths = []
451
461
 
452
462
  for component in study.root.components.values():
453
- print(component.root)
454
463
  actual_component = component.root
455
464
  if hasattr(actual_component, 'root'):
456
465
  actual_component = actual_component.root
@@ -701,11 +710,12 @@ def _recursive_json_permutation(
701
710
  input_json: dict,
702
711
  factors: List[str],
703
712
  order: rvt_models.Order,
704
- numSamples: int,
705
713
  input_components: dict,
706
- component_function=None
714
+ numSamples: Optional[int] = None,
715
+ component_function=None,
716
+ make_comp_block=True
707
717
  ):
708
- new_seq = __sequence__(order=order, numSamples=numSamples)
718
+ new_seq = __sequence__(order=input_json['order'], numSamples=input_json.get('numSamples'))
709
719
  while input_json['components']:
710
720
  c = input_json['components'].pop()
711
721
  # If component name
@@ -750,5 +760,9 @@ def _recursive_json_permutation(
750
760
  curr_seq.root.order = new_input_json['order']
751
761
  curr_seq.root.numSamples = temp_num_samples
752
762
  new_seq = new_seq + curr_seq
753
- return new_seq
754
-
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.15
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=yx6WApoJ0M5B0jPf6vsNVSgt7mWbm2BVfpEiQLHbQ4Q,27045
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.15.dist-info/METADATA,sha256=slQt5etPsvwsVEJGX-mRRQXuOzv26oMIYdfsizaCy58,8943
9
- revisit-0.0.15.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
10
- revisit-0.0.15.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,,