How to use the boltons.timeutils.isoparse function in boltons

To help you get started, we’ve selected a few boltons examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mahmoud / apatite / apatite / cli.py View on Github external
def _get_commit_dt(text):
    return isoparse(text.rsplit(':', 1)[0]).replace(second=0, microsecond=0)
github mahmoud / apatite / apatite / metrics / vcs.py View on Github external
def _get_commit_dt(repo_dir, commit_hash, **kw):
    kw.setdefault('env', {})['TZ'] = 'UTC'
    kw['cwd'] = repo_dir
    proc_res = run_cap(['git', 'show', '-s', '--format=%cd', '--date=format-local:%Y-%m-%dT%H:%M:%S', commit_hash], **kw)
    date_text = proc_res.stdout.strip()
    return isoparse(date_text)
github mahmoud / apatite / apatite / cli.py View on Github external
def _get_project_repo_info_map(project_list, repo_dir):
    ret = OrderedDict()

    for project in project_list:
        target_repo_dir = os.path.join(repo_dir, project.name_slug)
        if not os.path.isdir(target_repo_dir):
            print_err('project %s repo directory not found at: %r' % (project.name, target_repo_dir))
            continue
        pull_date_path = target_repo_dir + '/.apatite_last_pulled'
        with open(pull_date_path, 'r') as f:
            last_pulled_bytes = f.read()
            try:
                last_pulled = isoparse(last_pulled_bytes)
            except (TypeError, ValueError):
                print_err('project %s had unreadable pull date at: %r' % (project.name, pull_date_path))
                continue
        ret[project] = (target_repo_dir, last_pulled)

    return ret
github mahmoud / awesome-python-applications / apatite / apatite / metrics / vcs.py View on Github external
def _get_commit_dt(repo_dir, commit_hash, **kw):
    kw.setdefault('env', {})['TZ'] = 'UTC'
    kw['cwd'] = repo_dir
    proc_res = run_cap(['git', 'show', '-s', '--format=%cd', '--date=format-local:%Y-%m-%dT%H:%M:%S', commit_hash], **kw)
    date_text = proc_res.stdout.strip()
    return isoparse(date_text)
github mahmoud / awesome-python-applications / apatite / apatite / cli.py View on Github external
def _date_param(text):
    text = text.strip()
    if text.startswith('-'):
        td = parse_timedelta(text)
        dt = datetime.datetime.utcnow() + td  # adding a negative
        return dt
    dt = isoparse(text)
    return dt
github mahmoud / apatite / apatite / cli.py View on Github external
def _date_param(text):
    text = text.strip()
    if text.startswith('-'):
        td = parse_timedelta(text)
        dt = datetime.datetime.utcnow() + td  # adding a negative
        return dt
    dt = isoparse(text)
    return dt
github mahmoud / awesome-python-applications / apatite / apatite / cli.py View on Github external
def _get_project_repo_info_map(project_list, repo_dir):
    ret = OrderedDict()

    for project in project_list:
        target_repo_dir = os.path.join(repo_dir, project.name_slug)
        if not os.path.isdir(target_repo_dir):
            print_err('project %s repo directory not found at: %r' % (project.name, target_repo_dir))
            continue
        pull_date_path = target_repo_dir + '/.apatite_last_pulled'
        with open(pull_date_path, 'r') as f:
            last_pulled_bytes = f.read()
            try:
                last_pulled = isoparse(last_pulled_bytes)
            except (TypeError, ValueError):
                print_err('project %s had unreadable pull date at: %r' % (project.name, pull_date_path))
                continue
        ret[project] = (target_repo_dir, last_pulled)

    return ret