| """ | |
| To use this you'll need the following installed into your env | |
| - https://pypi.org/project/codeowners/ | |
| - https://pypi.org/project/tabulate/ | |
| Another approach to installing everything would be to use uv's scripts-dependency functionality: | |
| - https://docs.astral.sh/uv/guides/scripts/#declaring-script-dependencies | |
| Then using `uvx url-to-gist` with https://docs.astral.sh/uv/guides/tools/#requesting-different-sources |
| import sys | |
| import logging | |
| def get_logger_memory_footprint(): | |
| """ | |
| Get tuple of (logger names, size in KB) | |
| """ | |
| loggers = logging.Logger.manager.loggerDict |
| import contextlib | |
| @contextlib.contextmanager | |
| def mock_attr(object_, orig_attr_name, mock_attr): | |
| """ | |
| Temporarily mock object attribute for testing | |
| This is similiar to the unittest.patch.object in Python 3.3 just much | |
| simpler for our limited needs and use in Python 2.7. |
| ##### Taken from https://github.com/bosswissam/pysize | |
| import sys | |
| def get_size(obj, seen=None): | |
| """Recursively finds size of objects""" | |
| size = sys.getsizeof(obj) | |
| if seen is None: | |
| seen = set() |
| diff --git a/pskb_website/static/css/base.css b/pskb_website/static/css/base.css | |
| index 519b677..30dfec1 100644 | |
| --- a/pskb_website/static/css/base.css | |
| +++ b/pskb_website/static/css/base.css | |
| @@ -588,7 +588,6 @@ a:hover.emphasize-dark { | |
| } | |
| #article pre, #article blockquote, #article form { | |
| - margin-left: 21px; | |
| word-wrap: break-word; |
A common definition of a Python decorator is 'A function that takes a function and returns a function.' This is a straight-forward definition, however, it's a bit inaccurate. In practice, a Python decorator is actually more flexible than simply a function.
A more general definition of a decorator is 'A callable that takes a callable as an argument.' This is a subtle distinction, but it opens up a few new possibilities. This new definition now leads to another question.
I recently spent a little time reviewing a Python bug report and determining if I was running with a fixed version of the Python interpreter. I think this is a useful exercise for someone who is overly curious and not a core developer of the language.
This post is a rundown of my thought process while trying to figure this out.