<commit_before>require 'digest'

module Pod
  class Lockfile

    # @return [Lockfile] Returns the Lockfile saved in path.
    #   Returns {nil} If the file can't be loaded.
    #
    def self.from_file(path)
      return nil unless path.exist?
      hash = YAML.load(File.open(path))
      lockfile = Lockfile.new(hash)
      lockfile.defined_in_file = path
      lockfile
    end

    # @return [Lockfile] Generates a lockfile from a {Podfile} and the
    #   list of {Specifications} that were installed.
    #
    def self.generate(podfile, specs)
      Lockfile.new(generate_hash_from_podfile(podfile, specs))
    end

    # @return [String] The file where this Lockfile is defined.<commit_msg>Adding error handling for incorrect Podfile.lock syntax<commit_after>require 'digest'

module Pod
  class Lockfile

    # @return [Lockfile] Returns the Lockfile saved in path.
    #   Returns {nil} If the file can't be loaded.
    #
    def self.from_file(path)
      return nil unless path.exist?
      begin
        hash = YAML.load(File.open(path))
      rescue Exception => e
        raise Informative, "Podfile.lock syntax error:  #{e.inspect}"
      end
      lockfile = Lockfile.new(hash)
      lockfile.defined_in_file = path
      lockfile
    end

    # @return [Lockfile] Generates a lockfile from a {Podfile} and the
    #   list of {Specifications} that were installed.
    #
    def self.generate(podfile, specs)
      Lockfile.new(generate_hash_from_podfile(podfile, specs))
    end

    # @return [String] The file where this Lockfile is defined.
{'fraction_non_alphanumeric': 0.08450704225352113, 'fraction_numerical': 0.0, 'mean_word_length': 2.8402948402948405, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6580334', 'n_tokens_mistral': 490, 'n_tokens_neox': 474, 'n_words': 150}