serenajiang commented on a change in pull request #8138: [typing] add typing 
for superset/connectors and superset/common
URL: 
https://github.com/apache/incubator-superset/pull/8138#discussion_r319210270
 
 

 ##########
 File path: superset/common/query_object.py
 ##########
 @@ -34,12 +35,28 @@ class QueryObject:
     and druid. The query objects are constructed on the client.
     """
 
+    granularity: str
+    from_dttm: datetime
+    to_dttm: datetime
+    is_timeseries: bool
+    time_shift: timedelta
+    groupby: List[str]
+    metrics: List[Union[Dict, str]]
+    row_limit: int
+    filter: List[str]
+    timeseries_limit: int
+    timeseries_limit_metric: Optional[Dict]
+    order_desc: bool
+    extras: Dict
+    columns: List[str]
+    orderby: List[List]
+
     def __init__(
         self,
         granularity: str,
         metrics: List[Union[Dict, str]],
-        groupby: List[str] = None,
-        filters: List[str] = None,
+        groupby: Optional[List[str]] = None,
 
 Review comment:
   Setting default values to be mutable is tricky.
   Ex.
   ```python
   def f(lst=[]):
       return lst
   a = f() # a = []
   a.append(3) # a = [3]
   print(f()) # prints [3] ohno
   ```
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to