Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B-ASIC - Better ASIC Toolbox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
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
Computer Engineering
B-ASIC - Better ASIC Toolbox
Merge requests
!227
Add some argument checking
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Add some argument checking
argumentchecking
into
master
Overview
0
Commits
1
Pipelines
1
Changes
3
Merged
Oscar Gustafsson
requested to merge
argumentchecking
into
master
2 years ago
Overview
0
Commits
1
Pipelines
1
Changes
3
Expand
0
0
Merge request reports
Viewing commit
705153cc
Show latest version
3 files
+
12
−
1
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
705153cc
Add some argument checking
· 705153cc
Oscar Gustafsson
authored
2 years ago
b_asic/save_load_structure.py
+
6
−
1
Options
@@ -33,6 +33,9 @@ def sfg_to_python(
True if printing a schedule.
"""
if
not
isinstance
(
sfg
,
SFG
):
raise
TypeError
(
"
An SFG must be provided
"
)
_type
=
"
Schedule
"
if
schedule
else
"
SFG
"
result
=
(
@@ -139,7 +142,7 @@ def sfg_to_python(
def
python_to_sfg
(
path
:
str
)
->
Tuple
[
SFG
,
Dict
[
str
,
Tuple
[
int
,
int
]]]:
"""
Given a serialized file try to deserialize it and load it to the library.
Given a serialized file
,
try to deserialize it and load it to the library.
Parameters
==========
@@ -167,6 +170,8 @@ def schedule_to_python(schedule: Schedule) -> str:
schedule : Schedule
The schedule to serialize.
"""
if
not
isinstance
(
schedule
,
Schedule
):
raise
TypeError
(
"
A Schedule must be provided
"
)
sfg_name
=
(
schedule
.
sfg
.
name
.
replace
(
"
"
,
"
_
"
).
replace
(
"
-
"
,
"
_
"
)
if
schedule
.
sfg
.
name
Loading