-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* implemented conversion algorithm to convert `:=` (walrus) operations / **assignment expressions** to pre-3.8 compatible codes * implemented auto detection of line seperator and tab size based on source code context
- Loading branch information
Showing
8 changed files
with
271 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/usr/local/Homebrew/Library/Taps/jarryshaw/homebrew-tap/Generator/scripts/walrus.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
.\" Man page generated from reStructuredText. | ||
. | ||
.TH WALRUS 1 "November 25, 2019" "v0.1.0" "" | ||
.SH NAME | ||
walrus \- back-port compiler for Python 3.8 assignment expression | ||
. | ||
.nr rst2man-indent-level 0 | ||
. | ||
.de1 rstReportMargin | ||
\\$1 \\n[an-margin] | ||
level \\n[rst2man-indent-level] | ||
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] | ||
- | ||
\\n[rst2man-indent0] | ||
\\n[rst2man-indent1] | ||
\\n[rst2man-indent2] | ||
.. | ||
.de1 INDENT | ||
.\" .rstReportMargin pre: | ||
. RS \\$1 | ||
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] | ||
. nr rst2man-indent-level +1 | ||
.\" .rstReportMargin post: | ||
.. | ||
.de UNINDENT | ||
. RE | ||
.\" indent \\n[an-margin] | ||
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] | ||
.nr rst2man-indent-level -1 | ||
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] | ||
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u | ||
.. | ||
.SH SYNOPSIS | ||
.sp | ||
walrus [\fIoptions\fP] <\fIpython source files and folders\fP> ... | ||
.SH DESCRIPTION | ||
.sp | ||
Since PEP 572, Python introduced \fIassignment expressions\fP syntax in | ||
version __3.8__. For those who wish to use \fIassignment expressions\fP | ||
in their code, \fIwalrus\fP provides an intelligent, yet imperfect, | ||
solution of a \fBbackport compiler\fP by replacing \fIassignment expressions\fP | ||
syntax with old\-fashioned assignment\-then\-conditional syntax, which | ||
guarantees you to always write \fIassignment expressions\fP in Python 3.8 | ||
flavour then compile for compatibility later. | ||
.SH OPTIONS | ||
.SS positional arguments | ||
.INDENT 0.0 | ||
.TP | ||
.B SOURCE | ||
python source files and folders to be converted | ||
.UNINDENT | ||
.SS optional arguments | ||
.INDENT 0.0 | ||
.TP | ||
.B \-h\fP,\fB \-\-help | ||
show this help message and exit | ||
.TP | ||
.B \-V\fP,\fB \-\-version | ||
show program\(aqs version number and exit | ||
.TP | ||
.B \-q\fP,\fB \-\-quiet | ||
run in quiet mode | ||
.UNINDENT | ||
.SS archive options | ||
.sp | ||
duplicate original files in case there\(aqs any issue | ||
.INDENT 0.0 | ||
.TP | ||
.BI \-n\fB a\fP,\fB \ \-\-no\-archive | ||
do not archive original files | ||
.UNINDENT | ||
.INDENT 0.0 | ||
.TP | ||
.B \-p \fIPATH\fP, \-\-archive\-path \fIPATH\fP | ||
path to archive original files | ||
.UNINDENT | ||
.SS convert options | ||
.sp | ||
compatibility configuration for none\-unicode files | ||
.INDENT 0.0 | ||
.TP | ||
.B \-c \fICODING\fP, \-\-encoding \fICODING\fP | ||
encoding to open source files | ||
.TP | ||
.B \-v \fIVERSION\fP, \-\-python \fIVERSION\fP | ||
convert against Python version | ||
.TP | ||
.B \-s \fISEP\fP, \-\-linesep \fISEP\fP | ||
line separator to process source files | ||
.UNINDENT | ||
.INDENT 0.0 | ||
.TP | ||
.BI \-n\fB l\fP,\fB \ \-\-no\-linting | ||
do not lint converted codes | ||
.UNINDENT | ||
.INDENT 0.0 | ||
.TP | ||
.B \-t \fIINDENT\fP, \-\-tabsize \fIINDENT\fP | ||
indentation tab size | ||
.UNINDENT | ||
.SH ENVIRONMENT | ||
.sp | ||
\fBwalrus\fP currently supports two environment variables. | ||
.INDENT 0.0 | ||
.TP | ||
.B WALRUS_QUIET | ||
run in quiet mode | ||
.TP | ||
.B WALRUS_ENCODING | ||
encoding to open source files | ||
.TP | ||
.B WALRUS_VERSION | ||
convert against Python version | ||
.TP | ||
.B WALRUS_LINESEP | ||
line separator to process source files | ||
.TP | ||
.B WALRUS_LINTING | ||
lint converted codes | ||
.TP | ||
.B WALRUS_TABSIZE | ||
indentation tab size | ||
.UNINDENT | ||
.SH SEE ALSO | ||
.sp | ||
babel(1), f2format(1), poseur(1), vermin(1) | ||
.SH AUTHOR | ||
Jarry Shaw, a newbie programmer, is the author, owner and maintainer | ||
of walrus. Please contact me at [email protected]. | ||
.SH COPYRIGHT | ||
walrus is licensed under the MIT License. | ||
.\" Generated by docutils manpage writer. | ||
. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.