Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

naming

Project description

titlize/untitlize

from namae import titlize, untitlize

assert titlize("foo") == "Foo"
assert untitlize("Foo") == "foo"

pascalcase/camelcase/snakecase/kebabcase

assert pascalcase("foo-bar") == "FooBar"
assert camelcase("foo-bar") == "fooBar"

assert snakecase("IpAddress") == "ip_address"
assert snakecase("IPAddress") == "ip_address"
assert kebabcase("IPAddress") == "ip-address"
assert lispcase("IPAddress") == "ip-address"

normalize

from namae import normalize

# hyphen
assert normalize("foo-bar") == "foo_bar"

# invalid prefix
assert normalize("foo123") == "foo123"
assert normalize("123foo") == "n123foo"
assert normalize("+1") == "x1"
assert normalize("-1") == "x_1"

# python's keyword
assert normalize("while") == "while_"
assert normalize("def") == "def_"

appendix

goname

from namae.go import goname

assert goname("foo-bar-boo") == 'FooBarBoo'
assert goname("foo_bar_boo") == 'FooBarBoo'

assert goname("api") == 'API'
assert goname("id") == 'ID'
assert goname("fooid") == 'Fooid'
assert goname("foo_id") == 'FooID'
assert goname("1times") == 'OneTimes'
assert goname("9times") == 'NineTimes'
assert goname("10times") == 'Num10Times'

Project details


Release history Release notifications

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for namae, version 0.1
Filename, size File type Python version Upload date Hashes
Filename, size namae-0.1-py2.py3-none-any.whl (4.3 kB) File type Wheel Python version 3.5 Upload date Hashes View hashes
Filename, size namae-0.1.tar.gz (3.0 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page