Python json.encoder.encode_basestring_ascii() Examples
The following are 26
code examples of json.encoder.encode_basestring_ascii().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
json.encoder
, or try the search function
.
Example #1
Source File: validators.py From SA-ctf_scoreboard_admin with Creative Commons Zero v1.0 Universal | 5 votes |
def __call__(self, value): if value is None: return None value = unicode(value) if self.pattern.match(value) is None: raise ValueError('Expected {}, not {}'.format(self.name, json_encode_string(value))) return value
Example #2
Source File: validators.py From vscode-extension-splunk with MIT License | 5 votes |
def __call__(self, value): if value is None: return None value = six.text_type(value) if self.pattern.match(value) is None: raise ValueError('Expected {}, not {}'.format(self.name, json_encode_string(value))) return value
Example #3
Source File: validators.py From vscode-extension-splunk with MIT License | 5 votes |
def __call__(self, value): if value is None: return None try: if six.PY2: value = long(value) else: value = int(value) except ValueError: raise ValueError('Expected integer value, not {}'.format(json_encode_string(value))) self.check_range(value) return value
Example #4
Source File: validators.py From SA-ctf_scoreboard with Creative Commons Zero v1.0 Universal | 5 votes |
def __call__(self, value): if value is None: return None try: value = long(value) except ValueError: raise ValueError('Expected integer value, not {}'.format(json_encode_string(value))) self.check_range(value) return value
Example #5
Source File: validators.py From SA-ctf_scoreboard with Creative Commons Zero v1.0 Universal | 5 votes |
def __call__(self, value): if value is None: return None value = unicode(value) if self.pattern.match(value) is None: raise ValueError('Expected {}, not {}'.format(self.name, json_encode_string(value))) return value
Example #6
Source File: validators.py From SA-ctf_scoreboard with Creative Commons Zero v1.0 Universal | 5 votes |
def __call__(self, value): if value is None: return None try: value = long(value) except ValueError: raise ValueError('Expected integer value, not {}'.format(json_encode_string(value))) self.check_range(value) return value
Example #7
Source File: validators.py From SA-ctf_scoreboard with Creative Commons Zero v1.0 Universal | 5 votes |
def __call__(self, value): if value is None: return None value = unicode(value) if self.pattern.match(value) is None: raise ValueError('Expected {}, not {}'.format(self.name, json_encode_string(value))) return value
Example #8
Source File: validators.py From SA-ctf_scoreboard with Creative Commons Zero v1.0 Universal | 5 votes |
def __call__(self, value): if value is None: return None try: value = long(value) except ValueError: raise ValueError('Expected integer value, not {}'.format(json_encode_string(value))) self.check_range(value) return value
Example #9
Source File: hr_django_json_encoder.py From lexpredict-contraxsuite with GNU Affero General Public License v3.0 | 5 votes |
def brief_encode_basestring_ascii(s): text = encode_basestring_ascii(s) text = text[:HRDjangoJSONEncoder.MAX_ITEM_LENGTH - 3] + '...' \ if len(text) > HRDjangoJSONEncoder.MAX_ITEM_LENGTH else text return json.dumps(text)
Example #10
Source File: validators.py From SplunkAdmins with Apache License 2.0 | 5 votes |
def __call__(self, value): if value is None: return None value = six.text_type(value) if self.pattern.match(value) is None: raise ValueError('Expected {}, not {}'.format(self.name, json_encode_string(value))) return value
Example #11
Source File: validators.py From SplunkAdmins with Apache License 2.0 | 5 votes |
def __call__(self, value): if value is None: return None try: if six.PY2: value = long(value) else: value = int(value) except ValueError: raise ValueError('Expected integer value, not {}'.format(json_encode_string(value))) self.check_range(value) return value
Example #12
Source File: validators.py From SplunkAdmins with Apache License 2.0 | 5 votes |
def __call__(self, value): if value is None: return None value = six.text_type(value) if self.pattern.match(value) is None: raise ValueError('Expected {}, not {}'.format(self.name, json_encode_string(value))) return value
Example #13
Source File: validators.py From SplunkAdmins with Apache License 2.0 | 5 votes |
def __call__(self, value): if value is None: return None try: if six.PY2: value = long(value) else: value = int(value) except ValueError: raise ValueError('Expected integer value, not {}'.format(json_encode_string(value))) self.check_range(value) return value
Example #14
Source File: validators.py From misp42splunk with GNU Lesser General Public License v3.0 | 5 votes |
def __call__(self, value): if value is None: return None try: if six.PY2: value = long(value) else: value = int(value) except ValueError: raise ValueError('Expected integer value, not {}'.format(json_encode_string(value))) self.check_range(value) return value
Example #15
Source File: validators.py From SA-ctf_scoreboard_admin with Creative Commons Zero v1.0 Universal | 5 votes |
def __call__(self, value): if value is None: return None try: value = long(value) except ValueError: raise ValueError('Expected integer value, not {}'.format(json_encode_string(value))) self.check_range(value) return value
Example #16
Source File: test_speedups.py From Computable with MIT License | 5 votes |
def test_encode_basestring_ascii(self): self.assertEqual(encoder.encode_basestring_ascii.__module__, "_json") self.assertTrue(encoder.encode_basestring_ascii is encoder.c_encode_basestring_ascii)
Example #17
Source File: validators.py From SplunkForPCAP with MIT License | 5 votes |
def __call__(self, value): if value is None: return None value = unicode(value) if self.pattern.match(value) is None: raise ValueError('Expected {}, not {}'.format(self.name, json_encode_string(value))) return value
Example #18
Source File: validators.py From SplunkForPCAP with MIT License | 5 votes |
def __call__(self, value): if value is None: return None try: value = long(value) except ValueError: raise ValueError('Expected integer value, not {}'.format(json_encode_string(value))) self.check_range(value) return value
Example #19
Source File: validators.py From misp42splunk with GNU Lesser General Public License v3.0 | 5 votes |
def __call__(self, value): if value is None: return None value = six.text_type(value) if self.pattern.match(value) is None: raise ValueError('Expected {}, not {}'.format(self.name, json_encode_string(value))) return value
Example #20
Source File: validators.py From misp42splunk with GNU Lesser General Public License v3.0 | 5 votes |
def __call__(self, value): if value is None: return None try: if six.PY2: value = long(value) else: value = int(value) except ValueError: raise ValueError('Expected integer value, not {}'.format(json_encode_string(value))) self.check_range(value) return value
Example #21
Source File: validators.py From misp42splunk with GNU Lesser General Public License v3.0 | 5 votes |
def __call__(self, value): if value is None: return None value = six.text_type(value) if self.pattern.match(value) is None: raise ValueError('Expected {}, not {}'.format(self.name, json_encode_string(value))) return value
Example #22
Source File: validators.py From misp42splunk with GNU Lesser General Public License v3.0 | 5 votes |
def __call__(self, value): if value is None: return None try: if six.PY2: value = long(value) else: value = int(value) except ValueError: raise ValueError('Expected integer value, not {}'.format(json_encode_string(value))) self.check_range(value) return value
Example #23
Source File: validators.py From misp42splunk with GNU Lesser General Public License v3.0 | 5 votes |
def __call__(self, value): if value is None: return None try: if six.PY2: value = long(value) else: value = int(value) except ValueError: raise ValueError('Expected integer value, not {}'.format(json_encode_string(value))) self.check_range(value) return value
Example #24
Source File: validators.py From misp42splunk with GNU Lesser General Public License v3.0 | 5 votes |
def __call__(self, value): if value is None: return None value = six.text_type(value) if self.pattern.match(value) is None: raise ValueError('Expected {}, not {}'.format(self.name, json_encode_string(value))) return value
Example #25
Source File: validators.py From misp42splunk with GNU Lesser General Public License v3.0 | 5 votes |
def __call__(self, value): if value is None: return None try: if six.PY2: value = long(value) else: value = int(value) except ValueError: raise ValueError('Expected integer value, not {}'.format(json_encode_string(value))) self.check_range(value) return value
Example #26
Source File: validators.py From misp42splunk with GNU Lesser General Public License v3.0 | 5 votes |
def __call__(self, value): if value is None: return None value = six.text_type(value) if self.pattern.match(value) is None: raise ValueError('Expected {}, not {}'.format(self.name, json_encode_string(value))) return value