Skip to content

Commit c46302c

Browse files
author
Release Manager
committed
sagemathgh-37868: `sage.misc.misc`: Remove deprecated code <!-- ^ 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". --> Remove code deprecated in - sagemath#32987 (2022) - sagemath#33213 (2022) - sagemath#29869 (2020) - sagemath#17815 (2020) - sagemath#29892 (2020) ### 📝 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#37868 Reported by: Matthias Köppe Reviewer(s): Michael Orlitzky
2 parents b14d3ec + 6d9c5fa commit c46302c

File tree

1 file changed

+0
-156
lines changed

1 file changed

+0
-156
lines changed

src/sage/misc/misc.py

-156
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,6 @@
5252
lazy_import("sage.combinat.subset", ["powerset", "subsets", "uniq"],
5353
deprecation=35564)
5454

55-
lazy_import("sage.misc.call", ["AttrCallObject", "attrcall", "call_method"],
56-
deprecation=29869)
57-
58-
lazy_import("sage.misc.verbose", ["verbose", "set_verbose", "set_verbose_files",
59-
"get_verbose_files", "unset_verbose_files", "get_verbose"],
60-
deprecation=17815)
61-
62-
lazy_import("sage.misc.repr", ["coeff_repr", "repr_lincomb"],
63-
deprecation=29892)
64-
6555
lazy_import("sage.misc.timing", ["cputime", "GlobalCputime", "walltime"],
6656
deprecation=35816)
6757

@@ -71,44 +61,6 @@
7161
# File and directory utilities
7262
#################################################################
7363

74-
75-
def sage_makedirs(dirname, mode=0o777):
76-
"""
77-
Python version of ``mkdir -p``: try to create a directory, and also
78-
create all intermediate directories as necessary. Succeed silently
79-
if the directory already exists (unlike ``os.makedirs()``).
80-
Raise other errors (like permission errors) normally.
81-
82-
This function is deprecated; use ``os.makedirs(..., exist_ok=True)``
83-
instead.
84-
85-
EXAMPLES::
86-
87-
sage: from sage.misc.misc import sage_makedirs
88-
sage: sage_makedirs(DOT_SAGE) # no output
89-
doctest:warning...
90-
DeprecationWarning: sage_makedirs is deprecated; use os.makedirs(..., exist_ok=True) instead
91-
See https://github.com/sagemath/sage/issues/32987 for details.
92-
93-
The following fails because we are trying to create a directory in
94-
place of an ordinary file::
95-
96-
sage: filename = tmp_filename()
97-
sage: sage_makedirs(filename)
98-
Traceback (most recent call last):
99-
...
100-
FileExistsError: [Errno ...] File exists: ...
101-
"""
102-
from sage.misc.superseded import deprecation
103-
deprecation(32987,
104-
'sage_makedirs is deprecated; use os.makedirs(..., exist_ok=True) instead')
105-
try:
106-
os.makedirs(dirname)
107-
except OSError:
108-
if not os.path.isdir(dirname):
109-
raise
110-
111-
11264
# We create the DOT_SAGE directory (if it does not exist yet; note in particular
11365
# that it may already have been created by the bin/sage script) with
11466
# restrictive permissions, since otherwise possibly just anybody can easily see
@@ -216,79 +168,6 @@ def try_read(obj, splitlines=False):
216168
return data
217169

218170

219-
#################################################
220-
# Next we create the Sage temporary directory.
221-
#################################################
222-
223-
224-
@lazy_string
225-
def SAGE_TMP():
226-
"""
227-
EXAMPLES::
228-
229-
sage: from sage.misc.misc import SAGE_TMP
230-
sage: SAGE_TMP
231-
doctest:warning...
232-
DeprecationWarning: SAGE_TMP is deprecated; please use python's
233-
"tempfile" module instead.
234-
See https://github.com/sagemath/sage/issues/33213 for details.
235-
l'.../temp/...'
236-
237-
"""
238-
from sage.misc.superseded import deprecation
239-
deprecation(33213, "SAGE_TMP is deprecated; please use python's \"tempfile\" module instead.")
240-
d = os.path.join(DOT_SAGE, 'temp', HOSTNAME, str(os.getpid()))
241-
os.makedirs(d, exist_ok=True)
242-
return d
243-
244-
245-
@lazy_string
246-
def ECL_TMP():
247-
"""
248-
Temporary directory that should be used by ECL interfaces launched from
249-
Sage.
250-
251-
EXAMPLES::
252-
253-
sage: from sage.misc.misc import ECL_TMP
254-
sage: ECL_TMP
255-
doctest:warning...
256-
DeprecationWarning: ECL_TMP is deprecated and is no longer used
257-
by the ECL interface in sage
258-
See https://github.com/sagemath/sage/issues/33213 for details.
259-
...
260-
261-
"""
262-
from sage.misc.superseded import deprecation
263-
deprecation(33213, "ECL_TMP is deprecated and is no longer used by the ECL interface in sage")
264-
import atexit
265-
import tempfile
266-
d = tempfile.TemporaryDirectory()
267-
result = os.path.join(d.name, 'ecl')
268-
atexit.register(lambda: d.cleanup())
269-
return result
270-
271-
272-
@lazy_string
273-
def SPYX_TMP():
274-
r"""
275-
EXAMPLES::
276-
277-
sage: from sage.misc.misc import SPYX_TMP
278-
sage: SPYX_TMP
279-
doctest:warning...
280-
DeprecationWarning: SPYX_TMP is deprecated;
281-
use sage.misc.temporary_file.spyx_tmp instead
282-
See https://github.com/sagemath/sage/issues/33213 for details.
283-
...
284-
285-
"""
286-
from sage.misc.temporary_file import spyx_tmp
287-
from sage.misc.superseded import deprecation
288-
deprecation(33213, "SPYX_TMP is deprecated; use sage.misc.temporary_file.spyx_tmp instead")
289-
return spyx_tmp()
290-
291-
292171
SAGE_DB = os.path.join(DOT_SAGE, 'db')
293172
os.makedirs(SAGE_DB, exist_ok=True)
294173

@@ -299,41 +178,6 @@ def SPYX_TMP():
299178
pass
300179

301180

302-
def union(x, y=None):
303-
"""
304-
Return the union of x and y, as a list. The resulting list need not
305-
be sorted and can change from call to call.
306-
307-
INPUT:
308-
309-
310-
- ``x`` - iterable
311-
312-
- ``y`` - iterable (may optionally omitted)
313-
314-
315-
OUTPUT: list
316-
317-
EXAMPLES::
318-
319-
sage: answer = union([1,2,3,4], [5,6]); answer
320-
doctest:...: DeprecationWarning: sage.misc.misc.union is deprecated...
321-
See https://github.com/sagemath/sage/issues/32096 for details.
322-
[1, 2, 3, 4, 5, 6]
323-
sage: union([1,2,3,4,5,6], [5,6]) == answer
324-
True
325-
sage: union((1,2,3,4,5,6), [5,6]) == answer
326-
True
327-
sage: union((1,2,3,4,5,6), set([5,6])) == answer
328-
True
329-
"""
330-
from sage.misc.superseded import deprecation
331-
deprecation(32096, "sage.misc.misc.union is deprecated, use 'list(set(x).union(y))' or a more suitable replacement")
332-
if y is None:
333-
return list(set(x))
334-
return list(set(x).union(y))
335-
336-
337181
def exactly_one_is_true(iterable):
338182
r"""
339183
Return whether exactly one element of ``iterable`` evaluates ``True``.

0 commit comments

Comments
 (0)