home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

5 rows where issue = 1646350377 sorted by updated_at descending

✖
✖

✎ View and edit SQL

This data as json, CSV (advanced)

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

user 3

  • dcherian 2
  • headtr1ck 2
  • groutr 1

author_association 3

  • COLLABORATOR 2
  • MEMBER 2
  • NONE 1

issue 1

  • Use read1 instead of read to get magic number · 5 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
1513871216 https://github.com/pydata/xarray/pull/7698#issuecomment-1513871216 https://api.github.com/repos/pydata/xarray/issues/7698 IC_kwDOAMm_X85aO9dw dcherian 2448579 2023-04-18T22:36:29Z 2023-04-18T22:36:29Z MEMBER

One workaround is to use os.read when passed a filename, and .read() when passed a file object.

Not sure about the details here. I think it would be good to discuss in an issue before proceeding

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Use read1 instead of read to get magic number 1646350377
1495840833 https://github.com/pydata/xarray/pull/7698#issuecomment-1495840833 https://api.github.com/repos/pydata/xarray/issues/7698 IC_kwDOAMm_X85ZKLhB headtr1ck 43316012 2023-04-04T11:52:08Z 2023-04-04T11:52:08Z COLLABORATOR

I think this logic is done one level above in the call stack. But yes, maybe a different name for the argument would be better.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Use read1 instead of read to get magic number 1646350377
1489744942 https://github.com/pydata/xarray/pull/7698#issuecomment-1489744942 https://api.github.com/repos/pydata/xarray/issues/7698 IC_kwDOAMm_X85Yy7Qu groutr 10678620 2023-03-30T06:02:41Z 2023-03-30T06:03:03Z NONE

Agreed, and a reference to a pretty authoritative source: https://github.com/python/cpython/blob/3.11/Modules/_io/bufferedio.c#L915

It's confusing the method has a parameter called filename_or_obj but doesn't actually handle filenames.

One workaround is to use os.read when passed a filename, and .read() when passed a file object. Something similar to: python def get_magic_number(filename_or_obj, count=8): if isinstance(filename_or_obj, (str, os.PathLike)): fd = os.open(filename_or_obj, os.RDONLY) # Append os.O_BINARY on windows magic_number = os.read(fd, count) if len(magic_number) != count: raise TypeError("Error reading magic number") os.close(fd) elif isinstance(filename_or_obj, io.BufferedIOBase): if filename_or_obj.seekable(): pos = filename_or_obj.tell() filename_or_obj.seek(0) magic_number = filename_or_obj.read(count) filename_or_obj.seek(pos) else: raise TypeError("File not seekable.") else: raise TypeError("Cannot read magic number.") return magic_number On my laptop (w/ SSD) using os.read is about 2x faster than using .read()

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Use read1 instead of read to get magic number 1646350377
1489148512 https://github.com/pydata/xarray/pull/7698#issuecomment-1489148512 https://api.github.com/repos/pydata/xarray/issues/7698 IC_kwDOAMm_X85Ywppg dcherian 2448579 2023-03-29T19:04:08Z 2023-03-29T19:04:08Z MEMBER

Not sure if this change will cause problems if one doesn't get the full 8 bytes?

Agree, this seems a bit unsafe? https://stackoverflow.com/questions/57726771/what-the-difference-between-read-and-read1-in-python

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Use read1 instead of read to get magic number 1646350377
1489144606 https://github.com/pydata/xarray/pull/7698#issuecomment-1489144606 https://api.github.com/repos/pydata/xarray/issues/7698 IC_kwDOAMm_X85Ywose headtr1ck 43316012 2023-03-29T19:01:21Z 2023-03-29T19:01:21Z COLLABORATOR

I think some backends rely on this magic number to determine the exact file format. Not sure if this change will cause problems if one doesn't get the full 8 bytes?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Use read1 instead of read to get magic number 1646350377

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 1843.163ms · About: xarray-datasette
  • Sort ascending
  • Sort descending
  • Facet by this
  • Hide this column
  • Show all columns
  • Show not-blank rows