Skip to content

Commit c5ff061

Browse files
committed
Website build
1 parent e82a480 commit c5ff061

File tree

5 files changed

+99
-7
lines changed

5 files changed

+99
-7
lines changed

3_objects.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ <h3><span class="section-number">3.3.4. </span>String representations of objects
602602
<span id="object-arithmetic"></span><h3><span class="section-number">3.3.6. </span>Defining arithmetic options on objects<a class="headerlink" href="#defining-arithmetic-options-on-objects" title="Permalink to this headline"></a></h3>
603603
<details class="sphinx-bs dropdown card mb-3">
604604
<summary class="summary-title card-header">
605-
Video: object equality and test driven development<div class="summary-down docutils">
605+
Video: polynomial addition.<div class="summary-down docutils">
606606
<svg version="1.1" width="24" height="24" class="octicon octicon-chevron-down" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M5.22 8.72a.75.75 0 000 1.06l6.25 6.25a.75.75 0 001.06 0l6.25-6.25a.75.75 0 00-1.06-1.06L12 14.44 6.28 8.72a.75.75 0 00-1.06 0z"></path></svg></div>
607607
<div class="summary-up docutils">
608608
<svg version="1.1" width="24" height="24" class="octicon octicon-chevron-up" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M18.78 15.28a.75.75 0 000-1.06l-6.25-6.25a.75.75 0 00-1.06 0l-6.25 6.25a.75.75 0 101.06 1.06L12 9.56l5.72 5.72a.75.75 0 001.06 0z"></path></svg></div>

4_style.html

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,20 @@
5353

5454
<div class="section" id="a-matter-of-style">
5555
<span id="style"></span><h1><span class="section-number">4. </span>A matter of style<a class="headerlink" href="#a-matter-of-style" title="Permalink to this headline"></a></h1>
56-
<div class="section" id="the-value-of-convention">
56+
<details class="sphinx-bs dropdown card mb-3">
57+
<summary class="summary-title card-header">
58+
Video: why style?<div class="summary-down docutils">
59+
<svg version="1.1" width="24" height="24" class="octicon octicon-chevron-down" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M5.22 8.72a.75.75 0 000 1.06l6.25 6.25a.75.75 0 001.06 0l6.25-6.25a.75.75 0 00-1.06-1.06L12 14.44 6.28 8.72a.75.75 0 00-1.06 0z"></path></svg></div>
60+
<div class="summary-up docutils">
61+
<svg version="1.1" width="24" height="24" class="octicon octicon-chevron-up" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M18.78 15.28a.75.75 0 000-1.06l-6.25-6.25a.75.75 0 00-1.06 0l-6.25 6.25a.75.75 0 101.06 1.06L12 9.56l5.72 5.72a.75.75 0 001.06 0z"></path></svg></div>
62+
</summary><div class="summary-content card-body docutils">
63+
<div class="vimeo docutils container">
64+
<iframe src="https://player.vimeo.com/video/499766703"
65+
frameborder="0" allow="autoplay; fullscreen"
66+
allowfullscreen></iframe></div>
67+
<p class="card-text">Imperial students can also <a class="reference external" href="https://imperial.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=3572d8ea-5635-4b1a-9243-acae0150ddf8">watch this video on Panopto</a></p>
68+
</div>
69+
</details><div class="section" id="the-value-of-convention">
5770
<h2><span class="section-number">4.1. </span>The value of convention<a class="headerlink" href="#the-value-of-convention" title="Permalink to this headline"></a></h2>
5871
<p>Consider the following definition of the limit of a function <span class="math notranslate nohighlight">\(f\)</span> at a point <span class="math notranslate nohighlight">\(c\)</span>:</p>
5972
<div class="proof proof-type-definition" id="id3">
@@ -139,7 +152,20 @@ <h2><span class="section-number">4.2. </span>PEP 8<a class="headerlink" href="#p
139152
with code layout rules while this chapter roams more widely.</p>
140153
<div class="section" id="linters">
141154
<h3><span class="section-number">4.2.1. </span>Linters<a class="headerlink" href="#linters" title="Permalink to this headline"></a></h3>
142-
<p>One of the helpful characteristics of PEP 8 is that many of its strictures can
155+
<details class="sphinx-bs dropdown card mb-3">
156+
<summary class="summary-title card-header">
157+
Video: installing and using a linter.<div class="summary-down docutils">
158+
<svg version="1.1" width="24" height="24" class="octicon octicon-chevron-down" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M5.22 8.72a.75.75 0 000 1.06l6.25 6.25a.75.75 0 001.06 0l6.25-6.25a.75.75 0 00-1.06-1.06L12 14.44 6.28 8.72a.75.75 0 00-1.06 0z"></path></svg></div>
159+
<div class="summary-up docutils">
160+
<svg version="1.1" width="24" height="24" class="octicon octicon-chevron-up" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M18.78 15.28a.75.75 0 000-1.06l-6.25-6.25a.75.75 0 00-1.06 0l-6.25 6.25a.75.75 0 101.06 1.06L12 9.56l5.72 5.72a.75.75 0 001.06 0z"></path></svg></div>
161+
</summary><div class="summary-content card-body docutils">
162+
<div class="vimeo docutils container">
163+
<iframe src="https://player.vimeo.com/video/499770130"
164+
frameborder="0" allow="autoplay; fullscreen"
165+
allowfullscreen></iframe></div>
166+
<p class="card-text">Imperial students can also <a class="reference external" href="https://imperial.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=91c271e4-a61f-493c-a725-acae015273d5">watch this video on Panopto</a></p>
167+
</div>
168+
</details><p>One of the helpful characteristics of PEP 8 is that many of its strictures can
143169
be enforced automatically by a computer program. Programs that automatically
144170
check programming style are called linters. Lint are the little fibres that tend
145171
to stick to clothes, especially suit jackets, and make them ugly. So a linter is
@@ -158,6 +184,20 @@ <h3><span class="section-number">4.2.1. </span>Linters<a class="headerlink" href
158184
tendency for programmers to cut style corners, with the effect that
159185
the code in a project becomes harder and harder to read and work with.</p>
160186
</div>
187+
<div class="section" id="installing-flake8">
188+
<h3><span class="section-number">4.2.2. </span>Installing flake8<a class="headerlink" href="#installing-flake8" title="Permalink to this headline"></a></h3>
189+
<p>Flake8 is a Python package, which can be installed using pip. Make sure you’ve
190+
activated your <a class="reference internal" href="2_programs_in_files.html#term-virtual-environment"><span class="xref std std-term">virtual environment</span></a> and then run:</p>
191+
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$</span> python3 -m pip install flake8
192+
</pre></div>
193+
</div>
194+
<p>This is enough to run flake8 on the command line, however you will probably want
195+
to set up your editor to highlight flake8 incompatibilities in your source. For
196+
visual studio code, first open the command palette by typing <kbd class="kbd docutils literal notranslate">control</kbd> +
197+
<kbd class="kbd docutils literal notranslate">shift</kbd> + <kbd class="kbd docutils literal notranslate">P</kbd> (<kbd class="kbd docutils literal notranslate"></kbd> + <kbd class="kbd docutils literal notranslate">shift</kbd> + <kbd class="kbd docutils literal notranslate">P</kbd> on Mac). There type
198+
“Python: Select Linter” to bring up the list of available linters, and select
199+
“flake8” from the dropdown list. The video above shows this process.</p>
200+
</div>
161201
</div>
162202
<div class="section" id="code-layout">
163203
<h2><span class="section-number">4.3. </span>Code layout<a class="headerlink" href="#code-layout" title="Permalink to this headline"></a></h2>
@@ -948,7 +988,11 @@ <h2><span class="section-number">4.9. </span>Exercises<a class="headerlink" href
948988
<span class="proof-type">Exercise 4.2</span>
949989

