Skip to content

Commit

Permalink
Trac #34290: fix some W391
Browse files Browse the repository at this point in the history
about no empty final lines

URL: https://trac.sagemath.org/34290
Reported by: chapoton
Ticket author(s): Frédéric Chapoton
Reviewer(s): Travis Scrimshaw
  • Loading branch information
Release Manager committed Sep 25, 2022
2 parents d8b4ee8 + 7c5dc66 commit fa19f63
Show file tree
Hide file tree
Showing 35 changed files with 37 additions and 96 deletions.
3 changes: 0 additions & 3 deletions src/sage/algebras/lie_algebras/subalgebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
- Eero Hakavuori (2018-08-29): initial version
"""

# ****************************************************************************
# Copyright (C) 2018 Eero Hakavuori <[email protected]>
#
Expand All @@ -15,7 +14,6 @@
# (at your option) any later version.
# https://www.gnu.org/licenses/
# ****************************************************************************

from sage.algebras.lie_algebras.lie_algebra_element import LieSubalgebraElementWrapper
from sage.categories.lie_algebras import LieAlgebras
from sage.categories.homset import Hom
Expand Down Expand Up @@ -975,4 +973,3 @@ def adjoint_matrix(self, sparse=False):
return matrix(self.base_ring(),
[M.coordinate_vector(P.bracket(self, b).to_vector(sparse=sparse))
for b in basis], sparse=sparse).transpose()

9 changes: 3 additions & 6 deletions src/sage/all_cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,18 @@
This is all.py (load all sage functions) plus set-up for the Sage commandline.
"""

#*****************************************************************************
# ****************************************************************************
# Copyright (C) 2007 William Stein <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# http://www.gnu.org/licenses/
#*****************************************************************************

# https://www.gnu.org/licenses/
# ****************************************************************************
sage_mode = 'cmdline'

from sage.all import *
from sage.calculus.predefined import x

sage.misc.session.init()

1 change: 0 additions & 1 deletion src/sage/calculus/predefined.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,3 @@
X = _var('X')
Y = _var('Y')
Z = _var('Z')

1 change: 0 additions & 1 deletion src/sage/coding/grs_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -2389,4 +2389,3 @@ def decoding_radius(self):
GRSErrorErasureDecoder._decoder_type = {"error-erasure", "always-succeed"}
GeneralizedReedSolomonCode._registered_decoders["KeyEquationSyndrome"] = GRSKeyEquationSyndromeDecoder
GRSKeyEquationSyndromeDecoder._decoder_type = {"hard-decision", "always-succeed"}

8 changes: 3 additions & 5 deletions src/sage/coding/self_dual_codes.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
- [HP2003] \W. C. Huffman, V. Pless, Fundamentals of
Error-Correcting Codes, Cambridge Univ. Press, 2003.
- [P] \V. Pless, "A classification of self-orthogonal codes over GF(2)",
- [P] \V. Pless, *A classification of self-orthogonal codes over GF(2)*,
Discrete Math 3 (1972) 209-246.
"""

Expand All @@ -97,6 +97,7 @@

_F = GF(2)


def _MS(n):
r"""
For internal use; returns the floor(n/2) x n matrix space over GF(2).
Expand Down Expand Up @@ -162,6 +163,7 @@ def _matId(n):
Id.append(MSn.identity_matrix())
return Id


def _MS2(n):
r"""
For internal use; returns the floor(n/2) x floor(n/2) matrix space over GF(2).
Expand Down Expand Up @@ -933,7 +935,3 @@ def self_dual_binary_codes(n):
"3":self_dual_codes_22_3,"4":self_dual_codes_22_4,"5":self_dual_codes_22_5,\
"6":self_dual_codes_22_6}
return self_dual_codes




13 changes: 4 additions & 9 deletions src/sage/crypto/classical_cipher.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
"""
Classical Ciphers
"""

#*****************************************************************************
# ****************************************************************************
# Copyright (C) 2007 David Kohel <[email protected]>
#
# Distributed under the terms of the GNU General Public License (GPL)
#
# http://www.gnu.org/licenses/
#*****************************************************************************

# https://www.gnu.org/licenses/
# ****************************************************************************
from .cipher import SymmetricKeyCipher
from sage.monoids.string_monoid_element import StringMonoidElement
from sage.modules.free_module import FreeModule


class AffineCipher(SymmetricKeyCipher):
r"""
Affine cipher class. This is the class that does the actual work of
Expand Down Expand Up @@ -574,7 +573,3 @@ def inverse(self):
E = self.parent()
K = E.inverse_key(self.key())
return E(K)




9 changes: 4 additions & 5 deletions src/sage/crypto/mq/mpolynomialsystemgenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
Abstract base class for generators of polynomial systems
AUTHOR:
Martin Albrecht <[email protected]>
"""
Martin Albrecht <[email protected]>
"""
from sage.structure.sage_object import SageObject


