class_docstr: Class to make decorator marking function or method as deprecated
  
  The decorated function / method will:
  
  * Raise the given `warning_class` warning when the function / method gets
    called, up to (and including) version `until` (if specified);
  * Raise the given `error_class` error when the function / method gets
    called, when the package version is greater than version `until` (if
    specified).
  
  Parameters
  ----------
  version_comparator : callable
      Callable accepting string as argument, and return 1 if string
      represents a higher version than encoded in the `version_comparator`, 0
      if the version is equal, and -1 if the version is lower.  For example,
      the `version_comparator` may compare the input version string to the
      current package version string.
  warn_class : class, optional
      Class of warning to generate for deprecation.
  error_class : class, optional
      Class of error to generate when `version_comparator` returns 1 for a
      given argument of ``until`` in the ``__call__`` method (see below).
class_docstr_tok: ["Class","to","make","decorator","marking","function","or","method","as","deprecated","The","decorated","function","\/","method","will",":","*","Raise","the","given","`","warning_class","`","warning","when","the","function","\/","method","gets","called",",","up","to","(","and","including",")","version","`","until","`","(","if","specified",")",";","*","Raise","the","given","`","error_class","`","error","when","the","function","\/","method","gets","called",",","when","the","package","version","is","greater","than","version","`","until","`","(","if","specified",")",".","Parameters","--","--","--","--","--","version_comparator",":","callable","Callable","accepting","string","as","argument",",","and","return","1","if","string","represents","a","higher","version","than","encoded","in","the","`","version_comparator","`",",","0","if","the","version","is","equal",",","and","-1","if","the","version","is","lower",".","For","example",",","the","`","version_comparator","`","may","compare","the","input","version","string","to","the","current","package","version","string",".","warn_class",":","class",",","optional","Class","of","warning","to","generate","for","deprecation",".","error_class",":","class",",","optional","Class","of","error","to","generate","when","`","version_comparator","`","returns","1","for","a","given","argument","of","``","until","``","in","the","``","__call__","``","method","(","see","below",")","."]
code: def __init__(
      self,
      version_comparator: ty.Callable[[str], int],
      warn_class: type[Warning] = DeprecationWarning,
      error_class: type[Exception] = ExpiredDeprecationError,
  ) -> None:
      self.version_comparator = version_comparator
      self.warn_class = warn_class
      self.error_class = error_class
  
file_path: nibabel/nibabel/deprecator.py
imports: from __future__ import annotations
  import functools
  import re
  import typing
  import warnings
label_desc: Use image node_id 1 to create a new Deprecator object  with example: obj = Deprecator(version_comparator, warn_class, error_class)