1818from builtins import str , bytes
1919from packaging .version import Version
2020
21- from ...utils .misc import is_container
2221from ...utils .filemanip import md5 , hash_infile , hash_timestamp , to_str
2322from .traits_extension import (
2423 traits ,
@@ -151,24 +150,26 @@ def _deprecated_warn(self, obj, name, old, new):
151150 '%s' % trait_spec .new_name : new
152151 })
153152
154- def get (self , ** kwargs ):
153+ def trait_get (self , ** kwargs ):
155154 """ Returns traited class as a dict
156155
157156 Augments the trait get function to return a dictionary without
158157 notification handles
159158 """
160- out = super (BaseTraitedSpec , self ).get (** kwargs )
159+ out = super (BaseTraitedSpec , self ).trait_get (** kwargs )
161160 out = self ._clean_container (out , Undefined )
162161 return out
163162
163+ get = trait_get
164+
164165 def get_traitsfree (self , ** kwargs ):
165166 """ Returns traited class as a dict
166167
167168 Augments the trait get function to return a dictionary without
168169 any traits. The dictionary does not contain any attributes that
169170 were Undefined
170171 """
171- out = super (BaseTraitedSpec , self ).get (** kwargs )
172+ out = super (BaseTraitedSpec , self ).trait_get (** kwargs )
172173 out = self ._clean_container (out , skipundefined = True )
173174 return out
174175
@@ -183,8 +184,8 @@ def _clean_container(self, objekt, undefinedval=None, skipundefined=False):
183184 else :
184185 if not skipundefined :
185186 out [key ] = undefinedval
186- elif (isinstance (objekt , TraitListObject ) or isinstance (objekt , list )
187- or isinstance (objekt , tuple )):
187+ elif (isinstance (objekt , TraitListObject ) or isinstance (objekt , list ) or
188+ isinstance (objekt , tuple )):
188189 out = []
189190 for val in objekt :
190191 if isdefined (val ):
@@ -236,13 +237,13 @@ def get_hashval(self, hash_method=None):
236237
237238 list_withhash = []
238239 list_nofilename = []
239- for name , val in sorted (self .get ().items ()):
240+ for name , val in sorted (self .trait_get ().items ()):
240241 if not isdefined (val ) or self .has_metadata (name , "nohash" , True ):
241242 # skip undefined traits and traits with nohash=True
242243 continue
243244
244- hash_files = (not self .has_metadata (name , "hash_files" , False )
245- and not self .has_metadata (name , "name_source" ))
245+ hash_files = (not self .has_metadata (name , "hash_files" , False ) and
246+ not self .has_metadata (name , "name_source" ))
246247 list_nofilename .append ((name ,
247248 self ._get_sorteddict (
248249 val ,
@@ -286,8 +287,8 @@ def _get_sorteddict(self,
286287 else :
287288 out = None
288289 if isdefined (objekt ):
289- if (hash_files and isinstance (objekt , (str , bytes ))
290- and os .path .isfile (objekt )):
290+ if (hash_files and isinstance (objekt , (str , bytes )) and
291+ os .path .isfile (objekt )):
291292 if hash_method is None :
292293 hash_method = config .get ('execution' , 'hash_method' )
293294
@@ -341,7 +342,7 @@ def __deepcopy__(self, memo):
341342 id_self = id (self )
342343 if id_self in memo :
343344 return memo [id_self ]
344- dup_dict = deepcopy (self .get (), memo )
345+ dup_dict = deepcopy (self .trait_get (), memo )
345346 # access all keys
346347 for key in self .copyable_trait_names ():
347348 if key in self .__dict__ .keys ():
0 commit comments