class_docstr: A dict subclass with attribute style access.
  
  This dict subclass has a a few extra features:
  
  * Attribute style access.
  * Protection of class members (like keys, items) when using attribute
    style access.
  * The ability to restrict assignment to only existing keys.
  * Intelligent merging.
  * Overloaded operators.
class_docstr_tok: ["A","dict","subclass","with","attribute","style","access",".","This","dict","subclass","has","a","a","few","extra","features",":","*","Attribute","style","access",".","*","Protection","of","class","members","(","like","keys",",","items",")","when","using","attribute","style","access",".","*","The","ability","to","restrict","assignment","to","only","existing","keys",".","*","Intelligent","merging",".","*","Overloaded","operators","."]
docstr: Get an attr by calling :meth:`dict.__getitem__`.
  
  Like :meth:`__setattr__`, this method converts :exc:`KeyError` to
  :exc:`AttributeError`.
  
  Examples
  --------
  >>> s = Struct(a=10)
  >>> s.a
  10
  >>> type(s.get)
  <... 'builtin_function_or_method'>
  >>> try:
  ...     s.b
  ... except AttributeError:
  ...     print("I don't have that key")
  ...
  I don't have that key
docstr_tok: ["Get","an","attr","by","calling",":","meth",":","`","dict.__getitem__","`",".","Like",":","meth",":","`","__setattr__","`",",","this","method","converts",":","exc",":","`","KeyError","`","to",":","exc",":","`","AttributeError","`",".","Examples","--","--","--","--",">",">",">","s","=","Struct","(","a=10",")",">",">",">","s.a","10",">",">",">","type","(","s.get",")","<","...","'builtin_function_or_method","'",">",">",">",">","try",":","...","s.b","...","except","AttributeError",":","...","print","(","``","I","do","n't","have","that","key","''",")","...","I","do","n't","have","that","key"]
code: def __getattr__(self, key):
      """Get an attr by calling :meth:`dict.__getitem__`.
  
      Like :meth:`__setattr__`, this method converts :exc:`KeyError` to
      :exc:`AttributeError`.
  
      Examples
      --------
      >>> s = Struct(a=10)
      >>> s.a
      10
      >>> type(s.get)
      <... 'builtin_function_or_method'>
      >>> try:
      ...     s.b
      ... except AttributeError:
      ...     print("I don't have that key")
      ...
      I don't have that key
      """
      try:
          result = self[key]
      except KeyError:
          raise AttributeError(key) from None
      else:
          return result
  
file_path: nbformat/nbformat/_struct.py
imports: from __future__ import annotations
  from typing import Any, Dict
label_desc: Use image node_id 4 for calling the Struct obj's underlying member method code with example usage: obj.__getattr__(key) and returns: result