inflection Documentation

Similar documents
git-pr Release dev2+ng5b0396a

mp3fm Documentation Release Akshit Agarwal

Sensor-fusion Demo Documentation

dublincore Documentation

utidylib Documentation Release 0.4

agate-sql Documentation

Tailor Documentation. Release 0.1. Derek Stegelman, Garrett Pennington, and Jon Faustman

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

Dellve CuDNN Documentation

X Generic Event Extension. Peter Hutterer

PyCon APAC 2014 Documentation

Elegans Documentation

XStatic Documentation

retask Documentation Release 1.0 Kushal Das

sensor-documentation Documentation

deepatari Documentation

BME280 Documentation. Release Richard Hull

CuteFlow-V4 Documentation

twstock Documentation

Feed Cache for Umbraco Version 2.0

invenio-formatter Documentation

disspcap Documentation

MCAFEE THREAT INTELLIGENCE EXCHANGE RESILIENT THREAT SERVICE INTEGRATION GUIDE V1.0

Django Mail Queue Documentation

OPi.GPIO Documentation

pydocstyle Documentation

puppet-diamond Documentation

Piexif Documentation. Release 1.0.X. hmatoba

Open Source Used In Cisco Configuration Professional for Catalyst 1.0

Piexif Documentation. Release 1.0.X. hmatoba

Statsd Metrics Documentation

delegator Documentation

Industries Package. TARMS Inc.

Daedalus Documentation

jumpssh Documentation

SopaJS JavaScript library package

aiounittest Documentation

Testworks User Guide. Release 1.0. Dylan Hackers

Imagination Documentation

clipbit Release 0.1 David Fraser

Asthma Eliminator MicroMedic Competition Entry

LANDISVIEW Beta v1.0-user Guide

abstar Documentation Release Bryan Briney

MEAS HTU21D PERIPHERAL MODULE

Firebase PHP SDK. Release

Instagram PHP Documentation

RTI Connext DDS Core Libraries

Guest Book. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

XEP-0099: IQ Query Action Protocol

NDIS Implementation Guide

Spotter Documentation Version 0.5, Released 4/12/2010

MatPlotTheme Documentation

KEMP Driver for Red Hat OpenStack. KEMP LBaaS Red Hat OpenStack Driver. Installation Guide

Black Mamba Documentation

Transparency & Consent Framework

Inptools Manual. Steffen Macke

Imagination Documentation

Migration Tool. Migration Tool (Beta) Technical Note

XTEST Extension Library

TWO-FACTOR AUTHENTICATION Version 1.1.0

Colgate, WI

ClassPad Manager Subscription

PHP-FCM Documentation

MEAS TEMPERATURE SYSTEM SENSOR (TSYS01) XPLAINED PRO BOARD

Java Relying Party API v1.0 Programmer s Guide

webbot Documentation Release Natesh M Bhat

VMware vcenter Log Insight Manager. Deployment Guide

HTNG Web Services Product Specification. Version 2011A

Moodle. Moodle. Deployment Guide

Dependency Injection Container Documentation

ProFont began life as a better version of Monaco 9 which is especially good for programmers. It was created circa 1987 by Andrew Welch.

LoadMaster VMware Horizon (with View) 6. Deployment Guide

josync Documentation Release 1.0 Joel Goop and Jonas Einarsson

Adobe Connect. Adobe Connect. Deployment Guide

Transparency & Consent Framework

Additional License Authorizations for HPE OneView for Microsoft Azure Log Analytics

docxtemplater Documentation

Packet Trace Guide. Packet Trace Guide. Technical Note

LANDISVIEW User Guide

Simba Cassandra ODBC Driver with SQL Connector

NTLM NTLM. Feature Description

mqtt-broker Documentation

XEP-0087: Stream Initiation

SW MAPS TEMPLATE BUILDER. User s Manual

RSA Two Factor Authentication

Splunk. Splunk. Deployment Guide

Python-ASN1. Release 2.2.0

X Locale Database Specification. Yoshio Horiuchi, IBM Japan

NVIDIA Release 197 Tesla Driver for Windows

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

Epic. Epic Systems. Deployment Guide

Tenable Hardware Appliance Upgrade Guide

HTNG Web Services Product Specification. Version 2014A

SWTP 6800 Simulator Usage 27-Mar-2012

NVIDIA Tesla Compute Cluster Driver for Windows

Preprocessing of fmri data

Bluetooth Low Energy in C++ for nrfx Microcontrollers

Enterprise Payment Solutions. Scanner Installation April EPS Scanner Installation: Quick Start for Remote Deposit Complete TM

Compound Text Encoding

User Guide. Calibrated Software, Inc.

Transcription:

inflection Documentation Release 0.3.1 Janne Vanhala Oct 29, 2018

Contents 1 Installation 3 2 Contributing 5 3 API Documentation 7 4 Changelog 11 4.1 0.3.1 (May 3, 2015)........................................... 11 5 License 13 Python Module Index 15 i

ii

inflection Documentation, Release 0.3.1 Inflection is a string transformation library. It singularizes and pluralizes English words, and transforms strings from CamelCase to underscored_string. Inflection is a port of Ruby on Rails inflector to Python. Contents 1

inflection Documentation, Release 0.3.1 2 Contents

CHAPTER 1 Installation Use pip to install from PyPI: pip install inflection 3

inflection Documentation, Release 0.3.1 4 Chapter 1. Installation

CHAPTER 2 Contributing To contribute to Inflector create a fork on GitHub. Clone your fork, make some changes, and submit a pull request. 5

inflection Documentation, Release 0.3.1 6 Chapter 2. Contributing

