This file contains 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
package main | |
import ( | |
"os" | |
"fmt" | |
) | |
type Fetcher interface { | |
// Fetch returns the body of URL and | |
// a slice of URLs found on that page. |
This file contains 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 PyQt5 import QtCore | |
def with_metaclass(meta, base=QtCore.QObject): | |
"""Create a base class with a metaclass.""" | |
return meta("NewBase", (base,), {}) | |
class PropertyMeta(QtCore.pyqtWrapperType): | |
def __new__(cls, cls_name, cls_bases, cls_dict): | |
super_new = super(PropertyMeta, cls).__new__ |
This file contains 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 | |
# -*- coding: utf-8 -*- | |
from PyQt5 import QtCore | |
class BaseModel(QtCore.QAbstractListModel): | |
def __init__(self, parent=None): | |
super(BaseModel, self).__init__(parent) |
This file contains 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 | |
# -*- coding: utf-8 -*- | |
# Copyright (C) 2011 ~ 2012 Deepin, Inc. | |
# 2011 ~ 2012 Hou Shaohui | |
# | |
# Author: Hou Shaohui <houshao55@gmail.com> | |
# Maintainer: Hou Shaohui <houshao55@gmail.com> | |
# | |
# This program is free software: you can redistribute it and/or modify |
This file contains 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 datetime | |
import peewee as pw | |
from playhouse.signals import Model | |
from dtalk.utils.contextdecorator import contextmanager | |
from dtalk.utils.xmpp import split_jid, get_email | |
db = pw.SqliteDatabase('test.db', check_same_thread=False, threadlocals=True) | |
DEFAULT_GROUP = "我的好友" |
This file contains 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 | |
# -*- coding: utf-8 -*- | |
import gtk | |
class NoteBook(gtk.Window): | |
def __init__(self): | |
super(NoteBook, self).__init__() |
This file contains 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 urllib2 | |
import threading | |
from Queue import Queue | |
import sys, os, re | |
class ThreadedDownload(object): | |
REGEX = { | |
'hostname_strip':re.compile('.*\..*?/', re.I) | |
} |
This file contains 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
class postGui(QtCore.QObject): | |
throughThread = QtCore.pyqtSignal(object, object) | |
def __init__(self, func): | |
super(postGui, self).__init__() | |
self.throughThread.connect(self.onSignalReceived) | |
self._func = func | |
self._obj = None | |
This file contains 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 pyxmpp2.etree import ElementTree | |
from pyxmpp2.interfaces import StanzaPayload, payload_element_name | |
''' | |
def get_vcard(self, jid, callback=None): | |
if not callback: | |
callback = self.vcard_callback | |
q = Iq( |
This file contains 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 os | |
import sys | |
from PyQt4.QtCore import * | |
def quit(): | |
print "Memory: ", int(os.popen('ps -p %d -o rss | tail -1' % os.getpid()).read()) | |
sys.exit() | |
class Test(QObject): | |
@pyqtSlot() |
OlderNewer