-
Notifications
You must be signed in to change notification settings - Fork 44
refactor Python API to be more pythonic - part 2 #321
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
Merged
hendrikmuhs
merged 15 commits into
KeyviDev:master
from
hendrikmuhs:deprecate-old-methods
Feb 18, 2025
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
11a2307
deprecate some methods
hendrikmuhs 087778d
rename compiler methods
hendrikmuhs 93b348f
fix sk compilers
hendrikmuhs ff9b681
deprecate SmallData compilers
hendrikmuhs 72afece
rewrite merger methods
hendrikmuhs 4353504
rename index methods
hendrikmuhs 9201557
rename methods in tests
hendrikmuhs ef2b5df
rename forward backward completion methods
hendrikmuhs 6755a04
rewrite generator
hendrikmuhs 3d0b30f
refactor MultiwordCompletion
hendrikmuhs 8d5e15c
rename methods for normalization and predictive compression
hendrikmuhs ce4f1cc
adapt prefix completions
hendrikmuhs 8143b21
change vector API
hendrikmuhs 7a05a87
whitespace fixes
hendrikmuhs 367ad24
rename mset to bulk_set
hendrikmuhs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
|
|
||
|
|
||
| def Add(self, *args): | ||
| return call_deprecated_method("Add", "add", self.add, *args) | ||
|
|
||
| def Merge(self, *args): | ||
| return call_deprecated_method("Merge", "merge", self.merge, *args) | ||
|
|
||
| def SetManifest(self, *args): | ||
| return call_deprecated_method("SetManifest", "set_manifest", self.set_manifest, *args) | ||
|
|
||
|
|
This file contains hidden or 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 file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
|
|
||
|
|
||
| def GetCompletions(self, *args): | ||
| return call_deprecated_method("GetCompletions", "complete", self.complete, *args) | ||
This file contains hidden or 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 file contains hidden or 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 file was deleted.
Oops, something went wrong.
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
|
|
||
|
|
||
| def Add(self, *args): | ||
| return call_deprecated_method("Add", "add", self.add, *args) | ||
|
|
||
| def Merge(self, *args): | ||
| return call_deprecated_method("Merge", "merge", self.merge, *args) | ||
|
|
||
| def SetManifest(self, *args): | ||
| return call_deprecated_method("SetManifest", "set_manifest", self.set_manifest, *args) | ||
|
|
||
|
|
This file contains hidden or 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 file was deleted.
Oops, something went wrong.
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
|
|
||
|
|
||
| def Add(self, *args): | ||
| return call_deprecated_method("Add", "add", self.add, *args) | ||
|
|
||
| def Merge(self, *args): | ||
| return call_deprecated_method("Merge", "merge", self.merge, *args) | ||
|
|
||
| def SetManifest(self, *args): | ||
| return call_deprecated_method("SetManifest", "set_manifest", self.set_manifest, *args) | ||
|
|
||
|
|
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,17 @@ | ||
|
|
||
|
|
||
| def Get(self, index ): | ||
| def __getitem__(self, index ): | ||
| assert isinstance(index, (int, long)), 'arg index wrong type' | ||
|
|
||
| cdef libcpp_utf8_string _r = self.inst.get().Get((<size_t>index)) | ||
| py_result = json.loads(_r.decode('utf-8')) | ||
| return py_result | ||
|
|
||
| def Get(self, *args): | ||
| return call_deprecated_method("Get", "__getitem__", self.__getitem__, *args) | ||
|
|
||
| def Size(self, *args): | ||
| return call_deprecated_method("Size", "__len__", self.__len__, *args) | ||
|
|
||
| def Manifest(self, *args): | ||
| return call_deprecated_method("Manifest", "manifest", self.manifest, *args) |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,14 @@ | ||
|
|
||
|
|
||
| def PushBack(self, in_0 ): | ||
| def append(self, in_0 ): | ||
| dumps = json.dumps(in_0).encode('utf-8') | ||
| self.inst.get().PushBack((<libcpp_utf8_string>dumps)) | ||
|
|
||
| def PushBack(self, *args): | ||
| return call_deprecated_method("PushBack", "append", self.append, *args) | ||
|
|
||
| def SetManifest(self, *args): | ||
| return call_deprecated_method("SetManifest", "set_manifest", self.set_manifest, *args) | ||
|
|
||
| def WriteToFile(self, *args): | ||
| return call_deprecated_method("WriteToFile", "write_to_file", self.write_to_file, *args) |
This file contains hidden or 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 file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
|
|
||
|
|
||
| def Add(self, *args): | ||
| return call_deprecated_method("Add", "add", self.add, *args) | ||
|
|
||
| def CloseFeeding(self, *args): | ||
| return call_deprecated_method("CloseFeeding", "close_feeding", self.close_feeding, *args) | ||
|
|
||
| def WriteToFile(self, *args): | ||
| return call_deprecated_method("WriteToFile", "write_to_file", self.write_to_file, *args) |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
|
|
||
|
|
||
| def Add(self, *args): | ||
| return call_deprecated_method("Add", "add", self.add, *args) | ||
|
|
||
| def Merge(self, *args): | ||
| return call_deprecated_method("Merge", "merge", self.merge, *args) | ||
|
|
||
| def SetManifest(self, *args): | ||
| return call_deprecated_method("SetManifest", "set_manifest", self.set_manifest, *args) | ||
|
|
||
|
|
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
|
|
||
|
|
||
| def GetCompletions(self, *args): | ||
| return call_deprecated_method("GetCompletions", "complete", self.complete, *args) |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
|
|
||
|
|
||
| def GetCompletions(self, *args): | ||
| return call_deprecated_method("GetCompletions", "complete", self.complete, *args) | ||
|
|
||
| def GetFuzzyCompletions(self, *args): | ||
| return call_deprecated_method("GetFuzzyCompletions", "complete_fuzzy", self.complete_fuzzy, *args) |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't
get_completionsbetter ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔
In a previous change I named it like this:
avoiding prefixes like
get_There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, okie ...