This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Callable, Union | |
class Pipe: | |
def __init__(self, callable_: Callable): | |
self.callable_ = callable_ | |
def __rshift__(self, then: Union[Callable, "Pipe"]) -> "Pipe": | |
if not isinstance(then, Pipe): | |
then = Pipe(then) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import inspect | |
class Value: | |
__slots__ = ('name', 'default') | |
def __init__(self, name, default=None): | |
self.name = name | |
self.default = default |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Iterable, Tuple, Type, Optional, List | |
from django.conf import settings | |
from django.contrib.auth.models import Permission | |
from django.contrib.contenttypes.models import ContentType | |
from django.db.models import Model | |
from keycloak.admin.clientroles import ClientRoles | |
from keycloak.exceptions import KeycloakClientError | |
from keycloak.openid_connect import KeycloakOpenidConnect | |
from keycloak.realm import KeycloakRealm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import re | |
from typing import Tuple | |
def dict_to_openapi(d: dict) -> dict: | |
result = {} | |
for k, v in d.items(): | |
if isinstance(v, dict): | |
result[k] = dict(type="object", properties=dict_to_openapi(v)) |
OlderNewer