/usr/lib/python3/dist-packages/cookiecutter/extensions.py is in python3-cookiecutter 1.6.0-2.
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 | # -*- coding: utf-8 -*-
"""Jinja2 extensions."""
import json
from jinja2.ext import Extension
class JsonifyExtension(Extension):
"""Jinja2 extension to convert a Python object to JSON."""
def __init__(self, environment):
"""Initialize the extension with the given environment."""
super(JsonifyExtension, self).__init__(environment)
def jsonify(obj):
return json.dumps(obj, sort_keys=True, indent=4)
environment.filters['jsonify'] = jsonify
|