Rename *ResultItem to just *Result #934
Merged
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.
"Item" doesn't add anything to the specificity or grammatical correctness so it can be removed.
This of course has to be backwards compatible, so the current names used by extension (
ExtensionResultItem
andExtensionSmallResultItem
) have to keep working for extension at least throughout version 6.x.x, andResultItem
also, for those extensions that use type annotations (it's just one developer doing this, but it's a valid use case at least until #933 is implemented).from ulauncher.api.shared.item.Result import Result
tofrom ulauncher.api import Result
. If you also need more than one Result variant you can now for example import like this:from ulauncher.api import Result, SmallResult
instead of two separate lines, and the plan is to move more of these classes into justulauncher.api
rather than a deeper hierchy.2.
without conflicts I also had to rename the modules, so instead of naming themResult.py
,SmallResult.py
etc they're nowsmall_result.py
. This is the the pep8 standard anyway "Modules should have short, all-lowercase names. Underscores can be used in the module name if it improves readability. Python packages should also have short, all-lowercase names, although the use of underscores is discouraged.". With this change I used init.py to define the imports with a shorter common path. For memory consumption this pattern could be negative, but not for these four imports.ResultItem.py
etc, importing the new classes and making them accessible to extensions using the old import statements. SmallResult(Item) was intentionally left out as only the other three have valid use cases for extensions. I even checked using global GitHub search to see if any extensions use SmallResult(Item), and none of them do. There's a few small number of extensions that imports it and never uses it, but they will be able to fix that easy.Checklist
./ul test
is passing (the CI server will check this if you don't)