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
| """ | |
| 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 |
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
| ###################################### | |
| # Python 3 # | |
| ###################################### | |
| import abc | |
| import collections | |
| class AutoStorage: | |
| __counter = 0 | |
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 abc | |
| """ | |
| # data descriptor | |
| ## non-data descriptor(defined __get__ only) < instance's dictionary > data descriptor | |
| """ | |
| class AutoStorage(object): |
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
| 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 |
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
| #!/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 |
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
| #!/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 |
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
| #!/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' |
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
| 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): |
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 __future__ import absolute_import | |
| from time import time | |
| def memoize(timeout, dynamic_timeout=False): | |
| """ | |
| Memoization decorator with support for timeout. |
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
| from collections import defaultdict | |
| from functools import wraps | |
| from copy import deepcopy | |
| class Task(object): | |
| tasks = [] | |
| @staticmethod | |
| def register(name): |
OlderNewer