import json from glob import glob from collections import defaultdict, namedtuple, OrderedDict from pathlib import Path from math import log10, ceil from caflib.Utils import mkdir, slugify, cd, listify, timing, relink, \ make_nonwritable, _reports from caflib.Template import Template from caflib.Hook import process_hook from caflib.Logging import warn, info, error, dep_error try: from progressbar import ProgressBar except ImportError: dep_error('progressbar2') hashf = 'sha1' cellar = 'Cellar' brewery = 'Brewery' _features = {} class NotStored(Exception): pass def get_stored(path, require=True): full_path = Path(path).resolve()
import re import os from contextlib import contextmanager from datetime import datetime from collections import defaultdict import time import itertools import sys import stat from caflib.Logging import Table, dep_error try: import yaml except ImportError: dep_error('yaml') _dotiming = 'TIMING' in os.environ _timing = defaultdict(float) _timing_stack = [] _writable = stat.S_IWUSR | stat.S_IWGRP | stat.S_IWOTH _reports = [] def report(f): """Register function as a report in Context. Example: @report
from textwrap import dedent from collections import OrderedDict from caflib.Logging import dep_error, Table try: from docopt import docopt except ImportError: dep_error('docopt') class Command: def __init__(self, func, name=None, mapping=None, doc=None): self.name = name or func.__name__ self._func = func self._mapping = mapping or func.__annotations__ self._doc = doc or func.__doc__ def __repr__(self): return '<Command "{}">'.format(self.name) def __str__(self): s = dedent(self._doc).rstrip() firstline, s = s.split('\n', 1) if firstline: s = firstline + '\n' + s return s def __format__(self, fmt): if not fmt: return str(self)