set path to storage
5289
def set_settings(self, releases=None, default_release=None):
        """"""
        if (self._storage is None or
                getattr(self, 'releases', {}) != releases or
                getattr(self, 'default_release', '') != default_release):
            self._storage = {}
            self.releases = releases or {}
            self.default_release = default_release
904246
def put_path(self, url, path):
        
        cache_path = self._url_to_path(url)

        # Ensure that cache directories exist
        try:
            dir = os.path.dirname(cache_path)
            os.makedirs(dir)
        except OSError as e:
            if e.errno != errno.EEXIST:
                raise Error('Failed to create cache directories for ' % cache_path)

        # Remove the resource already exist
        try:
            os.unlink(cache_path)
        except OSError:
            pass

        try:
            # First try hard link to avoid wasting disk space & overhead
            os.link(path, cache_path)
        except OSError:
            try:
                # Use file copy as fallaback
                shutil.copyfile(path, cache_path)
            except IOError:
                raise Error('Failed to cache %s as %s for %s' % (path, cache_path, url))
978507
function setFromPath(obj, path, value){
		var parts = path.split('.');
		
		for(var i = 0, l = parts.length; i < l; i++){
			if(i < (l - 1) && !obj.hasOwnProperty(parts[i]))
				obj[parts[i]] = {};
	
			if(i == l - 1)
				obj[parts[i]] = value;
			
			else
				obj = obj[parts[i]];
		}
		
		return obj;
	}
326233
def set_paths(dir_root='.'):
    global DIR_ROOT,sylcmu
    DIR_ROOT = dir_root
    os.environ['STANFORD_PARSER'] = os.path.join(dir_root,'StanfordLibrary/stanford-parser-full-%s/stanford-parser.jar' % DATE)
    os.environ['STANFORD_MODELS'] = os.path.join(dir_root,'StanfordLibrary/stanford-parser-full-%s/stanford-parser-%s-models.jar' % (DATE, MODELS_VERSION))
    os.environ['STANFORD_EJML']   = os.path.join(dir_root,'StanfordLibrary/stanford-parser-full-%s/ejml-%s.jar' % (DATE, EJML_VERSION))

    
    sylcmu = {}
70751
def set_path(ctx, path_str, value, data):
    
    ctx.gbc.say('set_path:value:' + str(value) + ' at:' + path_str + ' in:',
                stuff=data, verbosity=1001)

    path = path_str.split('.')
    ctx.gbc.say('path:', stuff=path, verbosity=100)
    if len(path) > 1:
        destk = '.'.join(path[0:-1])
        lp = path[-1]
        ctx.gbc.say('destk:%s' % destk, verbosity=100)
        ctx.gbc.say('last:%s' % lp, verbosity=100)
        ctx.gbc.say('current keys:', stuff=data.keys(), verbosity=1001)
        if len(path) > 2:
            destk = unescape(ctx, destk)
        if destk not in data.keys():
            ctx.gbc.say('destk not in current keys:',
                        stuff=data.keys(), verbosity=1001)
            data[destk] = {}
            ctx.gbc.say('destk not added:', stuff=data, verbosity=1001)

        lp = unescape(ctx, lp)
        data[destk][lp] = value
        ctx.gbc.say('destk and val added:', stuff=data, verbosity=1001)
    else:
        path_str = unescape(ctx, path_str)
        data[path_str] = value
    ctx.gbc.say('set_path:res:', stuff=data, verbosity=1001)
    return data
375412
def set_destination(source, suffix, filename=False, ext=None):
    """"""
    source_dirname = os.path.dirname(source)

    # Do not create nested temp folders (/temp/temp)
    if not source_dirname.endswith('temp'):
        directory = os.path.join(source_dirname, 'temp')  # directory
    else:
        directory = source_dirname

    # Create temp dir if it does not exist
    if not os.path.isdir(directory):
        os.mkdir(directory)

    # Parse source filename
    if filename:
        src_file_name = filename
    else:
        src_file_name = Path(source).stem  # file name
    if ext:
        src_file_ext = ext
    else:
        src_file_ext = Path(source).suffix  # file extension

    # Concatenate new filename
    dst_path = src_file_name + '_' + suffix + src_file_ext
    full_path = os.path.join(directory, dst_path)  # new full path

    if not os.path.exists(full_path):
        return full_path
    else:
        # If file exists, increment number until filename is unique
        number = 1
        while True:
            dst_path = src_file_name + '_' + suffix + '_' + str(number) + src_file_ext
            if not os.path.exists(dst_path):
                break
            number = number + 1
        full_path = os.path.join(directory, dst_path)  # new full path
        return full_path
