Skip to content

Commit d3e58e3

Browse files
committed
lint fix
1 parent c625e65 commit d3e58e3

3 files changed

Lines changed: 19 additions & 18 deletions

File tree

cmdstanpy/model.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,6 +1320,7 @@ def _run_cmdstan(
13201320
fd_out.write(stdout)
13211321
if show_console:
13221322
lines = stdout.split('\n')
1323+
print(f' ****** lines to process: {len(lines)}')
13231324
for line in lines:
13241325
print('chain {}: {}'.format(idx + 1, stdout))
13251326

test/test_sample.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,10 @@ def test_multi_proc(self):
332332
with LogCapture() as log:
333333
logging.getLogger()
334334
logistic_model.sample(
335-
data=logistic_data, chains=4, parallel_chains=1,
336-
show_progress=False
335+
data=logistic_data,
336+
chains=4,
337+
parallel_chains=1,
338+
show_progress=False,
337339
)
338340
log.check_present(
339341
('cmdstanpy', 'INFO', 'finish chain 1'),
@@ -342,8 +344,10 @@ def test_multi_proc(self):
342344
with LogCapture() as log:
343345
logging.getLogger()
344346
logistic_model.sample(
345-
data=logistic_data, chains=4, parallel_chains=2,
346-
show_progress=False
347+
data=logistic_data,
348+
chains=4,
349+
parallel_chains=2,
350+
show_progress=False,
347351
)
348352
if cpu_count() >= 4:
349353
# finish chains 1, 2 before starting chains 3, 4
@@ -355,8 +359,10 @@ def test_multi_proc(self):
355359
with LogCapture() as log:
356360
logging.getLogger()
357361
logistic_model.sample(
358-
data=logistic_data, chains=4, parallel_chains=4,
359-
show_progress=False
362+
data=logistic_data,
363+
chains=4,
364+
parallel_chains=4,
365+
show_progress=False,
360366
)
361367
log.check_present(
362368
('cmdstanpy', 'INFO', 'start chain 4'),
@@ -370,7 +376,7 @@ def test_multi_proc(self):
370376
chains=1,
371377
parallel_chains=1,
372378
threads_per_chain=7,
373-
show_progress=False
379+
show_progress=False,
374380
)
375381
log.check_present(('cmdstanpy', 'DEBUG', 'total threads: 7'))
376382
with LogCapture() as log:
@@ -380,7 +386,7 @@ def test_multi_proc(self):
380386
chains=7,
381387
parallel_chains=1,
382388
threads_per_chain=5,
383-
show_progress=False
389+
show_progress=False,
384390
)
385391
log.check_present(('cmdstanpy', 'DEBUG', 'total threads: 5'))
386392
with LogCapture() as log:
@@ -581,13 +587,10 @@ def test_show_progress(self, stanfile='bernoulli.stan'):
581587
bern_model = CmdStanModel(stan_file=stan)
582588
jdata = os.path.join(DATAFILES_PATH, 'bernoulli.data.json')
583589

584-
sys_stderr = io.StringIO() # tqdm prints to stderr
590+
sys_stderr = io.StringIO() # tqdm prints to stderr
585591
with contextlib.redirect_stderr(sys_stderr):
586592
bern_model.sample(
587-
data=jdata,
588-
chains=2,
589-
parallel_chains=2,
590-
show_progress=True
593+
data=jdata, chains=2, parallel_chains=2, show_progress=True
591594
)
592595
console = sys_stderr.getvalue()
593596
self.assertTrue('chain 1' in console)

test/test_utils.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,6 @@ def test_parse_containers(self):
765765

766766

767767
class DoCommandTest(unittest.TestCase):
768-
769768
def test_capture_console(self):
770769
tmp = io.StringIO()
771770
do_command(cmd=['ls'], cwd=HERE, fd_out=tmp)
@@ -799,6 +798,7 @@ def test_bad(self):
799798
with self.assertRaisesRegex(ValueError, 'Expecting 3D array'):
800799
flatten_chains(array_2d)
801800

801+
802802
@pytest.mark.order(-1)
803803
class ShowProgressTest(unittest.TestCase):
804804
# this test must run after any tests that check tqdm progress bars
@@ -816,7 +816,7 @@ def test_show_progress_fns(self):
816816
'ERROR',
817817
'Error in progress bar initialization:\n'
818818
'\terror\n'
819-
'Disabling progress bars for this session'
819+
'Disabling progress bars for this session',
820820
)
821821
)
822822
self.assertFalse(allow_show_progress())
@@ -834,8 +834,5 @@ def test_show_progress_fns(self):
834834
self.assertFalse(allow_show_progress())
835835

836836

837-
838-
839-
840837
if __name__ == '__main__':
841838
unittest.main()

0 commit comments

Comments
 (0)