From bf57870e32d820e54927a4766f0f3b40cae39113 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 18 Jul 2023 05:02:12 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- barcode/ean.py | 9 ++------- barcode/pybarcode.py | 8 ++------ tests/test_manually.py | 4 +--- 3 files changed, 5 insertions(+), 16 deletions(-) diff --git a/barcode/ean.py b/barcode/ean.py index 6cf1728..bf47765 100755 --- a/barcode/ean.py +++ b/barcode/ean.py @@ -47,19 +47,14 @@ def __init__(self, ean, writer=None, no_checksum=False, guardbar=False) -> None: raise IllegalCharacterError("EAN code can only contain numbers.") if len(ean) != self.digits: raise NumberOfDigitsError( - "EAN must have {} digits, not {}.".format( - self.digits, - len(ean), - ) + f"EAN must have {self.digits} digits, not {len(ean)}." ) self.ean = ean # If no checksum if no_checksum: # Add a thirteen char if given in parameter, # otherwise pad with zero - self.ean = "{}{}".format( - ean, ean[self.digits] if len(ean) > self.digits else 0 - ) + self.ean = f"{ean}{ean[self.digits] if len(ean) > self.digits else 0}" else: self.ean = f"{ean}{self.calculate_checksum()}" diff --git a/barcode/pybarcode.py b/barcode/pybarcode.py index b21ca5d..a3e8463 100644 --- a/barcode/pybarcode.py +++ b/barcode/pybarcode.py @@ -26,16 +26,12 @@ def create_barcode(args, parser): args.type = args.type.upper() if args.type != "SVG" and args.type not in IMG_FORMATS: parser.error( - "Unknown type {type}. Try list action for available types.".format( - type=args.type - ) + f"Unknown type {args.type}. Try list action for available types." ) args.barcode = args.barcode.lower() if args.barcode not in barcode.PROVIDED_BARCODES: parser.error( - "Unknown barcode {bc}. Try list action for available barcodes.".format( - bc=args.barcode - ) + f"Unknown barcode {args.barcode}. Try list action for available barcodes." ) if args.type != "SVG": opts = {"format": args.type} diff --git a/tests/test_manually.py b/tests/test_manually.py index dc43fe6..816ecbe 100755 --- a/tests/test_manually.py +++ b/tests/test_manually.py @@ -68,9 +68,7 @@ def append_img(x, y): options["center_text"] = True filename = bcode.save(os.path.join(TESTPATH, codename), options=options) print( - "Code: {}, Input: {}, Output: {}".format( - bcode.name, code, bcode.get_fullcode() - ) + f"Code: {bcode.name}, Input: {code}, Output: {bcode.get_fullcode()}" ) append(os.path.basename(filename), bcode.name) if ImageWriter is not None: