Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c7182c2

Browse files
Adding docstrings
1 parent cd8bd6c commit c7182c2

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

‎Problem Solving Scripts/CPF_Checker.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,23 +72,39 @@
7272

7373

7474
def logThis(message):
75+
"""
76+
This function is used to log messages if debug is enabled.
77+
"""
7578
if debugMode:
7679
print(message)
7780

7881

7982
class CPF_Validator_N:
83+
"""
84+
This class is used to validate CPF numbers.
85+
"""
86+
8087
def __init__(self, userCPF):
88+
"""
89+
This function is used to initialize the class.
90+
"""
8191
self.userCPF = userCPF
8292

8393
@property
8494
def validateCPF(self):
95+
"""
96+
This function is used to return the CPF validation.
97+
"""
8598
return self.userCPF
8699

87100
validCPF = None
88101

89102
@staticmethod
90103
# Validates a CPF number with the easy way.
91104
def validateCPF(userCPF):
105+
"""
106+
This function is used to validate and clean the CPF number.
107+
"""
92108
# regular expression to remove any non-numeric characters, spaces, dots or dashes.
93109
userCPF = re.sub("[^0-9]", "", userCPF)
94110
logThis(userCPF)
@@ -137,6 +153,9 @@ def validateCPF(userCPF):
137153

138154

139155
if __name__ == "__main__":
156+
"""
157+
This function is used to run the program.
158+
"""
140159
if debugMode:
141160
sampleCPF = "113.314.390-35"
142161
CPF_Validator_N.validateCPF(sampleCPF)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /