Skip to content

Commit c4791d1

Browse files
committed
massive refactoring to allow more flexible addition and exchange of chapters in the future
1 parent 419ce6e commit c4791d1

File tree

21 files changed

+148
-148
lines changed

21 files changed

+148
-148
lines changed

notation/terms.sty

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ text={\softwareStyle{Java}},%
186186
name={Java},%
187187
sort={Java},%
188188
description={%
189-
is another very success programming language, with roots in the \pgls{C}~family of languages~\cite{LNL2020LJ,B2008EJ}.%
189+
is another very successful programming language, with roots in the \pgls{C}~family of languages~\cite{LNL2020LJ,B2008EJ}.%
190190
}%
191191
}%
192192
%

styles/listing.sty

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ $\downarrow$~~\expandafter\bashil{bash #3}~~$\downarrow$%
327327
\gitLoad{#1}{#2/#3}{python3 -m latexgit.formatters.python #4}%
328328
\expandafter\expandafter\expandafter\edef\expandafter\csname @pwp@gitUrl:lst:#5\endcsname{\gitUrl}%
329329
\expandafter\expandafter\expandafter\edef\expandafter\csname @pwp@gitFile:lst:#5\endcsname{\gitFile}%
330-
\gitExec{#1}{.}{./scripts/pythonIgnoreErrors.sh #2 #3}%
330+
\gitExec{#1}{.}{./_scripts_/pythonIgnoreErrors.sh #2 #3}%
331331
\expandafter\expandafter\expandafter\edef\expandafter\csname @pwp@gitFile:exec:#5\endcsname{\gitFile}%
332332
%
333333
\begin{figure}[tb]%

text/back/scripts.tex

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
\hsection{Scripts}%
22
%
3-
\gitBash{\programmingWithPythonCodeRepo}{scripts/mypy.sh}{bash:mypy}{%
3+
\gitBash{\programmingWithPythonCodeRepo}{_scripts_/mypy.sh}{bash:mypy}{%
44
A \bash\ script for executing \mypy, which prints the command line and the exit code; see \cref{ut:mypy}.}%
55
%
6-
\gitBash{\programmingWithPythonCodeRepo}{scripts/ruff.sh}{bash:ruff}{%
6+
\gitBash{\programmingWithPythonCodeRepo}{_scripts_/ruff.sh}{bash:ruff}{%
77
A \bash\ script for executing \ruff, which prints the command line and the exit code; see \cref{ut:ruff}.}%
88
%
9-
\gitBash{\programmingWithPythonCodeRepo}{scripts/pylint.sh}{bash:pylint}{%
9+
\gitBash{\programmingWithPythonCodeRepo}{_scripts_/pylint.sh}{bash:pylint}{%
1010
A \bash\ script for executing \pylint, which prints the command line and the exit code; see \cref{ut:pylint}.}%
1111
%
12-
\gitBash{\programmingWithPythonCodeRepo}{scripts/pytest.sh}{bash:pytest}{%
12+
\gitBash{\programmingWithPythonCodeRepo}{_scripts_/pytest.sh}{bash:pytest}{%
1313
A \bash\ script for executing test cases with \pytest, which prints the command line and the exit code; see \cref{ut:pytest}.}%
1414
%
15-
\gitBash{\programmingWithPythonCodeRepo}{scripts/pytest_doctest.sh}{bash:pytest_doctest}{%
15+
\gitBash{\programmingWithPythonCodeRepo}{_scripts_/pytest_doctest.sh}{bash:pytest_doctest}{%
1616
A \bash\ script for executing \pglspl{doctest} with \pytest, which prints the command line and the exit code; see \cref{ut:doctest}.}%
1717
%
1818
Here we provide some scripts that are used within this book.

text/main/basics/collections/dictionaries/dictionaries.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
\hsection{Dictionaries}%
22
\label{sec:dictionaries}%
33
%
4-
\gitPythonAndOutput{\programmingWithPythonCodeRepo}{02_collections}{dicts_1.py}{--args format}{dicts:dicts_1}{%
4+
\gitPythonAndOutput{\programmingWithPythonCodeRepo}{collections}{dicts_1.py}{--args format}{dicts:dicts_1}{%
55
An example of using dictionaries in \python.}%
66
%
77
Dictionaries in \python\ are containers that store key-value pairs.

text/main/basics/collections/lists/lists.tex

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
\hsection{Basic Functionality and Examples}%
88
\label{sec:lists:basicFunctions}%
99
%
10-
\gitPythonAndOutput{\programmingWithPythonCodeRepo}{02_collections}{lists_1.py}{--args format}{lists:lists_1}{%
10+
\gitPythonAndOutput{\programmingWithPythonCodeRepo}{collections}{lists_1.py}{--args format}{lists:lists_1}{%
1111
A first example for using lists in \python: creating, indexing, printing of and appending elements and other lists to lists.}%
1212
%
13-
\gitPythonAndOutput{\programmingWithPythonCodeRepo}{02_collections}{lists_2.py}{--args format}{lists:lists_2}{%
13+
\gitPythonAndOutput{\programmingWithPythonCodeRepo}{collections}{lists_2.py}{--args format}{lists:lists_2}{%
1414
A second example of using lists in \python: inserting and deleting elements, sorting and reversing lists.}%
1515
%
16-
\gitPythonAndOutput{\programmingWithPythonCodeRepo}{02_collections}{lists_3.py}{--args format}{lists:lists_3}{%
16+
\gitPythonAndOutput{\programmingWithPythonCodeRepo}{collections}{lists_3.py}{--args format}{lists:lists_3}{%
1717
A third example of using lists in \python: slicing, adding, and multiplying lists.}%
1818
%
1919
In \cref{lst:lists:lists_1}, we provide some first examples for using lists.
@@ -143,7 +143,7 @@
143143
\hsection{An Example of Errors and a new Tool}%
144144
\label{sec:listExampleForErrorsAndRuff}%
145145
%
146-
\gitPythonAndOutput{\programmingWithPythonCodeRepo}{02_collections}{lists_error.py}{--args format}{lists:lists_error}{%
146+
\gitPythonAndOutput{\programmingWithPythonCodeRepo}{collections}{lists_error.py}{--args format}{lists:lists_error}{%
147147
A program processing lists which exhibits some subtle errors and inefficiencies.}
148148

149149
Now, in the previous chapter, we learned that static code analysis tools can help us to discover subtle problems in our programs.
@@ -153,7 +153,7 @@
153153
It does not have any \emph{error} in the strict sense.
154154
We can execute it just fine and it will produce the output \textil{[1, 2, 3]} as shown in \cref{exec:lists:lists_error}.
155155

156-
\gitOutputTool{\programmingWithPythonCodeRepo}{.}{scripts/mypy.sh 02_collections lists_error.py}{lists:lists_error:mypy}{%
156+
\gitOutputTool{\programmingWithPythonCodeRepo}{.}{_scripts_/mypy.sh collections lists_error.py}{lists:lists_error:mypy}{%
157157
The results of static type checking with \mypy\ of the program given in \cref{lst:lists:lists_error}.}
158158

159159
However, upon closer inspection, we discover some issues.
@@ -179,7 +179,7 @@
179179
We provide a script for using \ruff\ with a reasonable default configuration in \cref{lst:bash:ruff} on \cpageref{lst:bash:ruff}.%
180180
}%
181181
%
182-
\gitOutputTool{\programmingWithPythonCodeRepo}{.}{scripts/ruff.sh 02_collections lists_error.py}{lists:lists_error:ruff}{%
182+
\gitOutputTool{\programmingWithPythonCodeRepo}{.}{_scripts_/ruff.sh collections lists_error.py}{lists:lists_error:ruff}{%
183183
The results of linting with \ruff\ of the program given in \cref{lst:lists:lists_error}. (We used the script given in \cref{lst:bash:ruff} on \cpageref{lst:bash:ruff} to apply \ruff.)}%
184184
%
185185
Let us apply \ruff\ to the program \textil{lists_error.py} given in \cref{lst:lists:lists_error}, which produces the output \cref{exec:lists:lists_error:ruff}.
@@ -199,7 +199,7 @@
199199
It basically creates a list via \pythonil{[1, 2, 3]} and then immediately makes a copy of it via the \pythonilIdx{list} function wrapped around the list specification.
200200
We can leave this outer call to \pythonil{list} away.
201201

202-
\gitPythonAndOutput{\programmingWithPythonCodeRepo}{02_collections}{lists_fixed.py}{--args format}{lists:lists_fixed}{%
202+
\gitPythonAndOutput{\programmingWithPythonCodeRepo}{collections}{lists_fixed.py}{--args format}{lists:lists_fixed}{%
203203
The corrected version of~\cref{lst:lists:lists_error}, taking into account the information given by \mypy\ in \cref{exec:lists:lists_error:mypy} and \ruff\ in \cref{exec:lists:lists_error:ruff}.}%
204204
%
205205
%
@@ -220,10 +220,10 @@
220220
%
221221
\FloatBarrier%
222222
%
223-
\gitOutputTool{\programmingWithPythonCodeRepo}{.}{scripts/mypy.sh 02_collections lists_fixed.py}{lists:lists_fixed:mypy}{%
223+
\gitOutputTool{\programmingWithPythonCodeRepo}{.}{_scripts_/mypy.sh collections lists_fixed.py}{lists:lists_fixed:mypy}{%
224224
The results of static type checking with \mypy\ of the program given in \cref{lst:lists:lists_fixed}.}%
225225
%
226-
\gitOutputTool{\programmingWithPythonCodeRepo}{.}{scripts/ruff.sh 02_collections lists_fixed.py}{lists:lists_fixed:ruff}{%
226+
\gitOutputTool{\programmingWithPythonCodeRepo}{.}{_scripts_/ruff.sh collections lists_fixed.py}{lists:lists_fixed:ruff}{%
227227
The results of static type checking with \ruff\ of the program given in \cref{lst:lists:lists_fixed}.}
228228

229229
Well, this was only a two-line program.

text/main/basics/collections/sets/sets.tex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
\hsection{Sets}%
22
\label{sec:sets}%
33
%
4-
\gitPythonAndOutput{\programmingWithPythonCodeRepo}{02_collections}{sets_1.py}{--args format}{sets:sets_1}{%
4+
\gitPythonAndOutput{\programmingWithPythonCodeRepo}{collections}{sets_1.py}{--args format}{sets:sets_1}{%
55
A first example of using sets in \python: creating, modifying, and converting sets. %
66
Since sets are unordered, printing them can yield a different result each time a program is executed (see \cref{bp:setsUnordered}).}%
77
%
8-
\gitPythonAndOutput{\programmingWithPythonCodeRepo}{02_collections}{sets_2.py}{--args format}{sets:sets_2}{%
8+
\gitPythonAndOutput{\programmingWithPythonCodeRepo}{collections}{sets_2.py}{--args format}{sets:sets_2}{%
99
A second example of using sets in \python: creating sets and set operations (as illustrated in \cref{fig:setOperations}). %
1010
Since sets are unordered, printing them can yield a different result each time a program is executed (see \cref{bp:setsUnordered}).}%
1111
%

text/main/basics/collections/tuples/tuples.tex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
\hsection{Tuples}%
22
\label{sec:tuples}%
33
%
4-
\gitPythonAndOutput{\programmingWithPythonCodeRepo}{02_collections}{tuples_1.py}{--args format}{tuples:tuples_1}{%
4+
\gitPythonAndOutput{\programmingWithPythonCodeRepo}{collections}{tuples_1.py}{--args format}{tuples:tuples_1}{%
55
A first example of using tuples in \python: creating, indexing, and printing of tuples.}%
66
%
7-
\gitPythonAndOutput{\programmingWithPythonCodeRepo}{02_collections}{tuples_2.py}{--args format}{tuples:tuples_2}{%
7+
\gitPythonAndOutput{\programmingWithPythonCodeRepo}{collections}{tuples_2.py}{--args format}{tuples:tuples_2}{%
88
A second example of using tuples in \python: tuples with elements of different types and tuple unpacking.}%
99
%
10-
\gitPythonAndErrorOutput{\programmingWithPythonCodeRepo}{02_collections}{tuples_3.py}{--args format}{tuples:tuples_3}{%
10+
\gitPythonAndErrorOutput{\programmingWithPythonCodeRepo}{collections}{tuples_3.py}{--args format}{tuples:tuples_3}{%
1111
A third example of using tuples in \python: testing the immutability property.}%
1212
%
13-
\gitOutputTool{\programmingWithPythonCodeRepo}{.}{scripts/mypy.sh 02_collections tuples_3.py}{tuples:tuples_3:mypy}{%
13+
\gitOutputTool{\programmingWithPythonCodeRepo}{.}{_scripts_/mypy.sh collections tuples_3.py}{tuples:tuples_3:mypy}{%
1414
The results of static type checking with \mypy\ of the program given in \cref{lst:tuples:tuples_3}.}%
1515
%
1616
\pythonIdx{tuple}%

text/main/basics/gettingStarted/firstProgram/firstProgram.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
This program should just print \inQuotes{Hello World!} to the text output and then exit.
77
It therefore will consist of the single statement \pythonil{print("Hello World!")}, as illustrated in \cref{lst:very_first_program}.
88

9-
\gitPythonAndOutput{\programmingWithPythonCodeRepo}{00_veryFirstProject}{very_first_program.py}{--args format}{very_first_program}{%
9+
\gitPythonAndOutput{\programmingWithPythonCodeRepo}{veryFirstProject}{very_first_program.py}{--args format}{very_first_program}{%
1010
Our very first \python\ program, which just prints \inQuotes{Hello World!}}%
1111
%
1212
\begin{figure}%

text/main/basics/variables/assignment/assignment.tex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
Here, \pythonil{name} is the name of the variable and \pythonil{value} be the value that we want to assign to that name.%
77
%
88
\hsection{A Simple Example of Variable Assignment and Comments in the Code}%
9-
\gitPythonAndOutput{\programmingWithPythonCodeRepo}{01_variables}{assignment.py}{--args format}{variables:assignment}{%
9+
\gitPythonAndOutput{\programmingWithPythonCodeRepo}{variables}{assignment.py}{--args format}{variables:assignment}{%
1010
A \python\ program showing some examples for variable assignments.}%
1111
%
1212
\begin{figure}[tb]%
@@ -232,7 +232,7 @@
232232
\pi_{2e} &= \frac{e}{2} s_{2e}\label{eq:liuhui:approx}%
233233
\end{align}%
234234
%
235-
\gitPythonAndOutput{\programmingWithPythonCodeRepo}{01_variables}{pi_liu_hui.py}{--args format}{variables:pi_liu_hui}{%
235+
\gitPythonAndOutput{\programmingWithPythonCodeRepo}{variables}{pi_liu_hui.py}{--args format}{variables:pi_liu_hui}{%
236236
A \python\ program showing several steps of the approximation of~\numberPi\ using the method of LIU Hui.}%
237237
%
238238
\begin{figure}[tb]%

text/main/basics/variables/identity/identity.tex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
\label{fig:variables:equalityAndIdentity}%
2222
\end{figure}%
2323
%
24-
\gitPythonAndOutput{\programmingWithPythonCodeRepo}{01_variables}{identity_1.py}{--args format}{variables:identity_1}{%
24+
\gitPythonAndOutput{\programmingWithPythonCodeRepo}{variables}{identity_1.py}{--args format}{variables:identity_1}{%
2525
An example of the difference between equality and identity\pythonIdx{sqrt}.}%
2626
%
27-
\gitPythonAndOutput{\programmingWithPythonCodeRepo}{01_variables}{identity_2.py}{--args format}{variables:identity_2}{%
27+
\gitPythonAndOutput{\programmingWithPythonCodeRepo}{variables}{identity_2.py}{--args format}{variables:identity_2}{%
2828
An second example of the difference between equality and identity.}%
2929
%
3030
We use variables to references objects in memory.

0 commit comments

Comments
 (0)