c2cwsgiutils 6.2.0.dev78__py3-none-any.whl → 6.2.0.dev80__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.
- c2cwsgiutils/auth.py +2 -2
- c2cwsgiutils/config_utils.py +1 -1
- c2cwsgiutils/db.py +2 -2
- c2cwsgiutils/db_maintenance_view.py +1 -1
- c2cwsgiutils/debug/_listeners.py +1 -1
- c2cwsgiutils/debug/_views.py +1 -1
- c2cwsgiutils/health_check.py +1 -1
- c2cwsgiutils/index.py +1 -1
- c2cwsgiutils/loader.py +1 -1
- c2cwsgiutils/prometheus.py +11 -4
- c2cwsgiutils/scripts/genversion.py +1 -1
- c2cwsgiutils/scripts/stats_db.py +2 -2
- c2cwsgiutils/setup_process.py +1 -1
- c2cwsgiutils/version.py +1 -1
- {c2cwsgiutils-6.2.0.dev78.dist-info → c2cwsgiutils-6.2.0.dev80.dist-info}/METADATA +1 -1
- {c2cwsgiutils-6.2.0.dev78.dist-info → c2cwsgiutils-6.2.0.dev80.dist-info}/RECORD +19 -19
- {c2cwsgiutils-6.2.0.dev78.dist-info → c2cwsgiutils-6.2.0.dev80.dist-info}/LICENSE +0 -0
- {c2cwsgiutils-6.2.0.dev78.dist-info → c2cwsgiutils-6.2.0.dev80.dist-info}/WHEEL +0 -0
- {c2cwsgiutils-6.2.0.dev78.dist-info → c2cwsgiutils-6.2.0.dev80.dist-info}/entry_points.txt +0 -0
c2cwsgiutils/auth.py
CHANGED
@@ -59,7 +59,7 @@ class AuthConfig(TypedDict, total=False):
|
|
59
59
|
def get_expected_secret(request: pyramid.request.Request) -> str:
|
60
60
|
"""Return the secret expected from the client."""
|
61
61
|
settings = request.registry.settings
|
62
|
-
return cast(str, env_or_settings(settings, SECRET_ENV, SECRET_PROP, default=False))
|
62
|
+
return cast("str", env_or_settings(settings, SECRET_ENV, SECRET_PROP, default=False))
|
63
63
|
|
64
64
|
|
65
65
|
def _hash_secret(secret: str) -> str:
|
@@ -117,7 +117,7 @@ def _is_auth_user_github(request: pyramid.request.Request) -> tuple[bool, UserDe
|
|
117
117
|
if cookie:
|
118
118
|
try:
|
119
119
|
return True, cast(
|
120
|
-
UserDetails,
|
120
|
+
"UserDetails",
|
121
121
|
jwt.decode(
|
122
122
|
cookie,
|
123
123
|
env_or_settings(
|
c2cwsgiutils/config_utils.py
CHANGED
@@ -9,7 +9,7 @@ import pyramid.config
|
|
9
9
|
|
10
10
|
def get_base_path(config: pyramid.config.Configurator) -> str:
|
11
11
|
"""Get the base path of all the views."""
|
12
|
-
return cast(str, env_or_config(config, "C2C_BASE_PATH", "c2c.base_path", "/c2c"))
|
12
|
+
return cast("str", env_or_config(config, "C2C_BASE_PATH", "c2c.base_path", "/c2c"))
|
13
13
|
|
14
14
|
|
15
15
|
def env_or_config(
|
c2cwsgiutils/db.py
CHANGED
@@ -236,8 +236,8 @@ class SessionFactory(_sessionmaker):
|
|
236
236
|
def engine_name(self, readwrite: bool) -> str:
|
237
237
|
"""Get the engine name."""
|
238
238
|
if readwrite:
|
239
|
-
return cast(str, self.rw_engine.c2c_name) # type: ignore[attr-defined]
|
240
|
-
return cast(str, self.ro_engine.c2c_name) # type: ignore[attr-defined]
|
239
|
+
return cast("str", self.rw_engine.c2c_name) # type: ignore[attr-defined]
|
240
|
+
return cast("str", self.ro_engine.c2c_name) # type: ignore[attr-defined]
|
241
241
|
|
242
242
|
def __call__( # type: ignore[override]
|
243
243
|
self,
|
@@ -34,7 +34,7 @@ def includeme(config: pyramid.config.Configurator) -> None:
|
|
34
34
|
|
35
35
|
def _db_maintenance(request: pyramid.request.Request) -> Mapping[str, Any]:
|
36
36
|
auth.auth_view(request)
|
37
|
-
readonly_param = cast(str, request.params.get("readonly"))
|
37
|
+
readonly_param = cast("str", request.params.get("readonly"))
|
38
38
|
if readonly_param is not None:
|
39
39
|
readonly = readonly_param.lower() == "true"
|
40
40
|
|
c2cwsgiutils/debug/_listeners.py
CHANGED
@@ -92,7 +92,7 @@ def _dump_memory_impl(
|
|
92
92
|
cache = linecache.cache
|
93
93
|
result[analyze_type]["biggest_objects"] = sorted(
|
94
94
|
({"filename": k, "size_kb": get_size(v)} for k, v in cache.items()),
|
95
|
-
key=lambda i: -(cast(int, i["size_kb"])),
|
95
|
+
key=lambda i: -(cast("int", i["size_kb"])),
|
96
96
|
)
|
97
97
|
else:
|
98
98
|
biggest_objects.reverse()
|
c2cwsgiutils/debug/_views.py
CHANGED
@@ -185,7 +185,7 @@ def _add_view(
|
|
185
185
|
|
186
186
|
def _dump_memory_maps(request: pyramid.request.Request) -> list[dict[str, Any]]:
|
187
187
|
auth.auth_view(request)
|
188
|
-
return sorted(dump_memory_maps(), key=lambda i: cast(int, -i.get("pss_kb", 0)))
|
188
|
+
return sorted(dump_memory_maps(), key=lambda i: cast("int", -i.get("pss_kb", 0)))
|
189
189
|
|
190
190
|
|
191
191
|
def _show_refs(request: pyramid.request.Request) -> pyramid.response.Response:
|
c2cwsgiutils/health_check.py
CHANGED
@@ -117,7 +117,7 @@ class _OldBinding(_Binding):
|
|
117
117
|
self.prev_bind = None
|
118
118
|
|
119
119
|
def name(self) -> str:
|
120
|
-
return cast(str, self.engine.c2c_name) # type: ignore[attr-defined]
|
120
|
+
return cast("str", self.engine.c2c_name) # type: ignore[attr-defined]
|
121
121
|
|
122
122
|
def __enter__(self) -> _scoped_session:
|
123
123
|
self.prev_bind = self.session.bind # type: ignore[assignment]
|
c2cwsgiutils/index.py
CHANGED
@@ -459,7 +459,7 @@ def _github_login_callback(request: pyramid.request.Request) -> dict[str, Any]:
|
|
459
459
|
"c2c-auth-jwt",
|
460
460
|
),
|
461
461
|
jwt.encode(
|
462
|
-
cast(dict[str, Any], user_information),
|
462
|
+
cast("dict[str, Any]", user_information),
|
463
463
|
env_or_settings(
|
464
464
|
settings,
|
465
465
|
GITHUB_AUTH_SECRET_ENV,
|
c2cwsgiutils/loader.py
CHANGED
@@ -14,7 +14,7 @@ class Loader(BaseLoader): # type: ignore[misc]
|
|
14
14
|
def _get_defaults(self, defaults: dict[str, str] | None = None) -> dict[str, str]:
|
15
15
|
d = get_config_defaults()
|
16
16
|
d.update(defaults or {})
|
17
|
-
return cast(dict[str, str], super()._get_defaults(d))
|
17
|
+
return cast("dict[str, str]", super()._get_defaults(d))
|
18
18
|
|
19
19
|
def __repr__(self) -> str:
|
20
20
|
"""Get the object representation."""
|
c2cwsgiutils/prometheus.py
CHANGED
@@ -3,8 +3,9 @@
|
|
3
3
|
import os
|
4
4
|
import re
|
5
5
|
import resource
|
6
|
-
from collections.abc import Generator
|
7
|
-
from
|
6
|
+
from collections.abc import Generator
|
7
|
+
from pathlib import Path
|
8
|
+
from typing import TYPE_CHECKING, Any, TypedDict, cast
|
8
9
|
|
9
10
|
import prometheus_client
|
10
11
|
import prometheus_client.core
|
@@ -16,6 +17,10 @@ import pyramid.config
|
|
16
17
|
from c2cwsgiutils import broadcast, redis_utils
|
17
18
|
from c2cwsgiutils.debug.utils import dump_memory_maps
|
18
19
|
|
20
|
+
if TYPE_CHECKING:
|
21
|
+
from collections.abc import Iterable
|
22
|
+
|
23
|
+
|
19
24
|
PSUTILS = True
|
20
25
|
try:
|
21
26
|
import psutil
|
@@ -136,7 +141,7 @@ class MultiProcessCustomCollector(prometheus_client.registry.Collector):
|
|
136
141
|
for channel in MULTI_PROCESS_COLLECTOR_BROADCAST_CHANNELS:
|
137
142
|
result = broadcast.broadcast(channel, expect_answers=True)
|
138
143
|
if result is not None:
|
139
|
-
results.extend(cast(Iterable[list[SerializedMetric]], result))
|
144
|
+
results.extend(cast("Iterable[list[SerializedMetric]]", result))
|
140
145
|
return _deserialize_collected_data(results)
|
141
146
|
|
142
147
|
|
@@ -192,7 +197,9 @@ class MemoryMapCollector(prometheus_client.registry.Collector):
|
|
192
197
|
)
|
193
198
|
|
194
199
|
for pid in (
|
195
|
-
[p for p in
|
200
|
+
[p.name for p in Path("/proc/").iterdir() if _NUMBER_RE.match(p.name)]
|
201
|
+
if self.pids is None
|
202
|
+
else self.pids
|
196
203
|
):
|
197
204
|
for e in dump_memory_maps(pid):
|
198
205
|
gauge.add_metric([pid, e["name"]], e[self.memory_type + "_kb"] * 1024)
|
@@ -23,7 +23,7 @@ def _get_package_version(comp: str) -> tuple[str | None, str | None]:
|
|
23
23
|
src_matcher = _SRC_VERSION_RE.match(comp)
|
24
24
|
matcher = src_matcher or _VERSION_RE.match(comp)
|
25
25
|
if matcher:
|
26
|
-
return cast(tuple[str, str], matcher.groups())
|
26
|
+
return cast("tuple[str, str]", matcher.groups())
|
27
27
|
if len(comp) > 0 and comp[:3] != "-e ":
|
28
28
|
print("Cannot parse package version: " + comp)
|
29
29
|
return None, None
|
c2cwsgiutils/scripts/stats_db.py
CHANGED
@@ -307,14 +307,14 @@ def main() -> None:
|
|
307
307
|
success = False
|
308
308
|
args = _parse_args()
|
309
309
|
c2cwsgiutils.setup_process.init(args.config_uri)
|
310
|
-
for _ in range(int(os.environ.get("C2CWSGIUTILS_STATS_DB_TRYNUMBER", 10))):
|
310
|
+
for _ in range(int(os.environ.get("C2CWSGIUTILS_STATS_DB_TRYNUMBER", "10"))):
|
311
311
|
try:
|
312
312
|
_do_dtats_db(args)
|
313
313
|
success = True
|
314
314
|
break
|
315
315
|
except: # pylint: disable=bare-except
|
316
316
|
_LOG.exception("Exception during run")
|
317
|
-
time.sleep(float(os.environ.get("C2CWSGIUTILS_STATS_DB_SLEEP", 1)))
|
317
|
+
time.sleep(float(os.environ.get("C2CWSGIUTILS_STATS_DB_SLEEP", "1")))
|
318
318
|
|
319
319
|
if not success:
|
320
320
|
_LOG.error("Not in success, exiting")
|
c2cwsgiutils/setup_process.py
CHANGED
@@ -102,4 +102,4 @@ def bootstrap_application(
|
|
102
102
|
loader = get_config_loader(config_uri)
|
103
103
|
loader.setup_logging(options)
|
104
104
|
logging.getLogger(__name__).info("Loading the application from %s", config_uri)
|
105
|
-
return cast(PyramidEnv, bootstrap(config_uri, options=options))
|
105
|
+
return cast("PyramidEnv", bootstrap(config_uri, options=options))
|
c2cwsgiutils/version.py
CHANGED
@@ -88,7 +88,7 @@ def _read_versions() -> dict[str, dict[str, str]]:
|
|
88
88
|
"""Read the version."""
|
89
89
|
with _VERSIONS_PATH.open(encoding="utf-8") as file:
|
90
90
|
versions = json.load(file)
|
91
|
-
return cast(dict[str, dict[str, str]], versions)
|
91
|
+
return cast("dict[str, dict[str, str]]", versions)
|
92
92
|
|
93
93
|
|
94
94
|
def get_version() -> str | None:
|
@@ -7,30 +7,30 @@ c2cwsgiutils/acceptance/package.json,sha256=ClHsOOzzwKrN7PL-7bcfIGiojA3MNBrk6fP_
|
|
7
7
|
c2cwsgiutils/acceptance/print.py,sha256=i6UxfSuZ8z9grC_P2qn0yU6RXLbNCcopPMOgjc8D1rI,2555
|
8
8
|
c2cwsgiutils/acceptance/screenshot.js,sha256=FAJYIWOLJFMm0MNggKzo3mIybtN-VtKLdMzPhQ9pO1g,2041
|
9
9
|
c2cwsgiutils/acceptance/utils.py,sha256=zTu-CRL4ZwFrluiM6rPvcGsXsC2Aq_r4L7oVyucQkbY,1920
|
10
|
-
c2cwsgiutils/auth.py,sha256=
|
10
|
+
c2cwsgiutils/auth.py,sha256=m_jYHhsT80Qo0eTKZiJ7HDdK2Wl30sL2GMfJ2InW0Pk,9757
|
11
11
|
c2cwsgiutils/broadcast/__init__.py,sha256=ZXegEEeBNlVD1k2lBn3EVlBvvRM-My5v34_wJ_ijU6s,4501
|
12
12
|
c2cwsgiutils/broadcast/interface.py,sha256=FUK6ZTcqleM3oI3bq_dRPWnbH8Q54fdJzL3Y1QKyE5E,685
|
13
13
|
c2cwsgiutils/broadcast/local.py,sha256=I0dT3Y6nRJ4JanEbXQLuKG7aENtmizJR0Y6lRJ7f1mY,1369
|
14
14
|
c2cwsgiutils/broadcast/redis.py,sha256=K3sKNCJE0j4N40JOGMh9lhJbAnrAlv14k4ceMiBt8Zk,5447
|
15
15
|
c2cwsgiutils/broadcast/utils.py,sha256=0fQZXPu3p_5LEJpGenJwiiMxECQjJhjZBjIkBk8h-ng,272
|
16
16
|
c2cwsgiutils/client_info.py,sha256=pik4rMw_GFIEjNVDO0b4aspO_eTLS3ts7dwGXmywdNE,4039
|
17
|
-
c2cwsgiutils/config_utils.py,sha256=
|
17
|
+
c2cwsgiutils/config_utils.py,sha256=vtMrVFU_fI41rbNrgjD7Msr4d8CXfPU2PRtjExX30E8,1528
|
18
18
|
c2cwsgiutils/coverage_setup.py,sha256=4xz9nRoYxC-8cCkMNhE06DGk0pr1azNSQK36u6wgBSM,935
|
19
|
-
c2cwsgiutils/db.py,sha256=
|
20
|
-
c2cwsgiutils/db_maintenance_view.py,sha256=
|
19
|
+
c2cwsgiutils/db.py,sha256=EiqoYkVAqXh0i2Tk7qFWmo_ZHBi_KtjaScwT8GTt-RE,16572
|
20
|
+
c2cwsgiutils/db_maintenance_view.py,sha256=LvJ-sdbNg8cjiIkfuw8xUBmfRE3iSE3JAXS_BtnNBLg,3075
|
21
21
|
c2cwsgiutils/debug/__init__.py,sha256=-MM2PJ1Dhpi7T1CvDO8JpTuO9cnRNv4DFVoCxkCZuLo,1333
|
22
|
-
c2cwsgiutils/debug/_listeners.py,sha256=
|
23
|
-
c2cwsgiutils/debug/_views.py,sha256=
|
22
|
+
c2cwsgiutils/debug/_listeners.py,sha256=XTtA7ix9FnTCXltGd_wAmq8huYnTaECSk0_RrELJvbE,4273
|
23
|
+
c2cwsgiutils/debug/_views.py,sha256=5FZtRiDPE7-fR91AGd0v6SLuzelpHfzTBZemtCVoYNo,8663
|
24
24
|
c2cwsgiutils/debug/utils.py,sha256=GpQQ0LgDCJ57IZmJwjIi2GkFAnHPLHeNtDT-zmMbLTY,2338
|
25
25
|
c2cwsgiutils/errors.py,sha256=EXb4AODAqn1T3AOaQ-39XlAHfNxjSkgFUJJhciDjrSQ,6748
|
26
|
-
c2cwsgiutils/health_check.py,sha256=
|
27
|
-
c2cwsgiutils/index.py,sha256=
|
28
|
-
c2cwsgiutils/loader.py,sha256=
|
26
|
+
c2cwsgiutils/health_check.py,sha256=KKt2ApRPzUyll9y2tSWC9ot_hK50Vr1ZQyVkvgeR5Ng,20867
|
27
|
+
c2cwsgiutils/index.py,sha256=kqdX2Ktj5GCg7s8XVjDKCMtQcjZNofZttF4bpoavdhw,17981
|
28
|
+
c2cwsgiutils/loader.py,sha256=dLI1B_k1qWSle-M-7GQyVeJqWee6G3lLunGO0sPlqT4,1423
|
29
29
|
c2cwsgiutils/logging_view.py,sha256=TfPNgiLLm86UnTJF1i6J1u8Nnyh8HaUK6pZAZfGJRjY,3491
|
30
30
|
c2cwsgiutils/models_graph.py,sha256=Ca09i6SfLJ1i4tHewth3XnY9hccFnkUSlkBi-XoVCSY,2709
|
31
31
|
c2cwsgiutils/pretty_json.py,sha256=-BxW_772VK-DuJNWo1hN9VYmTECRrKE_bMD2VysIwCE,1721
|
32
32
|
c2cwsgiutils/profiler.py,sha256=NiEMhkpBbvFXZtfk_znC9Msa5CR7Dq4sIMEn4e1W8Lk,758
|
33
|
-
c2cwsgiutils/prometheus.py,sha256=
|
33
|
+
c2cwsgiutils/prometheus.py,sha256=PO-_ppkNumZWdHpgRaJnFDnQaYN5mlxf9_Ky2JGbgvo,8832
|
34
34
|
c2cwsgiutils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
35
35
|
c2cwsgiutils/pyramid.py,sha256=t0INCb-kpLdswWALIhSLXNMWT0kTIvjlQRfUbyp8HZ8,1396
|
36
36
|
c2cwsgiutils/pyramid_logging.py,sha256=ZuzDwTWMCIAt9mWDdZla-6N6p9cnCkzUaGrt2vtN3d0,3973
|
@@ -39,12 +39,12 @@ c2cwsgiutils/redis_utils.py,sha256=8lxqVZTMzHMoo-QOxqWLcNdVE7HF8N8JZEH_nocv2NY,4
|
|
39
39
|
c2cwsgiutils/request_tracking/__init__.py,sha256=ONYs7oH5YK90_-0liz6fwP3wQgzC3yHdcBPZf0v_tzA,4194
|
40
40
|
c2cwsgiutils/request_tracking/_sql.py,sha256=Z3xVF1Le_2_O2y5K4B2qQy9iqJo4N0uRmYQ6VND5sHw,585
|
41
41
|
c2cwsgiutils/scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
42
|
-
c2cwsgiutils/scripts/genversion.py,sha256=
|
43
|
-
c2cwsgiutils/scripts/stats_db.py,sha256=
|
42
|
+
c2cwsgiutils/scripts/genversion.py,sha256=rxaoxgH4ZpaLNgGzStLKb0dGkha-ZCLWfzaicu-_m98,2043
|
43
|
+
c2cwsgiutils/scripts/stats_db.py,sha256=FY6c8ZaJH6s2Tq923tWISBAYN751ojm8O4KiakHIGx8,10615
|
44
44
|
c2cwsgiutils/scripts/test_print.py,sha256=-ofACKJfMF7GJv5eBwCFQKePodpZWxFTbn05AHMm8qQ,2139
|
45
45
|
c2cwsgiutils/sentry.py,sha256=eKY3n7Fu-Mtoe_iqKFIlE4cDbCw3nZ2hMZ5gqmOh5ZE,6913
|
46
46
|
c2cwsgiutils/services.py,sha256=AxdiH2S8gfEQpOY36R4WqKtJ-3P4OXhx0srTm5G5070,1569
|
47
|
-
c2cwsgiutils/setup_process.py,sha256=
|
47
|
+
c2cwsgiutils/setup_process.py,sha256=Ew0zsEGN7MyYmaVnYILJI6ciCEf1gXdBN0ymT5wSEnM,3587
|
48
48
|
c2cwsgiutils/sql_profiler/__init__.py,sha256=YR8003lCNNGC2eZdyIt5gt76-1frG5szw8IYE_EsQB4,921
|
49
49
|
c2cwsgiutils/sql_profiler/_impl.py,sha256=pVaoxQMwfUWLMXRAT7NplgMkGL8KnWjRAwLKh7_5mwg,3816
|
50
50
|
c2cwsgiutils/sqlalchemylogger/README.md,sha256=qXfyhGC4Kbt-Ye_geTPm_1InpclhthmKZpc66rqB4as,2018
|
@@ -60,9 +60,9 @@ c2cwsgiutils/stats_pyramid/__init__.py,sha256=0NizIUbaPbNf6bPye7pGrF9AaFerIN30Eh
|
|
60
60
|
c2cwsgiutils/stats_pyramid/_db_spy.py,sha256=_E5_KFipmsOdqD849mde4EDIlXS7ae0oClZb7GmZRLo,2992
|
61
61
|
c2cwsgiutils/stats_pyramid/_pyramid_spy.py,sha256=KFxxKdEKrmDeA1zpps-BPiB2c4hhR2GlgJvq6KOTyjU,3498
|
62
62
|
c2cwsgiutils/templates/index.html.mako,sha256=cK8qGBDeQG5SiJJCfvL0oKpgacr7dPKx634AAQivmjA,1416
|
63
|
-
c2cwsgiutils/version.py,sha256=
|
64
|
-
c2cwsgiutils-6.2.0.
|
65
|
-
c2cwsgiutils-6.2.0.
|
66
|
-
c2cwsgiutils-6.2.0.
|
67
|
-
c2cwsgiutils-6.2.0.
|
68
|
-
c2cwsgiutils-6.2.0.
|
63
|
+
c2cwsgiutils/version.py,sha256=b8rwN7vATtBWvVKyvxW_-ixbmMJGQBZhW3gNvGdAyVg,3156
|
64
|
+
c2cwsgiutils-6.2.0.dev80.dist-info/LICENSE,sha256=6bEOU0n7ued3SA-DQCsHQaACONMMRzGHmH5XhDVeD-U,1304
|
65
|
+
c2cwsgiutils-6.2.0.dev80.dist-info/METADATA,sha256=6GDSLVFc976vGRl8kg8DB-wN268H1vFg7tC6PTDdt-8,36598
|
66
|
+
c2cwsgiutils-6.2.0.dev80.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
67
|
+
c2cwsgiutils-6.2.0.dev80.dist-info/entry_points.txt,sha256=ujgqMTL1awN9qDg8WXmrF7m0fgR-hslUM6zKH86pvy0,703
|
68
|
+
c2cwsgiutils-6.2.0.dev80.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|