Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
import tornado.ioloop | |
import tornado.web | |
import tornado.httpserver | |
import tornado.httputil | |
import tempfile | |
class MainHandler(tornado.web.RequestHandler): | |
def put(self): | |
filename = self.request.body.name | |
# do stuff with the image |
from django.db import models | |
from django.core.exceptions import ValidationError | |
from django.forms import ModelForm | |
class CleanModel(models.Model): | |
""" Abstract class that adds field validations """ | |
def clean_fields(self, exclude): | |
errors = {} |
<?php | |
/** | |
* Scrape the number of podcast reviews from iTunes for all country specific storefronts. | |
* | |
* @author Sean Murphy <[email protected]> | |
*/ | |
$podcast_id = '366931951'; // Startups For the Rest of Us | |
//$podcast_id = '318567721'; // techzing |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
from pyqtgraph.Qt import QtGui, QtCore | |
import numpy as np | |
import pyqtgraph as pg | |
## Start Qt event loop unless running in interactive mode or using pyside. | |
if __name__ == '__main__': | |
import sys | |
from window import CustomWindow | |
#!/usr/bin/env python3 | |
import sys | |
import json | |
import os | |
import os.path | |
import shutil | |
import logging | |
import tempfile | |
import glob | |
import argparse |
<?php | |
/** | |
* Little helper class to request a payment on an OPI enabled Card Terminal | |
*/ | |
class OPIHelper { | |
private $ip; | |
private $port; | |
private $requestID = 0; |
NodeMonitor is a simple Python Django website that makes calls to Bitcoin (bitcoind) and Lightning Network (c-lightning lightningd) nodes and displays the results on a simple 'dashboard' style status page.
import re | |
from re import Pattern | |
from typing import Dict, Any, cast | |
from pydantic.utils import update_not_none | |
from pydantic.validators import constr_length_validator | |
class RFC3986Regex: | |
ALPHA: Pattern = r"[a-zA-Z]" |