View settings.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LOGGING = { | |
"version": 1, | |
"disable_existing_loggers": False, | |
"filters": { | |
"require_debug_true": { | |
"()": "django.utils.log.RequireDebugTrue", | |
}, | |
}, | |
"formatters": { | |
"rich": {"datefmt": "[%X]"}, |
View typed_property.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import annotations | |
from typing import NamedTuple, cast, overload | |
class ConsoleDimensions(NamedTuple): | |
width: int | |
height: int |
View example.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example of using raylib using only Python standard library | |
# whilst raylib-py looks useful, it seems quite out of date | |
from pathlib import Path | |
from ctypes import CDLL, c_int, c_char_p, c_ubyte, c_bool, Structure | |
raylib = CDLL(Path(__file__).parent / "lib" / "libraylib.3.7.0.dylib") | |
raylib.InitWindow.argtypes = [c_int, c_int, c_char_p] | |
raylib.InitWindow.restype = None |
View shell session
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat base.py | |
class MyMeta(type): | |
def __new__(mcs, name, bases, attrs): | |
return super().__new__(mcs, name, bases, attrs) | |
class MyBase(metaclass=MyMeta): | |
pass | |
$ python -c 'from base import MyBase |
View inner.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- debug: | |
msg: '{{ last|default("") }} -> {{ item }}' | |
- set_fact: | |
last: '{{ item }}' |
View test.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- hosts: localhost | |
connection: local | |
gather_facts: no | |
vars: | |
mylist: | |
- a | |
- b | |
- c | |
tasks: | |
- debug: |
View test_example.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from copy import deepcopy | |
import pytest | |
from django.contrib.auth.models import User | |
users = [ | |
User(username="a"), | |
User(username="b"), | |
] |
View models.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import annotations | |
import base64 | |
import itertools | |
import random | |
from dataclasses import dataclass | |
from functools import cached_property | |
from math import ceil, floor, log2, log10 | |
from django.db import models |
View _base.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="{% static 'app.js' %}" data-csrftoken="{{ csrf_token }}"></script> |
View graph-migrations.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime as dt | |
import subprocess | |
from colorsys import hsv_to_rgb | |
from textwrap import dedent | |
from django.core.management.base import BaseCommand | |
from django.db import DEFAULT_DB_ALIAS, connections | |
from django.db.migrations.loader import MigrationLoader |
NewerOlder