Skip to content
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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

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
@@ -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):
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, ...])

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