CHAPTER 3 API Documentation inflection.camelize(string, uppercase_first_letter=true) Convert strings to CamelCase. Examples: >>> camelize("device_type") "DeviceType" >>> camelize("device_type", False) "devicetype" camelize() can be thought of as a inverse of underscore(), although there are some cases where that does not hold: >>> camelize(underscore("ioerror")) "IoError" Parameters uppercase_first_letter if set to True camelize() converts strings to UpperCamelCase. If set to False camelize() produces lowercamelcase. Defaults to True. inflection.dasherize(word) Replace underscores with dashes in the string. Example: >>> dasherize("puni_puni") "puni-puni" inflection.humanize(word) Capitalize the first word and turn underscores into spaces and strip a trailing "_id", if any. Like titleize(), this is meant for creating pretty output. Examples: 7

inflection Documentation, Release 0.3.1 >>> humanize("employee_salary") "Employee salary" >>> humanize("author_id") "Author" inflection.ordinal(number) Return the suffix that should be added to a number to denote the position in an ordered sequence such as 1st, 2nd, 3rd, 4th. Examples: >>> ordinal(1) "st" >>> ordinal(2) "nd" >>> ordinal(1002) "nd" >>> ordinal(1003) "rd" >>> ordinal(-11) "th" >>> ordinal(-1021) "st" inflection.ordinalize(number) Turn a number into an ordinal string used to denote the position in an ordered sequence such as 1st, 2nd, 3rd, 4th. Examples: >>> ordinalize(1) "1st" >>> ordinalize(2) "2nd" >>> ordinalize(1002) "1002nd" >>> ordinalize(1003) "1003rd" >>> ordinalize(-11) "-11th" >>> ordinalize(-1021) "-1021st" inflection.parameterize(string, separator= - ) Replace special characters in a string so that it may be used as part of a pretty URL. Example: >>> parameterize(u"donald E. Knuth") 'donald-e-knuth' inflection.pluralize(word) Return the plural form of a word. Examples: >>> pluralize("post") "posts" (continues on next page) 8 Chapter 3. API Documentation

inflection Documentation, Release 0.3.1 >>> pluralize("octopus") "octopi" >>> pluralize("sheep") "sheep" >>> pluralize("cameloctopus") "CamelOctopi" (continued from previous page) inflection.singularize(word) Return the singular form of a word, the reverse of pluralize(). Examples: >>> singularize("posts") "post" >>> singularize("octopi") "octopus" >>> singularize("sheep") "sheep" >>> singularize("word") "word" >>> singularize("cameloctopi") "CamelOctopus" inflection.tableize(word) Create the name of a table like Rails does for models to table names. This method uses the pluralize() method on the last word in the string. Examples: >>> tableize('rawscaledscorer') "raw_scaled_scorers" >>> tableize('egg_and_ham') "egg_and_hams" >>> tableize('fancycategory') "fancy_categories" inflection.titleize(word) Capitalize all the words and replace some characters in the string to create a nicer looking title. titleize() is meant for creating pretty output. Examples: >>> titleize("man from the boondocks") "Man From The Boondocks" >>> titleize("x-men: the last stand") "X Men: The Last Stand" >>> titleize("themanwithoutapast") "The Man Without A Past" >>> titleize("raiders_of_the_lost_ark") "Raiders Of The Lost Ark" inflection.transliterate(string) Replace non-ascii characters with an ASCII approximation. If no approximation exists, the non-ascii character is ignored. The string must be unicode. Examples: 9

inflection Documentation, Release 0.3.1 >>> transliterate(u'älämölö') u'alamolo' >>> transliterate(u'ærøskøbing') u'rskbing' inflection.underscore(word) Make an underscored, lowercase form from the expression in the string. Example: >>> underscore("devicetype") "device_type" As a rule of thumb you can think of underscore() as the inverse of camelize(), though there are cases where that does not hold: >>> camelize(underscore("ioerror")) "IoError" 10 Chapter 3. API Documentation

CHAPTER 4 Changelog Here you can see the full list of changes between each Inflection release. 4.1 0.3.1 (May 3, 2015) Fixed trove classifiers not showing up on PyPI. Fixed human pluralized as humen and not humans. Fixed potato pluralized as potatos and not potatoes. 4.1.1 0.3.0 (March 1, 2015) Added tableize() function. 4.1.2 0.2.1 (September 3, 2014) Added Python 2, Python 3 and Python 3.4 trove classifiers. 4.1.3 0.2.0 (June 15, 2013) Added initial support for Python 3. Dropped Python 2.5 support. 4.1.4 0.1.2 (March 13, 2012) Added Python 2.5 support. 11

inflection Documentation, Release 0.3.1 4.1.5 0.1.1 (February 24, 2012) Fixed some files not included in the distribution package. 4.1.6 0.1.0 (February 24, 2012) Initial public release 12 Chapter 4. Changelog

CHAPTER 5 License Copyright (C) 2012-2015 Janne Vanhala Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software ), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PAR- TICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFT- WARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13

inflection Documentation, Release 0.3.1 14 Chapter 5. License

Python Module Index i inflection, 7 15

inflection Documentation, Release 0.3.1 16 Python Module Index

Index C camelize() (in module inflection), 7 D dasherize() (in module inflection), 7 H humanize() (in module inflection), 7 I inflection (module), 7 O ordinal() (in module inflection), 8 ordinalize() (in module inflection), 8 P parameterize() (in module inflection), 8 pluralize() (in module inflection), 8 S singularize() (in module inflection), 9 T tableize() (in module inflection), 9 titleize() (in module inflection), 9 transliterate() (in module inflection), 9 U underscore() (in module inflection), 10 17