class_docstr: Parse HOCON files: https://github.com/typesafehub/config/blob/master/HOCON.md
class_docstr_tok: ["Parse","HOCON","files",":","https",":","\/\/github.com\/typesafehub\/config\/blob\/master\/HOCON.md"]
code: def resolve_substitutions(cls, config, accept_unresolved=False):
      has_unresolved = False
      cls._fixup_self_references(config, accept_unresolved)
      substitutions = cls._find_substitutions(config)
      if len(substitutions) > 0:
          unresolved = True
          any_unresolved = True
          _substitutions = []
          cache = {}
          while (
              any_unresolved
              and len(substitutions) > 0
              and set(substitutions) != set(_substitutions)
          ):
              unresolved = False
              any_unresolved = True
              _substitutions = substitutions[:]
  
              for substitution in _substitutions:
                  (
                      is_optional_resolved,
                      resolved_value,
                  ) = cls._resolve_variable(config, substitution)
  
                  # if the substitution is optional
                  if not is_optional_resolved and substitution.optional:
                      resolved_value = None
                  if isinstance(resolved_value, ConfigValues):
                      parents = cache.get(resolved_value)
                      if parents is None:
                          parents = []
                          link = resolved_value
                          while isinstance(link, ConfigValues):
                              parents.append(link)
                              link = link.overriden_value
                          cache[resolved_value] = parents
  
                  if (
                      isinstance(resolved_value, ConfigValues)
                      and substitution.parent in parents
                      and hasattr(
                          substitution.parent, "overriden_value"
                      )
                      and substitution.parent.overriden_value
                  ):
                      # self resolution, backtrack
                      resolved_value = (
                          substitution.parent.overriden_value
                      )
  
                  (
                      unresolved,
                      new_substitutions,
                      result,
                  ) = cls._do_substitute(
                      substitution, resolved_value, is_optional_resolved
                  )
                  any_unresolved = unresolved or any_unresolved
                  substitutions.extend(new_substitutions)
                  if not isinstance(result, ConfigValues):
                      substitutions.remove(substitution)
  
          cls._final_fixup(config)
          if unresolved:
              has_unresolved = True
              if not accept_unresolved:
                  raise ConfigSubstitutionException(
                      "Cannot resolve {variables}. Check for cycles.".format(
                          variables=", ".join(
                              "${{{variable}}}: (line: {line}, col: {col})".format(
                                  variable=substitution.variable,
                                  line=lineno(
                                      substitution.loc,
                                      substitution.instring,
                                  ),
                                  col=col(
                                      substitution.loc,
                                      substitution.instring,
                                  ),
                              )
                              for substitution in substitutions
                          )
                      )
                  )
  
      cls._final_fixup(config)
      return has_unresolved
  
imports: import itertools
  import re
  import os
  import socket
  import contextlib
  import codecs
  from datetime import timedelta
  from pyparsing import Forward, Keyword, QuotedString, Word, Literal, Suppress, Regex, Optional, SkipTo, ZeroOrMore, Group, lineno, col, TokenConverter, replaceWith, alphanums, alphas8bit, ParseSyntaxException, StringEnd
  from pyparsing import ParserElement
  from .config_tree import ConfigTree, ConfigSubstitution, ConfigList, ConfigValues, ConfigUnquotedString, ConfigInclude, NoneValue, ConfigQuotedString
  from .exceptions import ConfigSubstitutionException, ConfigMissingException, ConfigException
  import logging
  import copy
label_desc: Use image node_id 9 for calling the ConfigParser obj's underlying member method code with example usage: obj.resolve_substitutions(cls, config, accept_unresolved) and returns: has_unresolved