We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 91148b9 + b15191c commit 91dc1d7Copy full SHA for 91dc1d7
fastjsonschema/generator.py
@@ -1,5 +1,6 @@
1
from collections import OrderedDict
2
import re
3
+import pickle
4
5
from .exceptions import JsonSchemaValueException, JsonSchemaDefinitionException
6
from .indent import indent
@@ -100,15 +101,12 @@ def global_state_code(self):
100
101
'',
102
103
])
- regexs = ['"{}": re.compile(r"{}")'.format(key, value.pattern) for key, value in self._compile_regexps.items()]
104
return '\n'.join(self._extra_imports_lines + [
105
- 'import re',
+ 'import re, pickle',
106
'from fastjsonschema import JsonSchemaValueException',
107
108
109
- 'REGEX_PATTERNS = {',
110
- ' ' + ',\n '.join(regexs),
111
- '}',
+ 'REGEX_PATTERNS = pickle.loads(' + str(pickle.dumps(self._compile_regexps)) + ')',
112
113
114
0 commit comments