From ee32b73efc8cd7c4d414cd286e21feeae92e0d4a Mon Sep 17 00:00:00 2001
From: Daniel Roy Greenfeld <62857+pydanny@users.noreply.github.com>
Date: Tue, 11 Jun 2024 18:06:28 +0100
Subject: [PATCH] Update BJJ
---
pages/about.mdoc | 2 +-
public/feeds/atom.xml | 95 ++++++++++++++++++++++--------------
public/feeds/django.atom.xml | 2 +-
public/feeds/python.atom.xml | 2 +-
public/feeds/til.atom.xml | 95 ++++++++++++++++++++++--------------
5 files changed, 121 insertions(+), 75 deletions(-)
diff --git a/pages/about.mdoc b/pages/about.mdoc
index 001f4b9..49e973c 100644
--- a/pages/about.mdoc
+++ b/pages/about.mdoc
@@ -10,7 +10,7 @@ I am a [coder](https://github.com/pydanny), [author](/books), and [speaker](/spe
I'm probably best known as "[pydanny](https://www.google.com/search?q=pydanny)", one of the authors of [Two Scoops of Django](/books/tech).
-I love to hang out with my [wife](https://audrey.feldroy.com/), play with my [daughter](/tags/uma), do [Brazilian Jiu-Jitsu](https://en.wikipedia.org/wiki/Brazilian_jiu-jitsu), write [books](/books), and read books. I work at [Kraken Tech](https://kraken.tech/), a company that is part of the sustainable global energy [Octopus Energy Group](https://octopusenergy.group/) working to address [global climate change](/tags/climate-change).
+I love to hang out with my [wife](https://audrey.feldroy.com/), play with my [daughter](/tags/uma), do [Brazilian Jiu-Jitsu](https://en.wikipedia.org/wiki/Brazilian_jiu-jitsu) at [Apex BJJ](https://www.apexbjj.co.uk/) in London, write [books](/books), and read books. I work at [Kraken Tech](https://kraken.tech/), a company that is part of the sustainable global energy [Octopus Energy Group](https://octopusenergy.group/) working to address [global climate change](/tags/climate-change).
- [Mastodon](https://fosstodon.org/@danielfeldroy)
- [LinkedIn](https://www.linkedin.com/in/danielfeldroy/)
diff --git a/public/feeds/atom.xml b/public/feeds/atom.xml
index 930f49d..b424a85 100644
--- a/public/feeds/atom.xml
+++ b/public/feeds/atom.xml
@@ -2,7 +2,7 @@
This will throw a mypy error:
+# code.py
+class MyException(Exception):
+ pass
+
+
+def myfunc(custom_exception: Exception) -> None:
+ try:
+ print('Test')
+ except custom_exception:
+ print('error)
+
+myfunc(MyException)
+
+The error mypy will throw looks something like this:
+$ mypy code.py
+
+code.py:6: error: Exception type must be derived from BaseException (or be a tuple of exception classes) [misc]
+code.py:9: error: Argument 1 to "custom_exception" has incompatible type "type[MyException]"; expected "Exception" [arg-type]
+Found 2 errors in 1 file (checked 1 source file)
+
+The solution is to use typing.Type
:
# code.py
+from typing import Type
+
+
+class MyException(Exception):
+ pass
+
+
+def myfunc(custom_exception: Type[Exception]) -> None:
+ try:
+ print('Test')
+ except custom_exception:
+ print('error)
+
+myfunc(MyException)
+
+]]>
+ Whenever I create a new branch and try to push the new commit then I start seeing this error:
-git push --force
-fatal: The current branch new-awesome-feature has no upstream branch.
-To push the current branch and set the remote as upstream, use
-
- git push --set-upstream origin new-awesome-feature
-
-To have this happen automatically for branches without a tracking
-upstream, see 'push.autoSetupRemote' in 'git help config'.
-
-To fix it so git just auto creates the branch, just enter this magic command:
-git config --global --add --bool push.autoSetupRemote true
-
-]]>This will throw a mypy error:
+# code.py
+class MyException(Exception):
+ pass
+
+
+def myfunc(custom_exception: Exception) -> None:
+ try:
+ print('Test')
+ except custom_exception:
+ print('error)
+
+myfunc(MyException)
+
+The error mypy will throw looks something like this:
+$ mypy code.py
+
+code.py:6: error: Exception type must be derived from BaseException (or be a tuple of exception classes) [misc]
+code.py:9: error: Argument 1 to "custom_exception" has incompatible type "type[MyException]"; expected "Exception" [arg-type]
+Found 2 errors in 1 file (checked 1 source file)
+
+The solution is to use typing.Type
:
# code.py
+from typing import Type
+
+
+class MyException(Exception):
+ pass
+
+
+def myfunc(custom_exception: Type[Exception]) -> None:
+ try:
+ print('Test')
+ except custom_exception:
+ print('error)
+
+myfunc(MyException)
+
+]]>Whenever I create a new branch and try to push the new commit then I start seeing this error:
-git push --force
-fatal: The current branch new-awesome-feature has no upstream branch.
-To push the current branch and set the remote as upstream, use
-
- git push --set-upstream origin new-awesome-feature
-
-To have this happen automatically for branches without a tracking
-upstream, see 'push.autoSetupRemote' in 'git help config'.
-
-To fix it so git just auto creates the branch, just enter this magic command:
-git config --global --add --bool push.autoSetupRemote true
-
-]]>