Sources a file written in a foreign shell language.
348403
def source_foreign(args, stdin=None):
    """"""
    parser = _ensure_source_foreign_parser()
    ns = parser.parse_args(args)
    if ns.prevcmd is not None:
        pass  # don't change prevcmd if given explicitly
    elif os.path.isfile(ns.files_or_code[0]):
        # we have filename to source
        ns.prevcmd = '{} "{}"'.format(ns.sourcer, '" "'.join(ns.files_or_code))
    elif ns.prevcmd is None:
        ns.prevcmd = ' '.join(ns.files_or_code)  # code to run, no files
    fsenv = foreign_shell_data(shell=ns.shell, login=ns.login,
                                          interactive=ns.interactive,
                                          envcmd=ns.envcmd,
                                          aliascmd=ns.aliascmd,
                                          extra_args=ns.extra_args,
                                          safe=ns.safe, prevcmd=ns.prevcmd,
                                          postcmd=ns.postcmd,
                                          funcscmd=ns.funcscmd,
                                          sourcer=ns.sourcer,
                                          use_tmpfile=ns.use_tmpfile,
                                          seterrprevcmd=ns.seterrprevcmd,
                                          seterrpostcmd=ns.seterrpostcmd)
    if fsenv is None:
        raise RuntimeError("Source failed: {}\n".format(ns.prevcmd), 1)
    # apply results
    env = os.environ.copy()
    for k, v in fsenv.items():
        if k in env and v == env[k]:
            continue  # no change from original
        env[k] = v
    # Remove any env-vars that were unset by the script.
    for k in os.environ: # use os.environ again to prevent errors about changed size
        if k not in fsenv:
            env.pop(k, None)
    return env
1279079
function write(myLocale) {
    try {
        stats = fs.lstatSync(directory);
    } catch(e) {
        fs.mkdirSync(directory, 0755);
    }
    fs.writeFile(locate(myLocale), JSON.stringify(locales[myLocale], null, "\t"));
}
919409
def shell_source(script):
    """"""
    pipe = subprocess.Popen(
        ". %s; env" % script, stdout=subprocess.PIPE, shell=True)
    output = pipe.communicate()[0].decode()
    env = {}
    for line in output.splitlines():
        try:
            keyval = line.split("=", 1)
            env[keyval[0]] = keyval[1]
        except:
            pass

    os.environ.update(env)
390764
function commonjsMain (args) {
    var cwd = require("file").path(require("file").cwd());
    if (!args[1])
        throw new Error('Usage: '+args[0]+' FILE');
    var source = cwd.join(args[1]).read({charset: "utf-8"});
    exports.parser.parse(source);
}
585818
function(stream, locale, fileExt) {
					archive.append(stream, { name: locale + '/translation.' + fileExt });
					if (++count === lenLocales) {
						archive.finalize();
					}
				}
900321
function makeReleaseCopies( Release ) {
	shell.mkdir( "-p", cdnFolder );

	Object.keys( releaseFiles ).forEach( function( key ) {
		var text,
			builtFile = releaseFiles[ key ],
			unpathedFile = key.replace( /VER/g, Release.newVersion ),
			releaseFile = cdnFolder + "/" + unpathedFile;

		if ( /\.map$/.test( releaseFile ) ) {

			// Map files need to reference the new uncompressed name;
			// assume that all files reside in the same directory.
			// "file":"jquery.min.js" ... "sources":["jquery.js"]
			text = fs.readFileSync( builtFile, "utf8" )
				.replace( /"file":"([^"]+)"/,
					"\"file\":\"" + unpathedFile.replace( /\.min\.map/, ".min.js\"" ) )
				.replace( /"sources":\["([^"]+)"\]/,
					"\"sources\":[\"" + unpathedFile.replace( /\.min\.map/, ".js" ) + "\"]" );
			fs.writeFileSync( releaseFile, text );
		} else if ( builtFile !== releaseFile ) {
			shell.cp( "-f", builtFile, releaseFile );
		}
	} );
}
50967
def get_file(fn):
    """"""
    fn = os.path.join(os.path.dirname(__file__), 'data', fn)
    f = open(fn, 'rb')
    lines = [line.decode('utf-8').strip() for line in f.readlines()]
    return lines
39887
def load(language_dir, filename, encoding):
  '''  '''
  global _DICTIONARY
  try:
    json_file = filename + '.json'
    with io.open(os.path.join(language_dir, json_file), 'r', encoding=encoding) as f:
      _DICTIONARY = json.load(f)
  except IOError:
    raise IOError('{0} Language file not found at location {1}. '
                  'Make sure that your translation file is in the '
                  'listed language directory'.format(filename.title(), language_dir))
