| | |
| | |
| | |
| | |
| |
|
| | import importlib.metadata |
| |
|
| | |
| | |
| | project = 'asyncgui' |
| | copyright = '2023, Mitō Nattōsai' |
| | author = 'Mitō Nattōsai' |
| | release = importlib.metadata.version(project) |
| |
|
| | rst_epilog = """ |
| | .. |ja| replace:: 🇯🇵 |
| | """ |
| |
|
| | |
| | |
| | extensions = [ |
| | 'sphinx.ext.autodoc', |
| | 'sphinx.ext.intersphinx', |
| | |
| | 'sphinx.ext.githubpages', |
| | 'sphinx_tabs.tabs', |
| |
|
| | ] |
| | templates_path = ['_templates'] |
| | exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] |
| | language = 'en' |
| | add_module_names = False |
| | gettext_auto_build = False |
| | gettext_location = False |
| |
|
| |
|
| | |
| | |
| | html_theme = "furo" |
| | html_static_path = ['_static'] |
| | html_theme_options = { |
| | "top_of_page_button": "edit", |
| | } |
| |
|
| | |
| | |
| | todo_include_todos = True |
| |
|
| | |
| | |
| | intersphinx_mapping = { |
| | 'python': ('https://docs.python.org/3', None), |
| | 'trio': ('https://trio.readthedocs.io/en/stable/', None), |
| | 'trio_util': ('https://trio-util.readthedocs.io/en/latest/', None), |
| | 'requests': ('https://docs.python-requests.org/en/latest/', None), |
| | 'asyncgui_ext.synctools': ('https://asyncgui.github.io/asyncgui-ext-synctools/', None), |
| | } |
| |
|
| |
|
| | |
| | |
| | sphinx_tabs_disable_tab_closing = True |
| |
|
| |
|
| | |
| | |
| |
|
| | def modify_signature(app, what: str, name: str, obj, options, signature, return_annotation: str, |
| | prefix="asyncgui.", |
| | len_prefix=len("asyncgui."), |
| | group1={'CancelScope', 'Nursery', 'TaskState', 'Task.cancel', 'Task.close', }, |
| | group2={'current_task', 'sleep_forever', 'open_nursery', }, |
| | |
| | group4={'wait_all_cm', 'wait_any_cm', 'run_as_daemon', 'run_as_main', }, |
| | group5={'open_nursery', }, |
| | ): |
| | if not name.startswith(prefix): |
| | return (signature, return_annotation, ) |
| | name = name[len_prefix:] |
| | if name in group1: |
| | print(f"Hide the signature of {name!r}") |
| | return ('', None) |
| | if name in group2: |
| | print(f"Modify the signature of {name!r}") |
| | return ('()', return_annotation) |
| | if name in group4: |
| | print(f"add a return-annotation to {name!r}") |
| | return (signature, '~typing.AsyncContextManager[Task]') |
| | if name in group5: |
| | print(f"Modify the return-annotation of {name!r}") |
| | return (signature, return_annotation.replace("AsyncIterator", "AsyncContextManager")) |
| | return (signature, return_annotation, ) |
| |
|
| |
|
| | def setup(app): |
| | app.connect('autodoc-process-signature', modify_signature) |
| |
|