pyglove 0.4.5.dev202501310808__py3-none-any.whl → 0.4.5.dev202502020807__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.
@@ -108,7 +108,8 @@ def evaluate(
108
108
 
109
109
  if isinstance(last_expr, ast.Assign):
110
110
  for name_node in last_expr.targets:
111
- result_vars.append(name_node.id)
111
+ if isinstance(name_node, ast.Name):
112
+ result_vars.append(name_node.id)
112
113
 
113
114
  last_expr = ast.Expression(last_expr.value) # pytype: disable=attribute-error
114
115
 
@@ -150,6 +150,27 @@ class EvaluateTest(unittest.TestCase):
150
150
  )
151
151
  self.assertEqual(ret, 'z is 1\n')
152
152
 
153
+ def test_attribute_assignment(self):
154
+ ret = execution.evaluate(
155
+ inspect.cleandoc(
156
+ """
157
+ class A:
158
+ def __init__(self, x):
159
+ self.x = x
160
+
161
+ a = A(1)
162
+ a.x = 2
163
+ """
164
+ ),
165
+ permission=permissions.CodePermission.ALL,
166
+ outputs_intermediate=True,
167
+ )
168
+ self.assertEqual(
169
+ list(ret.keys()), ['A', 'a', '__result__', '__stdout__']
170
+ )
171
+ self.assertTrue(inspect.isclass(ret['A']))
172
+ self.assertEqual(ret['__result__'], 2)
173
+
153
174
  def test_complex(self):
154
175
  ret = execution.evaluate(
155
176
  inspect.cleandoc(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: pyglove
3
- Version: 0.4.5.dev202501310808
3
+ Version: 0.4.5.dev202502020807
4
4
  Summary: PyGlove: A library for manipulating Python objects.
5
5
  Home-page: https://github.com/google/pyglove
6
6
  Author: PyGlove Authors
@@ -5,8 +5,8 @@ pyglove/core/logging_test.py,sha256=3z_c6wnxbqDbwUmSOAZzeDPXvzoweYL5QHUQVMJ5Xgo,
5
5
  pyglove/core/coding/__init__.py,sha256=tuHIg19ZchtkOQbdFVTVLkUpBa5f1eo66XtnKw3lcIU,1645
6
6
  pyglove/core/coding/errors.py,sha256=vstDb52lk5uJef2k_0_1dqvGv8eDYNq37IrqjGJ-cNc,3302
7
7
  pyglove/core/coding/errors_test.py,sha256=fwOR8vLiRvLadubsccyE19hLHj-kThlCQt88qmUYk9M,2311
8
- pyglove/core/coding/execution.py,sha256=Rq-rFPkecd70-wLnK-51L_rK01nd3J5SKfQidg3_qvY,10883
9
- pyglove/core/coding/execution_test.py,sha256=vTMLOCs7ceVi-XEz7-0CdPeoKqswBUQ26SzTqthcU4c,8397
8
+ pyglove/core/coding/execution.py,sha256=Fo5PS8FrKNxAQmzmyZvv2E7MabgcGsnGUw9YIhFEBgg,10931
9
+ pyglove/core/coding/execution_test.py,sha256=ghlwjNgL14-4_ZRDA8SmwQJzjOa2zhb4y6N6gV1DWso,8938
10
10
  pyglove/core/coding/function_generation.py,sha256=2fCqcdcizVYtGYE6QGpw5m1kuH9Fp0OF4BjyJ4en6tw,1636
11
11
  pyglove/core/coding/function_generation_test.py,sha256=kbSwmZF8Vog0R0OTSpuzPblEbMLoRJ1TigeIrwDhHS8,2161
12
12
  pyglove/core/coding/parsing.py,sha256=JXTdzFS9iB5-JVi9_-rDFORj_EZEtr7In8HBGHp09no,4084
@@ -211,8 +211,8 @@ pyglove/ext/scalars/randoms.py,sha256=LkMIIx7lOq_lvJvVS3BrgWGuWl7Pi91-lA-O8x_gZs
211
211
  pyglove/ext/scalars/randoms_test.py,sha256=nEhiqarg8l_5EOucp59CYrpO2uKxS1pe0hmBdZUzRNM,2000
212
212
  pyglove/ext/scalars/step_wise.py,sha256=IDw3tuTpv0KVh7AN44W43zqm1-E0HWPUlytWOQC9w3Y,3789
213
213
  pyglove/ext/scalars/step_wise_test.py,sha256=TL1vJ19xVx2t5HKuyIzGoogF7N3Rm8YhLE6JF7i0iy8,2540
214
- pyglove-0.4.5.dev202501310808.dist-info/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
215
- pyglove-0.4.5.dev202501310808.dist-info/METADATA,sha256=dm0yNPGp9rFF3t-p08IwTNVS4JvdY3o3_IQ0eGGe2EA,7067
216
- pyglove-0.4.5.dev202501310808.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
217
- pyglove-0.4.5.dev202501310808.dist-info/top_level.txt,sha256=wITzJSKcj8GZUkbq-MvUQnFadkiuAv_qv5qQMw0fIow,8
218
- pyglove-0.4.5.dev202501310808.dist-info/RECORD,,
214
+ pyglove-0.4.5.dev202502020807.dist-info/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
215
+ pyglove-0.4.5.dev202502020807.dist-info/METADATA,sha256=GrPVTap7aw6_4KTpGyqoYfIm6bsCSdrlYm4-ODrgUxs,7067
216
+ pyglove-0.4.5.dev202502020807.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
217
+ pyglove-0.4.5.dev202502020807.dist-info/top_level.txt,sha256=wITzJSKcj8GZUkbq-MvUQnFadkiuAv_qv5qQMw0fIow,8
218
+ pyglove-0.4.5.dev202502020807.dist-info/RECORD,,