Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-codegen
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
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Christian Heinigk
dune-codegen
Commits
ec0fe9e4
Commit
ec0fe9e4
authored
9 years ago
by
Dominic Kempf
Browse files
Options
Downloads
Patches
Plain Diff
Add my cgen extensions
parent
cebdbb60
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
python/dune/perftool/cgen/__init__.py
+22
-0
22 additions, 0 deletions
python/dune/perftool/cgen/__init__.py
python/dune/perftool/cgen/clazz.py
+17
-0
17 additions, 0 deletions
python/dune/perftool/cgen/clazz.py
with
39 additions
and
0 deletions
python/dune/perftool/cgen/__init__.py
0 → 100644
+
22
−
0
View file @
ec0fe9e4
from
__future__
import
absolute_import
from
cgen
import
*
from
dune.perftool.cgen.clazz
import
Class
class
Namespace
(
PrivateNamespace
):
"""
A namespace Generable that is provided the name of the namespace.
Normally, you would revert the inheritance here, but I do not want
to interfere with cgen and for some reason it does not provide
explicitly named namespace.
"""
def
__init__
(
self
,
*
args
,
**
kwargs
):
name
=
kwargs
.
pop
(
"
name
"
)
PrivateNamespace
.
__init__
(
self
,
*
args
,
**
kwargs
)
self
.
name
=
name
def
get_namespace_name
(
self
):
return
self
.
name
\ No newline at end of file
This diff is collapsed.
Click to expand it.
python/dune/perftool/cgen/clazz.py
0 → 100644
+
17
−
0
View file @
ec0fe9e4
from
cgen
import
Generable
class
Class
(
Generable
):
"""
Generator for a templated class
"""
def
__init__
(
self
,
name
,
public_methods
=
[],
tparams
=
[],
constructors
=
[]):
self
.
name
=
name
self
.
public_methods
=
public_methods
self
.
tparams
=
tparams
assert
isinstance
(
name
,
str
)
from
cgen
import
FunctionBody
for
m
in
self
.
methods
:
assert
isinstance
(
n
,
FunctionBody
)
def
generate
(
self
):
yield
"
class {}
"
.
format
(
self
.
name
)
\ 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