Skip to content

Commit e6fce33

Browse files
committed
fix: lint errors
1 parent b854d88 commit e6fce33

File tree

1 file changed

+20
-12
lines changed
  • lib/node_modules/@stdlib/stats/base/dists/planck/pmf/test/fixtures/python

1 file changed

+20
-12
lines changed

lib/node_modules/@stdlib/stats/base/dists/planck/pmf/test/fixtures/python/runner.py

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#!/usr/bin/env python
2-
1+
# !/usr/bin/env python
2+
#
33
# @license Apache-2.0
44
#
55
# Copyright (c) 2024 The Stdlib Authors.
@@ -16,11 +16,18 @@
1616
# See the License for the specific language governing permissions and
1717
# limitations under the License.
1818

19+
"""
20+
This script generates fixture data for the Planck distribution's probability mass function (PMF).
21+
22+
It writes the generated data to JSON files for large and small lambda values.
23+
"""
24+
1925
import os
2026
import json
2127
import numpy as np
2228
from scipy.stats import planck
2329

30+
2431
def gen(x, lam, name):
2532
"""
2633
Generate fixture data and write to file.
@@ -29,7 +36,7 @@ def gen(x, lam, name):
2936
----------
3037
x : ndarray
3138
Input values.
32-
lambda : ndarray
39+
lam : ndarray
3340
Shape parameter.
3441
name : str
3542
Output filename.
@@ -54,22 +61,23 @@ def gen(x, lam, name):
5461
filepath = os.path.join(dir_path, name)
5562

5663
# Write the data to the output filepath as JSON:
57-
with open(filepath, "w") as outfile:
64+
with open(filepath, "w", encoding='utf-8') as outfile:
5865
json.dump(data, outfile)
59-
66+
6067
# Include trailing newline
61-
with open(filepath, "a") as outfile:
68+
with open(filepath, "a", encoding='utf-8') as outfile:
6269
outfile.write("\n")
6370

71+
6472
# Get the directory in which this file resides:
6573
dir_path = os.path.dirname(os.path.abspath(__file__))
6674

6775
# Large success probability:
68-
x = np.round(np.random.rand(1000) * 10.0)
69-
lam = (np.random.rand(1000) * 10) + 10
70-
gen(x, lam, "large_lambda.json")
76+
x_ = np.round(np.random.rand(1000) * 10.0)
77+
lam_ = (np.random.rand(1000) * 10) + 10
78+
gen(x_, lam_, "large_lambda.json")
7179

7280
# Small success probability:
73-
x = np.round(np.random.rand(1000) * 10.0)
74-
lam = np.random.rand(1000) * 0.5
75-
gen(x, lam, "small_lambda.json")
81+
x_ = np.round(np.random.rand(1000) * 10.0)
82+
lam_ = np.random.rand(1000) * 0.5
83+
gen(x_, lam_, "small_lambda.json")

0 commit comments

Comments
 (0)