diff mbox series

[ovs-dev] python: Fix plural forms of OVSDB types.

Message ID 20200321221727.3975073-1-blp@ovn.org
State Accepted
Commit 714a104995af2b93eb456b0017ed8431f6769b16
Headers show
Series [ovs-dev] python: Fix plural forms of OVSDB types. | expand

Commit Message

Ben Pfaff March 21, 2020, 10:17 p.m. UTC
Fixes two problems.  First, the plural of chassis is also chassis.
Second, for linguistic analysis we need to consider plain words, not
words that have (e.g.) \fB and \fR pasted into them for nroff output.

This makes the OVN manpage for ovn-sb(5) talk about "set of Chassis"
not "set of Chassiss".

Signed-off-by: Ben Pfaff <blp@ovn.org>
---
 python/ovs/db/types.py | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

Comments

0-day Robot March 21, 2020, 10:56 p.m. UTC | #1
Bleep bloop.  Greetings Ben Pfaff, I am a robot and I have tried out your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


git-am:
error: sha1 information is lacking or useless (python/ovs/db/types.py).
error: could not build fake ancestor
hint: Use 'git am --show-current-patch' to see the failed patch
Patch failed at 0001 python: Fix plural forms of OVSDB types.
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".


Please check this out.  If you feel there has been an error, please email aconole@redhat.com

Thanks,
0-day Robot
Ben Pfaff July 6, 2020, 9:07 p.m. UTC | #2
This still needs a review.

On Sat, Mar 21, 2020 at 03:17:27PM -0700, Ben Pfaff wrote:
> Fixes two problems.  First, the plural of chassis is also chassis.
> Second, for linguistic analysis we need to consider plain words, not
> words that have (e.g.) \fB and \fR pasted into them for nroff output.
> 
> This makes the OVN manpage for ovn-sb(5) talk about "set of Chassis"
> not "set of Chassiss".
> 
> Signed-off-by: Ben Pfaff <blp@ovn.org>
> ---
>  python/ovs/db/types.py | 13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/python/ovs/db/types.py b/python/ovs/db/types.py
> index b0eec6165b3b..a8ba01d4f2cc 100644
> --- a/python/ovs/db/types.py
> +++ b/python/ovs/db/types.py
> @@ -591,9 +591,16 @@ class Type(object):
>              if self.value:
>                  return "map of %s%s-%s pairs" % (quantity, keyName, valueName)
>              else:
> -                if keyName.lower() == 'chassis':
> -                    plural = ''
> -                elif keyName.endswith('s'):
> +                # Exract the last word from 'keyName' so we can make it plural.
> +                # For linguistic analysis, turn it into English without
> +                # formatting so that we don't consider any prefix or suffix
> +                # added by escapeLiteral.
> +                plainKeyName = (self.key.toEnglish(returnUnchanged)
> +                                .rpartition(' ')[2].lower())
> +
> +                if plainKeyName == 'chassis':
> +                    plural = keyName
> +                elif plainKeyName.endswith('s'):
>                      plural = keyName + "es"
>                  else:
>                      plural = keyName + "s"
> -- 
> 2.24.1
>
Numan Siddique July 7, 2020, 12:41 a.m. UTC | #3
On Tue, Jul 7, 2020, 2:38 AM Ben Pfaff <blp@ovn.org> wrote:

> This still needs a review.
>

Oops. Sorry about that.

Acked-by: Numan Siddique <numans@ovn.org>


> On Sat, Mar 21, 2020 at 03:17:27PM -0700, Ben Pfaff wrote:
> > Fixes two problems.  First, the plural of chassis is also chassis.
> > Second, for linguistic analysis we need to consider plain words, not
> > words that have (e.g.) \fB and \fR pasted into them for nroff output.
> >
> > This makes the OVN manpage for ovn-sb(5) talk about "set of Chassis"
> > not "set of Chassiss".
> >
> > Signed-off-by: Ben Pfaff <blp@ovn.org>
> > ---
> >  python/ovs/db/types.py | 13 ++++++++++---
> >  1 file changed, 10 insertions(+), 3 deletions(-)
> >
> > diff --git a/python/ovs/db/types.py b/python/ovs/db/types.py
> > index b0eec6165b3b..a8ba01d4f2cc 100644
> > --- a/python/ovs/db/types.py
> > +++ b/python/ovs/db/types.py
> > @@ -591,9 +591,16 @@ class Type(object):
> >              if self.value:
> >                  return "map of %s%s-%s pairs" % (quantity, keyName,
> valueName)
> >              else:
> > -                if keyName.lower() == 'chassis':
> > -                    plural = ''
> > -                elif keyName.endswith('s'):
> > +                # Exract the last word from 'keyName' so we can make it
> plural.
> > +                # For linguistic analysis, turn it into English without
> > +                # formatting so that we don't consider any prefix or
> suffix
> > +                # added by escapeLiteral.
> > +                plainKeyName = (self.key.toEnglish(returnUnchanged)
> > +                                .rpartition(' ')[2].lower())
> > +
> > +                if plainKeyName == 'chassis':
> > +                    plural = keyName
> > +                elif plainKeyName.endswith('s'):
> >                      plural = keyName + "es"
> >                  else:
> >                      plural = keyName + "s"
> > --
> > 2.24.1
> >
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
>
Ben Pfaff July 7, 2020, 3:52 p.m. UTC | #4
On Tue, Jul 07, 2020 at 06:11:33AM +0530, Numan Siddique wrote:
> On Tue, Jul 7, 2020, 2:38 AM Ben Pfaff <blp@ovn.org> wrote:
> 
> > This still needs a review.
> >
> 
> Oops. Sorry about that.
> 
> Acked-by: Numan Siddique <numans@ovn.org>

Thanks!  Applied to master.
diff mbox series

Patch

diff --git a/python/ovs/db/types.py b/python/ovs/db/types.py
index b0eec6165b3b..a8ba01d4f2cc 100644
--- a/python/ovs/db/types.py
+++ b/python/ovs/db/types.py
@@ -591,9 +591,16 @@  class Type(object):
             if self.value:
                 return "map of %s%s-%s pairs" % (quantity, keyName, valueName)
             else:
-                if keyName.lower() == 'chassis':
-                    plural = ''
-                elif keyName.endswith('s'):
+                # Exract the last word from 'keyName' so we can make it plural.
+                # For linguistic analysis, turn it into English without
+                # formatting so that we don't consider any prefix or suffix
+                # added by escapeLiteral.
+                plainKeyName = (self.key.toEnglish(returnUnchanged)
+                                .rpartition(' ')[2].lower())
+
+                if plainKeyName == 'chassis':
+                    plural = keyName
+                elif plainKeyName.endswith('s'):
                     plural = keyName + "es"
                 else:
                     plural = keyName + "s"