Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OBITools3
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
23
Issues
23
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
OBITools
OBITools3
Commits
9b066f43
Commit
9b066f43
authored
Nov 06, 2015
by
Celine Mercier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Major update: obiarrays with columns containing indices referring to
character strings.
parent
456551ff
Changes
35
Hide whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
632 additions
and
532 deletions
+632
-532
python/obitools3/obidms/_obidms.pxd
python/obitools3/obidms/_obidms.pxd
+11
-11
python/obitools3/obidms/_obidms.pyx
python/obitools3/obidms/_obidms.pyx
+13
-13
python/obitools3/obidms/_obidmscolumn_bool.pxd
python/obitools3/obidms/_obidmscolumn_bool.pxd
+10
-10
python/obitools3/obidms/_obidmscolumn_bool.pyx
python/obitools3/obidms/_obidmscolumn_bool.pyx
+10
-10
python/obitools3/obidms/_obidmscolumn_char.pxd
python/obitools3/obidms/_obidmscolumn_char.pxd
+10
-10
python/obitools3/obidms/_obidmscolumn_char.pyx
python/obitools3/obidms/_obidmscolumn_char.pyx
+13
-13
python/obitools3/obidms/_obidmscolumn_float.pxd
python/obitools3/obidms/_obidmscolumn_float.pxd
+10
-10
python/obitools3/obidms/_obidmscolumn_float.pyx
python/obitools3/obidms/_obidmscolumn_float.pyx
+10
-10
python/obitools3/obidms/_obidmscolumn_int.pxd
python/obitools3/obidms/_obidmscolumn_int.pxd
+10
-10
python/obitools3/obidms/_obidmscolumn_int.pyx
python/obitools3/obidms/_obidmscolumn_int.pyx
+10
-10
python/obitools3/obidms/_obidmscolumn_str.pxd
python/obitools3/obidms/_obidmscolumn_str.pxd
+10
-9
python/obitools3/obidms/_obidmscolumn_str.pyx
python/obitools3/obidms/_obidmscolumn_str.pyx
+13
-31
python/obitools3/obidms/capi/obidmscolumn.pxd
python/obitools3/obidms/capi/obidmscolumn.pxd
+36
-35
python/obitools3/obidms/capi/obitypes.pxd
python/obitools3/obidms/capi/obitypes.pxd
+3
-3
python/obitools3/unit_tests.py
python/obitools3/unit_tests.py
+47
-17
python/obitools3/version.py
python/obitools3/version.py
+1
-1
src/obiarray.c
src/obiarray.c
+158
-155
src/obiarray.h
src/obiarray.h
+130
-22
src/obidms.c
src/obidms.c
+0
-4
src/obidms.h
src/obidms.h
+2
-0
src/obidmscolumn.c
src/obidmscolumn.c
+22
-22
src/obidmscolumn.h
src/obidmscolumn.h
+11
-9
src/obidmscolumn_bool.c
src/obidmscolumn_bool.c
+8
-8
src/obidmscolumn_bool.h
src/obidmscolumn_bool.h
+4
-6
src/obidmscolumn_char.c
src/obidmscolumn_char.c
+8
-8
src/obidmscolumn_char.h
src/obidmscolumn_char.h
+4
-6
src/obidmscolumn_float.c
src/obidmscolumn_float.c
+8
-8
src/obidmscolumn_float.h
src/obidmscolumn_float.h
+4
-6
src/obidmscolumn_int.c
src/obidmscolumn_int.c
+8
-8
src/obidmscolumn_int.h
src/obidmscolumn_int.h
+4
-6
src/obidmscolumn_str.c
src/obidmscolumn_str.c
+13
-30
src/obidmscolumn_str.h
src/obidmscolumn_str.h
+24
-24
src/obierrno.h
src/obierrno.h
+1
-1
src/obitypes.c
src/obitypes.c
+2
-2
src/obitypes.h
src/obitypes.h
+4
-4
No files found.
python/obitools3/obidms/_obidms.pxd
View file @
9b066f43
...
...
@@ -2,7 +2,7 @@
from
.capi.obidms
cimport
OBIDMS_p
from
.capi.obidmscolumn
cimport
OBIDMS_column_p
from
.capi.obitypes
cimport
obiversion_t
,
OBIType_t
from
.capi.obitypes
cimport
obiversion_t
,
OBIType_t
,
index_t
cdef
class
OBIDMS_column
...
...
@@ -21,8 +21,8 @@ cdef class OBIDMS:
bint
clone
=*
,
bint
clone_data
=*
,
obiversion_t
version_number
=*
,
OBIType_t
data_type
=*
,
size
_t
nb_lines
=*
,
size
_t
nb_elements_per_line
=*
,
index
_t
nb_lines
=*
,
index
_t
nb_elements_per_line
=*
,
list
elements_names
=*
,
str
array_name
=*
)
...
...
@@ -34,14 +34,14 @@ cdef class OBIDMS_column:
cdef
str
data_type
# TODO keep as OBIType_t? both?
cdef
str
dms_name
cdef
str
column_name
cdef
size
_t
nb_elements_per_line
cdef
index
_t
nb_elements_per_line
cdef
list
elements_names
# cpdef object get_item(self,
size
_t line_nb, str element_name) TODO can't declare because not the same in all subclasses
# cpdef set_item(self,
size
_t line_nb, str element_name, object value) TODO can't declare because object value
cpdef
list
get_elements_names
(
self
)
cpdef
str
get_data_type
(
self
)
cpdef
size
_t
get_nb_lines_used
(
self
)
cpdef
str
get_creation_date
(
self
)
cpdef
close
(
self
)
# cpdef object get_item(self,
index
_t line_nb, str element_name) TODO can't declare because not the same in all subclasses
# cpdef set_item(self,
index
_t line_nb, str element_name, object value) TODO can't declare because object value
cpdef
list
get_elements_names
(
self
)
cpdef
str
get_data_type
(
self
)
cpdef
index
_t
get_nb_lines_used
(
self
)
cpdef
str
get_creation_date
(
self
)
cpdef
close
(
self
)
python/obitools3/obidms/_obidms.pyx
View file @
9b066f43
...
...
@@ -80,7 +80,7 @@ cdef class OBIDMS :
cdef
str
data_type
cdef
str
creation_date
cdef
obiversion_t
latest_version
cdef
size
_t
line_count
cdef
index
_t
line_count
cdef
OBIDMS_column_header_p
header
p
=
Path
(
self
.
dms_name
+
'.obidms'
)
...
...
@@ -117,8 +117,8 @@ cdef class OBIDMS :
bint
clone
=
False
,
bint
clone_data
=
True
,
obiversion_t
version_number
=-
1
,
OBIType_t
data_type
=
<
OBIType_t
>
0
,
size
_t
nb_lines
=
0
,
size
_t
nb_elements_per_line
=
0
,
index
_t
nb_lines
=
0
,
index
_t
nb_elements_per_line
=
0
,
list
elements_names
=
None
,
str
array_name
=
"default_obiarray"
):
...
...
@@ -222,7 +222,7 @@ cdef class OBIDMS :
version_number
,
data_type
,
nb_lines
,
nb_elements_per_line
,
elements_names
,
array_name
)
return
column
...
...
@@ -237,8 +237,8 @@ cdef class OBIDMS_column :
bint
clone
,
bint
clone_data
,
obiversion_t
version_number
,
OBIType_t
type
,
size
_t
nb_lines
,
size
_t
nb_elements_per_line
,
index
_t
nb_lines
,
index
_t
nb_elements_per_line
,
list
elements_names
,
str
array_name
):
...
...
@@ -279,8 +279,8 @@ cdef class OBIDMS_column :
def
__iter__
(
self
):
# Declarations
cdef
size
_t
lines_used
cdef
size
_t
line_nb
cdef
index
_t
lines_used
cdef
index
_t
line_nb
# Yield each line
lines_used
=
self
.
pointer
.
header
.
lines_used
...
...
@@ -288,19 +288,19 @@ cdef class OBIDMS_column :
yield
self
.
get_line
(
line_nb
)
def
__setitem__
(
self
,
size
_t
line_nb
,
object
value
):
def
__setitem__
(
self
,
index
_t
line_nb
,
object
value
):
self
.
set_line
(
line_nb
,
value
)
def
__getitem__
(
self
,
size
_t
line_nb
):
def
__getitem__
(
self
,
index
_t
line_nb
):
return
self
.
get_line
(
line_nb
)
# cpdef object get_item(self,
size
_t line_nb, str element_name): TODO
# cpdef object get_item(self,
index
_t line_nb, str element_name): TODO
# raise NotImplementedError
# cpdef set_item(self,
size
_t line_nb, str element_name, object value): TODO
# cpdef set_item(self,
index
_t line_nb, str element_name, object value): TODO
# raise NotImplementedError
...
...
@@ -312,7 +312,7 @@ cdef class OBIDMS_column :
return
self
.
data_type
cpdef
size
_t
get_nb_lines_used
(
self
):
cpdef
index
_t
get_nb_lines_used
(
self
):
return
self
.
pointer
.
header
.
lines_used
...
...
python/obitools3/obidms/_obidmscolumn_bool.pxd
View file @
9b066f43
#cython: language_level=3
from
.capi.obitypes
cimport
obibool_t
from
.capi.obitypes
cimport
obibool_t
,
index_t
from
._obidms
cimport
OBIDMS_column
cdef
class
OBIDMS_column_bool
(
OBIDMS_column
):
cpdef
object
get_line
(
self
,
size
_t
line_nb
)
cpdef
set_line
(
self
,
size
_t
line_nb
,
object
value
)
cpdef
object
get_line
(
self
,
index
_t
line_nb
)
cpdef
set_line
(
self
,
index
_t
line_nb
,
object
value
)
cpdef
close
(
self
)
cdef
class
OBIDMS_column_bool_writable
(
OBIDMS_column_bool
):
cpdef
set_line
(
self
,
size
_t
line_nb
,
object
value
)
cpdef
set_line
(
self
,
index
_t
line_nb
,
object
value
)
cpdef
close
(
self
)
cdef
class
OBIDMS_column_bool_multi_elts
(
OBIDMS_column_bool
):
cpdef
object
get_item
(
self
,
size
_t
line_nb
,
str
element_name
)
cpdef
object
get_line
(
self
,
size
_t
line_nb
)
cpdef
set_item
(
self
,
size
_t
line_nb
,
str
element_name
,
obibool_t
value
)
cpdef
set_line
(
self
,
size
_t
line_nb
,
object
values
)
cpdef
object
get_item
(
self
,
index
_t
line_nb
,
str
element_name
)
cpdef
object
get_line
(
self
,
index
_t
line_nb
)
cpdef
set_item
(
self
,
index
_t
line_nb
,
str
element_name
,
obibool_t
value
)
cpdef
set_line
(
self
,
index
_t
line_nb
,
object
values
)
cdef
class
OBIDMS_column_bool_multi_elts_writable
(
OBIDMS_column_bool_multi_elts
):
cpdef
set_item
(
self
,
size
_t
line_nb
,
str
element_name
,
obibool_t
value
)
cpdef
set_line
(
self
,
size
_t
line_nb
,
object
values
)
cpdef
set_item
(
self
,
index
_t
line_nb
,
str
element_name
,
obibool_t
value
)
cpdef
set_line
(
self
,
index
_t
line_nb
,
object
values
)
cpdef
close
(
self
)
python/obitools3/obidms/_obidmscolumn_bool.pyx
View file @
9b066f43
...
...
@@ -16,7 +16,7 @@ from cpython.bool cimport PyBool_FromLong
cdef
class
OBIDMS_column_bool
(
OBIDMS_column
):
cpdef
object
get_line
(
self
,
size
_t
line_nb
):
cpdef
object
get_line
(
self
,
index
_t
line_nb
):
cdef
obibool_t
value
cdef
object
result
value
=
obi_column_get_obibool_with_elt_idx
(
self
.
pointer
,
line_nb
,
0
)
...
...
@@ -28,7 +28,7 @@ cdef class OBIDMS_column_bool(OBIDMS_column):
result
=
PyBool_FromLong
(
value
)
return
result
cpdef
set_line
(
self
,
size
_t
line_nb
,
object
value
):
cpdef
set_line
(
self
,
index
_t
line_nb
,
object
value
):
raise
Exception
(
"Column is read-only"
)
cpdef
close
(
self
):
...
...
@@ -38,7 +38,7 @@ cdef class OBIDMS_column_bool(OBIDMS_column):
cdef
class
OBIDMS_column_bool_writable
(
OBIDMS_column_bool
):
cpdef
set_line
(
self
,
size
_t
line_nb
,
object
value
):
cpdef
set_line
(
self
,
index
_t
line_nb
,
object
value
):
if
obi_column_set_obibool_with_elt_idx
(
self
.
pointer
,
line_nb
,
0
,
<
obibool_t
>
value
)
<
0
:
raise
Exception
(
"Problem setting a value in a column"
)
...
...
@@ -49,7 +49,7 @@ cdef class OBIDMS_column_bool_writable(OBIDMS_column_bool):
cdef
class
OBIDMS_column_bool_multi_elts
(
OBIDMS_column_bool
):
cpdef
object
get_item
(
self
,
size
_t
line_nb
,
str
element_name
):
cpdef
object
get_item
(
self
,
index
_t
line_nb
,
str
element_name
):
cdef
obibool_t
value
cdef
object
result
value
=
obi_column_get_obibool_with_elt_name
(
self
.
pointer
,
line_nb
,
str2bytes
(
element_name
))
...
...
@@ -61,10 +61,10 @@ cdef class OBIDMS_column_bool_multi_elts(OBIDMS_column_bool):
result
=
PyBool_FromLong
(
value
)
return
result
cpdef
object
get_line
(
self
,
size
_t
line_nb
)
:
cpdef
object
get_line
(
self
,
index
_t
line_nb
)
:
cdef
obibool_t
value
cdef
object
result
cdef
size
_t
i
cdef
index
_t
i
cdef
bint
all_NA
result
=
{}
all_NA
=
True
...
...
@@ -79,20 +79,20 @@ cdef class OBIDMS_column_bool_multi_elts(OBIDMS_column_bool):
result
=
None
return
result
cpdef
set_item
(
self
,
size
_t
line_nb
,
str
element_name
,
obibool_t
value
):
cpdef
set_item
(
self
,
index
_t
line_nb
,
str
element_name
,
obibool_t
value
):
raise
Exception
(
"Column is read-only"
)
cpdef
set_line
(
self
,
size
_t
line_nb
,
object
values
):
cpdef
set_line
(
self
,
index
_t
line_nb
,
object
values
):
raise
Exception
(
"Column is read-only"
)
cdef
class
OBIDMS_column_bool_multi_elts_writable
(
OBIDMS_column_bool_multi_elts
):
cpdef
set_item
(
self
,
size
_t
line_nb
,
str
element_name
,
obibool_t
value
):
cpdef
set_item
(
self
,
index
_t
line_nb
,
str
element_name
,
obibool_t
value
):
if
obi_column_set_obibool_with_elt_name
(
self
.
pointer
,
line_nb
,
str2bytes
(
element_name
),
value
)
<
0
:
raise
Exception
(
"Problem setting a value in a column"
)
cpdef
set_line
(
self
,
size
_t
line_nb
,
object
values
):
cpdef
set_line
(
self
,
index
_t
line_nb
,
object
values
):
cdef
obibool_t
value
for
element_name
in
values
:
value
=
<
obibool_t
>
values
[
element_name
]
...
...
python/obitools3/obidms/_obidmscolumn_char.pxd
View file @
9b066f43
#cython: language_level=3
from
.capi.obitypes
cimport
obichar_t
from
.capi.obitypes
cimport
obichar_t
,
index_t
from
._obidms
cimport
OBIDMS_column
cdef
class
OBIDMS_column_char
(
OBIDMS_column
):
cpdef
object
get_line
(
self
,
size
_t
line_nb
)
cpdef
set_line
(
self
,
size
_t
line_nb
,
object
value
)
cpdef
object
get_line
(
self
,
index
_t
line_nb
)
cpdef
set_line
(
self
,
index
_t
line_nb
,
object
value
)
cpdef
close
(
self
)
cdef
class
OBIDMS_column_char_writable
(
OBIDMS_column_char
):
cpdef
set_line
(
self
,
size
_t
line_nb
,
object
value
)
cpdef
set_line
(
self
,
index
_t
line_nb
,
object
value
)
cpdef
close
(
self
)
cdef
class
OBIDMS_column_char_multi_elts
(
OBIDMS_column_char
):
cpdef
object
get_item
(
self
,
size
_t
line_nb
,
str
element_name
)
cpdef
object
get_line
(
self
,
size
_t
line_nb
)
cpdef
set_item
(
self
,
size
_t
line_nb
,
str
element_name
,
bytes
value
)
cpdef
set_line
(
self
,
size
_t
line_nb
,
object
values
)
cpdef
object
get_item
(
self
,
index
_t
line_nb
,
str
element_name
)
cpdef
object
get_line
(
self
,
index
_t
line_nb
)
cpdef
set_item
(
self
,
index
_t
line_nb
,
str
element_name
,
bytes
value
)
cpdef
set_line
(
self
,
index
_t
line_nb
,
object
values
)
cdef
class
OBIDMS_column_char_multi_elts_writable
(
OBIDMS_column_char_multi_elts
):
cpdef
set_item
(
self
,
size
_t
line_nb
,
str
element_name
,
bytes
value
)
cpdef
set_line
(
self
,
size
_t
line_nb
,
object
values
)
cpdef
set_item
(
self
,
index
_t
line_nb
,
str
element_name
,
bytes
value
)
cpdef
set_line
(
self
,
index
_t
line_nb
,
object
values
)
cpdef
close
(
self
)
python/obitools3/obidms/_obidmscolumn_char.pyx
View file @
9b066f43
...
...
@@ -14,7 +14,7 @@ from obitools3.utils cimport str2bytes
cdef
class
OBIDMS_column_char
(
OBIDMS_column
):
cpdef
object
get_line
(
self
,
size
_t
line_nb
):
cpdef
object
get_line
(
self
,
index
_t
line_nb
):
cdef
obichar_t
value
cdef
object
result
value
=
obi_column_get_obichar_with_elt_idx
(
self
.
pointer
,
line_nb
,
0
)
...
...
@@ -26,7 +26,7 @@ cdef class OBIDMS_column_char(OBIDMS_column):
result
=
<
bytes
>
value
return
result
cpdef
set_line
(
self
,
size
_t
line_nb
,
object
value
):
cpdef
set_line
(
self
,
index
_t
line_nb
,
object
value
):
raise
Exception
(
"Column is read-only"
)
cpdef
close
(
self
):
...
...
@@ -36,7 +36,7 @@ cdef class OBIDMS_column_char(OBIDMS_column):
cdef
class
OBIDMS_column_char_writable
(
OBIDMS_column_char
):
cpdef
set_line
(
self
,
size
_t
line_nb
,
object
value
):
cpdef
set_line
(
self
,
index
_t
line_nb
,
object
value
):
if
obi_column_set_obichar_with_elt_idx
(
self
.
pointer
,
line_nb
,
0
,
<
bytes
>
value
[
0
])
<
0
:
raise
Exception
(
"Problem setting a value in a column"
)
...
...
@@ -47,7 +47,7 @@ cdef class OBIDMS_column_char_writable(OBIDMS_column_char):
cdef
class
OBIDMS_column_char_multi_elts
(
OBIDMS_column_char
):
cpdef
object
get_item
(
self
,
size
_t
line_nb
,
str
element_name
):
cpdef
object
get_item
(
self
,
index
_t
line_nb
,
str
element_name
):
cdef
obichar_t
value
cdef
object
result
value
=
obi_column_get_obichar_with_elt_name
(
self
.
pointer
,
line_nb
,
str2bytes
(
element_name
))
...
...
@@ -59,10 +59,10 @@ cdef class OBIDMS_column_char_multi_elts(OBIDMS_column_char):
result
=
<
bytes
>
value
return
result
cpdef
object
get_line
(
self
,
size
_t
line_nb
)
:
cpdef
object
get_line
(
self
,
index
_t
line_nb
)
:
cdef
obichar_t
value
cdef
object
result
cdef
size
_t
i
cdef
index
_t
i
cdef
bint
all_NA
result
=
{}
all_NA
=
True
...
...
@@ -77,20 +77,20 @@ cdef class OBIDMS_column_char_multi_elts(OBIDMS_column_char):
result
=
None
return
result
cpdef
set_item
(
self
,
size
_t
line_nb
,
str
element_name
,
bytes
value
):
cpdef
set_item
(
self
,
index
_t
line_nb
,
str
element_name
,
bytes
value
):
raise
Exception
(
"Column is read-only"
)
cpdef
set_line
(
self
,
size
_t
line_nb
,
object
values
):
cpdef
set_line
(
self
,
index
_t
line_nb
,
object
values
):
raise
Exception
(
"Column is read-only"
)
cdef
class
OBIDMS_column_char_multi_elts_writable
(
OBIDMS_column_char_multi_elts
):
cpdef
set_item
(
self
,
size
_t
line_nb
,
str
element_name
,
bytes
value
):
cpdef
set_item
(
self
,
index
_t
line_nb
,
str
element_name
,
bytes
value
):
if
obi_column_set_obichar_with_elt_name
(
self
.
pointer
,
line_nb
,
str2bytes
(
element_name
),
value
[
0
])
<
0
:
raise
Exception
(
"Problem setting a value in a column"
)
cpdef
set_line
(
self
,
size
_t
line_nb
,
object
values
):
cpdef
set_line
(
self
,
index
_t
line_nb
,
object
values
):
cdef
bytes
value
for
element_name
in
values
:
value
=
<
bytes
>
values
[
element_name
]
...
...
@@ -106,7 +106,7 @@ cdef class OBIDMS_column_char_multi_elts_writable(OBIDMS_column_char_multi_elts)
# cdef class OBIDMS_column_char(OBIDMS_column) :
#
# cpdef object get_item(self,
size
_t line_nb, str element_name):
# cpdef object get_item(self,
index
_t line_nb, str element_name):
# cdef char value
# cdef object result
# value = obi_column_get_obichar_with_elt_name(self.pointer, line_nb, str2bytes(element_name))
...
...
@@ -118,7 +118,7 @@ cdef class OBIDMS_column_char_multi_elts_writable(OBIDMS_column_char_multi_elts)
# result = <bytes> value
# return result
#
# cpdef set_item(self,
size
_t line_nb, str element_name, bytes value):
# cpdef set_item(self,
index
_t line_nb, str element_name, bytes value):
# raise Exception("Column is read-only")
#
# cpdef close(self):
...
...
@@ -128,7 +128,7 @@ cdef class OBIDMS_column_char_multi_elts_writable(OBIDMS_column_char_multi_elts)
#
# cdef class OBIDMS_column_char_writable(OBIDMS_column_char) :
#
# cpdef set_item(self,
size
_t line_nb, str element_name, bytes value):
# cpdef set_item(self,
index
_t line_nb, str element_name, bytes value):
# if obi_column_set_obichar_with_elt_name(self.pointer, line_nb, str2bytes(element_name), value[0]) < 0:
# raise Exception("Problem setting a value in a column")
#
...
...
python/obitools3/obidms/_obidmscolumn_float.pxd
View file @
9b066f43
#cython: language_level=3
from
.capi.obitypes
cimport
obifloat_t
from
.capi.obitypes
cimport
obifloat_t
,
index_t
from
._obidms
cimport
OBIDMS_column
cdef
class
OBIDMS_column_float
(
OBIDMS_column
):
cpdef
object
get_line
(
self
,
size
_t
line_nb
)
cpdef
set_line
(
self
,
size
_t
line_nb
,
object
value
)
cpdef
object
get_line
(
self
,
index
_t
line_nb
)
cpdef
set_line
(
self
,
index
_t
line_nb
,
object
value
)
cpdef
close
(
self
)
cdef
class
OBIDMS_column_float_writable
(
OBIDMS_column_float
):
cpdef
set_line
(
self
,
size
_t
line_nb
,
object
value
)
cpdef
set_line
(
self
,
index
_t
line_nb
,
object
value
)
cpdef
close
(
self
)
cdef
class
OBIDMS_column_float_multi_elts
(
OBIDMS_column_float
):
cpdef
object
get_item
(
self
,
size
_t
line_nb
,
str
element_name
)
cpdef
object
get_line
(
self
,
size
_t
line_nb
)
cpdef
set_item
(
self
,
size
_t
line_nb
,
str
element_name
,
obifloat_t
value
)
cpdef
set_line
(
self
,
size
_t
line_nb
,
object
values
)
cpdef
object
get_item
(
self
,
index
_t
line_nb
,
str
element_name
)
cpdef
object
get_line
(
self
,
index
_t
line_nb
)
cpdef
set_item
(
self
,
index
_t
line_nb
,
str
element_name
,
obifloat_t
value
)
cpdef
set_line
(
self
,
index
_t
line_nb
,
object
values
)
cdef
class
OBIDMS_column_float_multi_elts_writable
(
OBIDMS_column_float_multi_elts
):
cpdef
set_item
(
self
,
size
_t
line_nb
,
str
element_name
,
obifloat_t
value
)
cpdef
set_line
(
self
,
size
_t
line_nb
,
object
values
)
cpdef
set_item
(
self
,
index
_t
line_nb
,
str
element_name
,
obifloat_t
value
)
cpdef
set_line
(
self
,
index
_t
line_nb
,
object
values
)
cpdef
close
(
self
)
python/obitools3/obidms/_obidmscolumn_float.pyx
View file @
9b066f43
...
...
@@ -14,7 +14,7 @@ from obitools3.utils cimport str2bytes
cdef
class
OBIDMS_column_float
(
OBIDMS_column
):
cpdef
object
get_line
(
self
,
size
_t
line_nb
):
cpdef
object
get_line
(
self
,
index
_t
line_nb
):
cdef
obifloat_t
value
cdef
object
result
value
=
obi_column_get_obifloat_with_elt_idx
(
self
.
pointer
,
line_nb
,
0
)
...
...
@@ -26,7 +26,7 @@ cdef class OBIDMS_column_float(OBIDMS_column):
result
=
<
double
>
value
return
result
cpdef
set_line
(
self
,
size
_t
line_nb
,
object
value
):
cpdef
set_line
(
self
,
index
_t
line_nb
,
object
value
):
raise
Exception
(
"Column is read-only"
)
cpdef
close
(
self
):
...
...
@@ -36,7 +36,7 @@ cdef class OBIDMS_column_float(OBIDMS_column):
cdef
class
OBIDMS_column_float_writable
(
OBIDMS_column_float
):
cpdef
set_line
(
self
,
size
_t
line_nb
,
object
value
):
cpdef
set_line
(
self
,
index
_t
line_nb
,
object
value
):
if
obi_column_set_obifloat_with_elt_idx
(
self
.
pointer
,
line_nb
,
0
,
<
obifloat_t
>
value
)
<
0
:
raise
Exception
(
"Problem setting a value in a column"
)
...
...
@@ -47,7 +47,7 @@ cdef class OBIDMS_column_float_writable(OBIDMS_column_float):
cdef
class
OBIDMS_column_float_multi_elts
(
OBIDMS_column_float
):
cpdef
object
get_item
(
self
,
size
_t
line_nb
,
str
element_name
):
cpdef
object
get_item
(
self
,
index
_t
line_nb
,
str
element_name
):
cdef
obifloat_t
value
cdef
object
result
value
=
obi_column_get_obifloat_with_elt_name
(
self
.
pointer
,
line_nb
,
str2bytes
(
element_name
))
...
...
@@ -59,10 +59,10 @@ cdef class OBIDMS_column_float_multi_elts(OBIDMS_column_float):
result
=
<
double
>
value
return
result
cpdef
object
get_line
(
self
,
size
_t
line_nb
)
:
cpdef
object
get_line
(
self
,
index
_t
line_nb
)
:
cdef
obifloat_t
value
cdef
object
result
cdef
size
_t
i
cdef
index
_t
i
cdef
bint
all_NA
result
=
{}
all_NA
=
True
...
...
@@ -77,20 +77,20 @@ cdef class OBIDMS_column_float_multi_elts(OBIDMS_column_float):
result
=
None
return
result
cpdef
set_item
(
self
,
size
_t
line_nb
,
str
element_name
,
obifloat_t
value
):
cpdef
set_item
(
self
,
index
_t
line_nb
,
str
element_name
,
obifloat_t
value
):
raise
Exception
(
"Column is read-only"
)
cpdef
set_line
(
self
,
size
_t
line_nb
,
object
values
):
cpdef
set_line
(
self
,
index
_t
line_nb
,
object
values
):
raise
Exception
(
"Column is read-only"
)
cdef
class
OBIDMS_column_float_multi_elts_writable
(
OBIDMS_column_float_multi_elts
):
cpdef
set_item
(
self
,
size
_t
line_nb
,
str
element_name
,
obifloat_t
value
):
cpdef
set_item
(
self
,
index
_t
line_nb
,
str
element_name
,
obifloat_t
value
):
if
obi_column_set_obifloat_with_elt_name
(
self
.
pointer
,
line_nb
,
str2bytes
(
element_name
),
value
)
<
0
:
raise
Exception
(
"Problem setting a value in a column"
)
cpdef
set_line
(
self
,
size
_t
line_nb
,
object
values
):
cpdef
set_line
(
self
,
index
_t
line_nb
,
object
values
):
cdef
obifloat_t
value
for
element_name
in
values
:
value
=
<
obifloat_t
>
values
[
element_name
]
...
...
python/obitools3/obidms/_obidmscolumn_int.pxd
View file @
9b066f43
#cython: language_level=3
from
.capi.obitypes
cimport
obiint_t
from
.capi.obitypes
cimport
obiint_t
,
index_t
from
._obidms
cimport
OBIDMS_column
cdef
class
OBIDMS_column_int
(
OBIDMS_column
):
cpdef
object
get_line
(
self
,
size
_t
line_nb
)
cpdef
set_line
(
self
,
size
_t
line_nb
,
object
value
)
cpdef
object
get_line
(
self
,
index
_t
line_nb
)
cpdef
set_line
(
self
,
index
_t
line_nb
,
object
value
)
cpdef
close
(
self
)
cdef
class
OBIDMS_column_int_writable
(
OBIDMS_column_int
):
cpdef
set_line
(
self
,
size
_t
line_nb
,
object
value
)
cpdef
set_line
(
self
,
index
_t
line_nb
,
object
value
)
cpdef
close
(
self
)
cdef
class
OBIDMS_column_int_multi_elts
(
OBIDMS_column_int
):
cpdef
object
get_item
(
self
,
size
_t
line_nb
,
str
element_name
)
cpdef
object
get_line
(
self
,
size
_t
line_nb
)
cpdef
set_item
(
self
,
size
_t
line_nb
,
str
element_name
,
obiint_t
value
)
cpdef
set_line
(
self
,
size
_t
line_nb
,
object
values
)
cpdef
object
get_item
(
self
,
index
_t
line_nb
,
str
element_name
)
cpdef
object
get_line
(
self
,
index
_t
line_nb
)
cpdef
set_item
(
self
,
index
_t
line_nb
,
str
element_name
,
obiint_t
value
)
cpdef
set_line
(
self
,
index
_t
line_nb
,
object
values
)
cdef
class
OBIDMS_column_int_multi_elts_writable
(
OBIDMS_column_int_multi_elts
):
cpdef
set_item
(
self
,
size
_t
line_nb
,
str
element_name
,
obiint_t
value
)
cpdef
set_line
(
self
,
size
_t
line_nb
,
object
values
)
cpdef
set_item
(
self
,
index
_t
line_nb
,
str
element_name
,
obiint_t
value
)
cpdef
set_line
(
self
,
index
_t
line_nb
,
object
values
)
cpdef
close
(
self
)
python/obitools3/obidms/_obidmscolumn_int.pyx
View file @
9b066f43
...
...
@@ -16,7 +16,7 @@ from cpython.int cimport PyInt_FromLong
cdef
class
OBIDMS_column_int
(
OBIDMS_column
):
cpdef
object
get_line
(
self
,
size
_t
line_nb
):
cpdef
object
get_line
(
self
,
index
_t
line_nb
):
cdef
obiint_t
value
cdef
object
result
value
=
obi_column_get_obiint_with_elt_idx
(
self
.
pointer
,
line_nb
,
0
)
...
...
@@ -28,7 +28,7 @@ cdef class OBIDMS_column_int(OBIDMS_column):
result
=
PyInt_FromLong
(
value
)
return
result
cpdef
set_line
(
self
,
size
_t
line_nb
,
object
value
):
cpdef
set_line
(
self
,
index
_t
line_nb
,
object
value
):
raise
Exception
(
"Column is read-only"
)
cpdef
close
(
self
):
...
...
@@ -38,7 +38,7 @@ cdef class OBIDMS_column_int(OBIDMS_column):
cdef
class
OBIDMS_column_int_writable
(
OBIDMS_column_int
):
cpdef
set_line
(
self
,
size
_t
line_nb
,
object
value
):
cpdef
set_line
(
self
,
index
_t
line_nb
,
object
value
):
if
obi_column_set_obiint_with_elt_idx
(
self
.
pointer
,
line_nb
,
0
,
<
obiint_t
>
value
)
<
0
:
raise
Exception
(
"Problem setting a value in a column"
)
...
...
@@ -49,7 +49,7 @@ cdef class OBIDMS_column_int_writable(OBIDMS_column_int):
cdef
class
OBIDMS_column_int_multi_elts
(
OBIDMS_column_int
):
cpdef
object
get_item
(
self
,
size
_t
line_nb
,
str
element_name
):
cpdef
object
get_item
(
self
,
index
_t
line_nb
,
str
element_name
):
cdef
obiint_t
value
cdef
object
result
value
=
obi_column_get_obiint_with_elt_name
(
self
.
pointer
,
line_nb
,
str2bytes
(
element_name
))
...
...
@@ -61,10 +61,10 @@ cdef class OBIDMS_column_int_multi_elts(OBIDMS_column_int):
result
=
PyInt_FromLong
(
value
)
return
result
cpdef
object
get_line
(
self
,
size
_t
line_nb
)
:
cpdef
object
get_line
(
self
,
index
_t
line_nb
)
:
cdef
obiint_t
value
cdef
object
result
cdef
size
_t
i
cdef
index
_t
i
cdef
bint
all_NA
result
=
{}
all_NA
=
True
...
...
@@ -79,20 +79,20 @@ cdef class OBIDMS_column_int_multi_elts(OBIDMS_column_int):
result
=
None
return
result
cpdef
set_item
(
self
,
size
_t
line_nb
,
str
element_name
,
obiint_t
value
):
cpdef
set_item
(
self
,
index
_t
line_nb
,
str
element_name
,
obiint_t
value
):
raise
Exception
(
"Column is read-only"
)
cpdef
set_line
(
self
,
size
_t
line_nb
,
object
values
):
cpdef
set_line
(
self
,
index
_t
line_nb
,
object
values
):
raise
Exception
(
"Column is read-only"
)
cdef
class
OBIDMS_column_int_multi_elts_writable
(
OBIDMS_column_int_multi_elts
):
cpdef
set_item
(
self
,
size
_t
line_nb
,
str
element_name
,
obiint_t
value
):
cpdef
set_item
(
self
,
index
_t
line_nb
,
str
element_name
,
obiint_t
value
):
if
obi_column_set_obiint_with_elt_name
(
self
.
pointer
,
line_nb
,
str2bytes
(
element_name
),
value
)
<
0
:
raise
Exception
(
"Problem setting a value in a column"
)
cpdef
set_line
(
self
,
size
_t
line_nb
,
object
values
):
cpdef
set_line
(
self
,
index
_t
line_nb
,
object
values
):
cdef
obiint_t
value
for
element_name
in
values
:
value
=
<
obiint_t
>
values
[
element_name
]
...
...
python/obitools3/obidms/_obidmscolumn_str.pxd
View file @
9b066f43
#cython: language_level=3
from
.capi.obitypes
cimport
index_t
from
._obidms
cimport
OBIDMS_column