$ cat t.py
from pprint import pprint
from pytheory import Tone, Fretboard, charts_for_fretboard
tones = (
Tone.from_string("F2"),
Tone.from_string("C3"),
Tone.from_string("G3"),
Tone.from_string("D4"),
""" | |
Middleware to log all requests and responses. | |
Uses a logger configured by the name of django.request | |
to log all requests and responses according to configuration | |
specified for django.request. | |
""" | |
# import json | |
import logging | |
from django.utils.deprecation import MiddlewareMixin |
import argparse | |
import platform | |
import sys | |
import subprocess | |
from pathlib import Path | |
def describe() -> dict: | |
meta = { | |
"python": "py" + ".".join(platform.python_version_tuple()[:2]), |
# Prototype to create an eml file using python | |
import os | |
import uuid | |
from email import generator | |
from email.mime.multipart import MIMEMultipart | |
from email.mime.text import MIMEText | |
# where to write the output file | |
directory = "C:\\Users\\Jeremy\Documents\\python\\email-prototype\\temp" |
from django.core.files import File | |
from django.core.files.storage import default_storage, FileSystemStorage | |
from django.conf import settings | |
from django.core.files.base import ContentFile | |
local_storage = FileSystemStorage() | |
local_storage.base_location = settings.MEDIA_ROOT | |
def get_local_file_from_object(obj): |
import os | |
import io | |
from PIL import Image | |
from django.core.urlresolvers import reverse | |
from django.conf import settings | |
from rest_framework import status | |
from rest_framework.test import APITestCase |
$ cat t.py
from pprint import pprint
from pytheory import Tone, Fretboard, charts_for_fretboard
tones = (
Tone.from_string("F2"),
Tone.from_string("C3"),
Tone.from_string("G3"),
Tone.from_string("D4"),
I'm going to cover a simple, but effective, utility for managing state and transitions (aka workflow). We often need to store the state (status) of a model and it should only be in one state at a time.
from django.core.exceptions import ValidationError | |
from django.db.models import Field, CharField | |
__all__ = ['MultiColumnField'] | |
try: | |
from hashlib import md5 | |
except ImportError: | |
from md5 import new as md5 |
#look also | |
# https://github.com/dcramer/django-ratings/blob/master/djangoratings/fields.py | |
from django.core.exceptions import ValidationError | |
from django.db.models import Field, CharField | |
__all__ = ['MultiColumnField'] | |
try: | |
from hashlib import md5 |
If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.
Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.
If in doubt about what git is doing when you run these commands, just