Skip to content

Instantly share code, notes, and snippets.

View yilinxiong's full-sized avatar
💭
0.0

Mr X yilinxiong

💭
0.0
  • Everywhere
  • Shanghai
View GitHub Profile
"""
copy from http://www.python88.com/topic/4217
requirement: > python3.4
"""
import json
from datetime import datetime
from decimal import Decimal
from functools import singledispatch
######################################
# Python 3 #
######################################
import abc
import collections
class AutoStorage:
__counter = 0
import abc
"""
# data descriptor
## non-data descriptor(defined __get__ only) < instance's dictionary > data descriptor
"""
class AutoStorage(object):
from queue import Queue
from socket import socket, AF_INET, SOCK_STREAM
import select
class Task(object):
taskid = 0
def __init__(self,target):
Task.taskid += 1
#!/usr/bin/env python
# Python Network Programming Cookbook -- Chapter - 2
# This program is optimized for Python 2.7.
# It may run on any other version with/without modifications.
import select
import socket
import sys
import signal
import cPickle
import struct
#!/usr/bin/env python
# Python Network Programming Cookbook -- Chapter - 3
# This program is optimized for Python 2.7.
# It may run on any other version with/without modifications.
import os
import argparse
import socket
import struct
import select
import time
#!/usr/bin/env python
# Python Network Programming Cookbook -- Chapter - 3
# This program is optimized for Python 2.7.
# It may run on any other version with/without modifications.
import argparse
import asyncore
import socket
LOCAL_SERVER_HOST = 'localhost'
REMOTE_SERVER_HOST = 'www.google.com'
from queue import Queue
from socket import socket, AF_INET, SOCK_STREAM
import select
import types
class Task(object):
taskid = 0
def __init__(self,target):
# -*- coding:utf-8 -*-
from __future__ import absolute_import
from time import time
def memoize(timeout, dynamic_timeout=False):
"""
Memoization decorator with support for timeout.
from collections import defaultdict
from functools import wraps
from copy import deepcopy
class Task(object):
tasks = []
@staticmethod
def register(name):