Skip to content

Unify the style of type annotations#64

Merged
KaisennHu merged 2 commits into
Ascend:masterfrom
dpj135:unify_annotation_style
Jun 8, 2026
Merged

Unify the style of type annotations#64
KaisennHu merged 2 commits into
Ascend:masterfrom
dpj135:unify_annotation_style

Conversation

@dpj135

@dpj135 dpj135 commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

Description

  • Add type annotations to function signatures
  • Add Adjust function annotations style and complete functions that lack annotations
  • Add pydoclint to .pre-commit-config.yaml

@ascend-robot

Copy link
Copy Markdown

CLA Signature Pass

dpj135, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@dpj135 dpj135 force-pushed the unify_annotation_style branch from d455307 to b11febb Compare June 2, 2026 09:09
@ascend-robot

Copy link
Copy Markdown

CLA Signature Pass

dpj135, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@dpj135 dpj135 force-pushed the unify_annotation_style branch from b11febb to 2277dc9 Compare June 2, 2026 09:12
@ascend-robot

Copy link
Copy Markdown

CLA Signature Pass

dpj135, thanks for your pull request. All authors of the commits have signed the CLA. 👍

Signed-off-by: dpj135 <958208521@qq.com>
@dpj135 dpj135 force-pushed the unify_annotation_style branch from 2277dc9 to bfc15ed Compare June 3, 2026 02:41
@ascend-robot

Copy link
Copy Markdown

CLA Signature Pass

dpj135, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@dpj135 dpj135 requested a review from KaisennHu June 3, 2026 07:46
):
input_tensor: torch.Tensor,
output_tensor: torch.Tensor,
comm: hcclComm_t,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can the hcclComm_t pass the syntax check?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes, because hcclComm_t equal to ctypes.c_void_p.

hcclComm_t = ctypes.c_void_p

)
self._client = KVClient(host=host, port=port)
self.local_tensors = []
self.local_tensors: List["torch.Tensor"] = []

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

unnecessary

).remote()

backend_info: dict = ray.get(
backend_info: Dict[str, Any] = ray.get(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Whether local variables should be annotated or not, establish a unified standard.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I think we need to annotate local vars while using some uncommon types

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

and uncommon returned values

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

c++ syndrome lol

meta_bytes = pickle.dumps(meta_tuple, protocol=pickle.HIGHEST_PROTOCOL)

bufs: list[bytestr] = [meta_bytes, raw_data]
bufs = [meta_bytes, raw_data]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Whether local variables should be annotated or not, establish a unified standard.

@tianyi-ge

Copy link
Copy Markdown
Collaborator

consider introducing tools like pydoclint to pre-commit so that incorrect docstring can be automatically asserted.

Signed-off-by: dpj135 <958208521@qq.com>
@ascend-robot

Copy link
Copy Markdown

CLA Signature Pass

dpj135, thanks for your pull request. All authors of the commits have signed the CLA. 👍

Comment thread .pre-commit-config.yaml
# don't want a baseline the size of the codebase)
--arg-type-hints-in-docstring=False,
--skip-checking-raises=True,
--check-return-types=False,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

looks like return/arg type check are not enabled?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I referred to RAY's set about pydoclint there. Should we enable it?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

get it. now only arg name is checked. types are not cheked. let's follow the ray setting :)

@KaisennHu KaisennHu merged commit 49eebad into Ascend:master Jun 8, 2026
6 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants