@@ -40,51 +40,51 @@ def run(self):
4040 with open (yaml_src , 'rb' ) as fp :
4141 regexes = yaml .safe_load (fp )
4242 with open (py_dest , 'wb' ) as fp :
43- fp .write ('############################################\n ' )
44- fp .write ('# NOTICE: This file is autogenerated from #\n ' )
45- fp .write ('# regexes.yaml. Do not edit by hand, #\n ' )
46- fp .write ('# instead, re-run `setup.py build_regexes` #\n ' )
47- fp .write ('############################################\n ' )
48- fp .write ('\n ' )
49- fp .write ('from .user_agent_parser import (\n ' )
50- fp .write (' UserAgentParser, DeviceParser, OSParser,\n ' )
51- fp .write (')\n ' )
52- fp .write ('\n ' )
53- fp .write ('__all__ = (\n ' )
54- fp .write (' \' USER_AGENT_PARSERS\' , \' DEVICE_PARSERS\' , \' OS_PARSERS\' ,\n ' )
55- fp .write (')\n ' )
56- fp .write ('\n ' )
57- fp .write ('USER_AGENT_PARSERS = [\n ' )
43+ fp .write (b '############################################\n ' )
44+ fp .write (b '# NOTICE: This file is autogenerated from #\n ' )
45+ fp .write (b '# regexes.yaml. Do not edit by hand, #\n ' )
46+ fp .write (b '# instead, re-run `setup.py build_regexes` #\n ' )
47+ fp .write (b '############################################\n ' )
48+ fp .write (b '\n ' )
49+ fp .write (b 'from .user_agent_parser import (\n ' )
50+ fp .write (b ' UserAgentParser, DeviceParser, OSParser,\n ' )
51+ fp .write (b ')\n ' )
52+ fp .write (b '\n ' )
53+ fp .write (b '__all__ = (\n ' )
54+ fp .write (b ' \' USER_AGENT_PARSERS\' , \' DEVICE_PARSERS\' , \' OS_PARSERS\' ,\n ' )
55+ fp .write (b ')\n ' )
56+ fp .write (b '\n ' )
57+ fp .write (b 'USER_AGENT_PARSERS = [\n ' )
5858 for device_parser in regexes ['user_agent_parsers' ]:
59- fp .write (' UserAgentParser(\n ' )
60- fp .write (' %r,\n ' % device_parser ['regex' ])
61- fp .write (' %r,\n ' % device_parser .get ('family_replacement' ))
62- fp .write (' %r,\n ' % device_parser .get ('v1_replacement' ))
63- fp .write (' %r,\n ' % device_parser .get ('v2_replacement' ))
64- fp .write (' ),\n ' )
65- fp .write (']\n ' )
66- fp .write ('\n ' )
67- fp .write ('DEVICE_PARSERS = [\n ' )
59+ fp .write (b ' UserAgentParser(\n ' )
60+ fp .write (b ' %r,\n ' % device_parser ['regex' ])
61+ fp .write (b ' %r,\n ' % device_parser .get ('family_replacement' ))
62+ fp .write (b ' %r,\n ' % device_parser .get ('v1_replacement' ))
63+ fp .write (b ' %r,\n ' % device_parser .get ('v2_replacement' ))
64+ fp .write (b ' ),\n ' )
65+ fp .write (b ']\n ' )
66+ fp .write (b '\n ' )
67+ fp .write (b 'DEVICE_PARSERS = [\n ' )
6868 for device_parser in regexes ['device_parsers' ]:
69- fp .write (' DeviceParser(\n ' )
70- fp .write (' %r,\n ' % device_parser ['regex' ])
71- fp .write (' %r,\n ' % device_parser .get ('regex_flag' ))
72- fp .write (' %r,\n ' % device_parser .get ('device_replacement' ))
73- fp .write (' %r,\n ' % device_parser .get ('brand_replacement' ))
74- fp .write (' %r,\n ' % device_parser .get ('model_replacement' ))
75- fp .write (' ),\n ' )
76- fp .write (']\n ' )
77- fp .write ('\n ' )
78- fp .write ('OS_PARSERS = [\n ' )
69+ fp .write (b ' DeviceParser(\n ' )
70+ fp .write (b ' %r,\n ' % device_parser ['regex' ])
71+ fp .write (b ' %r,\n ' % device_parser .get ('regex_flag' ))
72+ fp .write (b ' %r,\n ' % device_parser .get ('device_replacement' ))
73+ fp .write (b ' %r,\n ' % device_parser .get ('brand_replacement' ))
74+ fp .write (b ' %r,\n ' % device_parser .get ('model_replacement' ))
75+ fp .write (b ' ),\n ' )
76+ fp .write (b ']\n ' )
77+ fp .write (b '\n ' )
78+ fp .write (b 'OS_PARSERS = [\n ' )
7979 for device_parser in regexes ['os_parsers' ]:
80- fp .write (' OSParser(\n ' )
81- fp .write (' %r,\n ' % device_parser ['regex' ])
82- fp .write (' %r,\n ' % device_parser .get ('os_replacement' ))
83- fp .write (' %r,\n ' % device_parser .get ('os_v1_replacement' ))
84- fp .write (' %r,\n ' % device_parser .get ('os_v2_replacement' ))
85- fp .write (' ),\n ' )
86- fp .write (']\n ' )
87- fp .write ('\n ' )
80+ fp .write (b ' OSParser(\n ' )
81+ fp .write (b ' %r,\n ' % device_parser ['regex' ])
82+ fp .write (b ' %r,\n ' % device_parser .get ('os_replacement' ))
83+ fp .write (b ' %r,\n ' % device_parser .get ('os_v1_replacement' ))
84+ fp .write (b ' %r,\n ' % device_parser .get ('os_v2_replacement' ))
85+ fp .write (b ' ),\n ' )
86+ fp .write (b ']\n ' )
87+ fp .write (b '\n ' )
8888
8989
9090class develop (_develop ):
0 commit comments