-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added support for keyword arguments in define-pymethod;
bug fix in dictionary object conversion; added example of using h5py
- Loading branch information
Showing
6 changed files
with
149 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
;; | ||
;; Example from Python h5py documentation. | ||
;; | ||
;; | ||
;; This program is free software: you can redistribute it and/or | ||
;; modify it under the terms of the GNU General Public License as | ||
;; published by the Free Software Foundation, either version 3 of the | ||
;; License, or (at your option) any later version. | ||
;; | ||
;; This program is distributed in the hope that it will be useful, but | ||
;; WITHOUT ANY WARRANTY; without even the implied warranty of | ||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
;; General Public License for more details. | ||
;; | ||
;; A full copy of the GPL license can be found at | ||
;; <http://www.gnu.org/licenses/>. | ||
;; | ||
|
||
(import chicken) | ||
(require-extension pyffi) | ||
|
||
(py-start) | ||
|
||
(py-import "h5py") | ||
(py-import "numpy") | ||
|
||
|
||
(define-pyfun "h5py.File" name mode) | ||
(define-pymethod "close") ;; File | ||
(define-pymethod "create_dataset" kw: (dtype)) ;; File | ||
|
||
(define-pyslot "shape") | ||
(define-pyslot "dtype") | ||
(define-pyslot "name") | ||
|
||
(define f (h5py.File "mytestfile.hdf5" "w")) | ||
|
||
(define dset (create_dataset f "mydataset" (vector 100) dtype: "i")) | ||
|
||
(print (py-object-from (name dset))) | ||
(print (py-object-from (shape dset))) | ||
(print (py-object-type (dtype dset))) | ||
|
||
(close f) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters