forked from cnheider/jord
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
430 additions
and
72 deletions.
There are no files selected for viewing
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 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from .geometry_filtering import * | ||
from .importing import * |
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import os | ||
|
||
os.environ["USE_PYGEOS"] = "0" | ||
|
||
import geopandas | ||
|
||
__all__ = ["geopandas"] |
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 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from pyplugin_installer.installer_data import repositories, plugins | ||
|
||
|
||
__all__ = ["plugin_status"] | ||
|
||
|
||
def plugin_status(plugin_key) -> str: | ||
return plugins.all()[plugin_key]["status"] | ||
|
||
|
||
# utils.reloadPlugin() |
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,4 @@ | |
from .serialisation import * | ||
from .uri_utilities import * | ||
from .client import * | ||
from .clients import * |
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from .auto import * | ||
from .interfaced import * |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
from functools import partial | ||
from typing import Callable | ||
import inspect | ||
from enum import Enum | ||
from jord.qlive_utilities import ( | ||
QliveClient, | ||
QliveRPCMethodEnum, | ||
QliveRPCMethodMap, | ||
build_package, | ||
) | ||
|
||
|
||
__all__ = ["AutoQliveClient"] | ||
|
||
|
||
class DisSatisfactionEnum(Enum): | ||
none = "none" | ||
args = "args" | ||
kws = "kws" | ||
argskws = "argskws" | ||
|
||
|
||
def partial_satisfied(partial_fn: Callable) -> bool: | ||
signature = inspect.signature(partial_fn.func) | ||
try: | ||
signature.bind(*partial_fn.args, **partial_fn.keywords) | ||
return True | ||
except TypeError: | ||
return False | ||
|
||
|
||
class AutoQliveClient(QliveClient): | ||
def __init__(self, *args, **kwargs): | ||
super().__init__(*args, **kwargs) | ||
|
||
for method in QliveRPCMethodEnum: | ||
actual_callable = QliveRPCMethodMap[method] | ||
|
||
if False: | ||
partial_build_package = partial(build_package, method) | ||
if False and partial_satisfied( | ||
partial_build_package | ||
): # TODO: RESOLVE PARTIAL APPLICATION SATISFACTION. | ||
|
||
def a(): | ||
self.send(partial_build_package()) | ||
|
||
rpc_method = a | ||
elif True: | ||
|
||
def a(*args): | ||
self.send(partial_build_package(*args)) | ||
|
||
rpc_method = a | ||
elif False: | ||
|
||
def a(**kwargs): | ||
self.send(partial_build_package(**kwargs)) | ||
|
||
rpc_method = a | ||
elif False: | ||
|
||
def a(*args, **kwargs): | ||
self.send(partial_build_package(*args, **kwargs)) | ||
|
||
rpc_method = a | ||
else: | ||
raise NotImplementedError | ||
elif False: | ||
rpc_method = lambda *args: self.send( | ||
partial(build_package, method)(*args) | ||
) | ||
elif False: | ||
rpc_method = lambda *args: self.send(build_package(method, *args)) | ||
else: | ||
|
||
def wrapped(method_, *args_) -> Callable: | ||
return self.send(build_package(method_, *args_)) | ||
|
||
rpc_method = partial(wrapped, method) | ||
|
||
rpc_method.__doc__ = actual_callable.__doc__ | ||
setattr(self, method.value, rpc_method) | ||
|
||
|
||
if __name__ == "__main__": | ||
# QliveClient().clear_all() | ||
# QliveClient().remove_layers() | ||
# print(QliveClient().clear_all.__doc__) | ||
# print(QliveClient().__dict__) | ||
def uahdsuh(): | ||
with AutoQliveClient() as qlive: | ||
qlive.add_wkts({"a": "POINT (-66.86 10.48)"}) | ||
|
||
# QliveClient().add_dataframe(None) | ||
|
||
uahdsuh() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from enum import Enum | ||
|
||
from jord.qlive_utilities.client import QliveClient | ||
|
||
|
||
__all__ = ["InterfacedQliveClient"] | ||
|
||
|
||
class InterfacedQliveClient(QliveClient): | ||
def __init__(self, *args, **kwargs): | ||
super().__init__(*args, **kwargs) |
Oops, something went wrong.