Skip to content

Commit

Permalink
Deploying to gh-pages from @ 6a03a5a 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
MarionBWeinzierl committed Jul 5, 2024
1 parent 87b9183 commit 8c4a88e
Show file tree
Hide file tree
Showing 5 changed files with 283 additions and 239 deletions.
8 changes: 2 additions & 6 deletions _comments_docstrings.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ Cat code comment image by [35_equal_W](https://www.reddit.com/r/ProgrammerHumor/

## Comments - some thoughts^[Adapted from [@stackoverflow_comments]] {.smaller}

::: {.incremental}

- Comments should not duplicate the code.
- Good comments do not excuse unclear code.
- Comments should dispel confusion, not cause it.
Expand All @@ -65,8 +63,6 @@ Cat code comment image by [35_equal_W](https://www.reddit.com/r/ProgrammerHumor/
- Comments are not documentation.
- Read by developers, documentation is for...

:::



## Docstrings {.smaller}
Expand Down Expand Up @@ -179,6 +175,7 @@ def calculate_gyroradius(mass, v_perp, charge, B, gamma=None):
:::
::::

<!--

## Docstrings - pydocstyle {.smaller}

Expand Down Expand Up @@ -256,8 +253,7 @@ def calculate_gyroradius(mass, v_perp, charge, B, gamma=None):

[^2]: Note that pydocstyle is [deprecated](https://github.com/PyCQA/pydocstyle/pull/658) as of the end of 2023. Longer-term look out for a replacement (likely Ruff or Pylint extension).



-->
## Exercise 5 {.smaller}

Go to exercise 5 and examine the comments:
Expand Down
12 changes: 8 additions & 4 deletions _fstrings_magic_config.qmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Writing better (Python) code

<!--
## f-strings {.smaller}
A better way to format strings since Python 3.6\
Expand Down Expand Up @@ -29,7 +30,7 @@ print(f"a={a} and b={b}. Their product is {a * b}, sum is {a + b}, and a/b is {a
See [Real Python](https://realpython.com/python-f-strings/) for more information.
Note: pylint W1203 recommends against using f-strings in logging calls.

-->

## Remove Magic Numbers {.smaller}

Expand Down Expand Up @@ -133,7 +134,7 @@ def bpm(l):
:::
::::


<!--
## Put config in a config file {.smaller}
:::: {.columns}
Expand Down Expand Up @@ -183,7 +184,7 @@ print(config)
:::
::::

-->

<!-- ------------------------------------------------------------------------------ -->

Expand All @@ -198,7 +199,7 @@ Magic Numbers
- Look through the code and identify any magic numbers.
- Implement what you feel is the best approach in each case


<!--
f-strings
- Look for any string handling (currently using the .format() approach) and update it
Expand All @@ -207,10 +208,13 @@ f-strings
- Is the layout of the data written to file easier to understand?
:::
::: {.column width="50%"}
Configuration settings
- There is helpfully a list of configurable inputs at the end of the file under `"__main__"`.\
We can improve on this, however, by placing them in a configuration file.
- Create an appropriate json file to be read in as a dictionary and passed to the main function.
-->
:::
::::

3 changes: 2 additions & 1 deletion _licenses.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
```

<!--
## Add a license in Github
![](images/github_license.png){width=80% fig-align="center"}
## Add a license in Gitlab
![](images/gitlab_license.png){width=80% fig-align="center"}

-->

480 changes: 262 additions & 218 deletions index.html

Large diffs are not rendered by default.

19 changes: 9 additions & 10 deletions python.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,7 @@ Beyond the scope of today are a few other honourable mentions:
- Adding type hinting to python code - how and why?
- Type checking with mypy

These lessons will be added to the course content in future but are beyond the scope
of today.
These lessons are beyond the scope of today.

<!-- ------------------------------------------------------------------------------
Expand Down Expand Up @@ -245,21 +244,21 @@ Get in touch:
{{< fa brands mastodon >}} \ [\@jatkinson1000\@fosstodon.org](https://fosstodon.org/@jatkinson1000)
:::
::: {.column width="35%"}
{{< fa pencil >}} \ Amy Pike

{{< fa solid envelope >}} \ [ap766[AT]cam.ac.uk](mailto:ap766@cam.ac.uk)

{{< fa brands github >}} \ [AmyOctoCat](https://github.com/AmyOctoCat)

\

{{< fa pencil >}} \ Marion Weinzierl

{{< fa solid envelope >}} \ [mw925[AT]cam.ac.uk](mailto:mw925@cam.ac.uk)

{{< fa brands github >}} \ [MarionBWeinzierl](https://github.com/MarionBWeinzierl)

{{< fa brands mastodon >}} \ [\@MarionBWeinzierl\@mast.hpc.social](https://mast.hpc.social/@MarionBWeinzierl)

\
{{< fa pencil >}} \ Amy Pike

{{< fa solid envelope >}} \ [ap766[AT]cam.ac.uk](mailto:ap766@cam.ac.uk)

{{< fa brands github >}} \ [AmyOctoCat](https://github.com/AmyOctoCat)

:::
::::

Expand Down

0 comments on commit 8c4a88e

Please sign in to comment.