Skip to content

Conversation

@yelite
Copy link
Contributor

@yelite yelite commented Jul 15, 2022

This PR addes:

  • StmtDoc Printing in PythonDocPrinter

Tracking issue: #11912

cc @junrushao1994 @gbonik

@github-actions github-actions bot requested a review from junrushao July 15, 2022 19:37
@yelite yelite mentioned this pull request Jul 15, 2022
@yelite yelite force-pushed the tunip-stmt-doc-printing branch 3 times, most recently from e7de83b to 871b3e3 Compare July 19, 2022 19:16
@yelite yelite force-pushed the tunip-stmt-doc-printing branch 2 times, most recently from f52ac4d to 763ff53 Compare July 25, 2022 18:24
junrushao pushed a commit to yelite/tvm that referenced this pull request Jul 27, 2022
This PR addes:

- Awareness of expression (operator) precedence during Python code printing
(`(* 1 (+ 2 3))` prints as `1 * (2 + 3)`)

Tracking issue: apache#11912

This PR is in draft state because it's branched off an open PR
apache#12112.
@yelite yelite force-pushed the tunip-stmt-doc-printing branch from 763ff53 to d0d9006 Compare July 28, 2022 01:23
@yelite yelite marked this pull request as ready for review July 28, 2022 01:24
doc.comment = "1\n2"
with pytest.raises(ValueError) as e:
to_python_script(doc)
assert "cannot have newline" in str(e.value)
Copy link
Member

Choose a reason for hiding this comment

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

Let's append some epilogues to this file so that it could be runnable with python /path/to/file

if __name__ == "__main__":
  tvm.testing.main()

Comment on lines +447 to +448
output_ << " -> ";
PrintDoc(doc->return_type);
Copy link
Member

Choose a reason for hiding this comment

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

Shall we consider the case where return_type is not given?

Copy link
Member

@junrushao junrushao left a comment

Choose a reason for hiding this comment

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

LGTM

@junrushao junrushao merged commit 1131c92 into apache:main Jul 28, 2022
junrushao pushed a commit to yelite/tvm that referenced this pull request Aug 1, 2022
This PR:

- Handle expression (operator) precedence during Python code printing (`(* 1 (+ 2 3))` prints as
`1 * (2 + 3)`)
- Addresses remaining feedback from previous PR apache#12112
- Reformats Python import with isort

Tracking issue: apache#11912
junrushao pushed a commit that referenced this pull request Aug 1, 2022
This PR:

- Handle expression (operator) precedence during Python code printing (`(* 1 (+ 2 3))` prints as
`1 * (2 + 3)`)
- Addresses remaining feedback from previous PR #12112
- Reformats Python import with isort

Tracking issue: #11912
xinetzone pushed a commit to daobook/tvm that referenced this pull request Nov 25, 2022
This PR addes:

- StmtDoc Printing in PythonDocPrinter

Tracking issue: apache#11912
xinetzone pushed a commit to daobook/tvm that referenced this pull request Nov 25, 2022
This PR:

- Handle expression (operator) precedence during Python code printing (`(* 1 (+ 2 3))` prints as
`1 * (2 + 3)`)
- Addresses remaining feedback from previous PR apache#12112
- Reformats Python import with isort

Tracking issue: apache#11912
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