You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by hu...@apache.org on 2021/03/31 12:01:30 UTC

[incubator-ponymail-foal] 06/14: PEP8 linting

This is an automated email from the ASF dual-hosted git repository.

humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git

commit 84ee468a59f7715c21b20a18df2badd543601362
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Wed Mar 31 12:20:28 2021 +0200

    PEP8 linting
---
 server/plugins/auditlog.py | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/server/plugins/auditlog.py b/server/plugins/auditlog.py
index 197dd25..0d54ff9 100644
--- a/server/plugins/auditlog.py
+++ b/server/plugins/auditlog.py
@@ -26,7 +26,16 @@ import time
 
 
 class AuditLogEntry:
-    _keys: tuple = ("id", "date", "action", "remote", "author","target", "lid", "log", )
+    _keys: tuple = (
+        "id",
+        "date",
+        "action",
+        "remote",
+        "author",
+        "target",
+        "lid",
+        "log",
+    )
 
     def __init__(self, doc):
         for key in self._keys:
@@ -34,13 +43,12 @@ class AuditLogEntry:
                 setattr(self, key, doc[key])
 
 
-async def view(session: plugins.session.SessionObject, page: int = 0, num_entries: int = 50, raw: bool = False) -> typing.List[dict]:
+async def view(
+    session: plugins.session.SessionObject, page: int = 0, num_entries: int = 50, raw: bool = False
+) -> typing.List[dict]:
     """ Returns N entries from the audit log, paginated """
     res = await session.database.search(
-        index=session.database.dbs.auditlog,
-        size=num_entries,
-        from_=page*num_entries,
-        sort="date:desc",
+        index=session.database.dbs.auditlog, size=num_entries, from_=page * num_entries, sort="date:desc",
     )
     for doc in res["hits"]["hits"]:
         doc["_source"]["id"] = doc["_id"]
@@ -49,6 +57,7 @@ async def view(session: plugins.session.SessionObject, page: int = 0, num_entrie
         else:
             yield AuditLogEntry(doc["_source"])
 
+
 async def add_entry(session: plugins.session.SessionObject, action: str, target: str, lid: str, log: str):
     """ Adds an entry to the audit log"""