MCPcopy
hub / github.com/reflex-dev/reflex / join

Method join

packages/reflex-base/src/reflex_base/vars/sequence.py:65–96  ·  view source on GitHub ↗

Join the elements of the array. Args: sep: The separator between elements. Returns: The joined elements.

(self, sep: StringVar | str = "")

Source from the content-addressed store, hash-verified

63 """Base class for immutable array vars."""
64
65 def join(self, sep: StringVar | str = "") -> StringVar:
66 """Join the elements of the array.
67
68 Args:
69 sep: The separator between elements.
70
71 Returns:
72 The joined elements.
73 """
74 if not isinstance(sep, (StringVar, str)):
75 raise_unsupported_operand_types("join", (type(self), type(sep)))
76 if (
77 isinstance(self, LiteralArrayVar)
78 and (
79 len(
80 args := [
81 x
82 for x in self._var_value
83 if isinstance(x, (LiteralStringVar, str))
84 ]
85 )
86 == len(self._var_value)
87 )
88 and isinstance(sep, (LiteralStringVar, str))
89 ):
90 sep_str = sep._var_value if isinstance(sep, LiteralStringVar) else sep
91 return LiteralStringVar.create(
92 sep_str.join(
93 i._var_value if isinstance(i, LiteralStringVar) else i for i in args
94 )
95 )
96 return array_join_operation(self, sep)
97
98 def reverse(self) -> ArrayVar[ARRAY_VAR_TYPE]:
99 """Reverse the array.

Callers 15

createMethod · 0.45
add_hooksMethod · 0.45
_default_drop_rejectedFunction · 0.45
_format_field_listFunction · 0.45
_renderMethod · 0.45
_get_codeblock_fn_varMethod · 0.45
check_requirementsFunction · 0.45
_build_cloudbuild_yamlFunction · 0.45
_format_env_vars_yamlFunction · 0.45
_normalize_pluginsMethod · 0.45

Calls 3

array_join_operationFunction · 0.85
createMethod · 0.45