ghga-transpiler 1.4.0__py3-none-any.whl → 2.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ghga_transpiler/__init__.py +13 -7
- ghga_transpiler/__main__.py +5 -4
- ghga_transpiler/cli.py +9 -8
- ghga_transpiler/config/__init__.py +7 -5
- ghga_transpiler/config/config.py +12 -11
- ghga_transpiler/config/exceptions.py +5 -4
- ghga_transpiler/configs/__init__.py +5 -4
- ghga_transpiler/core.py +33 -22
- ghga_transpiler/io.py +7 -6
- ghga_transpiler/transformations.py +29 -7
- {ghga_transpiler-1.4.0.dist-info → ghga_transpiler-2.1.0.dist-info}/LICENSE +1 -1
- {ghga_transpiler-1.4.0.dist-info → ghga_transpiler-2.1.0.dist-info}/METADATA +8 -8
- ghga_transpiler-2.1.0.dist-info/RECORD +16 -0
- {ghga_transpiler-1.4.0.dist-info → ghga_transpiler-2.1.0.dist-info}/WHEEL +1 -1
- ghga_transpiler-1.4.0.dist-info/RECORD +0 -16
- {ghga_transpiler-1.4.0.dist-info → ghga_transpiler-2.1.0.dist-info}/entry_points.txt +0 -0
- {ghga_transpiler-1.4.0.dist-info → ghga_transpiler-2.1.0.dist-info}/top_level.txt +0 -0
ghga_transpiler/__init__.py
CHANGED
|
@@ -1,20 +1,26 @@
|
|
|
1
|
-
# Copyright 2021 -
|
|
1
|
+
# Copyright 2021 - 2024 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
|
|
2
2
|
# for the German Human Genome-Phenome Archive (GHGA)
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
# you may not use this file except in compliance with the License.
|
|
6
6
|
# You may obtain a copy of the License at
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
# Unless required by applicable law or agreed to in writing, software
|
|
11
11
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
|
+
#
|
|
16
|
+
|
|
17
|
+
"""GHGA metadata transpiler"""
|
|
15
18
|
|
|
16
|
-
|
|
19
|
+
from openpyxl.xml import DEFUSEDXML
|
|
17
20
|
|
|
18
|
-
|
|
21
|
+
__version__ = "2.1.0"
|
|
19
22
|
|
|
20
|
-
|
|
23
|
+
if not DEFUSEDXML:
|
|
24
|
+
raise RuntimeError(
|
|
25
|
+
"The 'defusedxml' package must be present to safely run ghga-transpiler."
|
|
26
|
+
)
|
ghga_transpiler/__main__.py
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
# Copyright 2021 -
|
|
1
|
+
# Copyright 2021 - 2024 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
|
|
2
2
|
# for the German Human Genome-Phenome Archive (GHGA)
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
# you may not use this file except in compliance with the License.
|
|
6
6
|
# You may obtain a copy of the License at
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
# Unless required by applicable law or agreed to in writing, software
|
|
11
11
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
|
+
#
|
|
15
16
|
|
|
16
17
|
"""Entrypoint of the package"""
|
|
17
18
|
|
ghga_transpiler/cli.py
CHANGED
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
# Copyright 2021 -
|
|
1
|
+
# Copyright 2021 - 2024 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
|
|
2
2
|
# for the German Human Genome-Phenome Archive (GHGA)
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
# you may not use this file except in compliance with the License.
|
|
6
6
|
# You may obtain a copy of the License at
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
# Unless required by applicable law or agreed to in writing, software
|
|
11
11
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
#
|
|
16
|
+
#
|
|
16
17
|
"""CLI-specific wrappers around core functions."""
|
|
18
|
+
|
|
17
19
|
import sys
|
|
18
20
|
from pathlib import Path
|
|
19
|
-
from typing import Optional
|
|
20
21
|
|
|
21
22
|
import typer
|
|
22
23
|
|
|
23
24
|
from . import __version__, io
|
|
24
25
|
from .config.exceptions import UnknownVersionError
|
|
25
|
-
from .core import convert_workbook
|
|
26
|
+
from .core import InvalidSematicVersion, convert_workbook
|
|
26
27
|
|
|
27
28
|
cli = typer.Typer()
|
|
28
29
|
|
|
@@ -43,7 +44,7 @@ def transpile(
|
|
|
43
44
|
dir_okay=False,
|
|
44
45
|
readable=True,
|
|
45
46
|
),
|
|
46
|
-
output_file:
|
|
47
|
+
output_file: Path | None = typer.Argument(
|
|
47
48
|
None, help="The path to output file (JSON).", dir_okay=False
|
|
48
49
|
),
|
|
49
50
|
force: bool = typer.Option(
|
|
@@ -66,7 +67,7 @@ def transpile(
|
|
|
66
67
|
"""
|
|
67
68
|
try:
|
|
68
69
|
ghga_workbook = io.read_workbook(spread_sheet)
|
|
69
|
-
except (SyntaxError, UnknownVersionError) as exc:
|
|
70
|
+
except (SyntaxError, UnknownVersionError, InvalidSematicVersion) as exc:
|
|
70
71
|
sys.exit(f"Unable to parse input file '{spread_sheet}': {exc}")
|
|
71
72
|
|
|
72
73
|
converted = convert_workbook(ghga_workbook)
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
# Copyright 2021 -
|
|
1
|
+
# Copyright 2021 - 2024 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
|
|
2
2
|
# for the German Human Genome-Phenome Archive (GHGA)
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
# you may not use this file except in compliance with the License.
|
|
6
6
|
# You may obtain a copy of the License at
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
# Unless required by applicable law or agreed to in writing, software
|
|
11
11
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
#
|
|
16
|
+
#
|
|
17
|
+
|
|
18
|
+
"""Module to load workbook configurations and convert it to transpiler config"""
|
|
16
19
|
|
|
17
|
-
"""Module to load workbook configurations and convert it to transpiler config """
|
|
18
20
|
from .config import Config, load_config # noqa
|
ghga_transpiler/config/config.py
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
# Copyright 2021 -
|
|
1
|
+
# Copyright 2021 - 2024 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
|
|
2
2
|
# for the German Human Genome-Phenome Archive (GHGA)
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
# you may not use this file except in compliance with the License.
|
|
6
6
|
# You may obtain a copy of the License at
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
# Unless required by applicable law or agreed to in writing, software
|
|
11
11
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
#
|
|
16
|
+
#
|
|
16
17
|
|
|
17
18
|
"""Module to process config file"""
|
|
18
19
|
|
|
19
20
|
from collections import Counter
|
|
21
|
+
from collections.abc import Callable
|
|
20
22
|
from importlib import resources
|
|
21
|
-
from typing import Callable, Optional
|
|
22
23
|
|
|
23
24
|
import yaml
|
|
24
25
|
from pydantic import BaseModel, model_validator
|
|
@@ -40,18 +41,18 @@ class WorksheetSettings(BaseModel):
|
|
|
40
41
|
"""A data model for the per-worksheet settings of a transpiler config"""
|
|
41
42
|
|
|
42
43
|
name: str
|
|
43
|
-
header_row:
|
|
44
|
-
start_row:
|
|
45
|
-
start_column:
|
|
46
|
-
end_column:
|
|
47
|
-
transformations:
|
|
44
|
+
header_row: int | None = None
|
|
45
|
+
start_row: int | None = None
|
|
46
|
+
start_column: int | None = None
|
|
47
|
+
end_column: int | None = None
|
|
48
|
+
transformations: dict[str, Callable] | None = None
|
|
48
49
|
|
|
49
50
|
|
|
50
51
|
class Worksheet(BaseModel):
|
|
51
52
|
"""A data model for worksheets in the transpiler config"""
|
|
52
53
|
|
|
53
54
|
sheet_name: str
|
|
54
|
-
settings:
|
|
55
|
+
settings: WorksheetSettings | None
|
|
55
56
|
|
|
56
57
|
|
|
57
58
|
class Config(BaseModel):
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
# Copyright 2021 -
|
|
1
|
+
# Copyright 2021 - 2024 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
|
|
2
2
|
# for the German Human Genome-Phenome Archive (GHGA)
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
# you may not use this file except in compliance with the License.
|
|
6
6
|
# You may obtain a copy of the License at
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
# Unless required by applicable law or agreed to in writing, software
|
|
11
11
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
#
|
|
16
|
+
#
|
|
16
17
|
|
|
17
18
|
"""Module to collect custom exceptions"""
|
|
18
19
|
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
# Copyright 2021 -
|
|
1
|
+
# Copyright 2021 - 2024 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
|
|
2
2
|
# for the German Human Genome-Phenome Archive (GHGA)
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
# you may not use this file except in compliance with the License.
|
|
6
6
|
# You may obtain a copy of the License at
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
# Unless required by applicable law or agreed to in writing, software
|
|
11
11
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
#
|
|
16
|
+
#
|
ghga_transpiler/core.py
CHANGED
|
@@ -1,30 +1,33 @@
|
|
|
1
|
-
# Copyright 2021 -
|
|
1
|
+
# Copyright 2021 - 2024 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
|
|
2
2
|
# for the German Human Genome-Phenome Archive (GHGA)
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
# you may not use this file except in compliance with the License.
|
|
6
6
|
# You may obtain a copy of the License at
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
# Unless required by applicable law or agreed to in writing, software
|
|
11
11
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
#
|
|
16
|
+
#
|
|
16
17
|
|
|
17
18
|
"""This module contains functionalities for processing excel sheets into json object."""
|
|
18
|
-
|
|
19
|
+
|
|
20
|
+
from collections.abc import Callable
|
|
19
21
|
from importlib import resources
|
|
20
|
-
from typing import Callable, Optional, Union
|
|
21
22
|
|
|
23
|
+
import semver
|
|
22
24
|
from openpyxl import Workbook
|
|
23
25
|
|
|
24
26
|
from . import config
|
|
25
27
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
|
|
29
|
+
class InvalidSematicVersion(Exception):
|
|
30
|
+
"""Raised when a version string is invalid."""
|
|
28
31
|
|
|
29
32
|
|
|
30
33
|
class GHGAWorkbook:
|
|
@@ -33,27 +36,35 @@ class GHGAWorkbook:
|
|
|
33
36
|
def __init__(self, workbook: Workbook, configs_package: resources.Package):
|
|
34
37
|
"""Create a new GHGAWorkbook object from an XLSX workbook"""
|
|
35
38
|
self.workbook = workbook
|
|
36
|
-
self.
|
|
37
|
-
self.config = config.load_config(self.
|
|
39
|
+
self.wb_version = GHGAWorkbook._get_version(workbook)
|
|
40
|
+
self.config = config.load_config(self.major_minor_version, configs_package)
|
|
38
41
|
|
|
39
42
|
@staticmethod
|
|
40
43
|
def _get_version(workbook):
|
|
41
44
|
"""Function to get workbook version from the worksheet _properties"""
|
|
42
45
|
if "__properties" in workbook.sheetnames:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
try:
|
|
47
|
+
return semver.Version.parse(workbook["__properties"].cell(1, 1).value)
|
|
48
|
+
except ValueError:
|
|
49
|
+
raise InvalidSematicVersion(
|
|
50
|
+
"Unable to extract metadata model version from the provided workbook (not a valid semantic version)."
|
|
51
|
+
) from None
|
|
46
52
|
raise SyntaxError(
|
|
47
|
-
"Unable to extract metadata version from the provided workbook."
|
|
53
|
+
"Unable to extract metadata model version from the provided workbook (missing)."
|
|
48
54
|
)
|
|
49
55
|
|
|
56
|
+
@property
|
|
57
|
+
def major_minor_version(self):
|
|
58
|
+
"""Returns only major and minor version numbers"""
|
|
59
|
+
return f"{self.wb_version.major}.{self.wb_version.minor}"
|
|
60
|
+
|
|
50
61
|
|
|
51
62
|
def get_worksheet_rows(
|
|
52
63
|
worksheet,
|
|
53
|
-
min_row:
|
|
64
|
+
min_row: int | None,
|
|
54
65
|
max_row: int,
|
|
55
|
-
min_col:
|
|
56
|
-
max_col:
|
|
66
|
+
min_col: int | None,
|
|
67
|
+
max_col: int | None,
|
|
57
68
|
) -> list:
|
|
58
69
|
"""Function to create a list of rows of a worksheet"""
|
|
59
70
|
return list(
|
|
@@ -67,9 +78,9 @@ def get_worksheet_rows(
|
|
|
67
78
|
|
|
68
79
|
def get_header(
|
|
69
80
|
worksheet,
|
|
70
|
-
header_row:
|
|
71
|
-
min_col:
|
|
72
|
-
max_col:
|
|
81
|
+
header_row: int | None,
|
|
82
|
+
min_col: int | None,
|
|
83
|
+
max_col: int | None,
|
|
73
84
|
) -> list[str]:
|
|
74
85
|
"""Function to return a list column names of a worksheet"""
|
|
75
86
|
return list(
|
|
@@ -86,7 +97,7 @@ def convert_rows(header, rows) -> list[dict]:
|
|
|
86
97
|
return [
|
|
87
98
|
{
|
|
88
99
|
key: value
|
|
89
|
-
for key, value in zip(header, row)
|
|
100
|
+
for key, value in zip(header, row, strict=False)
|
|
90
101
|
if value is not None and value != ""
|
|
91
102
|
}
|
|
92
103
|
for row in rows
|
|
@@ -94,7 +105,7 @@ def convert_rows(header, rows) -> list[dict]:
|
|
|
94
105
|
|
|
95
106
|
|
|
96
107
|
def transform_rows(
|
|
97
|
-
rows: list[dict], transformations:
|
|
108
|
+
rows: list[dict], transformations: dict[str, Callable] | None
|
|
98
109
|
) -> list[dict]:
|
|
99
110
|
"""Transforms row values if it is applicable with a given function"""
|
|
100
111
|
transformed = []
|
ghga_transpiler/io.py
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
# Copyright 2021 -
|
|
1
|
+
# Copyright 2021 - 2024 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
|
|
2
2
|
# for the German Human Genome-Phenome Archive (GHGA)
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
# you may not use this file except in compliance with the License.
|
|
6
6
|
# You may obtain a copy of the License at
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
# Unless required by applicable law or agreed to in writing, software
|
|
11
11
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
#
|
|
16
|
+
#
|
|
16
17
|
|
|
17
18
|
"""IO related functionality"""
|
|
18
19
|
|
|
@@ -20,7 +21,7 @@ import json
|
|
|
20
21
|
import sys
|
|
21
22
|
from importlib import resources
|
|
22
23
|
from pathlib import Path
|
|
23
|
-
from typing import
|
|
24
|
+
from typing import TextIO
|
|
24
25
|
|
|
25
26
|
from openpyxl import load_workbook
|
|
26
27
|
|
|
@@ -39,7 +40,7 @@ def _write_json(data: dict, file: TextIO):
|
|
|
39
40
|
json.dump(obj=data, fp=file, ensure_ascii=False, indent=4)
|
|
40
41
|
|
|
41
42
|
|
|
42
|
-
def write_json(data: dict, path:
|
|
43
|
+
def write_json(data: dict, path: Path | None, force: bool) -> None:
|
|
43
44
|
"""Write the data provided as a dictionary to the specified output path or
|
|
44
45
|
to stdout if the path is None.
|
|
45
46
|
"""
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
# Copyright 2021 -
|
|
1
|
+
# Copyright 2021 - 2024 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
|
|
2
2
|
# for the German Human Genome-Phenome Archive (GHGA)
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
# you may not use this file except in compliance with the License.
|
|
6
6
|
# You may obtain a copy of the License at
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
# Unless required by applicable law or agreed to in writing, software
|
|
11
11
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
#
|
|
16
|
+
#
|
|
16
17
|
|
|
17
18
|
"""Module containing transformation functions"""
|
|
18
19
|
|
|
19
|
-
from
|
|
20
|
+
from collections.abc import Callable
|
|
20
21
|
|
|
21
22
|
|
|
22
23
|
def split_by_semicolon(value: str) -> list[str]:
|
|
@@ -35,10 +36,31 @@ def to_attributes() -> Callable:
|
|
|
35
36
|
def split_one(value: str) -> dict:
|
|
36
37
|
"""Returns a dictionary with key, value as keys, splitted string as values"""
|
|
37
38
|
splitted = (elem.strip() for elem in value.split("="))
|
|
38
|
-
return dict(zip(("key", "value"), splitted))
|
|
39
|
+
return dict(zip(("key", "value"), splitted, strict=False))
|
|
39
40
|
|
|
40
41
|
def split_mult(value: str) -> list[dict]:
|
|
41
|
-
"""
|
|
42
|
+
"""Converts string to attributes"""
|
|
42
43
|
return [split_one(elem) for elem in split_by_semicolon(value)]
|
|
43
44
|
|
|
44
45
|
return split_mult
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def snake_case(cv: str) -> str:
|
|
49
|
+
"""Converts format of a string to SNAKE_CASE"""
|
|
50
|
+
return cv.replace(" ", "_").upper()
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def to_snake_case() -> Callable:
|
|
54
|
+
"""Returns a function that converts a string to SNAKE_CASE"""
|
|
55
|
+
return snake_case
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def snake_case_list(value: str) -> list[str]:
|
|
59
|
+
"""Combines the functions to split_by_semicolon and convert_to_snake_case"""
|
|
60
|
+
list_to_convert = split_by_semicolon(value)
|
|
61
|
+
return [snake_case(elem) for elem in list_to_convert]
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def to_snake_case_list() -> Callable:
|
|
65
|
+
"""Returns a function that converts a semicolon separated string into a list of snake-cased strings"""
|
|
66
|
+
return snake_case_list
|
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
same "printed page" as the copyright notice for easier
|
|
187
187
|
identification within third-party archives.
|
|
188
188
|
|
|
189
|
-
Copyright 2021 -
|
|
189
|
+
Copyright 2021 - 2024 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
|
|
190
190
|
for the German Human Genome-Phenome Archive (GHGA)
|
|
191
191
|
|
|
192
192
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
|
-
Name:
|
|
3
|
-
Version: 1.
|
|
2
|
+
Name: ghga_transpiler
|
|
3
|
+
Version: 2.1.0
|
|
4
4
|
Summary: GHGA-Transpiler - excel to JSON converter
|
|
5
5
|
Author-email: "German Human Genome Phenome Archive (GHGA)" <contact@ghga.de>
|
|
6
6
|
License: Apache 2.0
|
|
7
7
|
Project-URL: Repository, https://github.com/ghga-de/ghga-transpiler
|
|
8
8
|
Classifier: Development Status :: 1 - Planning
|
|
9
9
|
Classifier: Operating System :: POSIX :: Linux
|
|
10
|
-
Classifier: Programming Language :: Python :: 3
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
12
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
14
13
|
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
|
|
15
14
|
Classifier: Topic :: Software Development :: Libraries
|
|
16
15
|
Classifier: Intended Audience :: Developers
|
|
17
|
-
Requires-Python: >=3.
|
|
16
|
+
Requires-Python: >=3.12
|
|
18
17
|
Description-Content-Type: text/markdown
|
|
19
18
|
License-File: LICENSE
|
|
20
|
-
Requires-Dist: typer
|
|
19
|
+
Requires-Dist: typer >=0.12
|
|
21
20
|
Requires-Dist: openpyxl ==3.*,>=3.1.2
|
|
22
|
-
Requires-Dist: defusedxml
|
|
21
|
+
Requires-Dist: defusedxml ==0.*,>=0.7
|
|
23
22
|
Requires-Dist: pydantic <3,>=2
|
|
24
23
|
Requires-Dist: PyYAML ~=6.0
|
|
24
|
+
Requires-Dist: semver ==3.*
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
[](https://github.com/ghga-de/ghga-transpiler/actions/workflows/unit_and_int_tests.yaml)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
ghga_transpiler/__init__.py,sha256=OXxyONXOjsICnct4BfF-c98ShNFaW6VenC_sxD_B_KM,908
|
|
2
|
+
ghga_transpiler/__main__.py,sha256=EVGi0SsK--oaDF_c6PhVvNyPDnItrJzVapNAsKhgBmM,847
|
|
3
|
+
ghga_transpiler/cli.py,sha256=AzIWDZaRzyREzGmV2az7OXVwzT33ijroot-dHwIdzUA,2491
|
|
4
|
+
ghga_transpiler/core.py,sha256=A2MKKNEwxRViCquU0pbuk7KjXCg8y-F_QJpICvSS-IE,5213
|
|
5
|
+
ghga_transpiler/io.py,sha256=ln997FIjVHyZKeJLkvGeo35hx6ZE4CtPIpoPcu23vGI,1769
|
|
6
|
+
ghga_transpiler/transformations.py,sha256=o-6qJHB-5ptrnMhi-q-3kXrrVdy_XwqLUjTVIg-SH0o,2236
|
|
7
|
+
ghga_transpiler/config/__init__.py,sha256=f8b3Le48ZrbOwRA5MVf6V6zqKFtxii9SQZMvvx1ulz8,817
|
|
8
|
+
ghga_transpiler/config/config.py,sha256=rDgUR939BCI89QkcqQXeJ1872hkAg1QE4IeGgoijRD0,3787
|
|
9
|
+
ghga_transpiler/config/exceptions.py,sha256=H2xLk9YV3yHuwBDxQDgumbymX_-xSXctlh-rrIxv8Qw,1090
|
|
10
|
+
ghga_transpiler/configs/__init__.py,sha256=109RyIL2rxVrEiOS9D0q-PGVqw1_VZblvvFxOh4ZUjU,686
|
|
11
|
+
ghga_transpiler-2.1.0.dist-info/LICENSE,sha256=fBYaxYJmvm_AQEYU4gRvUAWbqhO0bgqPj9Yl6f8RXuU,11452
|
|
12
|
+
ghga_transpiler-2.1.0.dist-info/METADATA,sha256=mwfApRxtzL1CvNhD7FJ8UySErjIee1gNTrxhVaP2d4k,4407
|
|
13
|
+
ghga_transpiler-2.1.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
14
|
+
ghga_transpiler-2.1.0.dist-info/entry_points.txt,sha256=Fr_VQJynZZl95NXjrQW2gE0bCocgjKVNEZQpaLls8po,65
|
|
15
|
+
ghga_transpiler-2.1.0.dist-info/top_level.txt,sha256=TksRpDO3Y4mvK-B09UhQU3ceZpG19fljNlVDGTfjg8o,16
|
|
16
|
+
ghga_transpiler-2.1.0.dist-info/RECORD,,
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
ghga_transpiler/__init__.py,sha256=MXeVOnFR_TEt-8CN-DU8y9PX1XUKOdn3l956H5kPTWo,824
|
|
2
|
-
ghga_transpiler/__main__.py,sha256=NgajDXhJ36WPA6MR5Rb44Qqmogie16_kr0HRL-umGxc,848
|
|
3
|
-
ghga_transpiler/cli.py,sha256=BKnCMk63c6uyDSV-U6UiIy72FBzU647qwR0lrKtbOg0,2476
|
|
4
|
-
ghga_transpiler/core.py,sha256=ZFGQOlX7EB5du4xAYgJQh0N_MBVdq6cUySIpktRfUj4,4996
|
|
5
|
-
ghga_transpiler/io.py,sha256=MJwXmFC2xsgq7exlG623pnKhCxiJ-EBI9uIV0G46frU,1783
|
|
6
|
-
ghga_transpiler/transformations.py,sha256=qI6vKq3gJPPBE2msUm-DMdVNeLrfJIkbga8l45tS7ek,1567
|
|
7
|
-
ghga_transpiler/config/__init__.py,sha256=IKlzAd82ta9a0_aEps3f4I3GLRSJeyV1QImFcHvBLE0,818
|
|
8
|
-
ghga_transpiler/config/config.py,sha256=3N3ozWlqIdtBNlNZI5dPjDunGGxlF7-APplgzx9MSn0,3807
|
|
9
|
-
ghga_transpiler/config/exceptions.py,sha256=_A8wMX9t0YkLw4tk2IhOVdKoGoZxP2pXsEaZwrgkXhw,1091
|
|
10
|
-
ghga_transpiler/configs/__init__.py,sha256=uGpTS9l2diw93p053atk09DuObDZ7eDZJoADCmuYX0g,687
|
|
11
|
-
ghga_transpiler-1.4.0.dist-info/LICENSE,sha256=a2nPPnhGY9QGdkfGrseHGDVj62fh8o5DoHsUpQp3GzA,11452
|
|
12
|
-
ghga_transpiler-1.4.0.dist-info/METADATA,sha256=pmQFx6mSFVvm-Gwyo5tWwffosI68VP8YWZEY2k3NiXs,4420
|
|
13
|
-
ghga_transpiler-1.4.0.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
|
|
14
|
-
ghga_transpiler-1.4.0.dist-info/entry_points.txt,sha256=Fr_VQJynZZl95NXjrQW2gE0bCocgjKVNEZQpaLls8po,65
|
|
15
|
-
ghga_transpiler-1.4.0.dist-info/top_level.txt,sha256=TksRpDO3Y4mvK-B09UhQU3ceZpG19fljNlVDGTfjg8o,16
|
|
16
|
-
ghga_transpiler-1.4.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|