revisit 0.0.7__tar.gz → 0.0.8__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: revisit
3
- Version: 0.0.7
3
+ Version: 0.0.8
4
4
  Requires-Dist: anywidget
5
5
  Requires-Dist: ipykernel>=6.29.5
6
6
  Requires-Dist: pydantic>=2.10.5
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "revisit"
7
- version = "0.0.7"
7
+ version = "0.0.8"
8
8
  dependencies = [
9
9
  "anywidget",
10
10
  "ipykernel>=6.29.5",
@@ -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
File without changes
File without changes
File without changes
File without changes
File without changes