Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nova-mvvm
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
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
NDIP
Nova Packages
nova-mvvm
Commits
0fc4a406
Commit
0fc4a406
authored
3 months ago
by
Yakubov, Sergey
Browse files
Options
Downloads
Patches
Plain Diff
add logger
parent
f2ab1419
No related branches found
No related tags found
1 merge request
!6
Update library to work with Pydantic models
Pipeline
#640843
waiting for manual action
Stage: lint
Stage: test
Stage: publish
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pyproject.toml
+1
-1
1 addition, 1 deletion
pyproject.toml
src/mvvm_lib/pydantic_utils.py
+4
-1
4 additions, 1 deletion
src/mvvm_lib/pydantic_utils.py
with
5 additions
and
2 deletions
pyproject.toml
+
1
−
1
View file @
0fc4a406
[tool.poetry]
name
=
"mvvm-lib"
version
=
"0.
3.1
"
version
=
"0.
4.0
"
description
=
"A Python Package for Model-View-ViewModel pattern"
authors
=
[
"Yakubov, Sergey <yakubovs@ornl.gov>"
]
readme
=
"README.md"
...
...
This diff is collapsed.
Click to expand it.
src/mvvm_lib/pydantic_utils.py
+
4
−
1
View file @
0fc4a406
"""
Pydantic utils.
"""
import
logging
import
re
from
typing
import
Any
...
...
@@ -8,6 +9,8 @@ from pydantic.fields import FieldInfo
from
mvvm_lib
import
bindings_map
logger
=
logging
.
getLogger
(
__name__
)
def
get_nested_pydantic_field
(
model
:
BaseModel
,
field_path
:
str
)
->
FieldInfo
:
"""
...
...
@@ -44,7 +47,7 @@ def get_field_info(field_name: str) -> FieldInfo:
def
validate_pydantic_parameter
(
name
:
str
,
value
:
Any
,
index
:
int
)
->
str
|
None
:
if
name
not
in
bindings_map
:
pr
in
t
(
f
"
cannot find
{
name
}
in bindings_map
"
)
# no error, just do not validate for now
logger
.
warn
in
g
(
f
"
cannot find
{
name
}
in bindings_map
"
)
# no error, just do not validate for now
return
None
binding
=
bindings_map
[
name
]
current_model
=
binding
.
viewmodel_linked_object
...
...
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