home / github

Menu
  • GraphQL API
  • Search all tables

issue_comments

Table actions
  • GraphQL API for issue_comments

3 rows where issue = 739281259 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: reactions, created_at (date), updated_at (date)

user 2

  • mathause 2
  • max-sixty 1

issue 1

  • upgrading mypy to 0.790 fails · 3 ✖

author_association 1

  • MEMBER 3
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
725455918 https://github.com/pydata/xarray/issues/4571#issuecomment-725455918 https://api.github.com/repos/pydata/xarray/issues/4571 MDEyOklzc3VlQ29tbWVudDcyNTQ1NTkxOA== mathause 10194086 2020-11-11T14:32:08Z 2020-11-11T14:32:08Z MEMBER

Jup, given the effort required for 1. I also vote for 2. I learned a lot about typing/ mypy, though...

{
    "total_count": 1,
    "+1": 0,
    "-1": 0,
    "laugh": 1,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  upgrading mypy to 0.790 fails 739281259
724768430 https://github.com/pydata/xarray/issues/4571#issuecomment-724768430 https://api.github.com/repos/pydata/xarray/issues/4571 MDEyOklzc3VlQ29tbWVudDcyNDc2ODQzMA== mathause 10194086 2020-11-10T15:16:49Z 2020-11-11T14:30:51Z MEMBER

For context, mypy 0.790 now requires __lt__ if something should be sorted. Thus the following fails (used to work):

```python

from typing import TypeVar T = TypeVar("T")

def sort(lst: List[T]) -> List[T]): return sorted(lst) `` which returns the error message above (_LTstands for_LowerThan). The workaround is to define aTypeVarthat isSortable`:

```python from typing import TypeVar, List, Protocol class Sortable(Protocol): def __lt__(self, __other: Any) -> bool: ... SortableT = TypeVar("SortableT", bound=Sortable) def sort(lst: List[SortableT]) -> List[SortableT]): return sorted(lst) ```

What we want is a sortable dict key. However, we define dict keys as Hashable (e.g. dims) which is not sortable (does not have __lt__). I see two possibilities:

  1. type all keys of a SortedKeysDict as SortableHashable instead of Hashable (that would be a lot)
  2. ignore this and add # type: ignore to core/utils.py#L466

But maybe there is a better way?

Here is how 1. could look like (simplified):

```python import collections from typing import Any, Dict, Iterator, Mapping, Protocol, TypeVar class HashableSortable(Protocol): def __lt__(self, __other: Any) -> bool: ... def __hash__(self) -> int: ... HashableSortableK = TypeVar("HashableSortableK", bound=HashableSortable) V = TypeVar("V") # use UserDict for brevity class SortedKeysDict(collections.UserDict[HashableSortableK, V]): # used to be [K, V] def __iter__(self) -> Iterator[HashableSortableK]: return iter(sorted(self.data)) # now we need to update the typing of all uses of `SortedKeysDict`, e.g. dims class Dataset: _dims: Dict[HashableSortable, int] # used to be [Hashable, int] def __init__(self, dims) -> None: self._dims = dims @property def dims(self) -> Mapping[HashableSortable, int]: return SortedKeysDict(self._dims) ```
{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  upgrading mypy to 0.790 fails 739281259
724848270 https://github.com/pydata/xarray/issues/4571#issuecomment-724848270 https://api.github.com/repos/pydata/xarray/issues/4571 MDEyOklzc3VlQ29tbWVudDcyNDg0ODI3MA== max-sixty 5635139 2020-11-10T17:23:55Z 2020-11-10T17:23:55Z MEMBER

Thanks for the excellent research @mathause

I would vote for #2. I think in time we could move away from SortedKeysDict given that dicts are now ordered. (There is a recent issue on this but I couldn't immediately find it)

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  upgrading mypy to 0.790 fails 739281259

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issue_comments] (
   [html_url] TEXT,
   [issue_url] TEXT,
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [created_at] TEXT,
   [updated_at] TEXT,
   [author_association] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [issue] INTEGER REFERENCES [issues]([id])
);
CREATE INDEX [idx_issue_comments_issue]
    ON [issue_comments] ([issue]);
CREATE INDEX [idx_issue_comments_user]
    ON [issue_comments] ([user]);
Powered by Datasette · Queries took 13.572ms · About: xarray-datasette