Skip to content

Commit

Permalink
fix python 3.7 compatibility issues
Browse files Browse the repository at this point in the history
  • Loading branch information
imryche committed Mar 20, 2024
1 parent 07ecb06 commit 501077b
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion blockkit/components.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
import json
from typing import Any, List, Type
from typing import get_origin, get_args, get_type_hints
from typing import get_type_hints

from pydantic import BaseModel, model_validator


try:
from typing import get_origin, get_args
except ImportError:

def get_origin(tp):
return getattr(tp, "__origin__", None)

def get_args(tp):
return getattr(tp, "__args__", ())


class Component(BaseModel):
@model_validator(mode="after")
def expand_strings(self) -> Any:
Expand Down

0 comments on commit 501077b

Please sign in to comment.