diff --git a/.github/workflows/check_links.yml b/.github/workflows/check_links.yml
index d89bef7..470be91 100644
--- a/.github/workflows/check_links.yml
+++ b/.github/workflows/check_links.yml
@@ -1,6 +1,6 @@
name: Check Links
-on:
+on:
schedule:
- cron: '45 01 30 * *'
pull_request:
@@ -18,12 +18,16 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
- python-version: '3.x'
+ python-version: '3.11'
+
+ - name: Set up uv
+ uses: astral-sh/setup-uv@v5
+
+ - name: Create virtual environment
+ run: uv venv
- name: Install dependencies
- run: |
- python -m pip install --upgrade pip
- python -m pip install pytest pytest-xdist requests jupyter lxml numpy matplotlib scipy sympy
+ run: uv pip install pytest pytest-xdist requests jupyter lxml numpy matplotlib scipy sympy
- name: Check links
- run: python -m pytest -n auto ./tests/test_check_links_in_ipynb.py ./utils/tests/
+ run: uv run pytest -n auto ./tests/test_check_links_in_ipynb.py ./utils/tests/
diff --git a/.github/workflows/conda_env_test.yml b/.github/workflows/conda_env_test.yml
index c3a4e1c..74f9793 100644
--- a/.github/workflows/conda_env_test.yml
+++ b/.github/workflows/conda_env_test.yml
@@ -1,10 +1,19 @@
name: CI
-on:
+on:
+ schedule:
+ - cron: '45 01 30 * *'
+
push:
+
pull_request:
+ branches: [main]
+
+ fork:
+
workflow_dispatch:
+
jobs:
badges:
name: Add Google Colab Badges
@@ -19,45 +28,56 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
- python-version: '3.x'
+ python-version: '3.11'
+
+ - name: Set up uv
+ uses: astral-sh/setup-uv@v5
+
+ - name: Create virtual environment
+ run: uv venv
- name: Install dependencies
- run: |
- python -m pip install --upgrade pip
- python -m pip install bs4 jupyter lxml
+ run: uv pip install beautifulsoup4 jupyter lxml
- name: Add/Update badges
- run: python ./utils/add_colab_main_buttons.py
+ run: uv run python ./utils/add_colab_main_buttons.py
- name: Commit & push
uses: stefanzweifel/git-auto-commit-action@v5
with:
- commit_message: "Add Google Colab badges"
+ commit_message: "Clean ipynb ${{ github.sha }}"
test_ipynb:
needs: badges
- name: Test ipynb with Anaconda ${{ matrix.anaconda }}
+ name: Test ipynb on ${{ matrix.environment.name }} of ${{ matrix.os }}
runs-on: ubuntu-latest
strategy:
matrix:
- anaconda: ["2021.11", "nightly"]
+ environment:
+ - {name: '2021.11', python-version: "3.9.4"}
+ - {name: '2020.10', python-version: "3.10"}
+ - {name: 'nightly', python-version: "3"}
+ os: [ubuntu-latest, macos-latest, windows-latest,]
fail-fast: false
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4
- - name: Set up Miniconda
- uses: conda-incubator/setup-miniconda@v3
- with:
- auto-update-conda: true
- miniconda-version: "latest"
- environment-file: ./tests/environment.${{ matrix.anaconda }}.yml
- activate-environment: test-environment
+ - name: Set up uv
+ uses: astral-sh/setup-uv@v5
+
+ - name: Create virtual environment
+ run: uv venv test-env-${{ matrix.environment.name }} --python ${{ matrix.environment.python-version }}
+
+ - name: Install dependencies
+ run: |
+ source test-env-${{ matrix.environment.name }}/bin/activate
+ uv pip install -r tests/requirements.${{ matrix.environment.name }}.txt
- name: Run tests
- shell: bash -l {0}
env:
TEST_IPYNB_IGNORE_FOLDER: tutorial
run: |
- pytest --numprocesses=auto -k 'not (links or update_nmisp_py)' tests/
\ No newline at end of file
+ source test-env-${{ matrix.environment.name }}/bin/activate
+ uv run pytest --numprocesses=auto -k 'not (links or update_nmisp_py)' tests/
diff --git a/00.python-c-cpp/00.python.ipynb b/00.python-c-cpp/00.python.ipynb
index 5dd5e87..9478cf0 100644
--- a/00.python-c-cpp/00.python.ipynb
+++ b/00.python-c-cpp/00.python.ipynb
@@ -7,7 +7,7 @@
"colab_type": "text"
},
"source": [
- "
\n"
+ "
\n"
]
},
{
diff --git a/00.python-c-cpp/10.c-cpp.ipynb b/00.python-c-cpp/10.c-cpp.ipynb
index 561c5df..8f4e50a 100644
--- a/00.python-c-cpp/10.c-cpp.ipynb
+++ b/00.python-c-cpp/10.c-cpp.ipynb
@@ -7,7 +7,7 @@
"colab_type": "text"
},
"source": [
- "
\n"
+ "
\n"
]
},
{
diff --git a/00.python-c-cpp/20.bash.ipynb b/00.python-c-cpp/20.bash.ipynb
index 3a5b268..4469795 100644
--- a/00.python-c-cpp/20.bash.ipynb
+++ b/00.python-c-cpp/20.bash.ipynb
@@ -7,7 +7,7 @@
"colab_type": "text"
},
"source": [
- "
\n"
+ "
\n"
]
},
{
diff --git a/10.data-types-and-operators/00.git.ipynb b/10.data-types-and-operators/00.git.ipynb
index b784aae..1506e45 100644
--- a/10.data-types-and-operators/00.git.ipynb
+++ b/10.data-types-and-operators/00.git.ipynb
@@ -7,7 +7,7 @@
"colab_type": "text"
},
"source": [
- "
\n"
+ "
\n"
]
},
{
diff --git a/10.data-types-and-operators/10.types.ipynb b/10.data-types-and-operators/10.types.ipynb
index fc98633..e9bf42c 100644
--- a/10.data-types-and-operators/10.types.ipynb
+++ b/10.data-types-and-operators/10.types.ipynb
@@ -7,7 +7,7 @@
"colab_type": "text"
},
"source": [
- "
\n"
+ "
\n"
]
},
{
diff --git a/10.data-types-and-operators/20.operators.ipynb b/10.data-types-and-operators/20.operators.ipynb
index 1b895d9..f910943 100644
--- a/10.data-types-and-operators/20.operators.ipynb
+++ b/10.data-types-and-operators/20.operators.ipynb
@@ -7,7 +7,7 @@
"colab_type": "text"
},
"source": [
- "
\n"
+ "
\n"
]
},
{
diff --git a/20.control-flow/00.if.ipynb b/20.control-flow/00.if.ipynb
index 6abafc5..5bf494b 100644
--- a/20.control-flow/00.if.ipynb
+++ b/20.control-flow/00.if.ipynb
@@ -7,7 +7,7 @@
"colab_type": "text"
},
"source": [
- "
\n"
+ "
\n"
]
},
{
diff --git a/20.control-flow/10.for-while.ipynb b/20.control-flow/10.for-while.ipynb
index 9611705..a4f0bb1 100644
--- a/20.control-flow/10.for-while.ipynb
+++ b/20.control-flow/10.for-while.ipynb
@@ -7,7 +7,7 @@
"colab_type": "text"
},
"source": [
- "
\n"
+ "
\n"
]
},
{
diff --git a/20.control-flow/20.functions.ipynb b/20.control-flow/20.functions.ipynb
index f331148..79de987 100644
--- a/20.control-flow/20.functions.ipynb
+++ b/20.control-flow/20.functions.ipynb
@@ -7,7 +7,7 @@
"colab_type": "text"
},
"source": [
- "
\n"
+ "
\n"
]
},
{
diff --git a/30.pointers-and-memory-management/00.pointers.ipynb b/30.pointers-and-memory-management/00.pointers.ipynb
index ade1fbf..e44435d 100644
--- a/30.pointers-and-memory-management/00.pointers.ipynb
+++ b/30.pointers-and-memory-management/00.pointers.ipynb
@@ -7,7 +7,7 @@
"colab_type": "text"
},
"source": [
- "
\n"
+ "
\n"
]
},
{
diff --git a/30.pointers-and-memory-management/10.calloc-free.ipynb b/30.pointers-and-memory-management/10.calloc-free.ipynb
index 75094f6..ab2a015 100644
--- a/30.pointers-and-memory-management/10.calloc-free.ipynb
+++ b/30.pointers-and-memory-management/10.calloc-free.ipynb
@@ -7,7 +7,7 @@
"colab_type": "text"
},
"source": [
- "
\n"
+ "
\n"
]
},
{
diff --git a/30.pointers-and-memory-management/20.python.list-reference.ipynb b/30.pointers-and-memory-management/20.python.list-reference.ipynb
index 938d058..c5abb6b 100644
--- a/30.pointers-and-memory-management/20.python.list-reference.ipynb
+++ b/30.pointers-and-memory-management/20.python.list-reference.ipynb
@@ -7,7 +7,7 @@
"colab_type": "text"
},
"source": [
- "
\n"
+ "
\n"
]
},
{
diff --git a/40.object-oriented-programming/00.module-namespace.ipynb b/40.object-oriented-programming/00.module-namespace.ipynb
index 4d158ce..f7852de 100644
--- a/40.object-oriented-programming/00.module-namespace.ipynb
+++ b/40.object-oriented-programming/00.module-namespace.ipynb
@@ -7,7 +7,7 @@
"colab_type": "text"
},
"source": [
- "
\n"
+ "
\n"
]
},
{
diff --git a/40.object-oriented-programming/10.class.ipynb b/40.object-oriented-programming/10.class.ipynb
index 9f3ac11..db1589f 100644
--- a/40.object-oriented-programming/10.class.ipynb
+++ b/40.object-oriented-programming/10.class.ipynb
@@ -7,7 +7,7 @@
"colab_type": "text"
},
"source": [
- "
\n"
+ "
\n"
]
},
{
diff --git a/40.object-oriented-programming/20.private-protected-public.ipynb b/40.object-oriented-programming/20.private-protected-public.ipynb
index 750ac4b..6ea30ff 100644
--- a/40.object-oriented-programming/20.private-protected-public.ipynb
+++ b/40.object-oriented-programming/20.private-protected-public.ipynb
@@ -7,7 +7,7 @@
"colab_type": "text"
},
"source": [
- "
\n"
+ "
\n"
]
},
{
diff --git a/40.object-oriented-programming/30.state-space-in-class.ipynb b/40.object-oriented-programming/30.state-space-in-class.ipynb
index 107c75b..a5f7f1a 100644
--- a/40.object-oriented-programming/30.state-space-in-class.ipynb
+++ b/40.object-oriented-programming/30.state-space-in-class.ipynb
@@ -7,7 +7,7 @@
"colab_type": "text"
},
"source": [
- "
\n"
+ "
\n"
]
},
{
diff --git a/40.object-oriented-programming/40.dataclasses.dataclass.ipynb b/40.object-oriented-programming/40.dataclasses.dataclass.ipynb
index a90e28d..82e693d 100644
--- a/40.object-oriented-programming/40.dataclasses.dataclass.ipynb
+++ b/40.object-oriented-programming/40.dataclasses.dataclass.ipynb
@@ -7,7 +7,7 @@
"colab_type": "text"
},
"source": [
- "
\n"
+ "
\n"
]
},
{
diff --git a/50.under-the-hood/00.gdb.ipynb b/50.under-the-hood/00.gdb.ipynb
index 7b9a835..9ae5270 100644
--- a/50.under-the-hood/00.gdb.ipynb
+++ b/50.under-the-hood/00.gdb.ipynb
@@ -7,7 +7,7 @@
"colab_type": "text"
},
"source": [
- "
\n"
+ "
\n"
]
},
{
diff --git a/50.under-the-hood/10.cython.ipynb b/50.under-the-hood/10.cython.ipynb
index 838398d..a82a5f2 100644
--- a/50.under-the-hood/10.cython.ipynb
+++ b/50.under-the-hood/10.cython.ipynb
@@ -7,7 +7,7 @@
"colab_type": "text"
},
"source": [
- "
\n"
+ "
\n"
]
},
{
diff --git a/50.under-the-hood/22.working_with_bits_operators.ipynb b/50.under-the-hood/22.working_with_bits_operators.ipynb
index 3e72906..d2e9182 100644
--- a/50.under-the-hood/22.working_with_bits_operators.ipynb
+++ b/50.under-the-hood/22.working_with_bits_operators.ipynb
@@ -7,7 +7,7 @@
"colab_type": "text"
},
"source": [
- "
\n"
+ "
\n"
]
},
{
diff --git a/50.under-the-hood/24.working_with_bits_operators_results.md b/50.under-the-hood/24.working_with_bits_operators_results.md
index f1dda90..4598e6e 100644
--- a/50.under-the-hood/24.working_with_bits_operators_results.md
+++ b/50.under-the-hood/24.working_with_bits_operators_results.md
@@ -1,5 +1,5 @@
* Let's take a look at the assembly instructions.
-```
+```
24:bitwise_16bit_color.cpp **** uint32_t hex = 0;
565 .loc 6 24 0
566 00cf C745C400 movl $0, -60(%rbp)
diff --git a/50.under-the-hood/28.working_with_bits_struct_union.ipynb b/50.under-the-hood/28.working_with_bits_struct_union.ipynb
index 8748c0c..4ce9789 100644
--- a/50.under-the-hood/28.working_with_bits_struct_union.ipynb
+++ b/50.under-the-hood/28.working_with_bits_struct_union.ipynb
@@ -7,7 +7,7 @@
"colab_type": "text"
},
"source": [
- "
\n"
+ "
\n"
]
},
{
diff --git a/tests/check_links_in_ipynb.py b/tests/check_links_in_ipynb.py
index 771c80c..f0535f2 100644
--- a/tests/check_links_in_ipynb.py
+++ b/tests/check_links_in_ipynb.py
@@ -72,5 +72,5 @@ def check_links_in_ipynb_cells_list(cells_list):
# check simple urls
check_link_in_cell(cell, rs)
- # check urls linked to
+ # check urls linked to
check_link_in_cell(cell, ri)
diff --git a/tests/get_cpp_from_ipynb.py b/tests/get_cpp_from_ipynb.py
index 2e601d5..27faf13 100644
--- a/tests/get_cpp_from_ipynb.py
+++ b/tests/get_cpp_from_ipynb.py
@@ -28,7 +28,7 @@ def is_markdown_cpp_src(ipynb_cell):
src = ipynb_cell['source'].strip()
# Multiline code block within ```'s
- if (src.startswith('```')
+ if (src.startswith('```')
and src.endswith('```')):
# check C++ right after ```
@@ -100,7 +100,7 @@ def get_build_command_in_last_line(cpp_txt):
if 4 < len(line.lower().split()):
# Check words
if (
- ('build' == line.lower().split()[1])
+ ('build' == line.lower().split()[1])
and ('command' == line.lower().split()[2])
and (':' == line.lower().split()[3])
):
diff --git a/tests/requirements.2021.11.txt b/tests/requirements.2021.11.txt
new file mode 100644
index 0000000..2571eb1
--- /dev/null
+++ b/tests/requirements.2021.11.txt
@@ -0,0 +1,17 @@
+# python==3.9.4
+cython==0.29.24
+jupyter==1.0.0
+lxml==4.9.1
+matplotlib==3.4.3
+numpy==1.20.3
+pandas==1.3.4
+pandas-datareader==0.10.0
+pytest==6.2.4
+pytest-xdist==2.3.0
+requests==2.26.0
+scikit-learn==0.24.2
+scipy==1.7.1
+seaborn==0.11.2
+statsmodels==0.12.2
+sympy==1.9
+xlwt==1.3.0
diff --git a/tests/requirements.2022.10.txt b/tests/requirements.2022.10.txt
new file mode 100644
index 0000000..c5ed159
--- /dev/null
+++ b/tests/requirements.2022.10.txt
@@ -0,0 +1,17 @@
+# python==3.10
+cython==0.29.32
+jupyter==1.0.0
+lxml==4.9.1
+matplotlib==3.5.2
+numpy==1.21.5
+pandas==1.4.4
+pandas-datareader==0.10.0
+pytest==7.1.2
+pytest-xdist==2.5.0
+requests==2.28.1
+scikit-learn==1.0.1
+scipy==1.9.1
+seaborn==0.11.2
+statsmodels==0.13.2
+sympy==1.10.1
+xlwt==1.3.0
diff --git a/tests/requirements.nightly.txt b/tests/requirements.nightly.txt
new file mode 100644
index 0000000..69115ff
--- /dev/null
+++ b/tests/requirements.nightly.txt
@@ -0,0 +1,17 @@
+# python
+cython
+jupyter
+lxml
+matplotlib
+numpy
+pandas
+pandas-datareader
+pytest
+pytest-xdist
+requests
+scikit-learn
+scipy
+seaborn
+statsmodels
+sympy
+xlwt
diff --git a/tests/test_check_links_in_ipynb.py b/tests/test_check_links_in_ipynb.py
index af9bb06..c5bd91c 100644
--- a/tests/test_check_links_in_ipynb.py
+++ b/tests/test_check_links_in_ipynb.py
@@ -41,7 +41,7 @@ def test_check_links_in_ipynb_cells_list():
'text': '[](https://www.youtube.com/user/CppCon/videos)\n\n',
'urls': {
'https://i.ytimg.com/vi/PorfLSr3DDI/hqdefault.jpg',
- }
+ }
},
{
'text': '* You could use following [command](https://stackoverflow.com/questions/8305866/how-to-analyze-a-programs-core-dump-file-with-gdb) to analyze.
\n``` sh\ngdb -c \n```',
@@ -121,7 +121,7 @@ def test_get_re_markdown_simple_link():
'text': '[](link_here)\n\n',
'urls': {
'link_here',
- }
+ }
},
]
@@ -376,10 +376,10 @@ def test_check_link_in_cell():
"[ref0](https://en.wikipedia.org/wiki/New_and_delete_(C%2B%2B))\n",
"\n"
])
- }
+ }
r = cli.get_re_markdown_simple_link()
-
+
# function under test
# success case
cli.check_link_in_cell(google_cell, r)
diff --git a/tests/test_gcpp_2nd_line_filename.py b/tests/test_gcpp_2nd_line_filename.py
index 74330e8..658c865 100644
--- a/tests/test_gcpp_2nd_line_filename.py
+++ b/tests/test_gcpp_2nd_line_filename.py
@@ -22,21 +22,21 @@
"""
cpp_test_cases = [
- ('// ``` C++\n// Begin account_module.h\n#include \n\nvoid deposit (int32_t amount);\nvoid withdraw (int32_t amount);\nint32_t check();\n// End account_module.h\n// ```',
+ ('// ``` C++\n// Begin account_module.h\n#include \n\nvoid deposit (int32_t amount);\nvoid withdraw (int32_t amount);\nint32_t check();\n// End account_module.h\n// ```',
'account_module.h'),
- ('// ``` C++\n// Begin account_module.cpp\n#include \n#include \n\n#include "account_module.h"\n\nusing namespace std;\n\nint32_t balance;\n\n\nvoid deposit (int32_t amount){\n cout << "Deposit " << amount << \'\\n\';\n balance += amount;\n}\n\n\nvoid withdraw (int32_t amount){\n cout << "Depowithdrawsit " << amount << \'\\n\';\n balance += -amount;\n}\n\n\nint32_t check(){\n return balance;\n}\n// End account_module.cpp\n// ```\n\n',
+ ('// ``` C++\n// Begin account_module.cpp\n#include \n#include \n\n#include "account_module.h"\n\nusing namespace std;\n\nint32_t balance;\n\n\nvoid deposit (int32_t amount){\n cout << "Deposit " << amount << \'\\n\';\n balance += amount;\n}\n\n\nvoid withdraw (int32_t amount){\n cout << "Depowithdrawsit " << amount << \'\\n\';\n balance += -amount;\n}\n\n\nint32_t check(){\n return balance;\n}\n// End account_module.cpp\n// ```\n\n',
'account_module.cpp'),
- ('\n// ``` C++\n// Begin account_module_user.cpp\n#include \n#include \n\n#include "account_module.h"\n\nusing namespace std;\n\nint32_t main(int32_t argn, char * argv[]){\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n deposit(10000);\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n withdraw(3000);\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n deposit(5000);\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n return 0;\n}\n// End account_module_user.cpp\n// ```\n\n',
+ ('\n// ``` C++\n// Begin account_module_user.cpp\n#include \n#include \n\n#include "account_module.h"\n\nusing namespace std;\n\nint32_t main(int32_t argn, char * argv[]){\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n deposit(10000);\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n withdraw(3000);\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n deposit(5000);\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n return 0;\n}\n// End account_module_user.cpp\n// ```\n\n',
'account_module_user.cpp'),
- ('// ``` C++\n// Begin account_module.h\n#include \n\nnamespace account {\n void deposit (int32_t amount);\n void withdraw (int32_t amount);\n int32_t check();\n}\n// End account_module.h\n// ```',
+ ('// ``` C++\n// Begin account_module.h\n#include \n\nnamespace account {\n void deposit (int32_t amount);\n void withdraw (int32_t amount);\n int32_t check();\n}\n// End account_module.h\n// ```',
'account_module.h'),
- ('// ``` C++\n// Begin account_module.cpp\n#include \n#include \n\n#include "account_module.h"\n\nusing namespace std;\n\nnamespace account{\n int32_t balance;\n\n void deposit (int32_t amount){\n cout << "Deposit " << amount << \'\\n\';\n balance += amount;\n }\n\n void withdraw (int32_t amount){\n cout << "Depowithdrawsit " << amount << \'\\n\';\n balance += -amount;\n }\n\n int32_t check(){\n return balance;\n }\n}\n// End account_module.cpp\n// ```\n\n',
+ ('// ``` C++\n// Begin account_module.cpp\n#include \n#include \n\n#include "account_module.h"\n\nusing namespace std;\n\nnamespace account{\n int32_t balance;\n\n void deposit (int32_t amount){\n cout << "Deposit " << amount << \'\\n\';\n balance += amount;\n }\n\n void withdraw (int32_t amount){\n cout << "Depowithdrawsit " << amount << \'\\n\';\n balance += -amount;\n }\n\n int32_t check(){\n return balance;\n }\n}\n// End account_module.cpp\n// ```\n\n',
'account_module.cpp'),
- ('\n// ``` C++\n// Begin account_module_user.cpp\n#include \n#include \n\n#include "account_module.h"\n\nusing namespace std;\n\nint32_t main(int32_t argn, char ** argv){\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n account::deposit(10000);\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n account::withdraw(3000);\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n account::deposit(5000);\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n return 0;\n}\n// End account_module_user.cpp\n// ```\n\n',
+ ('\n// ``` C++\n// Begin account_module_user.cpp\n#include \n#include \n\n#include "account_module.h"\n\nusing namespace std;\n\nint32_t main(int32_t argn, char ** argv){\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n account::deposit(10000);\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n account::withdraw(3000);\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n account::deposit(5000);\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n return 0;\n}\n// End account_module_user.cpp\n// ```\n\n',
'account_module_user.cpp'),
- ('// ``` C++\n// Begin account_module.h\n#include \n#include \n\nint32_t balance;\n\n\nvoid deposit (int32_t amount){\n std::cout << "Deposit " << amount << \'\\n\';\n balance += amount;\n}\n\n\nvoid withdraw (int32_t amount){\n std::cout << "Depowithdrawsit " << amount << \'\\n\';\n balance += -amount;\n}\n\n\nint32_t check(){\n return balance;\n}\n// End account_module.h\n\n// ```',
+ ('// ``` C++\n// Begin account_module.h\n#include \n#include \n\nint32_t balance;\n\n\nvoid deposit (int32_t amount){\n std::cout << "Deposit " << amount << \'\\n\';\n balance += amount;\n}\n\n\nvoid withdraw (int32_t amount){\n std::cout << "Depowithdrawsit " << amount << \'\\n\';\n balance += -amount;\n}\n\n\nint32_t check(){\n return balance;\n}\n// End account_module.h\n\n// ```',
'account_module.h'),
- ('// ```C++\n// Begin account_module_user.cpp\n#include \n#include \n\nnamespace account_a{\n #include "account_module.h"\n}\n\nnamespace account_b{\n #include "account_module.h"\n}\n\nusing namespace std;\n\nint32_t main(int32_t argn, char ** argv){\n\n cout << "account_a::check() = "<< account_a::check() <<\'\\n\';\n cout << "account_b::check() = "<< account_b::check() <<\'\\n\';\n\n account_a::deposit(10000);\n\n cout << "account_a::check() = "<< account_a::check() <<\'\\n\';\n cout << "account_b::check() = "<< account_b::check() <<\'\\n\';\n\n account_a::withdraw(3000);\n\n cout << "account_a::check() = "<< account_a::check() <<\'\\n\';\n cout << "account_b::check() = "<< account_b::check() <<\'\\n\';\n\n account_a::deposit(5000);\n\n cout << "account_a::check() = "<< account_a::check() <<\'\\n\';\n cout << "account_b::check() = "<< account_b::check() <<\'\\n\';\n\n remurn 0;\n}\n// End account_module_user.cpp\n// ```',
+ ('// ```C++\n// Begin account_module_user.cpp\n#include \n#include \n\nnamespace account_a{\n #include "account_module.h"\n}\n\nnamespace account_b{\n #include "account_module.h"\n}\n\nusing namespace std;\n\nint32_t main(int32_t argn, char ** argv){\n\n cout << "account_a::check() = "<< account_a::check() <<\'\\n\';\n cout << "account_b::check() = "<< account_b::check() <<\'\\n\';\n\n account_a::deposit(10000);\n\n cout << "account_a::check() = "<< account_a::check() <<\'\\n\';\n cout << "account_b::check() = "<< account_b::check() <<\'\\n\';\n\n account_a::withdraw(3000);\n\n cout << "account_a::check() = "<< account_a::check() <<\'\\n\';\n cout << "account_b::check() = "<< account_b::check() <<\'\\n\';\n\n account_a::deposit(5000);\n\n cout << "account_a::check() = "<< account_a::check() <<\'\\n\';\n cout << "account_b::check() = "<< account_b::check() <<\'\\n\';\n\n remurn 0;\n}\n// End account_module_user.cpp\n// ```',
'account_module_user.cpp'),
("""//```
void main (){
diff --git a/tests/test_get_build_command_in_last_line.py b/tests/test_get_build_command_in_last_line.py
index 9324bde..38ba038 100644
--- a/tests/test_get_build_command_in_last_line.py
+++ b/tests/test_get_build_command_in_last_line.py
@@ -22,25 +22,25 @@
"""
cpp_test_cases = [
- ('\n// ``` C++\n// Begin account_module_user.cpp\n#include \n#include \n\n#include "account_module.h"\n\nusing namespace std;\n\nint32_t main(int32_t argn, char * argv[]){\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n deposit(10000);\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n withdraw(3000);\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n deposit(5000);\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n return 0;\n}\n// End account_module_user.cpp\n// Build command : g++ -Wall -g account_module.cpp account_module_user.cpp -o account_module_user\n// ```\n\n',
+ ('\n// ``` C++\n// Begin account_module_user.cpp\n#include \n#include \n\n#include "account_module.h"\n\nusing namespace std;\n\nint32_t main(int32_t argn, char * argv[]){\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n deposit(10000);\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n withdraw(3000);\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n deposit(5000);\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n return 0;\n}\n// End account_module_user.cpp\n// Build command : g++ -Wall -g account_module.cpp account_module_user.cpp -o account_module_user\n// ```\n\n',
'g++ -Wall -g account_module.cpp account_module_user.cpp -o account_module_user'),
- ('\n// ``` C++\n// Begin account_module_user.cpp\n#include \n#include \n\n#include "account_module.h"\n\nusing namespace std;\n\nint32_t main(int32_t argn, char ** argv){\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n account::deposit(10000);\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n account::withdraw(3000);\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n account::deposit(5000);\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n return 0;\n}\n// End account_module_user.cpp\n// Build command : g++ -Wall -g account_module.cpp account_module_user.cpp -o account_module_user\n// ```\n\n',
+ ('\n// ``` C++\n// Begin account_module_user.cpp\n#include \n#include \n\n#include "account_module.h"\n\nusing namespace std;\n\nint32_t main(int32_t argn, char ** argv){\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n account::deposit(10000);\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n account::withdraw(3000);\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n account::deposit(5000);\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n return 0;\n}\n// End account_module_user.cpp\n// Build command : g++ -Wall -g account_module.cpp account_module_user.cpp -o account_module_user\n// ```\n\n',
'g++ -Wall -g account_module.cpp account_module_user.cpp -o account_module_user'),
- ('// ``` C++\n// Begin account_module.h\n#include \n\nvoid deposit (int32_t amount);\nvoid withdraw (int32_t amount);\nint32_t check();\n// End account_module.h\n// ```',
+ ('// ``` C++\n// Begin account_module.h\n#include \n\nvoid deposit (int32_t amount);\nvoid withdraw (int32_t amount);\nint32_t check();\n// End account_module.h\n// ```',
''),
- ('// ``` C++\n// Begin account_module.cpp\n#include \n#include \n\n#include "account_module.h"\n\nusing namespace std;\n\nint32_t balance;\n\n\nvoid deposit (int32_t amount){\n cout << "Deposit " << amount << \'\\n\';\n balance += amount;\n}\n\n\nvoid withdraw (int32_t amount){\n cout << "Depowithdrawsit " << amount << \'\\n\';\n balance += -amount;\n}\n\n\nint32_t check(){\n return balance;\n}\n// End account_module.cpp\n// ```\n\n',
+ ('// ``` C++\n// Begin account_module.cpp\n#include \n#include \n\n#include "account_module.h"\n\nusing namespace std;\n\nint32_t balance;\n\n\nvoid deposit (int32_t amount){\n cout << "Deposit " << amount << \'\\n\';\n balance += amount;\n}\n\n\nvoid withdraw (int32_t amount){\n cout << "Depowithdrawsit " << amount << \'\\n\';\n balance += -amount;\n}\n\n\nint32_t check(){\n return balance;\n}\n// End account_module.cpp\n// ```\n\n',
''),
- ('\n// ``` C++\n// Begin account_module_user.cpp\n#include \n#include \n\n#include "account_module.h"\n\nusing namespace std;\n\nint32_t main(int32_t argn, char * argv[]){\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n deposit(10000);\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n withdraw(3000);\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n deposit(5000);\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n return 0;\n}\n// End account_module_user.cpp\n// ```\n\n',
+ ('\n// ``` C++\n// Begin account_module_user.cpp\n#include \n#include \n\n#include "account_module.h"\n\nusing namespace std;\n\nint32_t main(int32_t argn, char * argv[]){\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n deposit(10000);\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n withdraw(3000);\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n deposit(5000);\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n return 0;\n}\n// End account_module_user.cpp\n// ```\n\n',
''),
- ('// ``` C++\n// Begin account_module.h\n#include \n\nnamespace account {\n void deposit (int32_t amount);\n void withdraw (int32_t amount);\n int32_t check();\n}\n// End account_module.h\n// ```',
+ ('// ``` C++\n// Begin account_module.h\n#include \n\nnamespace account {\n void deposit (int32_t amount);\n void withdraw (int32_t amount);\n int32_t check();\n}\n// End account_module.h\n// ```',
''),
- ('// ``` C++\n// Begin account_module.cpp\n#include \n#include \n\n#include "account_module.h"\n\nusing namespace std;\n\nnamespace account{\n int32_t balance;\n\n void deposit (int32_t amount){\n cout << "Deposit " << amount << \'\\n\';\n balance += amount;\n }\n\n void withdraw (int32_t amount){\n cout << "Depowithdrawsit " << amount << \'\\n\';\n balance += -amount;\n }\n\n int32_t check(){\n return balance;\n }\n}\n// End account_module.cpp\n// ```\n\n',
+ ('// ``` C++\n// Begin account_module.cpp\n#include \n#include \n\n#include "account_module.h"\n\nusing namespace std;\n\nnamespace account{\n int32_t balance;\n\n void deposit (int32_t amount){\n cout << "Deposit " << amount << \'\\n\';\n balance += amount;\n }\n\n void withdraw (int32_t amount){\n cout << "Depowithdrawsit " << amount << \'\\n\';\n balance += -amount;\n }\n\n int32_t check(){\n return balance;\n }\n}\n// End account_module.cpp\n// ```\n\n',
''),
- ('\n// ``` C++\n// Begin account_module_user.cpp\n#include \n#include \n\n#include "account_module.h"\n\nusing namespace std;\n\nint32_t main(int32_t argn, char ** argv){\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n account::deposit(10000);\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n account::withdraw(3000);\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n account::deposit(5000);\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n return 0;\n}\n// End account_module_user.cpp\n// ```\n\n',
+ ('\n// ``` C++\n// Begin account_module_user.cpp\n#include \n#include \n\n#include "account_module.h"\n\nusing namespace std;\n\nint32_t main(int32_t argn, char ** argv){\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n account::deposit(10000);\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n account::withdraw(3000);\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n account::deposit(5000);\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n return 0;\n}\n// End account_module_user.cpp\n// ```\n\n',
''),
- ('// ``` C++\n// Begin account_module.h\n#include \n#include \n\nint32_t balance;\n\n\nvoid deposit (int32_t amount){\n std::cout << "Deposit " << amount << \'\\n\';\n balance += amount;\n}\n\n\nvoid withdraw (int32_t amount){\n std::cout << "Depowithdrawsit " << amount << \'\\n\';\n balance += -amount;\n}\n\n\nint32_t check(){\n return balance;\n}\n// End account_module.h\n\n// ```',
+ ('// ``` C++\n// Begin account_module.h\n#include \n#include \n\nint32_t balance;\n\n\nvoid deposit (int32_t amount){\n std::cout << "Deposit " << amount << \'\\n\';\n balance += amount;\n}\n\n\nvoid withdraw (int32_t amount){\n std::cout << "Depowithdrawsit " << amount << \'\\n\';\n balance += -amount;\n}\n\n\nint32_t check(){\n return balance;\n}\n// End account_module.h\n\n// ```',
''),
- ('// ```C++\n// Begin account_module_user.cpp\n#include \n#include \n\nnamespace account_a{\n #include "account_module.h"\n}\n\nnamespace account_b{\n #include "account_module.h"\n}\n\nusing namespace std;\n\nint32_t main(int32_t argn, char ** argv){\n\n cout << "account_a::check() = "<< account_a::check() <<\'\\n\';\n cout << "account_b::check() = "<< account_b::check() <<\'\\n\';\n\n account_a::deposit(10000);\n\n cout << "account_a::check() = "<< account_a::check() <<\'\\n\';\n cout << "account_b::check() = "<< account_b::check() <<\'\\n\';\n\n account_a::withdraw(3000);\n\n cout << "account_a::check() = "<< account_a::check() <<\'\\n\';\n cout << "account_b::check() = "<< account_b::check() <<\'\\n\';\n\n account_a::deposit(5000);\n\n cout << "account_a::check() = "<< account_a::check() <<\'\\n\';\n cout << "account_b::check() = "<< account_b::check() <<\'\\n\';\n\n remurn 0;\n}\n// End account_module_user.cpp\n// ```',
+ ('// ```C++\n// Begin account_module_user.cpp\n#include \n#include \n\nnamespace account_a{\n #include "account_module.h"\n}\n\nnamespace account_b{\n #include "account_module.h"\n}\n\nusing namespace std;\n\nint32_t main(int32_t argn, char ** argv){\n\n cout << "account_a::check() = "<< account_a::check() <<\'\\n\';\n cout << "account_b::check() = "<< account_b::check() <<\'\\n\';\n\n account_a::deposit(10000);\n\n cout << "account_a::check() = "<< account_a::check() <<\'\\n\';\n cout << "account_b::check() = "<< account_b::check() <<\'\\n\';\n\n account_a::withdraw(3000);\n\n cout << "account_a::check() = "<< account_a::check() <<\'\\n\';\n cout << "account_b::check() = "<< account_b::check() <<\'\\n\';\n\n account_a::deposit(5000);\n\n cout << "account_a::check() = "<< account_a::check() <<\'\\n\';\n cout << "account_b::check() = "<< account_b::check() <<\'\\n\';\n\n remurn 0;\n}\n// End account_module_user.cpp\n// ```',
''),
("""//```
void main (){
diff --git a/tutorial/00.bash.ipynb b/tutorial/00.bash.ipynb
index 23913db..0d3479e 100644
--- a/tutorial/00.bash.ipynb
+++ b/tutorial/00.bash.ipynb
@@ -7,7 +7,7 @@
"colab_type": "text"
},
"source": [
- "
\n"
+ "
\n"
]
},
{
diff --git a/tutorial/05.jupyter_notebook.ipynb b/tutorial/05.jupyter_notebook.ipynb
index db26380..e7f19db 100644
--- a/tutorial/05.jupyter_notebook.ipynb
+++ b/tutorial/05.jupyter_notebook.ipynb
@@ -7,7 +7,7 @@
"colab_type": "text"
},
"source": [
- "
\n"
+ "
\n"
]
},
{
diff --git a/tutorial/10.git.ipynb b/tutorial/10.git.ipynb
index b3747a4..54fa8ae 100644
--- a/tutorial/10.git.ipynb
+++ b/tutorial/10.git.ipynb
@@ -7,7 +7,7 @@
"colab_type": "text"
},
"source": [
- "
\n"
+ "
\n"
]
},
{
diff --git a/tutorial/build_util/build_util.py b/tutorial/build_util/build_util.py
index 36268b5..14a2b43 100644
--- a/tutorial/build_util/build_util.py
+++ b/tutorial/build_util/build_util.py
@@ -34,7 +34,7 @@ def build_cpp(filename):
"""
# Detect OS type because OSX may need different options
# https://stackoverflow.com/questions/3466166/how-to-check-if-running-in-cygwin-mac-or-linux/18790824
-
+
basename, ext = os.path.splitext(filename)
if not ext:
filename += '.cpp'
diff --git a/tutorial/tests/check_links_in_ipynb.py b/tutorial/tests/check_links_in_ipynb.py
index 349631f..5175a42 100644
--- a/tutorial/tests/check_links_in_ipynb.py
+++ b/tutorial/tests/check_links_in_ipynb.py
@@ -74,5 +74,5 @@ def check_links_in_ipynb_cells_list(cells_list):
# check simple urls
check_link_in_cell(cell, rs)
- # check urls linked to
+ # check urls linked to
check_link_in_cell(cell, ri)
diff --git a/tutorial/tests/environment.3.5.yml b/tutorial/tests/environment.3.5.yml
index 748e818..59fb422 100644
--- a/tutorial/tests/environment.3.5.yml
+++ b/tutorial/tests/environment.3.5.yml
@@ -7,7 +7,7 @@ channels:
dependencies:
- python=3.5
-# Anaconda 4.2 (2016.09) python 3.5
+# Anaconda 4.2 (2016.09) python 3.5
# https://docs.anaconda.com/anaconda/packages/old-pkg-lists/4.2.0/py35/
- cython=0.24.1
- jupyter=1.0.0
diff --git a/tutorial/tests/environment.3.6.yml b/tutorial/tests/environment.3.6.yml
index 90fdfe6..303ac7a 100644
--- a/tutorial/tests/environment.3.6.yml
+++ b/tutorial/tests/environment.3.6.yml
@@ -6,7 +6,7 @@ channels:
dependencies:
- python=3.6
-# Anaconda 5.0.1 (2017.10) python 3.6
+# Anaconda 5.0.1 (2017.10) python 3.6
# https://docs.anaconda.com/anaconda/packages/old-pkg-lists/5.0.1/py3.6_win-64/
- cython=0.26.1
- jupyter=1.0.0
diff --git a/tutorial/tests/get_cpp_from_ipynb.py b/tutorial/tests/get_cpp_from_ipynb.py
index 2e601d5..27faf13 100644
--- a/tutorial/tests/get_cpp_from_ipynb.py
+++ b/tutorial/tests/get_cpp_from_ipynb.py
@@ -28,7 +28,7 @@ def is_markdown_cpp_src(ipynb_cell):
src = ipynb_cell['source'].strip()
# Multiline code block within ```'s
- if (src.startswith('```')
+ if (src.startswith('```')
and src.endswith('```')):
# check C++ right after ```
@@ -100,7 +100,7 @@ def get_build_command_in_last_line(cpp_txt):
if 4 < len(line.lower().split()):
# Check words
if (
- ('build' == line.lower().split()[1])
+ ('build' == line.lower().split()[1])
and ('command' == line.lower().split()[2])
and (':' == line.lower().split()[3])
):
diff --git a/tutorial/tests/test_check_links_in_ipynb.py b/tutorial/tests/test_check_links_in_ipynb.py
index 6c9ab57..a8fbb7a 100644
--- a/tutorial/tests/test_check_links_in_ipynb.py
+++ b/tutorial/tests/test_check_links_in_ipynb.py
@@ -41,7 +41,7 @@ def test_check_links_in_ipynb_cells_list():
'text': '[](https://www.youtube.com/user/CppCon/videos)\n\n',
'urls': {
'https://i.ytimg.com/vi/PorfLSr3DDI/hqdefault.jpg',
- }
+ }
},
{
'text': '* You could use following [command](https://stackoverflow.com/questions/8305866/how-to-analyze-a-programs-core-dump-file-with-gdb) to analyze.
\n``` sh\ngdb -c \n```',
@@ -121,7 +121,7 @@ def test_get_re_markdown_simple_link():
'text': '[](link_here)\n\n',
'urls': {
'link_here',
- }
+ }
},
]
@@ -376,10 +376,10 @@ def test_check_link_in_cell():
"[ref0](https://en.wikipedia.org/wiki/New_and_delete_(C%2B%2B))\n",
"\n"
])
- }
+ }
r = cli.get_re_markdown_simple_link()
-
+
# function under test
# success case
cli.check_link_in_cell(google_cell, r)
diff --git a/tutorial/tests/test_gcpp_2nd_line_filename.py b/tutorial/tests/test_gcpp_2nd_line_filename.py
index 74330e8..658c865 100644
--- a/tutorial/tests/test_gcpp_2nd_line_filename.py
+++ b/tutorial/tests/test_gcpp_2nd_line_filename.py
@@ -22,21 +22,21 @@
"""
cpp_test_cases = [
- ('// ``` C++\n// Begin account_module.h\n#include \n\nvoid deposit (int32_t amount);\nvoid withdraw (int32_t amount);\nint32_t check();\n// End account_module.h\n// ```',
+ ('// ``` C++\n// Begin account_module.h\n#include \n\nvoid deposit (int32_t amount);\nvoid withdraw (int32_t amount);\nint32_t check();\n// End account_module.h\n// ```',
'account_module.h'),
- ('// ``` C++\n// Begin account_module.cpp\n#include \n#include \n\n#include "account_module.h"\n\nusing namespace std;\n\nint32_t balance;\n\n\nvoid deposit (int32_t amount){\n cout << "Deposit " << amount << \'\\n\';\n balance += amount;\n}\n\n\nvoid withdraw (int32_t amount){\n cout << "Depowithdrawsit " << amount << \'\\n\';\n balance += -amount;\n}\n\n\nint32_t check(){\n return balance;\n}\n// End account_module.cpp\n// ```\n\n',
+ ('// ``` C++\n// Begin account_module.cpp\n#include \n#include \n\n#include "account_module.h"\n\nusing namespace std;\n\nint32_t balance;\n\n\nvoid deposit (int32_t amount){\n cout << "Deposit " << amount << \'\\n\';\n balance += amount;\n}\n\n\nvoid withdraw (int32_t amount){\n cout << "Depowithdrawsit " << amount << \'\\n\';\n balance += -amount;\n}\n\n\nint32_t check(){\n return balance;\n}\n// End account_module.cpp\n// ```\n\n',
'account_module.cpp'),
- ('\n// ``` C++\n// Begin account_module_user.cpp\n#include \n#include \n\n#include "account_module.h"\n\nusing namespace std;\n\nint32_t main(int32_t argn, char * argv[]){\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n deposit(10000);\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n withdraw(3000);\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n deposit(5000);\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n return 0;\n}\n// End account_module_user.cpp\n// ```\n\n',
+ ('\n// ``` C++\n// Begin account_module_user.cpp\n#include \n#include \n\n#include "account_module.h"\n\nusing namespace std;\n\nint32_t main(int32_t argn, char * argv[]){\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n deposit(10000);\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n withdraw(3000);\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n deposit(5000);\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n return 0;\n}\n// End account_module_user.cpp\n// ```\n\n',
'account_module_user.cpp'),
- ('// ``` C++\n// Begin account_module.h\n#include \n\nnamespace account {\n void deposit (int32_t amount);\n void withdraw (int32_t amount);\n int32_t check();\n}\n// End account_module.h\n// ```',
+ ('// ``` C++\n// Begin account_module.h\n#include \n\nnamespace account {\n void deposit (int32_t amount);\n void withdraw (int32_t amount);\n int32_t check();\n}\n// End account_module.h\n// ```',
'account_module.h'),
- ('// ``` C++\n// Begin account_module.cpp\n#include \n#include \n\n#include "account_module.h"\n\nusing namespace std;\n\nnamespace account{\n int32_t balance;\n\n void deposit (int32_t amount){\n cout << "Deposit " << amount << \'\\n\';\n balance += amount;\n }\n\n void withdraw (int32_t amount){\n cout << "Depowithdrawsit " << amount << \'\\n\';\n balance += -amount;\n }\n\n int32_t check(){\n return balance;\n }\n}\n// End account_module.cpp\n// ```\n\n',
+ ('// ``` C++\n// Begin account_module.cpp\n#include \n#include \n\n#include "account_module.h"\n\nusing namespace std;\n\nnamespace account{\n int32_t balance;\n\n void deposit (int32_t amount){\n cout << "Deposit " << amount << \'\\n\';\n balance += amount;\n }\n\n void withdraw (int32_t amount){\n cout << "Depowithdrawsit " << amount << \'\\n\';\n balance += -amount;\n }\n\n int32_t check(){\n return balance;\n }\n}\n// End account_module.cpp\n// ```\n\n',
'account_module.cpp'),
- ('\n// ``` C++\n// Begin account_module_user.cpp\n#include \n#include \n\n#include "account_module.h"\n\nusing namespace std;\n\nint32_t main(int32_t argn, char ** argv){\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n account::deposit(10000);\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n account::withdraw(3000);\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n account::deposit(5000);\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n return 0;\n}\n// End account_module_user.cpp\n// ```\n\n',
+ ('\n// ``` C++\n// Begin account_module_user.cpp\n#include \n#include \n\n#include "account_module.h"\n\nusing namespace std;\n\nint32_t main(int32_t argn, char ** argv){\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n account::deposit(10000);\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n account::withdraw(3000);\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n account::deposit(5000);\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n return 0;\n}\n// End account_module_user.cpp\n// ```\n\n',
'account_module_user.cpp'),
- ('// ``` C++\n// Begin account_module.h\n#include \n#include \n\nint32_t balance;\n\n\nvoid deposit (int32_t amount){\n std::cout << "Deposit " << amount << \'\\n\';\n balance += amount;\n}\n\n\nvoid withdraw (int32_t amount){\n std::cout << "Depowithdrawsit " << amount << \'\\n\';\n balance += -amount;\n}\n\n\nint32_t check(){\n return balance;\n}\n// End account_module.h\n\n// ```',
+ ('// ``` C++\n// Begin account_module.h\n#include \n#include \n\nint32_t balance;\n\n\nvoid deposit (int32_t amount){\n std::cout << "Deposit " << amount << \'\\n\';\n balance += amount;\n}\n\n\nvoid withdraw (int32_t amount){\n std::cout << "Depowithdrawsit " << amount << \'\\n\';\n balance += -amount;\n}\n\n\nint32_t check(){\n return balance;\n}\n// End account_module.h\n\n// ```',
'account_module.h'),
- ('// ```C++\n// Begin account_module_user.cpp\n#include \n#include \n\nnamespace account_a{\n #include "account_module.h"\n}\n\nnamespace account_b{\n #include "account_module.h"\n}\n\nusing namespace std;\n\nint32_t main(int32_t argn, char ** argv){\n\n cout << "account_a::check() = "<< account_a::check() <<\'\\n\';\n cout << "account_b::check() = "<< account_b::check() <<\'\\n\';\n\n account_a::deposit(10000);\n\n cout << "account_a::check() = "<< account_a::check() <<\'\\n\';\n cout << "account_b::check() = "<< account_b::check() <<\'\\n\';\n\n account_a::withdraw(3000);\n\n cout << "account_a::check() = "<< account_a::check() <<\'\\n\';\n cout << "account_b::check() = "<< account_b::check() <<\'\\n\';\n\n account_a::deposit(5000);\n\n cout << "account_a::check() = "<< account_a::check() <<\'\\n\';\n cout << "account_b::check() = "<< account_b::check() <<\'\\n\';\n\n remurn 0;\n}\n// End account_module_user.cpp\n// ```',
+ ('// ```C++\n// Begin account_module_user.cpp\n#include \n#include \n\nnamespace account_a{\n #include "account_module.h"\n}\n\nnamespace account_b{\n #include "account_module.h"\n}\n\nusing namespace std;\n\nint32_t main(int32_t argn, char ** argv){\n\n cout << "account_a::check() = "<< account_a::check() <<\'\\n\';\n cout << "account_b::check() = "<< account_b::check() <<\'\\n\';\n\n account_a::deposit(10000);\n\n cout << "account_a::check() = "<< account_a::check() <<\'\\n\';\n cout << "account_b::check() = "<< account_b::check() <<\'\\n\';\n\n account_a::withdraw(3000);\n\n cout << "account_a::check() = "<< account_a::check() <<\'\\n\';\n cout << "account_b::check() = "<< account_b::check() <<\'\\n\';\n\n account_a::deposit(5000);\n\n cout << "account_a::check() = "<< account_a::check() <<\'\\n\';\n cout << "account_b::check() = "<< account_b::check() <<\'\\n\';\n\n remurn 0;\n}\n// End account_module_user.cpp\n// ```',
'account_module_user.cpp'),
("""//```
void main (){
diff --git a/tutorial/tests/test_get_build_command_in_last_line.py b/tutorial/tests/test_get_build_command_in_last_line.py
index 9324bde..38ba038 100644
--- a/tutorial/tests/test_get_build_command_in_last_line.py
+++ b/tutorial/tests/test_get_build_command_in_last_line.py
@@ -22,25 +22,25 @@
"""
cpp_test_cases = [
- ('\n// ``` C++\n// Begin account_module_user.cpp\n#include \n#include \n\n#include "account_module.h"\n\nusing namespace std;\n\nint32_t main(int32_t argn, char * argv[]){\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n deposit(10000);\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n withdraw(3000);\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n deposit(5000);\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n return 0;\n}\n// End account_module_user.cpp\n// Build command : g++ -Wall -g account_module.cpp account_module_user.cpp -o account_module_user\n// ```\n\n',
+ ('\n// ``` C++\n// Begin account_module_user.cpp\n#include \n#include \n\n#include "account_module.h"\n\nusing namespace std;\n\nint32_t main(int32_t argn, char * argv[]){\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n deposit(10000);\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n withdraw(3000);\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n deposit(5000);\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n return 0;\n}\n// End account_module_user.cpp\n// Build command : g++ -Wall -g account_module.cpp account_module_user.cpp -o account_module_user\n// ```\n\n',
'g++ -Wall -g account_module.cpp account_module_user.cpp -o account_module_user'),
- ('\n// ``` C++\n// Begin account_module_user.cpp\n#include \n#include \n\n#include "account_module.h"\n\nusing namespace std;\n\nint32_t main(int32_t argn, char ** argv){\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n account::deposit(10000);\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n account::withdraw(3000);\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n account::deposit(5000);\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n return 0;\n}\n// End account_module_user.cpp\n// Build command : g++ -Wall -g account_module.cpp account_module_user.cpp -o account_module_user\n// ```\n\n',
+ ('\n// ``` C++\n// Begin account_module_user.cpp\n#include \n#include \n\n#include "account_module.h"\n\nusing namespace std;\n\nint32_t main(int32_t argn, char ** argv){\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n account::deposit(10000);\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n account::withdraw(3000);\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n account::deposit(5000);\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n return 0;\n}\n// End account_module_user.cpp\n// Build command : g++ -Wall -g account_module.cpp account_module_user.cpp -o account_module_user\n// ```\n\n',
'g++ -Wall -g account_module.cpp account_module_user.cpp -o account_module_user'),
- ('// ``` C++\n// Begin account_module.h\n#include \n\nvoid deposit (int32_t amount);\nvoid withdraw (int32_t amount);\nint32_t check();\n// End account_module.h\n// ```',
+ ('// ``` C++\n// Begin account_module.h\n#include \n\nvoid deposit (int32_t amount);\nvoid withdraw (int32_t amount);\nint32_t check();\n// End account_module.h\n// ```',
''),
- ('// ``` C++\n// Begin account_module.cpp\n#include \n#include \n\n#include "account_module.h"\n\nusing namespace std;\n\nint32_t balance;\n\n\nvoid deposit (int32_t amount){\n cout << "Deposit " << amount << \'\\n\';\n balance += amount;\n}\n\n\nvoid withdraw (int32_t amount){\n cout << "Depowithdrawsit " << amount << \'\\n\';\n balance += -amount;\n}\n\n\nint32_t check(){\n return balance;\n}\n// End account_module.cpp\n// ```\n\n',
+ ('// ``` C++\n// Begin account_module.cpp\n#include \n#include \n\n#include "account_module.h"\n\nusing namespace std;\n\nint32_t balance;\n\n\nvoid deposit (int32_t amount){\n cout << "Deposit " << amount << \'\\n\';\n balance += amount;\n}\n\n\nvoid withdraw (int32_t amount){\n cout << "Depowithdrawsit " << amount << \'\\n\';\n balance += -amount;\n}\n\n\nint32_t check(){\n return balance;\n}\n// End account_module.cpp\n// ```\n\n',
''),
- ('\n// ``` C++\n// Begin account_module_user.cpp\n#include \n#include \n\n#include "account_module.h"\n\nusing namespace std;\n\nint32_t main(int32_t argn, char * argv[]){\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n deposit(10000);\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n withdraw(3000);\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n deposit(5000);\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n return 0;\n}\n// End account_module_user.cpp\n// ```\n\n',
+ ('\n// ``` C++\n// Begin account_module_user.cpp\n#include \n#include \n\n#include "account_module.h"\n\nusing namespace std;\n\nint32_t main(int32_t argn, char * argv[]){\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n deposit(10000);\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n withdraw(3000);\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n deposit(5000);\n\n cout << "account_module.check() = "<< check() <<\'\\n\';\n\n return 0;\n}\n// End account_module_user.cpp\n// ```\n\n',
''),
- ('// ``` C++\n// Begin account_module.h\n#include \n\nnamespace account {\n void deposit (int32_t amount);\n void withdraw (int32_t amount);\n int32_t check();\n}\n// End account_module.h\n// ```',
+ ('// ``` C++\n// Begin account_module.h\n#include \n\nnamespace account {\n void deposit (int32_t amount);\n void withdraw (int32_t amount);\n int32_t check();\n}\n// End account_module.h\n// ```',
''),
- ('// ``` C++\n// Begin account_module.cpp\n#include \n#include \n\n#include "account_module.h"\n\nusing namespace std;\n\nnamespace account{\n int32_t balance;\n\n void deposit (int32_t amount){\n cout << "Deposit " << amount << \'\\n\';\n balance += amount;\n }\n\n void withdraw (int32_t amount){\n cout << "Depowithdrawsit " << amount << \'\\n\';\n balance += -amount;\n }\n\n int32_t check(){\n return balance;\n }\n}\n// End account_module.cpp\n// ```\n\n',
+ ('// ``` C++\n// Begin account_module.cpp\n#include \n#include \n\n#include "account_module.h"\n\nusing namespace std;\n\nnamespace account{\n int32_t balance;\n\n void deposit (int32_t amount){\n cout << "Deposit " << amount << \'\\n\';\n balance += amount;\n }\n\n void withdraw (int32_t amount){\n cout << "Depowithdrawsit " << amount << \'\\n\';\n balance += -amount;\n }\n\n int32_t check(){\n return balance;\n }\n}\n// End account_module.cpp\n// ```\n\n',
''),
- ('\n// ``` C++\n// Begin account_module_user.cpp\n#include \n#include \n\n#include "account_module.h"\n\nusing namespace std;\n\nint32_t main(int32_t argn, char ** argv){\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n account::deposit(10000);\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n account::withdraw(3000);\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n account::deposit(5000);\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n return 0;\n}\n// End account_module_user.cpp\n// ```\n\n',
+ ('\n// ``` C++\n// Begin account_module_user.cpp\n#include \n#include \n\n#include "account_module.h"\n\nusing namespace std;\n\nint32_t main(int32_t argn, char ** argv){\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n account::deposit(10000);\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n account::withdraw(3000);\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n account::deposit(5000);\n\n cout << "account_module.check() = "<< account::check() <<\'\\n\';\n\n return 0;\n}\n// End account_module_user.cpp\n// ```\n\n',
''),
- ('// ``` C++\n// Begin account_module.h\n#include \n#include \n\nint32_t balance;\n\n\nvoid deposit (int32_t amount){\n std::cout << "Deposit " << amount << \'\\n\';\n balance += amount;\n}\n\n\nvoid withdraw (int32_t amount){\n std::cout << "Depowithdrawsit " << amount << \'\\n\';\n balance += -amount;\n}\n\n\nint32_t check(){\n return balance;\n}\n// End account_module.h\n\n// ```',
+ ('// ``` C++\n// Begin account_module.h\n#include \n#include \n\nint32_t balance;\n\n\nvoid deposit (int32_t amount){\n std::cout << "Deposit " << amount << \'\\n\';\n balance += amount;\n}\n\n\nvoid withdraw (int32_t amount){\n std::cout << "Depowithdrawsit " << amount << \'\\n\';\n balance += -amount;\n}\n\n\nint32_t check(){\n return balance;\n}\n// End account_module.h\n\n// ```',
''),
- ('// ```C++\n// Begin account_module_user.cpp\n#include \n#include \n\nnamespace account_a{\n #include "account_module.h"\n}\n\nnamespace account_b{\n #include "account_module.h"\n}\n\nusing namespace std;\n\nint32_t main(int32_t argn, char ** argv){\n\n cout << "account_a::check() = "<< account_a::check() <<\'\\n\';\n cout << "account_b::check() = "<< account_b::check() <<\'\\n\';\n\n account_a::deposit(10000);\n\n cout << "account_a::check() = "<< account_a::check() <<\'\\n\';\n cout << "account_b::check() = "<< account_b::check() <<\'\\n\';\n\n account_a::withdraw(3000);\n\n cout << "account_a::check() = "<< account_a::check() <<\'\\n\';\n cout << "account_b::check() = "<< account_b::check() <<\'\\n\';\n\n account_a::deposit(5000);\n\n cout << "account_a::check() = "<< account_a::check() <<\'\\n\';\n cout << "account_b::check() = "<< account_b::check() <<\'\\n\';\n\n remurn 0;\n}\n// End account_module_user.cpp\n// ```',
+ ('// ```C++\n// Begin account_module_user.cpp\n#include \n#include \n\nnamespace account_a{\n #include "account_module.h"\n}\n\nnamespace account_b{\n #include "account_module.h"\n}\n\nusing namespace std;\n\nint32_t main(int32_t argn, char ** argv){\n\n cout << "account_a::check() = "<< account_a::check() <<\'\\n\';\n cout << "account_b::check() = "<< account_b::check() <<\'\\n\';\n\n account_a::deposit(10000);\n\n cout << "account_a::check() = "<< account_a::check() <<\'\\n\';\n cout << "account_b::check() = "<< account_b::check() <<\'\\n\';\n\n account_a::withdraw(3000);\n\n cout << "account_a::check() = "<< account_a::check() <<\'\\n\';\n cout << "account_b::check() = "<< account_b::check() <<\'\\n\';\n\n account_a::deposit(5000);\n\n cout << "account_a::check() = "<< account_a::check() <<\'\\n\';\n cout << "account_b::check() = "<< account_b::check() <<\'\\n\';\n\n remurn 0;\n}\n// End account_module_user.cpp\n// ```',
''),
("""//```
void main (){
diff --git a/utils/find_in_notebook_files.py b/utils/find_in_notebook_files.py
index 3bc23af..82625ff 100644
--- a/utils/find_in_notebook_files.py
+++ b/utils/find_in_notebook_files.py
@@ -118,7 +118,7 @@ def __init__(self, ipynb_full_path, replace_this, to_this, b_verbose=False, b_re
"""
super().__init__(ipynb_full_path)
- # Find or replace
+ # Find or replace
self.replace_this = replace_this
self.to_this = to_this
@@ -196,7 +196,7 @@ def write(self, ipynb_full_path):
"""
if self.b_replace and self.b_verbose and self.b_arm:
if (
- (ipynb_full_path != self.ipynb_full_path)
+ (ipynb_full_path != self.ipynb_full_path)
or (0 < self.count)
):
# If same filename but no replacement count, do not overwrite
diff --git a/utils/get_cpp_from_ipynb.py b/utils/get_cpp_from_ipynb.py
index 4064187..a883c81 100644
--- a/utils/get_cpp_from_ipynb.py
+++ b/utils/get_cpp_from_ipynb.py
@@ -28,7 +28,7 @@ def is_markdown_cpp_src(ipynb_cell):
src = ipynb_cell['source'].strip()
# Multiline code block within ```'s
- if (src.startswith('```')
+ if (src.startswith('```')
and src.endswith('```')):
# check C++ right after ```
diff --git a/utils/recursively_convert_units.py b/utils/recursively_convert_units.py
index 83d45cf..35f62c5 100644
--- a/utils/recursively_convert_units.py
+++ b/utils/recursively_convert_units.py
@@ -2,7 +2,7 @@
import pathlib
-ignore_path_list = {'__pycache__', '.ipynb_checkpoints', '.git', '.cache', '.idea',
+ignore_path_list = {'__pycache__', '.ipynb_checkpoints', '.git', '.cache', '.idea',
'nbutils', 'tests', 'utils', '.github'}
@@ -34,7 +34,7 @@ def gen_filename_ipynb(filename_list):
"""
for filename in filename_list:
if is_ipynb(filename):
- yield filename
+ yield filename
def gen_ipynb(root):
diff --git a/utils/symbol_converter.py b/utils/symbol_converter.py
index 235a4be..533fc88 100644
--- a/utils/symbol_converter.py
+++ b/utils/symbol_converter.py
@@ -125,7 +125,7 @@ def process_line(self, source_line):
"""
SymbolConverter.process_line()
- Find SymPy
+ Find SymPy
"""
symbol_names_location = self.find_symbol_name_location(source_line)
diff --git a/utils/tests/sample.ipynb b/utils/tests/sample.ipynb
index 0fbd27d..475c131 100644
--- a/utils/tests/sample.ipynb
+++ b/utils/tests/sample.ipynb
@@ -343,7 +343,7 @@
},
"outputs": [],
"source": [
- "fy_eq = sy.Eq(R_A_N + R_B_N + w0_N_m * L_AB_m)"
+ "fy_eq = sy.Eq(R_A_N + R_B_N + w0_N_m * L_AB_m, 0)"
]
},
{
@@ -406,7 +406,7 @@
"metadata": {},
"outputs": [],
"source": [
- "m_eq = sy.Eq(M_A_Nm - R_A_N * L_AB_m - sy.Rational(1, 2) * w0_N_m * L_AB_m ** 2)"
+ "m_eq = sy.Eq(M_A_Nm - R_A_N * L_AB_m - sy.Rational(1, 2) * w0_N_m * L_AB_m ** 2, 0)"
]
},
{
diff --git a/utils/tests/sample_with_output.ipynb b/utils/tests/sample_with_output.ipynb
index 9cab6af..a469403 100644
--- a/utils/tests/sample_with_output.ipynb
+++ b/utils/tests/sample_with_output.ipynb
@@ -414,7 +414,7 @@
},
"outputs": [],
"source": [
- "fy_eq = sy.Eq(R_A_N + R_B_N + w0_N_m * L_AB_m)"
+ "fy_eq = sy.Eq(R_A_N + R_B_N + w0_N_m * L_AB_m, 0)"
]
},
{
@@ -526,7 +526,7 @@
"metadata": {},
"outputs": [],
"source": [
- "m_eq = sy.Eq(M_A_Nm - R_A_N * L_AB_m - sy.Rational(1, 2) * w0_N_m * L_AB_m ** 2)"
+ "m_eq = sy.Eq(M_A_Nm - R_A_N * L_AB_m - sy.Rational(1, 2) * w0_N_m * L_AB_m ** 2, 0)"
]
},
{
diff --git a/utils/tests/test_end_with_two_returns.py b/utils/tests/test_end_with_two_returns.py
index b64f07e..61c8407 100644
--- a/utils/tests/test_end_with_two_returns.py
+++ b/utils/tests/test_end_with_two_returns.py
@@ -23,9 +23,9 @@ class TestFile(unittest.TestCase):
def setUp(self):
self.fp = open(
os.path.join(
- os.path.dirname(__file__),
+ os.path.dirname(__file__),
'sample.ipynb'
- ),
+ ),
encoding = 'utf-8'
)
@@ -35,7 +35,7 @@ def setUp(self):
self.cell = self.nb['cells'][0]
self.cell_src_strip = self.cell.source.strip()
-
+
def tearDown(self):
del self.cell_src_strip
del self.cell
diff --git a/utils/tests/test_separate_print.py b/utils/tests/test_separate_print.py
index d2a4fbe..037a4b5 100644
--- a/utils/tests/test_separate_print.py
+++ b/utils/tests/test_separate_print.py
@@ -41,7 +41,7 @@ def sample_seperation_dict() -> dict:
'print("sy.pi**2 = %s" % sy.pi ** 2)' : 'sy.pi ** 2',
'print("sy.pi.evalf() = %s" % sy.pi.evalf())' : 'sy.pi.evalf()',
'print("sy.pi + sy.exp(1) = %s" % (sy.pi + sy.exp(1)))' : '(sy.pi + sy.exp(1))',
- 'print("(sy.pi + sy.exp(1)).evalf() = %s" % ((sy.pi + sy.exp(1)).evalf()))' : '((sy.pi + sy.exp(1)).evalf())',
+ 'print("(sy.pi + sy.exp(1)).evalf() = %s" % ((sy.pi + sy.exp(1)).evalf()))' : '((sy.pi + sy.exp(1)).evalf())',
'print("sy.oo = %s" % sy.oo)' : 'sy.oo',
'print("sy.oo > 99999 = %s" % (sy.oo > 99999))' : '(sy.oo > 99999)',
'print("sy.sqrt(2) = %s" % (sy.sqrt(2).evalf(100)))' : '(sy.sqrt(2).evalf(100))',