-
-
Notifications
You must be signed in to change notification settings - Fork 553
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gh-36589: Replace relative imports by absolute ones in a few packages <!-- ^^^^^ Please provide a concise, informative and self-explanatory title. Don't put issue numbers in there, do this in the PR body below. For example, instead of "Fixes #1234" use "Introduce new method to calculate 1+1" --> <!-- Describe your changes here in detail --> As preparation for compiling with meson, we replace relative imports by absolute ones. Moreover, relative imports are not used consistently in the codebase and result in issues for doctesting with pytest (which admittedly is a limitation of pytest). We normalize the relative imports in a few smaller packages to be absolute imports. Small code-style improvements along the way (mainly to nicely order the imports) <!-- Why is this change required? What problem does it solve? --> <!-- If this PR resolves an open issue, please link to it here. For example "Fixes #12345". --> <!-- If your change requires a documentation PR, please link it appropriately. --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> <!-- If your change requires a documentation PR, please link it appropriately --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> <!-- Feel free to remove irrelevant items. --> - [ ] The title is concise, informative, and self-explanatory. - [ ] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - #12345: short description why this is a dependency - #34567: ... --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: #36589 Reported by: Tobias Diez Reviewer(s): Dima Pasechnik
- Loading branch information
Showing
18 changed files
with
146 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,96 @@ | ||
from sage.misc.lazy_import import lazy_import | ||
|
||
from .misc import (algdep, bernoulli, is_prime, is_prime_power, | ||
is_pseudoprime, is_pseudoprime_power, | ||
prime_powers, primes_first_n, eratosthenes, primes, | ||
next_prime_power, next_probable_prime, next_prime, | ||
previous_prime, previous_prime_power, random_prime, | ||
divisors, sigma, gcd, GCD, xlcm, xgcd, xkcd, | ||
inverse_mod, get_gcd, get_inverse_mod, power_mod, | ||
rational_reconstruction, mqrr_rational_reconstruction, | ||
trial_division, factor, prime_divisors, odd_part, prime_to_m_part, | ||
is_square, is_squarefree, euler_phi, carmichael_lambda, crt, CRT, | ||
CRT_list, CRT_basis, CRT_vectors, multinomial, multinomial_coefficients, | ||
binomial, factorial, kronecker_symbol, kronecker, legendre_symbol, | ||
primitive_root, nth_prime, quadratic_residues, moebius, | ||
continuant, number_of_divisors, hilbert_symbol, hilbert_conductor, | ||
hilbert_conductor_inverse, falling_factorial, rising_factorial, | ||
integer_ceil, integer_floor, | ||
two_squares, three_squares, four_squares, sum_of_k_squares, | ||
subfactorial, is_power_of_two, differences, | ||
from sage.arith.misc import ( | ||
algdep, | ||
bernoulli, | ||
is_prime, | ||
is_prime_power, | ||
is_pseudoprime, | ||
is_pseudoprime_power, | ||
prime_powers, | ||
primes_first_n, | ||
eratosthenes, | ||
primes, | ||
next_prime_power, | ||
next_probable_prime, | ||
next_prime, | ||
previous_prime, | ||
previous_prime_power, | ||
random_prime, | ||
divisors, | ||
sigma, | ||
gcd, | ||
GCD, | ||
xlcm, | ||
xgcd, | ||
xkcd, | ||
inverse_mod, | ||
get_gcd, | ||
get_inverse_mod, | ||
power_mod, | ||
rational_reconstruction, | ||
mqrr_rational_reconstruction, | ||
trial_division, | ||
factor, | ||
prime_divisors, | ||
odd_part, | ||
prime_to_m_part, | ||
is_square, | ||
is_squarefree, | ||
euler_phi, | ||
carmichael_lambda, | ||
crt, | ||
CRT, | ||
CRT_list, | ||
CRT_basis, | ||
CRT_vectors, | ||
multinomial, | ||
multinomial_coefficients, | ||
binomial, | ||
factorial, | ||
kronecker_symbol, | ||
kronecker, | ||
legendre_symbol, | ||
primitive_root, | ||
nth_prime, | ||
quadratic_residues, | ||
moebius, | ||
continuant, | ||
number_of_divisors, | ||
hilbert_symbol, | ||
hilbert_conductor, | ||
hilbert_conductor_inverse, | ||
falling_factorial, | ||
rising_factorial, | ||
integer_ceil, | ||
integer_floor, | ||
two_squares, | ||
three_squares, | ||
four_squares, | ||
sum_of_k_squares, | ||
subfactorial, | ||
is_power_of_two, | ||
differences, | ||
sort_complex_numbers_for_display, | ||
fundamental_discriminant, squarefree_divisors, | ||
radical, binomial_coefficients, jacobi_symbol, | ||
fundamental_discriminant, | ||
squarefree_divisors, | ||
radical, | ||
binomial_coefficients, | ||
jacobi_symbol, | ||
dedekind_sum, | ||
prime_factors, prime_range, valuation) | ||
prime_factors, | ||
prime_range, | ||
valuation, | ||
) | ||
|
||
lazy_import('sage.arith.misc', ('Sigma', 'Moebius', 'Euler_Phi'), deprecation=30322) | ||
lazy_import("sage.arith.misc", ("Sigma", "Moebius", "Euler_Phi"), deprecation=30322) | ||
|
||
from sage.arith.functions import lcm | ||
|
||
from .functions import lcm | ||
LCM = lcm | ||
|
||
from .srange import xsrange, srange, ellipsis_iter, ellipsis_range | ||
from sage.arith.srange import xsrange, srange, ellipsis_iter, ellipsis_range | ||
|
||
sxrange = xsrange | ||
|
||
σ = sigma |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
from .debug import getattr_debug, type_debug | ||
from .getattr import raw_getattr | ||
from sage.cpython.debug import getattr_debug, type_debug | ||
from sage.cpython.getattr import raw_getattr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
|
||
from .bitset import Bitset, FrozenBitset | ||
from sage.data_structures.bitset import Bitset, FrozenBitset |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
from .temporary_file import tmp_dir, tmp_filename | ||
from sage.misc.temporary_file import tmp_dir, tmp_filename |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
from .sage_eval import sage_eval, sageobj | ||
from sage.misc.sage_eval import sage_eval, sageobj | ||
|
||
from .sage_input import sage_input | ||
from sage.misc.sage_input import sage_input |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
"Benchmarks" | ||
|
||
from .misc import cputime | ||
from sage.misc.misc import cputime | ||
|
||
from sage.all import * | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
"License" | ||
|
||
import os | ||
from . import pager | ||
from sage.misc import pager | ||
|
||
from sage.env import SAGE_ROOT | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters