Commit 8bddde23 authored by Geert Jansen's avatar Geert Jansen

Moving to absolute imports.

This patch prepares for the addition of a "gevent.os" module.
parent ac04312a
......@@ -6,6 +6,8 @@ to provide a high-level synchronous API on top of libev event loop.
See http://www.gevent.org/ for the documentation.
"""
from __future__ import absolute_import
version_info = (1, 0, 0, 'dev', None)
__version__ = '1.0dev'
......@@ -32,7 +34,7 @@ __all__ = ['get_hub',
import sys
if sys.platform == 'win32':
__import__('socket') # trigger WSAStartup call
import socket # trigger WSAStartup call
del sys
......
from python cimport *
import os
# Work around lack of absolute_import in Cython.
os = __import__('os', level=0)
__all__ = ['set_exc_info']
......
......@@ -3,7 +3,8 @@ cimport cython
cimport libev
from python cimport *
import sys
import os
# Work around lack of absolute_import in Cython
os = __import__('os', level=0)
import traceback
import signal as signalmodule
......
from __future__ import absolute_import
import sys
import os
from gevent.hub import get_hub
......
# Copyright (c) 2009-2012 Denis Bilenko. See LICENSE for details.
from __future__ import absolute_import
import sys
import os
import traceback
......@@ -44,7 +45,7 @@ def __import_py_magic_greenlet():
pass
try:
greenlet = __import__('greenlet').greenlet
from greenlet import greenlet
except ImportError:
greenlet = __import_py_magic_greenlet()
if greenlet is None:
......@@ -63,9 +64,9 @@ if GreenletExit.__bases__[0] is Exception:
GreenletExit.__bases__ = (BaseException, )
if sys.version_info[0] <= 2:
thread = __import__('thread')
import thread
else:
thread = __import__('_thread')
import _thread as thread
threadlocal = thread._local
_threadlocal = threadlocal()
_threadlocal.Hub = None
......
......@@ -56,6 +56,7 @@ Monkey patches:
- thread-local storage becomes greenlet-local storage
"""
from __future__ import absolute_import
import sys
__all__ = ['patch_all',
......
......@@ -20,14 +20,15 @@ means repeatedly calling :meth:`get <Queue.get>` until :meth:`get <Queue.get>` r
2
"""
from __future__ import absolute_import
import sys
import heapq
import collections
if sys.version_info[0] == 2:
__queue__ = __import__('Queue')
import Queue as __queue__
else:
__queue__ = __import__('queue')
import queue as __queue__
Full = __queue__.Full
Empty = __queue__.Empty
......
# Copyright (c) 2011 Denis Bilenko. See LICENSE for details.
from __future__ import absolute_import
import os
import sys
from _socket import getservbyname, getaddrinfo, gaierror, error
......
# Copyright (c) 2009-2011 Denis Bilenko. See LICENSE for details.
from __future__ import absolute_import
import sys
from gevent.timeout import Timeout
from gevent.event import Event
......@@ -7,7 +8,7 @@ from gevent.hub import get_hub
__implements__ = ['select']
__all__ = ['error'] + __implements__
__select__ = __import__('select')
import select as __select__
error = __select__.error
......
......@@ -31,6 +31,8 @@ For convenience, exceptions (like :class:`error <socket.error>` and :class:`time
as well as the constants from :mod:`socket` module are imported into this module.
"""
from __future__ import absolute_import
# standard functions and classes that this module re-implements in a gevent-aware way:
__implements__ = ['create_connection',
'socket',
......@@ -111,7 +113,7 @@ except ImportError:
import _socket
_realsocket = _socket.socket
__socket__ = __import__('socket')
import socket as __socket__
_fileobject = __socket__._fileobject
for name in __imports__[:]:
......
......@@ -11,7 +11,8 @@ it requires `ssl package`_ to be installed.
.. _`ssl package`: http://pypi.python.org/pypi/ssl
"""
__ssl__ = __import__('ssl')
from __future__ import absolute_import
import ssl as __ssl__
try:
_ssl = __ssl__._ssl
......
from __future__ import absolute_import
import sys
import os
import errno
......@@ -10,7 +11,7 @@ from gevent.hub import get_hub
from gevent.fileobject import FileObject
from gevent.greenlet import Greenlet, joinall
spawn = Greenlet.spawn
__subprocess__ = __import__('subprocess')
import subprocess as __subprocess__
# Standard functions and classes that this module re-implements in a gevent-aware way.
......
......@@ -6,6 +6,7 @@
used directly. For spawning greenlets in your applications, prefer
:class:`Greenlet` class.
"""
from __future__ import absolute_import
import sys
__implements__ = ['allocate_lock',
......@@ -18,10 +19,9 @@ __implements__ = ['allocate_lock',
__imports__ = ['error']
if sys.version_info[0] <= 2:
__target__ = 'thread'
import thread as __thread__
else:
__target__ = '_thread'
__thread__ = __import__(__target__)
import _thread as __thread__
error = __thread__.error
from gevent.hub import getcurrent, GreenletExit
from gevent.greenlet import Greenlet
......
# Copyright (c) 2012 Denis Bilenko. See LICENSE for details.
from __future__ import with_statement
from __future__ import with_statement, absolute_import
import sys
import os
from gevent.hub import get_hub, getcurrent, sleep, integer_types
......
......@@ -23,6 +23,7 @@
The code is taken from twisted.python.win32 module.
"""
from __future__ import absolute_import
import os
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment