This file is indexed.

/usr/lib/python3/dist-packages/fiona/rfc3339.py is in python3-fiona 1.6.3-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# Fiona's date and time is founded on RFC 3339.
#
# OGR knows 3 time "zones": GMT, "local time", amd "unknown". Fiona, when
# writing will convert times with a timezone offset to GMT (Z) and otherwise
# will write times with the unknown zone.

import datetime
import logging
import re

log = logging.getLogger("Fiona")

# Fiona's 'date', 'time', and 'datetime' types are sub types of 'str'.

class FionaDateType(str):
    """Dates without time."""

class FionaTimeType(str):
    """Times without dates."""

class FionaDateTimeType(str):
    """Dates and times."""

pattern_date = re.compile(r"(\d\d\d\d)(-)?(\d\d)(-)?(\d\d)")
pattern_time = re.compile(
    r"(\d\d)(:)?(\d\d)(:)?(\d\d)?(\.\d+)?(Z|([+-])?(\d\d)?(:)?(\d\d))?" )
pattern_datetime = re.compile(
    r"(\d\d\d\d)(-)?(\d\d)(-)?(\d\d)(T)?(\d\d)(:)?(\d\d)(:)?(\d\d)?(\.\d+)?(Z|([+-])?(\d\d)?(:)?(\d\d))?" )

class group_accessor(object):
    def __init__(self, m):
        self.match = m
    def group(self, i):
        try:
            return self.match.group(i) or 0
        except IndexError:
            return 0

def parse_time(text):
    """Given a RFC 3339 time, returns a tz-naive datetime tuple"""
    match = re.search(pattern_time, text)
    if match is None:
        raise ValueError("Time data '%s' does not match pattern" % text)
    g = group_accessor(match)
    log.debug("Match groups: %s", match.groups())
    return (0, 0, 0,
        int(g.group(1)), 
        int(g.group(3)), 
        int(g.group(5)), 
        1000000.0*float(g.group(6)) )

def parse_date(text):
    """Given a RFC 3339 date, returns a tz-naive datetime tuple"""
    match = re.search(pattern_date, text)
    if match is None:
        raise ValueError("Time data '%s' does not match pattern" % text)
    g = group_accessor(match)
    log.debug("Match groups: %s", match.groups())
    return (
        int(g.group(1)), 
        int(g.group(3)), 
        int(g.group(5)),
        0, 0, 0, 0.0 )

def parse_datetime(text):
    """Given a RFC 3339 datetime, returns a tz-naive datetime tuple"""
    match = re.search(pattern_datetime, text)
    if match is None:
        raise ValueError("Time data '%s' does not match pattern" % text)
    g = group_accessor(match)
    log.debug("Match groups: %s", match.groups())
    return (
        int(g.group(1)), 
        int(g.group(3)), 
        int(g.group(5)),
        int(g.group(7)), 
        int(g.group(9)), 
        int(g.group(11)), 
        1000000.0*float(g.group(12)) )