summaryrefslogtreecommitdiff
path: root/examples/termui/termui.py
diff options
context:
space:
mode:
authorDavid Lord <davidism@gmail.com>2020-04-19 22:22:49 -0700
committerDavid Lord <davidism@gmail.com>2020-04-20 07:12:52 -0700
commitb444e6355ec50417546f42138bb833d1e9e8b306 (patch)
tree08b29d284fa7348c591aba0bbc71a21da7709876 /examples/termui/termui.py
parent62f84aa3242d6d9f57243b941b013b2536ea3b9c (diff)
downloadclick-b444e6355ec50417546f42138bb833d1e9e8b306.tar.gz
apply pyupgrade --py36-plus
Diffstat (limited to 'examples/termui/termui.py')
-rw-r--r--examples/termui/termui.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/examples/termui/termui.py b/examples/termui/termui.py
index 7b3da43..b772f13 100644
--- a/examples/termui/termui.py
+++ b/examples/termui/termui.py
@@ -1,4 +1,3 @@
-# coding: utf-8
import math
import random
import time
@@ -16,8 +15,8 @@ def cli():
def colordemo():
"""Demonstrates ANSI color support."""
for color in "red", "green", "blue":
- click.echo(click.style("I am colored {}".format(color), fg=color))
- click.echo(click.style("I am background colored {}".format(color), bg=color))
+ click.echo(click.style(f"I am colored {color}", fg=color))
+ click.echo(click.style(f"I am background colored {color}", bg=color))
@cli.command()
@@ -56,7 +55,7 @@ def progress(count):
def show_item(item):
if item is not None:
- return "Item #{}".format(item)
+ return f"Item #{item}"
with click.progressbar(
filter(items),
@@ -71,7 +70,7 @@ def progress(count):
length=count,
label="Counting",
bar_template="%(label)s %(bar)s | %(info)s",
- fill_char=click.style(u"█", fg="cyan"),
+ fill_char=click.style("█", fg="cyan"),
empty_char=" ",
) as bar:
for item in bar:
@@ -94,7 +93,7 @@ def progress(count):
length=count,
show_percent=False,
label="Slowing progress bar",
- fill_char=click.style(u"█", fg="green"),
+ fill_char=click.style("█", fg="green"),
) as bar:
for item in steps:
time.sleep(item)
@@ -119,13 +118,13 @@ def locate(url):
def edit():
"""Opens an editor with some text in it."""
MARKER = "# Everything below is ignored\n"
- message = click.edit("\n\n{}".format(MARKER))
+ message = click.edit(f"\n\n{MARKER}")
if message is not None:
msg = message.split(MARKER, 1)[0].rstrip("\n")
if not msg:
click.echo("Empty message!")
else:
- click.echo("Message:\n{}".format(msg))
+ click.echo(f"Message:\n{msg}")
else:
click.echo("You did not enter anything!")