File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change 1+ # emails_isim_soyisim.py
2+ import re
3+
4+ class Emails (list ):
5+ def __init__ (self , email_list ):
6+ self .validate (email_list )
7+
8+ unique_emails = []
9+ for email in email_list :
10+ if email not in unique_emails :
11+ unique_emails .append (email )
12+
13+ self .data = unique_emails
14+
15+ super ().__init__ (unique_emails )
16+
17+ def validate (self , email_list ):
18+ """Email listesini validate eder"""
19+ for email in email_list :
20+ if not isinstance (email , str ):
21+ raise ValueError (f"{ email } is not a string" )
22+
23+ if '@' not in email or '.' not in email :
24+ raise ValueError (f"{ email } is not a valid email address" )
25+
26+ if email .index ('@' ) > email .rindex ('.' ):
27+ raise ValueError (f"{ email } is not a valid email address" )
28+
29+ def __repr__ (self ):
30+ """repr() fonksiyonu için"""
31+ return f"Emails({ self .data } )"
32+
33+ def __str__ (self ):
34+ """print() için"""
35+ return f"Emails({ self .data } )"
You can’t perform that action at this time.
0 commit comments