File: utils.py

package info (click to toggle)
python-aiohttp-apispec 3.0.0~b2%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 204 kB
  • sloc: python: 439; makefile: 4
file content (17 lines) | stat: -rw-r--r-- 377 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from string import Formatter


def get_path(route):
    path_info = route.resource.get_info()
    return path_info.get("path") or path_info.get("formatter")


def get_path_keys(path):
    return [i[1] for i in Formatter().parse(path) if i[1]]


def issubclass_py37fix(cls, cls_info):
    try:
        return issubclass(cls, cls_info)
    except TypeError:
        return False