Skip to content

Commit

Permalink
critical error removed
Browse files Browse the repository at this point in the history
  • Loading branch information
ARSadri committed Aug 29, 2024
1 parent 4f6785d commit b37673a
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 26 deletions.
8 changes: 6 additions & 2 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,12 @@ History
-------------------
* the bug in scatter3 without animation is fixed.

0.12.12 (2024-09-01)
0.12.12 (2024-09-08)
-------------------
* log_dir assertion only throws a warning
* printvar try 1.
* pyrunner try 1. is added
* pyrunner try 1. is added

0.12.12 (2024-09-08)
-------------------
* critical error removed
5 changes: 2 additions & 3 deletions lognflow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

__author__ = 'Alireza Sadri'
__email__ = '[email protected]'
__version__ = '0.12.12'
__version__ = '0.12.13'

from .lognflow import lognflow
from .logviewer import logviewer
Expand All @@ -13,10 +13,9 @@
from .utils import (
select_directory, select_file, repr_raw, replace_all,
is_builtin_collection, text_to_collection, stack_to_frame,
stacks_to_frames, ssh_system, printvar)
stacks_to_frames, ssh_system, printvar, Pyrunner)
from .multiprocessor import multiprocessor
from .loopprocessor import loopprocessor
from .pyrunner import Pyrunner
getLogger = lognflow
def basicConfig(*args, **kwargs):
...
6 changes: 4 additions & 2 deletions lognflow/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,10 @@ def show(self, globals_, figsize = (3, 2)) -> (str, int):

show_and_ask_result = question_dialog(
question='Choose a cell number', figsize=figsize, buttons=buttons)
if show_and_ask_result == str(show_and_ask_result):
if show_and_ask_result is None:
self.logger(f'pyrunner: closing reloads, press Exit to close.')
return
elif show_and_ask_result == str(show_and_ask_result):
if show_and_ask_result == 'exit':
self.exit = True
return
Expand All @@ -407,7 +410,6 @@ def show(self, globals_, figsize = (3, 2)) -> (str, int):
self.saved_state.pop(key)
self.logger(f'Deleted state: {key}')
return

elif show_and_ask_result == int(show_and_ask_result):
globals_['pyrunner_code'] = pyrunner_code
globals_['pyrunner_cell_no'] = show_and_ask_result
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.12.11
current_version = 0.12.12
commit = True
tag = True

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

__author__ = 'Alireza Sadri'
__email__ = '[email protected]'
__version__ = '0.12.12'
__version__ = '0.12.13'

with open('README.rst') as readme_file:
readme = readme_file.read()
Expand Down
27 changes: 10 additions & 17 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,13 @@ def test_is_builtin_collection():
test_tuple = (1, 2, 3)
test_array = np.array([1, 2, 3])

print(lognflow.is_builtin_collection(test_list)) # Expected: True
print(lognflow.is_builtin_collection(test_string)) # Expected: False
print(lognflow.is_builtin_collection(test_dict)) # Expected: True
print(lognflow.is_builtin_collection(test_set)) # Expected: True
print(lognflow.is_builtin_collection(test_list)) # Expected: True
print(lognflow.is_builtin_collection(test_string)) # Expected: False
print(lognflow.is_builtin_collection(test_dict)) # Expected: True
print(lognflow.is_builtin_collection(test_set)) # Expected: True
print(lognflow.is_builtin_collection(test_tuple)) # Expected: True
print(lognflow.is_builtin_collection(test_array)) # Expected: False


def test_ssh_system():
try:
ssh = ssh_system(
Expand All @@ -56,29 +55,23 @@ def test_printvar():
lognflow.utils.printvar(test1)
test2 = 123
lognflow.utils.printvar(test2)
test3 = [1243, 'sadf', 21]
test3 = [1243, 'asdf', 21]
lognflow.utils.printvar(test3)

def test_save_or_load_kernel_state():

# Example code that sets up some variables
vec = np.random.rand(100)
vec_orig = vec.copy()
another_variable = "Hello, World!"
another_variable = "Hello"

# Save the current state of the kernel (interpreter)
current_kernel_state = lognflow.utils.save_or_load_kernel_state()

# Modify the variables
vec = vec ** 2
another_variable = "Goodbye, World!"
another_variable = "Goodbye"

# Restore the previous state
lognflow.utils.save_or_load_kernel_state(current_kernel_state)

# Check that the state has been restored
assert (vec == vec_orig).all()
assert another_variable == "Hello, World!"
assert another_variable == "Hello"

print("State restored successfully!")

Expand All @@ -87,8 +80,8 @@ def test_Pyrunner():
Pyrunner(Path('./test_pyrunner_code.py'), logger = print)

if __name__ == '__main__':
test_Pyrunner();exit()
test_Pyrunner()
test_printvar()
test_is_builtin_collection()
test_stack_to_frame()
test_ssh_system()
test_ssh_system()

0 comments on commit b37673a

Please sign in to comment.