Skip to content

Commit

Permalink
Remove hasattr check
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanjmcdougall committed Jul 25, 2024
1 parent 1122cdb commit 1a8a772
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions pins/drivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,10 @@ def load_data(
try:
import rdata

# Can be removed once support for Python 3.8 is dropped.
# The issue is that the last `rdata` available on Python 3.8 was v0.9,
# which doesn'thave the same `rdata.read_rds()` function.
# Equivalent to `rdata.read_rds(f)` but compatible with Python 3.8.
# See https://github.com/rstudio/pins-python/pull/265
if not hasattr(rdata, "read_rds"):
parsed = rdata.parser.parse_file(f)
rdata.conversion.convert(parsed)

return rdata.read_rds(f)
parsed = rdata.parser.parse_file(f)
return rdata.conversion.convert(parsed)
except ModuleNotFoundError:
raise ModuleNotFoundError(
"Install the 'rdata' package to attempt to convert 'rds' files into Python objects."
Expand Down

0 comments on commit 1a8a772

Please sign in to comment.