Skip to content

Commit aaa738f

Browse files
pre-commit-ci[bot]WhyNotHugo
authored andcommitted
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 26fd881 commit aaa738f

File tree

3 files changed

+5
-20
lines changed

3 files changed

+5
-20
lines changed

barcode/ean.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,14 @@ def __init__(self, ean, writer=None, no_checksum=False, guardbar=False) -> None:
4747
raise IllegalCharacterError("EAN code can only contain numbers.")
4848
if len(ean) != self.digits:
4949
raise NumberOfDigitsError(
50-
"EAN must have {} digits, not {}.".format(
51-
self.digits,
52-
len(ean),
53-
)
50+
f"EAN must have {self.digits} digits, not {len(ean)}."
5451
)
5552
self.ean = ean
5653
# If no checksum
5754
if no_checksum:
5855
# Add a thirteen char if given in parameter,
5956
# otherwise pad with zero
60-
self.ean = "{}{}".format(
61-
ean, ean[self.digits] if len(ean) > self.digits else 0
62-
)
57+
self.ean = f"{ean}{ean[self.digits] if len(ean) > self.digits else 0}"
6358
else:
6459
self.ean = f"{ean}{self.calculate_checksum()}"
6560

barcode/pybarcode.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,11 @@ def list_types(args, parser=None):
2525
def create_barcode(args, parser):
2626
args.type = args.type.upper()
2727
if args.type != "SVG" and args.type not in IMG_FORMATS:
28-
parser.error(
29-
"Unknown type {type}. Try list action for available types.".format(
30-
type=args.type
31-
)
32-
)
28+
parser.error(f"Unknown type {args.type}. Try list action for available types.")
3329
args.barcode = args.barcode.lower()
3430
if args.barcode not in barcode.PROVIDED_BARCODES:
3531
parser.error(
36-
"Unknown barcode {bc}. Try list action for available barcodes.".format(
37-
bc=args.barcode
38-
)
32+
f"Unknown barcode {args.barcode}. Try list action for available barcodes."
3933
)
4034
if args.type != "SVG":
4135
opts = {"format": args.type}

tests/test_manually.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,7 @@ def append_img(x, y):
6767
else:
6868
options["center_text"] = True
6969
filename = bcode.save(os.path.join(TESTPATH, codename), options=options)
70-
print(
71-
"Code: {}, Input: {}, Output: {}".format(
72-
bcode.name, code, bcode.get_fullcode()
73-
)
74-
)
70+
print(f"Code: {bcode.name}, Input: {code}, Output: {bcode.get_fullcode()}")
7571
append(os.path.basename(filename), bcode.name)
7672
if ImageWriter is not None:
7773
bcodec = get_barcode_class(codename)

0 commit comments

Comments
 (0)