Skip to content
Myr

[docs] Use yaml.safe_load() in build_*.py scripts (#2432)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by nmulcahey · committed by GitHub · parent b7511b9 · Browse files · 3 files+3 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Co-authored-by: itchyny <itchyny@cybozu.co.jp>

Diff stats

3 files+3 added−3 removed

  • other:+3 added−3 removed

3 files+3 added−3 removed

modified:docs/build_manpage.py+1 added-1 removed
185 unmodified lines
186 pass187188def load_yml_file(fn):189 with open(fn) as f:190 return yaml.load(f, Loader=yaml.Loader)190 return yaml.safe_load(f)191192def dedent_body(body):193 lines = [re.sub(r'^ (\S)', r'\1', l) for l in body.split('\n')]194 return '\n'.join(lines)
41 unmodified lines
modified:docs/build_mantests.py+1 added-1 removed
1#!/usr/bin/env python32import yaml34with open("content/manual/manual.yml") as f:5 manual = yaml.load(f)5 manual = yaml.safe_load(f)6 for section in manual.get('sections', []):7 for entry in section.get('entries', []):8 for example in entry.get('examples', []):9 print(example.get('program', '').replace('\n', ' '))
4 unmodified lines
modified:docs/build_website.py+1 added-1 removed
14 unmodified lines
15)1617def load_yml_file(fn):18 with open(fn) as f:19 return yaml.load(f, Loader=yaml.Loader)19 return yaml.safe_load(f)2021env.filters['search_id'] = lambda input: input.replace(r'`', '')22env.filters['section_id'] = lambda input: re.sub(r"[^a-zA-Z0-9_]", '', input)23env.filters['entry_id'] = lambda input: re.sub(r"[ `]", '', input)
47 unmodified lines