How to use the envisage.developer.code_browser.package.Package function in envisage

To help you get started, we’ve selected a few envisage examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github enthought / envisage / envisage / developer / code_browser / enclbr.py View on Github external
else:
        contents = []

    for child in directory.children:
        if child.ext == '.py':
            contents.append(read_file(child.path, package))

        elif child.is_package:
            if package is not None:
                sub_package_name = '%s.%s' % (package.name, child.name)
                sub_package = Package(
                    filename=child.path, name=sub_package_name, parent=package
                )

            else:
                sub_package = Package(filename=child.path, name=child.name)

            read_directory(child.path, sub_package)
            contents.append(sub_package)

    return contents
github enthought / envisage / envisage / developer / code_browser / code_browser.py View on Github external
if package is not None:
            contents = package.contents

        else:
            contents = []

        for child in directory.children:
            # If the child is a Python file then parse it.
            if child.ext == '.py':
                contents.append(self.read_file(child.path, package))

            # If the child is a sub-package then recurse!
            elif child.is_package:
                if package is not None:
                    sub_package_name = '%s.%s' % (package.name, child.name)
                    sub_package = Package(
                        filename = child.path,
                        name     = sub_package_name,
                        parent   = package
                    )

                else:
                    sub_package = Package(filename=child.path, name=child.name)

                self.read_directory(child.path, sub_package)
                contents.append(sub_package)

        return contents
github enthought / envisage / envisage / developer / code_browser / enclbr.py View on Github external
raise ValueError("%s is NOT a directory." % filename)

    if package is not None:
        contents = package.contents

    else:
        contents = []

    for child in directory.children:
        if child.ext == '.py':
            contents.append(read_file(child.path, package))

        elif child.is_package:
            if package is not None:
                sub_package_name = '%s.%s' % (package.name, child.name)
                sub_package = Package(
                    filename=child.path, name=sub_package_name, parent=package
                )

            else:
                sub_package = Package(filename=child.path, name=child.name)

            read_directory(child.path, sub_package)
            contents.append(sub_package)

    return contents
github enthought / envisage / envisage / developer / code_browser / code_browser.py View on Github external
# If the child is a Python file then parse it.
            if child.ext == '.py':
                contents.append(self.read_file(child.path, package))

            # If the child is a sub-package then recurse!
            elif child.is_package:
                if package is not None:
                    sub_package_name = '%s.%s' % (package.name, child.name)
                    sub_package = Package(
                        filename = child.path,
                        name     = sub_package_name,
                        parent   = package
                    )

                else:
                    sub_package = Package(filename=child.path, name=child.name)

                self.read_directory(child.path, sub_package)
                contents.append(sub_package)

        return contents