Skip to content

Commit 5f7179b

Browse files
committed
Fix linting issues
1 parent ca8edbf commit 5f7179b

File tree

2 files changed

+99
-101
lines changed

2 files changed

+99
-101
lines changed

conf.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,14 @@
9999

100100
# Enable executable .md files support
101101
myst_enable_extensions = [
102-
'colon_fence',
103-
'dollarmath',
104-
'substitution',
105-
'tasklist',
106-
'attrs_inline',
107-
'linkify',
102+
"colon_fence",
103+
"dollarmath",
104+
"substitution",
105+
"tasklist",
106+
"attrs_inline",
108107
]
109108

110-
nb_output_stderr = 'show'
109+
nb_output_stderr = "show"
111110

112111
# Monkey-patch sphinx to set the lineseparator option of pygment, to
113112
# have indented line wrapping

intro/intro.md

Lines changed: 93 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ kernelspec:
1414

1515
# Python scientific computing ecosystem
1616

17-
*Authors*: *Fernando Perez, Emmanuelle Gouillart, Gaël Varoquaux,
18-
Valentin Haenel*
17+
_Authors_: _Fernando Perez, Emmanuelle Gouillart, Gaël Varoquaux,
18+
Valentin Haenel_
1919

2020
## Why Python?
2121

@@ -29,27 +29,27 @@ Valentin Haenel*
2929
### Python’s strengths
3030

3131
- **Batteries included** Rich collection of already existing **bricks**
32-
of classic numerical methods, plotting or data processing tools. We
33-
don’t want to re-program the plotting of a curve, a Fourier transform
34-
or a fitting algorithm. Don’t reinvent the wheel!
32+
of classic numerical methods, plotting or data processing tools. We
33+
don’t want to re-program the plotting of a curve, a Fourier transform
34+
or a fitting algorithm. Don’t reinvent the wheel!
3535

3636
- **Easy to learn** Most scientists are not paid as programmers, neither
37-
have they been trained so. They need to be able to draw a curve, smooth
38-
a signal, do a Fourier transform in a few minutes.
37+
have they been trained so. They need to be able to draw a curve, smooth
38+
a signal, do a Fourier transform in a few minutes.
3939

4040
- **Easy communication** To keep code alive within a lab or a company
41-
it should be as readable as a book by collaborators, students, or
42-
maybe customers. Python syntax is simple, avoiding strange symbols or
43-
lengthy routine specifications that would divert the reader from
44-
mathematical or scientific understanding of the code.
41+
it should be as readable as a book by collaborators, students, or
42+
maybe customers. Python syntax is simple, avoiding strange symbols or
43+
lengthy routine specifications that would divert the reader from
44+
mathematical or scientific understanding of the code.
4545

4646
- **Efficient code** Python numerical modules are computationally
47-
efficient. But needless to say that a very fast code becomes useless if
48-
too much time is spent writing it. Python aims for quick development
49-
times and quick execution times.
47+
efficient. But needless to say that a very fast code becomes useless if
48+
too much time is spent writing it. Python aims for quick development
49+
times and quick execution times.
5050

5151
- **Universal** Python is a language used for many different problems.
52-
Learning Python avoids learning a new software for each new problem.
52+
Learning Python avoids learning a new software for each new problem.
5353

5454
### How does Python compare to other solutions?
5555

@@ -124,60 +124,59 @@ that can be combined to obtain a scientific computing environment:
124124

125125
**Python**, a generic and modern computing language
126126

127-
- The language: flow control, data types (`string`, `int`),
128-
data collections (lists, dictionaries), etc.
127+
- The language: flow control, data types (`string`, `int`),
128+
data collections (lists, dictionaries), etc.
129129

130-
- Modules of the standard library: string processing, file
131-
management, simple network protocols.
130+
- Modules of the standard library: string processing, file
131+
management, simple network protocols.
132132

133-
- A large number of specialized modules or applications written in
134-
Python: web framework, etc. … and scientific
135-
computing.
133+
- A large number of specialized modules or applications written in
134+
Python: web framework, etc. ... and scientific computing.
136135

137-
- Development tools (automatic testing, documentation generation)
136+
- Development tools (automatic testing, documentation generation)
138137

139138
:::{seealso}
140139
{ref}`chapter on Python language <python_language_chapter>`
141140
:::
142141

143142
**Core numeric libraries**
144143

