This file is indexed.

/usr/share/ada/adainclude/gnatcoll_python/gnatcoll-any_types-python.adb is in libgnatcoll-python1.6-dev 1.6gpl2014-9.

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
------------------------------------------------------------------------------
--                             G N A T C O L L                              --
--                                                                          --
--                     Copyright (C) 2009-2014, AdaCore                     --
--                                                                          --
-- This library is free software;  you can redistribute it and/or modify it --
-- under terms of the  GNU General Public License  as published by the Free --
-- Software  Foundation;  either version 3,  or (at your  option) any later --
-- version. This library is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY;  without even the implied warranty of MERCHAN- --
-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE.                            --
--                                                                          --
--                                                                          --
--                                                                          --
--                                                                          --
--                                                                          --
-- You should have received a copy of the GNU General Public License and    --
-- a copy of the GCC Runtime Library Exception along with this program;     --
-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
-- <http://www.gnu.org/licenses/>.                                          --
--                                                                          --
------------------------------------------------------------------------------

package body GNATCOLL.Any_Types.Python is

   -------------------
   -- From_PyObject --
   -------------------

   function From_PyObject (Object : PyObject) return Any_Type is
   begin
      if Object = null
        or else Object = Py_None
      then
         return Empty_Any_Type;
      end if;

      if PyInt_Check (Object) then
         declare
            A : Any_Type (Integer_Type, 0);
         begin
            A.Int := PyInt_AsLong (Object);
            return A;
         end;
      elsif PyString_Check (Object) then
         declare
            S : constant String := PyString_AsString (Object);
            A : Any_Type (String_Type, S'Length);
         begin
            A.Str := S;
            return A;
         end;
      elsif PyUnicode_Check (Object) then
         declare
            S : constant String := Unicode_AsString (Object);
            A : Any_Type (String_Type, S'Length);
         begin
            A.Str := S;
            return A;
         end;
      elsif PyList_Check (Object) then
         declare
            Size : constant Integer := PyList_Size (Object);
            Arr  : Any_Type_Array (1 .. Size);
            A    : Any_Type (List_Type, Size);
         begin
            for J in 1 .. Size loop
               Arr (J) := new Any_Type'
                 (From_PyObject (PyList_GetItem (Object, J - 1)));
            end loop;
            A.List := Arr;
            return A;
         end;
      elsif PyTuple_Check (Object) then
         declare
            Size : constant Integer := PyTuple_Size (Object);
            Arr  : Any_Type_Array (1 .. Size);
            A    : Any_Type (Tuple_Type, Size);
         begin
            for J in 1 .. Size loop
               Arr (J) := new Any_Type'
                 (From_PyObject (PyTuple_GetItem (Object, J - 1)));
            end loop;
            A.Tuple := Arr;
            return A;
         end;
      else
         --  When adding support for new types, add the corresponding cases
         --  here.

         null;
      end if;

      return Empty_Any_Type;
   end From_PyObject;

end GNATCOLL.Any_Types.Python;