Skip to content

Commit 0b99e47

Browse files
authored
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).
1 parent bc2fbf2 commit 0b99e47

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

ibis/expr/types/strings.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ def hashbytes(
455455
self,
456456
how: Literal["md5", "sha1", "sha256", "sha512"] = "sha256",
457457
) -> ir.BinaryValue:
458-
"""Compute the binary hash value of the input.
458+
r"""Compute the binary hash value of the input.
459459
460460
Parameters
461461
----------
@@ -466,6 +466,12 @@ def hashbytes(
466466
-------
467467
BinaryValue
468468
Binary expression
469+
470+
Examples
471+
--------
472+
>>> import ibis
473+
>>> str_lit = ibis.literal("hello")
474+
>>> result = str_lit.hashbytes("md5") # b']A@*\xbcK*v\xb9q\x9d\x91\x10\x17\xc5\x92'
469475
"""
470476
return ops.HashBytes(self, how).to_expr()
471477

@@ -492,7 +498,7 @@ def hexdigest(
492498
>>> t = ibis.memtable({"species": ["Adelie", "Chinstrap", "Gentoo"]})
493499
>>> t.species.hexdigest()
494500
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
495-
┃ HexDigest(species) ┃
501+
┃ HexDigest(species)
496502
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
497503
│ string │
498504
├──────────────────────────────────────────────────────────────────┤

0 commit comments

Comments
 (0)