This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Fitcat. A cat that truncates long lines. | |
import contextlib, os, shutil, sys | |
try: | |
width = os.get_terminal_size(sys.stdin.fileno()).columns | |
except OSError: | |
width = shutil.get_terminal_size().columns | |
with contextlib.ExitStack() as stack, contextlib.suppress(BrokenPipeError): | |
for f in [stack.enter_context(open(fname)) for fname in sys.argv[1:]]: | |
[print(line[:width].rstrip()) for line in f] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Coalescing LRU and TTL function cache.""" | |
import asyncio | |
import atexit | |
import logging | |
import time | |
from collections import defaultdict, OrderedDict | |
from functools import wraps | |
logger = logging.getLogger(__name__) |
OlderNewer