|
72 | 72 |
|
73 | 73 |
|
74 | 74 | def logThis(message):
|
| 75 | + """ |
| 76 | + This function is used to log messages if debug is enabled. |
| 77 | + """ |
75 | 78 | if debugMode:
|
76 | 79 | print(message)
|
77 | 80 |
|
78 | 81 |
|
79 | 82 | class CPF_Validator_N:
|
| 83 | + """ |
| 84 | + This class is used to validate CPF numbers. |
| 85 | + """ |
| 86 | + |
80 | 87 | def __init__(self, userCPF):
|
| 88 | + """ |
| 89 | + This function is used to initialize the class. |
| 90 | + """ |
81 | 91 | self.userCPF = userCPF
|
82 | 92 |
|
83 | 93 | @property
|
84 | 94 | def validateCPF(self):
|
| 95 | + """ |
| 96 | + This function is used to return the CPF validation. |
| 97 | + """ |
85 | 98 | return self.userCPF
|
86 | 99 |
|
87 | 100 | validCPF = None
|
88 | 101 |
|
89 | 102 | @staticmethod
|
90 | 103 | # Validates a CPF number with the easy way.
|
91 | 104 | def validateCPF(userCPF):
|
| 105 | + """ |
| 106 | + This function is used to validate and clean the CPF number. |
| 107 | + """ |
92 | 108 | # regular expression to remove any non-numeric characters, spaces, dots or dashes.
|
93 | 109 | userCPF = re.sub("[^0-9]", "", userCPF)
|
94 | 110 | logThis(userCPF)
|
@@ -137,6 +153,9 @@ def validateCPF(userCPF):
|
137 | 153 |
|
138 | 154 |
|
139 | 155 | if __name__ == "__main__":
|
| 156 | + """ |
| 157 | + This function is used to run the program. |
| 158 | + """ |
140 | 159 | if debugMode:
|
141 | 160 | sampleCPF = "113.314.390-35"
|
142 | 161 | CPF_Validator_N.validateCPF(sampleCPF)
|
0 commit comments