This file is indexed.

/usr/lib/python2.7/dist-packages/fiona/fio/calc.py is in python-fiona 1.7.1-1.

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
from __future__ import division
import json
import logging

import click
from cligj import use_rs_opt

from .helpers import obj_gen, eval_feature_expression


@click.command(short_help="Calculate GeoJSON property by Python expression")
@click.argument('property_name')
@click.argument('expression')
@click.option('--overwrite', is_flag=True, default=False,
              help="Overwrite properties, default: False")
@use_rs_opt
@click.pass_context
def calc(ctx, property_name, expression, overwrite, use_rs):
    """
    Create a new property on GeoJSON features using the specified expression.

    \b
    The expression is evaluated in a restricted namespace containing:
        - sum, pow, min, max and the imported math module
        - shape (optional, imported from shapely.geometry if available)
        - bool, int, str, len, float type conversions
        - f (the feature to be evaluated,
             allows item access via javascript-style dot notation using munch)

    The expression will be evaluated for each feature and its
    return value will be added to the properties
    as the specified property_name. Existing properties will not
    be overwritten by default (an Exception is raised).

    Example

    \b
    $ fio cat data.shp | fio calc sumAB  "f.properties.A + f.properties.B"
    """
    logger = logging.getLogger('fio')
    stdin = click.get_text_stream('stdin')

    try:
        source = obj_gen(stdin)
        for i, obj in enumerate(source):
            features = obj.get('features') or [obj]
            for j, feat in enumerate(features):

                if not overwrite and property_name in feat['properties']:
                    raise click.UsageError(
                        '{0} already exists in properties; '
                        'rename or use --overwrite'.format(property_name))

                feat['properties'][property_name] = eval_feature_expression(
                    feat, expression)

                if use_rs:
                    click.echo(u'\u001e', nl=False)
                click.echo(json.dumps(feat))

    except Exception:
        logger.exception("Exception caught during processing")
        raise click.Abort()