Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
CaosDB Crawler
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 Crawler
Commits
5c335d2f
Commit
5c335d2f
authored
2 years ago
by
Alexander Schlemmer
Browse files
Options
Downloads
Patches
Plain Diff
MAINT: revert addition of yaml converter which is part of f-yaml-converter
parent
f17befaa
No related branches found
No related tags found
2 merge requests
!53
Release 0.1
,
!42
F doc
Pipeline
#28752
passed
2 years ago
Stage: info
Stage: setup
Stage: cert
Stage: style
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/caoscrawler/converters.py
+0
-45
0 additions, 45 deletions
src/caoscrawler/converters.py
with
0 additions
and
45 deletions
src/caoscrawler/converters.py
+
0
−
45
View file @
5c335d2f
...
@@ -552,51 +552,6 @@ class FileConverter(Converter):
...
@@ -552,51 +552,6 @@ class FileConverter(Converter):
return
[]
return
[]
class
YAMLFileConverter
(
DictConverter
):
"""
Converter for yaml files very similar to the json converter.
"""
def
typecheck
(
self
,
element
:
StructureElement
):
return
isinstance
(
element
,
File
)
def
match
(
self
,
element
:
StructureElement
):
if
not
self
.
typecheck
(
element
):
raise
RuntimeError
(
"
Element must be a file
"
)
m
=
re
.
match
(
self
.
definition
[
"
match
"
],
element
.
name
)
if
m
is
None
:
return
None
return
m
.
groupdict
()
def
create_children
(
self
,
generalStore
:
GeneralStore
,
element
:
StructureElement
):
if
not
self
.
typecheck
(
element
):
raise
RuntimeError
(
"
A YAML file is needed to create children
"
)
with
open
(
element
.
path
,
'
r
'
)
as
yaml_file
:
yaml_data
=
yaml
.
safe_load
(
yaml_file
)
if
not
isinstance
(
yaml_data
,
dict
):
breakpoint
()
raise
NotImplementedError
(
"
YAML file must contain a dict
"
)
raise
NotImplementedError
()
# if "validate" in self.definition and self.definition["validate"]:
# if isinstance(self.definition["validate"], dict):
# schema = self.definition["validate"]
# elif isinstance(self.definition["validate"], str):
# with open(self.definition["validate"], 'r') as json_file:
# schema = json.load(json_file)
# else:
# raise ValueError("The value of 'validate' has to be a string describing the path "
# "to the json schema file (relative to the cfood yml) "
# "or a dict containing the schema.")
# # Validate the json content
# try:
# validate(instance=json_data, schema=schema)
# except ValidationError as err:
# raise ConverterValidationError(
# f"Couldn't validate {json_data}:\n{err.message}")
return
self
.
_create_children_from_dict
(
yaml_data
)
class
JSONFileConverter
(
DictConverter
):
class
JSONFileConverter
(
DictConverter
):
def
typecheck
(
self
,
element
:
StructureElement
):
def
typecheck
(
self
,
element
:
StructureElement
):
return
isinstance
(
element
,
File
)
return
isinstance
(
element
,
File
)
...
...
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