parameters: (self, path, source)
docstring: Move source file in cache directory.
docstring_summary: Move source file in cache directory.
docstring_tokens: Move source file in cache directory .
function: def copy_to_cache(self, path, source):
          """Move source file in cache directory.
          """
          if not op.isfile(path):
              print 'File %s does not exist' % path
              return False, None
  
          full_cache_dir = op.join(self.cache_dir, source)
  
          try:
              if not op.isdir(full_cache_dir):
                  os.makedirs(full_cache_dir)
          except OSError:
              full_cache_dir = '.'
  
          try:
              copy(path, full_cache_dir)
          except (SameFileError, IOError):
              # Copy did not happen because files are the same, or access problem
              return False, path
          else:
              return True, op.join(full_cache_dir, op.basename(path))
function_tokens: def copy_to_cache ( self , path , source ) : if not op . isfile ( path ) : print 'File %s does not exist' % path return False , None full_cache_dir = op . join ( self . cache_dir , source ) try : if not op . isdir ( full_cache_dir ) : os . makedirs ( full_cache_dir ) except OSError : full_cache_dir = '.' try : copy ( path , full_cache_dir ) except ( SameFileError , IOError ) : # Copy did not happen because files are the same, or access problem return False , path else : return True , op . join ( full_cache_dir , op . basename ( path ) )