Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
util.py
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file util.py
1
import
os
2
import
contextlib
3
import
sys
4
5
try
:
6
from
halo
import
Halo
7
except
:
8
Halo =
None
9
10
11
@contextlib.contextmanager
12
def
Spinner
(text, persist=True, *args, **kwargs):
13
stream = kwargs.get(
"stream"
, sys.stdout)
14
if
stream.isatty()
and
Halo
is
not
None
:
15
spinner =
Halo
(text, *args, **kwargs)
16
spinner.start()
17
try
:
18
yield
19
if
persist:
20
spinner.succeed()
21
except
:
22
if
persist:
23
spinner.fail()
24
raise
25
finally
:
26
if
not
persist:
27
spinner.stop()
28
else
:
29
stream.write(text +
"\n"
)
30
yield
acts
blob
sPHENIX
CI
util.py
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:17:32
using
1.8.2 with
sPHENIX GitHub integration