Python 2.7:
static PyObject *
builtin_hasattr(PyObject *self, PyObject *args)
{
PyObject *v;
from pygments import highlight | |
from pygments.lexers import guess_lexer | |
from pygments.formatters.html import HtmlFormatter | |
def highlight_code(src, style='manni'): | |
"""This function highlight :param:`src` into html format using the style provided. | |
:param src: The source code to highlight. | |
:param style: The color style, valid style to see: |
import functools | |
def singleton(cls, *args, **kwargs): | |
instances = {} | |
@functools.wraps(cls) | |
def wrapper(): | |
if cls not in instances: | |
instances[cls] = cls(*args, **kwargs) | |
return instances[cls] |
import sys | |
from cStringIO import StringIO | |
from contextlib import contextmanager | |
@contextmanager | |
def capture(command, *args, **kwargs): | |
out, sys.stdout = sys.stdout, StringIO() | |
command(*args, **kwargs) | |
sys.stdout.seek(0) | |
yield sys.stdout.read() |
logging.config.dictConfig({ | |
'version': 1, | |
'disable_existing_loggers': False, | |
'formatters': { | |
'console': {'format': '[%(levelname)s %(asctime)s %(name)s] %(message)s'}, | |
}, | |
'handlers': { | |
'console': { | |
'level': 'INFO', | |
'formatter': 'console', |
CSS 优先级?
1. !important
2. inline
3. id
4. class (多个 class 按照定义顺序)
Placeholder
env LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/include" pip install cryptography