diff options
-rw-r--r-- | .vale.ini | 9 | ||||
-rwxr-xr-x | export-keyring.py | 16 | ||||
-rwxr-xr-x | graph-paths.py | 16 | ||||
-rwxr-xr-x | graph-to-full.py | 16 | ||||
-rwxr-xr-x | make-sqlitedb.py | 25 | ||||
-rw-r--r-- | wotmate/__init__.py | 28 |
6 files changed, 30 insertions, 80 deletions
diff --git a/.vale.ini b/.vale.ini new file mode 100644 index 0000000..5ebf6be --- /dev/null +++ b/.vale.ini @@ -0,0 +1,9 @@ +StylesPath = /home/user/.local/share/vale/styles +Vocab = projects + +MinAlertLevel = suggestion + +Packages = Google, proselint, Readability + +[*] +BasedOnStyles = Vale, Google, proselint, Readability
\ No newline at end of file diff --git a/export-keyring.py b/export-keyring.py index a617960..abd15b3 100755 --- a/export-keyring.py +++ b/export-keyring.py @@ -1,19 +1,7 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- -# Copyright (C) 2015 by The Linux Foundation and contributors -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# SPDX-License-Identifier: GPL-3.0-or-later +# Copyright © 2018-2024 by The Linux Foundation and contributors __author__ = 'Konstantin Ryabitsev <konstantin@linuxfoundation.org>' import sys diff --git a/graph-paths.py b/graph-paths.py index da2c47b..76b5e34 100755 --- a/graph-paths.py +++ b/graph-paths.py @@ -1,19 +1,7 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- -# Copyright (C) 2015 by The Linux Foundation and contributors -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# SPDX-License-Identifier: GPL-3.0-or-later +# Copyright © 2018-2024 by The Linux Foundation and contributors __author__ = 'Konstantin Ryabitsev <konstantin@linuxfoundation.org>' import sys diff --git a/graph-to-full.py b/graph-to-full.py index a05d0f3..eedc3bf 100755 --- a/graph-to-full.py +++ b/graph-to-full.py @@ -1,19 +1,7 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- -# Copyright (C) 2015 by The Linux Foundation and contributors -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# SPDX-License-Identifier: GPL-3.0-or-later +# Copyright © 2018-2024 by The Linux Foundation and contributors __author__ = 'Konstantin Ryabitsev <konstantin@linuxfoundation.org>' import sys diff --git a/make-sqlitedb.py b/make-sqlitedb.py index d5fb387..6a4999b 100755 --- a/make-sqlitedb.py +++ b/make-sqlitedb.py @@ -1,19 +1,8 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- -# Copyright (C) 2015 by The Linux Foundation and contributors -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# SPDX-License-Identifier: GPL-3.0-or-later +# Copyright © 2018-2024 by The Linux Foundation and contributors +__author__ = 'Konstantin Ryabitsev <konstantin@linuxfoundation.org>' import os import sqlite3 @@ -90,7 +79,7 @@ def keyring_load_pub_uid(c, use_weak): def keyring_load_sig_data(c, pub_keyid_rowid_map, uid_hash_rowid_map): logger.info('Loading signature data') sigquery = 'INSERT INTO sig VALUES (?,?,?,?,?)' - # we use these to track which is the current pubkey/uid we're looking at + # used to track the current pubkey/uid pubkeyid = None uidrowid = None uidsigs = {} @@ -127,15 +116,15 @@ def keyring_load_sig_data(c, pub_keyid_rowid_map, uid_hash_rowid_map): try: uidrowid = uid_hash_rowid_map[(pubkeyid, fields[7])] except IndexError: - # unknown uid somehow... ignore it + # unknown uid somehow, ignore it continue elif fields[0] in ('sig', 'rev'): if not pubkeyid or is_revuid: ignored_sigs += 1 continue - # some gpg versions, when using --fast-list-mode, will not show UID - # entries, so for those cases we use the primary UID of the pubkey + # some gpg versions, when using --fast-list-mode, don't show UID + # entries, so for those cases use the primary UID of the pubkey if uidrowid is None: uidrowid = pub_keyid_rowid_map[pubkeyid][1] diff --git a/wotmate/__init__.py b/wotmate/__init__.py index 908fb95..b947a41 100644 --- a/wotmate/__init__.py +++ b/wotmate/__init__.py @@ -1,19 +1,7 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- -# Copyright (C) 2018 by The Linux Foundation and contributors -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# SPDX-License-Identifier: GPL-3.0-or-later +# Copyright © 2018-2024 by The Linux Foundation and contributors __author__ = 'Konstantin Ryabitsev <konstantin@linuxfoundation.org>' import sys @@ -40,7 +28,7 @@ GNUPGHOME = None logger = logging.getLogger(__name__) -# convenience caching so we avoid redundant lookups +# convenience caching to avoid redundant look-ups _all_signed_by_cache = dict() _all_sigs_cache = dict() _all_uiddata_cache = dict() @@ -110,13 +98,13 @@ def gpg_get_lines(args, matchonly=()): def gpg_get_fields(bline): line = bline.decode('utf8', 'ignore') - # gpg uses \x3a to indicate an encoded colon, so we explode and de-encode + # gpg uses \x3a to indicate an encoded colon, so explode and de-encode fields = [rawchunk.replace('\\x3a', ':') for rawchunk in line.split(':')] - # fields 5 and 6 are timestamps, so make them python datetime + # fields 5 and 6 are timestamps, so convert them to isoformat for sqlite3 needs if len(fields[5]): - fields[5] = datetime.fromtimestamp(int(fields[5])) + fields[5] = datetime.fromtimestamp(int(fields[5])).isoformat() if len(fields[6]): - fields[6] = datetime.fromtimestamp(int(fields[6])) + fields[6] = datetime.fromtimestamp(int(fields[6])).isoformat() return fields @@ -283,7 +271,7 @@ def get_shortest_path(c, t_p_rowid, b_p_rowid, depth, maxdepth, ignorekeys): # no need to go any deeper than current shortest maxdepth = depth - 1 + len(shortest) else: - # if we returned with None, then this key is a dead-end at this and lower depths + # if it returns with None, then this key is a dead-end at this and lower depths for _d in range(depth, maxdepth): _seenkeys.add((_d, s_p_rowid)) |