fotolab 0.28.4__py3-none-any.whl → 0.28.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fotolab/__init__.py +3 -2
 - fotolab/subcommands/contrast.py +19 -5
 - {fotolab-0.28.4.dist-info → fotolab-0.28.5.dist-info}/METADATA +1 -1
 - {fotolab-0.28.4.dist-info → fotolab-0.28.5.dist-info}/RECORD +7 -7
 - {fotolab-0.28.4.dist-info → fotolab-0.28.5.dist-info}/LICENSE.md +0 -0
 - {fotolab-0.28.4.dist-info → fotolab-0.28.5.dist-info}/WHEEL +0 -0
 - {fotolab-0.28.4.dist-info → fotolab-0.28.5.dist-info}/entry_points.txt +0 -0
 
    
        fotolab/__init__.py
    CHANGED
    
    | 
         @@ -23,7 +23,7 @@ from pathlib import Path 
     | 
|
| 
       23 
23 
     | 
    
         | 
| 
       24 
24 
     | 
    
         
             
            from PIL import Image
         
     | 
| 
       25 
25 
     | 
    
         | 
| 
       26 
     | 
    
         
            -
            __version__ = "0.28. 
     | 
| 
      
 26 
     | 
    
         
            +
            __version__ = "0.28.5"
         
     | 
| 
       27 
27 
     | 
    
         | 
| 
       28 
28 
     | 
    
         
             
            log = logging.getLogger(__name__)
         
     | 
| 
       29 
29 
     | 
    
         | 
| 
         @@ -99,7 +99,8 @@ def _open_image(filename): 
     | 
|
| 
       99 
99 
     | 
    
         
             
                    elif sys.platform == "darwin":
         
     | 
| 
       100 
100 
     | 
    
         
             
                        subprocess.call(["open", filename])
         
     | 
| 
       101 
101 
     | 
    
         
             
                    elif sys.platform == "windows":
         
     | 
| 
       102 
     | 
    
         
            -
                        subprocess.Popen(["open", filename])
         
     | 
| 
      
 102 
     | 
    
         
            +
                        with subprocess.Popen(["open", filename], shell=True) as proc:
         
     | 
| 
      
 103 
     | 
    
         
            +
                            proc.wait()
         
     | 
| 
       103 
104 
     | 
    
         
             
                    log.info("open image: %s", filename.resolve())
         
     | 
| 
       104 
105 
     | 
    
         | 
| 
       105 
106 
     | 
    
         
             
                except OSError as error:
         
     | 
    
        fotolab/subcommands/contrast.py
    CHANGED
    
    | 
         @@ -25,10 +25,24 @@ from fotolab import save_image 
     | 
|
| 
       25 
25 
     | 
    
         
             
            log = logging.getLogger(__name__)
         
     | 
| 
       26 
26 
     | 
    
         | 
| 
       27 
27 
     | 
    
         | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
      
 28 
     | 
    
         
            +
            # pylint: disable=protected-access
         
     | 
| 
      
 29 
     | 
    
         
            +
            def _validate_cutoff(value: str) -> float:
         
     | 
| 
      
 30 
     | 
    
         
            +
                """Validate the cutoff value."""
         
     | 
| 
      
 31 
     | 
    
         
            +
                try:
         
     | 
| 
      
 32 
     | 
    
         
            +
                    f_value = float(value)
         
     | 
| 
      
 33 
     | 
    
         
            +
                except ValueError as e:
         
     | 
| 
      
 34 
     | 
    
         
            +
                    raise argparse.ArgumentTypeError(f"invalid float value: '{value}'") from e
         
     | 
| 
      
 35 
     | 
    
         
            +
                if not 0 <= f_value <= 50:
         
     | 
| 
      
 36 
     | 
    
         
            +
                    raise argparse.ArgumentTypeError(
         
     | 
| 
      
 37 
     | 
    
         
            +
                        f"cutoff value {f_value} must be between 0 and 50"
         
     | 
| 
      
 38 
     | 
    
         
            +
                    )
         
     | 
| 
      
 39 
     | 
    
         
            +
                return f_value
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
            def build_subparser(subparsers: argparse._SubParsersAction) -> None:
         
     | 
| 
       29 
43 
     | 
    
         
             
                """Build the subparser."""
         
     | 
| 
       30 
44 
     | 
    
         
             
                contrast_parser = subparsers.add_parser(
         
     | 
| 
       31 
     | 
    
         
            -
                    "contrast", help="contrast an image"
         
     | 
| 
      
 45 
     | 
    
         
            +
                    "contrast", help="contrast an image."
         
     | 
| 
       32 
46 
     | 
    
         
             
                )
         
     | 
| 
       33 
47 
     | 
    
         | 
| 
       34 
48 
     | 
    
         
             
                contrast_parser.set_defaults(func=run)
         
     | 
| 
         @@ -46,10 +60,10 @@ def build_subparser(subparsers) -> None: 
     | 
|
| 
       46 
60 
     | 
    
         
             
                    "-c",
         
     | 
| 
       47 
61 
     | 
    
         
             
                    "--cutoff",
         
     | 
| 
       48 
62 
     | 
    
         
             
                    dest="cutoff",
         
     | 
| 
       49 
     | 
    
         
            -
                    type= 
     | 
| 
       50 
     | 
    
         
            -
                    default=1,
         
     | 
| 
      
 63 
     | 
    
         
            +
                    type=_validate_cutoff,
         
     | 
| 
      
 64 
     | 
    
         
            +
                    default=1.0,
         
     | 
| 
       51 
