Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
Template
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nimrod
Template
Commits
7d030048
Commit
7d030048
authored
8 years ago
by
nimrod
Browse files
Options
Downloads
Patches
Plain Diff
- The pprint filter already exists in Jinja, removing my duplicate.
parent
b09c2dba
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.rst
+0
-1
0 additions, 1 deletion
README.rst
VERSION
+1
-1
1 addition, 1 deletion
VERSION
template/filters.py
+0
-19
0 additions, 19 deletions
template/filters.py
with
1 addition
and
21 deletions
README.rst
+
0
−
1
View file @
7d030048
...
...
@@ -43,7 +43,6 @@ The following Jinja filters were added:
- :code:`from_yaml`: Convert from yaml.
- :code:`to_json`: Convert to json.
- :code:`from_json`: Convert from json.
- :code:`pprint`: Pretty print variable.
- :code:`combine`: Combine 2 dictionaries.
- :code:`to_toml`: Convert to toml.
- :code:`from_toml`: Convert from toml.
...
...
This diff is collapsed.
Click to expand it.
VERSION
+
1
−
1
View file @
7d030048
0.4.
1
0.4.
2
This diff is collapsed.
Click to expand it.
template/filters.py
+
0
−
19
View file @
7d030048
...
...
@@ -72,25 +72,6 @@ def from_yaml(value):
return
safe_load
(
value
)
def
pprint
(
value
):
'''
Returns a pretty string representation of the data structure given.
Examples:
>>>
pprint
(
1
)
'
1
'
>>>
import
six
>>>
output
=
pprint
([{
'
first_name
'
:
'
John
'
,
'
last_name
'
:
'
Doe
'
},
{
'
first_name
'
:
'
Jane
'
,
'
last_name
'
:
'
Doe
'
}])
# noqa: E501
>>>
if
six
.
PY3
:
...
output
==
"
[{
'
first_name
'
:
'
John
'
,
'
last_name
'
:
'
Doe
'
},
\\
n {
'
first_name
'
:
'
Jane
'
,
'
last_name
'
:
'
Doe
'
}]
"
...
elif
six
.
PY2
:
...
output
==
"
[{u
'
first_name
'
: u
'
John
'
, u
'
last_name
'
: u
'
Doe
'
},
\\
n {u
'
first_name
'
: u
'
Jane
'
, u
'
last_name
'
: u
'
Doe
'
}]
"
...
True
'''
from
pprint
import
pformat
return
pformat
(
value
)
def
combine
(
default
,
override
):
'''
Returns a combined dictionary of the 2 dictionaries given (with the 2nd
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment