Skip to content
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

Added print_code option to get code of scope #10

Merged
merged 1 commit into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ upsonic_cache/
.vscode

test.py
test.ipynb

test_backup
*.Upsonic
Expand Down
16 changes: 9 additions & 7 deletions upsonic/remote/on_prem.py
Original file line number Diff line number Diff line change
Expand Up @@ -815,12 +815,7 @@ def set(
self._log(f"Error on extract_source while dumping {key}")
traceback.print_exc()

try:
the_engine_reports["extract_source"] = fernet.encrypt(pickle.dumps(extract_source(value, self.tester), protocol=1))
except:
if self.tester:
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 @@ -844,14 +839,19 @@ def set(
else:
return False


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

def get(
self,
key,
version=None,
print_exc=True,
pass_python_version_control=False,
pass_usage_analyses=False,
try_to_extract_importable=False
try_to_extract_importable=False,
extract_source=False

):
if self.tester:
Expand Down Expand Up @@ -928,6 +928,8 @@ def get(
self._log(f"Error on extracted_local_files while loading {key}")
traceback.print_exc()
response.pop("extracted_local_files")
if extract_source:
return pickle.loads(fernet.decrypt(response["extract_source"]))
if "extract_source" in response:
response.pop("extract_source")
needed_libraries = None
Expand Down
Loading