provinzkraut / unasyncd Goto Github PK
View Code? Open in Web Editor NEWTransforming asynchronous to synchronous Python code
License: MIT License
Transforming asynchronous to synchronous Python code
License: MIT License
Removal of unused imports was removed in #1, since it was quite rough around the edges, not very performant, and its use discouraged.
The reason for all of this was mainly that such a feature isn't all that easy to get right, and I don't think it serves anyone if unasyncd re-implements something that other tools have already solved.
However, due to the nature of unasyncd, not removing unused imports that have become unused as a result of the transformation can cause some issues.
For example, running unasyncd within pre-commit before a tool that removes said imports, pre-commit will never reach a stable state, since it's going to be stuck in a loop of "Unasyncd transforms > unused imports are removed", since after the imports are removed, and unasyncd is run again, the state of the target file will not match what unasyncd expects, and it will re-apply the transfomations, adding back the unused imports.
The current solution to this problem is to structure code in such a way that imports won't get removed, e.g. by adding the needed synced version imports to the async file. This is far from ideal, so a better solution should be implemented.
Of the two approaches, I think 1) would be the "correct" solution in the long term, but a lot of things get more complex (exclusions for example would have to track fully qualified names across the transformations), and less performant, since scanning and transforming couldn't be done simultaneous anymore.
For the time being, it seems to me that 2) is the right way to go about this.
Currently only 3.11 is officially supported and tested, but there's nothing in the code that makes a bit more backwards compatibility impossible. 3.9 will be required as a minimum though, since it introduced ast.unparse
which can't be easily replaced.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.