stone 3.3.3__tar.gz → 3.3.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. {stone-3.3.3/stone.egg-info → stone-3.3.6}/PKG-INFO +1 -1
  2. {stone-3.3.3 → stone-3.3.6}/setup.py +1 -1
  3. {stone-3.3.3 → stone-3.3.6}/stone/backends/python_rsrc/stone_validators.py +25 -10
  4. {stone-3.3.3 → stone-3.3.6/stone.egg-info}/PKG-INFO +1 -1
  5. {stone-3.3.3 → stone-3.3.6}/LICENSE +0 -0
  6. {stone-3.3.3 → stone-3.3.6}/MANIFEST.in +0 -0
  7. {stone-3.3.3 → stone-3.3.6}/README.rst +0 -0
  8. {stone-3.3.3 → stone-3.3.6}/ez_setup.py +0 -0
  9. {stone-3.3.3 → stone-3.3.6}/setup.cfg +0 -0
  10. {stone-3.3.3 → stone-3.3.6}/stone/__init__.py +0 -0
  11. {stone-3.3.3 → stone-3.3.6}/stone/backend.py +0 -0
  12. {stone-3.3.3 → stone-3.3.6}/stone/backends/__init__.py +0 -0
  13. {stone-3.3.3 → stone-3.3.6}/stone/backends/helpers.py +0 -0
  14. {stone-3.3.3 → stone-3.3.6}/stone/backends/js_client.py +0 -0
  15. {stone-3.3.3 → stone-3.3.6}/stone/backends/js_helpers.py +0 -0
  16. {stone-3.3.3 → stone-3.3.6}/stone/backends/js_types.py +0 -0
  17. {stone-3.3.3 → stone-3.3.6}/stone/backends/obj_c.py +0 -0
  18. {stone-3.3.3 → stone-3.3.6}/stone/backends/obj_c_client.py +0 -0
  19. {stone-3.3.3 → stone-3.3.6}/stone/backends/obj_c_helpers.py +0 -0
  20. {stone-3.3.3 → stone-3.3.6}/stone/backends/obj_c_types.py +0 -0
  21. {stone-3.3.3 → stone-3.3.6}/stone/backends/python_client.py +0 -0
  22. {stone-3.3.3 → stone-3.3.6}/stone/backends/python_helpers.py +0 -0
  23. {stone-3.3.3 → stone-3.3.6}/stone/backends/python_rsrc/__init__.py +0 -0
  24. {stone-3.3.3 → stone-3.3.6}/stone/backends/python_rsrc/stone_base.py +0 -0
  25. {stone-3.3.3 → stone-3.3.6}/stone/backends/python_rsrc/stone_serializers.py +0 -0
  26. {stone-3.3.3 → stone-3.3.6}/stone/backends/python_type_mapping.py +0 -0
  27. {stone-3.3.3 → stone-3.3.6}/stone/backends/python_type_stubs.py +0 -0
  28. {stone-3.3.3 → stone-3.3.6}/stone/backends/python_types.py +0 -0
  29. {stone-3.3.3 → stone-3.3.6}/stone/backends/swift.py +0 -0
  30. {stone-3.3.3 → stone-3.3.6}/stone/backends/swift_client.py +0 -0
  31. {stone-3.3.3 → stone-3.3.6}/stone/backends/swift_helpers.py +0 -0
  32. {stone-3.3.3 → stone-3.3.6}/stone/backends/swift_types.py +0 -0
  33. {stone-3.3.3 → stone-3.3.6}/stone/backends/tsd_client.py +0 -0
  34. {stone-3.3.3 → stone-3.3.6}/stone/backends/tsd_helpers.py +0 -0
  35. {stone-3.3.3 → stone-3.3.6}/stone/backends/tsd_types.py +0 -0
  36. {stone-3.3.3 → stone-3.3.6}/stone/cli.py +0 -0
  37. {stone-3.3.3 → stone-3.3.6}/stone/cli_helpers.py +0 -0
  38. {stone-3.3.3 → stone-3.3.6}/stone/compiler.py +0 -0
  39. {stone-3.3.3 → stone-3.3.6}/stone/frontend/__init__.py +0 -0
  40. {stone-3.3.3 → stone-3.3.6}/stone/frontend/ast.py +0 -0
  41. {stone-3.3.3 → stone-3.3.6}/stone/frontend/exception.py +0 -0
  42. {stone-3.3.3 → stone-3.3.6}/stone/frontend/frontend.py +0 -0
  43. {stone-3.3.3 → stone-3.3.6}/stone/frontend/ir_generator.py +0 -0
  44. {stone-3.3.3 → stone-3.3.6}/stone/frontend/lexer.py +0 -0
  45. {stone-3.3.3 → stone-3.3.6}/stone/frontend/parser.py +0 -0
  46. {stone-3.3.3 → stone-3.3.6}/stone/ir/__init__.py +0 -0
  47. {stone-3.3.3 → stone-3.3.6}/stone/ir/api.py +0 -0
  48. {stone-3.3.3 → stone-3.3.6}/stone/ir/data_types.py +0 -0
  49. {stone-3.3.3 → stone-3.3.6}/stone/py.typed +0 -0
  50. {stone-3.3.3 → stone-3.3.6}/stone/typing_hacks.py +0 -0
  51. {stone-3.3.3 → stone-3.3.6}/stone.egg-info/SOURCES.txt +0 -0
  52. {stone-3.3.3 → stone-3.3.6}/stone.egg-info/dependency_links.txt +0 -0
  53. {stone-3.3.3 → stone-3.3.6}/stone.egg-info/entry_points.txt +0 -0
  54. {stone-3.3.3 → stone-3.3.6}/stone.egg-info/not-zip-safe +0 -0
  55. {stone-3.3.3 → stone-3.3.6}/stone.egg-info/requires.txt +0 -0
  56. {stone-3.3.3 → stone-3.3.6}/stone.egg-info/top_level.txt +0 -0
  57. {stone-3.3.3 → stone-3.3.6}/test/requirements.txt +0 -0
  58. {stone-3.3.3 → stone-3.3.6}/test/test_backend.py +0 -0
  59. {stone-3.3.3 → stone-3.3.6}/test/test_cli.py +0 -0
  60. {stone-3.3.3 → stone-3.3.6}/test/test_js_client.py +0 -0
  61. {stone-3.3.3 → stone-3.3.6}/test/test_python_client.py +0 -0
  62. {stone-3.3.3 → stone-3.3.6}/test/test_python_gen.py +0 -0
  63. {stone-3.3.3 → stone-3.3.6}/test/test_python_type_stubs.py +0 -0
  64. {stone-3.3.3 → stone-3.3.6}/test/test_python_types.py +0 -0
  65. {stone-3.3.3 → stone-3.3.6}/test/test_stone.py +0 -0
  66. {stone-3.3.3 → stone-3.3.6}/test/test_stone_internal.py +0 -0
  67. {stone-3.3.3 → stone-3.3.6}/test/test_stone_route_whitelist.py +0 -0
  68. {stone-3.3.3 → stone-3.3.6}/test/test_tsd_client.py +0 -0
  69. {stone-3.3.3 → stone-3.3.6}/test/test_tsd_types.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: stone
3
- Version: 3.3.3
3
+ Version: 3.3.6
4
4
  Summary: Stone is an interface description language (IDL) for APIs.
5
5
  Home-page: https://github.com/dropbox/stone
6
6
  Author: Ken Elkabany
@@ -36,7 +36,7 @@ with open('README.rst') as f: # pylint: disable=W1514
36
36
 
37
37
  dist = setup(
38
38
  name='stone',
39
- version='3.3.3',
39
+ version='3.3.6',
40
40
  install_requires=install_reqs,
41
41
  setup_requires=setup_requires,
42
42
  tests_require=test_reqs,
@@ -91,6 +91,17 @@ def generic_type_name(v):
91
91
  return type_name_with_module(type(v))
92
92
 
93
93
 
94
+ def get_value_string(v, max_length=1000):
95
+ # type: (typing.Any, int) -> str
96
+ """Return a truncated version of the input string. If the input string is longer than
97
+ 1000 characters, this will return the first 1000 characters and append with '[The
98
+ string has been truncated due to its length]' to indicate that it has been truncated."""
99
+ v_str = str(v)
100
+ if len(v_str) > max_length:
101
+ return v_str[:max_length] + ' [The string has been truncated due to its length]'
102
+ return v_str
103
+
104
+
94
105
  class Validator(metaclass=ABCMeta):
95
106
  """All primitive and composite data types should be a subclass of this."""
96
107
  __slots__ = ("_redact",)
@@ -322,7 +333,7 @@ class String(Primitive):
322
333
  """
323
334
  if not isinstance(val, str):
324
335
  raise ValidationError("'%s' expected to be a string, got %s"
325
- % (val, generic_type_name(val)))
336
+ % (get_value_string(val), generic_type_name(val)))
326
337
  if not six.PY3 and isinstance(val, str):
327
338
  try:
328
339
  val = val.decode('utf-8')
@@ -331,14 +342,18 @@ class String(Primitive):
331
342
 
332
343
  if self.max_length is not None and len(val) > self.max_length:
333
344
  raise ValidationError("'%s' must be at most %d characters, got %d"
334
- % (val, self.max_length, len(val)))
345
+ % (get_value_string(val), self.max_length, len(val)))
335
346
  if self.min_length is not None and len(val) < self.min_length:
336
347
  raise ValidationError("'%s' must be at least %d characters, got %d"
337
- % (val, self.min_length, len(val)))
348
+ % (get_value_string(val), self.min_length, len(val)))
338
349
 
339
350
  if self.pattern and not self.pattern_re.match(val):
351
+ # Detect if pattern is matching an email address and return redacted error message.
352
+ if self.pattern == "^['#&A-Za-z0-9._%+-]+@[A-Za-z0-9-][A-Za-z0-9.-]*\\.[A-Za-z]{2,15}$":
353
+ val = "*****"
354
+
340
355
  raise ValidationError("'%s' did not match pattern '%s'"
341
- % (val, self.pattern))
356
+ % (get_value_string(val), self.pattern))
342
357
  return val
343
358
 
344
359
 
@@ -366,10 +381,10 @@ class Bytes(Primitive):
366
381
  % generic_type_name(val))
367
382
  elif self.max_length is not None and len(val) > self.max_length:
368
383
  raise ValidationError("'%s' must have at most %d bytes, got %d"
369
- % (val, self.max_length, len(val)))
384
+ % (get_value_string(val), self.max_length, len(val)))
370
385
  elif self.min_length is not None and len(val) < self.min_length:
371
386
  raise ValidationError("'%s' has fewer than %d bytes, got %d"
372
- % (val, self.min_length, len(val)))
387
+ % (get_value_string(val), self.min_length, len(val)))
373
388
  return val
374
389
 
375
390
 
@@ -425,13 +440,13 @@ class List(Composite):
425
440
 
426
441
  def validate(self, val):
427
442
  if not isinstance(val, (tuple, list)):
428
- raise ValidationError('%r is not a valid list' % val)
443
+ raise ValidationError('%r is not a valid list' % get_value_string(val))
429
444
  elif self.max_items is not None and len(val) > self.max_items:
430
445
  raise ValidationError('%r has more than %s items'
431
- % (val, self.max_items))
446
+ % (get_value_string(val), self.max_items))
432
447
  elif self.min_items is not None and len(val) < self.min_items:
433
448
  raise ValidationError('%r has fewer than %s items'
434
- % (val, self.min_items))
449
+ % (get_value_string(val), self.min_items))
435
450
  return [self.item_validator.validate(item) for item in val]
436
451
 
437
452
 
@@ -449,7 +464,7 @@ class Map(Composite):
449
464
 
450
465
  def validate(self, val):
451
466
  if not isinstance(val, dict):
452
- raise ValidationError('%r is not a valid dict' % val)
467
+ raise ValidationError('%r is not a valid dict' % get_value_string(val))
453
468
  return {
454
469
  self.key_validator.validate(key):
455
470
  self.value_validator.validate(value) for key, value in val.items()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: stone
3
- Version: 3.3.3
3
+ Version: 3.3.6
4
4
  Summary: Stone is an interface description language (IDL) for APIs.
5
5
  Home-page: https://github.com/dropbox/stone
6
6
  Author: Ken Elkabany
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes