GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — py.typed and type comments by Avasam · Pull Request #251 · python-xlib/python-xlib

Conversation

@Avasam

@Avasam Avasam commented Nov 17, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Added type comments as per PEP 561 to type all public API while staying Python 2 compatible. (type definitions only need to be compatible with non EOL python versions. Using type comments instead of inline-types allows the code to still run on Python 2)

Added a py.typed marker to let type checkers know that this package provides its own types. And to not look for external type-stubs.

Some dynamic types (like Struct, Request, Event, ...) are naturally incomplete, but this was more than enough for my needs. And would add a lot of complexity to support.

For this to be as accurate as possible, the following should also be looked at:

  • xlib.error does not inherit from base exception #222 / randr: inherit XError in error classes #242
  • Should ReplyRequest and ConnectionSetupRequest inherit from Request? #244
  • Prefer bool over Literal[0, 1, None] #247
  • Fix potential usage of None and Unbound variables issues #248
  • Standardize return type of parse_binary_value to bytes #249
  • Explicit arguments with *args and **kwargs #250

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Avasam added 4 commits November 16, 2022 18:32
@Avasam
py.typed and type comments
4f5362e
@Avasam
Update rq.py
834881f
@Avasam
Update display.py
4d05260
@Avasam
Update types
f53aa8e
@Avasam
Avasam marked this pull request as draft November 18, 2022 21:16
@Avasam

Avasam commented Nov 18, 2022

Copy link
Copy Markdown
Contributor Author

As draft until all previous are also closed

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Avasam added 4 commits November 18, 2022 16:23
@Avasam
Fix syntax error
eba9e6f
@Avasam
Merge branch 'type-comments' of https://github.com/Avasam/python-xlib …
3154d16
…into type-comments
@Avasam
No TypeAlias explicit typing
c7a798a
@Avasam
XK
53bd753
@Avasam Avasam mentioned this pull request Nov 18, 2022
Missing imports in Xlib.XK #245
Closed
@Avasam
Avasam force-pushed the type-comments branch 2 times, most recently from 83ce322 to 70aa021 Compare November 18, 2022 22:39
@Avasam
Fix overload and TYPE_CHECKING type comments
7697da9
@Avasam
Avasam force-pushed the type-comments branch from 70aa021 to 7697da9 Compare November 18, 2022 22:47
Avasam added 7 commits November 18, 2022 17:50
@Avasam
Remove from __future__
ddb1e77
@Avasam
Update commetns and spacing
ad71f6c
@Avasam
__getattr__ change
830f0c5
@Avasam
syntax error
035edd4
@Avasam
test with comments?
909a748
@Avasam
probably fixed
f46b72c
@Avasam
Nonable length
dfdf8c1
@codecov-commenter

codecov-commenter commented Nov 19, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 43.14214% with 228 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.28%. Comparing base (4e8bbf8) to head (1c163a2).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #251      +/-   ##
==========================================
- Coverage   78.21%   75.28%   -2.93%     
==========================================
  Files          42       42              
  Lines        4705     5054     +349     
==========================================
+ Hits         3680     3805     +125     
- Misses       1025     1249     +224     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Avasam added 3 commits November 27, 2022 15:03
@Avasam
Update some buffer types
14e620d
@Avasam
Type comments update
d1797a3
@Avasam
Merge branch 'master' of https://github.com/python-xlib/python-xlib i…
1c163a2
…nto type-comments
@Avasam Avasam mentioned this pull request May 2, 2024
randr: inherit XError in error classes #242
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@Avasam @codecov-commenter
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.