<commit_before>(library (errata rss)
  (export emit
          start
          query)
  (import (only (core) format lookup-process-environment system)
          (rnrs)
          (only (rnrs eval) eval environment)
          (only (srfi :27) random-integer)
          (match)
          (ypsilon socket)
          (only (ypsilon ffi) on-freebsd)
          (only (lunula tree) put-tree)
          (only (lunula xml) declaration)
          (lunula rss))

  (define *base-url* "http://errata.fixedpoint.jp")

  (define *extension* "rss")

  (define *temporary-directory* (lookup-process-environment "ERRATA_RSS_TEMPORARY_DIRECTORY"))

  (define *output-directory* (lookup-process-environment "ERRATA_RSS_OUTPUT_DIRECTORY"))

  (define (make-rss category set entry-proc item-proc)
    (list
     (declaration 1.0 "UTF-8")
     (rdf:RDF
      (channel
       ((rdf:about (format "~a/~a.~a" *base-url* category *extension*)))
       (title category)
       (link (string-append *base-url* "/"))
       (description (format "Errata: ~a" category))
       (items
        (rdf:Seq
         (map entry-proc set))))
      (map item-proc set))))

  (define (rss-tree user password database category)
    (let ((env (environment `(errata rss ,(string->symbol category)))))
      (make-rss
       category
       (eval (list 'feed-set user password database) env)
       (eval 'feed-entry env)
       (eval 'feed-item env))))

  (define (emit user password database category)
    (case (string->symbol category)
      (else
       (let ((tmp (format "~a/~a.~a.~d" *temporary-directory* category *extension* (random-integer 100)))
             (dst (format "~a/~a.~a" *output-directory* category *extension*)))
         (call-with-output-file tmp
           (lambda (port)
             (put-tree
              port
              (rss-tree user password database category))))
         (system (format "/usr/bin/install -m 644 ~a ~a" tmp dst))
         (delete-file tmp)))))<commit_msg>removed unused codes<commit_after>(library (errata rss)
  (export emit
          start
          query)
  (import (only (core) format lookup-process-environment system)
          (rnrs)
          (only (rnrs eval) eval environment)
          (only (srfi :27) random-integer)
          (match)
          (ypsilon socket)
          (only (ypsilon ffi) on-freebsd)
          (only (lunula tree) put-tree)
          (only (lunula xml) declaration)
          (lunula rss))

  (define *base-url* "http://errata.fixedpoint.jp")

  (define *extension* "rss")

  (define *temporary-directory* (lookup-process-environment "ERRATA_RSS_TEMPORARY_DIRECTORY"))

  (define *output-directory* (lookup-process-environment "ERRATA_RSS_OUTPUT_DIRECTORY"))

  (define (make-rss category set entry-proc item-proc)
    (list
     (declaration 1.0 "UTF-8")
     (rdf:RDF
      (channel
       ((rdf:about (format "~a/~a.~a" *base-url* category *extension*)))
       (title category)
       (link (string-append *base-url* "/"))
       (description (format "Errata: ~a" category))
       (items
        (rdf:Seq
         (map entry-proc set))))
      (map item-proc set))))

  (define (rss-tree user password database category)
    (let ((env (environment `(errata rss ,(string->symbol category)))))
      (make-rss
       category
       (eval (list 'feed-set user password database) env)
       (eval 'feed-entry env)
       (eval 'feed-item env))))

  (define (emit user password database category)
    (let ((tmp (format "~a/~a.~a.~d" *temporary-directory* category *extension* (random-integer 100)))
          (dst (format "~a/~a.~a" *output-directory* category *extension*)))
      (call-with-output-file tmp
        (lambda (port)
          (put-tree
           port
           (rss-tree user password database category))))
      (system (format "/usr/bin/install -m 644 ~a ~a" tmp dst))
      (delete-file tmp)))
{'fraction_non_alphanumeric': 0.14293112377006734, 'fraction_numerical': 0.005696530295183843, 'mean_word_length': 2.45218945487042, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '1840431', 'n_tokens_mistral': 1220, 'n_tokens_neox': 1184, 'n_words': 327}