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

fix some old prints and usage of super() #118

Merged
merged 1 commit into from
Oct 17, 2023
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
3 changes: 2 additions & 1 deletion dev/ccache.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@
def compile_one(command):
try:
distutils.spawn.spawn(command)
except distutils.errors.DistutilsExecError, msg:
except distutils.errors.DistutilsExecError as msg:
return msg


def compile_parallel(self, sources, output_dir=None, macros=None, include_dirs=None,
debug=0, extra_preargs=None, extra_postargs=None, depends=None):
# Next two lines from distutils.ccompiler.CCompiler.compile:
Expand Down
4 changes: 1 addition & 3 deletions dev/cs_prob.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,4 @@
if vol in values:
continue
values.add(vol)
print vol, "after", c, "iterations"


print(vol, "after", c, "iterations")
4 changes: 2 additions & 2 deletions dev/hom_segfault/prob.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import snappy
M1 = snappy.Manifold('m1.tri')
M2 = snappy.Manifold('m2.tri')
print M1.volume(), M2.volume()
print M2.is_isometric_to(M1)
print(M1.volume(), M2.volume())
print(M2.is_isometric_to(M1))
10 changes: 5 additions & 5 deletions dev/homology_test/hard_homology.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def manifolds():
return [ TestManifold(*[eval(a) for a in line[:-1].split("\t")])
for line in gzip.open("hard_homology.data.gz").readlines()]


def main():
count = 0
for M in manifolds():
Expand All @@ -29,11 +30,10 @@ def main():
if count > 675:
break
hom = C.big_homology()
#assert C.small_homology() == hom
#hom = C.small_homology()
print count, C.num_tetrahedra(), hom
# assert C.small_homology() == hom
# hom = C.small_homology()
print(count, C.num_tetrahedra(), hom)


if __name__ == "__main__":
main()

2 changes: 1 addition & 1 deletion dev/vericlosed/oneVertexTruncatedComplex.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class OneVertexTruncatedComplex(TruncatedComplex):

