Skip to content

Commit e0952f6

Browse files
committed
resolving pylint errors
1 parent 1748158 commit e0952f6

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

format-para.py renamed to format_para.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
# Python
2+
"""This module demonstrates rendering a template with Jinja2 using sample data."""
13
from jinja2 import Template
24

3-
45
numbers = [1,2,3,4,5,6,7,8]
5-
template = """Hello {{name | title}},
6+
TEMPLATE = """Hello {{name | title}},
67
Hope you are doing well!
78
Please confirm the following order:
89
{{quantity | unique | max}} {{type | replace ("books","NOTEBOOKS") | lower}}, {% for key, value in collection.items() %}
@@ -23,7 +24,6 @@
2324
"collection" : {"Pencils":"2","Pens":"3", "Stencils":"5", "Erasers":"5" }
2425
}
2526

26-
j2_template = Template(template)
27+
j2_template = Template(TEMPLATE)
2728

2829
print(j2_template.render(data))
29-

html_example.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Python
2+
"""This module demonstrates rendering a template with Jinja2 using sample data."""
13
from jinja2 import Environment, FileSystemLoader
24

35
environment = Environment(loader=FileSystemLoader("templates/"))
@@ -12,5 +14,5 @@
1214
)
1315

1416
# w+ is to create a file if not present
15-
with open("index.html",'w+') as f:
16-
f.write(message)
17+
with open("index.html",'w+', encoding="utf-8") as f:
18+
f.write(message)

mail_example.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Python
2+
"""This module demonstrates rendering a template with Jinja2 using sample data."""
13
from jinja2 import Environment, FileSystemLoader
24

35
environment = Environment(loader=FileSystemLoader("templates/"))

table_example.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Python
2+
"""This module demonstrates rendering a template with Jinja2 using sample data."""
13
from jinja2 import Environment, FileSystemLoader
24

35
environment = Environment(loader=FileSystemLoader("templates/"))
@@ -10,11 +12,10 @@
1012
{"Id": 4, "Number": 48, "Name": "Cream"},
1113
{"Id": 5, "Number": 49, "Name": "Curd"},
1214
{"Id": 6, "Number": 50, "Name": "Yogurt"}
13-
1415
]
1516
}
1617

1718
message = template.render(json_data)
1819
# w+ is to create a file if not present
19-
with open("index.html", "w+") as f:
20-
f.write(message)
20+
with open("index.html", "w+", encoding="utf-8") as f:
21+
f.write(message,)

0 commit comments

Comments
 (0)