File tree Expand file tree Collapse file tree 4 files changed +14
-3
lines changed
third-party/thrift/src/thrift/lib/py3 Expand file tree Collapse file tree 4 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -224,7 +224,6 @@ def test_list_from_iterable(self) -> None:
224224 [Color .red , Color .blue , Color .green ],
225225 )
226226
227- @brokenInAutoMigrate ()
228227 def test_is_container (self ) -> None :
229228 self .assertIsInstance (int_list , Container )
230229 self .assertIsInstance (I32List ([1 , 2 , 3 ]), Container )
Original file line number Diff line number Diff line change @@ -182,7 +182,6 @@ def test_equality(self) -> None:
182182 self .assertEqual (x , x )
183183 self .assertEqual (y , y )
184184
185- @brokenInAutoMigrate ()
186185 def test_is_container (self ) -> None :
187186 self .assertIsInstance (LocationMap , Container )
188187 self .assertIsInstance (StrI32ListMap (), Container )
Original file line number Diff line number Diff line change @@ -251,7 +251,6 @@ def test_set_op_return_type(self) -> None:
251251 self .assertIsInstance (x .__rxor__ (y ), expected_type )
252252 self .assertIsInstance (x .__rsub__ (y ), expected_type )
253253
254- @brokenInAutoMigrate ()
255254 def test_is_container (self ) -> None :
256255 self .assertIsInstance (SetI32Lists (), Container )
257256 self .assertIsInstance (SetSetI32Lists (), Container )
Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ from thrift.python.types cimport (
3434)
3535from apache.thrift.metadata.types_auto_migrated import _fbthrift__is_py3_auto_migrated
3636from thrift.python.types import (
37+ Container as _fbthrift_python_Container,
3738 Enum as _fbthrift_python_Enum,
3839 EnumMeta as _fbthrift_python_EnumMeta,
3940 Flag as _fbthrift_python_Flag,
@@ -392,6 +393,19 @@ cdef class Container:
392393 def __len__ (self ):
393394 raise NotImplementedError ()
394395
396+ class ContainerMeta (type ):
397+ def __instancecheck__ (cls , inst ):
398+ if isinstance (inst, _fbthrift_python_Container):
399+ return _fbthrift__is_py3_auto_migrated
400+ return super ().__instancecheck__(inst)
401+
402+ def __subclasscheck__ (cls , sub ):
403+ if issubclass (sub, _fbthrift_python_Container):
404+ return _fbthrift__is_py3_auto_migrated
405+ return super ().__subclasscheck__(sub)
406+
407+ SetMetaClass(< PyTypeObject* > Container, < PyTypeObject* > ContainerMeta)
408+
395409cdef class _ListPrivateCtorToken:
396410 pass
397411
You can’t perform that action at this time.
0 commit comments