Boolean flags
parser.add_argument('--feature', dest='feature', action='store_true')
parser.add_argument('--no-feature', dest='feature', action='store_false')
parser.set_defaults(feature=True)
Usage:
--------------------------------------------------------------------------- | |
TypeError Traceback (most recent call last) | |
Cell In[41], line 1 | |
----> 1 print(ds) | |
File ~/anaconda3/envs/datumaro/lib/python3.10/site-packages/datumaro/components/dataset.py:261, in Dataset.__repr__(self) | |
257 def __repr__(self) -> str: | |
258 separator = "\t" | |
259 return ( | |
260 f"Dataset\n" |
import gi | |
from time import sleep, time | |
from threading import Thread | |
gi.require_version("Gst", "1.0") | |
from gi.repository import Gst, GLib # noqa | |
def bus_call(bus, message, loop): | |
t = message.type |
import logging | |
# if you call "getLogger" with same name several times it will return same instance: | |
logger = logging.getLogger("UniqueLoggerName") | |
# Uncomment lines to test different debug levels: | |
# Possible "level" values: https://docs.python.org/3/library/logging.html#levels | |
logger.setLevel(logging.DEBUG) | |
# logger.setLevel(logging.INFO) | |
# logger.setLevel(logging.ERROR) |
Collecting dvc[all] | |
Using cached dvc-0.82.9-py2.py3-none-any.whl (298 kB) | |
Processing /home/nik123/.cache/pip/wheels/41/99/17/7135f635215e1f61e906295afd11f4f791cfe4ab45f3bfdca2/nanotime-0.5.2-cp36-none-any.whl | |
Processing /home/nik123/.cache/pip/wheels/e8/e3/d0/a2d476b9cd09b8f5979789e0aaf07119726a3cfb19ee67aa1e/voluptuous-0.11.7-cp36-none-any.whl | |
Collecting pyasn1>=0.4.1 | |
Using cached pyasn1-0.4.8-py2.py3-none-any.whl (77 kB) | |
Processing /home/nik123/.cache/pip/wheels/de/63/64/3699be2a9d0ccdb37c7f16329acf3863fd76eda58c39c737af/networkx-2.3-py2.py3-none-any.whl | |
Processing /home/nik123/.cache/pip/wheels/20/5a/d8/1d875df03deae6f178dfdf70238cca33f948ef8a6f5209f2eb/funcy-1.14-py2.py3-none-any.whl | |
Collecting packaging>=19.0 | |
Using cached packaging-20.1-py2.py3-none-any.whl (36 kB) |
Collecting dvc[all] | |
Using cached dvc-0.82.8-py2.py3-none-any.whl (298 kB) | |
Processing /home/nik123/.cache/pip/wheels/69/86/6c/f8b8593bc273ec4b0c653d3827f7482bb2001a2781a73b7f44/humanize-0.5.1-cp36-none-any.whl | |
Processing /home/nik123/.cache/pip/wheels/3f/eb/fd/69e5177f67b505e44acbd1aedfbe44b91768ee0c4cd5636576/shortuuid-0.5.0-cp36-none-any.whl | |
Requirement already satisfied: setuptools>=34.0.0 in ./venv/lib/python3.6/site-packages (from dvc[all]) (45.1.0) | |
Collecting zc.lockfile>=1.2.1 | |
Using cached zc.lockfile-2.0-py2.py3-none-any.whl (9.7 kB) | |
Collecting pydot>=1.2.4 | |
Using cached pydot-1.4.1-py2.py3-none-any.whl (19 kB) | |
Collecting flatten-json>=0.1.6 |
DEBUG: PRAGMA user_version; | |
DEBUG: fetched: [(3,)] | |
DEBUG: CREATE TABLE IF NOT EXISTS state (inode INTEGER PRIMARY KEY, mtime TEXT NOT NULL, size TEXT NOT NULL, md5 TEXT NOT NULL, timestamp TEXT NOT NULL) | |
DEBUG: CREATE TABLE IF NOT EXISTS state_info (count INTEGER) | |
DEBUG: CREATE TABLE IF NOT EXISTS link_state (path TEXT PRIMARY KEY, inode INTEGER NOT NULL, mtime TEXT NOT NULL) | |
DEBUG: INSERT OR IGNORE INTO state_info (count) SELECT 0 WHERE NOT EXISTS (SELECT * FROM state_info) | |
DEBUG: PRAGMA user_version = 3; | |
DEBUG: Path ../../../.dvc/cache/ce/a5bf3143684c3b83dffd98b4d93bef.dir inode 105261837 | |
DEBUG: SELECT mtime, size, md5, timestamp from state WHERE inode=? | |
DEBUG: fetched: [('1573024010213697792', '457200', 'cea5bf3143684c3b83dffd98b4d93bef.dir', '1573188173411892992')] |
#! /usr/bin/python | |
# Script recursively walks through all files in current directory and saves them in the list. | |
# Then script selects random item from list of files created on previous step. | |
import random | |
import os | |
import argparse | |
""" | |
Sequence class and its derivatives. | |
Sequence provides an interface for batch-by-batch extraction of data from dataset | |
""" | |
import abc | |
from typing import Tuple, Any | |
import numpy as np | |
from sklearn.utils import shuffle |
Boolean flags
parser.add_argument('--feature', dest='feature', action='store_true')
parser.add_argument('--no-feature', dest='feature', action='store_false')
parser.set_defaults(feature=True)
Usage:
from contextlib import contextmanager | |
import time | |
@contextmanager | |
def timelogger(print_fn=print, msg: Optional[str]=None): | |
t1 = time.time() | |
try: | |
yield | |
finally: |