ACIL FM
Dark
Refresh
Current DIR:
/usr/lib/python3.9/site-packages/cloudinit
/
usr
lib
python3.9
site-packages
cloudinit
Upload
Zip Selected
Delete Selected
Pilih semua
Nama
Ukuran
Permission
Aksi
analyze
-
chmod
Open
Rename
Delete
cmd
-
chmod
Open
Rename
Delete
config
-
chmod
Open
Rename
Delete
distros
-
chmod
Open
Rename
Delete
filters
-
chmod
Open
Rename
Delete
handlers
-
chmod
Open
Rename
Delete
log
-
chmod
Open
Rename
Delete
mergers
-
chmod
Open
Rename
Delete
net
-
chmod
Open
Rename
Delete
reporting
-
chmod
Open
Rename
Delete
sources
-
chmod
Open
Rename
Delete
__pycache__
-
chmod
Open
Rename
Delete
apport.py
8.27 MB
chmod
View
DL
Edit
Rename
Delete
atomic_helper.py
2.79 MB
chmod
View
DL
Edit
Rename
Delete
cloud.py
3.71 MB
chmod
View
DL
Edit
Rename
Delete
dmi.py
7.86 MB
chmod
View
DL
Edit
Rename
Delete
event.py
2 MB
chmod
View
DL
Edit
Rename
Delete
features.py
4.87 MB
chmod
View
DL
Edit
Rename
Delete
gpg.py
7.99 MB
chmod
View
DL
Edit
Rename
Delete
helpers.py
16.16 MB
chmod
View
DL
Edit
Rename
Delete
importer.py
2.43 MB
chmod
View
DL
Edit
Rename
Delete
lifecycle.py
7.78 MB
chmod
View
DL
Edit
Rename
Delete
netinfo.py
24.02 MB
chmod
View
DL
Edit
Rename
Delete
performance.py
3.1 MB
chmod
View
DL
Edit
Rename
Delete
persistence.py
2.52 MB
chmod
View
DL
Edit
Rename
Delete
registry.py
1022 B
chmod
View
DL
Edit
Rename
Delete
safeyaml.py
10.11 MB
chmod
View
DL
Edit
Rename
Delete
settings.py
2.15 MB
chmod
View
DL
Edit
Rename
Delete
signal_handler.py
1.75 MB
chmod
View
DL
Edit
Rename
Delete
simpletable.py
1.93 MB
chmod
View
DL
Edit
Rename
Delete
socket.py
5.93 MB
chmod
View
DL
Edit
Rename
Delete
ssh_util.py
22.22 MB
chmod
View
DL
Edit
Rename
Delete
stages.py
41.53 MB
chmod
View
DL
Edit
Rename
Delete
subp.py
12.36 MB
chmod
View
DL
Edit
Rename
Delete
templater.py
7.8 MB
chmod
View
DL
Edit
Rename
Delete
temp_utils.py
2.94 MB
chmod
View
DL
Edit
Rename
Delete
type_utils.py
703 B
chmod
View
DL
Edit
Rename
Delete
url_helper.py
34.7 MB
chmod
View
DL
Edit
Rename
Delete
user_data.py
14.44 MB
chmod
View
DL
Edit
Rename
Delete
util.py
91.22 MB
chmod
View
DL
Edit
Rename
Delete
version.py
564 B
chmod
View
DL
Edit
Rename
Delete
warnings.py
3.76 MB
chmod
View
DL
Edit
Rename
Delete
__init__.py
0 B
chmod
View
DL
Edit
Rename
Delete
Edit file: /usr/lib/python3.9/site-packages/cloudinit/performance.py
import functools import logging import time LOG = logging.getLogger(__name__) class Timed: """ A context manager which measures and optionally logs context run time. :param msg: A message that describes the thing that is being measured :param threshold: Threshold, in seconds. When the context exceeds this threshold, a log will be made. :param log_mode: Control whether to log. Defaults to "threshold". Possible values include: "always" - Always log 'msg', even when 'threshold' is not reached. "threshold" - Log when context time exceeds 'threshold'. "skip" - Do not log. Context time and message are stored in the 'output' and 'delta' attributes, respectively. Used to manually coalesce with other logs at the call site. usage: this call: ``` with Timed("Configuring the network"): run_configure() ``` might produce this log: ``` Configuring the network took 0.100 seconds ``` """ def __init__( self, msg: str, *, threshold: float = 0.01, log_mode: str = "threshold", ): self.msg = msg self.threshold = threshold self.log_mode = log_mode self.output = "" self.start = 0.0 self.delta = 0.0 def __enter__(self): self.start = time.monotonic() return self def __exit__(self, exc_type, exc_val, exc_tb): self.delta = time.monotonic() - self.start suffix = f"took {self.delta:.3f} seconds" if "always" == self.log_mode: LOG.debug("%s %s", self.msg, suffix) elif "skip" == self.log_mode: return elif "threshold" == self.log_mode: if self.delta > self.threshold: LOG.debug("%s %s", self.msg, suffix) self.output = f"{self.msg} {suffix}" else: raise ValueError( f"Invalid Timed log_mode value: '{self.log_mode}'." ) def timed(msg: str, *, threshold: float = 0.01, log_mode: str = "threshold"): """ A decorator which measures and optionally logs context run time. :param msg: A message that describes the thing that is being measured :param threshold: Threshold, in seconds. When the context exceeds this threshold, a log will be made. :param log_mode: Control whether to log. Defaults to "threshold". Possible values include: "always" - Always log 'msg', even when 'threshold' is not reached. "threshold" - Log when context time exceeds 'threshold'. usage: this call: ``` @timed("Configuring the network") def run_configure(): ... ``` might produce this log: ``` Configuring the network took 0.100 seconds ``` """ def wrapper(func): @functools.wraps(func) def decorator(*args, **kwargs): with Timed(msg, threshold=threshold, log_mode=log_mode): return func(*args, **kwargs) return decorator return wrapper
Simpan
Batal
Isi Zip:
Unzip
Create
Buat Folder
Buat File
Terminal / Execute
Run
Chmod Bulk
All File
All Folder
All File dan Folder
Apply