[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/triples 257de87fdc 08/19: Minor code cleanup.
From: |
ELPA Syncer |
Subject: |
[elpa] externals/triples 257de87fdc 08/19: Minor code cleanup. |
Date: |
Sat, 5 Nov 2022 11:58:16 -0400 (EDT) |
branch: externals/triples
commit 257de87fdc0221baf3f945d958b01e4c07c7d33b
Author: Andrew Hyatt <ahyatt@gmail.com>
Commit: Andrew Hyatt <ahyatt@gmail.com>
Minor code cleanup.
Ran checkdoc and added lexical binding.
---
triples-test.el | 2 +-
triples.el | 20 +++++++++++---------
2 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/triples-test.el b/triples-test.el
index 85a747966e..4a38d42ed0 100644
--- a/triples-test.el
+++ b/triples-test.el
@@ -1,4 +1,4 @@
-;;; triples-test.el --- Tests for triples module.
+;;; triples-test.el --- Tests for triples module. -*- lexical-binding: t; -*-
(require 'triples)
(require 'seq)
(require 'kv)
diff --git a/triples.el b/triples.el
index 95cbbe0f2d..f1573a143e 100644
--- a/triples.el
+++ b/triples.el
@@ -1,5 +1,4 @@
-;;; triples.el --- This package provides a triple-based database, as well as
-;;; functions to store, retrieve, and modify the information it contains.
+;;; triples.el --- A flexible triple-based database for us in apps. -*-
lexical-binding: t; -*-
;; Copyright (c) 2022 Free Software Foundation, Inc.
@@ -30,8 +29,10 @@
(require 'emacsql)
(require 'seq)
+;;; Code:
+
(defun triples-connect (file)
- "Connect to the database and make sure it is populated."
+ "Connect to the database FILE and make sure it is populated."
(let* ((db (emacsql-sqlite3 file))
(triple-table-exists
(emacsql db [:select name
@@ -106,7 +107,7 @@ values."
(cdr op)))
(defun triples-properties-for-predicate (db cpred)
- "Return the properties for combined predicate CPRED as a plist."
+ "Return the properties in DB for combined predicate CPRED as a plist."
(mapcan (lambda (row)
(list (intern (format ":%s" (nth 1 row))) (nth 2 row)))
(emacsql db [:select * :from triples :where (= subject $s1)] cpred)))
@@ -121,11 +122,11 @@ values."
"Error if TRIPLES is not compliant with schema in DB."
(mapc (lambda (triple)
(pcase-let ((`(,type . ,prop) (triples-combined-to-type-and-prop
(nth 1 triple))))
- (unless (or (eq type 'base)
+ (unless (or (eq type 'base)
(emacsql db [:select * :from triples :where (= subject
$s1)
:and (= predicate 'schema/property) :and
(= object $s2)]
type prop))
- (error "Property %s not found in schema." (nth 1 triple)))))
+ (error "Property %s not found in schema" (nth 1 triple)))))
triples)
(mapc (lambda (triple)
(triples--plist-mapc (lambda (pred-prop val)
@@ -209,7 +210,7 @@ PROPERTIES is a plist of properties, without TYPE prefixes."
(puthash (nth 1 db-triple)
(cons (cons (nth 2 db-triple) (nth 3 db-triple))
(gethash (nth 1 db-triple) preds))
- preds))
+ preds))
(emacsql db [:select * :from triples :where (= subject $s1)
:and (like predicate $r2)] subject (format "%s/%%"
type)))
(append
@@ -265,7 +266,7 @@ TYPE-VALS-CONS is a list of conses, combining a type and a
plist of values."
type-vals-cons)))
(defun triples-delete-subject (db subject)
- "Delete all data with DB as the subject."
+ "Delete all data in DB associated with SUBJECT."
(emacsql-with-transaction db
(emacsql db [:delete :from triples :where (= subject $s1)] subject)))
@@ -295,6 +296,7 @@ This is something of form `:type/prop'."
(cons (triples--decolon (nth 0 s)) (intern (nth 1 s)))))
(defun triples-type-and-prop-to-combined (type prop)
+ "Format TYPE and PROP to a combined format - type/prop."
(intern (format "%s/%s" (triples--decolon type) (triples--decolon prop))))
(defun triples--plist-mapc (fn plist)
@@ -343,7 +345,7 @@ FN must take two arguments: the key and the value."
(defun triples-verify-base/virtual-reversed-compliant (_ triple)
"Virtual reversed properties shouldn't be set manually, so are never
compliant."
- (error "Invalid triple found: %s, should not be setting a
`base/virtual-reversed' property."
+ (error "Invalid triple found: %s, should not be setting a
`base/virtual-reversed' property"
triple))
(provide 'triples)
- [elpa] branch externals/triples created (now d17b3d6e17), ELPA Syncer, 2022/11/05
- [elpa] externals/triples 7d5aca3bb8 02/19: Fix issue where single element lists were not being treated as lists., ELPA Syncer, 2022/11/05
- [elpa] externals/triples 6f8f3376f1 06/19: Add `triples-set-types'., ELPA Syncer, 2022/11/05
- [elpa] externals/triples 5e8abd2989 01/19: Initial commit of triples module., ELPA Syncer, 2022/11/05
- [elpa] externals/triples cc5629fe5c 07/19: Wrap all database access in `triples-set-types' in a transaction., ELPA Syncer, 2022/11/05
- [elpa] externals/triples 257de87fdc 08/19: Minor code cleanup.,
ELPA Syncer <=
- [elpa] externals/triples 4627d6ed6d 10/19: Fix minor mistakes in ert tests., ELPA Syncer, 2022/11/05
- [elpa] externals/triples fb63dfe44a 12/19: Convert to sqlite., ELPA Syncer, 2022/11/05
- [elpa] externals/triples 0252dad7d1 17/19: Fixes from code review from Stefan Monnier., ELPA Syncer, 2022/11/05
- [elpa] externals/triples d17b3d6e17 19/19: Merge branch 'combined'., ELPA Syncer, 2022/11/05
- [elpa] externals/triples 2dae3d49b9 18/19: Various fixes for emacsql code, which wasn't being tested correctly., ELPA Syncer, 2022/11/05
- [elpa] externals/triples 6afcb290ca 15/19: Support both emacs 29 sqlite and emacsql., ELPA Syncer, 2022/11/05
- [elpa] externals/triples aca95ba7f3 03/19: Ensure that we don't duplicate triples., ELPA Syncer, 2022/11/05
- [elpa] externals/triples d82cc1d6b8 14/19: Finish basic sqlite layer, and fix everything so tests work., ELPA Syncer, 2022/11/05
- [elpa] externals/triples 8d7d3c13f4 05/19: Make the combined to and from functions public., ELPA Syncer, 2022/11/05
- [elpa] externals/triples ad6e329540 04/19: Fix for ert tests broken by the last commit., ELPA Syncer, 2022/11/05