polyapi-python 0.3.1.dev2__py3-none-any.whl → 0.3.1.dev3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- polyapi/deployables.py +8 -8
- {polyapi_python-0.3.1.dev2.dist-info → polyapi_python-0.3.1.dev3.dist-info}/METADATA +1 -1
- {polyapi_python-0.3.1.dev2.dist-info → polyapi_python-0.3.1.dev3.dist-info}/RECORD +6 -6
- {polyapi_python-0.3.1.dev2.dist-info → polyapi_python-0.3.1.dev3.dist-info}/LICENSE +0 -0
- {polyapi_python-0.3.1.dev2.dist-info → polyapi_python-0.3.1.dev3.dist-info}/WHEEL +0 -0
- {polyapi_python-0.3.1.dev2.dist-info → polyapi_python-0.3.1.dev3.dist-info}/top_level.txt +0 -0
polyapi/deployables.py
CHANGED
|
@@ -3,13 +3,13 @@ import subprocess
|
|
|
3
3
|
import json
|
|
4
4
|
import hashlib
|
|
5
5
|
from pathlib import Path
|
|
6
|
-
from typing import TypedDict, List, Dict, Tuple, Optional, Any
|
|
6
|
+
from typing import TypedDict, List, Dict, Tuple, Optional, Any, Union
|
|
7
7
|
from subprocess import check_output, CalledProcessError
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
# Constants
|
|
11
|
-
CACHE_VERSION_FILE = "
|
|
12
|
-
CACHE_DIR =
|
|
11
|
+
CACHE_VERSION_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "poly/deployments_revision")
|
|
12
|
+
CACHE_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "poly/deployables")
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
class DeployableTypes(str):
|
|
@@ -85,21 +85,21 @@ def prepare_deployable_directory() -> None:
|
|
|
85
85
|
Path(CACHE_DIR).mkdir(parents=True, exist_ok=True)
|
|
86
86
|
|
|
87
87
|
def load_deployable_records() -> List[DeployableRecord]:
|
|
88
|
-
return [read_json_file(CACHE_DIR
|
|
88
|
+
return [read_json_file(os.path.join(CACHE_DIR, name)) for name in os.listdir(CACHE_DIR) if name.endswith(".json")]
|
|
89
89
|
|
|
90
90
|
def save_deployable_records(records: List[DeployableRecord]) -> None:
|
|
91
91
|
for record in records:
|
|
92
|
-
write_json_file(
|
|
92
|
+
write_json_file(os.path.join(CACHE_DIR, f'{record["context"]}.{record["name"]}.json'), record)
|
|
93
93
|
|
|
94
94
|
def remove_deployable_records(records: List[DeployableRecord]) -> None:
|
|
95
95
|
for record in records:
|
|
96
|
-
os.remove(
|
|
96
|
+
os.remove(os.path.join(CACHE_DIR, f'{record["context"]}.{record["name"]}.json'))
|
|
97
97
|
|
|
98
|
-
def read_json_file(path: Path) -> Any:
|
|
98
|
+
def read_json_file(path: Union[str, Path]) -> Any:
|
|
99
99
|
with open(path, "r", encoding="utf-8") as file:
|
|
100
100
|
return json.load(file)
|
|
101
101
|
|
|
102
|
-
def write_json_file(path: Path, contents: Any) -> None:
|
|
102
|
+
def write_json_file(path: Union[str, Path], contents: Any) -> None:
|
|
103
103
|
with open(path, "w", encoding="utf-8") as file:
|
|
104
104
|
json.dump(contents, file, indent=2)
|
|
105
105
|
|
|
@@ -6,7 +6,7 @@ polyapi/cli.py,sha256=wXR5UE73nk26WQRbE8yK69h3h5udNrZFr85ORhbPnRs,8251
|
|
|
6
6
|
polyapi/client.py,sha256=CoFDYvyKsqL4wPQbUDIr0Qb8Q5eD92xN4OEEcJEVuGQ,1296
|
|
7
7
|
polyapi/config.py,sha256=uvEvOfWYZTLmBmZX-5jJxCzWPpwzVmEOIiQIdi98P4Y,3015
|
|
8
8
|
polyapi/constants.py,sha256=sc-FnS0SngBLvSu1ZWMs0UCf9EYD1u1Yhfr-sZXGLns,607
|
|
9
|
-
polyapi/deployables.py,sha256=
|
|
9
|
+
polyapi/deployables.py,sha256=NIFuw4nkCLn407_eTz-EO3TawsBwAlOtHh-Ti2w6bgU,12013
|
|
10
10
|
polyapi/error_handler.py,sha256=I_e0iz6VM23FLVQWJljxs2NGcl_OODbi43OcbnqBlp8,2398
|
|
11
11
|
polyapi/exceptions.py,sha256=Zh7i7eCUhDuXEdUYjatkLFTeZkrx1BJ1P5ePgbJ9eIY,89
|
|
12
12
|
polyapi/execute.py,sha256=kXnvlNQ7nz9cRlV2_5gXH09UCmyiDP5zi3wiAw0uDuk,1943
|
|
@@ -23,8 +23,8 @@ polyapi/typedefs.py,sha256=jmKprGFQSxmJXvwV53p-MFMcStmTp-tsgsynWjoVmU0,1986
|
|
|
23
23
|
polyapi/utils.py,sha256=jzCh-ivKMcgp5fIXynhYmP9UyzsISr9bGGEzdPP8n3w,7644
|
|
24
24
|
polyapi/variables.py,sha256=d36-trnfTL_8m2NkorMiImb4O3UrJbiFV38CHxV5i0A,4200
|
|
25
25
|
polyapi/webhook.py,sha256=LWv28c2MLz_OKBI_Nn7WR4C-gs1SWgbdXsoxIIf-9UI,4886
|
|
26
|
-
polyapi_python-0.3.1.
|
|
27
|
-
polyapi_python-0.3.1.
|
|
28
|
-
polyapi_python-0.3.1.
|
|
29
|
-
polyapi_python-0.3.1.
|
|
30
|
-
polyapi_python-0.3.1.
|
|
26
|
+
polyapi_python-0.3.1.dev3.dist-info/LICENSE,sha256=Hi0kDr56Dsy0uYIwNt4r9G7tI8x8miXRTlyvbeplCP8,1068
|
|
27
|
+
polyapi_python-0.3.1.dev3.dist-info/METADATA,sha256=nUHXOTJ-QXoLDdkY1hPd9-BO_r90ZDUFbnls4tp2NBs,5326
|
|
28
|
+
polyapi_python-0.3.1.dev3.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
|
|
29
|
+
polyapi_python-0.3.1.dev3.dist-info/top_level.txt,sha256=CEFllOnzowci_50RYJac-M54KD2IdAptFsayVVF_f04,8
|
|
30
|
+
polyapi_python-0.3.1.dev3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|