How to use the aniso8601.compat.range function in aniso8601

To help you get started, we’ve selected a few aniso8601 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 Jflick58 / DepressionAI / venv / lib / python3.6 / site-packages / aniso8601 / duration.py View on Github external
def _parse_duration_element(durationstr, elementstr):
    #Extracts the specified portion of a duration, for instance, given:
    #durationstr = 'T4H5M6.1234S'
    #elementstr = 'H'
    #
    #returns 4
    #
    #Note that the string must start with a character, so its assumed the
    #full duration string would be split at the 'T'

    durationstartindex = 0
    durationendindex = durationstr.find(elementstr)

    for characterindex in compat.range(durationendindex - 1, 0, -1):
        if durationstr[characterindex].isalpha() is True:
            durationstartindex = characterindex
            break

    durationstartindex += 1

    if ',' in durationstr:
        #Replace the comma with a 'full-stop'
        durationstr = durationstr.replace(',', '.')

    return float(durationstr[durationstartindex:durationendindex])
github Jflick58 / DepressionAI / venv / lib / python3.6 / site-packages / aniso8601 / resolution.py View on Github external
# -*- coding: utf-8 -*-

# Copyright (c) 2016, Brandon Nielsen
# All rights reserved.
#
# This software may be modified and distributed under the terms
# of the BSD license.  See the LICENSE file for details.

from aniso8601 import compat

class DateResolution(object):
    Year, Month, Week, Weekday, Day, Ordinal = list(compat.range(6))

class TimeResolution(object):
    Seconds, Minutes, Hours = list(compat.range(3))