emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/pyim d42cc01d44 13/35: pyim-dhashcache-calculate-priori


From: ELPA Syncer
Subject: [elpa] externals/pyim d42cc01d44 13/35: pyim-dhashcache-calculate-priority -> pyim-dhashcache--calculate-priority
Date: Fri, 24 Jun 2022 08:58:06 -0400 (EDT)

branch: externals/pyim
commit d42cc01d447e4bfa1dd6b66e9100d0103c193b60
Author: Feng Shu <tumashu@163.com>
Commit: Feng Shu <tumashu@163.com>

    pyim-dhashcache-calculate-priority -> pyim-dhashcache--calculate-priority
---
 pyim-dhashcache.el  | 60 ++++++++++++++++++++++++++---------------------------
 tests/pyim-tests.el |  4 ++--
 2 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/pyim-dhashcache.el b/pyim-dhashcache.el
index 35c3317bda..2da39c0858 100644
--- a/pyim-dhashcache.el
+++ b/pyim-dhashcache.el
@@ -253,7 +253,7 @@
         (maphash
          (lambda (key value)
            (puthash key
-                    (pyim-dhashcache-calculate-priority
+                    (pyim-dhashcache--calculate-priority
                      (pyim-dhashcache--get-ishortcodes-counts-from-log
                       value))
                     pyim-dhashcache-iword2priority))
@@ -271,7 +271,7 @@
         (async-inject-variables "^exec-path$")
         (async-inject-variables "^pyim-.+?directory$")))
 
-(defun pyim-dhashcache-calculate-priority (counts-info)
+(defun pyim-dhashcache--calculate-priority (counts-info)
   "根据 COUNTS-INFO 计算优先级(优先级是多个数字组成的一个列表),
 用于对词条进行排序。COUNTS-INFO 是一个 alist, 其结构类似:
 
@@ -566,38 +566,38 @@ pyim 使用的词库文件是简单的文本文件,编码 *强制* 为 \\='utf
          word 50 pyim-dhashcache-iword2count-recent-50-words))
   ;; 更新总 count 表
   (pyim-dhashcache--put
-   pyim-dhashcache-iword2count word
-   (cond
-    ((functionp wordcount-handler)
-     (funcall wordcount-handler (or orig-value 0)))
-    ((numberp wordcount-handler)
-     wordcount-handler)
-    (t (or orig-value 0))))
+    pyim-dhashcache-iword2count word
+    (cond
+     ((functionp wordcount-handler)
+      (funcall wordcount-handler (or orig-value 0)))
+     ((numberp wordcount-handler)
+      wordcount-handler)
+     (t (or orig-value 0))))
   ;; 更新 count 日志表。
   (pyim-dhashcache--put
-   pyim-dhashcache-iword2count-log word
-   (let (out)
-     (dolist (x pyim-dhashcache-count-types)
-       (let* ((label (car x))
-              (key (intern (format-time-string (plist-get (cdr x) :format))))
-              (n (plist-get (cdr x) :max-save-length))
-              (plist (cdr (assoc label orig-value)))
-              (value (plist-get plist key))
-              (output (if value
-                          (plist-put plist key (+ 1 value))
-                        (append (list key 1) plist)))
-              (length (length output))
-              (output (cl-subseq output 0 (min length (* 2 n)))))
-         (push `(,label ,@output) out)))
-     out))
+    pyim-dhashcache-iword2count-log word
+    (let (out)
+      (dolist (x pyim-dhashcache-count-types)
+        (let* ((label (car x))
+               (key (intern (format-time-string (plist-get (cdr x) :format))))
+               (n (plist-get (cdr x) :max-save-length))
+               (plist (cdr (assoc label orig-value)))
+               (value (plist-get plist key))
+               (output (if value
+                           (plist-put plist key (+ 1 value))
+                         (append (list key 1) plist)))
+               (length (length output))
+               (output (cl-subseq output 0 (min length (* 2 n)))))
+          (push `(,label ,@output) out)))
+      out))
   ;; 更新优先级表
   (pyim-dhashcache--put
-   pyim-dhashcache-iword2priority word
-   ;; Fix warn
-   (ignore orig-value)
-   (pyim-dhashcache-calculate-priority
-    (pyim-dhashcache--get-ishortcodes-counts-from-log
-     (gethash word pyim-dhashcache-iword2count-log)))))
+    pyim-dhashcache-iword2priority word
+    ;; Fix warn
+    (ignore orig-value)
+    (pyim-dhashcache--calculate-priority
+     (pyim-dhashcache--get-ishortcodes-counts-from-log
+      (gethash word pyim-dhashcache-iword2count-log)))))
 
 (defun pyim-dhashcache--update-iword2count-recent (word n hash-table)
   (let (words-need-remove)
diff --git a/tests/pyim-tests.el b/tests/pyim-tests.el
index 06f426ea64..dd16c26fdf 100644
--- a/tests/pyim-tests.el
+++ b/tests/pyim-tests.el
@@ -1426,8 +1426,8 @@ yin-xing 因行
                   '(((day 6 0 3 3 0 0 0)) ;Fixme: In github-ci will result 
this value, why?
                     ((day 10 6 0 3 3 0 0))))))
 
-(ert-deftest pyim-tests-pyim-dhashcache-calculate-priority ()
-  (should (equal (pyim-dhashcache-calculate-priority
+(ert-deftest pyim-tests-pyim-dhashcache--calculate-priority ()
+  (should (equal (pyim-dhashcache--calculate-priority
                   '((day 3 7 6 4 5 9 1)))
                  '(69))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]