0.5.0 a couple issues on first attempt to use
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 32/100
Direzione di ricerca
Inizia riproducendo la conversion per Windows usando esl_async.py e esl_sync.py, quindi esamina la tokenizzazione e il percorso di output utilizzati dall’esempio unasync Rule. Verifica la gestione dei fine riga, degli import di typing_extensions e dell’indentazione con tabulazioni; il lavoro è completato quando i file convertiti sono validi su Windows e con le versioni precedenti di Python, ed è supportata una semplice invocazione dalla stessa directory.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
-
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' )
- Lingua principale
- Python
- Stelle
- 108
- Fork
- 16
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di python-trio/unasync
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
python-trio/unasync#79 · 1 commento ·
-
Multitoken substitution Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
python-trio/unasync#74 · 4 commenti · 1 reazione ·
-
JIT Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
python-trio/unasync#72 · 3 commenti ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
python-trio/unasync#69 · 1 commento · 1 reazione ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
python-trio/unasync#68 · 2 commenti · 2 reazioni ·
Tutte le issue di python-trio/unasync
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
xinnan-tech/xiaozhi-fde-talk#263 ·
-
rules
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
huggingface/Repo2RLEnv#163 · 1 commento ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
huggingface/sentence-transformers#4074 ·
-
comp/dashboard invalid P3
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
NousResearch/hermes-agent#121143 ·