-
Notifications
You must be signed in to change notification settings - Fork 185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable rotating for special characters #66
base: master
Are you sure you want to change the base?
Conversation
captcha/image.py
Outdated
@@ -157,19 +160,20 @@ def create_noise_dots(image, color, width=3, number=30): | |||
number -= 1 | |||
return image | |||
|
|||
def create_captcha_image(self, chars, color, background): | |||
def create_captcha_image(self, chars: str, color: tuple, background: tuple, rotate: bool = True): |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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, ...]
)
There was a problem hiding this comment.
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
Okay, if you think there might be a problem with type hints, let's delete them. |
I think they could be added to the whole package, maybe? |
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. |
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.