Giter Site home page Giter Site logo

Comments (7)

radarhere avatar radarhere commented on June 15, 2024 1

python/typeshed#11408 has been merged to update types-Pillow.

from pillow.

Yay295 avatar Yay295 commented on June 15, 2024

ImageOps.autocontrast doesn't currently have any typing. It's probably getting it wrong because it has a default value.

def autocontrast(image, cutoff=0, ignore=None, mask=None, preserve_tone=False):

from pillow.

hugovk avatar hugovk commented on June 15, 2024

Do you have types-Pillow installed?

Typeshed has only int there:

https://github.com/python/typeshed/blob/994d22bfbb542956be24580323d5b4aeef822c77/stubs/Pillow/PIL/ImageOps.pyi#L14-L16

from pillow.

pa-tna avatar pa-tna commented on June 15, 2024

Yes, I do have types-Pillow installed. I can see that Typeshed is the appropriate place to resolve this issue.

It looks like cutoff should allow an int, float or tuple[int | float, int | float] value. Does that seem right? If so I can open an issue or PR there instead.

from pillow.

radarhere avatar radarhere commented on June 15, 2024

I've created PR #7786 to add a type hint to cutoff of float | tuple[float, float], as https://peps.python.org/pep-0484/#the-numeric-tower

when an argument is annotated as having type float, an argument of type int is acceptable

However, yes, if you're using types-Pillow, you will need to make a change elsewhere.

from pillow.

radarhere avatar radarhere commented on June 15, 2024

You might also be interested to know that the tuple behaviour was added in Pillow 8.0.0 with #4749

from pillow.

radarhere avatar radarhere commented on June 15, 2024

python/typeshed#11409 was later merged to change the type hints to allow floats as well.

from pillow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.