Skip to content

Add stubs for itsdangerous. - #537

Merged
gvanrossum merged 1 commit into
python:masterfrom
rowillia:add_itsdangerous
Sep 18, 2016
Merged

gvanrossum merged 1 commit into
python:masterfrom
rowillia:add_itsdangerous

Conversation

@rowillia

Copy link
Copy Markdown
Contributor

This is needed for #28

@gvanrossum

gvanrossum commented Sep 12, 2016 via email

Copy link
Copy Markdown
Member

@rowillia

Copy link
Copy Markdown
Contributor Author

@gvanrossum Gah, you're correct. They gave me permission for jinja and werkzeug but not itsdangerous. Will poke in that repo.

@rowillia

Copy link
Copy Markdown
Contributor Author

@gvanrossum Gave me the good to go here - pallets/itsdangerous#69

int_to_byte = chr
number_types = (int, long, float)

bytes_like = Union[bytearray, str]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm... I wonder if even for 2.7 it's better to use bytes instead of str? Honestly I have no idea what this package does (and no time to research it) so if you don't think that's a good idea I'll take your word for it. If you do, maybe it should go into 2and3?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, that's an interesting idea. I forgot that bytes aliases to str in Python 2. The main motivation for splitting things up is it actually gets quite complicated in Python 3 as to which methods can take strings and which ones have to take a bytes_like value. I'll investigate unifying the stybs.

@gvanrossum

Copy link
Copy Markdown
Member

Let me know. I'm also okay with merging as-is; I have no stomach to review this carefully.

@gvanrossum

Copy link
Copy Markdown
Member

Ping? Do you want me to merge this now or are you planning to do something about the bytes?

@gvanrossum

Copy link
Copy Markdown
Member

I'm just going to merge this as-is, if you change your mind about bytes you can submit a follow-up PR. Thanks for doing this!

@gvanrossum
gvanrossum merged commit b5e372b into python:master Sep 18, 2016
@rowillia

rowillia commented Sep 20, 2016 •

Copy link
Copy Markdown
Contributor Author

@gvanrossum Sorry I dropped the ball here, other things came up (mostly around adopting PEP 484 and selling it to other folks 😄). I will give it a go to make this a 2and3 module.

As an aside, say I were to get these types upstreamed into the module itself as opposed to typeshed. Is there any way in mypy or any of the other type checkers to specify something of the form "Check the module itself, and if it's missing types fall back to typeshed"?

@JukkaL

JukkaL commented Sep 20, 2016

Copy link
Copy Markdown
Contributor

We had a long discussion about inline annotations in library modules in the mypy issue tracker, but it's still unresolved: python/mypy#1190

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants