File: _py21incompat.py

package info (click to toggle)
python-kinterbasdb 3.1-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,044 kB
  • ctags: 1,157
  • sloc: ansic: 6,879; python: 2,517; makefile: 77
file content (43 lines) | stat: -rw-r--r-- 1,557 bytes parent folder | download | duplicates (2)
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
# KInterbasDB Python Package - Python Module For Python 2.1-incompatible Syntax
#
# Version 3.1
#
# 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-2004 [dsr]   David Rushby          <woodsplitter@rocketmail.com>
# [Contributors:]
#   2001      [eac]   Evgeny A. Cherkashin  <eugeneai@icc.ru>
#   2001-2002 [janez] Janez Jere            <janez.jere@void.si>

# This file is a temporary companion of __init__.py to preserve Python 2.1
# compatibility.  Due to Python quirks (__future__ imports must be at the very
# beginning of the module; yield is a keyword), it wasn't possible to use
# yield in a module that tried to be even minimally compatible with Python 2.1.

from __future__ import generators # Maintain compatibility with Python 2.2


def init(mainKGlobals):
    # Give this module access to some members of the main module.
    global DESCRIPTION_NAME
    DESCRIPTION_NAME = mainKGlobals['DESCRIPTION_NAME']


def _RowMapping__iterkeys(self):
    for fieldDesc in self._description:
        yield fieldDesc[DESCRIPTION_NAME]


def _RowMapping__itervalues(self):
    for fieldName in self:
        yield self[fieldName]


def _RowMapping__iteritems(self):
    for fieldName in self:
        yield fieldName, self[fieldName]