revisit 0.0.7__py2.py3-none-any.whl → 0.0.9__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
revisit/revisit.py CHANGED
@@ -58,6 +58,9 @@ class _WrappedResponse(_JSONableBaseModel):
58
58
  self.root = _validate_response(self.root.__dict__)
59
59
  return self
60
60
 
61
+ def clone(self):
62
+ return response(**self.root.__dict__)
63
+
61
64
 
62
65
  # Private
63
66
  class _WrappedComponent(_JSONableBaseModel):
@@ -85,9 +88,20 @@ class _WrappedComponent(_JSONableBaseModel):
85
88
  return None
86
89
 
87
90
  def edit_response(self, id: str, **kwargs) -> _WrappedComponent:
88
- for response in self.root.response:
89
- if response.root.id == id:
90
- response.set(**kwargs)
91
+ print(self.root.response)
92
+ for r in self.root.response:
93
+ if r.root.id == id:
94
+ # Get dict
95
+ response_dict = r.root.__dict__
96
+ # Create new response
97
+ new_response = response(**response_dict)
98
+ # Set with new values
99
+ new_response.set(**kwargs)
100
+ # Filter out old response
101
+ self.root.response = [_r for _r in self.root.response if _r.root.id != id]
102
+ # Add new response
103
+ self.root.response.append(new_response)
104
+ # Return component
91
105
  return self
92
106
 
93
107
  raise ValueError('No response with given ID found.')
@@ -105,6 +119,9 @@ class _WrappedComponent(_JSONableBaseModel):
105
119
 
106
120
  return self
107
121
 
122
+ def clone(self, component_name__):
123
+ return component(**self.root.__dict__, component_name__=component_name__)
124
+
108
125
 
109
126
  class _WrappedStudyMetadata(_JSONableBaseModel):
110
127
  root: rvt_models.StudyMetadata
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: revisit
3
- Version: 0.0.7
3
+ Version: 0.0.9
4
4
  Requires-Dist: anywidget
5
5
  Requires-Dist: ipykernel>=6.29.5
6
6
  Requires-Dist: pydantic>=2.10.5
@@ -1,9 +1,9 @@
1
1
  revisit/__init__.py,sha256=QCvYt8m9QwpjcK4dv6GlLMUDCzRXGy16cua1r2biNCg,255
2
2
  revisit/models.py,sha256=c-Hsd6XqeIP-hybH6MUovHG65XXueRhaMEVJZW1ViX0,120701
3
- revisit/revisit.py,sha256=yYDzdaOw8t8bqNnhwbPhy8eRO62tHa6H4FGRECnPGXA,22001
3
+ revisit/revisit.py,sha256=huYhGnzG5gL2KA3Lw0dIDCI8erm82uP6k5XDcoo_Q38,22683
4
4
  revisit/widget.py,sha256=qx1xehXLLYlSdR44lDJ_nnb5czljsvGFBZNEV79G77I,1850
5
5
  revisit/static/widget.css,sha256=TLu5F6k0CvowQtmApPswG-JZUXYszo7a10dVWKnZsIg,647
6
6
  revisit/static/widget.js,sha256=MlZ2jHlh_ADsUKMC5nZaSAmW73-4y2B57NcS3E5Jh3Q,187153
7
- revisit-0.0.7.dist-info/METADATA,sha256=8SdNZppKm4OeGvuBWOvXOcfx26SG8r4sDIeCkD70YvY,1712
8
- revisit-0.0.7.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
9
- revisit-0.0.7.dist-info/RECORD,,
7
+ revisit-0.0.9.dist-info/METADATA,sha256=CjEuDh8fO6tcv9DNXUzbEU1gtKFfhF3S7Ma6AXyzkDQ,1712
8
+ revisit-0.0.9.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
9
+ revisit-0.0.9.dist-info/RECORD,,