class MPolynomialSystemGenerator(SageObject):
"""
Abstract base class for generators of polynomial systems.
Expand All @@ -26,8 +27,7 @@ def __getattr__(self, attr):
if attr == "R":
self.R = self.ring()
return self.R
else:
raise AttributeError("'%s' object has no attribute '%s'"%(self.__class__,attr))
raise AttributeError("'%s' object has no attribute '%s'" % (self.__class__,attr))

def varformatstr(self, name):
"""
Expand Down Expand Up @@ -196,4 +196,3 @@ def random_element(self):
NotImplementedError
"""
raise NotImplementedError

4 changes: 1 addition & 3 deletions src/sage/ext_data/nbconvert/postprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
- Thierry Monteil (2018): initial version.
"""

import sys
import re

Expand All @@ -27,7 +26,7 @@

# processing
new_file = ''
for i,line in enumerate(lines):
for i, line in enumerate(lines):
if line.startswith(' # ') and not wrong_title_fixed:
new_file += re.sub('^ # ', '', line)
new_file += '=' * (len(line) - 4) + '\n'
Expand All @@ -44,4 +43,3 @@
# write new file
with open(file_name, 'w') as f:
f.write(new_file)

1 change: 0 additions & 1 deletion src/sage/finance/markov_multifractal.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,4 +276,3 @@ def simulations(self, n, k=1):
## OUTPUT:
## m0, sigma, gamma_kbar, b
## """

2 changes: 1 addition & 1 deletion src/sage/functions/orthogonal_polys.py
Original file line number Diff line number Diff line change
Expand Up @@ -3028,5 +3028,5 @@ def eval_recursive(self, k, x, a, b, n, *args, **kwds):
Hm2 = C * hahn.eval_recursive(k-2, x, a, b, n)
return (Hm1 - Hm2) / A

hahn = Func_hahn()

hahn = Func_hahn()
3 changes: 1 addition & 2 deletions src/sage/game_theory/parser.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""
Parser For gambit And lrs Nash Equilibria
"""

# ****************************************************************************
# Copyright (C) 2014 James Campbell [email protected]
# 2015 Vincent Knight
Expand All @@ -13,6 +12,7 @@
# https://www.gnu.org/licenses/
# ****************************************************************************


class Parser():
r"""
A class for parsing the outputs of different algorithms called in other
Expand Down Expand Up @@ -298,4 +298,3 @@ def format_gambit(self, gambit_game):
nice_stuff.append(profile)

return nice_stuff

1 change: 0 additions & 1 deletion src/sage/games/hexad.py
Original file line number Diff line number Diff line change
Expand Up @@ -711,4 +711,3 @@ def blackjack_move(self, L0):
return str(x) + ' --> ' + str(y) + ". The total went from " + str(total) + " to " + str(total - x + y) + "."
print("This is a hexad. \n There is no winning move, so make a random legal move.")
return L0

4 changes: 1 addition & 3 deletions src/sage/homology/algebraic_topological_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@
- John H. Palmieri (2015-09)
"""

########################################################################
# Copyright (C) 2015 John H. Palmieri <[email protected]>
#
# Distributed under the terms of the GNU General Public License (GPL)
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
#
# http://www.gnu.org/licenses/
# https://www.gnu.org/licenses/
########################################################################

# TODO: cythonize this.
Expand Down Expand Up @@ -590,4 +589,3 @@ def conditionally_sparse(m):
iota = ChainComplexMorphism(iota_data, M, C)
phi = ChainContraction(phi_data, pi, iota)
return phi, M

1 change: 0 additions & 1 deletion src/sage/homology/chain_complex.py
Original file line number Diff line number Diff line change
Expand Up @@ -2238,4 +2238,3 @@ def scalar(a):

from sage.misc.persist import register_unpickle_override
register_unpickle_override('sage.homology.chain_complex', 'ChainComplex', ChainComplex_class)

4 changes: 2 additions & 2 deletions src/sage/homology/chain_homotopy.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,14 @@
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
#
# http://www.gnu.org/licenses/
# https://www.gnu.org/licenses/
########################################################################

from sage.categories.morphism import Morphism
from sage.categories.homset import Hom
from sage.homology.chain_complex_morphism import ChainComplexMorphism


# In a perfect world, this would inherit from something like
# "TwoMorphism" rather than "Morphism"...
class ChainHomotopy(Morphism):
Expand Down Expand Up @@ -581,4 +582,3 @@ def dual(self):
deg = self.domain().degree_of_differential()
matrices = {i-deg: matrix_dict[i].transpose() for i in matrix_dict}
return ChainContraction(matrices, self.iota().dual(), self.pi().dual())

7 changes: 2 additions & 5 deletions src/sage/homology/homology_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
group that prints itself in a way that is suitable for homology
groups.
"""

########################################################################
# Copyright (C) 2013 John H. Palmieri <[email protected]>
# Volker Braun <[email protected]>
Expand All @@ -14,7 +13,7 @@
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
#
# http://www.gnu.org/licenses/
# https://www.gnu.org/licenses/
########################################################################

from sage.modules.free_module import VectorSpace
Expand Down Expand Up @@ -182,6 +181,4 @@ def HomologyGroup(n, base_ring, invfac=None):
invfac = [0] * (n - len(invfac)) + invfac
elif len(invfac) > n:
raise ValueError("invfac (={}) must have length n (={})".format(invfac, n))
M = HomologyGroup_class(n, invfac)
return M

return HomologyGroup_class(n, invfac)
4 changes: 1 addition & 3 deletions src/sage/homology/homology_vector_space_with_basis.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
- John H. Palmieri, Travis Scrimshaw (2015-09)
"""

########################################################################
# Copyright (C) 2015 John H. Palmieri <[email protected]>
# Travis Scrimshaw <tscrimsh at umn.edu>
Expand All @@ -23,7 +22,7 @@
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
#
# http://www.gnu.org/licenses/
# https://www.gnu.org/licenses/
########################################################################

from sage.misc.cachefunc import cached_method
Expand Down Expand Up @@ -871,4 +870,3 @@ def sum_indices(k, i_k_plus_one, S_k_plus_one):
return [[S_k]]
return [[i_k] + l for i_k in range(S_k, i_k_plus_one)
for l in sum_indices(k-1, i_k, S_k)]

5 changes: 2 additions & 3 deletions src/sage/homology/koszul_complex.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
"""
Koszul Complexes
"""

########################################################################
# Copyright (C) 2014 Travis Scrimshaw <tscrim at ucdavis.edu>
#
# Distributed under the terms of the GNU General Public License (GPL)
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
#
# http://www.gnu.org/licenses/
# https://www.gnu.org/licenses/
########################################################################

from sage.structure.unique_representation import UniqueRepresentation
Expand All @@ -22,6 +21,7 @@

import itertools


class KoszulComplex(ChainComplex_class, UniqueRepresentation):
r"""
A Koszul complex.
Expand Down Expand Up @@ -166,4 +166,3 @@ def _repr_(self):
if not self._elements:
return "Trivial Koszul complex over {}".format(self.base_ring())
return "Koszul complex defined by {} over {}".format(self._elements, self.base_ring())

4 changes: 1 addition & 3 deletions src/sage/homology/matrix_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
with the differentials thought of as matrices. This module contains
some utility functions for this purpose.
"""

########################################################################
# Copyright (C) 2013 John H. Palmieri <[email protected]>
#
# Distributed under the terms of the GNU General Public License (GPL)
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
#
# http://www.gnu.org/licenses/
# https://www.gnu.org/licenses/
########################################################################

# TODO: this module is a clear candidate for cythonizing. Need to
Expand Down Expand Up @@ -203,4 +202,3 @@ def dhsw_snf(mat, verbose=False):
if len(ed) < rows:
return ed + [0]*(rows - len(ed))
return ed[:rows]

1 change: 0 additions & 1 deletion src/sage/homology/simplicial_complex_homset.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@
sage.topology.simplicial_complex_homset.is_SimplicialComplexHomset)
SimplicialComplexHomset = deprecated_function_alias(31925,
sage.topology.simplicial_complex_homset.SimplicialComplexHomset)

1 change: 0 additions & 1 deletion src/sage/interfaces/axiom.py
Original file line number Diff line number Diff line change
Expand Up @@ -993,4 +993,3 @@ def axiom_console():
if not get_display_manager().is_in_terminal():
raise RuntimeError('Can use the console only in the terminal. Try %%axiom magics instead.')
os.system('axiom -nox')

1 change: 0 additions & 1 deletion src/sage/interfaces/gap.py
Original file line number Diff line number Diff line change
Expand Up @@ -1814,4 +1814,3 @@ def gap_console():
cmd, _ = gap_command(use_workspace_cache=False)
cmd += ' ' + os.path.join(SAGE_EXTCODE,'gap','console.g')
os.system(cmd)

4 changes: 0 additions & 4 deletions src/sage/interfaces/gnuplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,3 @@ def gnuplot_console():
if not get_display_manager().is_in_terminal():
raise RuntimeError('Can use the console only in the terminal. Try %%gnuplot magics instead.')
os.system('gnuplot')




2 changes: 0 additions & 2 deletions src/sage/interfaces/macaulay2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1866,7 +1866,6 @@ def macaulay2_console():
os.system('M2')



def reduce_load_macaulay2():
"""
Used for reconstructing a copy of the Macaulay2 interpreter from a pickle.
Expand All @@ -1878,4 +1877,3 @@ def reduce_load_macaulay2():
Macaulay2
"""
return macaulay2

1 change: 0 additions & 1 deletion src/sage/interfaces/mupad.py
Original file line number Diff line number Diff line change
Expand Up @@ -690,4 +690,3 @@ def __doctest_cleanup():
"""
import sage.interfaces.quit
sage.interfaces.quit.expect_quitall()

Loading

0 comments on commit fa19f63

Please sign in to comment.