Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
LabComm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Anders Blomdell
LabComm
Commits
3e763544
Commit
3e763544
authored
10 years ago
by
Anders Blomdell
Browse files
Options
Downloads
Patches
Plain Diff
Allow python sample classes to be used as sample_ref's
Update packaging
parent
373eac7b
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/python/labcomm2014/LabComm.py
+15
-8
15 additions, 8 deletions
lib/python/labcomm2014/LabComm.py
packaging/make_srpm
+1
-1
1 addition, 1 deletion
packaging/make_srpm
with
16 additions
and
9 deletions
lib/python/labcomm2014/LabComm.py
+
15
−
8
View file @
3e763544
...
@@ -375,6 +375,9 @@ class SAMPLE(primitive):
...
@@ -375,6 +375,9 @@ class SAMPLE(primitive):
return
encoder
.
encode_type
(
i_SAMPLE
)
return
encoder
.
encode_type
(
i_SAMPLE
)
def
encode
(
self
,
encoder
,
value
):
def
encode
(
self
,
encoder
,
value
):
if
not
isinstance
(
value
,
type_decl
):
# Probably trying to encode a sample class, grab signature
value
=
value
.
signature
return
encoder
.
encode_int
(
encoder
.
ref_to_index
.
get
(
value
,
0
))
return
encoder
.
encode_int
(
encoder
.
ref_to_index
.
get
(
value
,
0
))
def
decode
(
self
,
decoder
,
obj
=
None
):
def
decode
(
self
,
decoder
,
obj
=
None
):
...
@@ -729,6 +732,9 @@ class Codec(object):
...
@@ -729,6 +732,9 @@ class Codec(object):
return
True
return
True
def
add_ref
(
self
,
ref
,
index
=
0
):
def
add_ref
(
self
,
ref
,
index
=
0
):
if
not
isinstance
(
ref
,
type_decl
):
# Probably trying to register a sample class, grab signature
ref
=
ref
.
signature
if
index
==
0
:
if
index
==
0
:
if
ref
.
sample
in
self
.
ref_to_index
:
if
ref
.
sample
in
self
.
ref_to_index
:
return
False
return
False
...
@@ -783,15 +789,16 @@ class Encoder(Codec):
...
@@ -783,15 +789,16 @@ class Encoder(Codec):
decl
.
encode_decl
(
self
)
decl
.
encode_decl
(
self
)
self
.
writer
.
mark_end
(
decl
,
None
)
self
.
writer
.
mark_end
(
decl
,
None
)
def
add_ref
(
self
,
decl
,
index
=
0
):
def
add_ref
(
self
,
ref
,
index
=
0
):
if
not
isinstance
(
decl
,
type_decl
):
if
not
isinstance
(
ref
,
type_decl
):
decl
=
decl
.
signature
# Trying to register a sample class
ref
=
sample_ref
(
name
=
decl
.
name
,
decl
=
decl
.
decl
,
sample
=
decl
)
ref
=
ref
.
signature
decl
=
sample_ref
(
name
=
ref
.
name
,
decl
=
ref
.
decl
,
sample
=
ref
)
if
index
==
0
:
if
index
==
0
:
self
.
writer
.
mark_begin
(
decl
,
None
)
self
.
writer
.
mark_begin
(
ref
,
None
)
if
super
(
Encoder
,
self
).
add_ref
(
ref
,
index
):
if
super
(
Encoder
,
self
).
add_ref
(
decl
,
index
):
ref
.
encode_decl
(
self
)
decl
.
encode_decl
(
self
)
self
.
writer
.
mark_end
(
decl
,
None
)
self
.
writer
.
mark_end
(
ref
,
None
)
def
encode
(
self
,
object
,
decl
=
None
):
def
encode
(
self
,
object
,
decl
=
None
):
if
decl
==
None
:
if
decl
==
None
:
...
...
This diff is collapsed.
Click to expand it.
packaging/make_srpm
+
1
−
1
View file @
3e763544
...
@@ -68,7 +68,7 @@ install -m u=r,g=r,o=r lib/csharp/labcomm2014.dll ${RPM_BUILD_ROOT}/usr/lib
...
@@ -68,7 +68,7 @@ install -m u=r,g=r,o=r lib/csharp/labcomm2014.dll ${RPM_BUILD_ROOT}/usr/lib
# Python
# Python
#
#
install -d
${
RPM_BUILD_ROOT
}
/%{python_sitelib}/labcomm2014
install -d
${
RPM_BUILD_ROOT
}
/%{python_sitelib}/labcomm2014
install lib/python/labcomm/*
${
RPM_BUILD_ROOT
}
/%{python_sitelib}/labcomm2014
install lib/python/labcomm
2014
/*
${
RPM_BUILD_ROOT
}
/%{python_sitelib}/labcomm2014
%files
%files
%defattr (-, root, root)
%defattr (-, root, root)
...
...
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