This file is indexed.

/usr/lib/python3/dist-packages/glue/formats/jsonformat.py is in glue-sprite 0.11.1-2build1.

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
import os
import json

try:
    from collections import OrderedDict
except ImportError:
    from ordereddict import OrderedDict

from .base import BaseJSONFormat


class JSONFormat(BaseJSONFormat):

    extension = 'json'
    build_per_ratio = True

    @classmethod
    def populate_argument_parser(cls, parser):
        group = parser.add_argument_group("JSON format options")

        group.add_argument("--json",
                           dest="json_dir",
                           nargs='?',
                           const=True,
                           default=os.environ.get('GLUE_JSON', False),
                           metavar='DIR',
                           help="Generate JSON files and optionally where")

        group.add_argument("--json-format",
                           dest="json_format",
                           metavar='NAME',
                           type=str,
                           default=os.environ.get('GLUE_JSON_FORMAT', 'array'),
                           choices=['array', 'hash'],
                           help=("JSON structure format (array, hash)"))

    def get_context(self, *args, **kwargs):
        context = super(JSONFormat, self).get_context(*args, **kwargs)

        frames = OrderedDict([[i['filename'], {'filename': i['filename'],
                                        'frame': {'x': i['x'],
                                                  'y': i['y'],
                                                  'w': i['width'],
                                                  'h': i['height']},
                                        'rotated': False,
                                        'trimmed': False,
                                        'spriteSourceSize': {'x': i['x'],
                                                             'y': i['y'],
                                                             'w': i['width'],
                                                             'h': i['height']},
                                        'sourceSize': {'w': i['original_width'],
                                                       'h': i['original_height']}}] for i in context['images']])

        data = OrderedDict(frames=None, meta={'version': context['version'],
                                       'hash': context['hash'],
                                       'name': context['name'],
                                       'sprite_path': context['sprite_path'],
                                       'sprite_filename': context['sprite_filename'],
                                       'width': context['width'],
                                       'height': context['height']})

        if self.sprite.config['json_format'] == 'array':
            data['frames'] = list(frames.values())
        else:
            data['frames'] = frames

        return data