docs: def _replace(  # type: ignore
          self: T,
          variables: 'OrderedDict[Any, Variable]' = None,
          coord_names: set = None,
          dims: Dict[Any, int] = None,
          attrs: 'Optional[OrderedDict]' = __default,
          indexes: 'Optional[OrderedDict[Any, pd.Index]]' = __default,
          encoding: Optional[dict] = __default,
          inplace: bool = False,
      ) -> T:
          """Fastpath constructor for internal use.
  
          Returns an object with optionally with replaced attributes.
  
          Explicitly passed arguments are *not* copied when placed on the new
          dataset. It is up to the caller to ensure that they have the right type
          and are not used elsewhere.
          """
          if inplace:
              if variables is not None:
                  self._variables = variables
              if coord_names is not None:
                  self._coord_names = coord_names
              if dims is not None:
                  self._dims = dims
              if attrs is not self.__default:
                  self._attrs = attrs
              if indexes is not self.__default:
                  self._indexes = indexes
              if encoding is not self.__default:
                  self._encoding = encoding
              obj = self
          else:
              if variables is None:
                  variables = self._variables.copy()
              if coord_names is None:
                  coord_names = self._coord_names.copy()
              if dims is None:
                  dims = self._dims.copy()
              if attrs is self.__default:
                  attrs = copy.copy(self._attrs)
              if indexes is self.__default:
                  indexes = copy.copy(self._indexes)
              if encoding is self.__default:
                  encoding = copy.copy(self._encoding)
              obj = self._construct_direct(
                  variables, coord_names, dims, attrs, indexes, encoding)
          return obj