write the module-level namespace-generating callable.
437013
def write_namespaces(self, namespaces):
        """"""
        self.printer.writelines(
            "def _mako_get_namespace(context, name):",
                "try:",
                    "return context.namespaces[(__name__, name)]",
                "except KeyError:",
                    "_mako_generate_namespaces(context)",
                "return context.namespaces[(__name__, name)]",
            None, None
        )
        self.printer.writeline("def _mako_generate_namespaces(context):")


        for node in namespaces.values():
            if 'import' in node.attributes:
                self.compiler.has_ns_imports = True
            self.printer.start_source(node.lineno)
            if len(node.nodes):
                self.printer.writeline("def make_namespace():")
                export = []
                identifiers = self.compiler.identifiers.branch(node)
                self.in_def = True
                class NSDefVisitor(object):
                    def visitDefTag(s, node):
                        s.visitDefOrBase(node)

                    def visitBlockTag(s, node):
                        s.visitDefOrBase(node)

                    def visitDefOrBase(s, node):
                        if node.is_anonymous:
                            raise exceptions.CompileException(
                                "Can't put anonymous blocks inside "
                                "<%namespace>",
                                **node.exception_kwargs
                            )
                        self.write_inline_def(node, identifiers, nested=False)
                        export.append(node.funcname)
                vis = NSDefVisitor()
                for n in node.nodes:
                    n.accept_visitor(vis)
                self.printer.writeline("return [%s]" % (','.join(export)))
                self.printer.writeline(None)
                self.in_def = False
                callable_name = "make_namespace()"
            else:
                callable_name = "None"

            if 'file' in node.parsed_attributes:
                self.printer.writeline(
                                "ns = runtime.TemplateNamespace(%r,"
                                " context._clean_inheritance_tokens(),"
                                " templateuri=%s, callables=%s, "
                                " calling_uri=_template_uri)" %
                                (
                                    node.name,
                                    node.parsed_attributes.get('file', 'None'),
                                    callable_name,
                                )
                            )
            elif 'module' in node.parsed_attributes:
                self.printer.writeline(
                                "ns = runtime.ModuleNamespace(%r,"
                                " context._clean_inheritance_tokens(),"
                                " callables=%s, calling_uri=_template_uri,"
                                " module=%s)" %
                                (
                                    node.name,
                                    callable_name,
                                    node.parsed_attributes.get(
                                                'module', 'None')
                                )
                            )
            else:
                self.printer.writeline(
                                "ns = runtime.Namespace(%r,"
                                " context._clean_inheritance_tokens(),"
                                " callables=%s, calling_uri=_template_uri)" %
                                (
                                    node.name,
                                    callable_name,
                                )
                            )
            if eval(node.attributes.get('inheritable', "False")):
                self.printer.writeline("context['self'].%s = ns" % (node.name))

            self.printer.writeline(
                "context.namespaces[(__name__, %s)] = ns" % repr(node.name))
            self.printer.write_blanks(1)
        if not len(namespaces):
            self.printer.writeline("pass")
        self.printer.writeline(None)
339097
private static function create_namespace( $parent, $name, $callable ) {
		$reflection  = new ReflectionClass( $callable );
		$doc_comment = self::get_doc_comment( $reflection );
		if ( ! $doc_comment ) {
			\WP_CLI::debug( null === $doc_comment ? "Failed to get doc comment for {$name}." : "No doc comment for {$name}.", 'commandfactory' );
		}
		$docparser = new \WP_CLI\DocParser( $doc_comment );

		return new CommandNamespace( $parent, $name, $docparser );
	}
871386
def write_repr(self, out, visited):
        '''
        
        '''
        # Default implementation: generate a proxy value and write its repr
        # However, this could involve a lot of work for complicated objects,
        # so for derived classes we specialize this
        return out.write(repr(self.proxyval(visited)))
