<commit_before>require 'librarian/particularity'
require 'librarian/source/local'

module Librarian
  module Source
    class Path

      include Particularity
      include Local

      class << self
        LOCK_NAME = 'PATH'
        def lock_name
          LOCK_NAME
        end
        def from_lock_options(options)
          new(options[:remote], options.reject{|k, v| k == :remote})
        end
      end

      attr_reader :path

      def initialize(path, options)
        @path = path
      end

      def to_s
        path.to_s
      end

      def ==(other)
        other &&
        self.class  == other.class &&
        self.path   == other.path
      end

      def to_spec_args
        [path.to_s, {}]
      end

      def to_lock_options
        absolute_path = path.absolute? ? path : path.expand_path(root_module.project_path)
        relative_path = path.relative? ? path : path.relative_path_from(root_module.project_path)
        {:remote => relative_path.to_s[0, 3] == '../' ? absolute_path : relative_path}
      end

      def cache!(dependencies)
      end

      def filesystem_path
        @filesystem_path ||= Pathname.new(path).expand_path(root_module.project_path)
      end

    end
  end
end<commit_msg>Path#to_lock_options no longer needs to figure out whether the path is relative or absolute: because we no longer transform the input so we can just return the input.<commit_after>require 'librarian/particularity'
require 'librarian/source/local'

module Librarian
  module Source
    class Path

      include Particularity
      include Local

      class << self
        LOCK_NAME = 'PATH'
        def lock_name
          LOCK_NAME
        end
        def from_lock_options(options)
          new(options[:remote], options.reject{|k, v| k == :remote})
        end
      end

      attr_reader :path

      def initialize(path, options)
        @path = path
      end

      def to_s
        path.to_s
      end

      def ==(other)
        other &&
        self.class  == other.class &&
        self.path   == other.path
      end

      def to_spec_args
        [path.to_s, {}]
      end

      def to_lock_options
        {:remote => path}
      end

      def cache!(dependencies)
      end

      def filesystem_path
        @filesystem_path ||= Pathname.new(path).expand_path(root_module.project_path)
      end

    end
  end
end
{'fraction_non_alphanumeric': 0.08175305520438264, 'fraction_numerical': 0.0008428150021070375, 'mean_word_length': 1.9899244332493702, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '788701', 'n_tokens_mistral': 728, 'n_tokens_neox': 692, 'n_words': 179}