From d09aa431339648637ecfdd76c85dbf57d3ab97ce Mon Sep 17 00:00:00 2001 From: Celine Mercier Date: Wed, 31 Oct 2018 14:46:25 +0100 Subject: [PATCH] Cython API: added a function to get the full path to the DMS directory --- python/obitools3/dms/capi/obidms.pxd | 1 + python/obitools3/dms/dms.pyx | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/python/obitools3/dms/capi/obidms.pxd b/python/obitools3/dms/capi/obidms.pxd index e7da3c1..516c596 100755 --- a/python/obitools3/dms/capi/obidms.pxd +++ b/python/obitools3/dms/capi/obidms.pxd @@ -16,6 +16,7 @@ cdef extern from "obidms.h" nogil: struct OBIDMS_t: const_char_p dms_name + const_char_p directory_path OBIDMS_infos_p infos ctypedef OBIDMS_t* OBIDMS_p diff --git a/python/obitools3/dms/dms.pyx b/python/obitools3/dms/dms.pyx index d8beb33..10f1f97 100755 --- a/python/obitools3/dms/dms.pyx +++ b/python/obitools3/dms/dms.pyx @@ -38,10 +38,12 @@ cdef class DMS(OBIWrapper): cdef inline OBIDMS_p pointer(self) : return (self._pointer) + @staticmethod def obi_atexit() : atexit(obi_close_atexit) + @staticmethod def open_or_new(object dms_name) : cdef OBIDMS_p pointer @@ -56,6 +58,7 @@ cdef class DMS(OBIWrapper): dms = OBIWrapper.new_wrapper(DMS, pointer) return dms + @staticmethod def exists(object dms_name) : cdef bytes dms_name_b = tobytes(dms_name) @@ -65,6 +68,7 @@ cdef class DMS(OBIWrapper): raise RuntimeError("Error checking if a DMS exists") else : return bool(rep) + @staticmethod def new(object dms_name) : @@ -114,6 +118,17 @@ cdef class DMS(OBIWrapper): return self.pointer().dms_name + # DMS full path property getter + @property + def full_path(self) : + ''' + Returns the full path of the DMS directory + + @rtype: bytes + ''' + return self.pointer().directory_path + + # command history DOT graph property getter in the form of a bytes string @property def dot_history_graph(self):