• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

alorence / django-modern-rpc / 23174234441

pending completion
23174234441

Pull #144

github

web-flow
Merge 602112322 into 5e13c3507
Pull Request #144: Bump ty from 0.0.22 to 0.0.23

83 of 84 branches covered (98.81%)

1387 of 1410 relevant lines covered (98.37%)

2.95 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

69.57
modernrpc/compat.py
1
import sys
4✔
2
import types
4✔
3
import typing
4✔
4

5
import django
4✔
6
from django.views.decorators.csrf import csrf_exempt
4✔
7

8
if sys.version_info >= (3, 11):
4✔
9
    from typing import Self
3✔
10
else:
11
    from typing_extensions import Self  # noqa: F401
1✔
12

13

14
if django.VERSION >= (5, 0):
4✔
15
    # Django updated its decorators to support wrapping asynchronous method in release 5.0
16
    # REF: https://docs.djangoproject.com/en/5.2/releases/5.0/#decorators
17

18
    async_csrf_exempt = csrf_exempt
4✔
19

20
else:
21
    # Fore Django version < 5.0, we partially redefine decorators to support async view
22

23
    def async_csrf_exempt(view):
×
24
        view.csrf_exempt = True
×
25
        return view
×
26

27

28
if sys.version_info >= (3, 14):
4✔
29

30
    def is_union_type(_type) -> bool:
×
31
        return isinstance(_type, types.UnionType)
×
32

33
else:
34

35
    def is_union_type(_type) -> bool:
4✔
36
        return typing.get_origin(_type) in (types.UnionType, typing.Union)
4✔
37

38

39
if sys.version_info >= (3, 14):
4✔
40

41
    def union_str_repr(obj: typing.Any) -> str:
×
42
        return str(obj)
×
43

44
else:
45

46
    def union_str_repr(obj: typing.Any) -> str:
4✔
47
        return " | ".join(t.__name__ for t in typing.get_args(obj))
4✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc