Skip to content

Commit

Permalink
sync with master
Browse files Browse the repository at this point in the history
  • Loading branch information
onuratakan committed May 24, 2024
1 parent fa6400b commit c74a651
Showing 1 changed file with 13 additions and 21 deletions.
34 changes: 13 additions & 21 deletions upsonic/remote/on_prem.py
Original file line number Diff line number Diff line change
Expand Up @@ -697,26 +697,20 @@ def set(
pass




the_type = type(value).__name__
if the_type == "type":
the_type = "class"

encryption_key = "u"

data = {
"scope": key,
"code": textwrap.dedent(self.extract_source(value)),
}

self._send_request("POST", "/dump_code", data)

the_code = textwrap.dedent(self.extract_source(value))




data = {"scope": key, "type": the_type}

self._send_request("POST", "/dump_type", data)


the_requirements = Upsonic_On_Prem.export_requirement()
Expand Down Expand Up @@ -757,21 +751,11 @@ def set(

if self.tester:
self._log(f"the_original_requirements {the_original_requirements}")
data = {
"scope": key,
"requirements": the_original_requirements,
}

self._send_request("POST", "/dump_requirements", data)


the_version = f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}"

data = {
"scope": key,
"python_version": f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}",
}

self._send_request("POST", "/dump_python_version", data)

fernet_key = base64.urlsafe_b64encode(hashlib.sha256(encryption_key.encode()).digest())
fernet = Fernet(fernet_key)
Expand Down Expand Up @@ -809,6 +793,8 @@ def set(
self._log(f"Error on extract_source while dumping {key}")
traceback.print_exc()



if extracted_needed_libraries != None:
the_engine_reports["extract_needed_libraries"] = fernet.encrypt(pickle.dumps(extracted_needed_libraries, protocol=1))

Expand All @@ -820,17 +806,23 @@ def set(

data = {
"scope": key,
"code": the_code,
"type": the_type,
"requirements": the_original_requirements,
"python_version": the_version,
"data": fernet.encrypt(dumped),
"commit_message": message
}

response = self._send_request("POST", "/dump", data)
response = self._send_request("POST", "/dump_together", data)

if response != [None]:
return True
else:
return False



def print_code(self, key, version=None):
print(self.get(key, version=version, extract_source=True))

Expand Down

0 comments on commit c74a651

Please sign in to comment.