docstr: Parse file
  
  :param filename: filename
  :type filename: basestring
  :param encoding: file encoding
  :type encoding: basestring
  :param required: If true, raises an exception if can't load file
  :type required: boolean
  :param resolve: if true, resolve substitutions
  :type resolve: boolean
  :param unresolved_value: assigned value value to unresolved substitution.
      If overriden with a default value, it will replace all unresolved value to the default value.
      If it is set to to pyhocon.STR_SUBSTITUTION then it will replace the value by its
      substitution expression (e.g., ${x})
  :type unresolved_value: class
  :return: Config object
  :type return: Config
docstr_tok: ["Parse","file",":","param","filename",":","filename",":","type","filename",":","basestring",":","param","encoding",":","file","encoding",":","type","encoding",":","basestring",":","param","required",":","If","true",",","raises","an","exception","if","ca","n't","load","file",":","type","required",":","boolean",":","param","resolve",":","if","true",",","resolve","substitutions",":","type","resolve",":","boolean",":","param","unresolved_value",":","assigned","value","value","to","unresolved","substitution",".","If","overriden","with","a","default","value",",","it","will","replace","all","unresolved","value","to","the","default","value",".","If","it","is","set","to","to","pyhocon.STR_SUBSTITUTION","then","it","will","replace","the","value","by","its","substitution","expression","(","e.g.",",","$","{","x","}",")",":","type","unresolved_value",":","class",":","return",":","Config","object",":","type","return",":","Config"]
code: def parse_file(
      cls,
      filename,
      encoding="utf-8",
      required=True,
      resolve=True,
      unresolved_value=DEFAULT_SUBSTITUTION,
  ):
      """Parse file
  
      :param filename: filename
      :type filename: basestring
      :param encoding: file encoding
      :type encoding: basestring
      :param required: If true, raises an exception if can't load file
      :type required: boolean
      :param resolve: if true, resolve substitutions
      :type resolve: boolean
      :param unresolved_value: assigned value value to unresolved substitution.
          If overriden with a default value, it will replace all unresolved value to the default value.
          If it is set to to pyhocon.STR_SUBSTITUTION then it will replace the value by its
          substitution expression (e.g., ${x})
      :type unresolved_value: class
      :return: Config object
      :type return: Config
      """
      try:
          with codecs.open(filename, "r", encoding=encoding) as fd:
              content = fd.read()
              return cls.parse_string(
                  content,
                  os.path.dirname(filename),
                  resolve,
                  unresolved_value,
              )
      except IOError as e:
          if required:
              raise e
          logger.warn(
              "Cannot include file %s. File does not exist or cannot be read.",
              filename,
          )
          return []
  
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 1 for calling the ConfigFactory obj's underlying member method code with example usage: obj.parse_file(cls, filename, encoding, required, resolve, unresolved_value) and returns: cls, list