-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improvements for programmatic usage #55
Open
queengooborg
wants to merge
33
commits into
hube12:master
Choose a base branch
from
queengooborg:main
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
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 step only happens if running in manual mode, so I can't imagine it's quite useful.
Manual mode is really only helpful for debugging, but not really, because each step can only run if the previous step had. Implementing the ability to pick and choose steps just adds additional complexity to the program for very little gain.
"--forceno" is on by default, but the only reason to set it to False is to enable interactivity when it detects the conflict. This just adds more complexity to the code, and the better option is to simply have the user specify "--clean" or "--force" instead.
hube12
pushed a commit
that referenced
this pull request
Nov 2, 2024
- Add the path used to open the program from to all relative paths, so program doesn't create new folders in a directory outside the one it's located within - Replace sys.exits with exception raising (see #55) - Replace assertion (which can be compiled out) with unskippable test + exception - Tweak url['..._mappings'] code so correct exception is raised (#50) - Standardize pathlib usage - Some code restructuring to reduce the amount of indentation - Add some typing - Grammar fixes in code outputs/errors - Add TODOs to mark areas for future improvement
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR performs a number of changes tailored towards improving the experience when using DecompilerMC as a module, rather than as a script.
User Story
I use DecompilerMC as a dependency in a toolkit that reads the source code for Minecraft and calculates all of its items and their crafting recipes, which is then used to generate a
worth.yml
file for EssentialsX.However, I had to make some adjustments to its code to get it to work in the manner I desired it to. The primary issue I ran into was that
sys.exit()
was used quite often throughout the code when there was an error, which means that any script that imported it as a module would also quit on error.Solution
To improve the experience for module use, as well as to provide other minor improvements, the following changes were made:
sys.exit()
with thrown exceptionspathlib.Path
for most filepaths, rather than stringsmanifest.json
after parsing, only when redownloading