Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[docutils]: Add annotations fordocutils.parsers.rst.states#14209

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
Harry-Lees wants to merge17 commits intopython:main
base:main
Choose a base branch
Loading
fromHarry-Lees:14031-patch-1

Conversation

Harry-Lees
Copy link
Contributor

@Harry-LeesHarry-Lees commentedJun 1, 2025
edited
Loading

Linked Issue:#14031

This PR overlaps with#14191, apologies to@donBarbos, I didn't see your PR while working on this. I think this PR is a more fully implemented version of annotations indocutils.parsers.rst.states, but#14191 covers significantly more than just this file.

It might be possible to merge the two together, I will check the other PR to ensure that they line up on the parts which are overlapping.

Edit: I merged some changes where I thought#14191's implementation was more complete than this one, I added Co-authored attribution to the relevant commits,@donBarbos if you are unhappy in any way with the attribution, please let me know how I can update it, I'm not too well versed in Git, but I think I can transfer the commit ownership entirely, or remove you from the commit(s) entirely if you're unhappy to have your name associated with them :)

@github-actionsGitHub Actions

This comment has been minimized.

@github-actionsGitHub Actions

This comment has been minimized.

@github-actionsGitHub Actions

This comment has been minimized.

@donBarbos
Copy link
Contributor

Thank you, I suggest merging my PR first and then we can see what improvements you have made ;)

I will also note that stubs fordocutils are already fully generated in my draft PR (WIP) and for now I am sorting out the errors and sending separate updates for directories

Harry-Lees reacted with thumbs up emoji

@srittau
Copy link
Collaborator

I've merged@donBarbos's PR. This now has (as expected) merge conflicts.

donBarbos and Harry-Lees reacted with thumbs up emoji

@Harry-Lees
Copy link
ContributorAuthor

I rebased the PR and fixed a couple of obvious errors, I'm sure the CI will have some failures as-well :D.

I need to take a more detailed look at some of the differences, I should be able to get round to it later today.

self, match: Match[str], context:list[str] | None, next_state:str | None
) -> tuple[list[str],str | None, list[str]]: ...
self, match: Match[str], context:Any, next_state:_NextState
) -> tuple[list[Any],_NextState, list[Any]]: ...
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I would appreciate some input in these cases as-well. The implementing function is:

deffield_marker(self,match,context,next_state):"""Field list field."""field,blank_finish=self.field(match)self.parent+=fieldself.blank_finish=blank_finishreturn [],next_state, []

I'm not sure how the[] should be annotated ideally. This is another very common pattern which I have always annotated aslist[Any]. I stayed away fromlist[Never] here, because this will throw an error if the array is appended to (which I can only assume it often is)

Copy link
Member

@AA-TurnerAA-TurnerJun 3, 2025
edited
Loading

Choose a reason for hiding this comment

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

You will find answers in the docstring of theState class:

    Transition methods all return a 3-tuple:    - A context object, as (potentially) modified by the transition method.    - The next state name (a return value of ``None`` means no state change).    - The processing result, a list, which is accumulated by the state      machine.

@github-actionsGitHub Actions

This comment has been minimized.

@github-actionsGitHub Actions

This comment has been minimized.

@github-actionsGitHub Actions

This comment has been minimized.

@github-actionsGitHub Actions
Copy link
Contributor

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

Copy link
Collaborator

@srittausrittau left a comment

Choose a reason for hiding this comment

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

I'm sorry for the late review.

This looks mostly good, but I noticed that somecontext arguments are annotated withAny. We generally need comments explaining non-obvious uses ofAny. But I also noticed that there already is a_Context type var. Could this be used? If not, I would recommend renaming that type var (maybe to_ContextT) and instead introduce a_Context type alias (potentially toAny) and add any explanatory comment to the type var definition.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@AA-TurnerAA-TurnerAA-Turner left review comments

@srittausrittausrittau requested changes

Requested changes must be addressed to merge this pull request.

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@Harry-Lees@donBarbos@srittau@AA-Turner

[8]ページ先頭

©2009-2025 Movatter.jp