CHILD MODULE AUTO-COPYING Copying doc pages from a child module
543544
function getCompiledChildModuleDocsPath(moduleName) {
    let rootPath = c.rootPath;
    if (process.cwd() !== c.rootPath) {
        rootPath = path.join(process.cwd(), c.rootPath);
    }
    const childModuleRootPath = path.join(rootPath, c.dependenciesPath, moduleName),
            cmc = config.get(childModuleRootPath),
            childCompiledDocs = path.join(childModuleRootPath, cmc.webroot, cmc.latestVersionPath, '**/*.html');
    return childCompiledDocs;
}
107487
def _module_parents(module_name):
        '''
        
        '''
        spl = module_name.split('.')
        for i in range(len(spl), 0, -1):
            yield '.'.join(spl[0:i])
        if module_name:
            yield ''
1152246
def _process_docs(self, anexec, docblocks, parent, module, docsearch):
        """"""
        #The documentation for the parameters is stored outside of the executable
        #We need to get hold of them from docblocks from the parent text
        key = "{}.{}".format(parent.name, anexec.name)
        if key in docblocks:
            docs = self.docparser.to_doc(docblocks[key][0], anexec.name)
            anexec.docstart, anexec.docend = (docblocks[key][1], docblocks[key][2])
            self.docparser.process_execdocs(docs, anexec, key)
445460
def link_docstring(modules, docstring:str, overwrite:bool=False)->str:
    ""
    mods = listify(modules)
    for mod in mods: _modvars.update(mod.__dict__) # concat all module definitions
    return re.sub(BT_REGEX, replace_link, docstring)
764807
def appendChild(self, child):
        '''
            
        '''

        # Associate parentNode of #child to this tag
        child.parentNode = self

        # Associate owner document to child and all children recursive
        ownerDocument = self.ownerDocument

        child.ownerDocument = ownerDocument
        for subChild in child.getAllChildNodes():
            subChild.ownerDocument = ownerDocument

        # Our tag cannot be self-closing if we have a child tag
        self.isSelfClosing = False

        # Append to both "children" and "blocks"
        self.children.append(child)
        self.blocks.append(child)
        return child
1007324
public void copyDocumentationTo(/* @Nullable */ final EObject source, /* @Nullable */ JvmIdentifiableElement jvmElement) {
		if(source == null || jvmElement == null)
			return;
		
		DocumentationAdapter documentationAdapter = new DocumentationAdapter() {
			private boolean computed = false;
			@Override
			public String getDocumentation() {
				if (computed) {
					return super.getDocumentation();
				}
				String result = JvmTypesBuilder.this.getDocumentation(source);
				setDocumentation(result);
				return result;
			}
			@Override
			public void setDocumentation(String documentation) {
				computed = true;
				super.setDocumentation(documentation);
			}
		};
		jvmElement.eAdapters().add(documentationAdapter);
	}
751983
def autodoc_tuple2doc(module):
    """"""
    modulename = module.__name__
    for membername, member in inspect.getmembers(module):
        for tuplename, descr in _name2descr.items():
            tuple_ = getattr(member, tuplename, None)
            if tuple_:
                logstring = f'{modulename}.{membername}.{tuplename}'
                if logstring not in _loggedtuples:
                    _loggedtuples.add(logstring)
                    lst = [f'\n\n\n    {descr}:']
                    if tuplename == 'CLASSES':
                        type_ = 'func'
                    else:
                        type_ = 'class'
                    for cls in tuple_:
                        lst.append(
                            f'      * '
                            f':{type_}:`{cls.__module__}.{cls.__name__}`'
                            f' {objecttools.description(cls)}')
                    doc = getattr(member, '__doc__')
                    if doc is None:
                        doc = ''
                    member.__doc__ = doc + '\n'.join(l for l in lst)
