Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some fixes suggested by cython-lint in cython/core #108

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions cython/core/cusp_neighborhoods.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ cdef class CCuspNeighborhood():

def __repr__(self):
N = self._num_cusps
return 'Cusp Neighborhood with %d cusp%s'%(
return 'Cusp Neighborhood with %d cusp%s' % (
N, N != 1 and 's' or '')

def manifold(self):
Expand Down Expand Up @@ -65,7 +65,7 @@ cdef class CCuspNeighborhood():
return N
else:
raise IndexError('The specified cusp (%s) does not '
'exist.'%which_cusp)
'exist.' % which_cusp)

def num_cusps(self):
"""
Expand All @@ -78,7 +78,7 @@ cdef class CCuspNeighborhood():
Return the topological type of the specified cusp.
"""
N = self.check_index(which_cusp)
topology = get_cusp_neighborhood_topology(self.c_cusp_neighborhood,N)
topology = get_cusp_neighborhood_topology(self.c_cusp_neighborhood, N)
return CuspTopology[topology]

def get_displacement(self, which_cusp = 0):
Expand All @@ -92,8 +92,8 @@ cdef class CCuspNeighborhood():
displacement 0.)
"""
N = self.check_index(which_cusp)
disp = Number(Real2gen(get_cusp_neighborhood_displacement(
self.c_cusp_neighborhood, N)))
disp = Number(Real2gen(get_cusp_neighborhood_displacement(
self.c_cusp_neighborhood, N)))
return self._number_(disp)

def set_displacement(self, new_displacement, which_cusp=0):
Expand Down Expand Up @@ -241,15 +241,15 @@ cdef class CCuspNeighborhood():
if segment_list == NULL:
raise RuntimeError('The Ford domain construction failed.')
result = []
for n from 0 <= n < segment_list.num_segments:
for n in range(segment_list.num_segments):
segment = segment_list.segment[n]
if high_precision:
pair = (
self._number_(Complex2Number(segment.endpoint[0])),
self._number_(Complex2Number(segment.endpoint[1])) )
self._number_(Complex2Number(segment.endpoint[1])))
else:
pair = ( Complex2complex(segment.endpoint[0]),
Complex2complex(segment.endpoint[1]) )
pair = (Complex2complex(segment.endpoint[0]),
Complex2complex(segment.endpoint[1]))
result.append(pair)
free_cusp_neighborhood_segment_list(segment_list)
return result
Expand All @@ -275,7 +275,7 @@ cdef class CCuspNeighborhood():
if high_precision:
endpoints = (
self._number_(Complex2Number(segment.endpoint[0])),
self._number_(Complex2Number(segment.endpoint[1])) )
self._number_(Complex2Number(segment.endpoint[1])))
else:
endpoints = (Complex2complex(segment.endpoint[0]),
Complex2complex(segment.endpoint[1]))
Expand All @@ -299,10 +299,11 @@ cdef class CCuspNeighborhood():
which_cusp = self.check_index(which_cusp)
if HoroballViewer:
return ViewerWindow(HoroballViewer, self, which_cusp=which_cusp,
cutoff=cutoff, title='Cusp neighborhood%s of %s'%(
's' if self.num_cusps() > 1 else '', self.manifold_name))
else:
raise RuntimeError('The HoroballViewer class was not imported.')
cutoff=cutoff,
title='Cusp neighborhood%s of %s' % (
's' if self.num_cusps() > 1 else '',
self.manifold_name))
raise RuntimeError('The HoroballViewer class was not imported.')


class CuspNeighborhood(CCuspNeighborhood):
Expand Down
8 changes: 4 additions & 4 deletions cython/core/symmetry_group.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ cdef class SymmetryGroup():
if self.is_abelian():
theText = repr(self.abelian_description())
elif self.is_dihedral():
theText = 'D%d'%(self.order()//2)
theText = 'D%d' % (self.order()//2)
elif self.is_polyhedral():
theText = self.polyhedral_description()
elif self.is_S5():
theText = 'S5'
elif self.is_direct_product():
theText = '%s x %s' % self.direct_product_description()
theText = '%s x %s' % self.direct_product_description()
else:
theText = 'nonabelian group of order %d'%self.order()
theText = 'nonabelian group of order %d' % self.order()

return thePretext + theText

Expand Down Expand Up @@ -126,7 +126,7 @@ cdef class SymmetryGroup():
polyhedral group, return a description of it.
"""
cdef Boolean is_binary_group
cdef int p,q,r
cdef int p, q, r

if not self.is_polyhedral():
raise ValueError('The symmetry group is not polyhedral.')
Expand Down
Loading