0.5.0 a couple issues on first attempt to use
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 32/100
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện quá trình chuyển đổi trên Windows bằng esl_async.py và esl_sync.py, sau đó kiểm tra tokenization và đường dẫn đầu ra được unasync Rule example sử dụng. Kiểm tra việc xử lý ký tự kết thúc dòng, các import typing_extensions và thụt lề bằng tab; công việc được xem là hoàn tất khi các tệp đã chuyển đổi hợp lệ trên Windows và các phiên bản Python cũ hơn, đồng thời hỗ trợ cách gọi đơn giản từ cùng một thư mục.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
-
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' )
- Ngôn ngữ chính
- Python
- Star
- 108
- Fork
- 16
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của python-trio/unasync
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
python-trio/unasync#79 · 1 bình luận ·
-
Multitoken substitutionĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
python-trio/unasync#74 · 4 bình luận · 1 reaction ·
-
JITĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
python-trio/unasync#72 · 3 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
python-trio/unasync#69 · 1 bình luận · 1 reaction ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
python-trio/unasync#68 · 2 bình luận · 2 reaction ·
Tất cả issue của python-trio/unasync
Issue tương tự
-
enhancement good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
hatchet-dev/hatchet#5179 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Update Python support to 3.15Đang mởpython-version
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug javascript P2-medium python release:v3.1
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
adrirubio/claude-deck#546 ·
Maintainer thường phản hồi trong vòng 1 ngày