class_docstr: A class to wrap access to the global context store
  
  This class hosts static methods to wrap access to and encapsulate the
  singleton content store instance
class_docstr_tok: ["A","class","to","wrap","access","to","the","global","context","store","This","class","hosts","static","methods","to","wrap","access","to","and","encapsulate","the","singleton","content","store","instance"]
docstr: Add given instance of AbstractContext subclass to context store
  
  This private member is only called by ``AbstractContext.__init__()``
  
  if the given ctx is nested, merge parent context, to support
  following usage:
  
  Examples
  --------
  >>> from pmdarima.arima import StepwiseContext, auto_arima
  >>> with StepwiseContext(max_steps=10):
  ...     with StepwiseContext(max_dur=30):
  ...         auto_arima(samp,...)
  
  This is identical to:
  >>> from contextlib import ExitStack
  ... stack = ExitStack()
  ... outer_ctx = StepwiseContext(max_steps=10)
  ... inner_ctx = StepwiseContext(max_dur=30)
  ... stack.enter_context(outer_ctx)
  ... stack.enter_context(inner_ctx)
  ... with stack:
  ...     auto_arima(samp, ...)
  
  
  However, the nested context can override parent context. In the
  example below, the effective context for inner most call to
  ``auto_arima(...)`` is: ``max_steps=15, max_dur=30``. The effective
  context for the second call to ``auto_arima(..)`` is: ``max_steps=10``
  
  >>> with StepwiseContext(max_steps=10):
  ...     with StepwiseContext(max_steps=15, max_dur=30):
  ...         auto_arima(samp,...)
  ...
  ...     auto_arima(samp,...)
docstr_tok: ["Add","given","instance","of","AbstractContext","subclass","to","context","store","This","private","member","is","only","called","by","``","AbstractContext.__init__","(",")","``","if","the","given","ctx","is","nested",",","merge","parent","context",",","to","support","following","usage",":","Examples","--","--","--","--",">",">",">","from","pmdarima.arima","import","StepwiseContext",",","auto_arima",">",">",">","with","StepwiseContext","(","max_steps=10",")",":","...","with","StepwiseContext","(","max_dur=30",")",":","...","auto_arima","(","samp",",","...",")","This","is","identical","to",":",">",">",">","from","contextlib","import","ExitStack","...","stack","=","ExitStack","(",")","...","outer_ctx","=","StepwiseContext","(","max_steps=10",")","...","inner_ctx","=","StepwiseContext","(","max_dur=30",")","...","stack.enter_context","(","outer_ctx",")","...","stack.enter_context","(","inner_ctx",")","...","with","stack",":","...","auto_arima","(","samp",",","...",")","However",",","the","nested","context","can","override","parent","context",".","In","the","example","below",",","the","effective","context","for","inner","most","call","to","``","auto_arima","(","...",")","``","is",":","``","max_steps=15",",","max_dur=30","``",".","The","effective","context","for","the","second","call","to","``","auto_arima","(","..",")","``","is",":","``","max_steps=10","``",">",">",">","with","StepwiseContext","(","max_steps=10",")",":","...","with","StepwiseContext","(","max_steps=15",",","max_dur=30",")",":","...","auto_arima","(","samp",",","...",")","...","...","auto_arima","(","samp",",","...",")"]
code: def _add_context(ctx):
      """Add given instance of AbstractContext subclass to context store
  
      This private member is only called by ``AbstractContext.__init__()``
  
      if the given ctx is nested, merge parent context, to support
      following usage:
  
      Examples
      --------
      >>> from pmdarima.arima import StepwiseContext, auto_arima
      >>> with StepwiseContext(max_steps=10):
      ...     with StepwiseContext(max_dur=30):
      ...         auto_arima(samp,...)
  
      This is identical to:
      >>> from contextlib import ExitStack
      ... stack = ExitStack()
      ... outer_ctx = StepwiseContext(max_steps=10)
      ... inner_ctx = StepwiseContext(max_dur=30)
      ... stack.enter_context(outer_ctx)
      ... stack.enter_context(inner_ctx)
      ... with stack:
      ...     auto_arima(samp, ...)
  
  
      However, the nested context can override parent context. In the
      example below, the effective context for inner most call to
      ``auto_arima(...)`` is: ``max_steps=15, max_dur=30``. The effective
      context for the second call to ``auto_arima(..)`` is: ``max_steps=10``
  
      >>> with StepwiseContext(max_steps=10):
      ...     with StepwiseContext(max_steps=15, max_dur=30):
      ...         auto_arima(samp,...)
      ...
      ...     auto_arima(samp,...)
      """
      if not isinstance(ctx, AbstractContext):
          raise ValueError(
              "ctx must be be an instance of AbstractContext"
          )
  
      # if given Context Type is not present into store, make an entry
      context_type = ctx.get_type()
      if context_type not in _ctx.store:
          _ctx.store[context_type] = collections.deque()
  
      # if the context is nested, merge with parent's context
      if len(_ctx.store[context_type]) > 0:
          parent = _ctx.store[context_type][-1]
          ctx.update(parent)
  
      _ctx.store[context_type].append(ctx)
  
imports: from abc import ABC, abstractmethod
  from enum import Enum
  import collections
label_desc: Use image node_id 4 for calling the ContextStore obj's underlying member method code with example usage: obj._add_context(ctx) without return types