871
def generate_module_table_header(modules):
    

    # Print header file for all external modules.
    mod_defs = []
    print("// Automatically generated by makemoduledefs.py.\n")
    for module_name, obj_module, enabled_define in modules:
        mod_def = "MODULE_DEF_{}".format(module_name.upper())
        mod_defs.append(mod_def)
        print((
            "#if ({enabled_define})\n"
            "    extern const struct _mp_obj_module_t {obj_module};\n"
            "    #define {mod_def} {{ MP_ROM_QSTR({module_name}), MP_ROM_PTR(&{obj_module}) }},\n"
            "#else\n"
            "    #define {mod_def}\n"
            "#endif\n"
            ).format(module_name=module_name, obj_module=obj_module,
                     enabled_define=enabled_define, mod_def=mod_def)
        )

    print("\n#define MICROPY_REGISTERED_MODULES \\")

    for mod_def in mod_defs:
        print("    {mod_def} \\".format(mod_def=mod_def))

    print("// MICROPY_REGISTERED_MODULES")
1151755
def write_module_code(self, module_code):
        """"""
        for n in module_code:
            self.printer.start_source(n.lineno)
            self.printer.write_indented_block(n.text)
633661
void write(CallInfo callInfo, DataSetAssertion assertion) {
    Element rootNode = root(callInfo); 
    DataSource ds = assertion.getSource();
    write(rootNode, ds);
    Element saNode = createNode(rootNode, ASSERTION_TAG);
    List<MetaData.ColumnInfo> mdCols = ds.getMetaData().columns();
    write(saNode, 
        EXPECTED_TAG, 
        mdCols,
        assertion.data(DataSetAssertion.IteratorType.EXPECTED_DATA));
    if (! assertion.passed()) {
      Element errorsNode = createNode(saNode, ERRORS_TAG);
      write(errorsNode, 
          EXPECTED_TAG, 
          mdCols,
          assertion.data(DataSetAssertion.IteratorType.ERRORS_EXPECTED));
      write(errorsNode, 
          ACTUAL_TAG, 
          mdCols,
          assertion.data(DataSetAssertion.IteratorType.ERRORS_ACTUAL));
    }
    flush(rootNode);
  }
443494
private function writeClassHeader(): void
  {
    $p = strrpos($this->wrapperClassName, '\\');
    if ($p!==false)
    {
      $namespace  = ltrim(substr($this->wrapperClassName, 0, $p), '\\');
      $class_name = substr($this->wrapperClassName, $p + 1);
    }
    else
    {
      $namespace  = null;
      $class_name = $this->wrapperClassName;
    }

    // Write PHP tag.
    $this->codeStore->append('<?php');

    // Write strict types.
    if ($this->strictTypes)
    {
      $this->codeStore->append('declare(strict_types=1);');
    }

    // Write name space of the wrapper class.
    if ($namespace!==null)
    {
      $this->codeStore->append('');
      $this->codeStore->append(sprintf('namespace %s;', $namespace));
      $this->codeStore->append('');
    }

    // If the child class and parent class have different names import the parent class. Otherwise use the fully
    // qualified parent class name.
    $parent_class_name = substr($this->parentClassName, strrpos($this->parentClassName, '\\') + 1);
    if ($class_name!=$parent_class_name)
    {
      $this->imports[]       = $this->parentClassName;
      $this->parentClassName = $parent_class_name;
    }

    // Write use statements.
    if (!empty($this->imports))
    {
      $this->imports = array_unique($this->imports, SORT_REGULAR);
      foreach ($this->imports as $import)
      {
        $this->codeStore->append(sprintf('use %s;', $import));
      }
      $this->codeStore->append('');
    }

    // Write class name.
    $this->codeStore->append('/**');
    $this->codeStore->append(' * The data layer.', false);
    $this->codeStore->append(' */', false);
    $this->codeStore->append(sprintf('class %s extends %s', $class_name, $this->parentClassName));
    $this->codeStore->append('{');
  }
800139
def write_module_file(name, path, package):
    '''
    '''
    file_path = join(path, '%s.rst' % name)
    mod_file = open(file_path, 'w')

    mod_file.write('%s\n' % AUTOGEN)
    mod_file.write('%s\n' % name.title())
    mod_file.write('=' * len(name))
    mod_file.write('\n\n')
    mod_file.write('.. toctree::\n')
    mod_file.write('   :maxdepth: 1\n\n')
    mod_file.write('.. automodule:: %s.%s\n' % (package, name))
    mod_file.write('   :members:\n')
    mod_file.write('   :undoc-members:\n')
    mod_file.write('   :show-inheritance:\n')
