1667 if os.path.exists(os.path.join(p, name)): |
1667 if os.path.exists(os.path.join(p, name)): |
1668 pathname = os.path.join(p, name) |
1668 pathname = os.path.join(p, name) |
1669 if ext == ".ptl": |
1669 if ext == ".ptl": |
1670 # Quixote page template |
1670 # Quixote page template |
1671 return ( |
1671 return ( |
1672 open(pathname), # __IGNORE_WARNING_Y115__ |
1672 open(pathname), # noqa: Y115 |
1673 pathname, |
1673 pathname, |
1674 (".ptl", "r", PTL_SOURCE), |
1674 (".ptl", "r", PTL_SOURCE), |
1675 ) |
1675 ) |
1676 elif ext == ".rb": |
1676 elif ext == ".rb": |
1677 # Ruby source file |
1677 # Ruby source file |
1678 return ( |
1678 return ( |
1679 open(pathname), # __IGNORE_WARNING_Y115__ |
1679 open(pathname), # noqa: Y115 |
1680 pathname, |
1680 pathname, |
1681 (".rb", "r", RB_SOURCE), |
1681 (".rb", "r", RB_SOURCE), |
1682 ) |
1682 ) |
1683 else: |
1683 else: |
1684 return ( |
1684 return ( |
1685 open(pathname), # __IGNORE_WARNING_Y115__ |
1685 open(pathname), # noqa: Y115 |
1686 pathname, |
1686 pathname, |
1687 (ext, "r", PY_SOURCE), |
1687 (ext, "r", PY_SOURCE), |
1688 ) |
1688 ) |
1689 raise ImportError |
1689 raise ImportError |
1690 |
1690 |
1695 spec = importlib.machinery.PathFinder.find_spec(name, path) |
1695 spec = importlib.machinery.PathFinder.find_spec(name, path) |
1696 if spec is None: |
1696 if spec is None: |
1697 raise ImportError |
1697 raise ImportError |
1698 if isinstance(spec.loader, importlib.machinery.SourceFileLoader): |
1698 if isinstance(spec.loader, importlib.machinery.SourceFileLoader): |
1699 ext = os.path.splitext(spec.origin)[-1] |
1699 ext = os.path.splitext(spec.origin)[-1] |
1700 return (open(spec.origin), spec.origin, (ext, "r", PY_SOURCE)) |
1700 return (open(spec.origin), spec.origin, (ext, "r", PY_SOURCE)) # noqa: Y115 |
1701 # __IGNORE_WARNING_Y115__ |
|
1702 |
1701 |
1703 raise ImportError |
1702 raise ImportError |
1704 |
1703 |
1705 |
1704 |
1706 def resetParsedModules(): |
1705 def resetParsedModules(): |