diff --git a/src/sage/algebras/lie_algebras/subalgebra.py b/src/sage/algebras/lie_algebras/subalgebra.py index baa633c1cb7..90779eb91fc 100644 --- a/src/sage/algebras/lie_algebras/subalgebra.py +++ b/src/sage/algebras/lie_algebras/subalgebra.py @@ -5,7 +5,6 @@ - Eero Hakavuori (2018-08-29): initial version """ - # **************************************************************************** # Copyright (C) 2018 Eero Hakavuori # @@ -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 @@ -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() - diff --git a/src/sage/all_cmdline.py b/src/sage/all_cmdline.py index 644d3f2c863..81c56b018ab 100644 --- a/src/sage/all_cmdline.py +++ b/src/sage/all_cmdline.py @@ -3,21 +3,18 @@ This is all.py (load all sage functions) plus set-up for the Sage commandline. """ - -#***************************************************************************** +# **************************************************************************** # Copyright (C) 2007 William Stein # # 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() - diff --git a/src/sage/calculus/predefined.py b/src/sage/calculus/predefined.py index ea677fe15da..8e7f499b1ae 100644 --- a/src/sage/calculus/predefined.py +++ b/src/sage/calculus/predefined.py @@ -48,4 +48,3 @@ X = _var('X') Y = _var('Y') Z = _var('Z') - diff --git a/src/sage/coding/grs_code.py b/src/sage/coding/grs_code.py index 1b40afc6f8b..efbc1d32c5b 100644 --- a/src/sage/coding/grs_code.py +++ b/src/sage/coding/grs_code.py @@ -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"} - diff --git a/src/sage/coding/self_dual_codes.py b/src/sage/coding/self_dual_codes.py index 02dd5b953f0..49125e8fb01 100644 --- a/src/sage/coding/self_dual_codes.py +++ b/src/sage/coding/self_dual_codes.py @@ -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. """ @@ -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). @@ -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). @@ -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 - - - - diff --git a/src/sage/crypto/classical_cipher.py b/src/sage/crypto/classical_cipher.py index 0fe8c6b9434..72ea18a3117 100644 --- a/src/sage/crypto/classical_cipher.py +++ b/src/sage/crypto/classical_cipher.py @@ -1,19 +1,18 @@ """ Classical Ciphers """ - -#***************************************************************************** +# **************************************************************************** # Copyright (C) 2007 David Kohel # # 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 @@ -574,7 +573,3 @@ def inverse(self): E = self.parent() K = E.inverse_key(self.key()) return E(K) - - - - diff --git a/src/sage/crypto/mq/mpolynomialsystemgenerator.py b/src/sage/crypto/mq/mpolynomialsystemgenerator.py index 9dd861ed469..3c0bb6b349c 100644 --- a/src/sage/crypto/mq/mpolynomialsystemgenerator.py +++ b/src/sage/crypto/mq/mpolynomialsystemgenerator.py @@ -2,11 +2,12 @@ Abstract base class for generators of polynomial systems AUTHOR: - Martin Albrecht -""" +Martin Albrecht +""" from sage.structure.sage_object import SageObject + class MPolynomialSystemGenerator(SageObject): """ Abstract base class for generators of polynomial systems. @@ -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): """ @@ -196,4 +196,3 @@ def random_element(self): NotImplementedError """ raise NotImplementedError - diff --git a/src/sage/ext_data/nbconvert/postprocess.py b/src/sage/ext_data/nbconvert/postprocess.py index f36497fb73f..524c5b213a6 100755 --- a/src/sage/ext_data/nbconvert/postprocess.py +++ b/src/sage/ext_data/nbconvert/postprocess.py @@ -11,7 +11,6 @@ - Thierry Monteil (2018): initial version. """ - import sys import re @@ -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' @@ -44,4 +43,3 @@ # write new file with open(file_name, 'w') as f: f.write(new_file) - diff --git a/src/sage/finance/markov_multifractal.py b/src/sage/finance/markov_multifractal.py index 99b5968f051..6206f56b304 100644 --- a/src/sage/finance/markov_multifractal.py +++ b/src/sage/finance/markov_multifractal.py @@ -276,4 +276,3 @@ def simulations(self, n, k=1): ## OUTPUT: ## m0, sigma, gamma_kbar, b ## """ - diff --git a/src/sage/functions/orthogonal_polys.py b/src/sage/functions/orthogonal_polys.py index a61f84649e9..77b7e06b909 100644 --- a/src/sage/functions/orthogonal_polys.py +++ b/src/sage/functions/orthogonal_polys.py @@ -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() diff --git a/src/sage/game_theory/parser.py b/src/sage/game_theory/parser.py index 87b0676fecc..80d90d9a5cf 100644 --- a/src/sage/game_theory/parser.py +++ b/src/sage/game_theory/parser.py @@ -1,7 +1,6 @@ """ Parser For gambit And lrs Nash Equilibria """ - # **************************************************************************** # Copyright (C) 2014 James Campbell james.campbell@tanti.org.uk # 2015 Vincent Knight @@ -13,6 +12,7 @@ # https://www.gnu.org/licenses/ # **************************************************************************** + class Parser(): r""" A class for parsing the outputs of different algorithms called in other @@ -298,4 +298,3 @@ def format_gambit(self, gambit_game): nice_stuff.append(profile) return nice_stuff - diff --git a/src/sage/games/hexad.py b/src/sage/games/hexad.py index dff95e8e6b8..710513207a7 100644 --- a/src/sage/games/hexad.py +++ b/src/sage/games/hexad.py @@ -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 - diff --git a/src/sage/homology/algebraic_topological_model.py b/src/sage/homology/algebraic_topological_model.py index b14de9bdfa3..f89a1529dd9 100644 --- a/src/sage/homology/algebraic_topological_model.py +++ b/src/sage/homology/algebraic_topological_model.py @@ -12,7 +12,6 @@ - John H. Palmieri (2015-09) """ - ######################################################################## # Copyright (C) 2015 John H. Palmieri # @@ -20,7 +19,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/ ######################################################################## # TODO: cythonize this. @@ -590,4 +589,3 @@ def conditionally_sparse(m): iota = ChainComplexMorphism(iota_data, M, C) phi = ChainContraction(phi_data, pi, iota) return phi, M - diff --git a/src/sage/homology/chain_complex.py b/src/sage/homology/chain_complex.py index b879ac9c7eb..d88389e5c6d 100644 --- a/src/sage/homology/chain_complex.py +++ b/src/sage/homology/chain_complex.py @@ -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) - diff --git a/src/sage/homology/chain_homotopy.py b/src/sage/homology/chain_homotopy.py index feac17c26b7..16a1c385edc 100644 --- a/src/sage/homology/chain_homotopy.py +++ b/src/sage/homology/chain_homotopy.py @@ -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): @@ -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()) - diff --git a/src/sage/homology/homology_group.py b/src/sage/homology/homology_group.py index adfac7717a0..0b27087a362 100644 --- a/src/sage/homology/homology_group.py +++ b/src/sage/homology/homology_group.py @@ -5,7 +5,6 @@ group that prints itself in a way that is suitable for homology groups. """ - ######################################################################## # Copyright (C) 2013 John H. Palmieri # Volker Braun @@ -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 @@ -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) diff --git a/src/sage/homology/homology_vector_space_with_basis.py b/src/sage/homology/homology_vector_space_with_basis.py index 8861ee20ad9..63a80657917 100644 --- a/src/sage/homology/homology_vector_space_with_basis.py +++ b/src/sage/homology/homology_vector_space_with_basis.py @@ -14,7 +14,6 @@ - John H. Palmieri, Travis Scrimshaw (2015-09) """ - ######################################################################## # Copyright (C) 2015 John H. Palmieri # Travis Scrimshaw @@ -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 @@ -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)] - diff --git a/src/sage/homology/koszul_complex.py b/src/sage/homology/koszul_complex.py index c83605db2f5..858d5a71283 100644 --- a/src/sage/homology/koszul_complex.py +++ b/src/sage/homology/koszul_complex.py @@ -1,7 +1,6 @@ """ Koszul Complexes """ - ######################################################################## # Copyright (C) 2014 Travis Scrimshaw # @@ -9,7 +8,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.structure.unique_representation import UniqueRepresentation @@ -22,6 +21,7 @@ import itertools + class KoszulComplex(ChainComplex_class, UniqueRepresentation): r""" A Koszul complex. @@ -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()) - diff --git a/src/sage/homology/matrix_utils.py b/src/sage/homology/matrix_utils.py index 1f2b583fc54..b1edc656e58 100644 --- a/src/sage/homology/matrix_utils.py +++ b/src/sage/homology/matrix_utils.py @@ -5,7 +5,6 @@ with the differentials thought of as matrices. This module contains some utility functions for this purpose. """ - ######################################################################## # Copyright (C) 2013 John H. Palmieri # @@ -13,7 +12,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/ ######################################################################## # TODO: this module is a clear candidate for cythonizing. Need to @@ -203,4 +202,3 @@ def dhsw_snf(mat, verbose=False): if len(ed) < rows: return ed + [0]*(rows - len(ed)) return ed[:rows] - diff --git a/src/sage/homology/simplicial_complex_homset.py b/src/sage/homology/simplicial_complex_homset.py index 6a9d78f69f1..f5b54a59dc2 100644 --- a/src/sage/homology/simplicial_complex_homset.py +++ b/src/sage/homology/simplicial_complex_homset.py @@ -10,4 +10,3 @@ sage.topology.simplicial_complex_homset.is_SimplicialComplexHomset) SimplicialComplexHomset = deprecated_function_alias(31925, sage.topology.simplicial_complex_homset.SimplicialComplexHomset) - diff --git a/src/sage/interfaces/axiom.py b/src/sage/interfaces/axiom.py index 499592bae6a..0bc5334b071 100644 --- a/src/sage/interfaces/axiom.py +++ b/src/sage/interfaces/axiom.py @@ -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') - diff --git a/src/sage/interfaces/gap.py b/src/sage/interfaces/gap.py index c34fe530c34..ba175d4e340 100644 --- a/src/sage/interfaces/gap.py +++ b/src/sage/interfaces/gap.py @@ -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) - diff --git a/src/sage/interfaces/gnuplot.py b/src/sage/interfaces/gnuplot.py index d93f6b33fb4..8ab14c75e1c 100644 --- a/src/sage/interfaces/gnuplot.py +++ b/src/sage/interfaces/gnuplot.py @@ -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') - - - - diff --git a/src/sage/interfaces/macaulay2.py b/src/sage/interfaces/macaulay2.py index 91e4da97ea0..14d217cff9e 100644 --- a/src/sage/interfaces/macaulay2.py +++ b/src/sage/interfaces/macaulay2.py @@ -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. @@ -1878,4 +1877,3 @@ def reduce_load_macaulay2(): Macaulay2 """ return macaulay2 - diff --git a/src/sage/interfaces/mupad.py b/src/sage/interfaces/mupad.py index ada87034c0c..e4e8531e6c2 100644 --- a/src/sage/interfaces/mupad.py +++ b/src/sage/interfaces/mupad.py @@ -690,4 +690,3 @@ def __doctest_cleanup(): """ import sage.interfaces.quit sage.interfaces.quit.expect_quitall() - diff --git a/src/sage/interfaces/mwrank.py b/src/sage/interfaces/mwrank.py index dd4663ab802..701b91b5afe 100644 --- a/src/sage/interfaces/mwrank.py +++ b/src/sage/interfaces/mwrank.py @@ -362,4 +362,3 @@ def mwrank_console(): if not get_display_manager().is_in_terminal(): raise RuntimeError('Can use the console only in the terminal. Try %%mwrank magics instead.') os.system('mwrank') - diff --git a/src/sage/interfaces/primecount.py b/src/sage/interfaces/primecount.py index e037cb2794d..e647bf9b980 100644 --- a/src/sage/interfaces/primecount.py +++ b/src/sage/interfaces/primecount.py @@ -3,4 +3,3 @@ from sage.misc.lazy_import import lazy_import lazy_import("primecountpy.primecount", ['phi', 'nth_prime', 'prime_pi', 'prime_pi_128'], deprecation=(32894, "the module sage.interfaces.primecount is deprecated - use primecountpy.primecount instead")) - diff --git a/src/sage/interfaces/qepcad.py b/src/sage/interfaces/qepcad.py index 934b396e162..d4b10353e0c 100644 --- a/src/sage/interfaces/qepcad.py +++ b/src/sage/interfaces/qepcad.py @@ -2752,6 +2752,4 @@ def sample_point_dict(self): """ points = self.sample_point() vars = self._parent._varlist - return dict([(vars[i], points[i]) for i in range(len(points))]) - diff --git a/src/sage/interfaces/scilab.py b/src/sage/interfaces/scilab.py index 692c6b0b3b4..8349739633c 100644 --- a/src/sage/interfaces/scilab.py +++ b/src/sage/interfaces/scilab.py @@ -561,4 +561,3 @@ def scilab_version(): 'scilab-...' """ return str(scilab('getversion()')).strip() - diff --git a/src/sage/interfaces/sympy.py b/src/sage/interfaces/sympy.py index 74764b13716..2c847d56892 100644 --- a/src/sage/interfaces/sympy.py +++ b/src/sage/interfaces/sympy.py @@ -1181,7 +1181,7 @@ def sympy_set_to_list(set, vars): elif isinstance(set, (Union, Interval)): x = vars[0] if isinstance(set, Interval): - left,right,lclosed,rclosed = set._args + left, right, lclosed, rclosed = set._args if lclosed: rel1 = [x._sage_() > left._sage_()] else: @@ -1198,4 +1198,3 @@ def sympy_set_to_list(set, vars): if isinstance(set, Union): return [sympy_set_to_list(iv, vars) for iv in set._args] return set - diff --git a/src/sage/libs/gap/all.py b/src/sage/libs/gap/all.py index fd40910d9e7..e69de29bb2d 100644 --- a/src/sage/libs/gap/all.py +++ b/src/sage/libs/gap/all.py @@ -1,4 +0,0 @@ - - - - diff --git a/src/sage/libs/gap/test_long.py b/src/sage/libs/gap/test_long.py index 5a929ab4585..262db5ad287 100644 --- a/src/sage/libs/gap/test_long.py +++ b/src/sage/libs/gap/test_long.py @@ -3,7 +3,6 @@ These stress test the garbage collection inside GAP """ - from sage.libs.gap.libgap import libgap @@ -26,8 +25,8 @@ def test_loop_2(): sage: from sage.libs.gap.test_long import test_loop_2 sage: test_loop_2() # long time (10s on sage.math, 2013) """ - G =libgap.FreeGroup(2) - a,b = G.GeneratorsOfGroup() + G = libgap.FreeGroup(2) + a, b = G.GeneratorsOfGroup() for i in range(100): rel = libgap([a**2, b**2, a*b*a*b]) H = G / rel @@ -47,12 +46,9 @@ def test_loop_3(): sage: test_loop_3() # long time (31s on sage.math, 2013) """ G = libgap.FreeGroup(2) - (a,b) = G.GeneratorsOfGroup() + a, b = G.GeneratorsOfGroup() for i in range(300000): - lis=libgap([]) + lis = libgap([]) lis.Add(a ** 2) lis.Add(b ** 2) lis.Add(b * a) - - - diff --git a/src/sage/libs/lrcalc/lrcalc.py b/src/sage/libs/lrcalc/lrcalc.py index b541bfacd89..cf50d52a927 100644 --- a/src/sage/libs/lrcalc/lrcalc.py +++ b/src/sage/libs/lrcalc/lrcalc.py @@ -192,6 +192,7 @@ from sage.rings.integer import Integer import lrcalc + def _lrcalc_dict_to_sage(result): r""" Translate from lrcalc output format to Sage expected format. @@ -517,4 +518,3 @@ def lrskew(outer, inner, weight=None, maxrows=-1): w[j] += 1 if w == wt: yield ST.from_shape_and_word(shape, [i+1 for i in data]) - diff --git a/src/sage/libs/mpmath/all.py b/src/sage/libs/mpmath/all.py index c8d60c91142..cae40f79314 100644 --- a/src/sage/libs/mpmath/all.py +++ b/src/sage/libs/mpmath/all.py @@ -14,13 +14,12 @@ # Use mpmath internal functions for constants, to avoid unnecessary overhead _constants_funcs = { - 'glaisher' : glaisher_fixed, - 'khinchin' : khinchin_fixed, - 'twinprime' : twinprime_fixed, - 'mertens' : mertens_fixed + 'glaisher': glaisher_fixed, + 'khinchin': khinchin_fixed, + 'twinprime': twinprime_fixed, + 'mertens': mertens_fixed } def eval_constant(name, ring): prec = ring.precision() + 20 return ring(_constants_funcs[name](prec)) >> prec - diff --git a/src/sage/logic/logicparser.py b/src/sage/logic/logicparser.py index 08d9eb9c90d..b854f416127 100644 --- a/src/sage/logic/logicparser.py +++ b/src/sage/logic/logicparser.py @@ -82,7 +82,7 @@ # 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/ #***************************************************************************** import string @@ -703,5 +703,3 @@ def apply_func(tree, func): lval = tree[1] rval = tree[2] return func([tree[0], lval, rval]) - -