Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
quality-kpi
Manage
Activity
Members
Labels
Plan
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
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Quiring, Ole
quality-kpi
Commits
67328284
Commit
67328284
authored
2 years ago
by
Hock, Martin
Browse files
Options
Downloads
Patches
Plain Diff
Fix some label in dict issues. Fix optional label parameter typing.
Fix Assembly property parameter options.
parent
33f28032
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
functions/classes.py
+10
-8
10 additions, 8 deletions
functions/classes.py
with
10 additions
and
8 deletions
functions/classes.py
+
10
−
8
View file @
67328284
...
...
@@ -50,9 +50,9 @@ class LegoComponent:
def
clone
(
self
,
new_label
:
str
=
None
)
->
LegoComponent
:
def
clone
(
self
,
new_label
:
Optional
[
str
]
=
None
)
->
LegoComponent
:
if
new_label
is
None
:
new_label
=
self
.
properties
.
label
new_label
=
self
.
properties
[
'
label
'
]
clone
=
LegoComponent
(
None
,
None
,
self
.
properties
)
clone
.
properties
[
'
label
'
]
=
new_label
return
clone
...
...
@@ -68,7 +68,6 @@ class LegoComponent:
def
to_dict
(
self
)
->
Dict
:
dict_
=
{
"
uuid
"
:
self
.
uuid
,
"
label
"
:
self
.
label
,
"
properties
"
:
self
.
properties
,
"
layer
"
:
self
.
layer
,
}
...
...
@@ -93,10 +92,16 @@ class LegoAssembly:
self
.
uuid
:
uuid
.
UUID
=
uuid
.
uuid4
()
self
.
parent
:
None
|
LegoAssembly
=
None
self
.
properties
:
dict
=
{}
self
.
layer
:
AggregationLayer
=
layer
if
label
is
not
None
:
self
.
properties
[
'
label
'
]
=
label
self
.
layer
:
AggregationLayer
=
layer
self
.
properties
.
update
(
properties
)
for
prop
in
properties
:
if
isinstance
(
prop
,
dict
):
self
.
properties
.
update
(
prop
)
else
:
raise
ValueError
(
f
"
Unexpected argument type:
{
type
(
properties
)
}
"
)
for
key
,
value
in
kwargs
.
items
():
self
.
properties
[
key
]
=
value
self
.
components
:
List
[
LegoComponent
]
=
[]
self
.
assemblies
:
List
[
LegoAssembly
]
=
[]
...
...
@@ -249,6 +254,3 @@ class KPIEncoder(json.JSONEncoder):
return
"
kpi-
"
+
str
(
o
)
if
isinstance
(
o
,
(
AggregationLayer
)):
return
"
kpi-
"
+
o
.
properties
.
label
return
super
().
default
(
o
)
pass
\ No newline at end of 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