code: def _declare(self, key, type=Any, *, default=...):
      assert not self._already_declared(
          key
      ), f"Attempt of overwriting already declared value {key}"
  
      # This is kinda hacky. For each key, we create a new pydantic model,
      # which contains just one definition, effectively, like this:
      #
      # class foo(pydantic.BaseModel):
      #     foo: type
      #
      # When we want to evaluate, we do this:
      #
      #    # given
      #    settings.foo = value
      #
      #    # becomes
      #    settings._types["foo"].parse_obj({"foo": value}).foo
  
      self._types[key] = pydantic.create_model(
          key, **{key: (type, ...)}, __config__=_Config
      )
  
      # we use our own default-handling, instead of relying on pydantic
      if default != ...:
          self._set_(self._default, key, default)
  
imports: import functools
  import inspect
  import itertools
  from operator import attrgetter
  from typing import Any
  from gluonts.pydantic import pydantic, deep_update
label_desc: Use image node_id 5 for calling the Settings obj's underlying member method code with example usage: obj._declare(key, type) without return types