PKM¤"HJossgithub_com/__init__.pyimport sys import pip class IntermediateModule: """Module for paths like `github_com.nvbn`.""" def __init__(self, fullname): self._fullname = fullname self.__package__ = fullname self.__path__ = fullname.split('.') self.__name__ = fullname class GithubComFinder: """Handles `github_com....` modules.""" def find_module(self, module_name, package_path): if module_name.startswith('github_com'): return GithubComLoader() class GithubComLoader: """Installs and imports modules from github.""" def _is_installed(self, fullname): try: __import__(self._get_module_name(fullname)) return True except ImportError: return False def _get_module_name(self, fullname): return '.'.join(fullname.split('.')[2:]) def _install_module(self, fullname): if not self._is_installed(fullname): url = fullname.replace('.', '/') \ .replace('github_com', 'git+https://github.com', 1) pip.main(['install', url]) def _is_repository_path(self, fullname): return fullname.count('.') == 2 def _is_intermediate_path(self, fullname): return fullname.count('.') < 2 def load_module(self, fullname): if self._is_repository_path(fullname): self._install_module(fullname) if self._is_intermediate_path(fullname): module = IntermediateModule(fullname) else: module = __import__(self._get_module_name(fullname)) sys.modules[fullname] = module sys.meta_path.append(GithubComFinder()) PK¡¤"H^-Ò 4import_from_github_com-0.1.dist-info/DESCRIPTION.rstUNKNOWN PK¡¤"H€€k ÏÏ2import_from_github_com-0.1.dist-info/metadata.json{"extensions": {"python.details": {"contacts": [{"email": "nvbn.rm@gmail.com", "name": "Vladimir Iakovlev", "role": "author"}], "document_names": {"description": "DESCRIPTION.rst"}, "project_urls": {"Home": "https://github.com/nvbn/import_from_github_com"}}}, "generator": "bdist_wheel (0.26.0)", "license": "MIT", "metadata_version": "2.0", "name": "import-from-github-com", "summary": "Python module finder/loader from github, like in golang", "version": "0.1"}PK¡¤"HùjŠ 2import_from_github_com-0.1.dist-info/top_level.txtgithub_com PK¡¤"H}À‚¼\\*import_from_github_com-0.1.dist-info/WHEELWheel-Version: 1.0 Generator: bdist_wheel (0.26.0) Root-Is-Purelib: true Tag: py3-none-any PK¡¤"H{«òc-import_from_github_com-0.1.dist-info/METADATAMetadata-Version: 2.0 Name: import-from-github-com Version: 0.1 Summary: Python module finder/loader from github, like in golang Home-page: https://github.com/nvbn/import_from_github_com Author: Vladimir Iakovlev Author-email: nvbn.rm@gmail.com License: MIT Platform: UNKNOWN UNKNOWN PK¡¤"Hù³)ˆˆ+import_from_github_com-0.1.dist-info/RECORDgithub_com/__init__.py,sha256=0o_c_jVuaWIScB0jRDkAK6nncgbs4yb2QcJJBnNYcvo,1651 import_from_github_com-0.1.dist-info/DESCRIPTION.rst,sha256=OCTuuN6LcWulhHS3d5rfjdsQtW22n7HENFRh6jC6ego,10 import_from_github_com-0.1.dist-info/METADATA,sha256=aXVPv7JtikPZl_7nGl0GQPn-rj-cXWT5z_UG07tJeZE,287 import_from_github_com-0.1.dist-info/RECORD,, import_from_github_com-0.1.dist-info/WHEEL,sha256=zX7PHtH_7K-lEzyK75et0UBa3Bj8egCBMXe1M4gc6SU,92 import_from_github_com-0.1.dist-info/metadata.json,sha256=wUEd4Ob-zI63lQeaex2oa4NkZ2ccPFNfTsw9NyZp-wU,463 import_from_github_com-0.1.dist-info/top_level.txt,sha256=6vfr-kSk3B0qtTIXaxda0egc18Kok-_zWfjqtt4Y3a0,11 PKM¤"HJossgithub_com/__init__.pyPK¡¤"H^-Ò 4§import_from_github_com-0.1.dist-info/DESCRIPTION.rstPK¡¤"H€€k ÏÏ2import_from_github_com-0.1.dist-info/metadata.jsonPK¡¤"HùjŠ 2" import_from_github_com-0.1.dist-info/top_level.txtPK¡¤"H}À‚¼\\*} import_from_github_com-0.1.dist-info/WHEELPK¡¤"H{«òc-! import_from_github_com-0.1.dist-info/METADATAPK¡¤"Hù³)ˆˆ+‹ import_from_github_com-0.1.dist-info/RECORDPKr\