MCPcopy Create free account
hub / github.com/Meshcapade/difflocks / to_snake_case

Function to_snake_case

callbacks/callback.py:6–10  ·  view source on GitHub ↗

Converts CamelCase string into snake_case.

(string)

Source from the content-addressed store, hash-verified

4import torch
5
6def to_snake_case(string):
7 """Converts CamelCase string into snake_case."""
8
9 s = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', string)
10 return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s).lower()
11
12def classname(obj):
13 return obj.__class__.__name__

Callers 2

__init__Method · 0.85
__getitem__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected