Skip to content

Commit

Permalink
Added to_snake_case
Browse files Browse the repository at this point in the history
  • Loading branch information
NikosDelijohn committed Oct 19, 2024
1 parent d3f3862 commit 18bf061
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/testcrush/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@
import os


def to_snake_case(name: str) -> str:
"""
Args:
name (str): A camelCase-like string
Returns:
str: The ``name`` in snake_case format.
"""
return ''.join(['_' + i.lower() if i.isupper() else i for i in name]).lstrip('_')


def setup_logger(stream_logging_level: int, log_file: str | None = None) -> None:
"""Set up a logger with stream and file handlers."""
class IndentedFormatter(logging.Formatter):
Expand Down

0 comments on commit 18bf061

Please sign in to comment.