File: main.py

package info (click to toggle)
python-odmantic 1.0.2-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 1,640 kB
  • sloc: python: 8,547; sh: 37; makefile: 34; xml: 13; javascript: 3
file content (14 lines) | stat: -rw-r--r-- 487 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
def define_env(env):
    @env.macro
    def async_sync_snippet(folder: str, filename: str, hl_lines=None, linenums=True):
        return f"""
=== "Async"
    ```python {'linenums="1"' if linenums else ''} {'hl_lines="'+hl_lines+'"' if hl_lines is not None else ''}"
    --8<-- "{folder}/async/{filename}"
    ```

=== "Sync"
    ```python {'linenums="1"' if linenums else ''} {'hl_lines="'+hl_lines+'"' if hl_lines is not None else ''}"
    --8<-- "{folder}/sync/{filename}"
    ```
"""