docsstrings

This commit is contained in:
Will McGugan
2022-05-25 16:20:04 +01:00
parent 6bfc26c1ec
commit 43e9f8add9
5 changed files with 47 additions and 39 deletions

64
poetry.lock generated
View File

@@ -35,7 +35,7 @@ frozenlist = ">=1.1.0"
name = "astunparse" name = "astunparse"
version = "1.6.3" version = "1.6.3"
description = "An AST unparser for Python" description = "An AST unparser for Python"
category = "main" category = "dev"
optional = false optional = false
python-versions = "*" python-versions = "*"
@@ -110,7 +110,7 @@ uvloop = ["uvloop (>=0.15.2)"]
name = "cached-property" name = "cached-property"
version = "1.5.2" version = "1.5.2"
description = "A decorator for caching properties in classes." description = "A decorator for caching properties in classes."
category = "main" category = "dev"
optional = false optional = false
python-versions = "*" python-versions = "*"
@@ -207,7 +207,7 @@ python-versions = ">=3.7"
name = "ghp-import" name = "ghp-import"
version = "2.1.0" version = "2.1.0"
description = "Copy your docs directly to the gh-pages branch." description = "Copy your docs directly to the gh-pages branch."
category = "main" category = "dev"
optional = false optional = false
python-versions = "*" python-versions = "*"
@@ -221,7 +221,7 @@ dev = ["twine", "markdown", "flake8", "wheel"]
name = "griffe" name = "griffe"
version = "0.19.2" version = "0.19.2"
description = "Signatures for entire Python programs. Extract the structure, the frame, the skeleton of your project, to generate API documentation or find breaking changes in your API." description = "Signatures for entire Python programs. Extract the structure, the frame, the skeleton of your project, to generate API documentation or find breaking changes in your API."
category = "main" category = "dev"
optional = false optional = false
python-versions = ">=3.7" python-versions = ">=3.7"
@@ -279,7 +279,7 @@ python-versions = "*"
name = "jinja2" name = "jinja2"
version = "3.0.3" version = "3.0.3"
description = "A very fast and expressive template engine." description = "A very fast and expressive template engine."
category = "main" category = "dev"
optional = false optional = false
python-versions = ">=3.6" python-versions = ">=3.6"
@@ -293,7 +293,7 @@ i18n = ["Babel (>=2.7)"]
name = "markdown" name = "markdown"
version = "3.3.7" version = "3.3.7"
description = "Python implementation of Markdown." description = "Python implementation of Markdown."
category = "main" category = "dev"
optional = false optional = false
python-versions = ">=3.6" python-versions = ">=3.6"
@@ -307,7 +307,7 @@ testing = ["coverage", "pyyaml"]
name = "markupsafe" name = "markupsafe"
version = "2.1.1" version = "2.1.1"
description = "Safely add untrusted strings to HTML/XML markup." description = "Safely add untrusted strings to HTML/XML markup."
category = "main" category = "dev"
optional = false optional = false
python-versions = ">=3.7" python-versions = ">=3.7"
@@ -315,7 +315,7 @@ python-versions = ">=3.7"
name = "mergedeep" name = "mergedeep"
version = "1.3.4" version = "1.3.4"
description = "A deep merge function for 🐍." description = "A deep merge function for 🐍."
category = "main" category = "dev"
optional = false optional = false
python-versions = ">=3.6" python-versions = ">=3.6"
@@ -323,7 +323,7 @@ python-versions = ">=3.6"
name = "mkdocs" name = "mkdocs"
version = "1.3.0" version = "1.3.0"
description = "Project documentation with Markdown." description = "Project documentation with Markdown."
category = "main" category = "dev"
optional = false optional = false
python-versions = ">=3.6" python-versions = ">=3.6"
@@ -346,7 +346,7 @@ i18n = ["babel (>=2.9.0)"]
name = "mkdocs-autorefs" name = "mkdocs-autorefs"
version = "0.4.1" version = "0.4.1"
description = "Automatically link across pages in MkDocs." description = "Automatically link across pages in MkDocs."
category = "main" category = "dev"
optional = false optional = false
python-versions = ">=3.7" python-versions = ">=3.7"
@@ -356,19 +356,19 @@ mkdocs = ">=1.1"
[[package]] [[package]]
name = "mkdocs-material" name = "mkdocs-material"
version = "7.3.6" version = "8.2.15"
description = "A Material Design theme for MkDocs" description = "Documentation that simply works"
category = "dev" category = "dev"
optional = false optional = false
python-versions = "*" python-versions = ">=3.7"
[package.dependencies] [package.dependencies]
jinja2 = ">=2.11.1" jinja2 = ">=2.11.1"
markdown = ">=3.2" markdown = ">=3.2"
mkdocs = ">=1.2.3" mkdocs = ">=1.3.0"
mkdocs-material-extensions = ">=1.0" mkdocs-material-extensions = ">=1.0.3"
pygments = ">=2.10" pygments = ">=2.12"
pymdown-extensions = ">=9.0" pymdown-extensions = ">=9.4"
[[package]] [[package]]
name = "mkdocs-material-extensions" name = "mkdocs-material-extensions"
@@ -382,7 +382,7 @@ python-versions = ">=3.6"
name = "mkdocstrings" name = "mkdocstrings"
version = "0.18.1" version = "0.18.1"
description = "Automatic documentation from sources, for MkDocs." description = "Automatic documentation from sources, for MkDocs."
category = "main" category = "dev"
optional = false optional = false
python-versions = ">=3.7" python-versions = ">=3.7"
@@ -405,7 +405,7 @@ python-legacy = ["mkdocstrings-python-legacy (>=0.2.1)"]
name = "mkdocstrings-python" name = "mkdocstrings-python"
version = "0.6.6" version = "0.6.6"
description = "A Python handler for mkdocstrings." description = "A Python handler for mkdocstrings."
category = "main" category = "dev"
optional = false optional = false
python-versions = ">=3.7" python-versions = ">=3.7"
@@ -417,7 +417,7 @@ mkdocstrings = ">=0.18"
name = "mkdocstrings-python-legacy" name = "mkdocstrings-python-legacy"
version = "0.2.2" version = "0.2.2"
description = "A legacy Python handler for mkdocstrings." description = "A legacy Python handler for mkdocstrings."
category = "main" category = "dev"
optional = false optional = false
python-versions = ">=3.7" python-versions = ">=3.7"
@@ -480,7 +480,7 @@ python-versions = "*"
name = "packaging" name = "packaging"
version = "21.3" version = "21.3"
description = "Core utilities for Python packages" description = "Core utilities for Python packages"
category = "main" category = "dev"
optional = false optional = false
python-versions = ">=3.6" python-versions = ">=3.6"
@@ -559,7 +559,7 @@ python-versions = ">=3.6"
name = "pymdown-extensions" name = "pymdown-extensions"
version = "9.4" version = "9.4"
description = "Extension pack for Python Markdown." description = "Extension pack for Python Markdown."
category = "main" category = "dev"
optional = false optional = false
python-versions = ">=3.7" python-versions = ">=3.7"
@@ -570,7 +570,7 @@ markdown = ">=3.2"
name = "pyparsing" name = "pyparsing"
version = "3.0.9" version = "3.0.9"
description = "pyparsing module - Classes and methods to define and execute parsing grammars" description = "pyparsing module - Classes and methods to define and execute parsing grammars"
category = "main" category = "dev"
optional = false optional = false
python-versions = ">=3.6.8" python-versions = ">=3.6.8"
@@ -650,7 +650,7 @@ testing = ["fields", "hunter", "process-tests", "six", "pytest-xdist", "virtuale
name = "python-dateutil" name = "python-dateutil"
version = "2.8.2" version = "2.8.2"
description = "Extensions to the standard Python datetime module" description = "Extensions to the standard Python datetime module"
category = "main" category = "dev"
optional = false optional = false
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7" python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7"
@@ -661,7 +661,7 @@ six = ">=1.5"
name = "pytkdocs" name = "pytkdocs"
version = "0.16.1" version = "0.16.1"
description = "Load Python objects documentation." description = "Load Python objects documentation."
category = "main" category = "dev"
optional = false optional = false
python-versions = ">=3.7" python-versions = ">=3.7"
@@ -677,7 +677,7 @@ numpy-style = ["docstring_parser (>=0.7)"]
name = "pyyaml" name = "pyyaml"
version = "6.0" version = "6.0"
description = "YAML parser and emitter for Python" description = "YAML parser and emitter for Python"
category = "main" category = "dev"
optional = false optional = false
python-versions = ">=3.6" python-versions = ">=3.6"
@@ -685,7 +685,7 @@ python-versions = ">=3.6"
name = "pyyaml-env-tag" name = "pyyaml-env-tag"
version = "0.1" version = "0.1"
description = "A custom YAML tag for referencing environment variables in YAML files. " description = "A custom YAML tag for referencing environment variables in YAML files. "
category = "main" category = "dev"
optional = false optional = false
python-versions = ">=3.6" python-versions = ">=3.6"
@@ -712,7 +712,7 @@ jupyter = ["ipywidgets (>=7.5.1,<8.0.0)"]
name = "six" name = "six"
version = "1.16.0" version = "1.16.0"
description = "Python 2 and 3 compatibility utilities" description = "Python 2 and 3 compatibility utilities"
category = "main" category = "dev"
optional = false optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*"
@@ -782,7 +782,7 @@ testing = ["coverage (>=4)", "coverage-enable-subprocess (>=1)", "flaky (>=3)",
name = "watchdog" name = "watchdog"
version = "2.1.8" version = "2.1.8"
description = "Filesystem events monitoring" description = "Filesystem events monitoring"
category = "main" category = "dev"
optional = false optional = false
python-versions = ">=3.6" python-versions = ">=3.6"
@@ -817,7 +817,7 @@ testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-
[metadata] [metadata]
lock-version = "1.1" lock-version = "1.1"
python-versions = "^3.7" python-versions = "^3.7"
content-hash = "f32bca17ffa867133de5437f87390b1122fb84ee9c0b6eafab03f8c518fe6c15" content-hash = "bfa71851a0d29adf2bf6de97054967e2122355bdefe859439bca5ec4377c9992"
[metadata.files] [metadata.files]
aiohttp = [ aiohttp = [
@@ -1166,8 +1166,8 @@ mkdocs-autorefs = [
{file = "mkdocs_autorefs-0.4.1-py3-none-any.whl", hash = "sha256:a2248a9501b29dc0cc8ba4c09f4f47ff121945f6ce33d760f145d6f89d313f5b"}, {file = "mkdocs_autorefs-0.4.1-py3-none-any.whl", hash = "sha256:a2248a9501b29dc0cc8ba4c09f4f47ff121945f6ce33d760f145d6f89d313f5b"},
] ]
mkdocs-material = [ mkdocs-material = [
{file = "mkdocs-material-7.3.6.tar.gz", hash = "sha256:1b1dbd8ef2508b358d93af55a5c5db3f141c95667fad802301ec621c40c7c217"}, {file = "mkdocs-material-8.2.15.tar.gz", hash = "sha256:93b57e53733051431cc83216446e774bdf08bf516a6251ff2f24974f45f98149"},
{file = "mkdocs_material-7.3.6-py2.py3-none-any.whl", hash = "sha256:1b6b3e9e09f922c2d7f1160fe15c8f43d4adc0d6fb81aa6ff0cbc7ef5b78ec75"}, {file = "mkdocs_material-8.2.15-py2.py3-none-any.whl", hash = "sha256:9d6c4ca1ceecc00b2e38c214665ed7605d275321dcaa22f38b9d1175edc58955"},
] ]
mkdocs-material-extensions = [ mkdocs-material-extensions = [
{file = "mkdocs-material-extensions-1.0.3.tar.gz", hash = "sha256:bfd24dfdef7b41c312ede42648f9eb83476ea168ec163b613f9abd12bbfddba2"}, {file = "mkdocs-material-extensions-1.0.3.tar.gz", hash = "sha256:bfd24dfdef7b41c312ede42648f9eb83476ea168ec163b613f9abd12bbfddba2"},

View File

@@ -28,7 +28,6 @@ click = "8.1.2"
importlib-metadata = "^4.11.3" importlib-metadata = "^4.11.3"
typing-extensions = { version = "^4.0.0", python = "<3.8" } typing-extensions = { version = "^4.0.0", python = "<3.8" }
msgpack = "^1.0.3" msgpack = "^1.0.3"
mkdocstrings = {extras = ["python"], version = "^0.18.1"}
[tool.poetry.dev-dependencies] [tool.poetry.dev-dependencies]
pytest = "^6.2.3" pytest = "^6.2.3"
@@ -36,8 +35,8 @@ black = "^22.3.0"
mypy = "^0.950" mypy = "^0.950"
pytest-cov = "^2.12.1" pytest-cov = "^2.12.1"
mkdocs = "^1.3.0" mkdocs = "^1.3.0"
mkdocstrings = "^0.18.1" mkdocstrings = {extras = ["python"], version = "^0.18.1"}
mkdocs-material = "^7.3.6" mkdocs-material = "^8.2.15"
pre-commit = "^2.13.0" pre-commit = "^2.13.0"
pytest-aiohttp = "^1.0.4" pytest-aiohttp = "^1.0.4"
time-machine = "^2.6.0" time-machine = "^2.6.0"

View File

@@ -32,7 +32,7 @@ import rich.repr
from rich.console import Console, RenderableType from rich.console import Console, RenderableType
from rich.measure import Measurement from rich.measure import Measurement
from rich.protocol import is_renderable from rich.protocol import is_renderable
from rich.segment import Segments from rich.segment import Segments, SegmentLines
from rich.traceback import Traceback from rich.traceback import Traceback
from . import actions from . import actions
@@ -441,7 +441,9 @@ class App(Generic[ReturnType], DOMNode):
color_system="truecolor", color_system="truecolor",
record=True, record=True,
) )
console.print(self.screen._compositor.render(full=True)) lines = self.screen._compositor.render(full=True).lines
console.print(SegmentLines(lines, new_lines=True))
return console.export_svg(title=self.title) return console.export_svg(title=self.title)
def save_screenshot(self, path: str | None = None) -> str: def save_screenshot(self, path: str | None = None) -> str:
@@ -524,7 +526,7 @@ class App(Generic[ReturnType], DOMNode):
self.screen.refresh(layout=True) self.screen.refresh(layout=True)
def render(self) -> RenderableType: def render(self) -> RenderableType:
return Blank() return ""
def query(self, selector: str | None = None) -> DOMQuery: def query(self, selector: str | None = None) -> DOMQuery:
"""Get a DOM query in the current screen. """Get a DOM query in the current screen.

View File

@@ -938,6 +938,8 @@ class FractionalProperty:
class AlignProperty: class AlignProperty:
"""Combines the horizontal and vertical alignment properties in to a single property."""
def __set_name__(self, owner: StylesBase, name: str) -> None: def __set_name__(self, owner: StylesBase, name: str) -> None:
self.horizontal = f"{name}_horizontal" self.horizontal = f"{name}_horizontal"
self.vertical = f"{name}_vertical" self.vertical = f"{name}_vertical"

View File

@@ -28,7 +28,12 @@ class Screen(Widget):
"""A widget for the root of the app.""" """A widget for the root of the app."""
CSS = """ CSS = """
Screen {
layout: vertical;
overflow-y: auto;
background: $surface;
color: $text-surface;
}
""" """
dark = Reactive(False) dark = Reactive(False)