All we need is the imports, type declaration, and encode/decode
14922
public void generateMessageHeaderStub() throws IOException
    {
        final String messageHeader = "MessageHeader";
        try (Writer out = outputManager.createOutput(messageHeader))
        {
            final StringBuilder sb = new StringBuilder();
            final List<Token> tokens = ir.headerStructure().tokens();

            imports = new TreeSet<>();
            imports.add("io");

            generateTypeDeclaration(sb, messageHeader);
            generateTypeBodyComposite(sb, messageHeader, tokens.subList(1, tokens.size() - 1));

            generateEncodeDecode(sb, messageHeader, tokens.subList(1, tokens.size() - 1), false, false);
            generateCompositePropertyElements(sb, messageHeader, tokens.subList(1, tokens.size() - 1));
            out.append(generateFileHeader(ir.namespaces()));
            out.append(sb);
        }
    }
941066
def compile(self, source, dest, is_two_file=True, post=None, lang=None):
        """"""
        makedirs(os.path.dirname(dest))
        with io.open(dest, "w+", encoding="utf8") as out_file:
            with io.open(source, "r", encoding="utf8") as in_file:
                data = in_file.read()
            data, shortcode_deps = self.compile_string(data, source, is_two_file, post, lang)
            out_file.write(data)
        if post is None:
            if shortcode_deps:
                self.logger.error(
                    "Cannot save dependencies for post {0} (post unknown)",
                    source)
        else:
            post._depfile[dest] += shortcode_deps
        return True
918401
def _mergeGoSymbols(self, jsons = []):
		
		# <siXy> imports are per file, exports are per package
		# on the highest level we have: pkgname, types, funcs, vars, imports.

		symbols = {}
		symbols["types"] = []
		symbols["funcs"] = []
		symbols["vars"]  = []
		for file_json in jsons:
			symbols["types"] += file_json["types"]
			symbols["funcs"] += file_json["funcs"]
			symbols["vars"]  += file_json["vars"]

		return symbols
717402
def import_from_stdlib(name):
    """"""
    import os
    import types
    import code  # arbitrary module which stays in the same dir as pdb
    stdlibdir, _ = os.path.split(code.__file__)
    pyfile = os.path.join(stdlibdir, name + '.py')
    result = types.ModuleType(name)
    exec(compile(open(pyfile).read(), pyfile, 'exec'), result.__dict__)
    return result
1041650
def ImportTypes(self, prefix=''):
      
      # Use QueryTypeInfo to get all types
      dynTypeMgr = self.GetTypeManager()
      filterSpec = None
      if prefix != '':
         filterSpec = vmodl.reflect.DynamicTypeManager.TypeFilterSpec(
                                                              typeSubstr=prefix)
      allTypes = dynTypeMgr.QueryTypeInfo(filterSpec)

      ## Convert dynamic types to pyVmomi types
      #
      DynamicTypeConstructor().CreateTypes(allTypes)
      return allTypes
223995
function makeExtractionCompileOptions(compileOptions, entryFilename, extractions, importer) {
  const extractionCompileOptions = Object.assign({}, compileOptions);
  const extractionFunctions = {};

  // Copy all extraction function for each file into one object for compilation
  Object.keys(extractions).forEach(extractionKey => {
    Object.assign(extractionFunctions, extractions[extractionKey].injectedFunctions);
  });

  extractionCompileOptions.functions = Object.assign(extractionFunctions, compileOptions.functions);
  extractionCompileOptions.data = extractions[entryFilename].injectedData;
  if(!makeExtractionCompileOptions.imported) {
    extractionCompileOptions.importer = importer;
  }

  return extractionCompileOptions;
}
563783
function moveImports(code, imports) {
    return code.replace(RE_IMPORTS, function (_, indent, imprt) {
        imprt = imprt.trim();
        if (imprt.slice(-1) !== ';') {
            imprt += ';';
        }
        imports.push(imprt);
        return indent; // keep only the indentation
    });
}
574674
function build(importsObj, tree) {
  const modules = {};

  const instantiate = filepath => {
    if (modules[filepath] != null) {
      return modules[filepath];
    }

    const mod = tree.modules[filepath];
    const promise = Promise.all(
      Object.entries(mod.deps).map(([key, dep]) => {
        return instantiate(dep.filepath).then(result => [key, result]);
      })
    )
      .then(importsMap => {
        const imports = importsMap.reduce((acc, [key, module]) => {
          acc[key] = module.instance.exports;
          return acc;
        }, {});

        return WebAssembly.instantiate(
          tree.opcodes[filepath],
          Object.assign({}, imports, importsObj)
        );
      })
      .catch(e => {
        // TODO: do some logging here
        throw e;
      });

    modules[filepath] = promise;

    return promise;
  };

  modules[tree.root.filepath] = instantiate(tree.root.filepath);

  return modules[tree.root.filepath];
}
961583
def recompile(filename):
    """"""
    # Most of the code here based on the compile.py module.
    import os
    import imp
    import marshal
    import struct

    f = open(filename, 'U')
    try:
        timestamp = long(os.fstat(f.fileno()).st_mtime)
    except AttributeError:
        timestamp = long(os.stat(filename).st_mtime)
    codestring = f.read()
    f.close()
    if codestring and codestring[-1] != '\n':
        codestring = codestring + '\n'
    try:
        codeobject = compile(codestring, filename, 'exec')
    except SyntaxError:
        print >> sys.stderr, "Skipping %s - syntax error." % filename
        return
    cod = Code.from_code(codeobject)
    message = "reassembled %r imported.\n" % filename
    cod.code[:0] = [ # __import__('sys').stderr.write(message)
        (LOAD_GLOBAL, '__import__'),
        (LOAD_CONST, 'sys'),
        (CALL_FUNCTION, 1),
        (LOAD_ATTR, 'stderr'),
        (LOAD_ATTR, 'write'),
        (LOAD_CONST, message),
        (CALL_FUNCTION, 1),
        (POP_TOP, None),
        ]
    codeobject2 = cod.to_code()
    fc = open(filename+'c', 'wb')
    fc.write('\0\0\0\0')
    fc.write(struct.pack('<l', timestamp))
    marshal.dump(codeobject2, fc)
    fc.flush()
    fc.seek(0, 0)
    fc.write(imp.get_magic())
    fc.close()
