parameters: (
      key: str,
      defval: object,
      doc: str = "",
      validator: Callable[[Any], Any] | None = None,
      cb: Callable[[str], Any] | None = None,
  )
docstring: Register an option in the package-wide pandas config object
  
      Parameters
      ----------
      key : str
          Fully-qualified key, e.g. "x.y.option - z".
      defval : object
          Default value of the option.
      doc : str
          Description of the option.
      validator : Callable, optional
          Function of a single argument, should raise `ValueError` if
          called with a value which is not a legal value for the option.
      cb
          a function of a single argument "key", which is called
          immediately after an option value is set/reset. key is
          the full name of the option.
  
      Raises
      ------
      ValueError if `validator` is specified and `defval` is not a valid value.
docstring_summary: Register an option in the package-wide pandas config object
docstring_tokens: Register an option in the package - wide pandas config object
function: def register_option(
      key: str,
      defval: object,
      doc: str = "",
      validator: Callable[[Any], Any] | None = None,
      cb: Callable[[str], Any] | None = None,
  ) -> None:
      """
      Register an option in the package-wide pandas config object
  
      Parameters
      ----------
      key : str
          Fully-qualified key, e.g. "x.y.option - z".
      defval : object
          Default value of the option.
      doc : str
          Description of the option.
      validator : Callable, optional
          Function of a single argument, should raise `ValueError` if
          called with a value which is not a legal value for the option.
      cb
          a function of a single argument "key", which is called
          immediately after an option value is set/reset. key is
          the full name of the option.
  
      Raises
      ------
      ValueError if `validator` is specified and `defval` is not a valid value.
  
      """
      import keyword
      import tokenize
  
      key = key.lower()
  
      if key in _registered_options:
          raise OptionError(f"Option '{key}' has already been registered")
      if key in _reserved_keys:
          raise OptionError(f"Option '{key}' is a reserved key")
  
      # the default value should be legal
      if validator:
          validator(defval)
  
      # walk the nested dict, creating dicts as needed along the path
      path = key.split(".")
  
      for k in path:
          if not re.match("^" + tokenize.Name + "$", k):
              raise ValueError(f"{k} is not a valid identifier")
          if keyword.iskeyword(k):
              raise ValueError(f"{k} is a python keyword")
  
      cursor = _global_config
      msg = "Path prefix to option '{option}' is already an option"
  
      for i, p in enumerate(path[:-1]):
          if not isinstance(cursor, dict):
              raise OptionError(msg.format(option=".".join(path[:i])))
          if p not in cursor:
              cursor[p] = {}
          cursor = cursor[p]
  
      if not isinstance(cursor, dict):
          raise OptionError(msg.format(option=".".join(path[:-1])))
  
      cursor[path[-1]] = defval  # initialize
  
      # save the option metadata
      _registered_options[key] = RegisteredOption(
          key=key, defval=defval, doc=doc, validator=validator, cb=cb
      )
function_tokens: def register_option ( key : str , defval : object , doc : str = "" , validator : Callable [ [ Any ] , Any ] | None = None , cb : Callable [ [ str ] , Any ] | None = None , ) -> None : import keyword import tokenize key = key . lower ( ) if key in _registered_options : raise OptionError ( f"Option '{key}' has already been registered" ) if key in _reserved_keys : raise OptionError ( f"Option '{key}' is a reserved key" ) # the default value should be legal if validator : validator ( defval ) # walk the nested dict, creating dicts as needed along the path path = key . split ( "." ) for k in path : if not re . match ( "^" + tokenize . Name + "$" , k ) : raise ValueError ( f"{k} is not a valid identifier" ) if keyword . iskeyword ( k ) : raise ValueError ( f"{k} is a python keyword" ) cursor = _global_config msg = "Path prefix to option '{option}' is already an option" for i , p in enumerate ( path [ : - 1 ] ) : if not isinstance ( cursor , dict ) : raise OptionError ( msg . format ( option = "." . join ( path [ : i ] ) ) ) if p not in cursor : cursor [ p ] = { } cursor = cursor [ p ] if not isinstance ( cursor , dict ) : raise OptionError ( msg . format ( option = "." . join ( path [ : - 1 ] ) ) ) cursor [ path [ - 1 ] ] = defval # initialize # save the option metadata _registered_options [ key ] = RegisteredOption ( key = key , defval = defval , doc = doc , validator = validator , cb = cb )