예제 #1
0
 def escape(self, string, *args):
     """Less Escape.
     args:
         string (str): string to escape
     returns:
         str
     """
     return utility.destring(string.strip('~'))
예제 #2
0
 def escape(self, string, *args):
     """Less Escape.
     args:
         string (str): string to escape
     returns:
         str
     """
     return utility.destring(string.strip('~'))
예제 #3
0
파일: call.py 프로젝트: armirusco/Lesscpy
 def isurl(self, string, *args):
     """Is url
     args:
         string (str): match
     returns:
         bool
     """
     arg = utility.destring(string)
     regex = re.compile(r'^(?:http|ftp)s?://' # http:// or https://
                        r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}\.?)|' #domain...
                        r'localhost|' #localhost...
                        r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})' # ...or ip
                        r'(?::\d+)?' # optional port
                        r'(?:/?|[/?]\S+)$', re.IGNORECASE)
     return regex.match(arg)
예제 #4
0
 def isurl(self, string, *args):
     """Is url
     args:
         string (str): match
     returns:
         bool
     """
     arg = utility.destring(string)
     regex = re.compile(
         r'^(?:http|ftp)s?://'  # http:// or https://
         r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+'
         r'(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}\.?)|'  # domain...
         # localhost...
         r'localhost|'
         r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})'  # ...or ip
         # optional port
         r'(?::\d+)?'
         r'(?:/?|[/?]\S+)$',
         re.IGNORECASE)
     return regex.match(arg)