301589
private void updateChildrenInfo(Map myChild) {
        if (myChild != null) {
            Iterator values = myChild.values().iterator();
            while (values.hasNext()) {
                ModuleItem childMI = (ModuleItem) values.next();
                if (childMI.getInstance() instanceof PmiModuleAggregate) {
                    // no op                    
                } else {
                    ((PmiModuleAggregate) this.instance).add(childMI.getInstance());
                    ((PmiAbstractModule) this.instance).updateDataList();
                }
                updateChildrenInfo(childMI.children);
            }
        }
    }
1165409
private void copyDocFiles() throws DocFileIOException {
        PackageElement containingPackage = utils.containingPackage(typeElement);
        if((configuration.packages == null ||
            !configuration.packages.contains(containingPackage)) &&
            !containingPackagesSeen.contains(containingPackage)) {
            //Only copy doc files dir if the containing package is not
            //documented AND if we have not documented a class from the same
            //package already. Otherwise, we are making duplicate copies.
            utils.copyDocFiles(containingPackage);
            containingPackagesSeen.add(containingPackage);
        }
     }
1149613
def copy_dependency_docs(tile):
    """"""

    env = Environment(tools=[])

    outputbase = os.path.join('build', 'output', 'doc')
    depbase = os.path.join('build', 'deps')
    for dep in tile.dependencies:
        depdir = os.path.join(depbase, dep['unique_id'], 'doc', dep['unique_id'])
        outputdir = os.path.join(outputbase, dep['unique_id'])

        if os.path.exists(depdir):
            env.Command([outputdir], [depdir], Copy("$TARGET", "$SOURCE"))
522407
def _copy_binder_notebooks(app):
    """"""

    gallery_conf = app.config.sphinx_gallery_conf
    gallery_dirs = gallery_conf.get('gallery_dirs')
    binder_conf = gallery_conf.get('binder')
    notebooks_dir = os.path.join(app.outdir, binder_conf.get('notebooks_dir'))
    shutil.rmtree(notebooks_dir, ignore_errors=True)
    os.makedirs(notebooks_dir)

    if not isinstance(gallery_dirs, (list, tuple)):
        gallery_dirs = [gallery_dirs]

    iterator = sphinx_compatibility.status_iterator(
        gallery_dirs, 'copying binder notebooks...', length=len(gallery_dirs))

    for i_folder in iterator:
        shutil.copytree(os.path.join(app.srcdir, i_folder),
                        os.path.join(notebooks_dir, i_folder),
                        ignore=_remove_ipynb_files)
593087
def add_copies(self, node, parent, elem, minel):
        """"""
        rep = 0 if minel is None else int(minel.arg) - 1
        for i in range(rep):
            parent.append(copy.deepcopy(elem))
1236627
def process_child(node):
    """"""

    # Edit descriptions to be nicer
    if isinstance(node, sphinx.addnodes.desc_addname):
        if len(node.children) == 1:
            child = node.children[0]
            text = child.astext()
            if text.startswith("wpilib.") and text.endswith("."):
                # remove the last element
                text = ".".join(text.split(".")[:-2]) + "."
                node.children[0] = docutils.nodes.Text(text)

    # Edit literals to be nicer
    elif isinstance(node, docutils.nodes.literal):
        child = node.children[0]
        text = child.astext()

        # Remove the imported module name
        if text.startswith("wpilib."):
            stext = text.split(".")
            text = ".".join(stext[:-2] + [stext[-1]])
            node.children[0] = docutils.nodes.Text(text)

    for child in node.children:
        process_child(child)
