c2cwsgiutils 6.1.7.dev4__py3-none-any.whl → 6.2.0.dev54__py3-none-any.whl

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 (48) hide show
  1. c2cwsgiutils/acceptance/__init__.py +1 -0
  2. c2cwsgiutils/acceptance/connection.py +3 -2
  3. c2cwsgiutils/acceptance/image.py +5 -3
  4. c2cwsgiutils/acceptance/package-lock.json +110 -248
  5. c2cwsgiutils/acceptance/package.json +2 -2
  6. c2cwsgiutils/acceptance/print.py +1 -0
  7. c2cwsgiutils/acceptance/utils.py +2 -1
  8. c2cwsgiutils/auth.py +9 -8
  9. c2cwsgiutils/broadcast/__init__.py +1 -1
  10. c2cwsgiutils/broadcast/local.py +4 -0
  11. c2cwsgiutils/broadcast/redis.py +8 -2
  12. c2cwsgiutils/client_info.py +2 -0
  13. c2cwsgiutils/coverage_setup.py +2 -2
  14. c2cwsgiutils/db.py +11 -2
  15. c2cwsgiutils/db_maintenance_view.py +1 -1
  16. c2cwsgiutils/debug/__init__.py +4 -2
  17. c2cwsgiutils/debug/_views.py +22 -4
  18. c2cwsgiutils/errors.py +7 -2
  19. c2cwsgiutils/health_check.py +39 -29
  20. c2cwsgiutils/index.py +1 -1
  21. c2cwsgiutils/loader.py +1 -1
  22. c2cwsgiutils/logging_view.py +1 -1
  23. c2cwsgiutils/models_graph.py +1 -1
  24. c2cwsgiutils/pretty_json.py +1 -1
  25. c2cwsgiutils/profiler.py +1 -0
  26. c2cwsgiutils/prometheus.py +58 -0
  27. c2cwsgiutils/pyramid.py +1 -0
  28. c2cwsgiutils/pyramid_logging.py +4 -0
  29. c2cwsgiutils/redis_stats.py +1 -1
  30. c2cwsgiutils/redis_utils.py +2 -0
  31. c2cwsgiutils/request_tracking/__init__.py +1 -1
  32. c2cwsgiutils/scripts/genversion.py +4 -2
  33. c2cwsgiutils/scripts/stats_db.py +1 -0
  34. c2cwsgiutils/scripts/test_print.py +4 -1
  35. c2cwsgiutils/sentry.py +1 -1
  36. c2cwsgiutils/setup_process.py +5 -1
  37. c2cwsgiutils/sql_profiler/__init__.py +1 -1
  38. c2cwsgiutils/sql_profiler/_impl.py +1 -1
  39. c2cwsgiutils/sqlalchemylogger/handlers.py +18 -12
  40. c2cwsgiutils/stats_pyramid/__init__.py +2 -1
  41. c2cwsgiutils/stats_pyramid/_pyramid_spy.py +1 -0
  42. c2cwsgiutils/version.py +1 -1
  43. {c2cwsgiutils-6.1.7.dev4.dist-info → c2cwsgiutils-6.2.0.dev54.dist-info}/METADATA +74 -12
  44. c2cwsgiutils-6.2.0.dev54.dist-info/RECORD +67 -0
  45. c2cwsgiutils-6.1.7.dev4.dist-info/RECORD +0 -67
  46. {c2cwsgiutils-6.1.7.dev4.dist-info → c2cwsgiutils-6.2.0.dev54.dist-info}/LICENSE +0 -0
  47. {c2cwsgiutils-6.1.7.dev4.dist-info → c2cwsgiutils-6.2.0.dev54.dist-info}/WHEEL +0 -0
  48. {c2cwsgiutils-6.1.7.dev4.dist-info → c2cwsgiutils-6.2.0.dev54.dist-info}/entry_points.txt +0 -0
@@ -20,6 +20,7 @@ def retry(
20
20
  tries: number of times to try (not retry) before giving up
21
21
  delay: initial delay between retries in seconds
22
22
  backoff: backoff multiplier e.g. value of 2 will double the delay each retry
23
+
23
24
  """
24
25
 
25
26
  def deco_retry(f: typing.Callable[..., typing.Any]) -> typing.Callable[..., typing.Any]:
@@ -20,6 +20,7 @@ class Connection:
20
20
  """The connection."""
21
21
 
22
22
  def __init__(self, base_url: str, origin: str) -> None:
23
+ """Initialize the connection."""
23
24
  self.base_url = base_url
24
25
  if not self.base_url.endswith("/"):
25
26
  self.base_url += "/"
@@ -93,10 +94,10 @@ class Connection:
93
94
  check_response(r, expected_status, cache_expected=cache_expected)
94
95
  self._check_cors(cors, r)
95
96
  r.raw.decode_content = True
96
- doc = etree.parse(r.raw) # nosec
97
+ doc = etree.parse(r.raw) # noqa: S320
97
98
  if schema is not None:
98
99
  with open(schema, encoding="utf-8") as schema_file:
99
- xml_schema = etree.XMLSchema(etree.parse(schema_file)) # nosec
100
+ xml_schema = etree.XMLSchema(etree.parse(schema_file)) # noqa: S320
100
101
  xml_schema.assertValid(doc)
101
102
  return doc
102
103
 
@@ -10,7 +10,7 @@ import skimage.metrics # pylint: disable=import-error
10
10
  import skimage.transform # pylint: disable=import-error
11
11
 
12
12
  if TYPE_CHECKING:
13
- from typing import TypeAlias
13
+ from typing_extensions import TypeAlias
14
14
 
15
15
  NpNdarrayInt: TypeAlias = np.ndarray[np.uint8, Any]
16
16
  else:
@@ -89,6 +89,7 @@ def check_image( # pylint: disable=too-many-locals,too-many-statements
89
89
  level: The minimum similarity level (between 0.0 and 1.0), default to 1.0
90
90
  generate_expected_image: If `True` generate the expected image instead of checking it
91
91
  use_mask: If `False` don't use the mask event if the file exists
92
+
92
93
  """
93
94
  assert image_to_check is not None, "Image required"
94
95
  image_file_basename = os.path.splitext(os.path.basename(expected_filename))[0]
@@ -129,7 +130,7 @@ def check_image( # pylint: disable=too-many-locals,too-many-statements
129
130
  if np.issubdtype(mask.dtype, np.floating):
130
131
  mask = (mask * 255).astype("uint8")
131
132
 
132
- assert ((0 < mask) & (mask < 255)).sum() == 0, "Mask should be only black and white image"
133
+ assert ((mask > 0) & (mask < 255)).sum() == 0, "Mask should be only black and white image"
133
134
 
134
135
  # Convert to boolean
135
136
  mask = mask == 0
@@ -146,7 +147,7 @@ def check_image( # pylint: disable=too-many-locals,too-many-statements
146
147
  return
147
148
  if not os.path.isfile(expected_filename):
148
149
  skimage.io.imsave(expected_filename, image_to_check)
149
- assert False, "Expected image not found: " + expected_filename
150
+ raise AssertionError("Expected image not found: " + expected_filename)
150
151
  expected = skimage.io.imread(expected_filename)
151
152
  assert expected is not None, "Wrong image: " + expected_filename
152
153
  expected = normalize_image(expected)
@@ -208,6 +209,7 @@ def check_screenshot(
208
209
  level: See `check_image`
209
210
  generate_expected_image: See `check_image`
210
211
  use_mask: See `check_image`
212
+
211
213
  """
212
214
  if headers is None:
213
215
  headers = {}