golden hour
/opt/saltstack/salt/lib/python3.10/site-packages/tempora/__pycache__
⬆️ Go Up
Upload
File/Folder
Size
Actions
__init__.cpython-310.pyc
19.71 KB
Del
OK
schedule.cpython-310.pyc
7.36 KB
Del
OK
timing.cpython-310.pyc
7.67 KB
Del
OK
utc.cpython-310.pyc
887 B
Del
OK
Edit: timing.cpython-310.pyc
o �xe6 � @ s| d dl Z d dlZd dlZd dlZd dlZd dlZd dlZG dd� d�Z G dd� d�Z G dd� de �ZG dd � d ejj �ZdS ) � Nc @ sH e Zd ZdZdd� Zdd� Zdd� Zdd � Zd d� Zdd � Z dd� Z dS )� Stopwatcha� A simple stopwatch which starts automatically. >>> w = Stopwatch() >>> _1_sec = datetime.timedelta(seconds=1) >>> w.split() < _1_sec True >>> import time >>> time.sleep(1.0) >>> w.split() >= _1_sec True >>> w.stop() >= _1_sec True >>> w.reset() >>> w.start() >>> w.split() < _1_sec True It should be possible to launch the Stopwatch in a context: >>> with Stopwatch() as watch: ... assert isinstance(watch.split(), datetime.timedelta) In that case, the watch is stopped when the context is exited, so to read the elapsed time:: >>> watch.elapsed datetime.timedelta(...) >>> watch.elapsed.seconds 0 c C s | � � | �� d S �N)�reset�start��self� r �B/opt/saltstack/salt/lib/python3.10/site-packages/tempora/timing.py�__init__, s zStopwatch.__init__c C s@ t �d�| _t�t�� | `W d � d S 1 sw Y d S �Nr )�datetime� timedelta�elapsed� contextlib�suppress�AttributeError� start_timer r r r r 0 s "�zStopwatch.resetc C s t j �� | _d S r )r �utcnowr r r r r r 5 � zStopwatch.startc C s( t j �� }| j|| j 7 _| `| jS r )r r r r )r Z stop_timer r r �stop8 s zStopwatch.stopc C s t j �� | j }| j| S r )r r r r )r Zlocal_durationr r r �split>