This file contains hidden or 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 argparse | |
import json | |
import logging | |
import math | |
import os | |
import random | |
import time | |
from collections.abc import Mapping | |
from contextlib import contextmanager, nullcontext | |
from functools import partial |
This file contains hidden or 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
4218865 function calls (3451972 primitive calls) in 19.589 seconds | |
Ordered by: cumulative time | |
ncalls tottime percall cumtime percall filename:lineno(function) | |
1 0.001 0.001 19.595 19.595 completion.py:553(_process_request) | |
17143/1332 0.329 0.000 18.992 0.014 /Users/zhutou/.vscode/extensions/ms-python.python-2018.4.0/pythonFiles/jedi/evaluate/cache.py:19(wrapper) | |
1 0.003 0.003 18.716 18.716 completion.py:411(_serialize_definitions) | |
11624/272 0.080 0.000 18.650 0.069 /Users/zhutou/.vscode/extensions/ms-python.python-2018.4.0/pythonFiles/jedi/cache.py:134(wrapper) | |
1644/71 0.014 0.000 18.512 0.261 /Users/zhutou/.vscode/extensions/ms-python.python-2018.4.0/pythonFiles/jedi/evaluate/filters.py:105(infer) |
This file contains hidden or 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
# coding=utf-8 | |
""" | |
convert git HEAD blame of every file to database | |
using: | |
$ python repo_blame.py --help | |
$ python repo_blame.py --uri mysql://USER:PASSWD@HOST/DATABASE --repo="/home/zhutou/work/git/linux" | |
# requirements: | |
pip install peewee==2.8.5 GitPython==2.1.1 |
This file contains hidden or 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
def isNumber(x): | |
return isinstance(x, (int, long, float)) | |
def isValid(x): | |
return isinstance(x, (Symbols, int, long, float)) | |
def isSymbols(x): | |
return isinstance(x, Symbols) |
This file contains hidden or 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
# coding=utf-8 | |
from django.http import Http404 | |
from django.core.urlresolvers import resolve | |
class EndPointMiddleware(object): | |
"""make request in django have endpoint like flask""" | |
def process_request(self, request): | |
try: |
This file contains hidden or 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
#coding=utf-8 | |
import os | |
os.system("wget -r --spider http://diameizi.diandian.com 2>|log.txt")#非常简单的抓取整个网页树结构的语句————实质上是一种偷懒 | |
filein=open('log.txt','r') | |
fileout=open('dst','w+')#一个装最后的结果的没用的文件 | |
filelist=list(filein) | |
import urllib2,time | |
from bs4 import BeautifulSoup | |
header={ | |
'User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:8.0.1) Gecko/20100101 Firefox/8.0.1'} |