Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-advanced-user-tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-advanced-user-tools
Commits
caceab21
Commit
caceab21
authored
1 year ago
by
Henrik tom Wörden
Browse files
Options
Downloads
Patches
Plain Diff
MAINT: typing
parent
016c0bb0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
4 merge requests
!100
WIP: Filling XLSX: Seems to be working.
,
!94
ENH: add framework for converting json schema into table templates
,
!93
Filling XLSX: Everything except multiple choice.
,
!92
ENH: xlsx template generator
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/caosadvancedtools/table_json_conversion/table_generator.py
+4
-4
4 additions, 4 deletions
...aosadvancedtools/table_json_conversion/table_generator.py
with
4 additions
and
4 deletions
src/caosadvancedtools/table_json_conversion/table_generator.py
+
4
−
4
View file @
caceab21
...
...
@@ -28,7 +28,7 @@ import sys
from
abc
import
ABC
,
abstractmethod
from
argparse
import
RawTextHelpFormatter
from
enum
import
Enum
from
typing
import
Union
from
typing
import
Dict
,
List
,
Tuple
,
Union
from
openpyxl
import
Workbook
from
openpyxl.workbook.child
import
INVALID_TITLE_REGEX
...
...
@@ -74,7 +74,7 @@ class TableTemplateGenerator(ABC):
pass
def
_generate_sheets_from_schema
(
self
,
schema
:
dict
,
foreign_keys
:
dict
=
None
)
->
d
ict
[
str
,
d
ict
[
str
,
list
]]:
)
->
D
ict
[
str
,
D
ict
[
str
,
list
]]:
"""
generates a sheet definition from a given JSON schema
Parameters
...
...
@@ -104,7 +104,7 @@ class TableTemplateGenerator(ABC):
foreign_keys
=
{}
# here, we treat the top level
# sheets[sheetname][colname]= (COL_TYPE, description, [path])
sheets
:
d
ict
[
str
,
dict
[
str
,
t
uple
[
str
,
list
]]]
=
{}
sheets
:
D
ict
[
str
,
dict
[
str
,
T
uple
[
str
,
list
]]]
=
{}
if
"
properties
"
not
in
schema
:
raise
ValueError
(
"
Inappropriate JSON schema: The following part should contain
"
f
"
the
'
properties
'
key:
\n
{
schema
}
\n
"
)
...
...
@@ -141,7 +141,7 @@ class TableTemplateGenerator(ABC):
def
_treat_schema_element
(
self
,
schema
:
dict
,
sheets
:
dict
=
None
,
path
:
list
=
None
,
foreign_keys
:
dict
=
None
,
level_in_sheet_name
:
int
=
1
,
array_paths
:
list
=
None
)
->
d
ict
[
str
,
t
uple
[
str
,
str
,
list
]]:
)
->
D
ict
[
str
,
T
uple
[
str
,
str
,
list
]]:
"""
recursively transforms elements from the schema into column definitions
sheets is modified in place.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment