pyglove 0.4.5.dev202412180809__py3-none-any.whl → 0.4.5.dev202412210807__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.
- pyglove/core/symbolic/class_wrapper.py +1 -5
- pyglove/core/symbolic/class_wrapper_test.py +2 -2
- pyglove/core/symbolic/object.py +1 -17
- pyglove/core/symbolic/object_test.py +2 -2
- {pyglove-0.4.5.dev202412180809.dist-info → pyglove-0.4.5.dev202412210807.dist-info}/METADATA +1 -1
- {pyglove-0.4.5.dev202412180809.dist-info → pyglove-0.4.5.dev202412210807.dist-info}/RECORD +9 -9
- {pyglove-0.4.5.dev202412180809.dist-info → pyglove-0.4.5.dev202412210807.dist-info}/LICENSE +0 -0
- {pyglove-0.4.5.dev202412180809.dist-info → pyglove-0.4.5.dev202412210807.dist-info}/WHEEL +0 -0
- {pyglove-0.4.5.dev202412180809.dist-info → pyglove-0.4.5.dev202412210807.dist-info}/top_level.txt +0 -0
@@ -45,11 +45,7 @@ class ClassWrapperMeta(pg_object.ObjectMeta):
|
|
45
45
|
|
46
46
|
def __getattr__(self, name):
|
47
47
|
"""Pass through attribute requests to sym_wrapped_cls."""
|
48
|
-
|
49
|
-
return super().__getattr__(name)
|
50
|
-
except AttributeError:
|
51
|
-
wrapped_cls = object.__getattribute__(self, 'sym_wrapped_cls')
|
52
|
-
return getattr(wrapped_cls, name)
|
48
|
+
return getattr(object.__getattribute__(self, 'sym_wrapped_cls'), name)
|
53
49
|
|
54
50
|
|
55
51
|
class ClassWrapper(pg_object.Object, metaclass=ClassWrapperMeta):
|
@@ -588,7 +588,7 @@ class ClassWrapperTest(unittest.TestCase):
|
|
588
588
|
self.assertIsInstance(C(1, 2), ClassWrapper)
|
589
589
|
self.assertTrue(pg_eq(C(1, 2), C(1, 2)))
|
590
590
|
self.assertEqual(list(C.__schema__.fields.keys()), ['x', 'y'])
|
591
|
-
self.assertEqual(repr(C), f'<class {C.
|
591
|
+
self.assertEqual(repr(C), f'<class {C.__type_name__!r}>')
|
592
592
|
|
593
593
|
def test_custom_metaclass(self):
|
594
594
|
|
@@ -604,7 +604,7 @@ class ClassWrapperTest(unittest.TestCase):
|
|
604
604
|
A1 = pg_wrap(A) # pylint: disable=invalid-name
|
605
605
|
self.assertTrue(issubclass(A1, ClassWrapper))
|
606
606
|
self.assertTrue(issubclass(A1, A))
|
607
|
-
self.assertEqual(A1.
|
607
|
+
self.assertEqual(A1.__type_name__, 'pyglove.core.symbolic.class_wrapper_test.A')
|
608
608
|
self.assertEqual(A1.__schema__, pg_typing.Schema([]))
|
609
609
|
self.assertEqual(A1.foo, 'foo')
|
610
610
|
self.assertRegex(repr(A1), r'Symbolic\[.*\]')
|
pyglove/core/symbolic/object.py
CHANGED
@@ -19,7 +19,6 @@ import inspect
|
|
19
19
|
import typing
|
20
20
|
from typing import Any, Dict, Iterator, List, Optional, Sequence, Union
|
21
21
|
|
22
|
-
from pyglove.core import logging
|
23
22
|
from pyglove.core import object_utils
|
24
23
|
from pyglove.core import typing as pg_typing
|
25
24
|
from pyglove.core.symbolic import base
|
@@ -49,21 +48,6 @@ class ObjectMeta(abc.ABCMeta):
|
|
49
48
|
"""
|
50
49
|
return f'{cls.__module__}.{cls.__qualname__}'
|
51
50
|
|
52
|
-
def __getattr__(cls, name):
|
53
|
-
# NOTE(daiyip): For backward compatibility, we allows these names to
|
54
|
-
# be used as aliases to the canonical names if users do not override them.
|
55
|
-
if name == 'schema':
|
56
|
-
logging.warning(
|
57
|
-
'`pg.Object.schema` is deprecated and will be removed in future. '
|
58
|
-
'Please use `__schema__` instead.')
|
59
|
-
return cls.__schema__
|
60
|
-
elif name == 'type_name':
|
61
|
-
logging.warning(
|
62
|
-
'`pg.Object.type_name` is deprecated and will be removed in future. '
|
63
|
-
'Please use `__type_name__` instead.')
|
64
|
-
return cls.__type_name__
|
65
|
-
raise AttributeError(name)
|
66
|
-
|
67
51
|
@property
|
68
52
|
def init_arg_list(cls) -> List[str]:
|
69
53
|
"""Gets __init__ positional argument list."""
|
@@ -80,7 +64,7 @@ class ObjectMeta(abc.ABCMeta):
|
|
80
64
|
"""
|
81
65
|
# Formalize schema first.
|
82
66
|
if schema is not None:
|
83
|
-
schema = cls._normalize_schema(schema)
|
67
|
+
schema = cls._normalize_schema(schema) # pytype: disable=attribute-error
|
84
68
|
setattr(cls, '__schema__', schema)
|
85
69
|
setattr(cls, '__sym_fields', pg_typing.Dict(schema))
|
86
70
|
|
@@ -412,7 +412,7 @@ class ObjectTest(unittest.TestCase):
|
|
412
412
|
_assert_init_arg_list(F, ['x', '*y'], ['x'], [], 'y')
|
413
413
|
|
414
414
|
def test_forward_reference(self):
|
415
|
-
self.assertIs(Foo.
|
415
|
+
self.assertIs(Foo.__schema__.get_field('p').value.cls, Foo)
|
416
416
|
|
417
417
|
def test_update_of_default_values(self):
|
418
418
|
|
@@ -2595,7 +2595,7 @@ class EventsTest(unittest.TestCase):
|
|
2595
2595
|
base.FieldUpdate(
|
2596
2596
|
path=object_utils.KeyPath.parse('a2.b1.c1[0].d3.z'),
|
2597
2597
|
target=sd.a2.b1.c1[0].d3,
|
2598
|
-
field=sd.a2.b1.c1[0].d3.__class__.
|
2598
|
+
field=sd.a2.b1.c1[0].d3.__class__.__schema__['z'],
|
2599
2599
|
old_value=MISSING_VALUE,
|
2600
2600
|
new_value='foo')
|
2601
2601
|
}
|
@@ -82,8 +82,8 @@ pyglove/core/symbolic/base.py,sha256=BMPjNR00mSg-KEVe1CXpJi4Keme2SVhpxinNtF24DE8
|
|
82
82
|
pyglove/core/symbolic/base_test.py,sha256=YLMlQGF4TbxAB2PcN1-ckI70gRIVDxabv-goh43CV7A,7333
|
83
83
|
pyglove/core/symbolic/boilerplate.py,sha256=YO8ZTZJ3VfAqeHqJpIY_ORVDxc1XIzxdplNlpexWEyc,6000
|
84
84
|
pyglove/core/symbolic/boilerplate_test.py,sha256=1CZ1W6kq3l-3tpaknhGFa04V18bO7vPzis5qzWnxHEs,5252
|
85
|
-
pyglove/core/symbolic/class_wrapper.py,sha256
|
86
|
-
pyglove/core/symbolic/class_wrapper_test.py,sha256=
|
85
|
+
pyglove/core/symbolic/class_wrapper.py,sha256=-99foaMo3pD4JhIW_VblJsQtXxoiGapqfENZjfZosxU,22932
|
86
|
+
pyglove/core/symbolic/class_wrapper_test.py,sha256=GPgeLefIPj9hiD0ib6z2LyOm6A3O2f4-JHpE7dgfsNM,21644
|
87
87
|
pyglove/core/symbolic/compounding.py,sha256=zg6x09rtaSEb5v5pYJWWWpI5Cezy2Oy1iuWw4LUj2HY,11717
|
88
88
|
pyglove/core/symbolic/compounding_test.py,sha256=PSnk_ds0q6pRJrpN9teMwZtMrbUp5_P-D7ea7wRTK6k,8372
|
89
89
|
pyglove/core/symbolic/dict.py,sha256=ZRamH_6ssuYA2kDwvXCbyyihIrq4xwinQli3DD2FI3M,37213
|
@@ -98,8 +98,8 @@ pyglove/core/symbolic/inferred.py,sha256=jGCKXLkYGDs-iUflR57UWrCrOQIpkpv5kHVyj-J
|
|
98
98
|
pyglove/core/symbolic/inferred_test.py,sha256=G6uPykONcChvs6vZujXHSWaYfjewLTVBscMqzzKNty0,1270
|
99
99
|
pyglove/core/symbolic/list.py,sha256=63v4Ph0FdkoCDj1FjwcmjUHGZSJLBLxaTKcGg7PdghE,30345
|
100
100
|
pyglove/core/symbolic/list_test.py,sha256=yHYAJhe_EYwtU9p8eDztSXNBjnAGKe0UDN5U6S-xDr8,60627
|
101
|
-
pyglove/core/symbolic/object.py,sha256=
|
102
|
-
pyglove/core/symbolic/object_test.py,sha256=
|
101
|
+
pyglove/core/symbolic/object.py,sha256=hy2waFCo3NFPzymXbDHGBUqW2EhEmF9fE4Crp9Hnewc,42137
|
102
|
+
pyglove/core/symbolic/object_test.py,sha256=WNp8lB202EMn7RDJbMAV_VVdtjg9MB3HKTgaJN8GTuw,93617
|
103
103
|
pyglove/core/symbolic/origin.py,sha256=5bH1jZvFHY5jwku32vDm8Bj2i-buv-YNuzOOsA5GlSA,6177
|
104
104
|
pyglove/core/symbolic/origin_test.py,sha256=dU_ZGrGDetM_lYVMn3wQO0d367_t_t8eESe3NrKPBNE,3159
|
105
105
|
pyglove/core/symbolic/pure_symbolic.py,sha256=FVq-5Cg5uZe3ybTIrTqTHIEJIpje0oxzV2kKL6UKlsU,3244
|
@@ -196,8 +196,8 @@ pyglove/ext/scalars/randoms.py,sha256=LkMIIx7lOq_lvJvVS3BrgWGuWl7Pi91-lA-O8x_gZs
|
|
196
196
|
pyglove/ext/scalars/randoms_test.py,sha256=nEhiqarg8l_5EOucp59CYrpO2uKxS1pe0hmBdZUzRNM,2000
|
197
197
|
pyglove/ext/scalars/step_wise.py,sha256=IDw3tuTpv0KVh7AN44W43zqm1-E0HWPUlytWOQC9w3Y,3789
|
198
198
|
pyglove/ext/scalars/step_wise_test.py,sha256=TL1vJ19xVx2t5HKuyIzGoogF7N3Rm8YhLE6JF7i0iy8,2540
|
199
|
-
pyglove-0.4.5.
|
200
|
-
pyglove-0.4.5.
|
201
|
-
pyglove-0.4.5.
|
202
|
-
pyglove-0.4.5.
|
203
|
-
pyglove-0.4.5.
|
199
|
+
pyglove-0.4.5.dev202412210807.dist-info/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
|
200
|
+
pyglove-0.4.5.dev202412210807.dist-info/METADATA,sha256=2Ba4x2mx7QeX5CRAk_V72gvyn3FIS6qh70wfzqtsFRs,6828
|
201
|
+
pyglove-0.4.5.dev202412210807.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
202
|
+
pyglove-0.4.5.dev202412210807.dist-info/top_level.txt,sha256=wITzJSKcj8GZUkbq-MvUQnFadkiuAv_qv5qQMw0fIow,8
|
203
|
+
pyglove-0.4.5.dev202412210807.dist-info/RECORD,,
|
File without changes
|
File without changes
|
{pyglove-0.4.5.dev202412180809.dist-info → pyglove-0.4.5.dev202412210807.dist-info}/top_level.txt
RENAMED
File without changes
|