librovore 1.0a0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- librovore/__/__init__.py +31 -0
- librovore/__/doctab.py +83 -0
- librovore/__/imports.py +68 -0
- librovore/__/inscription.py +39 -0
- librovore/__/interfaces.py +57 -0
- librovore/__/nomina.py +32 -0
- librovore/__init__.py +43 -0
- librovore/__main__.py +28 -0
- librovore/_typedecls/bs4/__init__.pyi +34 -0
- librovore/_typedecls/bs4/_deprecation.pyi +7 -0
- librovore/_typedecls/bs4/_typing.pyi +15 -0
- librovore/_typedecls/bs4/_warnings.pyi +7 -0
- librovore/_typedecls/bs4/element.pyi +53 -0
- librovore/_typedecls/sphobjinv/__init__.pyi +54 -0
- librovore/_typedecls/sphobjinv/__main__.pyi.bak +36 -0
- librovore/_typedecls/sphobjinv/data.pyi.bak +386 -0
- librovore/_typedecls/sphobjinv/enum.pyi.bak +74 -0
- librovore/_typedecls/sphobjinv/error.pyi.bak +49 -0
- librovore/_typedecls/sphobjinv/fileops.pyi.bak +147 -0
- librovore/_typedecls/sphobjinv/inventory.pyi.bak +348 -0
- librovore/_typedecls/sphobjinv/re.pyi.bak +40 -0
- librovore/_typedecls/sphobjinv/schema.pyi.bak +37 -0
- librovore/_typedecls/sphobjinv/version.pyi.bak +35 -0
- librovore/_typedecls/sphobjinv/zlib.pyi.bak +81 -0
- librovore/cacheproxy.py +791 -0
- librovore/cli.py +645 -0
- librovore/data/.gitignore +0 -0
- librovore/data/configuration/general.toml +83 -0
- librovore/detection.py +286 -0
- librovore/exceptions.py +285 -0
- librovore/functions.py +463 -0
- librovore/interfaces.py +87 -0
- librovore/inventories/__.py +26 -0
- librovore/inventories/__init__.py +21 -0
- librovore/inventories/sphinx/__.py +25 -0
- librovore/inventories/sphinx/__init__.py +33 -0
- librovore/inventories/sphinx/detection.py +123 -0
- librovore/inventories/sphinx/main.py +81 -0
- librovore/processors.py +137 -0
- librovore/py.typed +0 -0
- librovore/search.py +148 -0
- librovore/server.py +297 -0
- librovore/state.py +37 -0
- librovore/structures/__.py +26 -0
- librovore/structures/__init__.py +21 -0
- librovore/structures/mkdocs/__.py +25 -0
- librovore/structures/mkdocs/__init__.py +31 -0
- librovore/structures/mkdocs/conversion.py +297 -0
- librovore/structures/mkdocs/detection.py +133 -0
- librovore/structures/mkdocs/extraction.py +402 -0
- librovore/structures/mkdocs/main.py +73 -0
- librovore/structures/sphinx/__.py +26 -0
- librovore/structures/sphinx/__init__.py +33 -0
- librovore/structures/sphinx/conversion.py +51 -0
- librovore/structures/sphinx/detection.py +113 -0
- librovore/structures/sphinx/extraction.py +411 -0
- librovore/structures/sphinx/main.py +101 -0
- librovore/structures/sphinx/urls.py +86 -0
- librovore/urls.py +48 -0
- librovore/xtnsapi.py +33 -0
- librovore/xtnsmgr/__.py +29 -0
- librovore/xtnsmgr/__init__.py +58 -0
- librovore/xtnsmgr/cachemgr.py +209 -0
- librovore/xtnsmgr/configuration.py +132 -0
- librovore/xtnsmgr/importation.py +254 -0
- librovore/xtnsmgr/installation.py +130 -0
- librovore/xtnsmgr/processors.py +113 -0
- librovore-1.0a0.dist-info/METADATA +319 -0
- librovore-1.0a0.dist-info/RECORD +72 -0
- librovore-1.0a0.dist-info/WHEEL +4 -0
- librovore-1.0a0.dist-info/entry_points.txt +2 -0
- librovore-1.0a0.dist-info/licenses/LICENSE.txt +202 -0
librovore/__/__init__.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# vim: set filetype=python fileencoding=utf-8:
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
#============================================================================#
|
|
5
|
+
# #
|
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); #
|
|
7
|
+
# you may not use this file except in compliance with the License. #
|
|
8
|
+
# You may obtain a copy of the License at #
|
|
9
|
+
# #
|
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0 #
|
|
11
|
+
# #
|
|
12
|
+
# Unless required by applicable law or agreed to in writing, software #
|
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS, #
|
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
|
15
|
+
# See the License for the specific language governing permissions and #
|
|
16
|
+
# limitations under the License. #
|
|
17
|
+
# #
|
|
18
|
+
#============================================================================#
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
''' Common constants, imports, and utilities. '''
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
from .doctab import (
|
|
25
|
+
access_doctab,
|
|
26
|
+
fragments as doctab,
|
|
27
|
+
)
|
|
28
|
+
from .imports import *
|
|
29
|
+
from .inscription import *
|
|
30
|
+
from .interfaces import *
|
|
31
|
+
from .nomina import *
|
librovore/__/doctab.py
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# vim: set filetype=python fileencoding=utf-8:
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
#============================================================================#
|
|
5
|
+
# #
|
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); #
|
|
7
|
+
# you may not use this file except in compliance with the License. #
|
|
8
|
+
# You may obtain a copy of the License at #
|
|
9
|
+
# #
|
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0 #
|
|
11
|
+
# #
|
|
12
|
+
# Unless required by applicable law or agreed to in writing, software #
|
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS, #
|
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
|
15
|
+
# See the License for the specific language governing permissions and #
|
|
16
|
+
# limitations under the License. #
|
|
17
|
+
# #
|
|
18
|
+
#============================================================================#
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
''' Docstrings table for reuse across entities. '''
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
from . import imports as __
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def access_doctab( name: str ) -> str:
|
|
28
|
+
''' Returns cleaned string corresponding to fragment. '''
|
|
29
|
+
return __.inspect.cleandoc( fragments[ name ] )
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
fragments: __.cabc.Mapping[ str, str ] = __.types.MappingProxyType( {
|
|
33
|
+
|
|
34
|
+
# Arguments
|
|
35
|
+
|
|
36
|
+
'group by argument':
|
|
37
|
+
''' Field to group results by (e.g., 'domain', 'role', 'priority'). ''',
|
|
38
|
+
|
|
39
|
+
'include snippets argument':
|
|
40
|
+
''' Include content snippets in results. ''',
|
|
41
|
+
|
|
42
|
+
'term argument':
|
|
43
|
+
''' Search term for documentation content. ''',
|
|
44
|
+
|
|
45
|
+
'query details argument':
|
|
46
|
+
''' Detail level for inventory results.
|
|
47
|
+
|
|
48
|
+
One of: Name, Signature, Summary, Documentation
|
|
49
|
+
''',
|
|
50
|
+
|
|
51
|
+
'results max argument':
|
|
52
|
+
''' Maximum number of results to return. ''',
|
|
53
|
+
|
|
54
|
+
'server port argument':
|
|
55
|
+
''' TCP port for server. ''',
|
|
56
|
+
|
|
57
|
+
'location argument':
|
|
58
|
+
''' URL or file path to documentation location. ''',
|
|
59
|
+
|
|
60
|
+
'term filter argument':
|
|
61
|
+
''' Filter objects by name containing this text. ''',
|
|
62
|
+
|
|
63
|
+
'transport argument':
|
|
64
|
+
''' Transport: stdio or sse. ''',
|
|
65
|
+
|
|
66
|
+
# Returns
|
|
67
|
+
|
|
68
|
+
'content query return':
|
|
69
|
+
''' Documentation content search results with relevance ranking.
|
|
70
|
+
Contains documents with signatures, descriptions, content snippets,
|
|
71
|
+
relevance scores, and match reasons.
|
|
72
|
+
''',
|
|
73
|
+
|
|
74
|
+
'inventory query return':
|
|
75
|
+
''' Inventory search results with configurable detail levels.
|
|
76
|
+
Contains project metadata, matching objects, and search metadata
|
|
77
|
+
with applied filters.
|
|
78
|
+
''',
|
|
79
|
+
|
|
80
|
+
'inventory summary return':
|
|
81
|
+
''' Human-readable summary of inventory contents. ''',
|
|
82
|
+
|
|
83
|
+
} )
|
librovore/__/imports.py
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# vim: set filetype=python fileencoding=utf-8:
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
#============================================================================#
|
|
5
|
+
# #
|
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); #
|
|
7
|
+
# you may not use this file except in compliance with the License. #
|
|
8
|
+
# You may obtain a copy of the License at #
|
|
9
|
+
# #
|
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0 #
|
|
11
|
+
# #
|
|
12
|
+
# Unless required by applicable law or agreed to in writing, software #
|
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS, #
|
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
|
15
|
+
# See the License for the specific language governing permissions and #
|
|
16
|
+
# limitations under the License. #
|
|
17
|
+
# #
|
|
18
|
+
#============================================================================#
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
''' Common imports used throughout the package. '''
|
|
22
|
+
|
|
23
|
+
# ruff: noqa: F401
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
import abc
|
|
27
|
+
import asyncio
|
|
28
|
+
import collections.abc as cabc
|
|
29
|
+
import collections
|
|
30
|
+
import contextlib as ctxl
|
|
31
|
+
import datetime
|
|
32
|
+
import dataclasses as dcls
|
|
33
|
+
import enum
|
|
34
|
+
import io
|
|
35
|
+
import inspect
|
|
36
|
+
import json
|
|
37
|
+
import locale
|
|
38
|
+
import platform
|
|
39
|
+
import re
|
|
40
|
+
import shutil
|
|
41
|
+
import stat
|
|
42
|
+
import subprocess
|
|
43
|
+
import sys
|
|
44
|
+
import time
|
|
45
|
+
import types
|
|
46
|
+
import warnings
|
|
47
|
+
|
|
48
|
+
from logging import getLogger as acquire_scribe
|
|
49
|
+
from pathlib import Path
|
|
50
|
+
|
|
51
|
+
import accretive as accret
|
|
52
|
+
import appcore
|
|
53
|
+
import dynadoc as ddoc
|
|
54
|
+
import detextive as detext
|
|
55
|
+
import exceptiongroup as excg
|
|
56
|
+
import frigid as immut
|
|
57
|
+
import typing_extensions as typx
|
|
58
|
+
# --- BEGIN: Injected by Copier ---
|
|
59
|
+
import tyro
|
|
60
|
+
# --- END: Injected by Copier ---
|
|
61
|
+
|
|
62
|
+
from absence import Absential, absent, is_absent
|
|
63
|
+
from appcore import asyncf, generics
|
|
64
|
+
from appcore.state import Globals
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
simple_tyro_class = tyro.conf.configure( )
|
|
68
|
+
standard_tyro_class = tyro.conf.configure( tyro.conf.OmitArgPrefixes )
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# vim: set filetype=python fileencoding=utf-8:
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
#============================================================================#
|
|
5
|
+
# #
|
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); #
|
|
7
|
+
# you may not use this file except in compliance with the License. #
|
|
8
|
+
# You may obtain a copy of the License at #
|
|
9
|
+
# #
|
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0 #
|
|
11
|
+
# #
|
|
12
|
+
# Unless required by applicable law or agreed to in writing, software #
|
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS, #
|
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
|
15
|
+
# See the License for the specific language governing permissions and #
|
|
16
|
+
# limitations under the License. #
|
|
17
|
+
# #
|
|
18
|
+
#============================================================================#
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
''' Logging utilities. '''
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
import logging as _logging
|
|
25
|
+
|
|
26
|
+
from . import imports as __
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def report_exceptions(
|
|
30
|
+
exception: BaseException | __.excg.ExceptionGroup[ Exception ],
|
|
31
|
+
scribe: _logging.Logger,
|
|
32
|
+
) -> None:
|
|
33
|
+
''' Reports exception groups or individual exceptions to logger. '''
|
|
34
|
+
if isinstance( exception, __.excg.ExceptionGroup ):
|
|
35
|
+
for exc in exception.exceptions: # pyright: ignore
|
|
36
|
+
report_exceptions( exc, scribe ) # pyright: ignore
|
|
37
|
+
else:
|
|
38
|
+
scribe.error( "{exception_class}: {exception}".format(
|
|
39
|
+
exception_class = type( exception ), exception = exception ) )
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# vim: set filetype=python fileencoding=utf-8:
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
#============================================================================#
|
|
5
|
+
# #
|
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); #
|
|
7
|
+
# you may not use this file except in compliance with the License. #
|
|
8
|
+
# You may obtain a copy of the License at #
|
|
9
|
+
# #
|
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0 #
|
|
11
|
+
# #
|
|
12
|
+
# Unless required by applicable law or agreed to in writing, software #
|
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS, #
|
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
|
15
|
+
# See the License for the specific language governing permissions and #
|
|
16
|
+
# limitations under the License. #
|
|
17
|
+
# #
|
|
18
|
+
#============================================================================#
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
''' Internal enumerations and interfaces. '''
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
from . import imports as __
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class DisplayStreams( __.enum.Enum ):
|
|
28
|
+
''' Stream upon which to place output. '''
|
|
29
|
+
|
|
30
|
+
Stderr = 'stderr'
|
|
31
|
+
Stdout = 'stdout'
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class DisplayTarget( __.immut.DataclassObject ):
|
|
35
|
+
silence: __.typx.Annotated[
|
|
36
|
+
bool,
|
|
37
|
+
__.tyro.conf.arg(
|
|
38
|
+
aliases = ( '--quiet', '--silent', ), prefix_name = False ),
|
|
39
|
+
] = False
|
|
40
|
+
file: __.typx.Annotated[
|
|
41
|
+
__.typx.Optional[ __.Path ],
|
|
42
|
+
__.tyro.conf.arg(
|
|
43
|
+
name = 'console-capture-file', prefix_name = False ),
|
|
44
|
+
] = None
|
|
45
|
+
stream: __.typx.Annotated[
|
|
46
|
+
DisplayStreams,
|
|
47
|
+
__.tyro.conf.arg( name = 'console-stream', prefix_name = False ),
|
|
48
|
+
] = DisplayStreams.Stderr
|
|
49
|
+
|
|
50
|
+
async def provide_stream( self ) -> __.io.TextIOWrapper:
|
|
51
|
+
''' Provides output stream for display. '''
|
|
52
|
+
if self.file: return open( self.file, 'w' )
|
|
53
|
+
match self.stream:
|
|
54
|
+
case DisplayStreams.Stdout:
|
|
55
|
+
return __.sys.stdout # pyright: ignore[reportReturnType]
|
|
56
|
+
case DisplayStreams.Stderr:
|
|
57
|
+
return __.sys.stderr # pyright: ignore[reportReturnType]
|
librovore/__/nomina.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# vim: set filetype=python fileencoding=utf-8:
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
#============================================================================#
|
|
5
|
+
# #
|
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); #
|
|
7
|
+
# you may not use this file except in compliance with the License. #
|
|
8
|
+
# You may obtain a copy of the License at #
|
|
9
|
+
# #
|
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0 #
|
|
11
|
+
# #
|
|
12
|
+
# Unless required by applicable law or agreed to in writing, software #
|
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS, #
|
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
|
15
|
+
# See the License for the specific language governing permissions and #
|
|
16
|
+
# limitations under the License. #
|
|
17
|
+
# #
|
|
18
|
+
#============================================================================#
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
''' Common names and type aliases. '''
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
from . import imports as __
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
ComparisonResult: __.typx.TypeAlias = bool | __.types.NotImplementedType
|
|
28
|
+
NominativeArguments: __.typx.TypeAlias = __.cabc.Mapping[ str, __.typx.Any ]
|
|
29
|
+
PositionalArguments: __.typx.TypeAlias = __.cabc.Sequence[ __.typx.Any ]
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
package_name = __name__.split( '.', maxsplit = 1 )[ 0 ]
|
librovore/__init__.py
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# vim: set filetype=python fileencoding=utf-8:
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
#============================================================================#
|
|
5
|
+
# #
|
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); #
|
|
7
|
+
# you may not use this file except in compliance with the License. #
|
|
8
|
+
# You may obtain a copy of the License at #
|
|
9
|
+
# #
|
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0 #
|
|
11
|
+
# #
|
|
12
|
+
# Unless required by applicable law or agreed to in writing, software #
|
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS, #
|
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
|
15
|
+
# See the License for the specific language governing permissions and #
|
|
16
|
+
# limitations under the License. #
|
|
17
|
+
# #
|
|
18
|
+
#============================================================================#
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
''' Model Context Protocol (MCP) server for Sphinx documentation. '''
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
from . import __
|
|
25
|
+
from . import server
|
|
26
|
+
from . import xtnsmgr
|
|
27
|
+
# --- BEGIN: Injected by Copier ---
|
|
28
|
+
from . import exceptions
|
|
29
|
+
# --- END: Injected by Copier ---
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
__version__: str
|
|
33
|
+
__version__ = '1.0a0'
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def main( ):
|
|
37
|
+
''' Entrypoint. '''
|
|
38
|
+
from .cli import execute
|
|
39
|
+
execute( )
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
__.immut.finalize_module(
|
|
43
|
+
__name__, dynadoc_table = __.doctab, recursive = True )
|
librovore/__main__.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# vim: set filetype=python fileencoding=utf-8:
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
#============================================================================#
|
|
5
|
+
# #
|
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); #
|
|
7
|
+
# you may not use this file except in compliance with the License. #
|
|
8
|
+
# You may obtain a copy of the License at #
|
|
9
|
+
# #
|
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0 #
|
|
11
|
+
# #
|
|
12
|
+
# Unless required by applicable law or agreed to in writing, software #
|
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS, #
|
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
|
15
|
+
# See the License for the specific language governing permissions and #
|
|
16
|
+
# limitations under the License. #
|
|
17
|
+
# #
|
|
18
|
+
#============================================================================#
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
''' Entrypoint. '''
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
# Note: Use absolute import for PyInstaller happiness.
|
|
25
|
+
from librovore.cli import execute
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
if '__main__' == __name__: execute( )
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"""Minimal type stubs for BeautifulSoup focusing on our usage."""
|
|
2
|
+
|
|
3
|
+
from typing import Any, Dict, List, Optional, Union
|
|
4
|
+
|
|
5
|
+
from ._warnings import (
|
|
6
|
+
AttributeResemblesVariableWarning,
|
|
7
|
+
GuessedAtParserWarning,
|
|
8
|
+
MarkupResemblesLocatorWarning,
|
|
9
|
+
UnusualUsageWarning,
|
|
10
|
+
XMLParsedAsHTMLWarning,
|
|
11
|
+
)
|
|
12
|
+
from .element import NavigableString, PageElement, Tag
|
|
13
|
+
|
|
14
|
+
__all__ = [
|
|
15
|
+
"BeautifulSoup",
|
|
16
|
+
"Tag",
|
|
17
|
+
"NavigableString",
|
|
18
|
+
"PageElement",
|
|
19
|
+
"AttributeResemblesVariableWarning",
|
|
20
|
+
"GuessedAtParserWarning",
|
|
21
|
+
"MarkupResemblesLocatorWarning",
|
|
22
|
+
"UnusualUsageWarning",
|
|
23
|
+
"XMLParsedAsHTMLWarning",
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
class BeautifulSoup(Tag):
|
|
27
|
+
"""A BeautifulSoup object representing a parsed HTML/XML document."""
|
|
28
|
+
|
|
29
|
+
def __init__(
|
|
30
|
+
self,
|
|
31
|
+
markup: Union[str, bytes] = ...,
|
|
32
|
+
features: Optional[Union[str, List[str]]] = ...,
|
|
33
|
+
**kwargs: Any
|
|
34
|
+
) -> None: ...
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""Minimal type annotations for BeautifulSoup."""
|
|
2
|
+
|
|
3
|
+
from typing import Any, Dict, List, Union
|
|
4
|
+
|
|
5
|
+
# Basic type aliases that BeautifulSoup uses
|
|
6
|
+
_Encoding = str
|
|
7
|
+
_Encodings = List[str]
|
|
8
|
+
_IncomingMarkup = Union[str, bytes]
|
|
9
|
+
_InsertableElement = Union[str, "PageElement"]
|
|
10
|
+
_RawAttributeValue = Union[str, List[str]]
|
|
11
|
+
_RawAttributeValues = Dict[str, _RawAttributeValue]
|
|
12
|
+
_RawMarkup = Union[str, bytes]
|
|
13
|
+
|
|
14
|
+
# Import the classes we need
|
|
15
|
+
from .element import PageElement
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"""Minimal warning stubs for BeautifulSoup."""
|
|
2
|
+
|
|
3
|
+
class AttributeResemblesVariableWarning(UserWarning): ...
|
|
4
|
+
class GuessedAtParserWarning(UserWarning): ...
|
|
5
|
+
class MarkupResemblesLocatorWarning(UserWarning): ...
|
|
6
|
+
class UnusualUsageWarning(UserWarning): ...
|
|
7
|
+
class XMLParsedAsHTMLWarning(UserWarning): ...
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"""Minimal type stubs for BeautifulSoup elements focusing on our usage."""
|
|
2
|
+
|
|
3
|
+
from typing import Any, Dict, List, Optional, Union
|
|
4
|
+
|
|
5
|
+
class PageElement:
|
|
6
|
+
"""Base class for all elements in the parse tree."""
|
|
7
|
+
|
|
8
|
+
def get_text(self, separator: str = ..., strip: bool = ...) -> str: ...
|
|
9
|
+
def decompose(self) -> None: ...
|
|
10
|
+
|
|
11
|
+
class NavigableString(str, PageElement):
|
|
12
|
+
"""A string that is part of the parse tree."""
|
|
13
|
+
pass
|
|
14
|
+
|
|
15
|
+
class Tag(PageElement):
|
|
16
|
+
"""An HTML/XML tag with attributes and contents."""
|
|
17
|
+
|
|
18
|
+
name: Optional[str]
|
|
19
|
+
|
|
20
|
+
def find(
|
|
21
|
+
self,
|
|
22
|
+
name: Optional[Union[str, List[str]]] = ...,
|
|
23
|
+
attrs: Optional[Dict[str, str]] = ...,
|
|
24
|
+
id: Optional[str] = ...,
|
|
25
|
+
**kwargs: str
|
|
26
|
+
) -> Optional["Tag"]: ...
|
|
27
|
+
|
|
28
|
+
def find_all(
|
|
29
|
+
self,
|
|
30
|
+
name: Optional[Union[str, List[str]]] = ...,
|
|
31
|
+
attrs: Optional[Dict[str, str]] = ...,
|
|
32
|
+
class_: Optional[str] = ...,
|
|
33
|
+
**kwargs: str
|
|
34
|
+
) -> List["Tag"]: ...
|
|
35
|
+
|
|
36
|
+
def find_parent(
|
|
37
|
+
self,
|
|
38
|
+
name: Optional[Union[str, List[str]]] = ...,
|
|
39
|
+
attrs: Optional[Dict[str, str]] = ...,
|
|
40
|
+
**kwargs: str
|
|
41
|
+
) -> Optional["Tag"]: ...
|
|
42
|
+
|
|
43
|
+
def find_next_sibling(
|
|
44
|
+
self,
|
|
45
|
+
name: Optional[Union[str, List[str]]] = ...,
|
|
46
|
+
attrs: Optional[Dict[str, str]] = ...,
|
|
47
|
+
**kwargs: str
|
|
48
|
+
) -> Optional["Tag"]: ...
|
|
49
|
+
|
|
50
|
+
def get(self, key: str, default: str = ...) -> str: ...
|
|
51
|
+
def get_text(self, separator: str = ..., strip: bool = ...) -> str: ...
|
|
52
|
+
def replace_with(self, *args: Union[str, "PageElement"]) -> "Tag": ...
|
|
53
|
+
def decompose(self) -> None: ...
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"""Minimal type stubs for sphobjinv - only what we actually use."""
|
|
2
|
+
|
|
3
|
+
from collections.abc import Sequence
|
|
4
|
+
from typing import Any, overload
|
|
5
|
+
|
|
6
|
+
class DataObjStr:
|
|
7
|
+
"""Sphinx inventory object data."""
|
|
8
|
+
name: str
|
|
9
|
+
domain: str
|
|
10
|
+
role: str
|
|
11
|
+
priority: str
|
|
12
|
+
uri: str
|
|
13
|
+
dispname: str
|
|
14
|
+
|
|
15
|
+
class Inventory:
|
|
16
|
+
"""Sphinx inventory containing project info and objects."""
|
|
17
|
+
project: str
|
|
18
|
+
version: str
|
|
19
|
+
objects: Sequence[DataObjStr]
|
|
20
|
+
|
|
21
|
+
def __init__(
|
|
22
|
+
self,
|
|
23
|
+
*,
|
|
24
|
+
url: str | None = None,
|
|
25
|
+
fname_zlib: str | None = None,
|
|
26
|
+
**kwargs: Any
|
|
27
|
+
) -> None: ...
|
|
28
|
+
|
|
29
|
+
@overload
|
|
30
|
+
def suggest(
|
|
31
|
+
self,
|
|
32
|
+
term: str,
|
|
33
|
+
*,
|
|
34
|
+
thresh: int = 75
|
|
35
|
+
) -> list[str]: ...
|
|
36
|
+
|
|
37
|
+
@overload
|
|
38
|
+
def suggest(
|
|
39
|
+
self,
|
|
40
|
+
term: str,
|
|
41
|
+
*,
|
|
42
|
+
thresh: int = 75,
|
|
43
|
+
with_score: bool
|
|
44
|
+
) -> list[str] | list[tuple[str, int]]: ...
|
|
45
|
+
|
|
46
|
+
def suggest(
|
|
47
|
+
self,
|
|
48
|
+
term: str,
|
|
49
|
+
*,
|
|
50
|
+
thresh: int = 75,
|
|
51
|
+
with_score: bool = False
|
|
52
|
+
) -> list[str] | list[tuple[str, int]]:
|
|
53
|
+
"""Return fuzzy match suggestions, optionally with scores."""
|
|
54
|
+
...
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This type stub file was generated by pyright.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
r"""``sphobjinv`` *package execution module*.
|
|
6
|
+
|
|
7
|
+
``sphobjinv`` is a toolkit for manipulation and inspection of
|
|
8
|
+
Sphinx |objects.inv| files.
|
|
9
|
+
|
|
10
|
+
**Author**
|
|
11
|
+
Brian Skinn (brian.skinn@gmail.com)
|
|
12
|
+
|
|
13
|
+
**File Created**
|
|
14
|
+
15 May 2020
|
|
15
|
+
|
|
16
|
+
**Copyright**
|
|
17
|
+
\(c) Brian Skinn 2016-2025
|
|
18
|
+
|
|
19
|
+
**Source Repository**
|
|
20
|
+
https://github.com/bskinn/sphobjinv
|
|
21
|
+
|
|
22
|
+
**Documentation**
|
|
23
|
+
https://sphobjinv.readthedocs.io/en/stable
|
|
24
|
+
|
|
25
|
+
**License**
|
|
26
|
+
Code: `MIT License`_
|
|
27
|
+
|
|
28
|
+
Docs & Docstrings: |CC BY 4.0|_
|
|
29
|
+
|
|
30
|
+
See |license_txt|_ for full license terms.
|
|
31
|
+
|
|
32
|
+
**Members**
|
|
33
|
+
|
|
34
|
+
"""
|
|
35
|
+
if __name__ == "__main__":
|
|
36
|
+
...
|