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

Improve Docs: contact part #289

Merged
merged 19 commits into from
Jan 15, 2022
Merged

Improve Docs: contact part #289

merged 19 commits into from
Jan 15, 2022

Conversation

GaryDu0123
Copy link
Member

  1. 将JavaScript代码替换为python代码
  2. 将文档翻译为中文
  3. 小幅度修改了文档结构

@GaryDu0123 GaryDu0123 requested a review from a team as a code owner January 4, 2022 09:37
@CLAassistant
Copy link

CLAassistant commented Jan 4, 2022

CLA assistant check
All committers have signed the CLA.

Copy link
Collaborator

@wj-Mcat wj-Mcat left a comment

Choose a reason for hiding this comment

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

Your improvement is great. Are you interested in writing documentation for other modules? If so, it will be a great thing.

docs/references/contact.md Outdated Show resolved Hide resolved
docs/references/contact.md Outdated Show resolved Hide resolved
@GaryDu0123
Copy link
Member Author

Your improvement is great. Are you interested in writing documentation for other modules? If so, it will be a great thing.

Sure, that will be my pleasure, I will request a new pr after I complete

@wj-Mcat
Copy link
Collaborator

wj-Mcat commented Jan 6, 2022

I’m very glad to hear that. Our document and code need a lot of improvements which are opened for developers. So there are many challenging improvements on docs and codes.

Back to the point, you can put all changes at here and modify the title of pr. We are looking forward to your future great works. Please go head and feel free to discuss with us at here.

@GaryDu0123
Copy link
Member Author

OK, I will change this PR title, and try to improve the references dir in recent days~ Cheers

@GaryDu0123
Copy link
Member Author

GaryDu0123 commented Jan 7, 2022

Almost done, but I am not yet familiar with the methods and attributes in wechaty.md and Friendship.md , so I think I should just leave it here, hope someone can improve it in the future

Copy link
Collaborator

@wj-Mcat wj-Mcat left a comment

Choose a reason for hiding this comment

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

Your improvements are so great, I think it will make a big change on docs of python-wechaty. Here are some suggestions about some detailed problem. Let's discuss about it.

* [contactSelf.qrcode\(\) ⇒ `Promise <string>`](contact-self.md#contactselfqrcode-⇒-promise)
* [contactSelf.signature\(signature\) ⇒ `Promise <string>`](contact-self.md#contactselfsignaturesignature)
* [contactSelf.name\(\[name\]\) ⇒ `Promise <void> | string`](contact-self.md#contactselfname-⇒-promisestring)
* [contactSelf.avatar\(\[file\]\) ⇒ `None | FileBox`](contact-self.md#contactselfavatarfile-⇒-promise)
Copy link
Collaborator

Choose a reason for hiding this comment

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

There are some suggestions:

Copy link
Collaborator

Choose a reason for hiding this comment

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

@GaryDu0123 there are some discussion topic in outline comment, we can get deep into discussion about one of topic as sub-comment. eg this comment is the sub-comment about type annotations.


If you can not understand, let use the generated stubfile type annotation in pyi file. For example:

Here is the generated stubfile with subgen tools. You can have a detail look. The following code is the example:

class ContactSelf(Contact):
    async def avatar(self, file: Optional[FileBox] = ...) -> FileBox: ...
    async def qr_code(self) -> str: ...
    @property
    def name(self) -> str: ...
    @name.setter
    def name(self, name: Optional[str]) -> None: ...
    async def signature(self, signature: str) -> Any: ...

The suggested command is:

# install the mypy and stubgen  tools
pip install mypy

# generate stubfiles
stubgen -o ./src ./src

Please feel free to discuss more about this problem.

docs/references/contact-self.md Outdated Show resolved Hide resolved
@huan
Copy link
Member

huan commented Jan 7, 2022

Wechaty Contributors Nomination

Link to wechaty/PMC#16

@GaryDu0123
Copy link
Member Author

Yea, I think you are right, it should be like Coroutine kind of things, and also for the contact_self, I will take a look at those issues and modify the commit,

@GaryDu0123
Copy link
Member Author

GaryDu0123 commented Jan 7, 2022

I was trying to find the description of using Coroutine as a return type on the python docs, but in the end, I still did not fully understand how to use it. So I decided to keep the return type the same as the source code, hope it is acceptable lol

docs/references/room.md Outdated Show resolved Hide resolved
Copy link
Collaborator

@wj-Mcat wj-Mcat left a comment

Choose a reason for hiding this comment

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

You have done a great improvement on docs, and it takes a while to read this. But here are some details to discuss, please read it and try to make another change. Looking forward to your next commit.

docs/references/contact-self.md Outdated Show resolved Hide resolved

### contactSelf.avatar\(\[file\]\) ⇒ `Promise <void | FileBox>`
### async def avatar(self, file: `Optional[FileBox]` = None) ⇒ `FileBox`
Copy link
Collaborator

Choose a reason for hiding this comment

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

The type of return result is Optinal[FileBox].

Copy link
Collaborator

Choose a reason for hiding this comment

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

I give a mention it by the way that it's more elegant to use overload at here which will make code clear and code complete more precise. The example code is:

@overload
async def avatar(self) -> FileBox: ...

@overload
async def avatar(self, file: FileBox) -> None: ...

There are many method should be refactored. If you have any interest at this python trick, It's will be great for you and python-wechaty.

Copy link
Member Author

@GaryDu0123 GaryDu0123 Jan 9, 2022

Choose a reason for hiding this comment

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

Cool, I like the @overload way hahaha, thanks for your mention, I will modify my commit

docs/references/contact-self.md Outdated Show resolved Hide resolved
docs/references/contact.md Outdated Show resolved Hide resolved
docs/references/contact.md Outdated Show resolved Hide resolved
@wj-Mcat
Copy link
Collaborator

wj-Mcat commented Jan 10, 2022

ping @GaryDu0123 Looking forward to your new commit to fix the above issue.

@GaryDu0123
Copy link
Member Author

ping @GaryDu0123 Looking forward to your new commit to fix the above issue.

coooool

Copy link
Collaborator

@wj-Mcat wj-Mcat left a comment

Choose a reason for hiding this comment

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

LGTM

@wj-Mcat wj-Mcat merged commit 0b56cb5 into wechaty:master Jan 15, 2022
@GaryDu0123
Copy link
Member Author

@huan Can I join Wechaty Contributor Program?

@huan
Copy link
Member

huan commented Jan 19, 2022

Of course, and thank you very much for your contribution!

You are welcome to join Wechaty Contributor Program

1. Join Wechaty Organization

You've invited Gary Du to Wechaty! They'll be receiving an email shortly. They can also visit https://github.com/wechaty to accept the invitation.

I have invited you to join our Wechaty GitHub Organization, please accept it by following the above message. (See also: wechaty/PMC#16)

2. Update Your Wechaty Contributor Profile

  1. Please open Contributor Hall of Fame and add yourself to the end of the list, so that other contributors will know you better!
  2. Please add yourself to our Website Contributors by creating a PR and refer to this PR link as well.

3. Join The Contributor Only WeChat Room

We also have a WeChat room for contributors only which can discuss Wechaty at a deeper level, you are welcome to join and if you are interested.

Please add @lijiarui wechat: ruirui_0914 and send her this pr link. She will invite you into Wechaty Contributor Room

Cheers!

@GaryDu0123
Copy link
Member Author

thanks

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