home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 1189593287

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/issues/6813#issuecomment-1189593287 https://api.github.com/repos/pydata/xarray/issues/6813 1189593287 IC_kwDOAMm_X85G58DH 38170479 2022-07-19T22:00:48Z 2022-07-19T22:00:48Z CONTRIBUTOR

Adding filename_or_obj.seek(0) fixes this, but I am not sure if it poses a security risk? def read_magic_number_from_file(filename_or_obj, count=8) -> bytes: # check byte header to determine file type if isinstance(filename_or_obj, bytes): magic_number = filename_or_obj[:count] elif isinstance(filename_or_obj, io.IOBase): filename_or_obj.seek(0) if filename_or_obj.tell() != 0: raise ValueError( "cannot guess the engine, " "file-like object read/write pointer not at the start of the file, " "please close and reopen, or use a context manager" ) magic_number = filename_or_obj.read(count) filename_or_obj.seek(0) else: raise TypeError(f"cannot read the magic number form {type(filename_or_obj)}") return magic_number

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  1310058435
Powered by Datasette · Queries took 0.687ms · About: xarray-datasette