Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: missing branch in show_signature_annotations #362

Merged
merged 3 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "${{ matrix.python-version }}"
python-version: "3.10"
- name: Install dev dependencies
run: |
python -m pip install --upgrade pip
Expand Down
3 changes: 3 additions & 0 deletions quartodoc/renderers/md_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,9 @@ def render(self, el: dc.Parameter):
res = f"{glob}{name}: {annotation} = {el.default}"
elif annotation:
res = f"{glob}{name}: {annotation}"
else:
res = f"{glob}{name}"

elif has_default:
res = f"{glob}{name}={el.default}"
else:
Expand Down
20 changes: 12 additions & 8 deletions quartodoc/tests/__snapshots__/test_renderers.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@
tests.example_signature.a_complex_signature(
x: list[C | int | None]
y: pathlib.Pathlib
z
)
```

## Parameters {.doc-section .doc-section-parameters}

| Name | Type | Description | Default |
|--------|--------------------------------------------------------------------------------------|-----------------|------------|
| x | [list](`list`)\[[C](`quartodoc.tests.example_signature.C`) \| [int](`int`) \| None\] | The x parameter | _required_ |
| y | [pathlib](`pathlib`).[Pathlib](`pathlib.Pathlib`) | The y parameter | _required_ |
| Name | Type | Description | Default |
|--------|--------------------------------------------------------------------------------------|-------------------------------|------------|
| x | [list](`list`)\[[C](`quartodoc.tests.example_signature.C`) \| [int](`int`) \| None\] | The x parameter | _required_ |
| y | [pathlib](`pathlib`).[Pathlib](`pathlib.Pathlib`) | The y parameter | _required_ |
| z | | The z parameter (unannotated) | _required_ |
'''
# ---
# name: test_render_annotations_complex_no_interlinks
Expand All @@ -26,15 +28,17 @@
tests.example_signature.a_complex_signature(
x: list[C | int | None]
y: pathlib.Pathlib
z
)
```

## Parameters {.doc-section .doc-section-parameters}

| Name | Type | Description | Default |
|--------|--------------------------|-----------------|------------|
| x | list\[C \| int \| None\] | The x parameter | _required_ |
| y | pathlib.Pathlib | The y parameter | _required_ |
| Name | Type | Description | Default |
|--------|--------------------------|-------------------------------|------------|
| x | list\[C \| int \| None\] | The x parameter | _required_ |
| y | pathlib.Pathlib | The y parameter | _required_ |
| z | | The z parameter (unannotated) | _required_ |
'''
# ---
# name: test_render_doc_class[embedded]
Expand Down
4 changes: 3 additions & 1 deletion quartodoc/tests/example_signature.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@ class C:
...


def a_complex_signature(x: "list[C | int | None]", y: "pathlib.Pathlib"):
def a_complex_signature(x: "list[C | int | None]", y: "pathlib.Pathlib", z):
"""
Parameters
----------
x:
The x parameter
y:
The y parameter
z:
The z parameter (unannotated)
"""
Loading