Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
2e884463
Commit
2e884463
authored
Jan 19, 2013
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
undo code removal - not entirely clear what to make of it
parent
2257147a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
0 deletions
+60
-0
Cython/Shadow.py
Cython/Shadow.py
+60
-0
No files found.
Cython/Shadow.py
View file @
2e884463
# cython.* namespace for pure mode.
__version__
=
"0.18b1"
# Shamelessly copied from Cython/minivect/minitypes.py
class
_ArrayType
(
object
):
is_array
=
True
subtypes
=
[
'dtype'
]
def
__init__
(
self
,
dtype
,
ndim
,
is_c_contig
=
False
,
is_f_contig
=
False
,
inner_contig
=
False
,
broadcasting
=
None
):
self
.
dtype
=
dtype
self
.
ndim
=
ndim
self
.
is_c_contig
=
is_c_contig
self
.
is_f_contig
=
is_f_contig
self
.
inner_contig
=
inner_contig
or
is_c_contig
or
is_f_contig
self
.
broadcasting
=
broadcasting
def
__repr__
(
self
):
axes
=
[
":"
]
*
self
.
ndim
if
self
.
is_c_contig
:
axes
[
-
1
]
=
"::1"
elif
self
.
is_f_contig
:
axes
[
0
]
=
"::1"
return
"%s[%s]"
%
(
self
.
dtype
,
", "
.
join
(
axes
))
def
index_type
(
base_type
,
item
):
"""
Support array type creation by slicing, e.g. double[:, :] specifies
a 2D strided array of doubles. The syntax is the same as for
Cython memoryviews.
"""
assert
isinstance
(
item
,
(
tuple
,
slice
))
def
verify_slice
(
s
):
if
s
.
start
or
s
.
stop
or
s
.
step
not
in
(
None
,
1
):
raise
minierror
.
InvalidTypeSpecification
(
"Only a step of 1 may be provided to indicate C or "
"Fortran contiguity"
)
if
isinstance
(
item
,
tuple
):
step_idx
=
None
for
idx
,
s
in
enumerate
(
item
):
verify_slice
(
s
)
if
s
.
step
and
(
step_idx
or
idx
not
in
(
0
,
len
(
item
)
-
1
)):
raise
minierror
.
InvalidTypeSpecification
(
"Step may only be provided once, and only in the "
"first or last dimension."
)
if
s
.
step
==
1
:
step_idx
=
idx
return
_ArrayType
(
base_type
,
len
(
item
),
is_c_contig
=
step_idx
==
len
(
item
)
-
1
,
is_f_contig
=
step_idx
==
0
)
else
:
verify_slice
(
item
)
return
_ArrayType
(
base_type
,
1
,
is_c_contig
=
bool
(
item
.
step
))
# END shameless copy
compiled
=
False
_Unspecified
=
object
()
...
...
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