def __init__(self, hyperbolic_structure):
super(OneVertexTruncatedComplex, self).__init__(
super().__init__(
hyperbolic_structure.mcomplex)

self.hyperbolic_structure = hyperbolic_structure
Expand Down
2 changes: 1 addition & 1 deletion python/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ class SnapPyNumbers():

def __new__(cls, precision=53):
if precision not in SnapPyNumbers._cache:
obj = super(SnapPyNumbers, cls).__new__(cls)
obj = super().__new__(cls)
obj._precision = precision
SnapPyNumbers._cache[precision] = obj
return obj
Expand Down
4 changes: 2 additions & 2 deletions python/ptolemy/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class ZeroDimensionalComponent(Component):

def __init__(self, l, p=None):
self.dimension = 0
super(ZeroDimensionalComponent, self).__init__(l)
super().__init__(l)


class NonZeroDimensionalComponent(Component):
Expand All @@ -36,7 +36,7 @@ def __init__(self, witnesses=[],
self.dimension = dimension
self.free_variables = free_variables
self.genus = genus
super(NonZeroDimensionalComponent, self).__init__(witnesses)
super().__init__(witnesses)

def _base_str_(self):
if self.free_variables is None:
Expand Down
6 changes: 3 additions & 3 deletions python/ptolemy/coordinates.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def __init__(self, d, is_numerical=True, py_eval_section=None,
self._matrix_cache = []
self._inverse_matrix_cache = []

super(PtolemyCoordinates, self).__init__(processed_dict)
super().__init__(processed_dict)

def __repr__(self):
dict_repr = dict.__repr__(self)
Expand Down Expand Up @@ -1009,7 +1009,7 @@ class Flattenings(dict):
"""

def __init__(self, d, manifold_thunk=lambda : None, evenN=2):
super(Flattenings, self).__init__(d)
super().__init__(d)
self._is_numerical = True
self._manifold_thunk = manifold_thunk
self.dimension = 0
Expand Down Expand Up @@ -1298,7 +1298,7 @@ class CrossRatios(dict):
"""

def __init__(self, d, is_numerical=True, manifold_thunk=None):
super(CrossRatios, self).__init__(d)
super().__init__(d)
self._is_numerical = is_numerical
self._manifold_thunk = manifold_thunk

Expand Down
2 changes: 1 addition & 1 deletion python/ptolemy/findLoops.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Vertex(tuple):
"""

def __new__(cls, tet, v0, v1, v2):
return super(Vertex, cls).__new__(cls, (tet, v0, v1, v2))
return super().__new__(cls, (tet, v0, v1, v2))

def edges_starting_at_vertex(self):
"""
Expand Down
2 changes: 1 addition & 1 deletion python/ptolemy/reginaWrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def __init__(self, *args, **kwargs):
"""
Constructor - takes same arguments as NTriangulation.
"""
super(NTriangulationForPtolemy, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)

# Make sure we are oriented
if not self.isOriented():
Expand Down
2 changes: 1 addition & 1 deletion python/ptolemy/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ class MethodMappingList(list):
"""

def __init__(self, l=[], p=None):
super(MethodMappingList, self).__init__(l)
super().__init__(l)

def __call__(self, *args, **kwargs):
return type(self)([elt(*args, **kwargs) for elt in self],
Expand Down
6 changes: 3 additions & 3 deletions python/raytracing/finite_raytracing_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def from_triangulation(triangulation, weights=None):
return r

def __init__(self, hyperbolic_structure):
super(FiniteRaytracingData, self).__init__(
super().__init__(
hyperbolic_structure.mcomplex)

def _compute_matrices(self, hyperbolic_structure):
Expand Down Expand Up @@ -136,7 +136,7 @@ def _check_consistency(self):
def get_uniform_bindings(self):
# self._check_consistency()

d = super(FiniteRaytracingData, self).get_uniform_bindings()
d = super().get_uniform_bindings()
d['TetrahedraEdges.R13EdgeEnds'] = (
'vec4[]',
[ edge_end
Expand All @@ -153,7 +153,7 @@ def get_uniform_bindings(self):
return d

def get_compile_time_constants(self):
d = super(FiniteRaytracingData, self).get_compile_time_constants()
d = super().get_compile_time_constants()
d[b'##finiteTrig##'] = 1
return d

Expand Down
8 changes: 4 additions & 4 deletions python/raytracing/ideal_raytracing_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def from_manifold(manifold,
return r

def __init__(self, mcomplex, snappy_manifold):
super(IdealRaytracingData, self).__init__(mcomplex)
super().__init__(mcomplex)
self.snappy_manifold = snappy_manifold

def _add_O13_matrices_to_faces(self):
Expand Down Expand Up @@ -244,7 +244,7 @@ def _add_log_holonomies(self):
def get_uniform_bindings(self):
# _check_consistency(self.mcomplex)

d = super(IdealRaytracingData, self).get_uniform_bindings()
d = super().get_uniform_bindings()

orientations = [
+1 if tet.ShapeParameters[t3m.E01].imag() > 0 else -1
Expand Down Expand Up @@ -327,7 +327,7 @@ def get_uniform_bindings(self):
return d

def get_compile_time_constants(self):
d = super(IdealRaytracingData, self).get_compile_time_constants()
d = super().get_compile_time_constants()
d[b'##finiteTrig##'] = 0
return d

Expand Down Expand Up @@ -357,7 +357,7 @@ def cusp_view_state_and_scale(self, which_cusp):

class NonGeometricRaytracingData(McomplexEngine):
def __init__(self, mcomplex):
super(NonGeometricRaytracingData, self).__init__(mcomplex)
super().__init__(mcomplex)

def get_compile_time_constants(self):
return {
Expand Down
2 changes: 1 addition & 1 deletion python/snap/kernel_structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def _clean_ideal_vertices(vertices):

class TransferKernelStructuresEngine(McomplexEngine):
def __init__(self, mcomplex, snappyTriangulation):
super(TransferKernelStructuresEngine, self).__init__(mcomplex)
super().__init__(mcomplex)
self.snappyTriangulation = snappyTriangulation

def add_shapes(self, shapes):
Expand Down
4 changes: 2 additions & 2 deletions python/verify/interval_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,13 +277,13 @@ class _IntervalTreeTester(IntervalTree):

def __init__(self):
self._entries = []
super(_IntervalTreeTester, self).__init__()
super().__init__()

def insert(self, interval, value):
# Insert in plain list for reference
self._entries.append((interval, value))
# Insert into red black tree
super(_IntervalTreeTester, self).insert(interval, value)
super().insert(interval, value)

def brute_force_find(self, interval):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def from_manifold_and_shapes(snappyManifold, shapes):
return CuspTilingEngine(m, original_mcomplex, cusp_areas, translations)

def __init__(self, mcomplex, original_mcomplex, cusp_areas, translations):
super(CuspTilingEngine, self).__init__(mcomplex)
super().__init__(mcomplex)

self.original_mcomplex = original_mcomplex
self.cusp_areas = cusp_areas
Expand Down
Loading