From 0b99e4781940527a82749a235206b4044da6b8cb Mon Sep 17 00:00:00 2001 From: Tyler White <50381805+IndexSeek@users.noreply.github.com> Date: Sat, 30 Nov 2024 15:43:02 -0500 Subject: [PATCH] docs(examples): add hashbytes example (#10537) ## Description of changes Adds non-auto computed documentation example for [`hashbytes`](https://ibis-project.org/reference/expression-strings.html#ibis.expr.types.strings.StringValue.hashbytes). --- ibis/expr/types/strings.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ibis/expr/types/strings.py b/ibis/expr/types/strings.py index 6383fe613256..f1aaad06b352 100644 --- a/ibis/expr/types/strings.py +++ b/ibis/expr/types/strings.py @@ -455,7 +455,7 @@ def hashbytes( self, how: Literal["md5", "sha1", "sha256", "sha512"] = "sha256", ) -> ir.BinaryValue: - """Compute the binary hash value of the input. + r"""Compute the binary hash value of the input. Parameters ---------- @@ -466,6 +466,12 @@ def hashbytes( ------- BinaryValue Binary expression + + Examples + -------- + >>> import ibis + >>> str_lit = ibis.literal("hello") + >>> result = str_lit.hashbytes("md5") # b']A@*\xbcK*v\xb9q\x9d\x91\x10\x17\xc5\x92' """ return ops.HashBytes(self, how).to_expr() @@ -492,7 +498,7 @@ def hexdigest( >>> t = ibis.memtable({"species": ["Adelie", "Chinstrap", "Gentoo"]}) >>> t.species.hexdigest() ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ - ┃ HexDigest(species) ┃ + ┃ HexDigest(species) ┃ ┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩ │ string │ ├──────────────────────────────────────────────────────────────────┤