1064718
function(action, channel, imports, sysImports, contentParts, next, invokeOverride) {
    var self = this,
    errStr,
    parsingError = false,
    schemePtr,
    mixedTypes = [ 'mixed', 'array', 'object' ]

    if (this.actions[action].invoke) {

      if (!channel.config) {
        channel.config = {};
      }

      if (!contentParts) {
        contentParts = {
          _files : []
        }
      }

      try {

        // apply channel config defaults into imports, if required
        // fields don't already exist
        var actionSchema = this.getAction(action),
          missingFields = (actionSchema.imports && actionSchema.imports.required && actionSchema.imports.required.length) ? actionSchema.imports.required : [];

        // apply config defaults
        var configDefaults = this.getActionConfigDefaults(action),
          configSchema = this.getActionConfig(action).properties,
          importSchema = this.getActionImports(action).properties;

        _.each(configDefaults, function(value, key) {
          if (!channel.config[key]) {
            channel.config[key] = value;
          }
        });

        // transpose from config to imports (no need to reference channel.config in pods)
        _.each(channel.config, function(value, key) {
          // convert to boolean if not already
          if (configSchema[key] && 'boolean' === configSchema[key].type) {
            channel.config[key] = helper.isTruthy(value) ? true : false;
          }

          if (!imports[key]) {
            imports[key] = channel.config[key];
          }
        });

        // derive import defaults
        var importDefaults = this.getActionImportDefaults(action);
        _.each(importDefaults, function(value, key) {
          if (!imports[key]) {
            imports[key] = value;
          }
        });

        for (var k in imports) {
          // trim empty import
          if (imports.hasOwnProperty(k) && '' === imports[k]) {
            delete imports[k];
            continue;
          }

          if (missingFields.length && missingFields.indexOf(k) > -1  ){
        	   missingFields.splice(missingFields.indexOf(k) ,1);
          }

        var mixed;
		    if(
          importSchema[k] && importSchema[k].type
          || configSchema[k] && configSchema[k].type
          ) {
			  	p_errStr = null;
			  	value = imports[k];

          if (importSchema[k]) {
            schemePtr = importSchema[k];
          } else if (configSchema[k]) {
            schemePtr = configSchema[k];
          }

          type = schemePtr.type.toLowerCase();

          //
          if ('number' === type) {
            pValue = helper.stringToFloat(value);
            if (0 !== pValue && !pValue) {
              p_errStr = k + ': String cannot be converted to Number';
            } else {
              imports[k] = pValue;
            }

          } else if ('integer' === type) {
            pValue = helper.stringToInt(value);
            if (0 !== pValue && !pValue) {
              p_errStr = k + ': String cannot be converted to Integer';
            } else {
              imports[k] = pValue;
            }

          } else if ('boolean' === type) {

            var pValue = helper.stringToBoolean(value);

            if (pValue == null) {
              p_errStr = k + ': String cannot be converted to Boolean';
            } else {
              imports[k] = pValue;
            }

          } else if (-1 !== mixedTypes.indexOf(type) ) {
            if ('object' === type && helper.isObject(value)) {
              imports[k] = value;

            } else if ('array' === type && helper.isArray(value)) {
              imports[k] = value;

            } else {
              pValue = helper.stringToJson(value);

              if (pValue) {
                imports[k] = pValue;

              } else if(!pValue){
                imports[k] = value;

              } else {
                p_errStr = k + ': String cannot be converted to '
                  + (('mixed' === type || 'object' === type) ? 'Object' : 'Array') ;
              }
            }
          }

        	if(p_errStr){
        		parsingError = true;
        		self.log(p_errStr, channel, 'error');
        		next.call(self, p_errStr);
        	}
			  }
      }

      if(missingFields.length){
        errStr = 'Missing Required Field(s):' + missingFields.join();
        self.log(errStr, channel, 'error');
        next.call(self, errStr)
      }

      if (!missingFields.length && !parsingError) {
        var invokeMethod = 'invoke' === this.getTriggerType() ? 'invoke' : 'trigger';

        // @deprecate -- when all trigger actions support 'trigger' method
        if (invokeOverride || !this.actions[action][invokeMethod]) {
          invokeMethod = 'invoke';
        }

        //
        this.actions[action][invokeMethod](imports, channel, sysImports, contentParts, function(err, exports) {
          if (err) {
            self.log(err, channel, 'error');
          }
          next.apply(self, arguments);
        });
      }
     } catch (e) {
       errStr = 'EXCEPT ' + e.toString();
       self.log(errStr, channel, 'error');
 	  	 next.call(self, errStr);
     }
    }
  }
