lists.arthurdejong.org
RSS feed

python-stdnum branch master updated. 1.11-12-g170e599

[Date Prev][Date Next] [Thread Prev][Thread Next]

python-stdnum branch master updated. 1.11-12-g170e599



This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "python-stdnum".

The branch, master has been updated
       via  170e5992cc076dca3ef869322c1eef252f26ccce (commit)
      from  6988d91a92c45d4a61ccc344a7761bbb8bd7c6ef (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://arthurdejong.org/git/python-stdnum/commit/?id=170e5992cc076dca3ef869322c1eef252f26ccce

commit 170e5992cc076dca3ef869322c1eef252f26ccce
Author: Arthur de Jong <arthur@arthurdejong.org>
Date:   Sun Jun 2 15:44:17 2019 +0200

    Rename stdnum.eu.nace.label() to get_label()
    
    To be more consistent with other similar functions. This deprecates the
    old function which now is a wrapper around get_label().

diff --git a/docs/stdnum.eu.nace.rst b/docs/stdnum.eu.nace.rst
index e474b40..9de35cc 100644
--- a/docs/stdnum.eu.nace.rst
+++ b/docs/stdnum.eu.nace.rst
@@ -2,4 +2,5 @@ stdnum.eu.nace
 ==============
 
 .. automodule:: stdnum.eu.nace
-   :members:
\ No newline at end of file
+   :members:
+   :exclude-members: label
diff --git a/stdnum/eu/nace.py b/stdnum/eu/nace.py
index 9fdd8bf..1f3a34c 100644
--- a/stdnum/eu/nace.py
+++ b/stdnum/eu/nace.py
@@ -1,7 +1,7 @@
 # nace.py - functions for handling EU NACE classification
 # coding: utf-8
 #
-# Copyright (C) 2017 Arthur de Jong
+# Copyright (C) 2017-2019 Arthur de Jong
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -38,7 +38,7 @@ More information:
 'A'
 >>> validate('62.01')
 '6201'
->>> str(label('62.01'))
+>>> str(get_label('62.01'))
 'Computer programming activities'
 >>> validate('62.05')
 Traceback (most recent call last):
@@ -52,6 +52,8 @@ InvalidLength: ...
 '62.01'
 """
 
+import warnings
+
 from stdnum.exceptions import *
 from stdnum.util import clean, isdigits
 
@@ -74,11 +76,19 @@ def info(number):
     return info
 
 
-def label(number):
+def get_label(number):
     """Lookup the category label for the number."""
     return info(number)['label']
 
 
+def label(number):  # pragma: no cover (deprecated function)
+    """DEPRECATED: use `get_label()` instead."""
+    warnings.warn(
+        'label() has been to get_label()',
+        DeprecationWarning, stacklevel=2)
+    return get_label(number)
+
+
 def validate(number):
     """Check if the number is a valid NACE. This checks the format and
     searches the registry to see if it exists."""

-----------------------------------------------------------------------

Summary of changes:
 docs/stdnum.eu.nace.rst |  3 ++-
 stdnum/eu/nace.py       | 16 +++++++++++++---
 2 files changed, 15 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
python-stdnum