0.5.0 a couple issues on first attempt to use
まだ誰も着手していません。
評価
調査の方向性
まず esl_async.py と esl_sync.py を使って Windows での変換を再現し、次に unasync Rule の例で使用されているトークン化と出力パスを調べます。行末、typing_extensions のインポート、タブによるインデントの処理を確認します。変換されたファイルが Windows および古い Python バージョンで有効であり、同じディレクトリからの単純な呼び出しがサポートされれば完了です。
索引モデルが issue の本文から書いたものです。
説明
-
trying to use this on Windows is producing bad EOL in output file. This is because the file is opened binary on read and pulls in '\r\n' but then the file is opened as text on output so ends up writing '\r\r\n' to the output file
-
need to support older versions of python but the following code:
from typing_extensions import AsyncIterator
gets transformed to the invalid:
from typing_extensions import Iterator -
unasync output files are invalid if they use tabbed indentation. Source tabs are getting replaced with a single space on some but not all lines. Actual error trying to run a converted file:
File "C:\cvs\gravitas_v1\incpy\esl_sync.py", line 48
if value is None:
^
IndentationError: unindent does not match any outer indentation level
- a simple way to run this by hand (setup.py is overkill for my needs) to convert a file to another file in the same directory. In my case I want to convert 'esl_async.py' to 'esl_sync.py' in the same folder. This is what I did in order to get this far:
# stdlib imports:
import os
from pathlib import Path
import sys
# 3rd-party imports:
import unasync # pip install unasync
from unasync import std_tokenize, _tokenize, _makedirs_existok
def _untokenize(tokens):
return "".join(
space + '\n' if tokval == '\r\n' else space + tokval
for space, tokval in tokens
)
class Rule( unasync.Rule ):
def __init__( self, fromdir, todir, suffix ) -> None:
self.suffix = suffix
super().__init__( fromdir, todir )
def _outfilepath( self, filepath ):
path = Path( self.todir ).absolute() / f'{Path(filepath).stem}{self.suffix}.py'
#assert False, f'{filepath=} {path=} {os.path.dirname(str(path))=}'
return str( path )
def _unasync_file( self, filepath ):
with open(filepath, "rb") as f:
write_kwargs = {}
if sys.version_info[0] >= 3:
encoding, _ = std_tokenize.detect_encoding(f.readline)
write_kwargs["encoding"] = encoding
f.seek(0)
tokens = _tokenize(f)
tokens = self._unasync_tokens(tokens)
result = _untokenize(tokens)
outfilepath = self._outfilepath( filepath )
_makedirs_existok(os.path.dirname(outfilepath))
with open(outfilepath, "w", **write_kwargs) as f:
print(result, file=f, end="")
rule = Rule( '.', '.', '_sync' )
rule._unasync_file( 'esl.py' )
- 主要言語
- Python
- スター
- 108
- フォーク
- 16
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
python-trio/unasync のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
python-trio/unasync#79 · コメント 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
python-trio/unasync#74 · コメント 4 件 · リアクション 1 件 ·
-
JITオープン
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
python-trio/unasync#72 · コメント 3 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
python-trio/unasync#69 · コメント 1 件 · リアクション 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
python-trio/unasync#68 · コメント 2 件 · リアクション 2 件 ·
python-trio/unasync の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
huggingface/peft#3955 ·
メンテナーはふだん 1 日以内に返信
-
author-page correction
難易度 2/5 1〜3時間 初心者へのやさしさ 60/100
acl-org/acl-anthology#10313 ·
メンテナーはふだん 1 日以内に返信
-
anime duplicate exception request-theme
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
LizardByte/ThemerrDB#8926 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
huggingface/transformers#49556 ·
メンテナーはふだん 1 日以内に返信
-
area/security bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
mozilla-ai/otari#2245 ·
メンテナーはふだん 1 日以内に返信