From 4931a15d409e3e5e6a3a89464f946bab457dd141 Mon Sep 17 00:00:00 2001 From: damani42 <56308939+damani42@users.noreply.github.com> Date: Thu, 3 Feb 2022 17:02:18 +0100 Subject: [PATCH] docs: use f-strings instead format (#585) In the documentation use f-strings in the examples. --- docs/cli.rst | 4 ++-- docs/colorlib.rst | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/cli.rst b/docs/cli.rst index 3a6b9d4c6..15aee5e98 100644 --- a/docs/cli.rst +++ b/docs/cli.rst @@ -23,7 +23,7 @@ might look like this:: verbose = cli.Flag(["v", "verbose"], help = "If given, I will be very talkative") def main(self, filename): - print("I will now read {0}".format(filename)) + print(f"I will now read {filename}") if self.verbose: print("Yadda " * 200) @@ -492,7 +492,7 @@ attached to the root application using the ``subcommand`` decorator :: def main(self, *args): if args: - print("Unknown command {0!r}".format(args[0])) + print(f"Unknown command {args[0]}") return 1 # error exit code if not self.nested_command: # will be ``None`` if no sub-command follows print("No command given") diff --git a/docs/colorlib.rst b/docs/colorlib.rst index e880b4ba3..46bbb905d 100644 --- a/docs/colorlib.rst +++ b/docs/colorlib.rst @@ -246,9 +246,9 @@ For example, if you wanted to create an HTMLStyle and HTMLcolors, you could do:: result = '' if self.bg and not self.bg.reset: - result += ''.format(self.bg.hex_code) + result += f'' if self.fg and not self.fg.reset: - result += ''.format(self.fg.hex_code) + result += f'' for attr in sorted(self.attributes): if self.attributes[attr]: result += '<' + self.attribute_names[attr] + '>'