biotite 0.41.2__cp312-cp312-win_amd64.whl → 1.0.0__cp312-cp312-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of biotite might be problematic. Click here for more details.

Files changed (205) hide show
  1. biotite/__init__.py +2 -3
  2. biotite/application/__init__.py +1 -1
  3. biotite/application/application.py +20 -10
  4. biotite/application/autodock/__init__.py +1 -1
  5. biotite/application/autodock/app.py +74 -79
  6. biotite/application/blast/__init__.py +1 -1
  7. biotite/application/blast/alignment.py +19 -10
  8. biotite/application/blast/webapp.py +92 -85
  9. biotite/application/clustalo/__init__.py +1 -1
  10. biotite/application/clustalo/app.py +46 -61
  11. biotite/application/dssp/__init__.py +1 -1
  12. biotite/application/dssp/app.py +8 -11
  13. biotite/application/localapp.py +62 -60
  14. biotite/application/mafft/__init__.py +1 -1
  15. biotite/application/mafft/app.py +16 -22
  16. biotite/application/msaapp.py +78 -89
  17. biotite/application/muscle/__init__.py +1 -1
  18. biotite/application/muscle/app3.py +50 -64
  19. biotite/application/muscle/app5.py +23 -31
  20. biotite/application/sra/__init__.py +1 -1
  21. biotite/application/sra/app.py +64 -68
  22. biotite/application/tantan/__init__.py +1 -1
  23. biotite/application/tantan/app.py +22 -45
  24. biotite/application/util.py +7 -9
  25. biotite/application/viennarna/rnaalifold.py +34 -28
  26. biotite/application/viennarna/rnafold.py +24 -39
  27. biotite/application/viennarna/rnaplot.py +36 -21
  28. biotite/application/viennarna/util.py +17 -12
  29. biotite/application/webapp.py +13 -14
  30. biotite/copyable.py +13 -13
  31. biotite/database/__init__.py +1 -1
  32. biotite/database/entrez/__init__.py +1 -1
  33. biotite/database/entrez/check.py +2 -3
  34. biotite/database/entrez/dbnames.py +7 -5
  35. biotite/database/entrez/download.py +55 -49
  36. biotite/database/entrez/key.py +1 -1
  37. biotite/database/entrez/query.py +62 -23
  38. biotite/database/error.py +2 -1
  39. biotite/database/pubchem/__init__.py +1 -1
  40. biotite/database/pubchem/download.py +43 -45
  41. biotite/database/pubchem/error.py +2 -2
  42. biotite/database/pubchem/query.py +34 -31
  43. biotite/database/pubchem/throttle.py +3 -4
  44. biotite/database/rcsb/__init__.py +1 -1
  45. biotite/database/rcsb/download.py +44 -52
  46. biotite/database/rcsb/query.py +85 -80
  47. biotite/database/uniprot/check.py +6 -3
  48. biotite/database/uniprot/download.py +6 -11
  49. biotite/database/uniprot/query.py +115 -31
  50. biotite/file.py +12 -31
  51. biotite/sequence/__init__.py +3 -3
  52. biotite/sequence/align/__init__.py +2 -2
  53. biotite/sequence/align/alignment.py +99 -90
  54. biotite/sequence/align/banded.cp312-win_amd64.pyd +0 -0
  55. biotite/sequence/align/buckets.py +12 -10
  56. biotite/sequence/align/cigar.py +43 -52
  57. biotite/sequence/align/kmeralphabet.cp312-win_amd64.pyd +0 -0
  58. biotite/sequence/align/kmeralphabet.pyx +55 -51
  59. biotite/sequence/align/kmersimilarity.cp312-win_amd64.pyd +0 -0
  60. biotite/sequence/align/kmertable.cp312-win_amd64.pyd +0 -0
  61. biotite/sequence/align/kmertable.pyx +3 -2
  62. biotite/sequence/align/localgapped.cp312-win_amd64.pyd +0 -0
  63. biotite/sequence/align/localungapped.cp312-win_amd64.pyd +0 -0
  64. biotite/sequence/align/matrix.py +81 -82
  65. biotite/sequence/align/multiple.cp312-win_amd64.pyd +0 -0
  66. biotite/sequence/align/multiple.pyx +1 -1
  67. biotite/sequence/align/pairwise.cp312-win_amd64.pyd +0 -0
  68. biotite/sequence/align/permutation.cp312-win_amd64.pyd +0 -0
  69. biotite/sequence/align/permutation.pyx +12 -4
  70. biotite/sequence/align/selector.cp312-win_amd64.pyd +0 -0
  71. biotite/sequence/align/selector.pyx +52 -54
  72. biotite/sequence/align/statistics.py +32 -33
  73. biotite/sequence/align/tracetable.cp312-win_amd64.pyd +0 -0
  74. biotite/sequence/alphabet.py +51 -65
  75. biotite/sequence/annotation.py +78 -77
  76. biotite/sequence/codec.cp312-win_amd64.pyd +0 -0
  77. biotite/sequence/codon.py +90 -79
  78. biotite/sequence/graphics/__init__.py +1 -1
  79. biotite/sequence/graphics/alignment.py +184 -103
  80. biotite/sequence/graphics/colorschemes.py +10 -12
  81. biotite/sequence/graphics/dendrogram.py +79 -34
  82. biotite/sequence/graphics/features.py +133 -99
  83. biotite/sequence/graphics/logo.py +22 -28
  84. biotite/sequence/graphics/plasmid.py +229 -178
  85. biotite/sequence/io/fasta/__init__.py +1 -1
  86. biotite/sequence/io/fasta/convert.py +44 -33
  87. biotite/sequence/io/fasta/file.py +42 -55
  88. biotite/sequence/io/fastq/__init__.py +1 -1
  89. biotite/sequence/io/fastq/convert.py +11 -14
  90. biotite/sequence/io/fastq/file.py +68 -112
  91. biotite/sequence/io/genbank/__init__.py +2 -2
  92. biotite/sequence/io/genbank/annotation.py +12 -20
  93. biotite/sequence/io/genbank/file.py +74 -76
  94. biotite/sequence/io/genbank/metadata.py +74 -62
  95. biotite/sequence/io/genbank/sequence.py +13 -14
  96. biotite/sequence/io/general.py +39 -30
  97. biotite/sequence/io/gff/__init__.py +2 -2
  98. biotite/sequence/io/gff/convert.py +10 -15
  99. biotite/sequence/io/gff/file.py +81 -65
  100. biotite/sequence/phylo/__init__.py +1 -1
  101. biotite/sequence/phylo/nj.cp312-win_amd64.pyd +0 -0
  102. biotite/sequence/phylo/tree.cp312-win_amd64.pyd +0 -0
  103. biotite/sequence/phylo/upgma.cp312-win_amd64.pyd +0 -0
  104. biotite/sequence/profile.py +57 -28
  105. biotite/sequence/search.py +17 -15
  106. biotite/sequence/seqtypes.py +200 -164
  107. biotite/sequence/sequence.py +15 -17
  108. biotite/structure/__init__.py +3 -3
  109. biotite/structure/atoms.py +221 -235
  110. biotite/structure/basepairs.py +260 -271
  111. biotite/structure/bonds.cp312-win_amd64.pyd +0 -0
  112. biotite/structure/bonds.pyx +29 -32
  113. biotite/structure/box.py +67 -71
  114. biotite/structure/celllist.cp312-win_amd64.pyd +0 -0
  115. biotite/structure/chains.py +55 -39
  116. biotite/structure/charges.cp312-win_amd64.pyd +0 -0
  117. biotite/structure/compare.py +32 -32
  118. biotite/structure/density.py +13 -18
  119. biotite/structure/dotbracket.py +20 -22
  120. biotite/structure/error.py +10 -2
  121. biotite/structure/filter.py +82 -77
  122. biotite/structure/geometry.py +130 -119
  123. biotite/structure/graphics/atoms.py +60 -43
  124. biotite/structure/graphics/rna.py +81 -68
  125. biotite/structure/hbond.py +112 -93
  126. biotite/structure/info/__init__.py +0 -2
  127. biotite/structure/info/atoms.py +10 -11
  128. biotite/structure/info/bonds.py +41 -43
  129. biotite/structure/info/ccd.py +4 -5
  130. biotite/structure/info/groups.py +1 -3
  131. biotite/structure/info/masses.py +5 -10
  132. biotite/structure/info/misc.py +1 -1
  133. biotite/structure/info/radii.py +20 -20
  134. biotite/structure/info/standardize.py +15 -26
  135. biotite/structure/integrity.py +18 -71
  136. biotite/structure/io/__init__.py +3 -4
  137. biotite/structure/io/dcd/__init__.py +1 -1
  138. biotite/structure/io/dcd/file.py +22 -20
  139. biotite/structure/io/general.py +47 -61
  140. biotite/structure/io/gro/__init__.py +1 -1
  141. biotite/structure/io/gro/file.py +73 -72
  142. biotite/structure/io/mol/__init__.py +1 -1
  143. biotite/structure/io/mol/convert.py +8 -11
  144. biotite/structure/io/mol/ctab.py +37 -36
  145. biotite/structure/io/mol/header.py +14 -10
  146. biotite/structure/io/mol/mol.py +9 -53
  147. biotite/structure/io/mol/sdf.py +47 -50
  148. biotite/structure/io/netcdf/__init__.py +1 -1
  149. biotite/structure/io/netcdf/file.py +24 -23
  150. biotite/structure/io/pdb/__init__.py +1 -1
  151. biotite/structure/io/pdb/convert.py +32 -20
  152. biotite/structure/io/pdb/file.py +151 -172
  153. biotite/structure/io/pdb/hybrid36.cp312-win_amd64.pyd +0 -0
  154. biotite/structure/io/pdbqt/__init__.py +1 -1
  155. biotite/structure/io/pdbqt/convert.py +17 -11
  156. biotite/structure/io/pdbqt/file.py +128 -80
  157. biotite/structure/io/pdbx/__init__.py +1 -2
  158. biotite/structure/io/pdbx/bcif.py +36 -44
  159. biotite/structure/io/pdbx/cif.py +64 -62
  160. biotite/structure/io/pdbx/component.py +10 -16
  161. biotite/structure/io/pdbx/convert.py +235 -246
  162. biotite/structure/io/pdbx/encoding.cp312-win_amd64.pyd +0 -0
  163. biotite/structure/io/trajfile.py +76 -93
  164. biotite/structure/io/trr/__init__.py +1 -1
  165. biotite/structure/io/trr/file.py +12 -15
  166. biotite/structure/io/xtc/__init__.py +1 -1
  167. biotite/structure/io/xtc/file.py +11 -14
  168. biotite/structure/mechanics.py +9 -11
  169. biotite/structure/molecules.py +3 -4
  170. biotite/structure/pseudoknots.py +53 -67
  171. biotite/structure/rdf.py +23 -21
  172. biotite/structure/repair.py +137 -86
  173. biotite/structure/residues.py +26 -16
  174. biotite/structure/sasa.cp312-win_amd64.pyd +0 -0
  175. biotite/structure/{resutil.py → segments.py} +24 -23
  176. biotite/structure/sequence.py +10 -11
  177. biotite/structure/sse.py +100 -119
  178. biotite/structure/superimpose.py +39 -77
  179. biotite/structure/transform.py +97 -71
  180. biotite/structure/util.py +11 -13
  181. biotite/version.py +2 -2
  182. biotite/visualize.py +69 -55
  183. {biotite-0.41.2.dist-info → biotite-1.0.0.dist-info}/METADATA +5 -5
  184. biotite-1.0.0.dist-info/RECORD +322 -0
  185. biotite/structure/io/ctab.py +0 -72
  186. biotite/structure/io/mmtf/__init__.py +0 -21
  187. biotite/structure/io/mmtf/assembly.py +0 -214
  188. biotite/structure/io/mmtf/convertarray.cp312-win_amd64.pyd +0 -0
  189. biotite/structure/io/mmtf/convertarray.pyx +0 -341
  190. biotite/structure/io/mmtf/convertfile.cp312-win_amd64.pyd +0 -0
  191. biotite/structure/io/mmtf/convertfile.pyx +0 -501
  192. biotite/structure/io/mmtf/decode.cp312-win_amd64.pyd +0 -0
  193. biotite/structure/io/mmtf/decode.pyx +0 -152
  194. biotite/structure/io/mmtf/encode.cp312-win_amd64.pyd +0 -0
  195. biotite/structure/io/mmtf/encode.pyx +0 -183
  196. biotite/structure/io/mmtf/file.py +0 -233
  197. biotite/structure/io/npz/__init__.py +0 -20
  198. biotite/structure/io/npz/file.py +0 -152
  199. biotite/structure/io/pdbx/legacy.py +0 -267
  200. biotite/structure/io/tng/__init__.py +0 -13
  201. biotite/structure/io/tng/file.py +0 -46
  202. biotite/temp.py +0 -86
  203. biotite-0.41.2.dist-info/RECORD +0 -340
  204. {biotite-0.41.2.dist-info → biotite-1.0.0.dist-info}/WHEEL +0 -0
  205. {biotite-0.41.2.dist-info → biotite-1.0.0.dist-info}/licenses/LICENSE.rst +0 -0
@@ -1,267 +0,0 @@
1
- # This source code is part of the Biotite package and is distributed
2
- # under the 3-Clause BSD License. Please see 'LICENSE.rst' for further
3
- # information.
4
-
5
- __name__ = "biotite.structure.io.pdbx"
6
- __author__ = "Patrick Kunzmann"
7
- __all__ = ["PDBxFile"]
8
-
9
- import copy
10
- from collections.abc import MutableMapping
11
- import warnings
12
- from .cif import CIFFile, CIFBlock, CIFCategory, CIFColumn
13
- from ....file import File, InvalidFileError
14
-
15
-
16
- class PDBxFile(File, MutableMapping):
17
- """
18
- This class represents the legacy interface to CIF files.
19
-
20
- The categories of the file can be accessed using the
21
- :meth:`get_category()`/:meth:`set_category()` methods.
22
- The content of each category is represented by a dictionary.
23
- The dictionary contains the entry
24
- (e.g. *label_entity_id* in *atom_site*) as key.
25
- The corresponding values are either strings in *non-looped*
26
- categories, or 1-D numpy arrays of string objects in case of
27
- *looped* categories.
28
-
29
- A category can be changed or added using :meth:`set_category()`:
30
- If a string-valued dictionary is provided, a *non-looped* category
31
- will be created; if an array-valued dictionary is given, a
32
- *looped* category will be created. In case of arrays, it is
33
- important that all arrays have the same size.
34
-
35
- Alternatively, The content of this file can also be read/write
36
- accessed using dictionary-like indexing:
37
- You can either provide a data block and a category or only a
38
- category, in which case the first data block is taken.
39
-
40
- DEPRECATED: Use :class:`CIFFile` instead.
41
-
42
- Notes
43
- -----
44
- This class is also able to detect and parse multiline entries in the
45
- file. However, when writing a category no multiline values are used.
46
- This could lead to long lines.
47
-
48
- This class uses a lazy category dictionary creation: When reading
49
- the file only the line positions of all categories are checked. The
50
- time consuming task of dictionary creation is done when
51
- :meth:`get_category()` is called.
52
-
53
- Examples
54
- --------
55
- Read the file and get author names:
56
-
57
- >>> import os.path
58
- >>> file = PDBxFile.read(os.path.join(path_to_structures, "1l2y.cif"))
59
- >>> author_dict = file.get_category("citation_author", block="1L2Y")
60
- >>> print(author_dict["name"])
61
- ['Neidigh, J.W.' 'Fesinmeyer, R.M.' 'Andersen, N.H.']
62
-
63
- Dictionary style indexing, no specification of data block:
64
-
65
- >>> print(file["citation_author"]["name"])
66
- ['Neidigh, J.W.' 'Fesinmeyer, R.M.' 'Andersen, N.H.']
67
-
68
- Get the structure from the file:
69
-
70
- >>> arr = get_structure(file)
71
- >>> print(type(arr).__name__)
72
- AtomArrayStack
73
- >>> arr = get_structure(file, model=1)
74
- >>> print(type(arr).__name__)
75
- AtomArray
76
-
77
- Modify atom array and write it back into the file:
78
-
79
- >>> arr_mod = rotate(arr, [1,2,3])
80
- >>> set_structure(file, arr_mod)
81
- >>> file.write(os.path.join(path_to_directory, "1l2y_mod.cif"))
82
- """
83
-
84
- def __init__(self):
85
- warnings.warn(
86
- "'PDBxFile' is deprecated, use 'CIFFile' instead",
87
- DeprecationWarning
88
- )
89
- super().__init__()
90
- self._cif_file = CIFFile()
91
-
92
- @property
93
- def cif_file(self):
94
- return self._cif_file
95
-
96
- @property
97
- def lines(self):
98
- return self._cif_file.lines
99
-
100
- @classmethod
101
- def read(cls, file):
102
- """
103
- Read a PDBx/mmCIF file.
104
-
105
- Parameters
106
- ----------
107
- file : file-like object or str
108
- The file to be read.
109
- Alternatively a file path can be supplied.
110
-
111
- Returns
112
- -------
113
- file_object : PDBxFile
114
- The parsed file.
115
- """
116
- pdbx_file = PDBxFile()
117
- pdbx_file._cif_file = CIFFile.read(file)
118
- return pdbx_file
119
-
120
- def write(self, file):
121
- self._cif_file.write(file)
122
-
123
-
124
- def get_block_names(self):
125
- """
126
- Get the names of all data blocks in the file.
127
-
128
- Returns
129
- -------
130
- blocks : list
131
- List of data block names.
132
- """
133
- return sorted(self._cif_file.keys())
134
-
135
- def get_category(self, category, block=None, expect_looped=False):
136
- """
137
- Get the dictionary for a given category.
138
-
139
- Parameters
140
- ----------
141
- category : string
142
- The name of the category. The leading underscore is omitted.
143
- block : string, optional
144
- The name of the data block. Default is the first
145
- (and most times only) data block of the file.
146
- expect_looped : bool, optional
147
- If set to true, the returned dictionary will always contain
148
- arrays (only if the category exists):
149
- If the category is *non-looped*, each array will contain
150
- only one element.
151
-
152
- Returns
153
- -------
154
- category_dict : dict of (str or ndarray, dtype=str) or None
155
- A entry keyed dictionary. The corresponding values are
156
- strings or array of strings for *non-looped* and
157
- *looped* categories, respectively.
158
- Returns None, if the data block does not contain the given
159
- category.
160
- """
161
- if block is None:
162
- try:
163
- block = self.get_block_names()[0]
164
- except IndexError:
165
- raise InvalidFileError("File is empty")
166
-
167
- if category not in self._cif_file[block]:
168
- return None
169
-
170
- category_dict = {}
171
- for column_name, column in self._cif_file[block][category].items():
172
- if not expect_looped and len(column) == 1:
173
- category_dict[column_name] = column.as_item()
174
- else:
175
- category_dict[column_name] = column.as_array()
176
- return category_dict
177
-
178
- def set_category(self, category, category_dict, block=None):
179
- """
180
- Set the content of a category.
181
-
182
- If the category is already existing, all lines corresponding
183
- to the category are replaced. Otherwise a new category is
184
- created and the lines are appended at the end of the data block.
185
-
186
- Parameters
187
- ----------
188
- category : string
189
- The name of the category. The leading underscore is omitted.
190
- category_dict : dict
191
- The category content. The dictionary must have strings
192
- (subcategories) as keys and strings or :class:`ndarray`
193
- objects as values.
194
- block : string, optional
195
- The name of the data block. Default is the first
196
- (and most times only) data block of the file. If the
197
- block is not contained in the file yet, a new block is
198
- appended at the end of the file.
199
- """
200
- if block is None:
201
- try:
202
- block = self.get_block_names()[0]
203
- except IndexError:
204
- raise InvalidFileError(
205
- "File is empty, give an explicit data block"
206
- )
207
-
208
- if block not in self._cif_file:
209
- self._cif_file = CIFBlock()
210
- self._cif_file[block][category] = CIFCategory({
211
- column_name: CIFColumn(array)
212
- for column_name, array in category_dict.items()
213
- })
214
-
215
- def __copy_fill__(self, clone):
216
- super().__copy_fill__(clone)
217
- clone._cif_file = copy.deepcopy(self._cif_file)
218
-
219
- def __setitem__(self, index, item):
220
- block, category_name = self._full_index(index)
221
- self.set_category(category_name, item, block=block)
222
-
223
- def __getitem__(self, index):
224
- block, category_name = self._full_index(index)
225
- return self.get_category(category_name, block=block)
226
-
227
- def __delitem__(self, index):
228
- block, category_name = self._full_index(index)
229
- del self._cif_file[block][category_name]
230
-
231
- def __contains__(self, index):
232
- block, category_name = self._full_index(index)
233
- return (block, category_name) in self._categories
234
-
235
- def __iter__(self):
236
- try:
237
- block = self.get_block_names()[0]
238
- except IndexError:
239
- raise InvalidFileError(
240
- "File is empty, give an explicit data block"
241
- )
242
-
243
- return iter(self._cif_file[block])
244
-
245
- def __len__(self):
246
- try:
247
- block = self.get_block_names()[0]
248
- except IndexError:
249
- raise InvalidFileError(
250
- "File is empty, give an explicit data block"
251
- )
252
-
253
- return len(self._cif_file[block])
254
-
255
- def _full_index(self, index):
256
- """
257
- Converts a an integer or tuple index into a block and a category
258
- name.
259
- """
260
- if isinstance(index, tuple):
261
- return index[0], index[1]
262
- elif isinstance(index, str):
263
- return self.get_block_names()[0], index
264
- else:
265
- raise TypeError(
266
- f"'{type(index).__name__}' is an invalid index type"
267
- )
@@ -1,13 +0,0 @@
1
- # This source code is part of the Biotite package and is distributed
2
- # under the 3-Clause BSD License. Please see 'LICENSE.rst' for further
3
- # information.
4
-
5
- """
6
- This subpackage is used for reading and writing trajectories in the
7
- compressed *Gromacs* TNG format.
8
- """
9
-
10
- __name__ = "biotite.structure.io.tng"
11
- __author__ = "Patrick Kunzmann"
12
-
13
- from .file import *
@@ -1,46 +0,0 @@
1
- # This source code is part of the Biotite package and is distributed
2
- # under the 3-Clause BSD License. Please see 'LICENSE.rst' for further
3
- # information.
4
-
5
- __name__ = "biotite.structure.io.tng"
6
- __author__ = "Patrick Kunzmann"
7
- __all__ = ["TNGFile"]
8
-
9
- import numpy as np
10
- from ..trajfile import TrajectoryFile
11
-
12
-
13
- class TNGFile(TrajectoryFile):
14
- """
15
- This file class represents a TNG trajectory file.
16
- """
17
-
18
- @classmethod
19
- def traj_type(cls):
20
- import mdtraj.formats as traj
21
- return traj.TNGTrajectoryFile
22
-
23
- @classmethod
24
- def process_read_values(cls, read_values):
25
- # nm to Angstrom
26
- coord = read_values[0] * 10
27
- box = read_values[2]
28
- if box is not None:
29
- box *= 10
30
- time = read_values[1]
31
- return coord, box, time
32
-
33
- @classmethod
34
- def prepare_write_values(cls, coord, box, time):
35
- # Angstrom to nm
36
- xyz = np.divide(coord, 10, dtype=np.float32) \
37
- if coord is not None else None
38
- time = time.astype(np.float32, copy=False) \
39
- if time is not None else None
40
- box = np.divide(box, 10, dtype=np.float32) \
41
- if box is not None else None
42
- return {
43
- "xyz" : xyz,
44
- "box" : box,
45
- "time" : time,
46
- }
biotite/temp.py DELETED
@@ -1,86 +0,0 @@
1
- # This source code is part of the Biotite package and is distributed
2
- # under the 3-Clause BSD License. Please see 'LICENSE.rst' for further
3
- # information.
4
-
5
- __name__ = "biotite"
6
- __author__ = "Patrick Kunzmann"
7
- __all__ = ["temp_file", "temp_dir"]
8
-
9
- import shutil
10
- import atexit
11
- import os
12
- import tempfile
13
- import warnings
14
-
15
-
16
- _temp_dir = ""
17
-
18
- def _create_temp_dir():
19
- global _temp_dir
20
- if _temp_dir == "":
21
- cwd = os.getcwd()
22
- _temp_dir = os.path.join(cwd, ".biotitetemp")
23
- if not os.path.isdir(_temp_dir):
24
- os.makedirs(_temp_dir)
25
- atexit.register(_delete_temp)
26
-
27
-
28
- def _delete_temp():
29
- global _temp_dir
30
- # Condition only for savety reasons
31
- if ".biotitetemp" in _temp_dir:
32
- shutil.rmtree(_temp_dir)
33
-
34
-
35
- def temp_file(suffix=""):
36
- """
37
- Get a file path to a temporary file.
38
-
39
- All temporary files will be deleted after script execution.
40
-
41
- DEPRECATED: Please use the :mod:`tempfile` module from the
42
- standard library.
43
-
44
- Parameters
45
- ----------
46
- suffix : str
47
- Suffix of the file.
48
- By default no suffix will be appended.
49
-
50
- Returns
51
- -------
52
- temp_file_name : str
53
- a file name in the temporary directory.
54
- """
55
- global _temp_dir
56
- warnings.warn(
57
- "Please use the :mod:`tempfile` module from the standard library",
58
- DeprecationWarning
59
- )
60
- _create_temp_dir()
61
- if suffix != "" and not suffix.startswith("."):
62
- suffix = "." + suffix
63
- return tempfile.mktemp(suffix=suffix, dir=_temp_dir)
64
-
65
-
66
- def temp_dir():
67
- """
68
- Get the temporary directory path.
69
-
70
- The temporary directory will be deleted after script execution.
71
-
72
- DEPRECATED: Please use the :mod:`tempfile` module from the
73
- standard library.
74
-
75
- Returns
76
- -------
77
- temp_dir : str
78
- Path of the temporary directory.
79
- """
80
- global _temp_dir
81
- warnings.warn(
82
- "Please use the :mod:`tempfile` module from the standard library",
83
- DeprecationWarning
84
- )
85
- _create_temp_dir()
86
- return _temp_dir