Skip to content

Commit 5fd261b

Browse files
committed
Pylint
1 parent 65e3086 commit 5fd261b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pelican/migration/generate_settings.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ def generate_settings(source_yaml, settings_path, builtin_p_paths=None, sourcepa
4040
if os.path.isfile(asfyaml):
4141
print(".asf.yaml detected, reading...")
4242
adata = yaml.safe_load(open(asfyaml))
43+
else:
44+
adata = None # ensure the variable is defined
4345

4446
print(f"Reading {source_yaml} in {sourcepath}")
4547
ydata = yaml.safe_load(open(source_yaml))
@@ -172,7 +174,7 @@ def generate_settings(source_yaml, settings_path, builtin_p_paths=None, sourcepa
172174
t = ezt.Template(os.path.join(THIS_DIR, AUTO_SETTINGS_TEMPLATE))
173175
t.generate(open(settings_path, "w+"), tdata)
174176

175-
if __name__ == "__main__":
177+
def main():
176178
parser = argparse.ArgumentParser(description="Convert pelicanconf.yaml to pelicanconf.py")
177179
parser.add_argument('-y', '--yaml', required=True, help="Pelicanconf YAML file")
178180
args = parser.parse_args()
@@ -186,3 +188,6 @@ def generate_settings(source_yaml, settings_path, builtin_p_paths=None, sourcepa
186188
settings_path = os.path.join(sourcepath, AUTO_SETTINGS)
187189
builtin_plugins = os.path.join(tool_dir, os.pardir, "plugins")
188190
generate_settings(pelconf_yaml, settings_path, [builtin_plugins], sourcepath)
191+
192+
if __name__ == "__main__":
193+
main()

0 commit comments

Comments
 (0)