29711
function cpTypes(typeAsset) {
  const {dir, base} = path.parse(typeAsset);
  let destDir = dir.split('build/types/')[1];
  destDir = destDir.split('/');
  destDir.splice(2, 0, 'dist');
  destDir = `${destDir.join('/')}/${base}`;
  addTsIgnore(typeAsset);
  return cpFile(typeAsset, destDir)
    .then(() => console.log(`cp ${typeAsset} -> ${destDir}`));
}
499418
function buildTree(index, api) {
  const modules = {};

  const dependency = (module, parent) => {
    const filepath = api.resolve(module, parent);
    if (modules[filepath] != null) {
      return modules[filepath];
    }

    const src = api.getFileContents(module, parent, "utf8");
    const basic = api.parser(src);
    const [nestedImports, hasMemory] = parseImports(basic, api);

    const deps = {};

    Object.keys(nestedImports).forEach(mod => {
      if (mod.indexOf(".") === 0) {
        const dep = dependency(mod, filepath);
        deps[mod] = dep;
      }
    });

    const patched = inferImportTypes(basic, deps, api);
    const ast = api.semantics(patched);

    api.validate(ast, {
      lines: src.split("\n"),
      filename: module.split("/").pop(),
    });

    const result = {
      ast,
      deps,
      filepath,
      hasMemory,
    };
    modules[filepath] = result;

    return result;
  };

  const root = dependency(index, null);

  return {
    root,
    modules,
  };
}
558399
def _main():
    
    from argparse import ArgumentParser, FileType
    from gutenberg import Error
    from gutenberg._util.os import reopen_encoded

    parser = ArgumentParser(description='Remove headers and footers from a '
                                        'Project Gutenberg text')
    parser.add_argument('infile', type=FileType('r'))
    parser.add_argument('outfile', type=FileType('w'))
    args = parser.parse_args()

    try:
        with reopen_encoded(args.infile, 'r', 'utf8') as infile:
            text = infile.read()
            clean_text = strip_headers(text)

        with reopen_encoded(args.outfile, 'w', 'utf8') as outfile:
            outfile.write(clean_text)
    except Error as error:
        parser.error(str(error))
1328474
def registerXmlType(typ, encoder, decoder):
        
        DataSet._xmlTypes[nstr(typ)] = (encoder, decoder)
129005
public final void mIMPORT() throws RecognitionException {
        try {
            int _type = IMPORT;
            int _channel = DEFAULT_TOKEN_CHANNEL;
            // com/dyuproject/protostuff/parser/ProtoLexer.g:103:5: ( 'import' )
            // com/dyuproject/protostuff/parser/ProtoLexer.g:103:9: 'import'
            {
            match("import"); 


            }

            state.type = _type;
            state.channel = _channel;
        }
        finally {
        }
    }
222785
def import_enum(dest, src, name):
    
    dest.enums[name] = src.enums[name]
1006273
def _import_type(line: str) -> Optional[str]:
        """"""
        if "isort:skip" in line or "NOQA" in line:
            return None
        elif line.startswith('import '):
            return "straight"
        elif line.startswith('from '):
            return "from"