home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

4 rows where author_association = "MEMBER", issue = 1084220684 and user = 35968931 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

These facets timed out: author_association, issue

user 1

  • TomNicholas · 4 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
998973316 https://github.com/pydata/xarray/pull/6086#issuecomment-998973316 https://api.github.com/repos/pydata/xarray/issues/6086 IC_kwDOAMm_X847ix-E TomNicholas 35968931 2021-12-21T17:43:11Z 2021-12-23T04:12:48Z MEMBER

This is just an internal check in xarray, verifying that _variables is always a Python dict. I would be fine turning this off, certainly at least for tests with the new custom mapping.

It seems I can make that check pass very easily, because this already works somehow, even though they aren't considered subtypes :confused:

```python In [1]: from xarray.core.utils import CopyableMutableMapping

In [2]: d = {}

In [3]: isinstance(d, CopyableMutableMapping) Out[3]: True ```

I realize that my assertion above isn't quite right — the issue was about Mapping[Hashable, V], not Dict[Hashable, V].

Changing CopyableMutableMapping[Hashable, Variable] to Mapping[Hashable, Variable] in the type hints for ._construct_direct and ._replace gets rid of loads of type errors! Must be because those methods don't actually need to mutate the mapping, so won't complain about .update if it's never called on those types.

Still have a bunch of errors like this though

xarray/core/dataset.py:785: error: Argument 1 to "Frozen" has incompatible type "CopyableMutableMapping[Hashable, Variable]"; expected "Mapping[Hashable, Variable]" [arg-type]

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Type protocol for internal variable mapping 1084220684
998226035 https://github.com/pydata/xarray/pull/6086#issuecomment-998226035 https://api.github.com/repos/pydata/xarray/issues/6086 IC_kwDOAMm_X847f7hz TomNicholas 35968931 2021-12-20T19:56:34Z 2021-12-20T19:56:34Z MEMBER

I can have a look this week!

Thanks, but no rush! I write these comments just as much for my benefit as for anyone else's.

Would you mind committing the Hashable -> Any changes?

Sure, just done it in https://github.com/pydata/xarray/pull/6086/commits/1376ed9ffe756feefedd8e07e4068c7614ba39bb, though there might be other places that need it as a result.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Type protocol for internal variable mapping 1084220684
998193097 https://github.com/pydata/xarray/pull/6086#issuecomment-998193097 https://api.github.com/repos/pydata/xarray/issues/6086 IC_kwDOAMm_X847fzfJ TomNicholas 35968931 2021-12-20T19:04:38Z 2021-12-20T19:04:38Z MEMBER

I started adding the test implementation, but when I run the new test I get the exact isinstance error I was expecting:

``` ds = <xarray.Dataset> Dimensions: () Data variables: a int64 0 b int64 1

def _assert_dataset_invariants(ds: Dataset):
  assert isinstance(ds._variables, dict), type(ds._variables)

E AssertionError: <class 'xarray.tests.test_dataset.CustomMirroredMapping'>

/home/tom/Documents/Work/Code/xarray/xarray/testing.py:309: AssertionError `` I *think* that with@runtime_checkable` then once mypy considers these the same type then this would pass, but I might have completely misunderstood how that works (meaning then we would probably need to relax the isinstance check).

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Type protocol for internal variable mapping 1084220684
998127749 https://github.com/pydata/xarray/pull/6086#issuecomment-998127749 https://api.github.com/repos/pydata/xarray/issues/6086 IC_kwDOAMm_X847fjiF TomNicholas 35968931 2021-12-20T17:24:43Z 2021-12-20T17:24:43Z MEMBER

Thanks @max-sixty . Unfortunately changing Dict[Hashable, V] -> Dict[Any, V] and CopyableMutableMapping[Hashable, Variable] -> CopyableMutableMapping[Any, Variable] doesn't seem to help, I just get similar errors but with Any:

xarray/core/dataarray.py:538: error: Argument 1 to "_construct_direct" of "Dataset" has incompatible type "Dict[Any, Variable]"; expected "CopyableMutableMapping[Any, Variable]" [arg-type] xarray/core/dataarray.py:538: note: Following member(s) of "Dict[Any, Variable]" have conflicts: xarray/core/dataarray.py:538: note: Expected: xarray/core/dataarray.py:538: note: @overload xarray/core/dataarray.py:538: note: def update(self, other: Mapping[Any, Variable], **kwargs: Variable) -> None xarray/core/dataarray.py:538: note: @overload xarray/core/dataarray.py:538: note: def update(self, other: Iterable[Tuple[Any, Variable]], **kwargs: Variable) -> None xarray/core/dataarray.py:538: note: <1 more overload not shown> xarray/core/dataarray.py:538: note: Got: xarray/core/dataarray.py:538: note: @overload xarray/core/dataarray.py:538: note: def update(self, Mapping[Any, Variable], **kwargs: Variable) -> None xarray/core/dataarray.py:538: note: @overload xarray/core/dataarray.py:538: note: def update(self, Iterable[Tuple[Any, Variable]], **kwargs: Variable) -> None

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Type protocol for internal variable mapping 1084220684

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 6806.428ms · About: xarray-datasette