Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions quantecon/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

try:
import numba
except:
except ImportError as e:
raise ImportError(
"Cannot import numba from current anaconda distribution. \
Please run `conda install numba` to install the latest version.")
"Cannot import numba, which QuantEcon.py requires. Install it with "
"`pip install numba` or `conda install numba`.") from e

#-Modules-#
from . import distributions
Expand Down
4 changes: 2 additions & 2 deletions quantecon/_dle.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def compute_sequence(self, x0, ts_length=None, Pay=None):

# === Value of asset whose payout vector is Pay*xt === #
# See p.145: Equation (7.11.1)
if isinstance(Pay, np.ndarray) == True:
if isinstance(Pay, np.ndarray):
self.Za = Pay.T @ self.Mc
self.Q = solve_discrete_lyapunov(
self.A0.T * self.beta**0.5, self.Za)
Expand Down Expand Up @@ -277,7 +277,7 @@ def irf(self, ts_length=100, shock=None):

"""

if type(shock) != np.ndarray:
if not isinstance(shock, np.ndarray):
# Default is to select first element of w
shock = np.vstack((np.ones((1, 1)), np.zeros((self.nw - 1, 1))))

Expand Down
9 changes: 7 additions & 2 deletions quantecon/game_theory/game_generators/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# flake8: noqa
"""
game_theory.game_generators

"""
from .bimatrix_generators import *
from .bimatrix_generators import (blotto_game, ranking_game, sgc_game,
tournament_game, unit_vector_game)

__all__ = [
'blotto_game', 'ranking_game', 'sgc_game', 'tournament_game',
'unit_vector_game'
]
2 changes: 1 addition & 1 deletion quantecon/tests/test_graph_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def setup_method(self):
for graph_dict in self.graphs.graph_dicts:
try:
weighted = graph_dict['weighted']
except:
except KeyError:
weighted = False
graph_dict['g'] = DiGraph(graph_dict['A'], weighted=weighted)

Expand Down
8 changes: 0 additions & 8 deletions quantecon/tests/test_quadsum.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,3 @@ def test_m_matsum():
summedval = summedval + a**i * b * a.T**i

assert_allclose(retval, summedval, atol=1e-5, rtol=0)



if __name__ == '__main__':
test_simplesum()
test_identitysum()
test_m_simplesum()
test_m_identitysum
2 changes: 1 addition & 1 deletion quantecon/util/notebooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def fetch_nb_dependencies(files, repo=REPO, raw=RAW, branch=BRANCH, folder=FOLDE
import requests

#-Generate Common Data Structure-#
if type(files) == list:
if isinstance(files, list):
files = {"" : files}

status = []
Expand Down
2 changes: 1 addition & 1 deletion quantecon/util/timing.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def __enter__(self):
self._start_time = time.time()
return self

def __exit__(self, exc_type, exc_val, exc_tb):
def __exit__(self, *exc_info):
end_time = time.time()
self.elapsed = end_time - self._start_time

Expand Down