Skip to content

Commit 0f56f5f

Browse files
committed
Uses latest runtype
1 parent 5b70f5e commit 0f56f5f

File tree

4 files changed

+7
-11
lines changed

4 files changed

+7
-11
lines changed

preql/core/pql_ast.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from typing import List, Any, Optional, Dict, Union
22
from dataclasses import field
33

4-
from preql.utils import dataclass, TextReference, field_list
4+
from preql.utils import dataclass, TextReference
55

66
from . import pql_types as types
77
from .pql_types import T, Object, Id
@@ -153,7 +153,7 @@ class Projection(TableOperation):
153153
table: Object
154154
fields: List[NamedField]
155155
groupby: bool = False
156-
agg_fields: List[NamedField] = field_list()
156+
agg_fields: List[NamedField] = []
157157

158158
def __post_init__(self):
159159
if self.groupby:

preql/core/sql.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from typing import List, Optional, Dict
22

3-
from preql.utils import dataclass, X, listgen, field_list, safezip
3+
from preql.utils import dataclass, X, listgen, safezip
44

55
from . import pql_types
66
from .pql_types import T, Type, dp_type, Id
@@ -675,9 +675,9 @@ class Select(TableOperation):
675675
type: Type
676676
table: Sql # XXX Table won't work with RawSQL
677677
fields: List[Sql]
678-
conds: List[Sql] = field_list()
679-
group_by: List[Sql] = field_list()
680-
order: List[Sql] = field_list()
678+
conds: List[Sql] = []
679+
group_by: List[Sql] = []
680+
order: List[Sql] = []
681681

682682
# MySQL doesn't support arithmetic in offset/limit, and we don't need it anyway
683683
offset: Optional[int] = None

preql/utils.py

-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from typing import Optional
88
from functools import wraps
99
from operator import getitem
10-
import dataclasses
1110

1211
import runtype
1312
from rich.text import Text
@@ -18,9 +17,6 @@
1817
dataclass = runtype.dataclass(check_types=settings.typecheck)
1918
dsp = runtype.Dispatch()
2019

21-
def field_list():
22-
return dataclasses.field(default_factory=list)
23-
2420
class SafeDict(dict):
2521
def __setitem__(self, key, value):
2622
if key in self:

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ packages = [{ include = "preql" }]
2828
[tool.poetry.dependencies]
2929
python = "^3.6"
3030
lark-parser = "^0.11.3"
31-
runtype = "^0.1.12"
31+
runtype = "^0.1.16"
3232
dsnparse = "*"
3333
prompt-toolkit = "*"
3434
pygments = "*"

0 commit comments

Comments
 (0)