Commit c226b807 authored by Matthieu Boileau's avatar Matthieu Boileau

pep8

parent 4d90e90a
Pipeline #6818 passed with stage
in 34 seconds
......@@ -16,7 +16,7 @@ from ruamel.yaml.reader import Reader
import io
import shutil
import sys
import ftfy # Fixing broken encoding
import ftfy # Fixing broken encoding
import chardet
SPIPFILES = [
......@@ -88,6 +88,7 @@ def escape_title(s):
else:
return s
escape_title.pattern = re.compile(r'^ ([^ :]+):\s+(.*?)$')
......@@ -119,6 +120,7 @@ def is_invalid_date(s):
"""
return is_invalid_date.pattern.match(s)
is_invalid_date.pattern = re.compile(r"^ (date|en_ligne)[^:]*: 0000-00-00 00:00:00$")
......@@ -129,6 +131,7 @@ def remove_null_date(s):
s = re.sub(r'(^ date|^ en_ligne).*: 0000-00-00 00:00:00$', r'', s, flags=re.MULTILINE)
return s
def is_removable_title(s):
"""
True if the title can be remove from the YAML content.
......@@ -137,6 +140,7 @@ def is_removable_title(s):
return match and match.group(1) in TITLETOREMOVE
is_removable_title.pattern = re.compile(r'^ ([^ :]+):')
......@@ -144,7 +148,6 @@ def clean_generator(iterable):
"""
Generator of cleaned and fixed YAML lines.
"""
#for line in deblock_generator(iterable):
for line in iterable:
if is_invalid_date(line) or is_removable_title(line):
continue
......@@ -215,4 +218,3 @@ if __name__ == '__main__':
reset_output_directory()
split_yaml(args.spipfile)
clean_yaml_files(SPIPFILES)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment