class_docstr: Factory class for function transforming a string into another object
  (int, float).
  
  After initialization, an instance can be called to transform a string
  into another object. If the string is recognized as representing a
  missing value, a default value is returned.
  
  Attributes
  ----------
  func : function
      Function used for the conversion.
  default : any
      Default value to return when the input corresponds to a missing
      value.
  type : type
      Type of the output.
  _status : int
      Integer representing the order of the conversion.
  _mapper : sequence of tuples
      Sequence of tuples (dtype, function, default value) to evaluate in
      order.
  _locked : bool
      Holds `locked` parameter.
  
  Parameters
  ----------
  dtype_or_func : {None, dtype, function}, optional
      If a `dtype`, specifies the input data type, used to define a basic
      function and a default value for missing data. For example, when
      `dtype` is float, the `func` attribute is set to `float` and the
      default value to `np.nan`.  If a function, this function is used to
      convert a string to another object. In this case, it is recommended
      to give an associated default value as input.
  default : any, optional
      Value to return by default, that is, when the string to be
      converted is flagged as missing. If not given, `StringConverter`
      tries to supply a reasonable default value.
  missing_values : {None, sequence of str}, optional
      ``None`` or sequence of strings indicating a missing value. If ``None``
      then missing values are indicated by empty entries. The default is
      ``None``.
  locked : bool, optional
      Whether the StringConverter should be locked to prevent automatic
      upgrade or not. Default is False.
code: def __init__(
      self,
      dtype_or_func=None,
      default=None,
      missing_values=None,
      locked=False,
  ):
      # Defines a lock for upgrade
      self._locked = bool(locked)
      # No input dtype: minimal initialization
      if dtype_or_func is None:
          self.func = str2bool
          self._status = 0
          self.default = default or False
          dtype = np.dtype("bool")
      else:
          # Is the input a np.dtype ?
          try:
              self.func = None
              dtype = np.dtype(dtype_or_func)
          except TypeError:
              # dtype_or_func must be a function, then
              if not hasattr(dtype_or_func, "__call__"):
                  errmsg = (
                      "The input argument `dtype` is neither a"
                      " function nor a dtype (got '%s' instead)"
                  )
                  raise TypeError(errmsg % type(dtype_or_func))
              # Set the function
              self.func = dtype_or_func
              # If we don't have a default, try to guess it or set it to
              # None
              if default is None:
                  try:
                      default = self.func("0")
                  except ValueError:
                      default = None
              dtype = self._getdtype(default)
  
          # find the best match in our mapper
          try:
              self._status, (
                  _,
                  func,
                  default_def,
              ) = self._find_map_entry(dtype)
          except LookupError:
              # no match
              self.default = default
              _, func, _ = self._mapper[-1]
              self._status = 0
          else:
              # use the found default only if we did not already have one
              if default is None:
                  self.default = default_def
              else:
                  self.default = default
  
          # If the input was a dtype, set the function to the last we saw
          if self.func is None:
              self.func = func
  
          # If the status is 1 (int), change the function to
          # something more robust.
          if self.func == self._mapper[1][1]:
              if issubclass(dtype.type, np.uint64):
                  self.func = np.uint64
              elif issubclass(dtype.type, np.int64):
                  self.func = np.int64
              else:
                  self.func = lambda x: int(float(x))
      # Store the list of strings corresponding to missing values.
      if missing_values is None:
          self.missing_values = {""}
      else:
          if isinstance(missing_values, str):
              missing_values = missing_values.split(",")
          self.missing_values = set(list(missing_values) + [""])
  
      self._callingfunction = self._strict_call
      self.type = self._dtypeortype(dtype)
      self._checked = False
      self._initial_default = default
  
imports: import numpy
  import numpy.core.numeric
  from numpy.compat import asbytes, asunicode
label_desc: Use image node_id 6 to create a new StringConverter object  with example: obj = StringConverter(dtype_or_func, default, missing_values, locked)