Create and return an anonymous gist with a single file and specified
    contents
490181
def _make_gist(contents, description='', filename='data.geojson'):
    
    ghapi = github3.GitHub()
    files = {filename: {'content': contents}}
    gist = ghapi.create_gist(description, files)

    return gist
821262
function bundle(srcFiles, destDir, optionsFn) {
    return gulp.src(srcFiles, {
        read: false
    })
    .pipe(tap(function(file) {
        var options = {};
        if (optionsFn) options = optionsFn(file);
        var fileName = options.fileName || path.basename(file.path);

        if (options.standalone)
            console.log(`Creating ${options.standalone} in ${destDir}/${fileName}`);
        else
            console.log(`Creating ${destDir}/${fileName}`);

        file.contents = browserify(file.path, options)
            .ignore("buffer")
            .ignore("dotenv")
        .bundle()
            .on("error", function (err) {
                console.log(err);
            });
        file.path = path.join(file.base, fileName);
    }))
    .pipe(buffer())
    .pipe(sourcemaps.init({
        loadMaps: true
    }))
    .pipe(uglify({
        preserveComments: function(node, comment) {
            return comment.value.includes("Copyright Arm");
        }
    }))
    .pipe(sourcemaps.write(".", {
        sourceRoot: path.relative(destDir, nodeDir)
    }))
    .pipe(gulp.dest(destDir));
}
280318
function(args) {
    var mode = (args && args['mode']) || 'update';
    return map(function(code, filename) {
        var lines = code.toString().split("\n");
        var gists = {};
        var currentGist = null;
        var lineNo = 0;
        lines.forEach(function(line) {
            if (line.indexOf("// startgist:") > -1 || line.indexOf("# startgist:") > -1) {
                if (currentGist) {
                    throw new PluginError(PLUGIN_NAME, filename + ":" + lineNo + ": Unexpected startgist: a previous gist was not closed");
                }
                currentGist = {
                    "id": line.split(":")[1].trim(),
                    "filename": line.split(":")[2].trim(),
                    "lines": []
                };
            } else if (line.indexOf("// endgist") > -1 || line.indexOf("# endgist") > -1) {
                if (!currentGist) {
                    throw new PluginError(PLUGIN_NAME, filename + ":" + lineNo + " Unexpected endgist: missing startgist earlier");
                }
                if (!gists[currentGist.id]) {
                    gists[currentGist.id] = {};
                }
                gists[currentGist.id][currentGist.filename] = {
                    'content': leftAlign(currentGist.lines).join("\n")
                };
                currentGist = null;
            } else if (currentGist && line.indexOf("gisthide") == -1) {
                currentGist.lines.push(line);
            }
            lineNo += 1;
        });
        if (currentGist) {
            throw new PluginError(PLUGIN_NAME, "Reached end of file but gist is still open");
        }
        if (mode == 'create') {
            return fs.read(getUserHome() + '/.gistauth', 'b').then(function (auth) {
                return Q.all(Object.keys(gists).map(function(id) {
                    return create(auth, gists[id]);
                }));
            }).done();
        } else if (mode == 'update') {
            return fs.read(getUserHome() + '/.gistauth', 'b').then(function (auth) {
                return Q.all(Object.keys(gists).map(function(id) {
                    return patch(auth, id, gists[id]);
                }));
            }).done();
        } else {
            gutil.log('Gist mock: ', gists);
        }
    });
}
348682
function(callback) {
			fs.appendFileSync(outputFile,";(function(root,factory){\r\n")
			fs.appendFileSync(outputFile,"    if (typeof define === 'function' && define.amd) {\r\n")
			fs.appendFileSync(outputFile,"        define([], factory);\r\n")
			fs.appendFileSync(outputFile,"    } else if (typeof exports === 'object') {\r\n")
			fs.appendFileSync(outputFile,"        module.exports = factory();\r\n")
			fs.appendFileSync(outputFile,"    } else {\r\n")
			fs.appendFileSync(outputFile,"        if (typeof root === 'undefined' || root !== Object(root)) {\r\n")
			fs.appendFileSync(outputFile,"            throw new Error('puglatizer: window does not exist or is not an object');\r\n")
			fs.appendFileSync(outputFile,"        }\r\n")
			fs.appendFileSync(outputFile,"        root.puglatizer = factory();\r\n")
			fs.appendFileSync(outputFile,"    }\r\n")
			fs.appendFileSync(outputFile,"}(this, function () {\r\n")
			fs.appendFileSync(outputFile,"    function pug_classes_object(val) { var classString = '', padding = ''; for (var key in val) { if (key && val[key] && pug_has_own_property.call(val, key)) { var classString = classString + padding + key; var padding = ' '; } } return classString; }")
			fs.appendFileSync(outputFile,"    function pug_classes_array(val, escaping) { var classString = '', className, padding = '', escapeEnabled = Array.isArray(escaping); for (var i = 0; i < val.length; i++) { var className = pug_classes(val[i]); if (!className) continue; escapeEnabled && escaping[i] && (className = pug_escape(className)); var classString = classString + padding + className; var padding = ' '; } return classString; }")
			fs.appendFileSync(outputFile,"    " + minify.js(pug.runtime.merge.toString()) + '\r\n')
			fs.appendFileSync(outputFile,"    " + minify.js(pug.runtime.classes.toString()) + '\r\n')
			fs.appendFileSync(outputFile,"    " + minify.js(pug.runtime.style.toString()) + '\r\n')
			fs.appendFileSync(outputFile,"    " + minify.js(pug.runtime.attr.toString()) + '\r\n')
			fs.appendFileSync(outputFile,"    " + minify.js(pug.runtime.attrs.toString()) + '\r\n')
			fs.appendFileSync(outputFile,"    " + minify.js(pug.runtime.escape.toString()).replace('pug_match_html','(/[\"&<>]/)') + '\r\n')
			fs.appendFileSync(outputFile,"    " + minify.js(pug.runtime.rethrow.toString()) + '\r\n')
			fs.appendFileSync(outputFile,"    var pug = {\r\n")
			fs.appendFileSync(outputFile,"    	merge:" + minify.js(pug.runtime.merge.toString()) + ',\r\n')
			fs.appendFileSync(outputFile,"    	classes:" + minify.js(pug.runtime.classes.toString()) + ',\r\n')
			fs.appendFileSync(outputFile,"    	style:" + minify.js(pug.runtime.style.toString()) + ',\r\n')
			fs.appendFileSync(outputFile,"    	attr:" + minify.js(pug.runtime.attr.toString()) + ',\r\n')
			fs.appendFileSync(outputFile,"    	attrs:" + minify.js(pug.runtime.attrs.toString()) + ',\r\n')
			fs.appendFileSync(outputFile,"    	escape:" + minify.js(pug.runtime.escape.toString()).replace('pug_match_html','(/[\"&<>]/)') + ',\r\n')
			fs.appendFileSync(outputFile,"    	rethrow:" + minify.js(pug.runtime.rethrow.toString()) + '\r\n')
			fs.appendFileSync(outputFile,"    }\r\n")
			fs.appendFileSync(outputFile,"\r\n")
			fs.appendFileSync(outputFile,'    var puglatizer = {}')
			fs.appendFileSync(outputFile,"\r\n")
			return callback()
		}
