[python-arrayfire] 178/250: Cleaning up interop.py

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Mar 28 22:59:46 UTC 2016


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch debian/master
in repository python-arrayfire.

commit 56897a09be0b9d4dd7804333bcda550aedde981d
Author: Pavan Yalamanchili <pavan at arrayfire.com>
Date:   Fri Dec 11 15:26:32 2015 -0500

    Cleaning up interop.py
---
 arrayfire/__init__.py |  4 +++-
 arrayfire/interop.py  | 11 +++++++----
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/arrayfire/__init__.py b/arrayfire/__init__.py
index 20b5a8a..79959bb 100644
--- a/arrayfire/__init__.py
+++ b/arrayfire/__init__.py
@@ -60,4 +60,6 @@ del ct
 del inspect
 del numbers
 del os
-del np
+
+if (AF_NUMPY_FOUND):
+    del np
diff --git a/arrayfire/interop.py b/arrayfire/interop.py
index 9aaa569..8095629 100644
--- a/arrayfire/interop.py
+++ b/arrayfire/interop.py
@@ -16,11 +16,12 @@ This module provides interoperability with the following python packages.
 """
 
 from .array import *
-from .data import reorder
 
 try:
     import numpy as np
-    AF_NP_FOUND=True
+    from .data import reorder
+
+    AF_NUMPY_FOUND=True
 
     def np_to_af_array(np_arr):
         """
@@ -32,7 +33,7 @@ try:
 
         Returns
         ---------
-        af_arry  : arrayfire.Array()
+        af_arr  : arrayfire.Array()
         """
         if (np_arr.flags['F_CONTIGUOUS']):
             return Array(np_arr.ctypes.data, np_arr.shape, np_arr.dtype.char)
@@ -55,5 +56,7 @@ try:
                 raise RuntimeError("Unsupported ndim")
         else:
             return np_to_af_array(np.asfortranarray(np_arr))
+
+    from_ndarray = np_to_af_array
 except:
-    AF_NP_FOUND=False
+    AF_NUMPY_FOUND=False

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/python-arrayfire.git



More information about the debian-science-commits mailing list