From 031593d4701d43317c952484e8539ff784d2485d Mon Sep 17 00:00:00 2001 From: Georg Pfuetzenreuter Date: Mon, 16 Sep 2024 03:47:31 +0200 Subject: [PATCH] Formatting For a better code style: - consistent trailing commas - use constant instead of repeated "magic" values Signed-off-by: Georg Pfuetzenreuter --- pyacl/acl.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pyacl/acl.py b/pyacl/acl.py index 1bde7a1..8e6dbc5 100644 --- a/pyacl/acl.py +++ b/pyacl/acl.py @@ -1,4 +1,3 @@ -#!/usr/bin/python3 """ pyacl - high level abstractions over pylibacl Copyright 2024, Georg Pfuetzenreuter @@ -33,16 +32,18 @@ DEFAULT_ENTRYTYPES = [ 'user', 'group', 'mask', - 'other' + 'other', ] +MAX_PERMBITS = 3 + def acl_reduce_entries(acl): entries = acl.to_any_text().decode().split() entries = [entry for entry in entries if entry not in DEFAULT_ENTRIES] return entries def acl_parse_permission(strpermission): - if len(strpermission) != 3: + if len(strpermission) != MAX_PERMBITS: return ValueError('Invalid permission') permap = { @@ -78,13 +79,13 @@ def acl_parse_entry(strentry): elif not entryvalue: return ValueError('Invalid entry value') - if len(permissions) != 3: + if len(permissions) != MAX_PERMBITS: raise ValueError('Unsupported amount of permissions') return { entrytype: { - entryvalue: acl_parse_permission(permissions) - } + entryvalue: acl_parse_permission(permissions), + }, } def acl_parse_entries(acl):