From: Kamalesh Babulal Date: Thu, 17 Feb 2022 11:19:34 +0000 (+0530) Subject: utils.py: make it PEP8 compliant X-Git-Tag: v3.1.0~308^2~2^2~52 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=01acd45c9f847d4c6833ba03bbf3c466a6d2fe43;p=thirdparty%2Flibcgroup.git utils.py: make it PEP8 compliant Make utils.py PEP-8 compliant. Signed-off-by: Kamalesh Babulal Signed-off-by: Tom Hromatka --- diff --git a/ftests/utils.py b/ftests/utils.py index d237d858..396f72d6 100644 --- a/ftests/utils.py +++ b/ftests/utils.py @@ -19,20 +19,21 @@ # along with this library; if not, see . # -import grp -import os from run import Run +import os + # function to indent a block of text by cnt number of spaces def indent(in_str, cnt): leading_indent = cnt * ' ' return ''.join(leading_indent + line for line in in_str.splitlines(True)) + def get_file_owner_uid(config, filename): cmd = list() cmd.append('stat') cmd.append('-c') - cmd.append('\'%u\'') + cmd.append("'%u'") cmd.append(filename) if config.args.container: @@ -40,11 +41,12 @@ def get_file_owner_uid(config, filename): else: return Run.run(cmd, shell_bool=True) + def get_file_owner_username(config, filename): cmd = list() cmd.append('stat') cmd.append('-c') - cmd.append('\'%U\'') + cmd.append("'%U'") cmd.append(filename) if config.args.container: @@ -53,11 +55,12 @@ def get_file_owner_username(config, filename): return Run.run(cmd, shell_bool=True) return os.stat(filename).st_uid + def get_file_owner_gid(config, filename): cmd = list() cmd.append('stat') cmd.append('-c') - cmd.append('\'%g\'') + cmd.append("'%g'") cmd.append(filename) if config.args.container: @@ -65,11 +68,12 @@ def get_file_owner_gid(config, filename): else: return Run.run(cmd, shell_bool=True) + def get_file_owner_group_name(config, filename): cmd = list() cmd.append('stat') cmd.append('-c') - cmd.append('\'%G\'') + cmd.append("'%G'") cmd.append(filename) if config.args.container: @@ -77,11 +81,12 @@ def get_file_owner_group_name(config, filename): else: return Run.run(cmd, shell_bool=True) + def get_file_permissions(config, filename): cmd = list() cmd.append('stat') cmd.append('-c') - cmd.append('\'%a\'') + cmd.append("'%a'") cmd.append(filename) if config.args.container: