1
0
Fork 0
forked from github/pelican

tasks.py.jinja2: optimize imports

When opening the generated tasks.py file with a Python linter enabled,
some imports will be marked as unecessary depending on the options
passed to pelican-quickstart.

Add if statements around the optional imports so they are used
only when necessary.
This commit is contained in:
Agathe Porte 2024-08-04 22:39:50 +09:00
commit 2d375bc135

View file

@ -2,11 +2,15 @@ import os
import shlex
import shutil
import sys
{% if github %}
import datetime
{% endif %}
from invoke import task
from invoke.main import program
{% if cloudfiles %}
from invoke.util import cd
{% endif %}
from pelican import main as pelican_main
from pelican.server import ComplexHTTPRequestHandler, RootedHTTPServer
from pelican.settings import DEFAULT_CONFIG, get_settings_from_file