Skip to content

Commit d949bff

Browse files
author
Release Manager
committed
gh-35920: replace basestring by str in cython files <!-- ^^^^^ 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 --> just removing this trace of python2 <!-- 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. --> - [x] The title is concise, informative, and self-explanatory. - [x] 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: #35920 Reported by: Frédéric Chapoton Reviewer(s): Matthias Köppe
2 parents e0c51e5 + bfb5f73 commit d949bff

File tree

15 files changed

+18
-18
lines changed

15 files changed

+18
-18
lines changed

src/sage/algebras/letterplace/free_algebra_letterplace.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,7 @@ cdef class FreeAlgebra_letterplace(Algebra):
861861
(2)*y*y*y + z*z + t*y
862862
863863
"""
864-
if isinstance(x, basestring):
864+
if isinstance(x, str):
865865
from sage.misc.sage_eval import sage_eval
866866
return sage_eval(x, locals=self.gens_dict())
867867
try:

src/sage/libs/gap/libgap.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ class Gap(Parent):
310310
return make_GapElement_Boolean(self, GAP_True if x else GAP_False)
311311
elif isinstance(x, int):
312312
return make_GapElement_Integer(self, make_gap_integer(x))
313-
elif isinstance(x, basestring):
313+
elif isinstance(x, str):
314314
return make_GapElement_String(self, make_gap_string(x))
315315
elif isinstance(x, Path):
316316
return make_GapElement_String(self, make_gap_string(str(x)))
@@ -398,7 +398,7 @@ class Gap(Parent):
398398
"""
399399
cdef GapElement elem
400400

401-
if not isinstance(gap_command, basestring):
401+
if not isinstance(gap_command, str):
402402
gap_command = str(gap_command._libgap_init_())
403403

404404
initialize()

src/sage/libs/mpmath/ext_main.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ cdef int MPF_set_any(MPF *re, MPF *im, x, MPopts opts, bint str_tuple_ok) except
176176
elif len(x) == 4:
177177
MPF_set_tuple(re, x)
178178
return 1
179-
if isinstance(x, basestring):
179+
if isinstance(x, str):
180180
try:
181181
st = libmp.from_str(x, opts.prec,
182182
rndmode_to_python(opts.rounding))
@@ -1007,7 +1007,7 @@ cdef class Context:
10071007
if not p % q:
10081008
return p // q, 'Z'
10091009
return rationallib.mpq((p,q)), 'Q'
1010-
if isinstance(x, basestring) and '/' in x:
1010+
if isinstance(x, str) and '/' in x:
10111011
p, q = x.split('/')
10121012
p = int(p)
10131013
q = int(q)

src/sage/matrix/args.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,7 +1260,7 @@ cdef class MatrixArgs:
12601260
if isinstance(self.entries, MatrixArgs):
12611261
# Prevent recursion
12621262
return MA_ENTRIES_UNKNOWN
1263-
if isinstance(self.entries, basestring):
1263+
if isinstance(self.entries, str):
12641264
# Blacklist strings, we don't want them to be considered a sequence
12651265
return MA_ENTRIES_UNKNOWN
12661266
try:
@@ -1300,7 +1300,7 @@ cdef class MatrixArgs:
13001300
return MA_ENTRIES_SEQ_FLAT
13011301
if isinstance(x, Element) and element_is_scalar(<Element>x):
13021302
return MA_ENTRIES_SEQ_FLAT
1303-
if isinstance(x, basestring):
1303+
if isinstance(x, str):
13041304
# Blacklist strings, we don't want them to be considered a sequence
13051305
return MA_ENTRIES_UNKNOWN
13061306
try:

src/sage/matrix/matrix2.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12437,7 +12437,7 @@ cdef class Matrix(Matrix1):
1243712437
R = self.base_ring()
1243812438
if not is_Vector(v):
1243912439
raise TypeError('first input should be a vector, not {0}'.format(v))
12440-
if not (var is None or isinstance(var, basestring)):
12440+
if not (var is None or isinstance(var, str)):
1244112441
generator = False
1244212442
try:
1244312443
generator = var.is_gen()

src/sage/misc/cachefunc.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2210,7 +2210,7 @@ cdef class CachedMethodCallerNoArgs(CachedFunction):
22102210
22112211
"""
22122212
# initialize CachedFunction
2213-
if isinstance(f,basestring):
2213+
if isinstance(f,str):
22142214
try:
22152215
F = getattr(inst.__class__,f)
22162216
except AttributeError:

src/sage/misc/citation.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def get_systems(cmd):
9191
"Rebuild Sage with the environment variable 'SAGE_PROFILE=yes' "
9292
"to enable profiling.")
9393

94-
if not isinstance(cmd, basestring):
94+
if not isinstance(cmd, str):
9595
raise TypeError("command must be a string")
9696

9797
from sage.repl.preparse import preparse

src/sage/misc/lazy_import.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1104,7 +1104,7 @@ def lazy_import(module, names, as_=None, *,
11041104
"""
11051105
if as_ is None:
11061106
as_ = names
1107-
if isinstance(names, basestring):
1107+
if isinstance(names, str):
11081108
names = [names]
11091109
as_ = [as_]
11101110
else:

src/sage/misc/lazy_string.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ cdef class _LazyString():
205205

206206
cdef val(self):
207207
cdef f = self.func
208-
if isinstance(f, basestring):
208+
if isinstance(f, str):
209209
return f % self.args
210210
return PyObject_Call(f, self.args, self.kwargs)
211211

src/sage/rings/integer.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1902,7 +1902,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement):
19021902
sage: b'hi' * 8 == b'hihihihihihihihi'
19031903
True
19041904
"""
1905-
if isinstance(s, (list, tuple, basestring, bytes)):
1905+
if isinstance(s, (list, tuple, str, bytes)):
19061906
if mpz_fits_slong_p(self.value):
19071907
return s * mpz_get_si(self.value)
19081908
else:

0 commit comments

Comments
 (0)