Skip to content

Commit 67dcf61

Browse files
committed
-
1 parent c2dae08 commit 67dcf61

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

python_toolbox/cute_profile/cute_profile.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import functools
1111
import marshal
1212

13+
from python_toolbox import misc_tools
1314
from python_toolbox import decorator_tools
1415

1516
from . import base_profile
@@ -96,6 +97,8 @@ def inner(function_, *args, **kwargs):
9697
'decorated_function.original_function(*args, **kwargs)',
9798
globals(), locals()
9899
)
100+
101+
if misc_tools
99102

100103
Z Z Z Do shit depending on `profile_handler`. Allow filename, folder, email address, or index for printing (sort). In any case do everything on a thread.
101104

python_toolbox/misc_tools/misc_tools.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,18 @@
1313

1414
from python_toolbox import cute_iter_tools
1515

16+
17+
_email_pattern = re.compile(
18+
r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*"
19+
r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-\011\013\014\016'
20+
r'-\177])*"'
21+
r')@((?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}\.?|'
22+
r'[A-Z0-9-]{2,}\.?)$)'
23+
r'|\[(25[0-5]|2[0-4]\d|[0-1]?\d?\d)(\.(25[0-5]|2[0-4]\d|'
24+
r'[0-1]?\d?\d)){3}\]$',
25+
re.IGNORECASE
26+
)
27+
1628

1729
def is_subclass(candidate, base_class):
1830
'''
@@ -254,4 +266,6 @@ def general_product(things, start=None):
254266
else:
255267
return reduce(operator.mul, things, start)
256268

257-
269+
270+
def is_legal_email_address(email_address_candidate):
271+
return bool(_email_pattern.match(email_address_candidate))

0 commit comments

Comments
 (0)