danepitkin commented on code in PR #444:
URL: https://github.com/apache/arrow-nanoarrow/pull/444#discussion_r1583576861


##########
python/src/nanoarrow/_lib.pyx:
##########
@@ -858,6 +858,24 @@ cdef class CSchemaView:
     def storage_type_id(self):
         return self._schema_view.storage_type
 
+    @property
+    def buffer_format(self):
+        if not self.extension_name and self._schema_view.type == 
self._schema_view.storage_type:
+            return self.storage_buffer_format

Review Comment:
   Can we add `return None` to be explicit? In Python, a function without 
`return` is commonly perceived similar to a void function in C/C++.



##########
python/src/nanoarrow/_lib.pyx:
##########
@@ -858,6 +858,24 @@ cdef class CSchemaView:
     def storage_type_id(self):
         return self._schema_view.storage_type
 
+    @property
+    def buffer_format(self):
+        if not self.extension_name and self._schema_view.type == 
self._schema_view.storage_type:
+            return self.storage_buffer_format
+
+    @property
+    def storage_buffer_format(self):
+        cdef char out[128]
+        cdef int element_size_bits = 0
+        if self._schema_view.type == NANOARROW_TYPE_FIXED_SIZE_BINARY:
+            element_size_bits = self._schema_view.fixed_size * 8
+
+        try:
+            c_format_from_arrow_type(self._schema_view.type, 
element_size_bits, sizeof(out), out)
+            return out.decode()
+        except ValueError:
+            pass

Review Comment:
   same here (can we add `return None`)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to