summaryrefslogtreecommitdiff
path: root/Cython/Compiler/MemoryView.py
diff options
context:
space:
mode:
Diffstat (limited to 'Cython/Compiler/MemoryView.py')
-rw-r--r--Cython/Compiler/MemoryView.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/Cython/Compiler/MemoryView.py b/Cython/Compiler/MemoryView.py
index 9adb194d3..50a948e3c 100644
--- a/Cython/Compiler/MemoryView.py
+++ b/Cython/Compiler/MemoryView.py
@@ -728,6 +728,7 @@ def get_axes_specs(env, axes):
return axes_specs
+
def validate_axes(pos, axes):
if len(axes) >= Options.buffer_max_dims:
error(pos, "More dimensions than the maximum number"
@@ -736,31 +737,27 @@ def validate_axes(pos, axes):
return True
-def all(it):
- for item in it:
- if not item:
- return False
- return True
def is_cf_contig(specs):
is_c_contig = is_f_contig = False
- if (len(specs) == 1 and specs == [('direct', 'contig')]):
+ if len(specs) == 1 and specs == [('direct', 'contig')]:
is_c_contig = True
elif (specs[-1] == ('direct','contig') and
- all([axis == ('direct','follow') for axis in specs[:-1]])):
+ all(axis == ('direct','follow') for axis in specs[:-1])):
# c_contiguous: 'follow', 'follow', ..., 'follow', 'contig'
is_c_contig = True
elif (len(specs) > 1 and
specs[0] == ('direct','contig') and
- all([axis == ('direct','follow') for axis in specs[1:]])):
+ all(axis == ('direct','follow') for axis in specs[1:])):
# f_contiguous: 'contig', 'follow', 'follow', ..., 'follow'
is_f_contig = True
return is_c_contig, is_f_contig
+
def get_mode(specs):
is_c_contig, is_f_contig = is_cf_contig(specs)