MCPcopy Create free account
hub / github.com/ImageEngine/cortex / __updateClassFromSearchPath

Method __updateClassFromSearchPath

python/IECore/ClassLoader.py:232–257  ·  view source on GitHub ↗
( self, searchPath, name )

Source from the content-addressed store, hash-verified

230 return cls.defaultLoader( "IECORE_OP_PATHS" )
231
232 def __updateClassFromSearchPath( self, searchPath, name ) :
233
234 pattern = re.compile( r".*-(\d+).py$" )
235 pruneDir = False
236 nameTail = os.path.split( name )[-1]
237
238 # globbing for any extension rather than .py to avoid exploring shader
239 # directories without Python files. Function returns true on those cases.
240 gf = glob.glob( os.path.join( searchPath, name, nameTail + "*.*" ) )
241 for f in gf :
242
243 pruneDir = True
244
245 m = re.match( pattern, f )
246 try :
247 version = int( m.group( 1 ) )
248 except :
249 continue
250
251 c = self.__classes.setdefault( name, { "versions" : [], "imports" : {} } )
252
253 if not version in c["versions"]:
254 c["versions"].append( version )
255 c["versions"].sort()
256
257 return pruneDir
258
259 def __findClass( self, name ) :
260

Callers 2

__findClassMethod · 0.95
__findAllClassesMethod · 0.95

Calls 6

compileMethod · 0.80
joinMethod · 0.80
matchMethod · 0.80
setdefaultMethod · 0.80
appendMethod · 0.80
sortMethod · 0.80

Tested by

no test coverage detected