From 33b9b053fd957349d425624bcf285a347e8d2c36 Mon Sep 17 00:00:00 2001 From: Petri Savolainen Date: Tue, 16 Nov 2021 21:32:10 +0200 Subject: [PATCH] prepare for 2.2 release; updated changelog, readme, version & remove old class based API --- CHANGES.txt | 9 ++++++--- README.md | 37 +++++-------------------------------- cleanco/__init__.py | 1 - cleanco/cleanco.py | 20 -------------------- setup.py | 2 +- 5 files changed, 12 insertions(+), 57 deletions(-) delete mode 100644 cleanco/cleanco.py diff --git a/CHANGES.txt b/CHANGES.txt index e81f23a..278c41d 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,11 +1,14 @@ Changelog ********** -2.2 (Unpublished) +2.2 (2021-11-16) ----------------- -- Nothing yet - +- Terms no longer need to be explicitly passed to basename() +- New custom_basename() can be used with custom terms +- prepare_terms() was renamed to prepare_default_terms() +- Tests were simplified +- Old class based API was removed 2.1 (2021-01-30) ---------------- diff --git a/README.md b/README.md index 99eea3e..f64ce87 100644 --- a/README.md +++ b/README.md @@ -26,14 +26,15 @@ Just use 'pip install cleanco' if you have pip installed (as most systems do). O ## How does it work? Let's look at some sample code. To get the base name of a business without legal suffix: - >>> from cleanco import prepare_default_terms, basename + >>> from cleanco import basename >>> business_name = "Some Big Pharma, LLC" - >>> terms = prepare_default_terms() - >>> basename(business_name, terms, prefix=False, middle=False, suffix=True) + >>> basename(business_name) >>> 'Some Big Pharma' Note that sometimes a name may have e.g. two different suffixes after one another. The cleanco -term data covers many of these but you may want to run `basename()` twice, just in case. +term data covers many of these, but you may want to run `basename()` twice on the name, just in case. + +If you want to use your custom terms, please see `custom_basename()` that also provides some other ways to adjust how base name is produced. To get the business type or country: @@ -49,34 +50,6 @@ To get the possible countries of jurisdiction: >>> matches("Some Big Pharma, LLC", classification_sources) ยด ['United States of America', 'Philippines'] -The legacy (versions < 2.0) way can still be used, too, but will eventually be discontinued: - -Import the utility class: - - >>> from cleanco import cleanco - -Prepare a string of a company name that you want to process: - - >>> business_name = "Some Big Pharma, LLC" - -Throw it into the instance: - - >>> x = cleanco(business_name) - -You can now get the company types: - - >>> x.type() - ['Limited Liability Company'] - -...the possible countries... - - >>> x.country() - ['United States of America', 'Philippines'] - -...and a clean version of the company name. - - >>> x.clean_name() - 'Some Big Pharma' ## Are there bugs? See the issue tracker. If you find a bug or have enhancement suggestion or question, please file an issue and provide a PR if you can. For example, some of the company suffixes may be incorrect or there may be suffixes missing. diff --git a/cleanco/__init__.py b/cleanco/__init__.py index 8b2de14..8cc9733 100644 --- a/cleanco/__init__.py +++ b/cleanco/__init__.py @@ -1,3 +1,2 @@ -from .cleanco import cleanco from .clean import prepare_default_terms, basename from .classify import typesources, countrysources, matches diff --git a/cleanco/cleanco.py b/cleanco/cleanco.py deleted file mode 100644 index 1322124..0000000 --- a/cleanco/cleanco.py +++ /dev/null @@ -1,20 +0,0 @@ -from .clean import basename -from .classify import typesources, countrysources, matches - - -class cleanco: - "silly backwards compatibility wrapper, you should NOT use this" - - def __init__(self, name): - self._name = name - self._types = typesources() - self._countries = countrysources() - - def clean_name(self): - return basename(self._name) - - def country(self): - return matches(self._name, self._countries) - - def type(self): - return matches(self._name, self._types) diff --git a/setup.py b/setup.py index d0180aa..d20e39d 100755 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ description='Python library to process company names', long_description=long_description, long_description_content_type='text/markdown', - version='2.2-dev0', + version='2.2', license="MIT", license_files=('LICENSE.txt',), classifiers = [