Skip to content

Commit 3129fb3

Browse files
committed
Merge pull request #3827 from cpcloud/remove-relative-imports
CLN: remove relative imports
2 parents 5bf1d9c + 4c50b71 commit 3129fb3

File tree

3 files changed

+8
-17
lines changed

3 files changed

+8
-17
lines changed

pandas/__init__.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,10 @@
33
__docformat__ = 'restructuredtext'
44

55
try:
6-
from . import hashtable, tslib, lib
7-
except Exception: # pragma: no cover
8-
import sys
9-
e = sys.exc_info()[1] # Py25 and Py3 current exception syntax conflict
10-
print e
11-
if 'No module named lib' in str(e):
12-
raise ImportError('C extensions not built: if you installed already '
13-
'verify that you are not importing from the source '
14-
'directory')
15-
else:
16-
raise
6+
from pandas import hashtable, tslib, lib
7+
except ImportError as e: # pragma: no cover
8+
module = str(e).lstrip('cannot import name ') # hack but overkill to use re
9+
raise ImportError("C extensions: {0} not built".format(module))
1710

1811
from datetime import datetime
1912
import numpy as np

pandas/algos.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ cdef extern from "src/headers/math.h":
5757
double fabs(double)
5858
int signbit(double)
5959

60-
from . import lib
60+
from pandas import lib
6161

6262
include "skiplist.pyx"
6363

pandas/index.pyx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ import numpy as np
1515

1616
cimport tslib
1717
from hashtable cimport *
18-
from . import algos, tslib, hashtable as _hash
19-
from .tslib import Timestamp
18+
from pandas import algos, tslib, hashtable as _hash
19+
from pandas.tslib import Timestamp
2020

2121
from datetime cimport (get_datetime64_value, _pydatetime_to_dts,
2222
pandas_datetimestruct)
@@ -34,16 +34,14 @@ try:
3434
import pytz
3535
UTC = pytz.utc
3636
have_pytz = True
37-
except:
37+
except ImportError:
3838
have_pytz = False
3939

4040
PyDateTime_IMPORT
4141

4242
cdef extern from "Python.h":
4343
int PySlice_Check(object)
4444

45-
# int PyList_Check(object)
46-
# int PyTuple_Check(object)
4745

4846
cdef inline is_definitely_invalid_key(object val):
4947
if PyTuple_Check(val):

0 commit comments

Comments
 (0)