Python __builtin__ 模块,long() 实例源码

我们从Python开源项目中,提取了以下5个代码示例,用于说明如何使用__builtin__.long()

项目:oa_qian    作者:sunqb    | 项目源码 | 文件源码
def idle(priority=0):
    """
    Cause the calling greenlet to wait until the event loop is idle.

    Idle is defined as having no other events of the same or higher
    *priority* pending. That is, as long as sockets, timeouts or even
    signals of the same or higher priority are being processed, the loop
    is not idle.

    .. seealso:: :func:`sleep`
    """
    hub = get_hub()
    watcher = hub.loop.idle()
    if priority:
        watcher.priority = priority
    hub.wait(watcher)
项目:request_validator    作者:amirasaran    | 项目源码 | 文件源码
def check_int(self):
        if isinstance(self.data, int):
            return True
        if type(self.data) is long:
            self.data = int(self.data)
            return True
        if type(self.data) is Decimal:
            self.data = int(self.data)
            return True
        if isinstance(self.data, (str, unicode)):
            import re
            if re.match(r"\d+", self.data):
                self.data = int(self.data)
                return True
        if self.data is None:
            return True
        self.error = self._MESSAGES[self.INT].format(data_type=type(self.data).__name__)
        return False
项目:Lixiang_zhaoxin    作者:hejaxian    | 项目源码 | 文件源码
def idle(priority=0):
    """
    Cause the calling greenlet to wait until the event loop is idle.

    Idle is defined as having no other events of the same or higher
    *priority* pending. That is, as long as sockets, timeouts or even
    signals of the same or higher priority are being processed, the loop
    is not idle.

    .. seealso:: :func:`sleep`
    """
    hub = get_hub()
    watcher = hub.loop.idle()
    if priority:
        watcher.priority = priority
    hub.wait(watcher)
项目:oa_qian    作者:sunqb    | 项目源码 | 文件源码
def start(self, callback, *args, **kw):
        update = kw.get("update", True)
        if update:
            # Quoth the libev doc: "This is a costly operation and is
            # usually done automatically within ev_run(). This
            # function is rarely useful, but when some event callback
            # runs for a very long time without entering the event
            # loop, updating libev's idea of the current time is a
            # good idea."
            # So do we really need to default to true?
            libev.ev_now_update(self.loop._ptr)
        watcher.start(self, callback, *args)
项目:Lixiang_zhaoxin    作者:hejaxian    | 项目源码 | 文件源码
def start(self, callback, *args, **kw):
        update = kw.get("update", True)
        if update:
            # Quoth the libev doc: "This is a costly operation and is
            # usually done automatically within ev_run(). This
            # function is rarely useful, but when some event callback
            # runs for a very long time without entering the event
            # loop, updating libev's idea of the current time is a
            # good idea."
            # So do we really need to default to true?
            libev.ev_now_update(self.loop._ptr)
        watcher.start(self, callback, *args)