#! /usr/bin/env python
"""Decorators for TheLandlab package."""
import re
[docs]
def camel_case(text, sep=None):
"""Convert to camel case.
Convert *text* to camel case. Use the *sep* keyword to specify the word
separator. The default is to split on whitespace.
>>> from landlab.framework.decorators import camel_case
>>> camel_case("eric idle")
'EricIdle'
>>> camel_case("terry_gilliam", sep="_")
'TerryGilliam'
>>> camel_case("MONTY Python")
'MONTYPython'
>>> camel_case("GrahamChapman")
'GrahamChapman'
"""
return "".join([word[0].upper() + word[1:] for word in text.split(sep)])