Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
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
xAAL
Code
Python
Commits
0e88f033
Commit
0e88f033
authored
5 months ago
by
KERDREUX Jerome
Browse files
Options
Downloads
Patches
Plain Diff
Formating, fix ruff errors
parent
8b6726fc
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libs/schemas/xaal/schemas/dev_builder.py
+10
-11
10 additions, 11 deletions
libs/schemas/xaal/schemas/dev_builder.py
with
10 additions
and
11 deletions
libs/schemas/xaal/schemas/dev_builder.py
+
10
−
11
View file @
0e88f033
from
mako.template
import
Template
from
mako.template
import
Template
import
sys
import
os
import
os
import
json
import
json
from
pprint
import
pprint
from
pprint
import
pprint
...
@@ -52,7 +51,7 @@ class Schemas:
...
@@ -52,7 +51,7 @@ class Schemas:
def
__init__
(
self
):
def
__init__
(
self
):
self
.
__cache
=
{}
self
.
__cache
=
{}
def
load
(
self
,
filename
):
def
load
(
self
,
filename
):
"""
load schema from disk, and put it in cache
"""
load schema from disk, and put it in cache
return the file as dict
"""
return the file as dict
"""
if
filename
in
self
.
__cache
.
keys
():
if
filename
in
self
.
__cache
.
keys
():
...
@@ -66,7 +65,7 @@ class Schemas:
...
@@ -66,7 +65,7 @@ class Schemas:
return
jsonDict
return
jsonDict
def
get_extends
(
self
,
name
):
def
get_extends
(
self
,
name
):
"""
return the chain list off extends in reverse order, any.any is the first item
"""
"""
return the chain list off extends in reverse order, any.any is the first item
"""
current
=
name
current
=
name
...
@@ -82,7 +81,7 @@ class Schemas:
...
@@ -82,7 +81,7 @@ class Schemas:
return
extends
return
extends
def
get
(
self
,
name
):
def
get
(
self
,
name
):
"""
return an complete schema w/ all extends included
"""
"""
return an complete schema w/ all extends included
"""
ext
=
self
.
get_extends
(
name
)
ext
=
self
.
get_extends
(
name
)
res
=
self
.
load
(
name
)
res
=
self
.
load
(
name
)
...
@@ -133,22 +132,22 @@ class DeviceBuilder:
...
@@ -133,22 +132,22 @@ class DeviceBuilder:
self
.
schemas
=
Schemas
()
self
.
schemas
=
Schemas
()
self
.
basic
=
self
.
schemas
.
get
(
'
basic.basic
'
)
self
.
basic
=
self
.
schemas
.
get
(
'
basic.basic
'
)
def
is_basic_method
(
self
,
value
):
def
is_basic_method
(
self
,
value
):
return
value
in
self
.
basic
[
'
methods
'
]
return
value
in
self
.
basic
[
'
methods
'
]
def
is_basic_attribute
(
self
,
value
):
def
is_basic_attribute
(
self
,
value
):
return
value
in
self
.
basic
[
'
attributes
'
]
return
value
in
self
.
basic
[
'
attributes
'
]
def
is_basic_notification
(
self
,
value
):
def
is_basic_notification
(
self
,
value
):
return
value
in
self
.
basic
[
'
notifications
'
]
return
value
in
self
.
basic
[
'
notifications
'
]
def
is_basic_datamodel
(
self
,
value
):
def
is_basic_datamodel
(
self
,
value
):
return
value
in
self
.
basic
[
'
datamodel
'
]
return
value
in
self
.
basic
[
'
datamodel
'
]
def
get_schema
(
self
,
name
):
def
get_schema
(
self
,
name
):
return
self
.
schemas
.
get
(
name
)
return
self
.
schemas
.
get
(
name
)
def
build
(
self
,
name
,
template
):
def
build
(
self
,
name
,
template
):
data
=
self
.
schemas
.
get
(
name
)
data
=
self
.
schemas
.
get
(
name
)
tmpl
=
Template
(
filename
=
template
)
tmpl
=
Template
(
filename
=
template
)
...
@@ -183,7 +182,7 @@ class DeviceBuilder:
...
@@ -183,7 +182,7 @@ class DeviceBuilder:
print
(
tmpl
.
render
(
**
args
))
print
(
tmpl
.
render
(
**
args
))
#return args
#return args
def
build_all
(
self
,
template
):
def
build_all
(
self
,
template
):
devs
=
self
.
schemas
.
get_devtypes
()
devs
=
self
.
schemas
.
get_devtypes
()
for
k
in
devs
:
for
k
in
devs
:
self
.
build
(
k
,
template
)
self
.
build
(
k
,
template
)
...
...
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