65 
     | 
    
         
             
                    help=(
         
     | 
| 
       52 
     | 
    
         
            -
                        "set the percentage of lightest or darkest pixels"
         
     | 
| 
      
 66 
     | 
    
         
            +
                        "set the percentage (0-50) of lightest or darkest pixels"
         
     | 
| 
       53 
67 
     | 
    
         
             
                        " to discard from histogram"
         
     | 
| 
       54 
68 
     | 
    
         
             
                        " (default: '%(default)s')"
         
     | 
| 
       55 
69 
     | 
    
         
             
                    ),
         
     | 
| 
         @@ -1,11 +1,11 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            fotolab/__init__.py,sha256= 
     | 
| 
      
 1 
     | 
    
         
            +
            fotolab/__init__.py,sha256=qytheZnIjS5g0aUnq6-ChflsFcLasoz97T7GReoaeeQ,3301
         
     | 
| 
       2 
2 
     | 
    
         
             
            fotolab/__main__.py,sha256=aboOURPs_snOXTEWYR0q8oq1UTY9e-NxCd1j33V0wHI,833
         
     | 
| 
       3 
3 
     | 
    
         
             
            fotolab/cli.py,sha256=fIApD9C4Vkn-u4CejOFTboSV5f-Ks9vBGxeb-_ca-Nw,3935
         
     | 
| 
       4 
4 
     | 
    
         
             
            fotolab/subcommands/__init__.py,sha256=l3DlIaJ3u3jGjnC1H1yV8LZ_nPqOLJ6gikD4BCaMAQ0,1129
         
     | 
| 
       5 
5 
     | 
    
         
             
            fotolab/subcommands/animate.py,sha256=OcS6Q6JM1TW6HF0dSgBsV9mpEGwDMcJlQssupkf0_ZA,3393
         
     | 
| 
       6 
6 
     | 
    
         
             
            fotolab/subcommands/auto.py,sha256=ia-xegV1Z4HvYsbKgmTzf1NfNFdTDPWfZe7vQ1_90Ik,2425
         
     | 
| 
       7 
7 
     | 
    
         
             
            fotolab/subcommands/border.py,sha256=BS3BHytdWiNumxdKulKYK-WigbsKtPxECdvInUhUjSQ,4608
         
     | 
| 
       8 
     | 
    
         
            -
            fotolab/subcommands/contrast.py,sha256= 
     | 
| 
      
 8 
     | 
    
         
            +
            fotolab/subcommands/contrast.py,sha256=ZHTvAJhRYZjNTrkHRZq3O6wba3LS7QjH1BfiGf4ZvGY,3005
         
     | 
| 
       9 
9 
     | 
    
         
             
            fotolab/subcommands/env.py,sha256=QoxRvzZKgmoHTUxDV4QYhdChCpMWs5TbXFY_qIpIQpE,1469
         
     | 
| 
       10 
10 
     | 
    
         
             
            fotolab/subcommands/halftone.py,sha256=bRGG_Bg1T5ZV3UWsdMszOdPmc6g9_R0yNp5mb0g8hcE,4152
         
     | 
| 
       11 
11 
     | 
    
         
             
            fotolab/subcommands/info.py,sha256=Qp-Zu7Xp1ptLK211hOkFM5oxZWGTrlNBqCpbx2IjL9Y,3371
         
     | 
| 
         @@ -14,8 +14,8 @@ fotolab/subcommands/resize.py,sha256=UOb2rg_5ArRj0gxPTDOww_ix3tqJRC0W5b_S-Lt1G4w 
     | 
|
| 
       14 
14 
     | 
    
         
             
            fotolab/subcommands/rotate.py,sha256=uBFjHyjiBSQLtrtH1p9myODIHUDr1gkL4PpU-6Y1Ofo,2575
         
     | 
| 
       15 
15 
     | 
    
         
             
            fotolab/subcommands/sharpen.py,sha256=YNho2IPbc-lPvSy3Bsjehc2JOEy27LPqFSGRULs9MyY,3492
         
     | 
| 
       16 
16 
     | 
    
         
             
            fotolab/subcommands/watermark.py,sha256=A_dUy_yf9wPHUexB9aIicFIS-BpWrjjfI8Hr4WCCBoc,9449
         
     | 
| 
       17 
     | 
    
         
            -
            fotolab-0.28. 
     | 
| 
       18 
     | 
    
         
            -
            fotolab-0.28. 
     | 
| 
       19 
     | 
    
         
            -
            fotolab-0.28. 
     | 
| 
       20 
     | 
    
         
            -
            fotolab-0.28. 
     | 
| 
       21 
     | 
    
         
            -
            fotolab-0.28. 
     | 
| 
      
 17 
     | 
    
         
            +
            fotolab-0.28.5.dist-info/entry_points.txt,sha256=mvw7AY_yZkIyjAxPtHNed9X99NZeLnMxEeAfEJUbrCM,44
         
     | 
| 
      
 18 
     | 
    
         
            +
            fotolab-0.28.5.dist-info/LICENSE.md,sha256=tGtFDwxWTjuR9syrJoSv1Hiffd2u8Tu8cYClfrXS_YU,31956
         
     | 
| 
      
 19 
     | 
    
         
            +
            fotolab-0.28.5.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
         
     | 
| 
      
 20 
     | 
    
         
            +
            fotolab-0.28.5.dist-info/METADATA,sha256=0SIqAZceh2lv4iQkVoJu-7nRab99nDecITkquNUXFuU,12970
         
     | 
| 
      
 21 
     | 
    
         
            +
            fotolab-0.28.5.dist-info/RECORD,,
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     |