Skip to content

Commit 2fd96b0

Browse files
author
Release Manager
committed
sagemathgh-38086: `all*.py` files: Use 'del lazy_import', 'del install_doc' <!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> - Cherry-picked from sagemath#37900 Includes style fixes from there as well. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [ ] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#38086 Reported by: Matthias Köppe Reviewer(s): Kwankyu Lee
2 parents 9817b21 + 5372cb9 commit 2fd96b0

File tree

48 files changed

+158
-162
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+158
-162
lines changed

src/sage/algebras/fusion_rings/all.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@
1515

1616
lazy_import('sage.algebras.fusion_rings.fusion_ring', ['FusionRing'])
1717
lazy_import('sage.algebras.fusion_rings.fusion_double', ['FusionDouble'])
18+
del lazy_import
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
"""
22
Hecke Algebras
33
"""
4-
#from sage.misc.lazy_import import lazy_import

src/sage/algebras/lie_algebras/all.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Lie Algebras
33
"""
44

5-
#*****************************************************************************
5+
# *****************************************************************************
66
# Copyright (C) 2013 Travis Scrimshaw <tscrim at ucdavis.edu>
77
#
88
# Distributed under the terms of the GNU General Public License (GPL)
@@ -14,10 +14,11 @@
1414
#
1515
# The full text of the GPL is available at:
1616
#
17-
# http://www.gnu.org/licenses/
18-
#*****************************************************************************
17+
# https://www.gnu.org/licenses/
18+
# *****************************************************************************
1919
from sage.misc.lazy_import import lazy_import
2020

2121
lazy_import('sage.algebras.lie_algebras.lie_algebra', 'LieAlgebra')
22-
#from kac_moody import KacMoodyAlgebra
22+
# from kac_moody import KacMoodyAlgebra
2323
lazy_import('sage.algebras.lie_algebras', 'examples', 'lie_algebras')
24+
del lazy_import
Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1-
#******************************************************************************
1+
# ******************************************************************************
22
# Copyright (C) 2020 Reimundo Heluani <[email protected]>
33
#
44
# This program is free software: you can redistribute it and/or modify
55
# it under the terms of the GNU General Public License as published by
66
# the Free Software Foundation, either version 2 of the License, or
77
# (at your option) any later version.
8-
# http://www.gnu.org/licenses/
9-
#*****************************************************************************
8+
# https://www.gnu.org/licenses/
9+
# *****************************************************************************
1010

1111

1212
from sage.misc.lazy_import import lazy_import
13-
lazy_import('sage.algebras.lie_conformal_algebras.lie_conformal_algebra','LieConformalAlgebra')
14-
lazy_import('sage.algebras.lie_conformal_algebras', 'examples', 'lie_conformal_algebras')
13+
lazy_import('sage.algebras.lie_conformal_algebras.lie_conformal_algebra',
14+
'LieConformalAlgebra')
15+
lazy_import('sage.algebras.lie_conformal_algebras',
16+
'examples', 'lie_conformal_algebras')
17+
del lazy_import

src/sage/algebras/quantum_groups/all.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
from sage.misc.lazy_import import lazy_import
66
lazy_import('sage.algebras.quantum_groups.fock_space', 'FockSpace')
77
lazy_import('sage.algebras.quantum_groups.quantum_group_gap', 'QuantumGroup')
8+
del lazy_import

src/sage/all__sagemath_objects.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99

1010
# This import also sets up the interrupt handler
1111
from cysignals.signals import (AlarmInterrupt, SignalError,
12-
sig_on_reset as sig_on_count)
12+
sig_on_reset as sig_on_count)
1313

14-
from time import sleep
14+
from time import sleep
1515

16-
from sage.misc.all__sagemath_objects import *
17-
from sage.structure.all import *
18-
from sage.arith.power import generic_power as power
16+
from sage.misc.all__sagemath_objects import *
17+
from sage.structure.all import *
18+
from sage.arith.power import generic_power as power
1919
from sage.categories.all__sagemath_objects import *
2020

21-
from sage.cpython.all import *
21+
from sage.cpython.all import *
2222

2323
from cysignals.alarm import alarm, cancel_alarm
2424

src/sage/all__sagemath_repl.py

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
############ setup warning filters before importing Sage stuff ####
1+
# Set up warning filters before importing Sage stuff
2+
23
import sys
34
import warnings
45

5-
__with_pydebug = hasattr(sys, 'gettotalrefcount') # This is a Python debug build (--with-pydebug)
6+
# This is a Python debug build (--with-pydebug)
7+
__with_pydebug = hasattr(sys, 'gettotalrefcount')
68
if __with_pydebug:
79
# a debug build does not install the default warning filters. Sadly, this breaks doctests so we
810
# have to re-add them:
@@ -16,38 +18,38 @@
1618

1719
# Ignore all deprecations from IPython etc.
1820
warnings.filterwarnings('ignore', category=DeprecationWarning,
19-
module='(IPython|ipykernel|jupyter_client|jupyter_core|nbformat|notebook|ipywidgets|storemagic|jedi)')
21+
module='(IPython|ipykernel|jupyter_client|jupyter_core|nbformat|notebook|ipywidgets|storemagic|jedi)')
2022

2123
# scipy 1.18 introduced reprecation warnings on a number of things they are moving to
2224
# numpy, e.g. DeprecationWarning: scipy.array is deprecated
2325
# and will be removed in SciPy 2.0.0, use numpy.array instead
2426
# This affects networkx 2.2 up and including 2.4 (cf. :issue:29766)
2527
warnings.filterwarnings('ignore', category=DeprecationWarning,
26-
module='(scipy|networkx)')
28+
module='(scipy|networkx)')
2729

2830
# However, be sure to keep OUR deprecation warnings
2931
warnings.filterwarnings('default', category=DeprecationWarning,
30-
message=r'[\s\S]*See https?://trac\.sagemath\.org/[0-9]* for details.')
32+
message=r'[\s\S]*See https?://trac\.sagemath\.org/[0-9]* for details.')
3133

3234
# Ignore Python 3.9 deprecation warnings
3335
warnings.filterwarnings('ignore', category=DeprecationWarning,
34-
module='ast')
36+
module='ast')
3537

3638
# Ignore packaging 20.5 deprecation warnings
3739
warnings.filterwarnings('ignore', category=DeprecationWarning,
38-
module='(.*[.]_vendor[.])?packaging')
40+
module='(.*[.]_vendor[.])?packaging')
3941

4042
# Ignore a few warnings triggered by pythran 0.12.1
4143
warnings.filterwarnings('ignore', category=DeprecationWarning,
42-
message='\n\n `numpy.distutils` is deprecated since NumPy 1.23.0',
43-
module='pythran.dist')
44+
message='\n\n `numpy.distutils` is deprecated since NumPy 1.23.0',
45+
module='pythran.dist')
4446
warnings.filterwarnings('ignore', category=DeprecationWarning,
45-
message='pkg_resources is deprecated as an API|'
46-
'Deprecated call to `pkg_resources.declare_namespace(.*)`',
47-
module='pkg_resources|setuptools.sandbox')
47+
message='pkg_resources is deprecated as an API|'
48+
'Deprecated call to `pkg_resources.declare_namespace(.*)`',
49+
module='pkg_resources|setuptools.sandbox')
4850
warnings.filterwarnings('ignore', category=DeprecationWarning,
49-
message='msvccompiler is deprecated and slated to be removed',
50-
module='distutils.msvccompiler')
51+
message='msvccompiler is deprecated and slated to be removed',
52+
module='distutils.msvccompiler')
5153

5254
warnings.filterwarnings('ignore', category=DeprecationWarning,
5355
message='The distutils(.sysconfig module| package) is deprecated',
@@ -105,8 +107,8 @@
105107
from sage.all__sagemath_objects import *
106108
from sage.all__sagemath_environment import *
107109

108-
from sage.doctest.all import *
109-
from sage.repl.all import *
110+
from sage.doctest.all import *
111+
from sage.repl.all import *
110112
from sage.misc.all__sagemath_repl import *
111113

112114
# For doctesting. These are overwritten later

src/sage/all_cmdline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
from sage.misc.lazy_import import lazy_import
2121

22-
for pkg in ['axiom', 'fricas', 'gap' , 'gap3', 'giac', 'gp',
22+
for pkg in ['axiom', 'fricas', 'gap', 'gap3', 'giac', 'gp',
2323
'gnuplot', 'kash', 'magma', 'macaulay2', 'maple',
2424
'mathematica', 'mathics', 'matlab',
2525
'mupad', 'mwrank', 'octave', 'qepcad', 'singular',

src/sage/arith/all.py

Lines changed: 24 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,36 @@
11
from sage.misc.lazy_import import lazy_import
22

3-
from sage.arith.misc import (
4-
algdep,
5-
bernoulli,
6-
is_prime,
7-
is_prime_power,
8-
is_pseudoprime,
9-
is_pseudoprime_power,
10-
prime_powers,
11-
primes_first_n,
12-
eratosthenes,
13-
primes,
14-
next_prime_power,
15-
next_probable_prime,
16-
next_prime,
17-
previous_prime,
18-
previous_prime_power,
19-
random_prime,
20-
divisors,
21-
sigma,
22-
gcd,
23-
GCD,
24-
xlcm,
25-
xgcd,
26-
xkcd,
27-
inverse_mod,
28-
get_gcd,
29-
get_inverse_mod,
30-
power_mod,
31-
rational_reconstruction,
32-
mqrr_rational_reconstruction,
33-
trial_division,
34-
factor,
35-
prime_divisors,
36-
odd_part,
37-
prime_to_m_part,
38-
is_square,
39-
is_squarefree,
40-
euler_phi,
41-
carmichael_lambda,
42-
crt,
43-
CRT,
44-
CRT_list,
45-
CRT_basis,
46-
CRT_vectors,
47-
multinomial,
48-
multinomial_coefficients,
49-
binomial,
50-
factorial,
51-
kronecker_symbol,
52-
kronecker,
53-
legendre_symbol,
54-
primitive_root,
55-
nth_prime,
56-
quadratic_residues,
57-
moebius,
58-
continuant,
59-
number_of_divisors,
60-
hilbert_symbol,
61-
hilbert_conductor,
62-
hilbert_conductor_inverse,
63-
falling_factorial,
64-
rising_factorial,
65-
integer_ceil,
66-
integer_floor,
67-
two_squares,
68-
three_squares,
69-
four_squares,
70-
sum_of_k_squares,
71-
subfactorial,
72-
is_power_of_two,
73-
differences,
74-
sort_complex_numbers_for_display,
75-
fundamental_discriminant,
76-
squarefree_divisors,
77-
radical,
78-
binomial_coefficients,
79-
jacobi_symbol,
80-
dedekind_sum,
81-
prime_factors,
82-
prime_range,
83-
valuation,
84-
)
3+
from sage.arith.misc import (algdep, bernoulli, is_prime, is_prime_power,
4+
is_pseudoprime, is_pseudoprime_power,
5+
prime_powers, primes_first_n, eratosthenes, primes,
6+
next_prime_power, next_probable_prime, next_prime,
7+
previous_prime, previous_prime_power, random_prime,
8+
divisors, sigma, gcd, GCD, xlcm, xgcd, xkcd,
9+
inverse_mod, get_gcd, get_inverse_mod, power_mod,
10+
rational_reconstruction, mqrr_rational_reconstruction,
11+
trial_division, factor, prime_divisors, odd_part, prime_to_m_part,
12+
is_square, is_squarefree, euler_phi, carmichael_lambda, crt, CRT,
13+
CRT_list, CRT_basis, CRT_vectors, multinomial, multinomial_coefficients,
14+
binomial, factorial, kronecker_symbol, kronecker, legendre_symbol,
15+
primitive_root, nth_prime, quadratic_residues, moebius,
16+
continuant, number_of_divisors, hilbert_symbol, hilbert_conductor,
17+
hilbert_conductor_inverse, falling_factorial, rising_factorial,
18+
integer_ceil, integer_floor,
19+
two_squares, three_squares, four_squares, sum_of_k_squares,
20+
subfactorial, is_power_of_two, differences,
21+
sort_complex_numbers_for_display,
22+
fundamental_discriminant, squarefree_divisors,
23+
radical, binomial_coefficients, jacobi_symbol,
24+
dedekind_sum,
25+
prime_factors, prime_range, valuation)
8526

8627
lazy_import("sage.arith.misc", ("Sigma", "Moebius", "Euler_Phi"), deprecation=30322)
8728

8829
from sage.arith.functions import lcm
89-
9030
LCM = lcm
9131

9232
from sage.arith.srange import xsrange, srange, ellipsis_iter, ellipsis_range
93-
9433
sxrange = xsrange
9534

9635
σ = sigma
36+
del lazy_import

src/sage/categories/all.py

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -109,31 +109,31 @@
109109
# * with basis
110110
from sage.categories.modules_with_basis import ModulesWithBasis
111111
FreeModules = ModulesWithBasis
112-
from sage.categories.hecke_modules import HeckeModules
113-
from sage.categories.algebras_with_basis import AlgebrasWithBasis
114-
from sage.categories.coalgebras_with_basis import CoalgebrasWithBasis
115-
from sage.categories.bialgebras_with_basis import BialgebrasWithBasis
112+
from sage.categories.hecke_modules import HeckeModules
113+
from sage.categories.algebras_with_basis import AlgebrasWithBasis
114+
from sage.categories.coalgebras_with_basis import CoalgebrasWithBasis
115+
from sage.categories.bialgebras_with_basis import BialgebrasWithBasis
116116
from sage.categories.hopf_algebras_with_basis import HopfAlgebrasWithBasis
117117

118118
# finite dimensional * with basis
119-
from sage.categories.finite_dimensional_modules_with_basis import FiniteDimensionalModulesWithBasis
120-
from sage.categories.finite_dimensional_algebras_with_basis import FiniteDimensionalAlgebrasWithBasis
121-
from sage.categories.finite_dimensional_coalgebras_with_basis import FiniteDimensionalCoalgebrasWithBasis
122-
from sage.categories.finite_dimensional_bialgebras_with_basis import FiniteDimensionalBialgebrasWithBasis
119+
from sage.categories.finite_dimensional_modules_with_basis import FiniteDimensionalModulesWithBasis
120+
from sage.categories.finite_dimensional_algebras_with_basis import FiniteDimensionalAlgebrasWithBasis
121+
from sage.categories.finite_dimensional_coalgebras_with_basis import FiniteDimensionalCoalgebrasWithBasis
122+
from sage.categories.finite_dimensional_bialgebras_with_basis import FiniteDimensionalBialgebrasWithBasis
123123
from sage.categories.finite_dimensional_hopf_algebras_with_basis import FiniteDimensionalHopfAlgebrasWithBasis
124124

125125
# graded *
126-
from sage.categories.graded_modules import GradedModules
127-
from sage.categories.graded_algebras import GradedAlgebras
128-
from sage.categories.graded_coalgebras import GradedCoalgebras
129-
from sage.categories.graded_bialgebras import GradedBialgebras
126+
from sage.categories.graded_modules import GradedModules
127+
from sage.categories.graded_algebras import GradedAlgebras
128+
from sage.categories.graded_coalgebras import GradedCoalgebras
129+
from sage.categories.graded_bialgebras import GradedBialgebras
130130
from sage.categories.graded_hopf_algebras import GradedHopfAlgebras
131131

132132
# graded * with basis
133-
from sage.categories.graded_modules_with_basis import GradedModulesWithBasis
134-
from sage.categories.graded_algebras_with_basis import GradedAlgebrasWithBasis
135-
from sage.categories.graded_coalgebras_with_basis import GradedCoalgebrasWithBasis
136-
from sage.categories.graded_bialgebras_with_basis import GradedBialgebrasWithBasis
133+
from sage.categories.graded_modules_with_basis import GradedModulesWithBasis
134+
from sage.categories.graded_algebras_with_basis import GradedAlgebrasWithBasis
135+
from sage.categories.graded_coalgebras_with_basis import GradedCoalgebrasWithBasis
136+
from sage.categories.graded_bialgebras_with_basis import GradedBialgebrasWithBasis
137137
from sage.categories.graded_hopf_algebras_with_basis import GradedHopfAlgebrasWithBasis
138138

139139
# Coxeter groups
@@ -155,3 +155,5 @@
155155

156156
# lie conformal algebras
157157
lazy_import('sage.categories.lie_conformal_algebras', 'LieConformalAlgebras')
158+
del lazy_import
159+
del install_doc

0 commit comments

Comments
 (0)