MCPcopy Create free account
hub / github.com/dot-agent/nextpy / split

Method split

nextpy/backend/vars.py:1274–1296  ·  view source on GitHub ↗

Split a string var into a list. Args: other: The string to split the var with. Returns: A var with the list. Raises: TypeError: If the var is not a string.

(self, other: str | Var[str] = " ")

Source from the content-addressed store, hash-verified

1272 )
1273
1274 def split(self, other: str | Var[str] = " ") -> Var:
1275 """Split a string var into a list.
1276
1277 Args:
1278 other: The string to split the var with.
1279
1280 Returns:
1281 A var with the list.
1282
1283 Raises:
1284 TypeError: If the var is not a string.
1285 """
1286 if not types._issubclass(self._var_type, str):
1287 raise TypeError(f"Cannot split non-string var {self._var_full_name}.")
1288
1289 other = Var.create_safe(json.dumps(other)) if isinstance(other, str) else other
1290
1291 return self._replace(
1292 _var_name=f"{self._var_name}.split({other._var_full_name})",
1293 _var_is_string=False,
1294 _var_type=list[str],
1295 merge_var_data=other._var_data,
1296 )
1297
1298 def join(self, other: str | Var[str] | None = None) -> Var:
1299 """Join a list var into a string.

Callers 15

indexFunction · 0.80
upload_fileFunction · 0.80
to_camel_caseFunction · 0.80
to_title_caseFunction · 0.80
get_event_handler_partsFunction · 0.80
format_breadcrumbsFunction · 0.80
_get_hook_depsMethod · 0.80
eventHandlerFunction · 0.80
applyClientStorageDeltaFunction · 0.80
initFunction · 0.80
get_route_argsFunction · 0.80

Calls 2

_replaceMethod · 0.95
create_safeMethod · 0.80

Tested by 4

indexFunction · 0.64
versiontupleFunction · 0.64
test_state_proxyFunction · 0.64
get_above_max_versionFunction · 0.64