From e246568819d56cee29f6690673e7bf1a6891b5ef Mon Sep 17 00:00:00 2001 From: Christian Boltz Date: Mon, 12 Aug 2019 23:27:41 +0200 Subject: [PATCH] fix whitespace and indentation in several files --- utils/aa-notify | 2 +- utils/aa-status | 4 ++-- utils/apparmor/easyprof.py | 6 +++--- utils/apparmor/rule/__init__.py | 4 ++-- utils/apparmor/rule/dbus.py | 4 ++-- utils/apparmor/rule/file.py | 4 ++-- utils/apparmor/sandbox.py | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/utils/aa-notify b/utils/aa-notify index 700935206..a184b0a6b 100755 --- a/utils/aa-notify +++ b/utils/aa-notify @@ -398,7 +398,7 @@ def main(): # If a TTY then assume running in test mode and fix output width if not sys.stdout.isatty(): - parser.formatter_class=lambda prog: argparse.HelpFormatter(prog, width=80) + parser.formatter_class = lambda prog: argparse.HelpFormatter(prog, width=80) args = parser.parse_args() diff --git a/utils/aa-status b/utils/aa-status index b971c398a..4d1854778 100755 --- a/utils/aa-status +++ b/utils/aa-status @@ -64,7 +64,7 @@ def cmd_verbose(): filtered_profiles = filter_profiles(profiles, status) stdmsg("%d profiles are in %s mode." % (len(filtered_profiles), status)) for item in filtered_profiles: - stdmsg(" %s" % item) + stdmsg(" %s" % item) stdmsg("%d processes have profiles defined." % len(processes)) for status in ('enforce', 'complain', 'unconfined'): @@ -197,7 +197,7 @@ def filter_processes(processes, status): def find_apparmorfs(): '''Finds AppArmor mount point''' - for p in open("/proc/mounts","rb").readlines(): + for p in open("/proc/mounts", "rb").readlines(): if p.split()[2].decode() == "securityfs" and \ os.path.exists(os.path.join(p.split()[1].decode(), "apparmor")): return os.path.join(p.split()[1].decode(), "apparmor") diff --git a/utils/apparmor/easyprof.py b/utils/apparmor/easyprof.py index c6e693270..fca91f809 100644 --- a/utils/apparmor/easyprof.py +++ b/utils/apparmor/easyprof.py @@ -822,8 +822,8 @@ def check_for_manifest_arg(option, opt_str, value, parser): def check_for_manifest_arg_append(option, opt_str, value, parser): '''Check for -m/--manifest with conflicting args (with append)''' if parser.values.manifest: - raise optparse.OptionValueError("can't use --%s with --manifest " \ - "argument" % opt_str.lstrip('-')) + raise optparse.OptionValueError("can't use --%s with --manifest " \ + "argument" % opt_str.lstrip('-')) parser.values.ensure_value(option.dest, []).append(value) def add_parser_policy_args(parser): @@ -1216,7 +1216,7 @@ def verify_manifest(params, args=None): tv_val = tv.split('=')[1] debug("Examining %s" % tv_val) if '..' in tv_val or pat.search(tv_val): - err_str += "\n%s" % tv + err_str += "\n%s" % tv if err_str: warn("Manifest definition is potentially unsafe%s" % err_str) diff --git a/utils/apparmor/rule/__init__.py b/utils/apparmor/rule/__init__.py index 060a6b780..08eb3108e 100644 --- a/utils/apparmor/rule/__init__.py +++ b/utils/apparmor/rule/__init__.py @@ -140,7 +140,7 @@ class BaseRule(object): '''check if other_rule is covered by this rule object''' if not type(other_rule) == type(self): - raise AppArmorBug('Passes %s instead of %s' % (str(other_rule),self.__class__.__name__)) + raise AppArmorBug('Passes %s instead of %s' % (str(other_rule), self.__class__.__name__)) if check_allow_deny and self.deny != other_rule.deny: return False @@ -197,7 +197,7 @@ class BaseRule(object): Note: this function checks against other_value.regex, which is not really correct, but avoids overly strict results when matching one regex against another ''' if type(other_value) == AARE: - other_value = other_value.regex + other_value = other_value.regex return self._is_covered_aare(self_value, self_all, other_value, other_all, cond_name) diff --git a/utils/apparmor/rule/dbus.py b/utils/apparmor/rule/dbus.py index 4ac4c1e90..2510bba20 100644 --- a/utils/apparmor/rule/dbus.py +++ b/utils/apparmor/rule/dbus.py @@ -98,9 +98,9 @@ class DbusRule(BaseRule): # not all combinations are allowed if self.access and 'bind' in self.access and (self.path or self.interface or self.member or self.peername or self.peerlabel): - raise AppArmorException(_('dbus bind rules must not contain a path, interface, member or peer conditional')) + raise AppArmorException(_('dbus bind rules must not contain a path, interface, member or peer conditional')) elif self.access and 'eavesdrop' in self.access and (self.name or self.path or self.interface or self.member or self.peername or self.peerlabel): - raise AppArmorException(_('dbus eavesdrop rules must not contain a name, path, interface, member or peer conditional')) + raise AppArmorException(_('dbus eavesdrop rules must not contain a name, path, interface, member or peer conditional')) elif self.access and self.name: for msg in message_keywords: if msg in self.access: diff --git a/utils/apparmor/rule/file.py b/utils/apparmor/rule/file.py index 755973049..3867bd08e 100644 --- a/utils/apparmor/rule/file.py +++ b/utils/apparmor/rule/file.py @@ -401,7 +401,7 @@ class FileRule(BaseRule): def glob(self): '''Change path to next possible glob''' if self.all_paths: - return + return self.path = self.path.glob_path() self.raw_rule = None @@ -409,7 +409,7 @@ class FileRule(BaseRule): def glob_ext(self): '''Change path to next possible glob with extension''' if self.all_paths: - return + return self.path = self.path.glob_path_withext() self.raw_rule = None diff --git a/utils/apparmor/sandbox.py b/utils/apparmor/sandbox.py index 17e413ea8..76acebb71 100644 --- a/utils/apparmor/sandbox.py +++ b/utils/apparmor/sandbox.py @@ -81,8 +81,8 @@ def parse_args(args=None, parser=None): valid_xservers = ['xpra', 'xpra3d', 'xephyr'] if my_opt.withx and my_opt.xserver.lower() not in valid_xservers: - error("Invalid server '%s'. Use one of: %s" % (my_opt.xserver, \ - ", ".join(valid_xservers))) + error("Invalid server '%s'. Use one of: %s" % (my_opt.xserver, \ + ", ".join(valid_xservers))) if my_opt.withx: if my_opt.xephyr_geometry and my_opt.xserver.lower() != "xephyr":