Skip to content

Commit

Permalink
fix: ensures that REncoder also checks for numpy.bool_ in encode_value (
Browse files Browse the repository at this point in the history
#1749)

* fix:ensures that REncoder also checks for numpy.bool_

* fix: ensures that REncoder also checks for numpy.bool_ in encode_value

* Moved new code line and numpy try clause to not add numpy as new dependency

* Modifyied wrong function. Corrected.

* formatted with black

* Fix value capitalization

Co-authored-by: Johannes Köster <johannes.koester@uni-due.de>
  • Loading branch information
Christian-Heyer and johanneskoester committed Jul 19, 2022
1 parent 6ade76d commit 10a6e1d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions snakemake/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ def encode_numeric(cls, value):

@classmethod
def encode_value(cls, value):

if value is None:
return "NULL"
elif isinstance(value, str):
Expand All @@ -202,6 +203,9 @@ def encode_value(cls, value):

if isinstance(value, np.number):
return str(value)
elif isinstance(value, np.bool_):
return "TRUE" if value else "FALSE"

except ImportError:
pass
raise ValueError("Unsupported value for conversion into R: {}".format(value))
Expand Down

0 comments on commit 10a6e1d

Please sign in to comment.