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

Method reRooted

python/IECore/MenuDefinition.py:161–173  ·  view source on GitHub ↗
( self, root )

Source from the content-addressed store, hash-verified

159 # new definition are all adjusted to be relative to the requested
160 # root.
161 def reRooted( self, root ) :
162
163 if not root:
164 return MenuDefinition( [] )
165
166 rootConformed = "/{}/".format( root.strip('/') )
167
168 newItems = []
169 for path, itemDict in self.items() :
170 if path.startswith( rootConformed ) :
171 newItems.append( ( path[ len( rootConformed )-1 : ], itemDict ) )
172
173 return MenuDefinition( newItems )
174
175 ## Returns the item at `path`. Supports multiple path components.
176 # If no item is found, return `None`

Callers 1

testMethod · 0.95

Calls 4

itemsMethod · 0.95
MenuDefinitionClass · 0.85
appendMethod · 0.80
lenFunction · 0.50

Tested by

no test coverage detected