A "Best of the Best Practices" (BOBP) guide to developing in Python.
- "Build tools for others that you want to be built for you." - Kenneth Reitz
- "Simplicity is alway better than functionality." - Pieter Hintjens
| import requests | |
| def format_bytes(size): | |
| # 2**10 = 1024 | |
| power = 2 ** 10 | |
| n = 0 | |
| power_labels = {0: '', 1: 'K', 2: 'M', 3: 'G', 4: 'T'} | |
| while size > power: | |
| size /= power |
| """ | |
| Python implementation of the color map function for the PASCAL VOC data set. | |
| Official Matlab version can be found in the PASCAL VOC devkit | |
| http://host.robots.ox.ac.uk/pascal/VOC/voc2012/index.html#devkit | |
| """ | |
| import numpy as np | |
| from skimage.io import imshow | |
| import matplotlib.pyplot as plt | |
| def color_map(N=256, normalized=False): |
| !------------------------------------------------------------------------------- | |
| ! Xft settings | |
| !------------------------------------------------------------------------------- | |
| Xft.dpi: 96 | |
| Xft.antialias: false | |
| Xft.rgba: rgb | |
| Xft.hinting: true | |
| Xft.hintstyle: hintslight |