Repository: brazilian-utils/brutils-python (python)

Issue:
Add `parse_cnpj` method
To map `sieve` to `parse_cnpj` in order to make the name compatible with the [js brutils](https://brazilian-utils.com.br/#/utilities)

Pull request:
feat: add parse cnpj method
closes #56 

Patch:
diff --git a/README.md b/README.md
index 34ab790..8056d47 100644
--- a/README.md
+++ b/README.md
@@ -39,10 +39,10 @@ False
 
 ### What if my string has formatting symbols in it?
 ```
->>> from brutils import parse_cpf
+>>> from brutils import parse_cpf, parse_cnpj
 >>> parse_cpf('000.111.222-33')
 '00011122233'
->>> cnpj.sieve('00.111.222/0001-00')
+>>> parse_cnpj('00.111.222/0001-00')
 '00111222000100'
 
 # The `sieve` function only filters out the symbols used for CPF or CNPJ validation.
diff --git a/README_PT_BR.md b/README_PT_BR.md
index dead564..e897ec0 100644
--- a/README_PT_BR.md
+++ b/README_PT_BR.md
@@ -41,10 +41,10 @@ False
 
 ### E se a minha string estiver formatada com simbolos?
 ```
->>> from brutils import parse_cpf
+>>> from brutils import parse_cpf, parse_cnpj
 >>> parse_cpf('000.111.222-33')
 '00011122233'
->>> cnpj.sieve('00.111.222/0001-00')
+>>> parse_cnpj('00.111.222/0001-00')
 '00111222000100'
 
 # A função `sieve` limpa apenas os simbolos de formatação de CPF ou CNPJ, e de
diff --git a/brutils/__init__.py b/brutils/__init__.py
index 6df0523..72d9a42 100644
--- a/brutils/__init__.py
+++ b/brutils/__init__.py
@@ -1,2 +1,6 @@
 from brutils.cpf import is_valid as is_valid_cpf, format_cpf, parse as parse_cpf
-from brutils.cnpj import is_valid as is_valid_cnpj, format_cnpj
+from brutils.cnpj import (
+    is_valid as is_valid_cnpj,
+    format_cnpj,
+    parse as parse_cnpj,
+)
diff --git a/brutils/cnpj.py b/brutils/cnpj.py
index 39bdcb8..9e64e2b 100644
--- a/brutils/cnpj.py
+++ b/brutils/cnpj.py
@@ -16,6 +16,16 @@ def sieve(dirty):  # type: (str) -> str
     return "".join(filter(lambda char: char not in "./-", dirty))
 
 
+def parse(dirty):  # type: (str) -> str
+    """
+    Filters out CNPJ formatting symbols. Symbols that are not used
+    in the CNPJ formatting are left unfiltered on purpose so that
+    if fails other tests, because their presence indicate that the
+    input was somehow corrupted.
+    """
+    return sieve(dirty)
+
+
 def display(cnpj):  # type: (str) -> str
     """
     Will format an adequately formatted numbers-only CNPJ string,


Test patch:
diff --git a/tests/test_cnpj.py b/tests/test_cnpj.py
index 78e18b9..7f95949 100644
--- a/tests/test_cnpj.py
+++ b/tests/test_cnpj.py
@@ -17,6 +17,7 @@ from brutils.cnpj import (
     generate,
     is_valid,
     format_cnpj,
+    parse,
 )
 from unittest import TestCase, main
 
@@ -30,6 +31,14 @@ class CNPJ(TestCase):
         assert sieve("ab.c1.--.2-3/09.-1-./6/-.*.-!*&#") == "abc1230916*!*&#"
         assert sieve("/...---.../") == ""
 
+    def test_parse(self):
+        assert parse("00000000000") == "00000000000"
+        assert parse("12.345.678/0001-90") == "12345678000190"
+        assert parse("134..2435/.-1892.-") == "13424351892"
+        assert parse("abc1230916*!*&#") == "abc1230916*!*&#"
+        assert parse("ab.c1.--.2-3/09.-1-./6/-.*.-!*&#") == "abc1230916*!*&#"
+        assert parse("/...---.../") == ""
+
     def test_display(self):
         assert display("00000000000109") == "00.000.000/0001-09"
         assert display("00000000000000") is None