Merge branch 'fix_plurals'

This commit is contained in:
Sebastian Thiel
2022-11-30 09:28:55 +01:00
2 changed files with 15 additions and 5 deletions

View File

@@ -7,3 +7,4 @@ codecov
ghp-import
pyright
types-PyYAML
inflect

View File

@@ -2,6 +2,7 @@ import os
import re
import subprocess
import inflect
from dataclasses import dataclass
from typing import Any, Dict, List, Mapping, Tuple
from copy import deepcopy
@@ -94,6 +95,10 @@ data_unit_multipliers = {
'%': 1,
}
inflection = inflect.engine()
HUB_TYPE_PARAMETERS = ('S',)
@@ -284,11 +289,15 @@ def md_italic(l):
def singular(s):
if s.endswith('ies'):
return s[:-3] + 'y'
if s[-1] == 's':
return s[:-1]
return s
if s.lower().endswith('data'):
return s
single_noun = inflection.singular_noun(s)
if single_noun is False:
return s
else:
return single_noun
def split_camelcase_s(s):