Skip to content

Commit

Permalink
docs(examples): add hashbytes example (#10537)
Browse files Browse the repository at this point in the history
## 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).
  • Loading branch information
IndexSeek authored Nov 30, 2024
1 parent bc2fbf2 commit 0b99e47
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions ibis/expr/types/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
----------
Expand All @@ -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()

Expand All @@ -492,7 +498,7 @@ def hexdigest(
>>> t = ibis.memtable({"species": ["Adelie", "Chinstrap", "Gentoo"]})
>>> t.species.hexdigest()
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ HexDigest(species) ┃
┃ HexDigest(species)
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ string │
├──────────────────────────────────────────────────────────────────┤
Expand Down

0 comments on commit 0b99e47

Please sign in to comment.