MCPcopy Create free account
hub / github.com/omkarcloud/botasaurus / camelcase

Function camelcase

botasaurus/cl.py:38–55  ·  view source on GitHub ↗

Convert a string into camelCase. Args: string (:obj:`str`): The string to convert to camelCase. Returns: :obj:`str`: The camelCased string.

(string: str)

Source from the content-addressed store, hash-verified

36 return re.sub(r"_$", "", string) if not trailing_underscore else string
37
38def camelcase(string: str) -> str:
39 """Convert a string into camelCase.
40
41 Args:
42 string (:obj:`str`):
43 The string to convert to camelCase.
44
45 Returns:
46 :obj:`str`: The camelCased string.
47 """
48 import re
49 if not string:
50 return ""
51 # Turn into snake_case, then remove "_" and capitalize first letter
52 string = "".join(f"{s[0].upper()}{s[1:].lower()}"
53 for s in re.split(r'_', snakecase(string)) if s)
54 # Make first letter lower
55 return f"{string[0].lower()}{string[1:]}" if string else ""
56
57def remove_commas(s):
58 if isinstance(s, str):

Callers 1

camelcase_keysFunction · 0.85

Calls 2

snakecaseFunction · 0.85
joinMethod · 0.80

Tested by

no test coverage detected