|
1 | | -from typing import ( |
2 | | - Optional, |
3 | | - TypeVar, |
4 | | - Union, |
5 | | -) |
| 1 | +from typing import Optional, TypeVar, Union |
6 | 2 |
|
7 | 3 | from typing_extensions import Unpack |
8 | 4 |
|
9 | | -from basilisp.lang.interfaces import ( |
10 | | - ILispObject, |
11 | | - ILookup, |
12 | | -) |
13 | | - |
| 5 | +from basilisp.lang.interfaces import ILispObject, ILookup |
14 | 6 | from basilisp.lang.keyword import keyword |
15 | 7 | from basilisp.lang.obj import PrintSettings, lrepr |
16 | 8 | from basilisp.lang.symbol import Symbol |
|
22 | 14 | _TAG_KW = keyword("tag") |
23 | 15 | _FORM_KW = keyword("form") |
24 | 16 |
|
| 17 | + |
25 | 18 | class TaggedLiteral( |
26 | 19 | ILispObject, |
27 | 20 | ILookup[K, T], |
28 | 21 | ): |
29 | | - """Basilisp TaggedLiteral. https://clojure.org/reference/reader#tagged_literals |
30 | | - """ |
| 22 | + """Basilisp TaggedLiteral. https://clojure.org/reference/reader#tagged_literals""" |
31 | 23 |
|
32 | 24 | __slots__ = ("_tag", "_form", "_hash") |
33 | 25 |
|
34 | | - def __init__( |
35 | | - self, tag: Symbol, form |
36 | | - ) -> None: |
| 26 | + def __init__(self, tag: Symbol, form) -> None: |
37 | 27 | self._tag = tag |
38 | 28 | self._form = form |
39 | | - self._hash : Optional[int] = None |
| 29 | + self._hash: Optional[int] = None |
40 | 30 |
|
41 | 31 | @property |
42 | 32 | def tag(self) -> Symbol: |
@@ -75,9 +65,8 @@ def val_at(self, k: K, default: Optional[V] = None) -> T: |
75 | 65 | def _lrepr(self, **kwargs: Unpack[PrintSettings]) -> str: |
76 | 66 | return f"#{self._tag} {lrepr(self._form, **kwargs)}" |
77 | 67 |
|
78 | | -def tagged_literal( |
79 | | - tag: Symbol, form |
80 | | -): |
| 68 | + |
| 69 | +def tagged_literal(tag: Symbol, form): |
81 | 70 | """Construct a data representation of a tagged literal from a |
82 | 71 | tag symbol and a form.""" |
83 | 72 | if not isinstance(tag, Symbol): |
|
0 commit comments