@@ -44,18 +44,13 @@ class Thing(ThingHash):
4444 __AS_TYPE__ = True
4545
4646 _props = dict ()
47- _any = None
48- _thing = None
4947 _type_name = None # Only set when __AS_TYPE__ is True
5048 _visited = 0 # For build, 0=not visited, 1=new_type, 2=set_type, 3=build
5149
5250 def __init__ (self , collection , id : int ):
5351 super ().__init__ (id )
54- cls = self .__class__
5552 self ._event_id = 0
5653 self ._collection = collection
57- cls ._any = Prop .get_conv ('any' , klass = Thing , collection = collection )
58- cls ._thing = Prop .get_conv ('thing' , klass = Thing , collection = collection )
5954 collection ._register (self )
6055
6156 def __init_subclass__ (cls ):
@@ -134,7 +129,7 @@ def _job_add(self, pair):
134129 f'while the property is of type `{ type (set_ )} `' )
135130 return
136131
137- convert = prop .nconv if prop else cls . _thing
132+ convert = prop .nconv if prop else self . collection . _conv_thing
138133 try :
139134 set_ .update ((convert (item ) for item in v ))
140135 except Exception as e :
@@ -177,14 +172,16 @@ def _job_remove(self, pair):
177172
178173 def _job_set (self , pairs ):
179174 cls = self .__class__
175+
180176 for k , v in pairs .items ():
181177 prop = cls ._props .get (k )
182178 if prop :
183179 convert = prop .vconv
184180 elif cls .__STRICT__ :
185181 continue
186182 else :
187- convert = cls ._any (v )
183+ convert = self .collection ._conv_any
184+
188185 try :
189186 v = convert (v )
190187 except Exception as e :
@@ -219,7 +216,7 @@ def _job_splice(self, pair):
219216 return
220217
221218 index , count , * items = v
222- convert = prop .nconv if prop else cls . _any
219+ convert = prop .nconv if prop else self . collection . _conv_any
223220 try :
224221 arr [index :index + count ] = (convert (item ) for item in items )
225222 except (TypeError , ValueError ) as e :
@@ -235,15 +232,27 @@ def _job_del_type(self, data):
235232 pass
236233
237234 def _job_mod_type_add (self , data ):
238- self ._collection ._update_type_add (data )
235+ self ._collection ._upd_type_add (data )
239236
240237 def _job_mod_type_del (self , data ):
241- self ._collection ._update_type_del (data )
238+ self ._collection ._upd_type_del (data )
242239
243240 def _job_mod_type_mod (self , data ):
244241 # we do not care about the specification so simply ignore this event
245242 pass
246243
244+ def _job_mod_enum_add (self , data ):
245+ self ._collection ._upd_enum_add (data )
246+
247+ def _job_mod_enum_del (self , data ):
248+ self ._collection ._upd_enum_del (data )
249+
250+ def _job_mod_enum_mod (self , data ):
251+ self ._collection ._upd_enum_mod (data )
252+
253+ def _job_mod_enum_ren (self , data ):
254+ self ._collection ._upd_enum_ren (data )
255+
247256 def _job_new_procedure (self , data ):
248257 self ._collection ._set_procedure (data )
249258
@@ -268,6 +277,10 @@ def _job_set_type(self, data):
268277 'mod_type_add' : _job_mod_type_add ,
269278 'mod_type_del' : _job_mod_type_del ,
270279 'mod_type_mod' : _job_mod_type_mod ,
280+ 'mod_enum_add' : _job_mod_enum_add ,
281+ 'mod_enum_del' : _job_mod_enum_del ,
282+ 'mod_enum_mod' : _job_mod_enum_mod ,
283+ 'mod_enum_ren' : _job_mod_enum_ren ,
271284 'new_procedure' : _job_new_procedure ,
272285 'new_type' : _job_new_type ,
273286 'set_type' : _job_set_type ,
0 commit comments