Skip to content

Instantly share code, notes, and snippets.

@tdsmith
Created March 3, 2024 17:29
Show Gist options
  • Save tdsmith/301461ba3b95c64bdea51bf9d7eea0c6 to your computer and use it in GitHub Desktop.
Save tdsmith/301461ba3b95c64bdea51bf9d7eea0c6 to your computer and use it in GitHub Desktop.
from typing import Annotated
import svcs
with svcs.Registry() as reg:
reg.register_value(Annotated[int, "my_int"], 42)
reg.register_value(float, 3.14)
/Users/tim/tmp/demo.py
/Users/tim/tmp/demo.py:6:24 - error: Argument of type "type[int]" cannot be assigned to parameter "svc_type" of type "type" in function "register_value" (reportArgumentType)
1 error, 0 warnings, 0 informations
#
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile
#
attrs==23.2.0
# via svcs
nodeenv==1.8.0
# via pyright
pyright==1.1.352
# via -r requirements.in
svcs==24.1.0
# via -r requirements.in
# The following packages are considered to be unsafe in a requirements file:
# setuptools
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment