Skip to content

Commit

Permalink
partial fix for E251, using autopep8 (too big for one pull-request) (#97
Browse files Browse the repository at this point in the history
)
  • Loading branch information
fchapoton authored Mar 24, 2023
1 parent 03b36ba commit 10e7ee2
Show file tree
Hide file tree
Showing 59 changed files with 335 additions and 338 deletions.
104 changes: 52 additions & 52 deletions python/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,10 @@ def identify(self, extends_to_link=False):


def canonical_retriangulation(
manifold, verified = False,
interval_bits_precs = verify.default_interval_bits_precs,
exact_bits_prec_and_degrees = verify.default_exact_bits_prec_and_degrees,
verbose = False):
manifold, verified=False,
interval_bits_precs=verify.default_interval_bits_precs,
exact_bits_prec_and_degrees=verify.default_exact_bits_prec_and_degrees,
verbose=False):
"""
The canonical retriangulation which is closely related to the canonical
cell decomposition and described in more detail `here
Expand Down Expand Up @@ -196,9 +196,9 @@ def canonical_retriangulation(
if verified:
return verify.verified_canonical_retriangulation(
manifold,
interval_bits_precs = interval_bits_precs,
exact_bits_prec_and_degrees = exact_bits_prec_and_degrees,
verbose = verbose)
interval_bits_precs=interval_bits_precs,
exact_bits_prec_and_degrees=exact_bits_prec_and_degrees,
verbose=verbose)
else:
return manifold._canonical_retriangulation()

Expand All @@ -208,10 +208,10 @@ def canonical_retriangulation(


def isometry_signature(
manifold, of_link = False, verified = False,
interval_bits_precs = verify.default_interval_bits_precs,
exact_bits_prec_and_degrees = verify.default_exact_bits_prec_and_degrees,
verbose = False):
manifold, of_link=False, verified=False,
interval_bits_precs=verify.default_interval_bits_precs,
exact_bits_prec_and_degrees=verify.default_exact_bits_prec_and_degrees,
verbose=False):
"""
The isomorphism signature of the canonical retriangulation. This is a
complete invariant of the isometry type of a hyperbolic 3-manifold and
Expand Down Expand Up @@ -258,17 +258,17 @@ def isometry_signature(
raise ValueError('isometry_signature needs all cusps to be complete')

retrig = manifold.canonical_retriangulation(
verified = verified,
interval_bits_precs = interval_bits_precs,
exact_bits_prec_and_degrees = exact_bits_prec_and_degrees,
verbose = verbose)
verified=verified,
interval_bits_precs=interval_bits_precs,
exact_bits_prec_and_degrees=exact_bits_prec_and_degrees,
verbose=verbose)

if not retrig:
return None

return retrig.triangulation_isosig(decorated = of_link,
ignore_cusp_ordering = True,
ignore_curve_orientations = True)
return retrig.triangulation_isosig(decorated=of_link,
ignore_cusp_ordering=True,
ignore_curve_orientations=True)


Manifold.isometry_signature = isometry_signature
Expand Down Expand Up @@ -356,14 +356,14 @@ def cusp_area_matrix(manifold, method='trigDependentTryCanonize',
"available as verified computation. "
"Pass verified = True.")
return verify.verified_maximal_cusp_area_matrix(
manifold, bits_prec = bits_prec)
manifold, bits_prec=bits_prec)
if method in ['trigDependent', 'trigDependentTryCanonize']:
if method == 'trigDependentTryCanonize':
manifold = manifold.copy()
manifold.canonize()

return verify.triangulation_dependent_cusp_area_matrix(
manifold, verified = verified, bits_prec = bits_prec)
manifold, verified=verified, bits_prec=bits_prec)

raise ValueError("method passed to cusp_area_matrix must be "
"'trigDependent', 'trigDependentTryCanonize', "
Expand All @@ -376,9 +376,9 @@ def cusp_area_matrix(manifold, method='trigDependentTryCanonize',
from .verify import cusp_areas as verify_cusp_areas


def cusp_areas(manifold, policy = 'unbiased',
method = 'trigDependentTryCanonize',
verified = False, bits_prec = None, first_cusps=[]):
def cusp_areas(manifold, policy='unbiased',
method='trigDependentTryCanonize',
verified=False, bits_prec=None, first_cusps=[]):
"""
Picks areas for the cusps such that the corresponding cusp
neighborhoods are disjoint. By default, the ``policy`` is
Expand Down Expand Up @@ -460,9 +460,9 @@ def cusp_areas(manifold, policy = 'unbiased',


def short_slopes(manifold,
length = 6,
policy = 'unbiased', method = 'trigDependentTryCanonize',
verified = False, bits_prec = None, first_cusps=[]):
length=6,
policy='unbiased', method='trigDependentTryCanonize',
verified=False, bits_prec=None, first_cusps=[]):
"""
Picks disjoint cusp neighborhoods (using
:py:meth:`Manifold.cusp_areas`, thus the same arguments can be
Expand Down Expand Up @@ -503,22 +503,22 @@ def short_slopes(manifold,

return [
verify_short_slopes.short_slopes_from_cusp_shape_and_area(
shape, area, length = length)
shape, area, length=length)
for shape, area
in zip(manifold.cusp_info(
'shape', verified = verified, bits_prec = bits_prec),
'shape', verified=verified, bits_prec=bits_prec),
manifold.cusp_areas(
policy = policy, method = method,
verified = verified, bits_prec = bits_prec, first_cusps=first_cusps)) ]
policy=policy, method=method,
verified=verified, bits_prec=bits_prec, first_cusps=first_cusps)) ]


