_expired_attrs_2_0.py 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. """
  2. Dict of expired attributes that are discontinued since 2.0 release.
  3. Each item is associated with a migration note.
  4. """
  5. __expired_attributes__ = {
  6. "geterrobj": "Use the np.errstate context manager instead.",
  7. "seterrobj": "Use the np.errstate context manager instead.",
  8. "cast": "Use `np.asarray(arr, dtype=dtype)` instead.",
  9. "source": "Use `inspect.getsource` instead.",
  10. "lookfor": "Search NumPy's documentation directly.",
  11. "who": "Use an IDE variable explorer or `locals()` instead.",
  12. "fastCopyAndTranspose": "Use `arr.T.copy()` instead.",
  13. "set_numeric_ops":
  14. "For the general case, use `PyUFunc_ReplaceLoopBySignature`. "
  15. "For ndarray subclasses, define the ``__array_ufunc__`` method "
  16. "and override the relevant ufunc.",
  17. "NINF": "Use `-np.inf` instead.",
  18. "PINF": "Use `np.inf` instead.",
  19. "NZERO": "Use `-0.0` instead.",
  20. "PZERO": "Use `0.0` instead.",
  21. "add_newdoc":
  22. "It's still available as `np.lib.add_newdoc`.",
  23. "add_docstring":
  24. "It's still available as `np.lib.add_docstring`.",
  25. "add_newdoc_ufunc":
  26. "It's an internal function and doesn't have a replacement.",
  27. "compat": "There's no replacement, as Python 2 is no longer supported.",
  28. "safe_eval": "Use `ast.literal_eval` instead.",
  29. "float_": "Use `np.float64` instead.",
  30. "complex_": "Use `np.complex128` instead.",
  31. "longfloat": "Use `np.longdouble` instead.",
  32. "singlecomplex": "Use `np.complex64` instead.",
  33. "cfloat": "Use `np.complex128` instead.",
  34. "longcomplex": "Use `np.clongdouble` instead.",
  35. "clongfloat": "Use `np.clongdouble` instead.",
  36. "string_": "Use `np.bytes_` instead.",
  37. "unicode_": "Use `np.str_` instead.",
  38. "Inf": "Use `np.inf` instead.",
  39. "Infinity": "Use `np.inf` instead.",
  40. "NaN": "Use `np.nan` instead.",
  41. "infty": "Use `np.inf` instead.",
  42. "issctype": "Use `issubclass(rep, np.generic)` instead.",
  43. "maximum_sctype":
  44. "Use a specific dtype instead. You should avoid relying "
  45. "on any implicit mechanism and select the largest dtype of "
  46. "a kind explicitly in the code.",
  47. "obj2sctype": "Use `np.dtype(obj).type` instead.",
  48. "sctype2char": "Use `np.dtype(obj).char` instead.",
  49. "sctypes": "Access dtypes explicitly instead.",
  50. "issubsctype": "Use `np.issubdtype` instead.",
  51. "set_string_function":
  52. "Use `np.set_printoptions` instead with a formatter for "
  53. "custom printing of NumPy objects.",
  54. "asfarray": "Use `np.asarray` with a proper dtype instead.",
  55. "issubclass_": "Use `issubclass` builtin instead.",
  56. "tracemalloc_domain": "It's now available from `np.lib`.",
  57. "mat": "Use `np.asmatrix` instead.",
  58. "recfromcsv": "Use `np.genfromtxt` with comma delimiter instead.",
  59. "recfromtxt": "Use `np.genfromtxt` instead.",
  60. "deprecate": "Emit `DeprecationWarning` with `warnings.warn` directly, "
  61. "or use `typing.deprecated`.",
  62. "deprecate_with_doc": "Emit `DeprecationWarning` with `warnings.warn` "
  63. "directly, or use `typing.deprecated`.",
  64. "disp": "Use your own printing function instead.",
  65. "find_common_type":
  66. "Use `numpy.promote_types` or `numpy.result_type` instead. "
  67. "To achieve semantics for the `scalar_types` argument, use "
  68. "`numpy.result_type` and pass the Python values `0`, `0.0`, or `0j`.",
  69. "round_": "Use `np.round` instead.",
  70. "get_array_wrap": "",
  71. "DataSource": "It's still available as `np.lib.npyio.DataSource`.",
  72. "nbytes": "Use `np.dtype(<dtype>).itemsize` instead.",
  73. "byte_bounds": "Now it's available under `np.lib.array_utils.byte_bounds`",
  74. "compare_chararrays":
  75. "It's still available as `np.char.compare_chararrays`.",
  76. "format_parser": "It's still available as `np.rec.format_parser`.",
  77. "alltrue": "Use `np.all` instead.",
  78. "sometrue": "Use `np.any` instead.",
  79. }