Linux iad1-shared-b7-18 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
Apache
: 67.205.6.31 | : 216.73.216.47
Cant Read [ /etc/named.conf ]
8.2.29
fernandoquevedo
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
README
+ Create Folder
+ Create File
/
usr /
lib /
python3 /
dist-packages /
sphinx /
util /
[ HOME SHELL ]
Name
Size
Permission
Action
__pycache__
[ DIR ]
drwxr-xr-x
stemmer
[ DIR ]
drwxr-xr-x
__init__.py
19.24
KB
-rw-r--r--
build_phase.py
417
B
-rw-r--r--
cfamily.py
13.96
KB
-rw-r--r--
compat.py
1.2
KB
-rw-r--r--
console.py
3.48
KB
-rw-r--r--
docfields.py
16.11
KB
-rw-r--r--
docstrings.py
3.65
KB
-rw-r--r--
docutils.py
18.53
KB
-rw-r--r--
fileutil.py
3.72
KB
-rw-r--r--
i18n.py
9.71
KB
-rw-r--r--
images.py
2.92
KB
-rw-r--r--
inspect.py
31.36
KB
-rw-r--r--
inventory.py
6.28
KB
-rw-r--r--
jsdump.py
5.69
KB
-rw-r--r--
logging.py
17.92
KB
-rw-r--r--
matching.py
3.22
KB
-rw-r--r--
math.py
1.85
KB
-rw-r--r--
nodes.py
22.31
KB
-rw-r--r--
osutil.py
6.79
KB
-rw-r--r--
parallel.py
5.28
KB
-rw-r--r--
png.py
1.56
KB
-rw-r--r--
pycompat.py
2.04
KB
-rw-r--r--
requests.py
4.06
KB
-rw-r--r--
rst.py
3.35
KB
-rw-r--r--
smartypants.py
15.61
KB
-rw-r--r--
tags.py
2.72
KB
-rw-r--r--
template.py
4.65
KB
-rw-r--r--
texescape.py
5.46
KB
-rw-r--r--
typing.py
18.44
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : inventory.py
""" sphinx.util.inventory ~~~~~~~~~~~~~~~~~~~~~ Inventory utility functions for Sphinx. :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ import os import re import zlib from typing import IO, TYPE_CHECKING, Callable, Iterator from sphinx.util import logging from sphinx.util.typing import Inventory BUFSIZE = 16 * 1024 logger = logging.getLogger(__name__) if TYPE_CHECKING: from sphinx.builders import Builder from sphinx.environment import BuildEnvironment class InventoryFileReader: """A file reader for an inventory file. This reader supports mixture of texts and compressed texts. """ def __init__(self, stream: IO) -> None: self.stream = stream self.buffer = b'' self.eof = False def read_buffer(self) -> None: chunk = self.stream.read(BUFSIZE) if chunk == b'': self.eof = True self.buffer += chunk def readline(self) -> str: pos = self.buffer.find(b'\n') if pos != -1: line = self.buffer[:pos].decode() self.buffer = self.buffer[pos + 1:] elif self.eof: line = self.buffer.decode() self.buffer = b'' else: self.read_buffer() line = self.readline() return line def readlines(self) -> Iterator[str]: while not self.eof: line = self.readline() if line: yield line def read_compressed_chunks(self) -> Iterator[bytes]: decompressor = zlib.decompressobj() while not self.eof: self.read_buffer() yield decompressor.decompress(self.buffer) self.buffer = b'' yield decompressor.flush() def read_compressed_lines(self) -> Iterator[str]: buf = b'' for chunk in self.read_compressed_chunks(): buf += chunk pos = buf.find(b'\n') while pos != -1: yield buf[:pos].decode() buf = buf[pos + 1:] pos = buf.find(b'\n') class InventoryFile: @classmethod def load(cls, stream: IO, uri: str, joinfunc: Callable) -> Inventory: reader = InventoryFileReader(stream) line = reader.readline().rstrip() if line == '# Sphinx inventory version 1': return cls.load_v1(reader, uri, joinfunc) elif line == '# Sphinx inventory version 2': return cls.load_v2(reader, uri, joinfunc) else: raise ValueError('invalid inventory header: %s' % line) @classmethod def load_v1(cls, stream: InventoryFileReader, uri: str, join: Callable) -> Inventory: invdata: Inventory = {} projname = stream.readline().rstrip()[11:] version = stream.readline().rstrip()[11:] for line in stream.readlines(): name, type, location = line.rstrip().split(None, 2) location = join(uri, location) # version 1 did not add anchors to the location if type == 'mod': type = 'py:module' location += '#module-' + name else: type = 'py:' + type location += '#' + name invdata.setdefault(type, {})[name] = (projname, version, location, '-') return invdata @classmethod def load_v2(cls, stream: InventoryFileReader, uri: str, join: Callable) -> Inventory: invdata: Inventory = {} projname = stream.readline().rstrip()[11:] version = stream.readline().rstrip()[11:] line = stream.readline() if 'zlib' not in line: raise ValueError('invalid inventory header (not compressed): %s' % line) for line in stream.read_compressed_lines(): # be careful to handle names with embedded spaces correctly m = re.match(r'(?x)(.+?)\s+(\S+)\s+(-?\d+)\s+?(\S*)\s+(.*)', line.rstrip()) if not m: continue name, type, prio, location, dispname = m.groups() if ':' not in type: # wrong type value. type should be in the form of "{domain}:{objtype}" # # Note: To avoid the regex DoS, this is implemented in python (refs: #8175) continue if type == 'py:module' and type in invdata and name in invdata[type]: # due to a bug in 1.1 and below, # two inventory entries are created # for Python modules, and the first # one is correct continue if location.endswith('$'): location = location[:-1] + name location = join(uri, location) invdata.setdefault(type, {})[name] = (projname, version, location, dispname) return invdata @classmethod def dump(cls, filename: str, env: "BuildEnvironment", builder: "Builder") -> None: def escape(string: str) -> str: return re.sub("\\s+", " ", string) with open(os.path.join(filename), 'wb') as f: # header f.write(('# Sphinx inventory version 2\n' '# Project: %s\n' '# Version: %s\n' '# The remainder of this file is compressed using zlib.\n' % (escape(env.config.project), escape(env.config.version))).encode()) # body compressor = zlib.compressobj(9) for domainname, domain in sorted(env.domains.items()): for name, dispname, typ, docname, anchor, prio in \ sorted(domain.get_objects()): if anchor.endswith(name): # this can shorten the inventory by as much as 25% anchor = anchor[:-len(name)] + '$' uri = builder.get_target_uri(docname) if anchor: uri += '#' + anchor if dispname == name: dispname = '-' entry = ('%s %s:%s %s %s %s\n' % (name, domainname, typ, prio, uri, dispname)) f.write(compressor.compress(entry.encode())) f.write(compressor.flush())
Close