675202
function (pluginName, moduleName, write) {

			var module,
				content,
				cutPos,
				modPath,
				relCssPath;
			if (_genericCssToRootPath && _buildMap.hasOwnProperty(moduleName)) {

				module = _buildMap[moduleName];
				if (module.write) {

					// #1: fix urls in css
					// get folder path to the current module
					cutPos = moduleName.lastIndexOf("/");
					modPath = cutPos >= 0 ? moduleName.slice(0, cutPos + 1) : "";
					// form a new base path for substituting in css
					relCssPath = _genericCssToRootPath + modPath;

					// replace all links like 'url(folder/file.png)' in the module's content (css)
					// to make them relative to the generic.css location
					content = _replaceCssRelativeUrls(module.data, relCssPath);

					// #2: add module's css into common generic.css
					module.write(moduleName, module.path, content);
				}
			}
		}
665260
def writef90():
    
    cparser = _parse()
    dependencies = ["{}_c".format(m) for m in cparser.modules]
    originals = list(cparser.modules.keys())
    writers = {}
    for modname, module in list(cparser.modules.items()):
        msg.info("Writing wrapper module for {}".format(modname))
        fwriter = f90.WrapperModule(module, args["library"], args["f90"], args["link"])
        writers[modname] = fwriter
        fwriter.write_f90()
        msg.okay("Finished writing {}_c.f90".format(modname))
        
    #We can compile all these modules together into a single shared library.
    writer = list(writers.values())[0]
    code = writer.make(remake=args["remake"], dependencies=dependencies, compiler=args["compiler"],
                       debug=args["debug"], profile=args["profile"])
    if code == 0:
        for modname in originals:
            msg.info("Writing python wrapper module {}.py".format(modname))
            writers[modname].write_py()
            msg.okay("Finished writing {}.py".format(modname))
456351
def write_def_decl(self, node, identifiers):
        """"""
        funcname = node.funcname
        namedecls = node.get_argument_expressions()
        nameargs = node.get_argument_expressions(as_call=True)

        if not self.in_def and (
                                len(self.identifiers.locally_assigned) > 0 or
                                len(self.identifiers.argument_declared) > 0):
            nameargs.insert(0, 'context._locals(__M_locals)')
        else:
            nameargs.insert(0, 'context')
        self.printer.writeline("def %s(%s):" % (funcname, ",".join(namedecls)))
        self.printer.writeline(
                    "return render_%s(%s)" % (funcname, ",".join(nameargs)))
        self.printer.writeline(None)
196090
def _write(self, fp):
        """"""
        def write_section(name, section_dict):
            fp.write(("[%s]\n" % name).encode(defenc))
            for (key, value) in section_dict.items():
                if key != "__name__":
                    fp.write(("\t%s = %s\n" % (key, self._value_to_string(value).replace('\n', '\n\t'))).encode(defenc))
                # END if key is not __name__
        # END section writing

        if self._defaults:
            write_section(cp.DEFAULTSECT, self._defaults)
        for name, value in self._sections.items():
            write_section(name, value)
698506
def generate_module_content(self, module):
        
        if isinstance(module, Module):
            return module.render()
        else:  # pragma: no cover
            raise Exception("%r is not a Module object" % module)
900465
def _build_module_db(self):
        
        tdict = collections.defaultdict(lambda: [])
        for callable_name, callable_dict in self._exh_obj.callables_db.items():
            fname, line_no = callable_dict["code_id"]
            cname = (
                "{cls_name}.__init__".format(cls_name=callable_name)
                if callable_dict["type"] == "class"
                else callable_name
            )
            tdict[fname].append({"name": cname, "line": line_no})
        for fname in tdict.keys():
            self._module_obj_db[fname] = sorted(
                tdict[fname], key=lambda idict: idict["line"]
            )
686028
def write_into(self, block, level=0):
        """"""

        for line, l in self._lines:
            block.write_line(line, level + l)

        for name, obj in _compat.iteritems(self._deps):
            block.add_dependency(name, obj)
964226
function(pluginName, moduleName, write){
            if(moduleName in buildMap){
                var content = buildMap[moduleName];
                write('define("'+ pluginName +'!'+ moduleName +'", function(){ return '+ content +';});\n');
            }
        }
417012
def in_namespace(name)
      name ||= generate_name
      @scope = Scope.new(name, @scope)
      ns = NameSpace.new(self, @scope)
      yield(ns)
      ns
    ensure
      @scope = @scope.tail
    end