Switch from pattern.en to inflect
Change-Id: Ice314b136b9f7fe58ca978885f43ce346d337f3e
diff --git a/lib/xos-genx/setup.py b/lib/xos-genx/setup.py
index 109af47..c97ba52 100644
--- a/lib/xos-genx/setup.py
+++ b/lib/xos-genx/setup.py
@@ -35,7 +35,7 @@
include_package_data=True,
# TODO add all deps to the install_requires section
install_requires=[
- 'pattern>=2.6',
+ 'inflect>=1.0.1',
'astunparse>=1.5.0'
]
)
diff --git a/lib/xos-genx/xosgenx/jinja2_extensions/base.py b/lib/xos-genx/xosgenx/jinja2_extensions/base.py
index 561aeea..702b554 100644
--- a/lib/xos-genx/xosgenx/jinja2_extensions/base.py
+++ b/lib/xos-genx/xosgenx/jinja2_extensions/base.py
@@ -16,7 +16,9 @@
import pdb
import re
-from pattern import en
+from inflect import engine as inflect_engine_class
+
+inflect_engine = inflect_engine_class()
class FieldNotFound(Exception):
def __init__(self, message):
@@ -41,7 +43,7 @@
singular = field['options']['singular']
singular = unquote(singular)
except KeyError:
- singular = en.singularize(field['name'])
+ singular = inflect_engine.singular_noun(field['name'])
return singular
@@ -51,7 +53,7 @@
plural = field['options']['plural']
plural = unquote(plural)
except KeyError:
- plural = en.pluralize(en.singularize(field['name']))
+ plural = inflect_engine.plural_noun(inflect_engine.singular_noun(field['name']))
return plural
@@ -61,7 +63,7 @@
plural = field['options']['plural']
plural = unquote(plural)
except KeyError:
- plural = en.pluralize(field['name'])
+ plural = inflect_engine.plural_noun(field['name'])
return plural