<commit_before>;;; local -*- lexical-binding: t; coding: utf-8; -*-

;;; Code:

(cl-defun vendle:make-package-local (source info)
  (cl-letf ((name (vendle:make-package-name-local source info))
            (load-path (vendle:make-package-load-path-local source info)))
    (vendle:package name
                    :type 'local
                    :name name
                    :path source
                    :load-path load-path
                    :url ""
                    :compile nil
                    :build nil
                    :info nil)))

(cl-defun vendle:make-package-name-local (source info)
  (if info
      (thread-first info
        (cl-getf :name)
        (if name (file-name-nondirectory source)))
    (file-name-nondirectory source)))

(cl-defun vendle:make-package-load-path-local (source info)
  (if info
      (cl-letf ((path (cl-getf info :load-path)))
        (if path
            (expand-file-name path source)
          source))
    source))

(cl-defun vendle:make-package-url-local (source info)
  (if info
      (if-let ((url (cl-getf info :url)))
          url "")
    ""))

(provide 'vendle-source-local)

;;; local.el ends here<commit_msg>* vendle/source/local.el: add info option support to local package<commit_after>;;; local -*- lexical-binding: t; coding: utf-8; -*-

;;; Code:

(cl-defun vendle:make-package-local (source info)
  (cl-letf ((name (vendle:make-package-name-local source info))
            (load-path (vendle:make-package-load-path-local source info)))
    (vendle:package name
                    :type 'local
                    :name name
                    :path source
                    :load-path load-path
                    :url ""
                    :compile nil
                    :build nil
                    :info (cl-getf info :info nil))))

(cl-defun vendle:make-package-name-local (source info)
  (if info
      (thread-first info
        (cl-getf :name)
        (if name (file-name-nondirectory source)))
    (file-name-nondirectory source)))

(cl-defun vendle:make-package-load-path-local (source info)
  (if info
      (cl-letf ((path (cl-getf info :load-path)))
        (if path
            (expand-file-name path source)
          source))
    source))

(cl-defun vendle:make-package-url-local (source info)
  (if info
      (if-let ((url (cl-getf info :url)))
          url "")
    ""))

(provide 'vendle-source-local)

;;; local.el ends here
{'fraction_non_alphanumeric': 0.13703703703703704, 'fraction_numerical': 0.0008230452674897119, 'mean_word_length': 1.8399532710280373, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5488056', 'n_tokens_mistral': 783, 'n_tokens_neox': 760, 'n_words': 186}