original_docstring: 
          Find the specified file in the specified environment
          
docstring: Find the specified file in the specified environment
docstring_tokens: Find the specified file in the specified environment
code: def find_file(self, path, tgt_env):
          '''
          Find the specified file in the specified environment
          '''
          tree = self.get_tree(tgt_env)
          if not tree:
              # Branch/tag/SHA not found
              return None, None, None
          blob = None
          mode = None
          depth = 0
          while True:
              depth += 1
              if depth > SYMLINK_RECURSE_DEPTH:
                  blob = None
                  break
              prefix_dirs, _, filename = path.rpartition(os.path.sep)
              tree = self.walk_tree(tree, prefix_dirs)
              if not isinstance(tree, dulwich.objects.Tree):
                  # Branch/tag/SHA not found in repo
                  break
              try:
                  mode, oid = tree[filename]
                  if stat.S_ISLNK(mode):
                      # Path is a symlink. The blob data corresponding to
                      # this path's object ID will be the target of the
                      # symlink. Follow the symlink and set path to the
                      # location indicated in the blob data.
                      link_tgt = self.repo.get_object(oid).as_raw_string()
                      path = salt.utils.path_join(os.path.dirname(path), link_tgt)
                  else:
                      blob = self.repo.get_object(oid)
                      if isinstance(blob, dulwich.objects.Tree):
                          # Path is a directory, not a file.
                          blob = None
                      break
              except KeyError:
                  blob = None
                  break
          if isinstance(blob, dulwich.objects.Blob):
              return blob, blob.sha().hexdigest(), mode
          return None, None, None
code_tokens: def find_file ( self , path , tgt_env ) : tree = self . get_tree ( tgt_env ) if not tree : return None , None , None blob = None mode = None depth = 0 while True : depth += 1 if depth > SYMLINK_RECURSE_DEPTH : blob = None break prefix_dirs , _ , filename = path . rpartition ( os . path . sep ) tree = self . walk_tree ( tree , prefix_dirs ) if not isinstance ( tree , dulwich . objects . Tree ) : break try : mode , oid = tree [ filename ] if stat . S_ISLNK ( mode ) : link_tgt = self . repo . get_object ( oid ) . as_raw_string ( ) path = salt . utils . path_join ( os . path . dirname ( path ) , link_tgt ) else : blob = self . repo . get_object ( oid ) if isinstance ( blob , dulwich . objects . Tree ) : blob = None break except KeyError : blob = None break if isinstance ( blob , dulwich . objects . Blob ) : return blob , blob . sha ( ) . hexdigest ( ) , mode return None , None , None
short_docstring: Find the specified file in the specified environment
short_docstring_tokens: Find the specified file in the specified environment
comment: '''
          Find the specified file in the specified environment
          '''$SEP$# Branch/tag/SHA not found$SEP$# Branch/tag/SHA not found in repo$SEP$# Path is a symlink. The blob data corresponding to$SEP$# this path's object ID will be the target of the$SEP$# symlink. Follow the symlink and set path to the$SEP$# location indicated in the blob data.$SEP$# Path is a directory, not a file.