コード例 #1
0
ファイル: conftest.py プロジェクト: tarsbase/pipenv
 def dumps(self):
     source_table = tomlkit.table()
     source_table["url"] = os.environ.get("PIPENV_TEST_INDEX")
     source_table["verify_ssl"] = False
     source_table["name"] = "pipenv_test_index"
     self.document["sources"].append(source_table)
     return tomlkit.dumps(self.document)
コード例 #2
0
ファイル: conftest.py プロジェクト: theasylum/pipenv
 def dumps(self):
     source_table = tomlkit.table()
     pypi_url = os.environ.get("PIPENV_PYPI_URL", "https://pypi.org/simple")
     source_table["url"] = os.environ.get("PIPENV_TEST_INDEX", pypi_url)
     source_table["verify_ssl"] = False
     source_table["name"] = "pipenv_test_index"
     self.document["source"].append(source_table)
     return tomlkit.dumps(self.document)
コード例 #3
0
ファイル: pipfile.py プロジェクト: wwjiang007/pipenv
 def load(cls, f, encoding=None):
     # type: (Any, Text) -> PipfileLoader
     content = f.read()
     if encoding is not None:
         content = content.decode(encoding)
     _data = tomlkit.loads(content)
     should_reload = "source" not in _data
     _data = reorder_source_keys(_data)
     if should_reload:
         if "sources" in _data:
             content = tomlkit.dumps(_data)
         else:
             # HACK: There is no good way to prepend a section to an existing
             # TOML document, but there's no good way to copy non-structural
             # content from one TOML document to another either. Modify the
             # TOML content directly, and load the new in-memory document.
             sep = "" if content.startswith("\n") else "\n"
             content = plette.pipfiles.DEFAULT_SOURCE_TOML + sep + content
     data = tomlkit.loads(content)
     data = cls.ensure_package_sections(data)
     instance = cls(data)
     instance._data = dict(instance._data)
     return instance
コード例 #4
0
ファイル: pipfiles.py プロジェクト: wwjiang007/pipenv
 def dump(self, f, encoding=None):
     content = tomlkit.dumps(self._data)
     if encoding is not None:
         content = content.encode(encoding)
     f.write(content)