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

Add stubs for aws_xray_sdk #12587

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open

Add stubs for aws_xray_sdk #12587

wants to merge 12 commits into from

Conversation

ashm-dev
Copy link
Contributor

No description provided.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

@ashm-dev
Copy link
Contributor Author

@srittau can you please review my PR if it's not difficult!)

Copy link
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

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

Thanks! Not a complete review yet, just a few things I noticed. Also, my question about private attributes from the other PR applies here as well.

Comment on lines +8 to +10
def __init__(
self, *args: ParamSpecArgs, loop: Incomplete | None = None, use_task_factory: bool = True, **kwargs: ParamSpecKwargs
) -> None: ...
Copy link
Collaborator

Choose a reason for hiding this comment

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

I've never seen ParamSpecArgs used like this. It seems that *args and **kwargs are just passed on to the super class in the implementation. I suggest to just copy the super class argument:

Suggested change
def __init__(
self, *args: ParamSpecArgs, loop: Incomplete | None = None, use_task_factory: bool = True, **kwargs: ParamSpecKwargs
) -> None: ...
def __init__(
self, context_missing: str = "LOG_ERROR", loop: Incomplete | None = None, use_task_factory: bool = True
) -> None: ...

def __getattribute__(self, item: str): ...
def __init__(self, loop: AbstractEventLoop | None = None) -> None: ...
def __setattr__(self, name: str, value: str) -> None: ...
def __getattribute__(self, item: str) -> str: ...
Copy link
Collaborator

Choose a reason for hiding this comment

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

This can return other types than just str, but that's hard to express.

Suggested change
def __getattribute__(self, item: str) -> str: ...
# Forwards attribute access to task.context (if set).
def __getattribute__(self, item: str) -> Any: ...

def send_entity(self, entity) -> None: ...
def set_daemon_address(self, address) -> None: ...
def __init__(self, daemon_address: str = "127.0.0.1:2000") -> None: ...
def send_entity(self, entity: Any) -> None: ...
Copy link
Collaborator

Choose a reason for hiding this comment

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

We require a comment (or type alias) for any use of Any. In this case, we could do better by adding a protocol like this and using it here:

@type_check_only
class _HasSerialize(Protocol):
    def serialize(self) -> str: ...

Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

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