Skip to content

Strip

Base classes

Name Children Inherits
TextOp
datacook.engine.ops.strings

⋔ Inheritance diagram

graph TD
  2848413086["strings.Strip"]
  4127298390["strings.TextOp"]
  2451904138["series.SeriesOp"]
  124287307["series.ColumnOp"]
  1539482213["base.Op"]
  2751680898["builtins.object"]
  4127298390 --> 2848413086
  2451904138 --> 4127298390
  124287307 --> 2451904138
  1539482213 --> 124287307
  2751680898 --> 1539482213

🛈 DocStrings

Bases: TextOp

Source code in src/datacook/engine/ops/strings.py
class Strip(TextOp):
    id = "str_strip"
    title = _("Strip text")
    description = _("Remove whitespace (or the given characters) at the start and end of text.")
    icon = "mdi.format-align-justify"
    method_param = "side"
    methods = {"both": "strip", "left": "lstrip", "right": "rstrip"}  # noqa: RUF012

    class Params(series.ColumnParams):
        side: Literal["both", "left", "right"] = Field("both", title=N_("Side"))
        to_strip: str | None = Field(
            None,
            title=N_("Characters"),
            description=N_("Characters to remove (any order). Empty: whitespace."),
        )

:fa-brands-github: Show source on GitHub