This file is indexed.

/usr/share/pyshared/kinterbasdb/typeconv_datetime_naked.py is in python-kinterbasdb 3.3.0-3.

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
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
# KInterbasDB Python Package - Type Conv : DateTime/Minimal
#
# Version 3.3
#
# The following contributors hold Copyright (C) over their respective
# portions of code (see license.txt for details):
#
# [Original Author (maintained through version 2.0-0.3.1):]
#   1998-2001 [alex]  Alexander Kuznetsov   <alexan@users.sourceforge.net>
# [Maintainers (after version 2.0-0.3.1):]
#   2001-2002 [maz]   Marek Isalski         <kinterbasdb@maz.nu>
#   2002-2006 [dsr]   David Rushby          <woodsplitter@rocketmail.com>
# [Contributors:]
#   2001      [eac]   Evgeny A. Cherkashin  <eugeneai@icc.ru>
#   2001-2002 [janez] Janez Jere            <janez.jere@void.si>

__all__ = (
    # kinterbasdb-native date and time converters:
    'date_conv_in', 'date_conv_out',
    'time_conv_in', 'time_conv_out',
    'timestamp_conv_in', 'timestamp_conv_out',

    # DB API 2.0 standard date and time type constructors:
    'Date', 'Time', 'Timestamp',
    'DateFromTicks', 'TimeFromTicks', 'TimestampFromTicks',
  )

import sys, time
from kinterbasdb.k_exceptions import *

################################################################################
## DATE AND TIME
################################################################################

# kinterbasdb-native date and time converters:
def date_conv_in(dateObj):
    # Allow implicit param conv from string:
    if dateObj is None or isinstance(dateObj, basestring):
        return dateObj

    if not isinstance(dateObj, tuple):
        raise InterfaceError(
            'Cannot convert object of type %s to native kinterbasdb tuple.'
            % str(type(dateObj))
          )
    return dateObj

def date_conv_out(dateTuple):
    return dateTuple


def time_conv_in(timeObj):
    # Allow implicit param conv from string:
    if timeObj is None or isinstance(timeObj, basestring):
        return timeObj

    if not isinstance(timeObj, tuple):
        raise InterfaceError(
            'Cannot convert object of type %s to native kinterbasdb tuple.'
            % str(type(timeObj))
          )
    return timeObj

def time_conv_out(timeTuple):
    return timeTuple


def timestamp_conv_in(timestampObj):
    # Allow implicit param conv from string:
    if timestampObj is None or isinstance(timestampObj, basestring):
        return timestampObj

    if not isinstance(timestampObj, tuple):
        raise InterfaceError(
            'Cannot convert object of type %s to native kinterbasdb tuple.'
            % str(type(timestampObj))
          )

    return timestampObj

def timestamp_conv_out(timestampTuple):
    return timestampTuple


# DB API 2.0 standard date and time type constructors:
def Date(year, month, day):
    return (year, month, day)

def Time(hour, minute, second):
    return (hour, minute, second)

def Timestamp(year, month, day, hour, minute, second):
    return (year, month, day, hour, minute, second)

def DateFromTicks(ticks):
    return time.localtime(ticks)[:3]

def TimeFromTicks(ticks):
    return time.localtime(ticks)[3:6]

def TimestampFromTicks(ticks):
    return time.localtime(ticks)[:6]