145-
- **NumPy**: numerical computing with powerful **numerical arrays**
146-
objects, and routines to manipulate them. https://numpy.org/
144+
- **NumPy**: numerical computing with powerful **numerical arrays**
145+
objects, and routines to manipulate them. https://numpy.org/
147146

148-
:::{seealso}
149-
{ref}`chapter on numpy <numpy>`
150-
:::
147+
:::{seealso}
148+
{ref}`chapter on numpy <numpy>`
149+
:::
151150

152-
- **SciPy** : high-level numerical routines.
153-
Optimization, regression, interpolation, etc https://scipy.org/
151+
- **SciPy** : high-level numerical routines.
152+
Optimization, regression, interpolation, etc https://scipy.org/
154153

155-
:::{seealso}
156-
{ref}`chapter on SciPy <scipy>`
157-
:::
154+
:::{seealso}
155+
{ref}`chapter on SciPy <scipy>`
156+
:::
158157

159-
- **Matplotlib** : 2-D visualization, “publication-ready” plots
160-
https://matplotlib.org/
158+
- **Matplotlib** : 2-D visualization, “publication-ready” plots
159+
https://matplotlib.org/
161160

162-
:::{seealso}
163-
{ref}`chapter on matplotlib <matplotlib>`
164-
:::
161+
:::{seealso}
162+
{ref}`chapter on matplotlib <matplotlib>`
163+
:::
165164

166165
**Advanced interactive environments**:
167166

168-
- **IPython**, an advanced **Python console** https://ipython.org/
167+
- **IPython**, an advanced **Python console** https://ipython.org/
169168

170-
- **Jupyter**, **notebooks** in the browser https://jupyter.org/
169+
- **Jupyter**, **notebooks** in the browser https://jupyter.org/
171170

172171
**Domain-specific packages**,
173172

174-
- **pandas, statsmodels, seaborn** for {ref}`statistics <statistics>`
173+
- **pandas, statsmodels, seaborn** for {ref}`statistics <statistics>`
175174

176-
- **sympy** for {ref}`symbolic computing <sympy>`
175+
- **sympy** for {ref}`symbolic computing <sympy>`
177176

178-
- **scikit-image** for {ref}`image processing <scikit_image>`
177+
- **scikit-image** for {ref}`image processing <scikit_image>`
179178

180-
- **scikit-learn** for {ref}`machine learning <scikit-learn_chapter>`
179+
- **scikit-learn** for {ref}`machine learning <scikit-learn_chapter>`
181180

182181
and many more packages not documented in the Scientific Python Lectures.
183182

@@ -216,6 +215,7 @@ possible for Python to be used for programs, in web servers, or
216215
embedded devices.
217216

218217
(interactive_work)=
218+
219219
### Interactive work
220220

221221
We recommend an interactive work with the [IPython](https://ipython.org)
@@ -261,12 +261,11 @@ but also to create and reuse Python files. For this, a powerful code editor
261261
will get you far. Here are several good easy-to-use editors:
262262

263263
- [Spyder](https://www.spyder-ide.org/): integrates an IPython
264-
console, a debugger, a profiler…
264+
console, a debugger, a profiler…
265265
- [PyCharm](https://www.jetbrains.com/pycharm): integrates an IPython
266-
console, notebooks, a debugger… (freely available,
267-
but commercial)
266+
console, notebooks, a debugger… (freely available, but commercial)
268267
- [Visual Studio Code](https://code.visualstudio.com/docs/languages/python):
269-
integrates a Python console, notebooks, a debugger,
268+
integrates a Python console, notebooks, a debugger, ...
270269

271270
Some of these are shipped by the various scientific Python distributions,
272271
and you can find them in the menus.
@@ -309,11 +308,11 @@ the script to a set of functions:
309308
#### IPython and Jupyter Tips and Tricks
310309

311310
The user manuals contain a wealth of information. Here we give a quick
312-
introduction to four useful features: *history*, *tab completion*, *magic
313-
functions*, and *aliases*.
311+
introduction to four useful features: _history_, _tab completion_, _magic
312+
functions_, and _aliases_.
314313

315314
**Command history** Like a UNIX shell, the IPython console supports
316-
command history. Type *up* and *down* to navigate previously typed
315+
command history. Type _up_ and _down_ to navigate previously typed
317316
commands:
318317

319318
:::{code} ipython
@@ -347,64 +346,64 @@ you can just type the magic function and it will work.
347346

348347
Other useful magic functions are:
349348

350-
- `%cd` to change the current directory.
349+
- `%cd` to change the current directory.
351350

352-
:::{code} ipython
351+
:::{code} ipython
353352

354-
In [1]: cd /tmp
355-
/tmp
356-
:::
353+
In [1]: cd /tmp
354+
/tmp
355+
:::
357356

358-
- `%cpaste` allows you to paste code, especially code from websites which has
359-
been prefixed with the standard Python prompt (e.g. `>>>`) or with an ipython
360-
prompt, (e.g. `in [3]`):
357+
- `%cpaste` allows you to paste code, especially code from websites which has
358+
been prefixed with the standard Python prompt (e.g. `>>>`) or with an ipython
359+
prompt, (e.g. `in [3]`):
361360

362-
:::{code} ipython
361+
:::{code} ipython
363362

364-
In [2]: %cpaste
365-
Pasting code; enter '--' alone on the line to stop or use Ctrl-D.
366-
:for i in range(3):
367-
print(i):
368-
:--
369-
0
370-
1
371-
2
372-
:::
363+
In [2]: %cpaste
364+
Pasting code; enter '--' alone on the line to stop or use Ctrl-D.
365+
:for i in range(3):
366+
print(i):
367+
:--
368+
0
369+
1
370+
2
371+
:::
373372

374-
- `%timeit` allows you to time the execution of short snippets using the
375-
`timeit` module from the standard library:
373+
- `%timeit` allows you to time the execution of short snippets using the
374+
`timeit` module from the standard library:
376375

377-
:::{code} ipython
378-
In [3]: %timeit x = 10
379-
10000000 loops, best of 3: 39 ns per loop
380-
:::
376+
:::{code} ipython
377+
In [3]: %timeit x = 10
378+
10000000 loops, best of 3: 39 ns per loop
379+
:::
381380

382-
:::{seealso} {ref}`Chapter on optimizing code <optimizing_code_chapter>`
383-
:::
381+
:::{seealso} {ref}`Chapter on optimizing code <optimizing_code_chapter>`
382+
:::
384383

385-
- `%debug` allows you to enter post-mortem debugging. That is to say, if the
386-
code you try to execute, raises an exception, using `%debug` will enter the
387-
debugger at the point where the exception was thrown.
384+
- `%debug` allows you to enter post-mortem debugging. That is to say, if the
385+
code you try to execute, raises an exception, using `%debug` will enter the
386+
debugger at the point where the exception was thrown.
388387

389-
:::{code} ipython
390-
In [4]: x === 10
388+
:::{code} ipython
389+
In [4]: x === 10
391390

392-
In [5]: %debug
393-
> /home/jarrod/.venv/lectures/lib64/python3.11/site-packages/IPython/core/compilerop.py(86)ast_parse()
394-
84 Arguments are exactly the same as ast.parse (in the standard library),
395-
85 and are passed to the built-in compile function."""
396-
---> 86 return compile(source, filename, symbol, self.flags | PyCF_ONLY_AST, 1)
397-
87
398-
88 def reset_compiler_flags(self):
399-
ipdb> locals()
400-
{'self': <IPython.core.compilerop.CachingCompiler object at 0x7f30d02efc10>, 'source': 'x === 10\n', 'filename': '<ipython-input-1-8e8bc565444b>', 'symbol': 'exec'}
401-
ipdb>
402-
:::
391+
In [5]: %debug
392+
> /home/jarrod/.venv/lectures/lib64/python3.11/site-packages/IPython/core/compilerop.py(86)ast_parse()
393+
84 Arguments are exactly the same as ast.parse (in the standard library),
394+
85 and are passed to the built-in compile function."""
395+
---> 86 return compile(source, filename, symbol, self.flags | PyCF_ONLY_AST, 1)
396+
87
397+
88 def reset_compiler_flags(self):
398+
ipdb> locals()
399+
{'self': <IPython.core.compilerop.CachingCompiler object at 0x7f30d02efc10>, 'source': 'x === 10\n', 'filename': '<ipython-input-1-8e8bc565444b>', 'symbol': 'exec'}
400+
ipdb>
401+
:::
403402

404403
:::{seealso} {ref}`Chapter on debugging <debugging_chapter>`
405404

406405
**Aliases**
407-
Furthermore IPython ships with various *aliases* which emulate common UNIX
406+
Furthermore IPython ships with various _aliases_ which emulate common UNIX
408407
command line tools such as `ls` to list files, `cp` to copy files and `rm` to
409408
remove files (a full list of aliases is shown when typing `alias`).
410409

0 commit comments

Comments
 (0)