510946
def _store_path(self, filepath, fprogress):
        """"""
        st = os.lstat(filepath)     # handles non-symlinks as well
        if S_ISLNK(st.st_mode):
            # in PY3, readlink is string, but we need bytes. In PY2, it's just OS encoded bytes, we assume UTF-8
            open_stream = lambda: BytesIO(force_bytes(os.readlink(filepath), encoding=defenc))
        else:
            open_stream = lambda: open(filepath, 'rb')
        with open_stream() as stream:
            fprogress(filepath, False, filepath)
            istream = self.repo.odb.store(IStream(Blob.type, st.st_size, stream))
            fprogress(filepath, True, filepath)
        return BaseIndexEntry((stat_mode_to_index_mode(st.st_mode),
                               istream.binsha, 0, to_native_path_linux(filepath)))
732720
def set_uri(self, uri, size, checksum, readable=True, writable=False,
                storage_class=None):
        """"""
        self.uri = uri
        self.size = size
        self.checksum = checksum
        self.writable = writable
        self.readable = readable
        self.storage_class = \
            current_app.config['FILES_REST_DEFAULT_STORAGE_CLASS'] \
            if storage_class is None else \
            storage_class
        return self
1146583
def set_file(path, saltenv='base', **kwargs):
    '''
    
    '''
    if '__env__' in kwargs:
        # "env" is not supported; Use "saltenv".
        kwargs.pop('__env__')

    path = __salt__['cp.cache_file'](path, saltenv)
    if path:
        _set_file(path)
        return True

    return False
467674
async def storage(dev: Device):
    """"""
    storages = await dev.get_storage_list()
    for storage in storages:
        click.echo(storage)
777592
def _save_or_update(self):
        
        with self._resource_lock:
            if not self._config or not self._config._storage_path:
                raise Exception("self._config._storage path is undefined")
            if not self._config._base_name:
                raise Exception("self._config._base_name is undefined")
            if not os.path.exists(self._config._storage_path):
                os.makedirs(self._config._storage_path)
            path = self._get_cloud_provider_storage_path()
            with open(path, 'wb') as storage:
                pickle.dump(self._config, storage, pickle.HIGHEST_PROTOCOL)
                pickle.dump(self._subscriptions, storage,
                            pickle.HIGHEST_PROTOCOL)
650499
function _setDirectoryOpen(treeData, path, open) {
        var objectPath = _filePathToObjectPath(treeData, path),
            directory = treeData.getIn(objectPath);

        if (!objectPath) {
            return {
                needsLoading: true,
                treeData: treeData
            };
        }

        if (isFile(directory)) {
            return;
        }

        var alreadyOpen = directory.get("open") === true;

        if ((alreadyOpen && open) || (!alreadyOpen && !open)) {
            return;
        }

        treeData = treeData.updateIn(objectPath, function (directory) {
            if (open) {
                return directory.set("open", true);
            } else {
                return directory.delete("open");
            }
        });

        if (open && (directory.get("children") === null || directory.get("notFullyLoaded"))) {
            return {
                needsLoading: true,
                treeData: treeData
            };
        }
        return {
            needsLoading: false,
            treeData: treeData
        };
    }
202232
def put(path, options = {})
      ext = options[:ext] || File.extname(path)
      path = path.to_s
      resp = http_post("/v1/#{appkey}",
                       File.open(path.start_with?('/') ? path : fpath(path)).read,
                       :params => {
                         :suffix => ext,
                         :simple_name => options[:simple_name] || 0
                       },
                       :accept => :json)

      json = JSON.parse(resp)
      json && json['TFS_FILE_NAME']
    end
1345762
function saveDirs(path, obj, cb) {
  var currDir = ''
  var root    = ''

  walk.walk(path, walkFn, function(err) {
    if (err) return cb(err)
    cb(null, obj)
  })

  function walkFn(baseDir, filename, stat, next) {
    if (!root) root = baseDir
    baseDir = stripLeadingSlash(baseDir.split(root)[1])

    if (!baseDir) return next()
    if (obj[baseDir]) return next()

    if (baseDir != currDir) currDir = baseDir

    if (stat.isDirectory()) {
      setObject(baseDir, obj, {})
      return next()
    }

    setObject(baseDir, obj, [])
    next()
  }
}
73316
def do_put(self, from_path, to_path):
        
        from_file = open(os.path.expanduser(from_path), "rb")

        self.n.put(self.current_path + "/" + from_path, to_path)
825072
def prepare_storage_dir(storage_directory):
    """"""
    storage_directory = os.path.expanduser(storage_directory)
    if not os.path.exists(storage_directory):
        os.mkdir(storage_directory)

    return storage_directory
384232
def init_storage():
    
    # http://stackoverflow.com/a/600612/735926
    try:
        os.makedirs(DICTS_PATH)
    except OSError as ex:
        if ex.errno != errno.EEXIST or not os.path.isdir(DICTS_PATH):
            raise