Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pystencils-sfg
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
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pycodegen
pystencils-sfg
Commits
2dca4f92
Commit
2dca4f92
authored
4 months ago
by
Frederik Hennig
Browse files
Options
Downloads
Patches
Plain Diff
remove superfluous interfaces; remove debug lines from coverage
parent
b87be486
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!17
Improved Source File and Code Structure Modelling
Pipeline
#73684
passed
4 months ago
Stage: Code Quality
Stage: Tests
Stage: Documentation
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
pyproject.toml
+2
-0
2 additions, 0 deletions
pyproject.toml
src/pystencilssfg/ir/entities.py
+1
-53
1 addition, 53 deletions
src/pystencilssfg/ir/entities.py
src/pystencilssfg/ir/syntax.py
+0
-10
0 additions, 10 deletions
src/pystencilssfg/ir/syntax.py
with
3 additions
and
63 deletions
pyproject.toml
+
2
−
0
View file @
2dca4f92
...
...
@@ -59,6 +59,7 @@ parentdir_prefix = "pystencilssfg-"
[tool.coverage.run]
omit
=
[
"setup.py"
,
"noxfile.py"
,
"src/pystencilssfg/_version.py"
,
"integration/*"
]
...
...
@@ -68,4 +69,5 @@ exclude_also = [
"
\\
.
\\
.
\\
.
\n
"
,
"if TYPE_CHECKING:"
,
"@(abc
\\
.)?abstractmethod"
,
"assert False"
]
This diff is collapsed.
Click to expand it.
src/pystencilssfg/ir/entities.py
+
1
−
53
View file @
2dca4f92
...
...
@@ -7,10 +7,9 @@ from typing import (
Sequence
,
Generator
,
)
from
dataclasses
import
replace
from
itertools
import
chain
from
pystencils
import
CreateKernelConfig
,
create_kernel
,
Field
from
pystencils
import
Field
from
pystencils.codegen
import
Kernel
from
pystencils.types
import
PsType
,
PsCustomType
...
...
@@ -164,57 +163,6 @@ class SfgKernelNamespace(SfgNamespace):
)
self
.
_kernels
[
kernel
.
name
]
=
kernel
def
add
(
self
,
kernel
:
Kernel
,
name
:
str
|
None
=
None
):
"""
Adds an existing pystencils AST to this namespace.
If a name is specified, the AST
'
s function name is changed.
"""
if
name
is
None
:
kernel_name
=
kernel
.
name
else
:
kernel_name
=
name
if
kernel_name
in
self
.
_kernels
:
raise
ValueError
(
f
"
Duplicate kernels: A kernel called
{
kernel_name
}
already exists in namespace
{
self
.
fqname
}
"
)
if
name
is
not
None
:
kernel
.
name
=
kernel_name
khandle
=
SfgKernelHandle
(
kernel_name
,
self
,
kernel
)
self
.
_kernels
[
kernel_name
]
=
khandle
# TODO: collect includes later
# for header in kernel.required_headers:
# self._ctx.add_include(
# SfgHeaderInclude(HeaderFile.parse(header), private=True)
# )
return
khandle
def
create
(
self
,
assignments
,
name
:
str
|
None
=
None
,
config
:
CreateKernelConfig
|
None
=
None
,
):
"""
Creates a new pystencils kernel from a list of assignments and a configuration.
This is a wrapper around `pystencils.create_kernel`
with a subsequent call to `add`.
"""
if
config
is
None
:
config
=
CreateKernelConfig
()
if
name
is
not
None
:
if
name
in
self
.
_kernels
:
raise
ValueError
(
f
"
Duplicate kernels: A kernel with name
{
name
}
already exists in namespace
{
self
.
fqname
}
"
)
config
=
replace
(
config
,
function_name
=
name
)
# type: ignore
kernel
=
create_kernel
(
assignments
,
config
=
config
)
return
self
.
add
(
kernel
)
class
SfgFunction
(
SfgCodeEntity
):
"""
A free function.
"""
...
...
This diff is collapsed.
Click to expand it.
src/pystencilssfg/ir/syntax.py
+
0
−
10
View file @
2dca4f92
...
...
@@ -2,7 +2,6 @@ from __future__ import annotations
from
enum
import
Enum
,
auto
from
typing
import
(
Generator
,
Iterable
,
TypeVar
,
Generic
,
...
...
@@ -15,7 +14,6 @@ from .entities import (
SfgKernelHandle
,
SfgFunction
,
SfgClassMember
,
SfgMemberVariable
,
SfgVisibility
,
SfgClass
,
)
...
...
@@ -99,14 +97,6 @@ class SfgVisibilityBlock:
def
elements
(
self
,
elems
:
Iterable
[
SfgClassBodyElement
]):
self
.
_elements
=
list
(
elems
)
def
members
(
self
)
->
Generator
[
SfgClassMember
,
None
,
None
]:
for
elem
in
self
.
_elements
:
match
elem
:
case
SfgEntityDecl
(
entity
)
|
SfgEntityDef
(
entity
):
yield
entity
case
SfgMemberVariable
():
yield
elem
class
SfgNamespaceBlock
:
"""
A C++ namespace block.
...
...
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