Best Python code snippet using lemoncheesecake
regexes.py
Source:regexes.py
1#!/usr/bin/env python2# vim:set et sw=4:3"""4Central repository of regexes for dak5@contact: Debian FTP Master <ftpmaster@debian.org>6@copyright: 2001, 2002, 2003, 2004, 2005, 2006 James Troup <james@nocrew.org>7@copyright: 2009 Mark Hymers <mhy@debian.org>8@copyright: 2009, 2010 Joerg Jaspert <joerg@debian.org>9@license: GNU General Public License version 2 or later10"""11# This program is free software; you can redistribute it and/or modify12# it under the terms of the GNU General Public License as published by13# the Free Software Foundation; either version 2 of the License, or14# (at your option) any later version.15# This program is distributed in the hope that it will be useful,16# but WITHOUT ANY WARRANTY; without even the implied warranty of17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the18# GNU General Public License for more details.19# You should have received a copy of the GNU General Public License20# along with this program; if not, write to the Free Software21# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA22###############################################################################23import re24#: Is it a number?25re_isanum = re.compile (r"^\d+$")26#: Looking for the default reply27re_default_answer = re.compile(r"\[(.*)\]")28#: Detect a binnmu29re_bin_only_nmu = re.compile(r"\+b\d+$")30#: To sort out comment lines31re_comments = re.compile(r"\#.*")32#: To ignore comment and whitespace lines.33re_whitespace_comment = re.compile(r"^\s*(#|$)")34re_no_epoch = re.compile(r"^\d+\:")35re_extract_src_version = re.compile (r"(\S+)\s*\((.*)\)")36re_isadeb = re.compile (r"(.+?)_(.+?)_(.+)\.u?deb$")37orig_source_ext_re = r"orig(?:-[a-zA-Z0-9-]+)?\.tar\.(?:gz|bz2|xz)(?:\.asc)?"38file_source_ext_re = "(" + orig_source_ext_re + r"|(?:debian\.)?tar\.(?:gz|bz2|xz)|diff\.gz)"39re_source_ext = re.compile("(" + file_source_ext_re + r"|dsc)$")40re_issource = re.compile(r"(.+)_(.+?)\." + re_source_ext.pattern)41re_single_line_field = re.compile(r"^(\S*?)\s*:\s*(.*)")42re_multi_line_field = re.compile(r"^\s(.*)")43re_taint_free = re.compile(r"^[-+~/\.\w]+$")44re_parse_maintainer = re.compile(r"^\s*(\S.*\S)\s*\<([^\>]+)\>")45re_srchasver = re.compile(r"^(\S+)\s+\((\S+)\)$")46re_verwithext = re.compile(r"^(\d+)(?:\.(\d+))(?:\s+\((\S+)\))?$")47html_escaping = {'"':'"', '&':'&', '<':'<', '>':'>'}48re_html_escaping = re.compile('|'.join(map(re.escape, html_escaping.keys())))49# From clean_proposed_updates.py50re_isdeb = re.compile (r"^(.+)_(.+?)_(.+?).u?deb$")51# From examine_package.py52re_package = re.compile(r"^(.+?)_.*")53re_doc_directory = re.compile(r".*/doc/([^/]*).*")54re_contrib = re.compile('^contrib/')55re_nonfree = re.compile('^non\-free/')56re_localhost = re.compile("localhost\.localdomain")57re_version = re.compile('^(.*)\((.*)\)')58re_newlinespace = re.compile('\n')59re_spacestrip = re.compile('(\s)')60# From new_security_install.py61re_taint_free = re.compile(r"^['/;\-\+\.~\s\w]+$")62# From process_unchecked.py63re_changelog_versions = re.compile(r"^\w[-+0-9a-z.]+ \([^\(\) \t]+\)")64# From dak/rm.py65re_strip_source_version = re.compile (r'\s+.*$')66re_build_dep_arch = re.compile(r"\[[^]]+\]")67# From dak/transitions.py68re_broken_package = re.compile(r"[a-zA-Z]\w+\s+\-.*")69# From dak/add_user.py70re_gpg_fingerprint_colon = re.compile(r"^fpr:+(.*):$", re.MULTILINE);71# The next one is dirty72re_user_address = re.compile(r"^pub:.*<(.*)@.*>.*$", re.MULTILINE);73re_user_mails = re.compile(r"^(pub|uid):[^rdin].*<(.*@.*)>.*$", re.MULTILINE);74re_user_name = re.compile(r"^pub:.*:(.*)<.*$", re.MULTILINE);75re_re_mark = re.compile(r'^RE:')76re_parse_lintian = re.compile(r"^(?P<level>W|E|O): (?P<package>.*?): (?P<tag>[^ ]*) ?(?P<description>.*)$")77# in generate-releases78re_gensubrelease = re.compile (r".*/(binary-[0-9a-z-]+|source)$")79re_includeinrelease = re.compile (r"(Translation-[a-zA-Z_]+\.(?:bz2|xz)|Contents-[0-9a-z-]+.gz|Index|Packages(.gz|.bz2|.xz)?|Sources(.gz|.bz2|.xz)?|Components-[0-9a-z-]+.yml(.gz|.xz)|icons-[0-9x-]+.tar(.gz|.xz)|.*_sigs\.tar\.xz|MD5SUMS|SHA256SUMS|Release)$")80# in generate_index_diffs81re_includeinpdiff = re.compile(r"(Translation-[a-zA-Z_]+\.(?:bz2|xz))")82######################################################################83# Patterns matching filenames #84######################################################################85# Match safe filenames86re_file_safe = re.compile(r'^[a-zA-Z0-9][a-zA-Z0-9_.~+-]*$')87# Match safe filenames, including slashes88re_file_safe_slash = re.compile(r'^[a-zA-Z0-9][/a-zA-Z0-9_.~+-]*$')89# Prefix of binary and source filenames90_re_file_prefix = r'^(?P<package>[a-z0-9][a-z0-9.+-]+)_(?P<version>[A-Za-z0-9.~+-]+?)'91# Match binary packages92# Groups: package, version, architecture, type93re_file_binary = re.compile(_re_file_prefix + r'_(?P<architecture>[a-z0-9-]+)\.(?P<type>u?deb)$')94# Match changes files95# Groups: package, version, suffix96re_file_changes = re.compile(_re_file_prefix + r'_(?P<suffix>[a-zA-Z0-9+-]+)\.changes$')97# Match dsc files98# Groups: package, version99re_file_dsc = re.compile(_re_file_prefix + r'\.dsc$')100# Match other source files101# Groups: package, version102re_file_source = re.compile(_re_file_prefix + r'\.' + file_source_ext_re)103# Match upstream tarball104# Groups: package, version105re_file_orig = re.compile(_re_file_prefix + r'\.' + orig_source_ext_re)106# Match buildinfo file107# Groups: package, version, suffix108re_file_buildinfo = re.compile(_re_file_prefix + r'_(?P<suffix>[a-zA-Z0-9+-]+)\.buildinfo$')109######################################################################110# Patterns matching fields #111######################################################################112# Match package name113re_field_package = re.compile(r'^[a-z0-9][a-z0-9.+-]+$')114# Match version115# Groups: without-epoch116re_field_version = re.compile(r'^(?:[0-9]+:)?(?P<without_epoch>[A-Za-z0-9.:~+-]+)$')117# Extract upstream version118# Groups: upstream119re_field_version_upstream = re.compile(r'^(?:[0-9]+:)?(?P<upstream>.*)-[^-]*$')120# Match source field121# Groups: package, version...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!