MCPcopy
hub / github.com/sphinx-doc/sphinx / loads

Method loads

sphinx/util/inventory.py:45–63  ·  view source on GitHub ↗
(
        cls,
        content: bytes,
        *,
        uri: str,
    )

Source from the content-addressed store, hash-verified

43class InventoryFile:
44 @classmethod
45 def loads(
46 cls,
47 content: bytes,
48 *,
49 uri: str,
50 ) -> _Inventory:
51 format_line, _, content = content.partition(b'\n')
52 format_line = format_line.rstrip() # remove trailing \r or spaces
53 if format_line == b'# Sphinx inventory version 2':
54 return cls._loads_v2(content, uri=uri)
55 if format_line == b'# Sphinx inventory version 1':
56 lines = content.decode().splitlines()
57 return cls._loads_v1(lines, uri=uri)
58 if format_line.startswith(b'# Sphinx inventory version '):
59 unknown_version = format_line[27:].decode()
60 msg = f'unknown or unsupported inventory version: {unknown_version!r}'
61 raise ValueError(msg)
62 msg = f'invalid inventory header: {format_line.decode()}'
63 raise ValueError(msg)
64
65 @classmethod
66 def load(cls, stream: _SupportsRead, uri: str, joinfunc: _JoinFunc) -> Inventory:

Callers 15

_load_theme_tomlFunction · 0.45
mergeMethod · 0.45
get_doctreeMethod · 0.45
_load_inventoryFunction · 0.45
loadMethod · 0.45
test_pickleablilityFunction · 0.45
load_searchindexFunction · 0.45
test_read_inventory_v1Function · 0.45
test_read_inventory_v2Function · 0.45

Calls 2

_loads_v2Method · 0.80
_loads_v1Method · 0.80

Tested by 15

test_pickleablilityFunction · 0.36
load_searchindexFunction · 0.36
test_read_inventory_v1Function · 0.36
test_read_inventory_v2Function · 0.36
test_durationFunction · 0.36
test_buildFunction · 0.36
test_defaultsFunction · 0.36