950990
</div><div class="proof-content">
951-
<p>Configure your Python editor to use flake8.</p>
991+
<p>Install flake8 and configure your Python editor to use flake8.</p>
992+
<div class="admonition note">
993+
<p class="admonition-title">Note</p>
994+
<p>The test should check that flake8 is importable.</p>
995+
</div>
952996
</div></div><div class="admonition note">
953997
<p class="admonition-title">Note</p>
954998
<p>Use this example in the exercises or quiz:</p>

_sources/3_objects.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ equality now behaves as we might expect.
600600
Defining arithmetic options on objects
601601
......................................
602602

603-
.. dropdown:: Video: object equality and test driven development
603+
.. dropdown:: Video: polynomial addition.
604604

605605
.. container:: vimeo
606606

_sources/4_style.rst.txt

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,20 @@
33
A matter of style
44
=================
55

6+
.. dropdown:: Video: why style?
7+
8+
.. container:: vimeo
9+
10+
.. raw:: html
11+
12+
<iframe src="https://player.vimeo.com/video/499766703"
13+
frameborder="0" allow="autoplay; fullscreen"
14+
allowfullscreen></iframe>
15+
16+
Imperial students can also `watch this video on Panopto
17+
<https://imperial.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=3572d8ea-5635-4b1a-9243-acae0150ddf8>`__
18+
19+
620
The value of convention
721
-----------------------
822

@@ -97,6 +111,20 @@ with code layout rules while this chapter roams more widely.
97111
Linters
98112
.......
99113

114+
.. dropdown:: Video: installing and using a linter.
115+
116+
.. container:: vimeo
117+
118+
.. raw:: html
119+
120+
<iframe src="https://player.vimeo.com/video/499770130"
121+
frameborder="0" allow="autoplay; fullscreen"
122+
allowfullscreen></iframe>
123+
124+
Imperial students can also `watch this video on Panopto
125+
<https://imperial.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=91c271e4-a61f-493c-a725-acae015273d5>`__
126+
127+
100128
One of the helpful characteristics of PEP 8 is that many of its strictures can
101129
be enforced automatically by a computer program. Programs that automatically
102130
check programming style are called linters. Lint are the little fibres that tend
@@ -118,6 +146,23 @@ conformance. Indeed, without a mechanism like this, there is a strong
118146
tendency for programmers to cut style corners, with the effect that
119147
the code in a project becomes harder and harder to read and work with.
120148

149+
Installing flake8
150+
.................
151+
152+
Flake8 is a Python package, which can be installed using pip. Make sure you've
153+
activated your :term:`virtual environment` and then run:
154+
155+
.. code-block:: console
156+
157+
$ python3 -m pip install flake8
158+
159+
This is enough to run flake8 on the command line, however you will probably want
160+
to set up your editor to highlight flake8 incompatibilities in your source. For
161+
visual studio code, first open the command palette by typing :kbd:`control` +
162+
:kbd:`shift` + :kbd:`P` (:kbd:`` + :kbd:`shift` + :kbd:`P` on Mac). There type
163+
"Python: Select Linter" to bring up the list of available linters, and select
164+
"flake8" from the dropdown list. The video above shows this process.
165+
121166
Code layout
122167
-----------
123168

@@ -978,8 +1023,11 @@ Exercises
9781023

9791024
.. proof:exercise::
9801025
981-
Configure your Python editor to use flake8.
1026+
Install flake8 and configure your Python editor to use flake8.
9821027

1028+
.. note::
1029+
1030+
The test should check that flake8 is importable.
9831031

9841032
.. note::
9851033

searchindex.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)