AndreaCensi/contracts — pull request #16 by ryanheimbuch-wf (2013-09-10 19:20:32+00:00)
Title: Allow `contracts` to be imported when numpy is not installed.

I noticed that in the current master (6454b66052), `import contracts` fails when numpy is not installed:
```
$ git clone git://github.com/AndreaCensi/contracts.git
...

$ virtualenv venv
...

$ venv/bin/python --version
Python 2.7.5

$ venv/bin/pip install ./contracts
...

$ venv/bin/python -c 'import contracts'
Traceback (most recent call last):
File "", line 1, in
File "/Users/ryan.heimbuch/src/venv/lib/python2.7/site-packages/contracts/__init__.py", line 43, in
from .useful_contracts import *
File "/Users/ryan.heimbuch/src/venv/lib/python2.7/site-packages/contracts/useful_contracts/__init__.py", line 1, in
from .numpy_specific import *
File "/Users/ryan.heimbuch/src/venv/lib/python2.7/site-packages/contracts/useful_contracts/numpy_specific.py", line 2, in
import numpy as np
ImportError: No module named numpy
```

I found a conditional import check that used to be present in `src/contracts/useful_contracts/__init__.py` but was [removed in commit cfe9bb78d](https://github.com/AndreaCensi/contracts/commit/cfe9bb78d#L6L2). I feel like this was probably an oversight during the refactoring of the `contracts.useful_contracts` package. I've added back a try/except/else block around the `from .numpy_specific import *` statement.