From 5f199c30ec890a131452ee9892c7115c5b684467 Mon Sep 17 00:00:00 2001 From: davidedellagiustina Date: Fri, 12 Jan 2024 11:22:41 +0000 Subject: [PATCH] Fix justfile and modules --- justfile | 11 +++++++---- src/examples/__init__.py | 2 -- src/examples/grover_search_known_m.py | 2 +- src/examples/grover_search_unknown_m.py | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) delete mode 100644 src/examples/__init__.py diff --git a/justfile b/justfile index acf8b90..f79805d 100644 --- a/justfile +++ b/justfile @@ -1,8 +1,7 @@ python_path := '.' -# Dummy default recipe, just to avoid running undesired commands if no argument is supplied _default: - @echo "Run \`just -l' to list the available recipies" + @ just -l # Run format and lint checks corresponding to those run by the GitHub CI action ci: @@ -11,8 +10,12 @@ ci: # List the available examples list: - @ls -lA ./src/examples/ | tail -n +2 | awk '{print $9}' | sed 's/\.py//' | sed '/pycache/d' + @ ls -lA ./src/examples/ | tail -n +2 | awk '{print $9}' | sed 's/\.py//' | sed '/__/d' # Run a selected example from the examples folder run example: - PYTHONPATH={{python_path}} python ./src/examples/{{example}}.py + ( \ + export PYTHONPATH={{python_path}}; \ + export NAME=`echo {{example}} | sed 's/\.py//'`; \ + python ./src/examples/$NAME.py \ + ) diff --git a/src/examples/__init__.py b/src/examples/__init__.py deleted file mode 100644 index 1a4d046..0000000 --- a/src/examples/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -'''QASP examples. -''' diff --git a/src/examples/grover_search_known_m.py b/src/examples/grover_search_known_m.py index 50f9177..a513a35 100644 --- a/src/examples/grover_search_known_m.py +++ b/src/examples/grover_search_known_m.py @@ -2,7 +2,7 @@ ''' from src import qasp -from .util import tab, pause +from src.examples.util import tab, pause # ASP program PRGM = ''' diff --git a/src/examples/grover_search_unknown_m.py b/src/examples/grover_search_unknown_m.py index faa1c2f..fa6191a 100644 --- a/src/examples/grover_search_unknown_m.py +++ b/src/examples/grover_search_unknown_m.py @@ -3,7 +3,7 @@ ''' from src import qasp -from .util import tab, pause +from src.examples.util import tab, pause # ASP program PRGM = '''