Skip to content

Commit

Permalink
Fix new flake8 errors (#2477)
Browse files Browse the repository at this point in the history
  • Loading branch information
eb8680 authored May 12, 2020
1 parent e0f7053 commit bae2f61
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/capture_recapture/cjs.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def main(args):
sex = torch.tensor(np.genfromtxt(sex_file, delimiter=',')).float()[:, 1]
print("Loaded dipper sex data.")
elif args.dataset == "vole" and args.model in ["4", "5"]:
raise ValueError("Cannot run model_{} on meadow voles data, since we lack sex " +
raise ValueError("Cannot run model_{} on meadow voles data, since we lack sex "
"information for these animals.".format(args.model))
else:
sex = None
Expand Down
2 changes: 2 additions & 0 deletions examples/sparse_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ def model(X, Y, hypers, jitter=1.0e-4):
hyperparameters (eta1, xisq, ...).
Compare to theorem 5.1 in reference [1].
"""


@torch.no_grad()
def compute_posterior_stats(X, Y, msq, lam, eta1, xisq, c, var_obs, jitter=1.0e-4):
N, P = X.shape
Expand Down
2 changes: 1 addition & 1 deletion pyro/distributions/distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def has_rsample_(self, value):
:rtype: Distribution
"""
if not (value is True or value is False):
raise ValueError("Expected value in {False,True}, actual {}".format(value))
raise ValueError("Expected value in [False,True], actual {}".format(value))
self.has_rsample = value
return self

Expand Down
2 changes: 1 addition & 1 deletion pyro/poutine/trace_struct.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def log_prob_sum(self, site_filter=lambda name, site: True):
except ValueError:
_, exc_value, traceback = sys.exc_info()
shapes = self.format_shapes(last_site=site["name"])
raise ValueError("Error while computing log_prob_sum at site '{}':\n{}\n"
raise ValueError("Error while computing log_prob_sum at site '{}':\n{}\n{}\n"
.format(name, exc_value, shapes)).with_traceback(traceback)
log_p = scale_and_mask(log_p, site["scale"], site["mask"]).sum()
site["log_prob_sum"] = log_p
Expand Down
2 changes: 1 addition & 1 deletion pyro/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ def check_site_shape(site, max_plate_nesting):
expected_shape = [None] * (-f.dim - len(expected_shape)) + expected_shape
if expected_shape[f.dim] is not None:
raise ValueError('\n '.join([
'at site "{}" within plate("", dim={}), dim collision'.format(site["name"], f.name, f.dim),
'at site "{}" within plate("{}", dim={}), dim collision'.format(site["name"], f.name, f.dim),
'Try setting dim arg in other plates.']))
expected_shape[f.dim] = f.size
expected_shape = [-1 if e is None else e for e in expected_shape]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
try:
long_description = open('README.md', encoding='utf-8').read()
except Exception as e:
sys.stderr.write('Failed to read README.md\n'.format(e))
sys.stderr.write('Failed to read README.md: {}\n'.format(e))
sys.stderr.flush()
long_description = ''

Expand Down

0 comments on commit bae2f61

Please sign in to comment.