TODO: Until pulp supports optional upload of layers, include all layers
 https://pulp.plan.io/issues/3497
542900
def force_include_layer(repository, digest, layer)
      unless File.exist? tmp_file(layer)
        logger.debug "Getting blob #{digest} to write to #{layer}"
        fullpath = "/v2/#{repository}/blobs/#{digest}"
        request = Resources::Registry::Proxy.get(fullpath)
        File.open(tmp_file(layer), 'wb', 0600) do |file|
          file.write request.body
        end
        logger.debug "Wrote blob #{digest} to #{layer}"
      end
    end
519064
function buildLayers() {
            layers = transformedData.map((item) => {
                let ret = {};

                groups.forEach((key) => {
                    ret[key] = item[key];
                });

                return assign({}, item, ret);
            });
        }
289552
function hotDownloadUpdateChunk(chunkId) {
		var filename = require("path").join(__dirname, $hotChunkFilename$);
		require("fs").readFile(filename, "utf-8", function(err, content) {
			if (err) {
				if ($require$.onError) return $require$.oe(err);
				throw err;
			}
			var chunk = {};
			require("vm").runInThisContext(
				"(function(exports) {" + content + "\n})",
				{ filename: filename }
			)(chunk);
			hotAddUpdateChunk(chunk.id, chunk.modules);
		});
	}
270765
function multipartEncoded(gw, callback){
  var upload = new formidable.IncomingForm();
  var files = {};
  var fields = {};    

  gw.eventium.on('end',cleanTemp);

  upload.uploadDir = tempDirectory;
  upload.keepExtensions = true;
  upload.onPart = function(part) {
    if (part.filename!="") {
      upload.handlePart(part);
    }
  }
  upload
    .on('progress', function(bytesReceived, bytesExpected) {
      var percent_complete = (bytesReceived / bytesExpected) * 100;
    })
    .on('error', function (error) {gw.error(500,error);})
    .on('field', function (field, value) {
      if (fields[field]) {
        if (!Array.isArray(fields[field])) {fields[field]=[fields[field]];}
        fields[field].push(value);
      } else {
        fields[field]=value;
      }
    })
    .on('file', function(field, file) {
      file.ext =  file.name.replace(/^.*\./,'');
      if (fields[field]) {
        if(!Array.isArray(fields[field])){fields[field]=[fields[field]];}
        fields[field].push(file);
      } else {
        fields[field]=file;
      }
      if (files[field]) {
        if (!Array.isArray(files[field])) {files[field]=[files[field]];}
        files[field].push(file);
      } else {
        files[field]=file;
      }
    })
    .on('end', function() {
      fields = gw.constructor.queryHeap(fields);
      gw.content.params = fields;
      for(var i=0,k=Object.keys(fields),l=k.length;i<l;i++){
        gw.params[k[i]]=fields[k[i]];
      }
      gw.files = files;
      callback();
    })
  ;
  upload.parse(gw.req);
}
591760
def upload_tree(self, src, dst, ignore=None):
        
        names = os.listdir(src)
        if ignore is not None:
            ignored_names = ignore(src, names)
        else:
            ignored_names = set()

        try:
            self.conn.mkd(dst)
        except error_perm:
            pass

        errors = []
        for name in names:
            if name in ignored_names:
                continue
            src_name = os.path.join(src, name)
            dst_name = os.path.join(dst, name)
            try:
                if os.path.islink(src_name):
                    pass
                elif os.path.isdir(src_name):
                    self.upload_tree(src_name, dst_name, ignore)
                else:
                    # Will raise a SpecialFileError for unsupported file types
                    self.put(src_name, dst_name)
            except Exception as why:
                errors.append((src_name, dst_name, str(why)))

        return dst
327976
function (layers) {
		var layersArray = this._toArray(layers),
		    separated = this._checkInGetSeparated(layersArray),
		    groups = separated.groups,
		    i, group, id;

		// Batch add all single layers.
		this._originalAddLayers(separated.singles);

		// Add Layer Groups to the map so that they are registered there and
		// the map fires 'layeradd' events for them as well.
		for (i = 0; i < groups.length; i++) {
			group = groups[i];
			id = L.stamp(group);
			this._proxyLayerGroups[id] = group;
			delete this._proxyLayerGroupsNeedRemoving[id];
			if (this._map) {
				this._map._originalAddLayer(group);
			}
		}
	}
335054
protected final void addAllFilesToSuccessfullyUploadedFiles() {
        for (Iterator<UploadFile> iterator = params.files.iterator(); iterator.hasNext(); ) {
            UploadFile file = iterator.next();

            if (!successfullyUploadedFiles.contains(file.path)) {
                successfullyUploadedFiles.add(file.path);
            }
            iterator.remove();
        }
    }
752970
function transferSingleFile(sfXML, dir, callback){
  var xmlParser; 
  var groups;
  var responders = [];
  var fileList = [];
  var entry;
  var responder;
  var stat;

  if(typeof sfXML === 'undefined'){
    throw new Error('No input file specified');
  }

  if(!/\.xml$/.test(sfXML)){
    throw new Error('Input file must be a xml file!');
  }

  sfXML = sfXML.indexOf(path.sep) === 0 ? sfXML : path.join(process.pwd, sfXML);

  xmlParser = new xml2js.Parser();

  fs.readFile(sfXML, function(err, xml){
    if(err){ throw err; }

    xmlParser.parseString(xml, function(err, result){
      var groupParser = function(group){
        var groupId;
        var resources;

        if(typeof group['$'] === 'undefined'){
          return;
        }

        groupId = group['$']['id'];

        if(typeof groupId !== 'undefined'){
          resources = group['resource'];
          entry = {
            comment: '// pattern for ' + groupId,
            pattern: groupId,
            responder: {
              dir: dir || 'fill the dir',
              src: []
            }
          };

          responder = entry.responder;

          if(typeof resources === 'object' && 
              typeof resources['$'] === 'object' && 
              typeof resources['$']['uri'] === 'string'){

            responder.src.push(resources['$']['uri']);

          }

          if(Array.isArray(resources)){
            resources.forEach(function(resource){
              if(typeof resource['$'] === 'object' && 
                  typeof resource['$']['uri'] === 'string'){
                responder.src.push(resource['$']['uri']);
              }
            });
          }
          responders.push(entry);

        }
      }
      groups = result.groupdefinition.groups[0].group;
      if(Array.isArray(groups)){
        groups.forEach(groupParser);
      }else if(typeof groups === 'object'){
        groupParser(groups);
      }
    });

    _getRuleAsString(responders, callback);
    
  });

}
827031
function uploadToUpyun(path, file, __newFile, done) {
  var options = this.options;
  var upyun = getInstance(options);
  upyun.uploadFile(path, file, __newFile.headers['content-type'], true, function (err, data) {
    if (err) {
      return done(err);
    }
    if (!data) {
      return done(new Error('Upload failed!'));
    }
    if (data && data.statusCode != 200) {
      return done(new Error(data.error['message']));
    }
    __newFile.fd = options.domain + path;
    return done();
  });
}
74325
async def expand(self, request: Request, layer: BaseLayer):
        

        if isinstance(layer, lyr.RawText):
            t = self.reading_time(layer.text)
            yield layer
            yield lyr.Sleep(t)

        elif isinstance(layer, lyr.MultiText):
            texts = await render(layer.text, request, True)

            for text in texts:
                t = self.reading_time(text)
                yield lyr.RawText(text)
                yield lyr.Sleep(t)

        elif isinstance(layer, lyr.Text):
            text = await render(layer.text, request)
            t = self.reading_time(text)
            yield lyr.RawText(text)
            yield lyr.Sleep(t)

        else:
            yield layer
783336
def upload_tree(self):
        
        from datetime import datetime
        start_time = datetime.now()
        root, channel_id = self.add_channel()
        self.node_count_dict = {"upload_count": 0, "total_count": self.channel.count()}

        config.LOGGER.info("\tPreparing fields...")
        self.truncate_fields(self.channel)

        self.add_nodes(root, self.channel)
        if self.check_failed(print_warning=False):
            failed = self.failed_node_builds
            self.failed_node_builds = {}
            self.reattempt_failed(failed)
            self.check_failed()
        channel_id, channel_link = self.commit_channel(channel_id)
        end_time = datetime.now()
        config.LOGGER.info("Upload time: {time}s".format(time=(end_time - start_time).total_seconds()))
        return channel_id, channel_link
459772
function hotDownloadUpdateChunk(chunkId) {
/******/ 		var head = document.getElementsByTagName("head")[0];
/******/ 		var script = document.createElement("script");
/******/ 		script.charset = "utf-8";
/******/ 		script.src = __webpack_require__.p + "static/webpack/" + chunkId + "." + hotCurrentHash + ".hot-update.js";
/******/ 		;
/******/ 		head.appendChild(script);
/******/ 	}
420239
function layerRequirements() {
  if (!this.options.layer) {
    return BbPromise.resolve();
  }

  this.serverless.cli.log('Packaging Python Requirements Lambda Layer...');

  return BbPromise.bind(this)
    .then(zipRequirements)
    .then(createLayers);
}
1219622
async def setLayers(self, layers):
        '''
        
        '''
        layrs = []

        for iden in layers:
            layr = self.core.layers.get(iden)
            if layr is None:
                raise s_exc.NoSuchLayer(iden=iden)
            if not layrs and layr.readonly:
                raise s_exc.ReadOnlyLayer(mesg=f'First layer {layr.iden} must not be read-only')

            layrs.append(layr)

        self.borked = None
        self.layers = layrs

        await self.info.set('layers', layers)
1300214
function joinNodeModules(jsPaths){
    _.each(jsPaths, function(jsPath){
      var libPath = path.join(nodeModules, jsPath),
          flattenedLibPath = path.join(flattenedNodeModules, jsPath);

      if (fs.existsSync(libPath)) {
        defaultScripts.push(libPath);
      } else if (fs.existsSync(flattenedLibPath)) {
        defaultScripts.push(flattenedLibPath);
      } else {
        console.error('Could not find ' + jsPath);
      }
    });
  }
887784
function appendLayer( &$imageLayer, $parameters = array() )
    {
        if ( !$imageLayer instanceof eZImageLayer )
        {
            eZDebug::writeWarning( 'Only eZImageLayer objects may be added as layer items', __METHOD__ );
            return false;
        }
        ++$this->ImageLayerCounter;
        $layerID = $this->ImageLayerCounter;
        $this->ImageLayers[] = $layerID;
        $this->ImageLayerIndex[$layerID] = array( 'image' => &$imageLayer,
                                                  'parameters' => $parameters );
        return $layerID;
    }
227462
def upload(object, options = {})
      if file?(object)           then upload_file(object, options)
      elsif object.is_a?(Array)  then upload_files(object, options)
      elsif object.is_a?(String) then upload_url(object, options)
      else
        raise ArgumentError, "Expected input to be a file/Array/URL, given: `#{object}`"
      end
    end