Coverage for jsonsubschema/config.py : 95%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1'''
2Created on June 24, 2019
3@author: Andrew Habib
4'''
6import sys
7import jsonschema
9this = sys.modules[__name__]
11this.VALIDATOR = jsonschema.Draft4Validator # Which schema validator draft to use
12this.PRINT_DB = False # Print debugging info?
13this.WARN_UNINHABITED = False # Enable uninhabited types warning?
16# API to set which schema validator draft to use
17def set_json_validator_version(v=jsonschema.Draft4Validator):
18 ''' Currently, our subtype checking supports json schema draft 4 only,
19 so VALIDATOR should not changed.
20 We prodive the method for future support of other json schema versions. '''
22 this.VALIDATOR = v
25# API to set print debugging info?
26def set_debug(b=False):
27 if b:
28 this.PRINT_DB = True
29 else:
30 this.PRINT_DB = False
33# API to enable uninhabited types warning?
34def set_warn_uninhabited(b=False):
35 if b:
36 this.WARN_UNINHABITED = True
37 else:
38 this.WARN_UNINHABITED = False