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
Commits
82384ca6
Commit
82384ca6
authored
2 years ago
by
Frans Skarman
Committed by
Oscar Gustafsson
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Allow string literals to be passed to Name
parent
7c45e4c3
No related branches found
No related tags found
1 merge request
!176
Name literals
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
b_asic/graph_component.py
+13
-2
13 additions, 2 deletions
b_asic/graph_component.py
b_asic/special_operations.py
+2
-2
2 additions, 2 deletions
b_asic/special_operations.py
with
15 additions
and
4 deletions
b_asic/graph_component.py
+
13
−
2
View file @
82384ca6
...
@@ -7,9 +7,20 @@ Contains the base for all components with an ID in a signal flow graph.
...
@@ -7,9 +7,20 @@ Contains the base for all components with an ID in a signal flow graph.
from
abc
import
ABC
,
abstractmethod
from
abc
import
ABC
,
abstractmethod
from
collections
import
deque
from
collections
import
deque
from
copy
import
copy
,
deepcopy
from
copy
import
copy
,
deepcopy
from
typing
import
Any
,
Dict
,
Generator
,
Iterable
,
Mapping
,
NewType
,
cast
from
typing
import
Any
,
Dict
,
Generator
,
Iterable
,
Mapping
,
NewType
,
TypeAlias
,
cast
import
sys
# We want to be able to initialize Name with String literals, but still have the
# benefit of static type checking that we don't pass non-names to name locations.
# However, until python 3.11 a string literal type was not available. In those versions,
# we'll fall back on just aliasing `str` => Name.
if
sys
.
version_info
>=
(
3
,
11
):
from
typing
import
LiteralString
Name
:
TypeAlias
=
NewType
(
"
Name
"
,
str
)
|
LiteralString
else
:
Name
=
str
Name
=
NewType
(
"
Name
"
,
str
)
TypeName
=
NewType
(
"
TypeName
"
,
str
)
TypeName
=
NewType
(
"
TypeName
"
,
str
)
GraphID
=
NewType
(
"
GraphID
"
,
str
)
GraphID
=
NewType
(
"
GraphID
"
,
str
)
GraphIDNumber
=
NewType
(
"
GraphIDNumber
"
,
int
)
GraphIDNumber
=
NewType
(
"
GraphIDNumber
"
,
int
)
...
...
This diff is collapsed.
Click to expand it.
b_asic/special_operations.py
+
2
−
2
View file @
82384ca6
...
@@ -28,12 +28,12 @@ class Input(AbstractOperation):
...
@@ -28,12 +28,12 @@ class Input(AbstractOperation):
_execution_time
=
0
_execution_time
=
0
def
__init__
(
self
,
name
:
Name
=
Name
(
""
)
)
:
def
__init__
(
self
,
name
:
Name
=
""
):
"""
Construct an Input operation.
"""
"""
Construct an Input operation.
"""
super
().
__init__
(
super
().
__init__
(
input_count
=
0
,
input_count
=
0
,
output_count
=
1
,
output_count
=
1
,
name
=
Name
(
name
)
,
name
=
name
,
latency_offsets
=
{
"
out0
"
:
0
},
latency_offsets
=
{
"
out0
"
:
0
},
)
)
self
.
set_param
(
"
value
"
,
0
)
self
.
set_param
(
"
value
"
,
0
)
...
...
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