[apparmor] [patch 5/8] parser testlib - write_file() argument adjustments
Christian Boltz
apparmor at cboltz.de
Thu Oct 24 20:35:20 UTC 2013
Hello,
Am Mittwoch, 23. Oktober 2013 schrieb Steve Beattie:
> This patch modifies testlib.write_file() to take a directory and a
> file name instead of a path and return the joined result for callers
> to use if necessary.
>
> Signed-off-by: Steve Beattie <steve at nxnw.org>
> Index: b/parser/tst/testlib.py
> ===================================================================
> --- a/parser/tst/testlib.py
> +++ b/parser/tst/testlib.py
> @@ -165,10 +165,12 @@ def touch(path):
> return os.utime(path, None)
>
>
> -def write_file(path, contents):
> - '''write contents to path'''
> +def write_file(directory, file, contents):
> + '''construct path, write contents to it, and return it'''
It's not really obvious what the last "it" means - the path or the
conents?
Something like "... and return the full path" would be better.
> + path = os.path.join(directory, file)
> with open(path, 'w+') as f:
> f.write(contents)
> + return path
With an improved comment for write_file,
Acked-by: Christian Boltz <apparmor at cboltz.de>
Regards,
Christian Boltz
--
Comic Sans
Man möge mir verzeihen, aber ich möchte mich im Rahmen dieses Essays in
erster Linie mit Schriften auseinandersetzen, nicht mit Krankheiten.
[http://praegnanz.de/essays/136/typo-im-web-html-schriften-unter-der-lupe]
More information about the AppArmor
mailing list