96616
function resolveInputFile(args) {
    const { file } = args;
    return file ? resolve(path.resolve(file)) : build(args);
}
504882
function dumpAndWrap(fName /*, localDir:string*/, sourceToDump) {
    let p = new Promise(function (resolve) {
        fs.stat(fName, (err, stat) => {
            if (!err) {
                if (stat.isFile()) {
                    logger.debug(`Found a file to wrap at ${fName}`);
                    let stream = fs.createReadStream(fName, {
                        'encoding': 'utf8'
                    });
                    resolve(stream);
                    return;
                }
                logger.error(`Should not be here:\n ${util.format(stat)}`);
            }
            else {
                logger.warn(`cant find file ${fName}`);
                if (sourceToDump) {
                    logger.debug(`Found alternative source dumping it from \n ${util.format(sourceToDump)}`);
                    let target = fs.createWriteStream(fName, { 'flags': 'a' });
                    sourceToDump.pipe(target);
                    target.on('close', () => {
                        let stream = fs.createReadStream(fName, {
                            'encoding': 'utf8'
                        });
                        logger.debug(`should resolve with ${util.format(stream)}`);
                        resolve(stream);
                        return;
                    });
                }
                else {
                    logger.error("Output file error, Still cant open output file, returning empy stream");
                    let dummyStream = new streamLib.Readable();
                    dummyStream.push(null);
                    resolve(dummyStream);
                    return;
                }
            }
        });
    });
    return p;
}
387346
def run_putgist(filename, user, **kwargs):
    """"""
    assume_yes = kwargs.get("yes_to_all")
    private = kwargs.get("private")
    getgist = GetGist(
        user=user,
        filename=filename,
        assume_yes=assume_yes,
        create_private=private,
        allow_none=True,
    )
    getgist.put()
43714
def generate_contents(startpath, outfilename=DEFAULT_BUILDFILE):
    
    def _ignored_name(name):
        return (
            name.startswith('.') or
            name == PACKAGE_DIR_NAME or
            name.endswith('~') or
            name == outfilename
        )

    def _generate_contents(dir_path):
        safename_duplicates = defaultdict(list)
        for name in os.listdir(dir_path):
            if _ignored_name(name):
                continue

            path = os.path.join(dir_path, name)

            if os.path.isdir(path):
                nodename = name
                ext = None
            elif os.path.isfile(path):
                nodename, ext = splitext_no_dot(name)
            else:
                continue

            safename = to_identifier(nodename)
            safename_duplicates[safename].append((name, nodename, ext))

        safename_to_name = {}
        for safename, duplicates in iteritems(safename_duplicates):
            for name, nodename, ext in duplicates:
                if len(duplicates) > 1 and ext:
                    new_safename = to_identifier(name)  # Name with ext
                else:
                    new_safename = safename
                existing_name = safename_to_name.get(new_safename)
                if existing_name is not None:
                    message = "Duplicate node names in directory %r."
                    message += " %r was renamed to %r, which overlaps with %r"
                    raise BuildException(
                        message % (dir_path, name, new_safename, existing_name)
                    )
                safename_to_name[new_safename] = name

        contents = {}
        for safename, name in iteritems(safename_to_name):
            path = os.path.join(dir_path, name)

            if os.path.isdir(path):
                data = _generate_contents(path)
            else:
                rel_path = os.path.relpath(path, startpath)
                data = dict(file=rel_path)

            contents[safename] = data

        return contents

    return dict(
        contents=_generate_contents(startpath)
    )
365478
function (files) {
  if (files.length === 1) {
    return { file: files[0] };
  } else {
    var contents = files.map(function (fname) {
      return '@import ' + JSON.stringify(fname) + ';';
    }).join('\n');

    return { contents: contents };
  }
}
511226
function tryServeWithGzip() {
      fs.stat(gzippedFile, (err, stat) => {
        if (!err && stat.isFile()) {
          hasGzipId12(gzippedFile, (gzipErr, isGzip) => {
            if (!gzipErr && isGzip) {
              file = gzippedFile;
              serve(stat);
            } else {
              statFile();
            }
          });
        } else {
          statFile();
        }
      });
    }
328587
def c_ls(api, args, verbose=False):
    
    obj = api.get_object(args['<URL>'].split('/')[-1])
    res = []
    for bitstream in obj.bitstreams:
        res.append((
            api.url(bitstream),
            bitstream._properties['content-type'],
            bitstream._properties['filesize'],
            datetime.fromtimestamp(bitstream._properties['last-modified'] / 1000.0)
        ))
    if args['-t']:
        res = sorted(res, key=lambda t: t[3], reverse=True)
    elif args['-s']:
        res = sorted(res, key=lambda t: t[2], reverse=True)
    if args['-r']:
        res = reversed(res)

    for r in res:
        yield '{0}\t{1}\t{2:>8}\t{3}'.format(*r) if verbose else r[0]
8621
def lint(relative_path_to_file,
         contents,
         linter_functions,
         **kwargs):
    
    """
    lines = contents.splitlines(True)

    errors = list()
    for (code, info) in linter_functions.items():
        error = info.function(relative_path_to_file, lines, kwargs)
        if error:
            if isinstance(error, list):
                errors.extend([(code, e) for e in error])
            else:
                errors.append((code, error))

    errors = [e for e in errors if not _error_is_suppressed(e[1], e[0], lines)]
    return sorted(errors, key=lambda e: e[1].line)
957630
function createDir(srcPath, desPath) {
    var pathInfo = path.parse(desPath);
    var searchvalue = pathInfo.root[pathInfo.root.length - 1]
    var start = 0;
    var found = pathInfo.dir.indexOf(searchvalue);
    var subPath = '';
    var dirs = [];

    if (found != -1) {
        while (true) {
            subPath = pathInfo.dir.substr(start, found - start + 1);
            if (subPath != '') {
                dirs.push(subPath);
            }
            start = found + 1;
            found = pathInfo.dir.indexOf(searchvalue, start);
            if (found == -1) {
                if (start < pathInfo.dir.length) {
                    dirs.push(pathInfo.dir.substr(start));
                }
                break;
            }
        }
    }

    subPath = '';
    dirs.forEach(function (dir, num) {
        subPath += dir;
        if (!fs.existsSync(subPath)) {
            try {
                fs.mkdirSync(subPath);
            } catch (e) {
                if (e.code != 'EEXIST') {
                    console.log('[error] ', e);
                };
            }
            console.log('[info] create  dir:', subPath);
        }
        if (num == dirs.length - 1 && pathInfo.base != '') {
            copyFile(srcPath, desPath);
            //console.log('src file:', srcPath);
            //console.log('des file:', desPath);
        }
    });

}
382803
function(args){
        //  Remove auth info
        var fnArgs = _.clone(args),
            shasum = crypto.createHash('sha1'),
            fileName;
        delete fnArgs.auth;
        fileName = JSON.stringify(fnArgs);
        shasum.update(fileName);
        return cacheDir + shasum.digest('hex');
    }
557835
function _filesToFile (files, target, separator, callback) {

			if ("undefined" === typeof files) {
				throw new ReferenceError("missing \"files\" argument");
			}
				else if ("object" !== typeof files || !(files instanceof Array)) {
					throw new TypeError("\"files\" argument is not an Array");
				}
			else if ("undefined" === typeof target) {
				throw new ReferenceError("missing \"target\" argument");
			}
				else if ("string" !== typeof target) {
					throw new TypeError("\"target\" argument is not a string");
				}
			else if ("undefined" === typeof callback && "undefined" === typeof separator) {
				throw new ReferenceError("missing \"callback\" argument");
			}
				else if ("function" !== typeof callback && "function" !== typeof separator) {
					throw new TypeError("\"callback\" argument is not a function");
				}
			else {

				const _target = target.trim();

				if ("" === _target) {
					throw new Error("\"target\" argument is empty");
				}
				else {

					const _callback = "undefined" === typeof callback ? separator : callback;

					Promise.resolve().then(() => {
						return isFileProm(_target);
					}).then((exists) => {

						return !exists ? Promise.resolve() : new Promise((resolve, reject) => {

							fs.unlink(_target, (err) => {
								return err ? reject(err) : resolve();
							});

						});

					}).then(() => {

						if (!files.length) {

							return new Promise((resolve, reject) => {

								fs.writeFile(_target, "", (err) => {
									return err ? reject(err) : resolve();
								});

							});

						}
						else {

							return filesToStreamProm(files, "string" === typeof separator ? separator : " ").then((readStream) => {

								return new Promise((resolve, reject) => {

									let error = false;
									readStream.once("error", (_err) => {
										error = true; reject(_err);
									}).pipe(fs.createWriteStream(_target, { "flags": "a" }).once("error", (_err) => {
										error = true; reject(_err);
									}).once("close", () => {

										if (!error) {
											resolve();
										}

									}));

								});

							});

						}

					}).then(() => {
						_callback(null);
					}).catch(_callback);

				}

			}

		}
1072674
function(inputFile, outputFile, content) {
                return Promise()
                .then(function() {
                    var outputFilePath = PathUtils.resolveInRoot(outputFolder, outputFile);

                    return fs.ensureFile(outputFilePath)
                    .then(function() {
                        return fs.copy(inputFile, outputFilePath);
                    });
                });
            }
486119
function createBuildTask(filename, prefix, suffix) {
  return () =>
    gulp
      .src([
        `${closureLibRoot}/closure/goog/**/*.js`,
        `${closureLibRoot}/third_party/closure/goog/**/*.js`,
        'src/**/*.js'
      ], { base: '.' })
      .pipe(sourcemaps.init())
      .pipe(
        closureCompiler({
          js_output_file: filename,
          output_wrapper: `${prefix}%output%${suffix}`,
          entry_point: 'fireauth.exports',
          compilation_level: OPTIMIZATION_LEVEL,
          externs: [
            'externs/externs.js',
            'externs/grecaptcha.js',
            'externs/gapi.iframes.js',
            path.resolve(
              __dirname,
              '../firebase/externs/firebase-app-externs.js'
            ),
            path.resolve(
              __dirname,
              '../firebase/externs/firebase-error-externs.js'
            ),
            path.resolve(
              __dirname,
              '../firebase/externs/firebase-app-internal-externs.js'
            )
          ],
          language_out: 'ES5',
          only_closure_dependencies: true
        })
      )
      .pipe(sourcemaps.write('.'))
      .pipe(gulp.dest('dist'));
}