INNER CODE UNIT · Python

read_seen

pluralsh/plural · bin/list_images.py:42

def read_seen():
    seen_file = Path('./.seen')
    with seen_file.open() as f:
        for l in f.readlines():
            SEEN.add(l.strip())

def flush_seen(*_args):
    seen_file = Path('./.seen')
    with seen_file.open('w') as f:
        f.writelines([f"{r}\n" for r in SEEN])
    sys.exit(0)

def get_token():
    if os.environ.get('PLURAL_ACCESS_TOKEN'):
        return os.environ['PLURAL_ACCESS_TOKEN']

    with open(expanduser("~/.plural/config.yml")) as f:
        data = yaml.load(f, Loader=SafeLoader)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…