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
21
Issues
21
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
392f110c
Commit
392f110c
authored
Oct 02, 2015
by
Celine Mercier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new functions in the OBIDMS_column class to raise NotImplementedError
exceptions and to get the creation date of a column
parent
6ced3c48
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
4 deletions
+37
-4
python/obitools3/obidms/_obidms.pxd
python/obitools3/obidms/_obidms.pxd
+6
-0
python/obitools3/obidms/_obidms.pyx
python/obitools3/obidms/_obidms.pyx
+26
-4
python/obitools3/obidms/capi/obidmscolumn.pxd
python/obitools3/obidms/capi/obidmscolumn.pxd
+5
-0
No files found.
python/obitools3/obidms/_obidms.pxd
View file @
392f110c
...
...
@@ -4,7 +4,9 @@ from .capi.obidms cimport OBIDMS_p
from
.capi.obidmscolumn
cimport
OBIDMS_column_p
from
.capi.obitypes
cimport
obiversion_t
,
OBIType_t
cdef
class
OBIDMS_column
cdef
class
OBIDMS
:
...
...
@@ -33,6 +35,10 @@ cdef class OBIDMS_column:
cdef
str
column_name
cpdef
object
get_item
(
self
,
size_t
line_nb
,
str
element_name
)
# cpdef set_item(self, size_t line_nb, str element_name, object value) TODO
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
)
python/obitools3/obidms/_obidms.pyx
View file @
392f110c
...
...
@@ -10,6 +10,8 @@ from .capi.obidmscolumn cimport obi_column_get_data_type_from_name, \
obi_column_get_line_count_from_name
,
\
obi_column_get_nb_lines_used
,
\
obi_column_get_elements_names
,
\
obi_column_get_formatted_creation_date
,
\
obi_column_get_formatted_creation_date_from_name
,
\
obi_create_column
,
\
obi_clone_column
,
\
obi_open_column
,
\
...
...
@@ -63,12 +65,17 @@ cdef class OBIDMS :
cdef
str
column_name
cdef
bytes
column_name_b
cdef
str
data_type
cdef
str
creation_date
cdef
obiversion_t
latest_version
cdef
size_t
line_count
p
=
Path
(
self
.
dms_name
+
'.obidms'
)
print
(
"{:<25} {:<25} {:<25} {:<25}"
.
format
(
'-Column name-'
,
'-Data type-'
,
'-Latest version number-'
,
'-Line count of latest version-'
))
print
(
"{:<25} {:<25} {:<25} {:<25}"
.
format
(
'-Column name-'
,
'-Data type-'
,
'-Latest version number-'
,
'-Line count of latest version-'
))
#'-Creation date of latest version-'))
for
entry
in
p
.
iterdir
():
if
entry
.
suffix
==
".obicol"
:
column_name
=
entry
.
stem
...
...
@@ -77,13 +84,19 @@ cdef class OBIDMS :
data_type
=
bytes2str
(
name_data_type
(
obi_column_get_data_type_from_name
(
self
.
pointer
,
column_name_b
)))
latest_version
=
obi_column_get_latest_version_from_name
(
self
.
pointer
,
column_name_b
)
line_count
=
obi_column_get_line_count_from_name
(
self
.
pointer
,
column_name_b
)
# creation_date = bytes2str(obi_column_get_formatted_creation_date_from_name(self.pointer, column_name_b)) #TODO
# print(creation_date)
dms
[
column_name
][
'data_type'
]
=
data_type
dms
[
column_name
][
'latest_version'
]
=
latest_version
dms
[
column_name
][
'line_count'
]
=
line_count
# dms[column_name]['creation_date'] = creation_date
print
(
"{:<25} {:<25} {:<25} {:<25}"
.
format
(
column_name
,
data_type
,
latest_version
,
line_count
))
return
dms
cpdef
OBIDMS_column
open_column
(
self
,
str
column_name
,
bint
create
=
False
,
...
...
@@ -109,6 +122,9 @@ cdef class OBIDMS :
data_type
=
obi_column_get_data_type_from_name
(
self
.
pointer
,
column_name_b
)
# Open the column with the right subclass depending on the data type and the mode (read-only or writable)
# TODO : check that data type is the same as previous version if it exists?
if
data_type
==
1
:
if
(
create
or
clone
)
:
column
=
OBIDMS_column_int_writable
(
self
,
column_name
,
...
...
@@ -266,18 +282,24 @@ cdef class OBIDMS_column :
cpdef
object
get_item
(
self
,
size_t
line_nb
,
str
element_name
):
raise
NotImplementedError
# cpdef set_item(self, size_t line_nb, str element_name, object value): TODO
# raise NotImplementedError
cpdef
list
get_elements_names
(
self
):
cdef
bytes
elements_names
elements_names
=
obi_column_get_elements_names
(
self
.
pointer
)
return
(
bytes2str
(
elements_names
)).
split
(
';'
)
cpdef
str
get_data_type
(
self
):
return
self
.
data_type
cpdef
size_t
get_nb_lines_used
(
self
):
return
obi_column_get_nb_lines_used
(
self
.
pointer
)
cpdef
str
get_creation_date
(
self
):
return
bytes2str
(
obi_column_get_formatted_creation_date
(
self
.
pointer
))
cpdef
close
(
self
):
raise
NotImplementedError
python/obitools3/obidms/capi/obidmscolumn.pxd
View file @
392f110c
...
...
@@ -56,6 +56,11 @@ cdef extern from "obidmscolumn.h" nogil:
size_t
obi_column_get_line_count_from_name
(
OBIDMS_p
dms
,
const_char_p
column_name
)
char
*
obi_column_get_formatted_creation_date
(
OBIDMS_column_p
column
)
char
*
obi_column_get_formatted_creation_date_from_name
(
OBIDMS_p
dms
,
const_char_p
column_name
)
cdef
extern
from
"obidmscolumn_int.h"
nogil
:
int
obi_column_set_obiint_with_elt_name
(
OBIDMS_column_p
column
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment