Skip to content

Commit 4fff38b

Browse files
authored
nbqa black 5 notebooks (#4165)
1 parent 5e30554 commit 4fff38b

6 files changed

+15
-29
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ repos:
55
- id: end-of-file-fixer
66
- id: check-toml
77
- repo: https://github.com/nbQA-dev/nbQA
8-
rev: 0.2.3
8+
rev: 0.3.0
99
hooks:
1010
- id: nbqa
1111
args: ['isort']

docs/source/notebooks/GLM-negative-binomial-regression.ipynb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -383,9 +383,7 @@
383383
}
384384
],
385385
"source": [
386-
"g = sns.catplot(\n",
387-
" x=\"nsneeze\", row=\"nomeds\", col=\"alcohol\", data=df, kind=\"count\", aspect=1.5\n",
388-
")\n",
386+
"g = sns.catplot(x=\"nsneeze\", row=\"nomeds\", col=\"alcohol\", data=df, kind=\"count\", aspect=1.5)\n",
389387
"\n",
390388
"# Make x-axis ticklabels less crowded\n",
391389
"ax = g.axes[1, 0]\n",
@@ -464,9 +462,7 @@
464462
"fml = \"nsneeze ~ alcohol + nomeds + alcohol:nomeds\"\n",
465463
"\n",
466464
"with pm.Model() as model:\n",
467-
" pm.glm.GLM.from_formula(\n",
468-
" formula=fml, data=df, family=pm.glm.families.NegativeBinomial()\n",
469-
" )\n",
465+
" pm.glm.GLM.from_formula(formula=fml, data=df, family=pm.glm.families.NegativeBinomial())\n",
470466
" trace = pm.sample(1000, tune=1000, cores=2, return_inferencedata=True)"
471467
]
472468
},

docs/source/notebooks/MLDA_gravity_surveying.ipynb

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
"%config InlineBackend.figure_format = 'retina'\n",
118118
"RANDOM_SEED = 123446\n",
119119
"np.random.seed(RANDOM_SEED)\n",
120-
"az.style.use('arviz-darkgrid')"
120+
"az.style.use(\"arviz-darkgrid\")"
121121
]
122122
},
123123
{
@@ -212,9 +212,7 @@
212212
" \"\"\"\n",
213213
" Find eigenvalues and eigenvectors using Arnoldi iteration.\n",
214214
" \"\"\"\n",
215-
" eigvals, eigvecs = eigh(\n",
216-
" self.cov, eigvals=(self.n_points - self.mkl, self.n_points - 1)\n",
217-
" )\n",
215+
" eigvals, eigvecs = eigh(self.cov, eigvals=(self.n_points - self.mkl, self.n_points - 1))\n",
218216
"\n",
219217
" order = np.flip(np.argsort(eigvals))\n",
220218
" self.eigenvalues = eigvals[order]\n",
@@ -316,7 +314,7 @@
316314
"class Gravity:\n",
317315
" \"\"\"\n",
318316
" Gravity is a class that implements a simple gravity surveying problem,\n",
319-
" as described in Hansen, P. C. (2010). Discrete Inverse Problems: Insight and Algorithms. \n",
317+
" as described in Hansen, P. C. (2010). Discrete Inverse Problems: Insight and Algorithms.\n",
320318
" Society for Industrial and Applied Mathematics.\n",
321319
" It uses midpoint quadrature to evaluate a Fredholm integral of the first kind.\n",
322320
" \"\"\"\n",
@@ -349,9 +347,7 @@
349347
"\n",
350348
" # Create coordinate vectors.\n",
351349
" self.T_coords = np.c_[TX.ravel(), TY.ravel(), np.zeros(self.n_quad ** 2)]\n",
352-
" self.S_coords = np.c_[\n",
353-
" SX.ravel(), SY.ravel(), self.depth * np.ones(self.n_data ** 2)\n",
354-
" ]\n",
350+
" self.S_coords = np.c_[SX.ravel(), SY.ravel(), self.depth * np.ones(self.n_data ** 2)]\n",
355351
"\n",
356352
" # Set the quadrature weights.\n",
357353
" self.w = 1 / self.n_quad ** 2\n",
@@ -485,9 +481,7 @@
485481
")\n",
486482
"fig.colorbar(g, ax=axes[0])\n",
487483
"axes[1].set_title(\"Noisy Signal\")\n",
488-
"d = axes[1].imshow(\n",
489-
" data.reshape(n_data, n_data), extent=(0, 1, 0, 1), origin=\"lower\", cmap=\"plasma\"\n",
490-
")\n",
484+
"d = axes[1].imshow(data.reshape(n_data, n_data), extent=(0, 1, 0, 1), origin=\"lower\", cmap=\"plasma\")\n",
491485
"fig.colorbar(d, ax=axes[1])\n",
492486
"plt.show()"
493487
]
@@ -531,9 +525,7 @@
531525
"\n",
532526
" # Create coordinate vectors.\n",
533527
" self.T_coords = np.c_[TX.ravel(), TY.ravel(), np.zeros(self.n_quad ** 2)]\n",
534-
" self.S_coords = np.c_[\n",
535-
" SX.ravel(), SY.ravel(), self.depth * np.ones(self.n_data ** 2)\n",
536-
" ]\n",
528+
" self.S_coords = np.c_[SX.ravel(), SY.ravel(), self.depth * np.ones(self.n_data ** 2)]\n",
537529
"\n",
538530
" # Set the quadrature weights.\n",
539531
" self.w = 1 / self.n_quad ** 2\n",

docs/source/notebooks/log-gaussian-cox-process.ipynb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
"%config InlineBackend.figure_format = 'retina'\n",
7171
"RANDOM_SEED = 8927\n",
7272
"np.random.seed(RANDOM_SEED)\n",
73-
"az.style.use('arviz-darkgrid')"
73+
"az.style.use(\"arviz-darkgrid\")"
7474
]
7575
},
7676
{
@@ -588,9 +588,7 @@
588588
"metadata": {},
589589
"outputs": [],
590590
"source": [
591-
"intensity_samples = np.asarray(\n",
592-
" [x for x in new_samples[\"intensity_new\"] if np.all(np.isfinite(x))]\n",
593-
")"
591+
"intensity_samples = np.asarray([x for x in new_samples[\"intensity_new\"] if np.all(np.isfinite(x))])"
594592
]
595593
},
596594
{

docs/source/notebooks/marginalized_gaussian_mixture_model.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"%config InlineBackend.figure_format = 'retina'\n",
4343
"RANDOM_SEED = 8927\n",
4444
"np.random.seed(RANDOM_SEED)\n",
45-
"az.style.use('arviz-darkgrid')"
45+
"az.style.use(\"arviz-darkgrid\")"
4646
]
4747
},
4848
{

docs/source/notebooks/sampling_compound_step.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@
127127
"source": [
128128
"n_ = theano.shared(np.asarray([10, 15]))\n",
129129
"with pm.Model() as m:\n",
130-
" p = pm.Beta('p', 1., 1.)\n",
131-
" ni = pm.Bernoulli('ni', .5)\n",
132-
" k = pm.Binomial('k', p=p, n=n_[ni], observed=4)\n",
130+
" p = pm.Beta(\"p\", 1.0, 1.0)\n",
131+
" ni = pm.Bernoulli(\"ni\", 0.5)\n",
132+
" k = pm.Binomial(\"k\", p=p, n=n_[ni], observed=4)\n",
133133
" trace = pm.sample()"
134134
]
135135
},

0 commit comments

Comments
 (0)