From 12cf076118570eebbff08c6b3090e0d4798447a1 Mon Sep 17 00:00:00 2001 From: cyfraeviolae Date: Wed, 3 Apr 2024 03:17:55 -0400 Subject: no venv --- .../faker/providers/ssn/pt_BR/__init__.py | 64 --------------------- .../ssn/pt_BR/__pycache__/__init__.cpython-311.pyc | Bin 3921 -> 0 bytes 2 files changed, 64 deletions(-) delete mode 100644 venv/lib/python3.11/site-packages/faker/providers/ssn/pt_BR/__init__.py delete mode 100644 venv/lib/python3.11/site-packages/faker/providers/ssn/pt_BR/__pycache__/__init__.cpython-311.pyc (limited to 'venv/lib/python3.11/site-packages/faker/providers/ssn/pt_BR') diff --git a/venv/lib/python3.11/site-packages/faker/providers/ssn/pt_BR/__init__.py b/venv/lib/python3.11/site-packages/faker/providers/ssn/pt_BR/__init__.py deleted file mode 100644 index 1efac15..0000000 --- a/venv/lib/python3.11/site-packages/faker/providers/ssn/pt_BR/__init__.py +++ /dev/null @@ -1,64 +0,0 @@ -from typing import List - -from .. import Provider as SsnProvider - - -def checksum(digits: List[int]) -> int: - """ - Returns the checksum of CPF digits. - References to the algorithm: - https://pt.wikipedia.org/wiki/Cadastro_de_pessoas_f%C3%ADsicas#Algoritmo - https://metacpan.org/source/MAMAWE/Algorithm-CheckDigits-v1.3.0/lib/Algorithm/CheckDigits/M11_004.pm - """ - s = 0 - p = len(digits) + 1 - for i in range(0, len(digits)): - s += digits[i] * p - p -= 1 - - reminder = s % 11 - if reminder == 0 or reminder == 1: - return 0 - else: - return 11 - reminder - - -class Provider(SsnProvider): - """ - Provider for Brazilian SSN also known in Brazil as CPF. - There are two methods Provider.ssn and Provider.cpf - The snn returns a valid number with numbers only - The cpf return a valid number formatted with brazilian mask. eg nnn.nnn.nnn-nn - """ - - def ssn(self) -> str: - digits = self.generator.random.sample(range(10), 9) - - dv = checksum(digits) - digits.append(dv) - digits.append(checksum(digits)) - - return "".join(map(str, digits)) - - def cpf(self) -> str: - c = self.ssn() - return c[:3] + "." + c[3:6] + "." + c[6:9] + "-" + c[9:] - - def rg(self) -> str: - """ - Brazilian RG, return plain numbers. - Check: https://www.ngmatematica.com/2014/02/como-determinar-o-digito-verificador-do.html - """ - - digits = self.generator.random.sample(range(0, 9), 8) - checksum = sum(i * digits[i - 2] for i in range(2, 10)) - last_digit = 11 - (checksum % 11) - - if last_digit == 10: - digits.append("X") - elif last_digit == 11: - digits.append(0) - else: - digits.append(last_digit) - - return "".join(map(str, digits)) diff --git a/venv/lib/python3.11/site-packages/faker/providers/ssn/pt_BR/__pycache__/__init__.cpython-311.pyc b/venv/lib/python3.11/site-packages/faker/providers/ssn/pt_BR/__pycache__/__init__.cpython-311.pyc deleted file mode 100644 index 072caa2..0000000 Binary files a/venv/lib/python3.11/site-packages/faker/providers/ssn/pt_BR/__pycache__/__init__.cpython-311.pyc and /dev/null differ -- cgit v1.2.3