1183839
def copy_page_and_children(self, foreign_id, parent_id, depth=0):
        '''
        
        '''
        url = "{}/api/v2/pages/{}/".format(self.base_url, foreign_id)

        self.log(ACTION, "Requesting Data", {"url": url}, depth)
        try:
            # TODO: create a robust wrapper around this functionality
            response = requests.get(url)
            content = json.loads(response.content)
        except Exception as e:
            self.log(ERROR, "Requesting Data - abandoning copy",
                     {"url": url, "exception": e}, depth)
            return None

        parent = Page.objects.get(id=parent_id).specific
        page = None
        try:
            self.log(ACTION, "Create Page", {"url": url}, depth)
            page = self.attach_page(parent, content)
            if page:
                self.log(SUCCESS, "Create Page",
                         {"url": url,
                          "page title": page.title.encode('utf-8')},
                         depth)
        except PageNotImportable as e:
            message = e.message.pop("message")
            self.log(WARNING, message, e.message.pop("message"), depth)
            return None

        if page:
            # create translations
            if content["meta"]["translations"]:
                for translation_obj in content["meta"]["translations"]:
                    _url = "{}/api/v2/pages/{}/".format(self.base_url,
                                                        translation_obj["id"])
                    # TODO: create a robust wrapper around this functionality
                    _response = requests.get(_url)
                    self.log(
                        ACTION,
                        "Getting translated content",
                        {"url": _url}, depth)
                    if _response.content:
                        _content = json.loads(_response.content)

                        if ("locale" in translation_obj and
                                translation_obj["locale"]):
                            self.attach_translated_content(
                                page, _content, translation_obj["locale"])
                        else:
                            self.log(
                                ERROR,
                                "locale is null",
                                {"url": _url, }, depth)
                    else:
                        self.log(
                            ERROR,
                            "Getting translated content",
                            {"url": _url}, depth)

            main_language_child_ids = content["meta"]["main_language_children"]

            # recursively iterate through child nodes
            if main_language_child_ids:
                for main_language_child_id in main_language_child_ids:
                    try:
                        self.copy_page_and_children(
                            foreign_id=main_language_child_id,
                            parent_id=page.id, depth=depth + 1)
                    except Exception as e:
                        self.log(ERROR, "Copying Children",
                                 {"url": url, "exception": e})
552747
public static Document deepCopy(Element child) {
		Document mdDoc = DOCUMENT_BUILDER.newDocument();
		Element el = (Element) mdDoc.importNode(child, true);
		mdDoc.appendChild(el);
		return mdDoc;
	}
1322193
def copy_template(template_name, copy_to, tag_library_name):
    """"""
    import django_extensions
    import shutil

    template_dir = os.path.join(django_extensions.__path__[0], 'conf', template_name)

    # walk the template structure and copies it
    for d, subdirs, files in os.walk(template_dir):
        relative_dir = d[len(template_dir) + 1:]
        if relative_dir and not os.path.exists(os.path.join(copy_to, relative_dir)):
            os.mkdir(os.path.join(copy_to, relative_dir))
        for i, subdir in enumerate(subdirs):
            if subdir.startswith('.'):
                del subdirs[i]
        for f in files:
            if f.endswith('.pyc') or f.startswith('.DS_Store'):
                continue
            path_old = os.path.join(d, f)
            path_new = os.path.join(copy_to, relative_dir, f.replace('sample', tag_library_name))
            if os.path.exists(path_new):
                path_new = os.path.join(copy_to, relative_dir, f)
                if os.path.exists(path_new):
                    continue
            path_new = path_new.rstrip(".tmpl")
            fp_old = open(path_old, 'r')
            fp_new = open(path_new, 'w')
            fp_new.write(fp_old.read())
            fp_old.close()
            fp_new.close()
            try:
                shutil.copymode(path_old, path_new)
                _make_writeable(path_new)
            except OSError:
                sys.stderr.write("Notice: Couldn't set permission bits on %s. You're probably using an uncommon filesystem setup. No problem.\n" % path_new)
20278
def module(args):
    "  "

    mod = op.join(settings.MOD_DIR, args.MODULE)
    assert op.exists(mod), "Not found module: %s" % args.MODULE
    if not args.DEST.startswith(op.sep):
        args.DEST = op.join(getcwd(), args.DEST)
    print_header("Copy module source")
    copytree(mod, args.DEST)