Skip to content

Conversation

@SecorD0
Copy link

@SecorD0 SecorD0 commented Jul 14, 2023

Once special characters are rotated, they become illegible. So I added the ability to disable rotation of all text characters and disable rotation of special characters anyway.

captcha/image.py Outdated
return image

def create_captcha_image(self, chars, color, background):
def create_captcha_image(self, chars: str, color: tuple, background: tuple, rotate: bool = True):
Copy link
Owner

Choose a reason for hiding this comment

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

this tuple type hint is not compatible with 3.8.

Copy link
Author

Choose a reason for hiding this comment

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

I use Python 3.8 in almost all of my projects and this hint works fine. The project using this library with my modifications is no exception.

Copy link

Choose a reason for hiding this comment

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

It is working if not parametrized, but using tuple[...] is 3.9+.

(It is usually recommended to parametrize generic types, if you don't know the structure of the color argument, you can use typing.Tuple[T, ...])

Copy link

Choose a reason for hiding this comment

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

why dont yall just from __future__ import annotations

@SecorD0
Copy link
Author

SecorD0 commented Jul 17, 2023

Okay, if you think there might be a problem with type hints, let's delete them.

@Viicos
Copy link

Viicos commented Jul 17, 2023

I think they could be added to the whole package, maybe?

@lepture
Copy link
Owner

lepture commented Jul 29, 2023

This is an advanced feature. I'd like to make image captcha the ability to add character by character, in this way, developers can control each character themselves.

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.

4 participants