
Product
Announcing Precomputed Reachability Analysis in Socket
Socket’s precomputed reachability slashes false positives by flagging up to 80% of vulnerabilities as irrelevant, with no setup and instant results.
type-checker-decorators
Advanced tools
from type_checker.decorators import enforce_strict_types
from dataclasses import dataclass
from type_checker.decorators import enforce_strict_types
@enforce_strict_types
@dataclass
class Person:
name: str
age: int
def test_greet_person_with_wrong_types():
try:
Person(123, "twenty")
except TypeError as e:
assert (
str(e)
== "Problem on function Person, Expected type '<class 'str'>' for argument 'name' but received type '<class 'int'>' instead"
)
try:
Person("Alice", "twenty")
except TypeError as e:
assert (
str(e)
== "Problem on function Person, Expected type '<class 'int'>' for argument 'age' but received type '<class 'str'>' instead"
)
from type_checker.decorators import enforce_strict_types
@enforce_strict_types
def greet(name: str, age: int):
print(f"Hello, {name}! You are {age} years old.")
def test_greet_with_wrong_types():
try:
greet(123, "twenty")
except TypeError as e:
print(str(e))
assert (
str(e)
== "Problem on function greet, Expected type '<class 'str'>' for argument 'name' but received type '<class 'int'>' instead"
)
try:
greet("Alice", "twenty")
except TypeError as e:
assert (
str(e)
== "Problem on function greet, Expected type '<class 'int'>' for argument 'age' but received type '<class 'str'>' instead"
)
FAQs
Unknown package
We found that type-checker-decorators demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket’s precomputed reachability slashes false positives by flagging up to 80% of vulnerabilities as irrelevant, with no setup and instant results.
Product
Socket is launching experimental protection for Chrome extensions, scanning for malware and risky permissions to prevent silent supply chain attacks.
Product
Add secure dependency scanning to Claude Desktop with Socket MCP, a one-click extension that keeps your coding conversations safe from malicious packages.