File: context_manager.py

package info (click to toggle)
python-halo 0.0.31-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 340 kB
  • sloc: python: 1,318; makefile: 4
file content (18 lines) | stat: -rw-r--r-- 389 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# -*- coding: utf-8 -*-
"""Example for context manager
"""
import os
import sys
import time

sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

from halo import Halo

with Halo(text='Loading', spinner='dots'):
    # Run time consuming work here
    time.sleep(4)

with Halo(text='Loading 2', spinner='dots'):
    # Run time consuming work here
    time.sleep(4)