_expired_attrs_2_0.py 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. "safe_eval": "Use `ast.literal_eval` instead.",
  28. "float_": "Use `np.float64` instead.",
  29. "complex_": "Use `np.complex128` instead.",
  30. "longfloat": "Use `np.longdouble` instead.",
  31. "singlecomplex": "Use `np.complex64` instead.",
  32. "cfloat": "Use `np.complex128` instead.",
  33. "longcomplex": "Use `np.clongdouble` instead.",
  34. "clongfloat": "Use `np.clongdouble` instead.",
  35. "string_": "Use `np.bytes_` instead.",
  36. "unicode_": "Use `np.str_` instead.",
  37. "Inf": "Use `np.inf` instead.",
  38. "Infinity": "Use `np.inf` instead.",
  39. "NaN": "Use `np.nan` instead.",
  40. "infty": "Use `np.inf` instead.",
  41. "issctype": "Use `issubclass(rep, np.generic)` instead.",
  42. "maximum_sctype":
  43. "Use a specific dtype instead. You should avoid relying "
  44. "on any implicit mechanism and select the largest dtype of "
  45. "a kind explicitly in the code.",
  46. "obj2sctype": "Use `np.dtype(obj).type` instead.",
  47. "sctype2char": "Use `np.dtype(obj).char` instead.",
  48. "sctypes": "Access dtypes explicitly instead.",
  49. "issubsctype": "Use `np.issubdtype` instead.",
  50. "set_string_function":
  51. "Use `np.set_printoptions` instead with a formatter for "
  52. "custom printing of NumPy objects.",
  53. "asfarray": "Use `np.asarray` with a proper dtype instead.",
  54. "issubclass_": "Use `issubclass` builtin instead.",
  55. "tracemalloc_domain": "It's now available from `np.lib`.",
  56. "mat": "Use `np.asmatrix` instead.",
  57. "recfromcsv": "Use `np.genfromtxt` with comma delimiter instead.",
  58. "recfromtxt": "Use `np.genfromtxt` instead.",
  59. "deprecate": "Emit `DeprecationWarning` with `warnings.warn` directly, "
  60. "or use `typing.deprecated`.",
  61. "deprecate_with_doc": "Emit `DeprecationWarning` with `warnings.warn` "
  62. "directly, or use `typing.deprecated`.",
  63. "find_common_type":
  64. "Use `numpy.promote_types` or `numpy.result_type` instead. "
  65. "To achieve semantics for the `scalar_types` argument, use "
  66. "`numpy.result_type` and pass the Python values `0`, `0.0`, or `0j`.",
  67. "round_": "Use `np.round` instead.",
  68. "get_array_wrap": "",
  69. "DataSource": "It's still available as `np.lib.npyio.DataSource`.",
  70. "nbytes": "Use `np.dtype(<dtype>).itemsize` instead.",
  71. "byte_bounds": "Now it's available under `np.lib.array_utils.byte_bounds`",
  72. "compare_chararrays":
  73. "It's still available as `np.char.compare_chararrays`.",
  74. "format_parser": "It's still available as `np.rec.format_parser`.",
  75. "alltrue": "Use `np.all` instead.",
  76. "sometrue": "Use `np.any` instead.",
  77. }