def dependencies(snippet, path=''):
 if isinstance(snippet, Function):
  return snippet.dependencies(path)
 elif isinstance(snippet, collections.Mapping):
  def mkpath(key):
   return '.'.join([path, six.text_type(key)])
  deps = (dependencies(value, mkpath(key)) for (key, value) in snippet.items())
  return itertools.chain.from_iterable(deps)
 elif ((not isinstance(snippet, six.string_types)) and isinstance(snippet, collections.Iterable)):
  def mkpath(idx):
   return ''.join([path, ('[%d]' % idx)])
  deps = (dependencies(value, mkpath(i)) for (i, value) in enumerate(snippet))
  return itertools.chain.from_iterable(deps)
 else:
  return []

def dependencies ( snippet , path = '' ) : if isinstance ( snippet , Function ) : return snippet . dependencies ( path ) elif isinstance ( snippet , collections . Mapping ) : def mkpath ( key ) : return '.' . join ( [ path , six . text_type ( key ) ] ) deps = ( dependencies ( value , mkpath ( key ) ) for ( key , value ) in snippet . items ( ) ) return itertools . chain . from_iterable ( deps ) elif ( ( not isinstance ( snippet , six . string_types ) ) and isinstance ( snippet , collections . Iterable ) ) : def mkpath ( idx ) : return '' . join ( [ path , ( '[%d]' % idx ) ] ) deps = ( dependencies ( value , mkpath ( i ) ) for ( i , value ) in enumerate ( snippet ) ) return itertools . chain . from_iterable ( deps ) else : return [ ]
return an iterator over resource dependencies in a template snippet .