Skip to content

Commit

Permalink
Fix docs build
Browse files Browse the repository at this point in the history
  • Loading branch information
mmwinther committed Jan 12, 2024
1 parent 6eb37a6 commit b9dd8cf
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 40 deletions.
19 changes: 0 additions & 19 deletions docs/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,6 @@ delete the .rst file afterwards.
datadoc package
===============
Subpackages
-----------
.. toctree::
:maxdepth: 4
datadoc.backend
datadoc.frontend
datadoc.app module
------------------
Expand Down Expand Up @@ -104,15 +94,6 @@ datadoc.backend.storage\_adapter module
datadoc.frontend package
========================
Subpackages
-----------
.. toctree::
:maxdepth: 4
datadoc.frontend.callbacks
datadoc.frontend.components
datadoc.frontend.fields
datadoc.frontend.callbacks package
==================================
Expand Down
4 changes: 1 addition & 3 deletions src/datadoc/backend/dataset_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from __future__ import annotations

import pathlib # noqa: TCH003 import is needed for docs build
import re
import typing as t
from abc import ABC
Expand All @@ -19,9 +20,6 @@
from datadoc.backend.storage_adapter import StorageAdapter
from datadoc.enums import DataType

if t.TYPE_CHECKING:
import pathlib

KNOWN_INTEGER_TYPES = (
"int",
"int_",
Expand Down
10 changes: 4 additions & 6 deletions src/datadoc/frontend/callbacks/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@
import logging
import os
import traceback
import typing as t
from pathlib import Path # noqa: TCH003 import is needed for docs build

from pydantic import ValidationError

from datadoc import state
from datadoc.backend.datadoc_metadata import METADATA_DOCUMENT_FILE_SUFFIX
from datadoc.backend.datadoc_metadata import DataDocMetadata
from datadoc.enums import (
SupportedLanguages, # noqa: TCH001 import is needed for docs build
)
from datadoc.frontend.callbacks.utils import MetadataInputTypes
from datadoc.frontend.callbacks.utils import find_existing_language_string
from datadoc.frontend.callbacks.utils import get_options_for_language
Expand All @@ -21,11 +24,6 @@
from datadoc.frontend.fields.display_dataset import MULTIPLE_LANGUAGE_DATASET_METADATA
from datadoc.frontend.fields.display_dataset import DatasetIdentifiers

if t.TYPE_CHECKING:
from pathlib import Path

from datadoc.enums import SupportedLanguages

logger = logging.getLogger(__name__)

DATADOC_DATASET_PATH_ENV_VAR = "DATADOC_DATASET_PATH"
Expand Down
40 changes: 28 additions & 12 deletions src/datadoc/frontend/callbacks/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,19 +151,35 @@ def update_variable_table_dropdown_options_for_language(
"""Retrieve enum options for dropdowns in the Datatable.
Handles the special case of boolean values which we represent in the Datatable
with a Dropdown but they're not backed by an Enum.
Example return structure:
{'data_type': {'options': [{'label': 'TEKST', 'value': 'STRING'},
{'label': 'HELTALL', 'value': 'INTEGER'},
{'label': 'DESIMALTALL', 'value': 'FLOAT'},
{'label': 'DATOTID', 'value': 'DATETIME'},
{'label': 'BOOLSK', 'value': 'BOOLEAN'}]},
'direct_person_identifying': {'options': [{'label': 'Ja', 'value': True},
{'label': 'Nei', 'value': False}]},
'temporality_type': {'options': [{'label': 'FAST', 'value': 'FIXED'},
...
with a Dropdown but they're not backed by an Enum. Example return data structure as follows:
.. code-block:: python
{
"data_type": {
"options": [
{"label": "TEKST", "value": "STRING"},
{"label": "HELTALL", "value": "INTEGER"},
{"label": "DESIMALTALL", "value": "FLOAT"},
{"label": "DATOTID", "value": "DATETIME"},
{"label": "BOOLSK", "value": "BOOLEAN"},
],
},
"direct_person_identifying": {
"options": [
{"label": "Ja", "value": True},
{"label": "Nei", "value": False},
],
},
"temporality_type": {"options": [{"label": "FAST", "value": "FIXED"}]},
}
Args:
language (SupportedLanguages): The language for metadata entry selected by the user.
Returns:
Data structure with options for all dropdowns.
"""
options: list[dict[str, object]] = []
for field_type in DISPLAYED_DROPDOWN_VARIABLES_TYPES:
Expand Down

0 comments on commit b9dd8cf

Please sign in to comment.