Manifold.short_slopes = short_slopes
ManifoldHP.short_slopes = short_slopes


def cusp_translations(manifold, policy = 'unbiased',
method = 'trigDependentTryCanonize',
verified = False, bits_prec = None, first_cusps=[]):
def cusp_translations(manifold, policy='unbiased',
method='trigDependentTryCanonize',
verified=False, bits_prec=None, first_cusps=[]):
"""
Picks disjoint cusp neighborhoods and returns the respective
(complex) Euclidean translations of the meridian and longitude for
Expand Down Expand Up @@ -556,21 +556,21 @@ def cusp_translations(manifold, policy = 'unbiased',

return [
verify_short_slopes.translations_from_cusp_shape_and_area(
shape, area, kernel_convention = True)
shape, area, kernel_convention=True)
for shape, area
in zip(manifold.cusp_info(
'shape', verified = verified, bits_prec = bits_prec),
'shape', verified=verified, bits_prec=bits_prec),
manifold.cusp_areas(
policy = policy, method = method,
verified = verified, bits_prec = bits_prec, first_cusps=first_cusps)) ]
policy=policy, method=method,
verified=verified, bits_prec=bits_prec, first_cusps=first_cusps)) ]


Manifold.cusp_translations = cusp_translations
ManifoldHP.cusp_translations = cusp_translations


def complex_volume(manifold, verified_modulo_2_torsion = False,
bits_prec = None):
def complex_volume(manifold, verified_modulo_2_torsion=False,
bits_prec=None):
"""
Returns the complex volume, i.e.
volume + i 2 pi^2 (chern simons)
Expand Down Expand Up @@ -605,7 +605,7 @@ def complex_volume(manifold, verified_modulo_2_torsion = False,
"""
if verified_modulo_2_torsion:
return verify.verified_complex_volume_torsion(
manifold, bits_prec = bits_prec)
manifold, bits_prec=bits_prec)

if bits_prec:
raise Exception("Arbitrary precision for complex volume only "
Expand All @@ -620,7 +620,7 @@ def complex_volume(manifold, verified_modulo_2_torsion = False,

from . import drilling
drilling._add_methods(Manifold)
drilling._add_methods(ManifoldHP, high_precision = True)
drilling._add_methods(ManifoldHP, high_precision=True)

try:
from .gui import ViewerWindow
Expand All @@ -632,7 +632,7 @@ def complex_volume(manifold, verified_modulo_2_torsion = False,
_importErrorRaytracing = str(e)


def manifold_inside_view(self, cohomology_class = None, geodesics = []):
def manifold_inside_view(self, cohomology_class=None, geodesics=[]):
"""
Show raytraced inside view of hyperbolic manifold. See
`images <https://im.icerm.brown.edu/portfolio/snappy-views/>`_
Expand Down Expand Up @@ -674,18 +674,18 @@ def manifold_inside_view(self, cohomology_class = None, geodesics = []):
return ViewerWindow(
InsideViewer,
self,
title = "Inside view of %s" % self.name(),
weights = weights,
cohomology_basis = cohomology_basis,
cohomology_class = cohomology_class,
geodesics = geodesics)
title="Inside view of %s" % self.name(),
weights=weights,
cohomology_basis=cohomology_basis,
cohomology_class=cohomology_class,
geodesics=geodesics)


Manifold.inside_view = manifold_inside_view
ManifoldHP.inside_view = manifold_inside_view


def all_translations(self, verified = False, bits_prec = None):
def all_translations(self, verified=False, bits_prec=None):
"""
Returns the (complex) Euclidean translations of the meridian
and longitude for each cusp measured with respect to the cusp neighborhood.
Expand Down Expand Up @@ -745,7 +745,7 @@ def all_translations(self, verified = False, bits_prec = None):
# Use the implementation in verify.cuspTranslations that uses
# tetrahedra_shapes and ComplexCuspNeighborhood
return verify.cusp_translations_for_neighborhood(
self, verified = verified, bits_prec = bits_prec)
self, verified=verified, bits_prec=bits_prec)

# Use the implementation in the SnapPea kernel
return [ self.translations(i) for i in range(self.num_cusps()) ]
Expand Down Expand Up @@ -848,9 +848,9 @@ def _link_exterior(self, with_hyperbolic_structure=True,
The module defines the following classes:
%s""" % textwrap.fill(
', '.join(__all__) + '.',
width = 78,
initial_indent = ' ',
subsequent_indent = ' ')
width=78,
initial_indent=' ',
subsequent_indent=' ')

# Add easy way to get the version info
from .version import version as release_info
Expand Down
6 changes: 3 additions & 3 deletions python/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def open_file(self, event=None):
parent=self.window,
title='Run Saved Transcript In Current Namespace',
defaultextension='.py',
filetypes = [
filetypes=[
("Python and text files", "*.py *.ipy *.txt", "TEXT"),
("All text files", "", "TEXT"),
("All files", "")])
Expand Down Expand Up @@ -153,7 +153,7 @@ def open_link_file(self, event=None):
openfile = filedialog.askopenfile(
title='Load Link Projection File',
defaultextension='.lnk',
filetypes = [
filetypes=[
("Link and text files", "*.lnk *.txt", "TEXT"),
("All text files", "", "TEXT"),
("All files", "")])
Expand All @@ -178,7 +178,7 @@ def save_file_as(self, event=None):
mode='w',
title='Save Transcript as a Python script',
defaultextension='.py',
filetypes = [
filetypes=[
("Python and text files", "*.py *.ipy *.txt", "TEXT"),
("All text files", "", "TEXT"),
("All files", "")])
Expand Down
10 changes: 4 additions & 6 deletions python/app_menus.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ def __init__(self, menubar):
# on OS X setting name='help' makes this a system help menu.
Tk_.Menu.__init__(self, menubar, name='help')
if sys.platform != 'darwin':
self.add_command(label = 'SnapPy Help ...', command=self.show_SnapPy_help)
self.add_command(label = help_report_bugs_label,
self.add_command(label='SnapPy Help ...', command=self.show_SnapPy_help)
self.add_command(label=help_report_bugs_label,
command=self.show_bugs_page)
self.extra_commands = {}

Expand Down Expand Up @@ -288,8 +288,7 @@ def dirichlet_menus(self):
command=lambda : about_snappy(self.master))
Python_menu.add_separator()
if sys.platform in ('linux2', 'linux') and self.main_window is not None:
Python_menu.add_command(label='Quit SnapPy', command=
self.main_window.close)
Python_menu.add_command(label='Quit SnapPy', command=self.main_window.close)
menubar.add_cascade(label='SnapPy', menu=Python_menu)
File_menu = Tk_.Menu(menubar, name='file')
add_menu(self.master, File_menu, 'Open...', None, 'disabled')
Expand Down Expand Up @@ -348,8 +347,7 @@ def inside_view_menus(self):
command=lambda : about_snappy(self.master))
Python_menu.add_separator()
if sys.platform in ('linux2', 'linux') and self.main_window is not None:
Python_menu.add_command(label='Quit SnapPy', command=
self.main_window.close)
Python_menu.add_command(label='Quit SnapPy', command=self.main_window.close)
menubar.add_cascade(label='SnapPy', menu=Python_menu)
File_menu = Tk_.Menu(menubar, name='file')
add_menu(self.master, File_menu, 'Open...', None, 'disabled')
Expand Down
8 changes: 4 additions & 4 deletions python/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def __init__(self, manifold, root=None, main_window=None):
notebook.add(invariants_tab, text='Invariants', padding=[0])
notebook.add(self.dirichlet_viewer, text='Dirichlet')
notebook.add(self.horoball_viewer, text='Cusp Nbhds')
notebook.add(self.build_inside_view(), text = 'Inside view')
notebook.add(self.build_inside_view(), text='Inside view')
notebook.add(symmetry_tab, text='Symmetry', padding=[0])
if link_tab:
notebook.add(link_tab.canvas, text='Link')
Expand Down Expand Up @@ -431,7 +431,7 @@ def build_symmetry(self):
message1 = ttk.Label(frame,
text='Future releases of SnapPy will show more information here.')
message2 = ttk.Label(frame,
text = 'Type SymmetryGroup.<tab> in the command shell to see '
text='Type SymmetryGroup.<tab> in the command shell to see '
'what is available.')
message1.grid(row=1, column=0, pady=(40, 10))
message2.grid(row=2, column=0)
Expand All @@ -452,7 +452,7 @@ def build_inside_view(self):
if not self.manifold.is_orientable():
text = ("Inside view for non-orientable manifolds such as %s "
"is not supported yet.") % self.manifold.name()
return ttk.Label(self, text = text)
return ttk.Label(self, text=text)

try:
# delayed import to avoid cycle
Expand All @@ -465,7 +465,7 @@ def build_inside_view(self):
import traceback
text = ("Could not instantiate inside view. "
"Error was:\n\n%s" % traceback.format_exc())
return ttk.Label(self, text = text)
return ttk.Label(self, text=text)

def update_menus(self, menubar):
"""Default menus used by the Invariants, Symmetry and Link tabs."""
Expand Down
Loading

0 comments on commit 10e7ee2

Please sign in to comment.