Skip to content

Conversation

@welli7ngton
Copy link
Contributor

@welli7ngton welli7ngton commented Dec 4, 2024

Added type annotations to some methods in the DesktopBot class to enhance code readability and enable static type checking:

  • _fix_display_size: Returns a Tuple[int, int].
  • display_size: Returns a Tuple[int, int].
  • screenshot: Accepts Optional[str] for filepath and Optional[Tuple[int, int, int, int]] for region, and returns Image.Image.
  • get_screenshot: Same parameters and return type as screenshot.
  • screen_cut: Parameters now include x: int = 0, y: int = 0, and Optional[int] for width and height. Returns Image.Image.
  • save_screenshot: Parameter path is typed as str, and the method returns None.

Improving formatting consistency:

  • added spacing around arithmetic operators in _fix_display_size.
  • Replaced redundant default value assignments (x = x or 0) with cleaner initial parameter values.

Also updated imports to include Tuple and Optional from typing.

This PR is related to issue

Added type annotations to several methods in the DesktopBot class to enhance code readability and enable static type checking:
- _fix_display_size: Returns a Tuple[int, int].
- display_size: Returns a Tuple[int, int].
- screenshot: Accepts Optional[str] for filepath and Optional[Tuple[int, int, int, int]] for region, and returns Image.Image.
- get_screenshot: Same parameters and return type as screenshot.
- screen_cut: Parameters now include x: int = 0, y: int = 0, and Optional[int] for width and height. Returns Image.Image.
- save_screenshot: Parameter path is typed as str, and the method returns None.

Improving formatting consistency:
- added spacing around arithmetic operators in _fix_display_size.
- Replaced redundant default value assignments (x = x or 0) with cleaner initial parameter values.

Also updated imports to include Tuple and Optional from typing.
@welli7ngton welli7ngton marked this pull request as draft December 4, 2024 21:56
@welli7ngton welli7ngton marked this pull request as ready for review December 4, 2024 21:56
@welli7ngton welli7ngton marked this pull request as draft December 4, 2024 21:56
@welli7ngton welli7ngton marked this pull request as ready for review December 4, 2024 21:58
@welli7ngton welli7ngton marked this pull request as draft December 4, 2024 23:31
@welli7ngton welli7ngton marked this pull request as ready for review December 4, 2024 23:37
@joao-voltarelli
Copy link
Contributor

@welli7ngton great work! Thanks for the contribution.

@joao-voltarelli joao-voltarelli merged commit 04e220f into botcity-dev:main Dec 13, 2024
3 checks passed
@welli7ngton
Copy link
Contributor Author

@joao-voltarelli i will soon be working on the next functions following the documentation

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.

2 participants