764761
function(file) {
      var type = file.type.toLowerCase(),
        sources = file.sources;

      $.each(sources, function(tmpSource) {
        if (_support[type][tmpSource]) {
          file = file.sources[tmpSource];
          file.type = type.toUpperCase();
          return false;
        }
      });
      if (file.source) {
        return file;
      } else {
        return false;
      }
    }
1370764
def iterstd(cmd, std="out", **kwargs):
    """"""
    def _readline():
        while True:
            line = getattr(proc, "std"+std).readline()
            if line != b"":
                yield line.rstrip().decode("UTF-8", "replace")
            else:
                break
    kwargs['shell'] = True
    kwargs['stdout'] = subprocess.PIPE
    kwargs['stderr'] = subprocess.PIPE
    if sys.version_info >= (3,0):
        with subprocess.Popen(cmd, **kwargs) as proc:
            for line in _readline(): yield line
    else:
        proc = subprocess.Popen(cmd, **kwargs)
        for line in _readline(): yield line
        proc.kill()
1359964
function fixImportedSourceMap(file, state, callback) {
  if (!state.map) {
    return callback();
  }

  state.map.sourcesContent = state.map.sourcesContent || [];

  nal.map(state.map.sources, normalizeSourcesAndContent, callback);

  function assignSourcesContent(sourceContent, idx) {
    state.map.sourcesContent[idx] = sourceContent;
  }

  function normalizeSourcesAndContent(sourcePath, idx, cb) {
    var sourceRoot = state.map.sourceRoot || '';
    var sourceContent = state.map.sourcesContent[idx] || null;

    if (isRemoteSource(sourcePath)) {
      assignSourcesContent(sourceContent, idx);
      return cb();
    }

    if (state.map.sourcesContent[idx]) {
      return cb();
    }

    if (sourceRoot && isRemoteSource(sourceRoot)) {
      assignSourcesContent(sourceContent, idx);
      return cb();
    }

    var basePath = path.resolve(file.base, sourceRoot);
    var absPath = path.resolve(state.path, sourceRoot, sourcePath);
    var relPath = path.relative(basePath, absPath);
    var unixRelPath = normalizePath(relPath);

    state.map.sources[idx] = unixRelPath;

    if (absPath !== file.path) {
      // Load content from file async
      return fs.readFile(absPath, onRead);
    }

    // If current file: use content
    assignSourcesContent(state.content, idx);
    cb();

    function onRead(err, data) {
      if (err) {
        assignSourcesContent(null, idx);
        return cb();
      }
      assignSourcesContent(removeBOM(data).toString('utf8'), idx);
      cb();
    }
  }
}
100454
def shell(args):
    "  "
    print
    print "# Makesite integration "
    print "# ==================== "
    print "export MAKESITE_HOME=%s" % args.path
    print "source %s" % op.join(settings.BASEDIR, 'shell.sh')
    print
375221
function makeFromFile(makefile,target){
	var read;
	var basedir='.';
	if(makefile){
		read = fs.createReadStream(makefile, {encoding: 'utf8'});
		basedir=mpath.dirname(makefile);
	}else{
		process.stdin.resume();
		process.stdin.setEncoding('utf8');
		read = process.stdin;
	}
	read.on('data', function (data){
		try {
			var o=JSON.parse(data);
			make(basedir, o, target);
		}catch(e){
			console.log(e);
		}
	});
}
1000133
function copySourceContent(filename) {
    var content = consumer.sourceContentFor(filename);
    if (content) {
      generator.setSourceContent(filename, content);
    }
  }
519054
def run(self, args):
        
        configuration = self.configuration
        source_messages_dir = configuration.source_messages_dir
        for locale, converter in zip(configuration.dummy_locales, [Dummy(), Dummy2(), ArabicDummy()]):
            print('Processing source language files into dummy strings, locale "{}"'.format(locale))
            for source_file in configuration.source_messages_dir.walkfiles('*.po'):
                if args.verbose:
                    print('   ', source_file.relpath())
                make_dummy(source_messages_dir.joinpath(source_file), locale, converter)
        if args.verbose:
            print()
909373
function sourceRootFn (file) {
  let sourcePath    = file.history[0],
      targetPath    = path.join(__dirname, '../src/'),
      relativePath  = path.join(path.relative(sourcePath, targetPath), './src');
  return relativePath;
}
190583
function processSourceFile(work_directory, file_path) {

    var path = create('fs.path', work_directory).combine(file_path),
        source = create('fs.filereader(utf8)', path).readSync();

    // replace /*#include filename.ext*/
    var result = source.replace(/\/\*#include \S+\*\//gm, function(line) {
        var include_file_path = /\/\*#include (\S+)\*\//.exec(line)[1];
        // list .js file
        watch_list.push(include_file_path);
        // recursively perform substitutions
        return processSourceFile(path.getParentPath().path, include_file_path);
    });

    return result;
}