[ovs-dev] [python idl 13/16] python: Change 'clone' function names to 'copy'.
Ethan Jackson
ethan at nicira.com
Tue Sep 20 01:16:16 UTC 2011
Looks good,
Ethan
On Mon, Sep 19, 2011 at 11:18, Ben Pfaff <blp at nicira.com> wrote:
> It seems that 'copy' is the proper name for this kind of function in
> Python, based on the existence of dict.copy().
> ---
> python/ovs/db/data.py | 2 +-
> python/ovs/db/types.py | 10 +++++-----
> 2 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/python/ovs/db/data.py b/python/ovs/db/data.py
> index 15a7151..334c261 100644
> --- a/python/ovs/db/data.py
> +++ b/python/ovs/db/data.py
> @@ -241,7 +241,7 @@ class Datum(object):
> def __contains__(self, item):
> return item in self.values
>
> - def clone(self):
> + def copy(self):
> return Datum(self.type, dict(self.values))
>
> @staticmethod
> diff --git a/python/ovs/db/types.py b/python/ovs/db/types.py
> index 9563211..08dfa0a 100644
> --- a/python/ovs/db/types.py
> +++ b/python/ovs/db/types.py
> @@ -220,8 +220,8 @@ class BaseType(object):
> json['refType'] = self.ref_type
> return json
>
> - def clone(self):
> - return BaseType(self.type, self.enum.clone(), self.min, self.max,
> + def copy(self):
> + return BaseType(self.type, self.enum.copy(), self.min, self.max,
> self.min_length, self.max_length, self.ref_table)
>
> def is_valid(self):
> @@ -378,12 +378,12 @@ class Type(object):
> self.n_min = n_min
> self.n_max = n_max
>
> - def clone(self):
> + def copy(self):
> if self.value is None:
> value = None
> else:
> - value = self.value.clone()
> - return Type(self.key.clone(), value, self.n_min, self.n_max)
> + value = self.value.copy()
> + return Type(self.key.copy(), value, self.n_min, self.n_max)
>
> def __eq__(self, other):
> if not isinstance(other, Type):
> --
> 1.7.4.4
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>
More information about the dev
mailing list