Browse Source

Documentation should now be compilable

master
Peter Zaitcev 6 months ago
parent
commit
c2d4bcdc34
8 changed files with 46 additions and 8 deletions
  1. + 1
    - 0
      .gitignore
  2. + 3
    - 2
      requirements.txt
  3. + 28
    - 0
      src/openapi_parser/parser/__init__.py
  4. + 1
    - 1
      src/openapi_parser/parser/loader.py
  5. + 0
    - 2
      src/openapi_parser/parser/model.py
  6. + 1
    - 0
      src/openapi_parser/util/__init__.py
  7. + 11
    - 3
      src/openapi_parser/util/_backports.py
  8. + 1
    - 0
      src/openapi_parser/util/typing_proxy.py

+ 1
- 0
.gitignore

@ -3,6 +3,7 @@
/.venv/
/.code-gen/
/html/
/dist/
/build/
__pycache__/

+ 3
- 2
requirements.txt

@ -1,4 +1,5 @@
stringcase
stringcase==1.2.0,<2.0.0
dataclasses-json>=0.2.13
dataclasses>=0.6
dataclasses>=0.6;python_version=="3.6"
functional-python>=0.0.6
lazy_object_proxy;python_version=="3.6"

+ 28
- 0
src/openapi_parser/parser/__init__.py

@ -0,0 +1,28 @@
from .date_formats import *
from .errors import *
from .filters import *
from .inheritance_support import *
from .loader import *
from .model import *
__all__ = [ ]
_submodules = \
[
date_formats,
errors,
filters,
inheritance_support,
loader,
model,
]
__pdoc__ = { }
for _submodule in _submodules:
_submodule_name = _submodule.__name__.partition(f'{__name__}.')[-1]
__all__.extend(_submodule.__all__)
__pdoc__[_submodule_name] = True
_submodule.__pdoc__ = getattr(_submodule, '__pdoc__', dict())
_extras = getattr(_submodule, '__pdoc_extras__', list())
for _element in _submodule.__all__:
__pdoc__[_element] = _element in _extras

+ 1
- 1
src/openapi_parser/parser/loader.py

@ -4,7 +4,7 @@ from typing import *
from functional import Option
from openapi_parser.model import Model, ModelClass, Filter, ModelSchema
from openapi_parser.util.backports import singledispatchmethod
from openapi_parser.util._backports import singledispatchmethod
from openapi_parser.util.typing_proxy import *
from .date_formats import DateFormatName
from .errors import *

+ 0
- 2
src/openapi_parser/parser/model.py

@ -146,8 +146,6 @@ def extract_metadata(f: Field) -> ModelSchema:
__all__ = \
[
'METADATA_KEY',
'ClassRef',
'ForwardRef',
'ModelClassImpl',

+ 1
- 0
src/openapi_parser/util/__init__.py

@ -0,0 +1 @@
pass

src/openapi_parser/util/backports.py → src/openapi_parser/util/_backports.py

@ -8,7 +8,8 @@ try:
except ImportError:
from functools import singledispatch, update_wrapper
class singledispatchmethod:
"""Single-dispatch generic method descriptor.
"""
Single-dispatch generic method descriptor.
Supports wrapping existing descriptors and handles non-descriptor
callables as instance methods.
"""
@ -16,12 +17,13 @@ except ImportError:
def __init__(self, func):
if not callable(func) and not hasattr(func, "__get__"):
raise TypeError(f"{func!r} is not callable or a descriptor")
self.dispatcher = singledispatch(func)
self.func = func
def register(self, cls, method=None):
"""generic_method.register(cls, func) -> func
"""
generic_method.register(cls, func) -> func
Registers a new implementation for the given *cls* on a *generic_method*.
"""
return self.dispatcher.register(cls, func=method)
@ -47,3 +49,9 @@ __all__ = \
'cached_property',
'singledispatchmethod',
]
__pdoc__ = \
{
'cached_property': False,
'singledispatchmethod': False,
}

+ 1
- 0
src/openapi_parser/util/typing_proxy.py

@ -145,6 +145,7 @@ def ref_name_pretty(obj) -> str:
__all__ = \
[
'GenericProxy',
'DictProxy',
'ListProxy',
'UnionProxy',

Loading…
Cancel
Save