# HG changeset patch # User Andrey Skvortsov # Date 1539075405 -10800 # Node ID f0a040f1de1be0286a78245ff71eb00e709aedba # Parent 0f2e5303f212ee520b9dd80fa15aad82e663db09 Fix pep8 warning: W605 invalid escape sequence ?x? diff -r 0f2e5303f212 -r f0a040f1de1b Beremiz_service.py --- a/Beremiz_service.py Tue Oct 09 11:43:39 2018 +0300 +++ b/Beremiz_service.py Tue Oct 09 11:56:45 2018 +0300 @@ -328,7 +328,7 @@ ip_addr = self.pyroserver.ip_addr ip_addr = '' if ip_addr is None else ip_addr dlg = ParamsEntryDialog(None, _("Enter the IP of the interface to bind"), defaultValue=ip_addr) - dlg.SetTests([(re.compile('\d{1,3}(?:\.\d{1,3}){3}$').match, _("IP is not valid!")), + dlg.SetTests([(re.compile(r'\d{1,3}(?:\.\d{1,3}){3}$').match, _("IP is not valid!")), (lambda x:len([x for x in x.split(".") if 0 <= int(x) <= 255]) == 4, _("IP is not valid!"))]) if dlg.ShowModal() == wx.ID_OK: diff -r 0f2e5303f212 -r f0a040f1de1b CodeFileTreeNode.py --- a/CodeFileTreeNode.py Tue Oct 09 11:43:39 2018 +0300 +++ b/CodeFileTreeNode.py Tue Oct 09 11:56:45 2018 +0300 @@ -114,8 +114,8 @@ '<%s>' % self.CODEFILE_NAME, '<%s xmlns:xhtml="http://www.w3.org/1999/xhtml">' % self.CODEFILE_NAME) for cre, repl in [ - (re.compile("(?)(?:)(?!)"), "]]>")]: + (re.compile(r"(?)(?:)(?!)"), "]]>")]: codefile_xml = cre.sub(repl, codefile_xml) try: diff -r 0f2e5303f212 -r f0a040f1de1b PLCControler.py --- a/PLCControler.py Tue Oct 09 11:43:39 2018 +0300 +++ b/PLCControler.py Tue Oct 09 11:56:45 2018 +0300 @@ -44,8 +44,8 @@ from graphics.GraphicCommons import * from PLCGenerator import * -duration_model = re.compile("(?:([0-9]{1,2})h)?(?:([0-9]{1,2})m(?!s))?(?:([0-9]{1,2})s)?(?:([0-9]{1,3}(?:\.[0-9]*)?)ms)?") -VARIABLE_NAME_SUFFIX_MODEL = re.compile('(\d+)$') +duration_model = re.compile(r"(?:([0-9]{1,2})h)?(?:([0-9]{1,2})m(?!s))?(?:([0-9]{1,2})s)?(?:([0-9]{1,3}(?:\.[0-9]*)?)ms)?") +VARIABLE_NAME_SUFFIX_MODEL = re.compile(r'(\d+)$') ScriptDirectory = paths.AbsDir(__file__) diff -r 0f2e5303f212 -r f0a040f1de1b ProjectController.py --- a/ProjectController.py Tue Oct 09 11:43:39 2018 +0300 +++ b/ProjectController.py Tue Oct 09 11:56:45 2018 +0300 @@ -68,7 +68,7 @@ base_folder = paths.AbsParentDir(__file__) MATIEC_ERROR_MODEL = re.compile( - ".*\.st:(\d+)-(\d+)\.\.(\d+)-(\d+): (?:error)|(?:warning) : (.*)$") + r".*\.st:(\d+)-(\d+)\.\.(\d+)-(\d+): (?:error)|(?:warning) : (.*)$") def ExtractChildrenTypesFromCatalog(catalog): @@ -713,7 +713,7 @@ lines = [line.strip() for line in location_file.readlines()] # This regular expression parses the lines genereated by IEC2C LOCATED_MODEL = re.compile( - "__LOCATED_VAR\((?P[A-Z]*),(?P[_A-Za-z0-9]*),(?P[QMI])(?:,(?P[XBWDL]))?,(?P[,0-9]*)\)") + r"__LOCATED_VAR\((?P[A-Z]*),(?P[_A-Za-z0-9]*),(?P[QMI])(?:,(?P[XBWDL]))?,(?P[,0-9]*)\)") for line in lines: # If line match RE, result = LOCATED_MODEL.match(line) diff -r 0f2e5303f212 -r f0a040f1de1b controls/VariablePanel.py --- a/controls/VariablePanel.py Tue Oct 09 11:43:39 2018 +0300 +++ b/controls/VariablePanel.py Tue Oct 09 11:56:45 2018 +0300 @@ -101,8 +101,8 @@ "External": lambda x: {"Constant": "Constant"}.get(x, "") } -LOCATION_MODEL = re.compile("((?:%[IQM](?:\*|(?:[XBWLD]?[0-9]+(?:\.[0-9]+)*)))?)$") -LOCATION_MODEL_SET = re.compile("((?:%[IQM](?:[XBWLD]?[0-9]+(?:\.[0-9]+)*))?)$") +LOCATION_MODEL = re.compile(r"((?:%[IQM](?:\*|(?:[XBWLD]?[0-9]+(?:\.[0-9]+)*)))?)$") +LOCATION_MODEL_SET = re.compile(r"((?:%[IQM](?:[XBWLD]?[0-9]+(?:\.[0-9]+)*))?)$") # ------------------------------------------------------------------------------- @@ -606,7 +606,7 @@ # increment location address if row_content.Location != "" and LOCATION_MODEL_SET.match(row_content.Location): old_location = row_content.Location - model = re.compile("%[IQM][XBWLD]?(.*\.|)") + model = re.compile(r"%[IQM][XBWLD]?(.*\.|)") prefix = model.match(old_location).group(0) addr = int(re.split(model, old_location)[-1]) + 1 row_content.Location = prefix + text(addr) diff -r 0f2e5303f212 -r f0a040f1de1b dialogs/ArrayTypeDialog.py --- a/dialogs/ArrayTypeDialog.py Tue Oct 09 11:43:39 2018 +0300 +++ b/dialogs/ArrayTypeDialog.py Tue Oct 09 11:56:45 2018 +0300 @@ -34,7 +34,7 @@ # Helpers # ------------------------------------------------------------------------------- -DIMENSION_MODEL = re.compile("([0-9]+)\.\.([0-9]+)$") +DIMENSION_MODEL = re.compile(r"([0-9]+)\.\.([0-9]+)$") # ------------------------------------------------------------------------------- # Array Type Dialog diff -r 0f2e5303f212 -r f0a040f1de1b dialogs/DurationEditorDialog.py --- a/dialogs/DurationEditorDialog.py Tue Oct 09 11:43:39 2018 +0300 +++ b/dialogs/DurationEditorDialog.py Tue Oct 09 11:56:45 2018 +0300 @@ -41,7 +41,7 @@ HOUR = 60 * MINUTE DAY = 24 * HOUR -IEC_TIME_MODEL = re.compile("(?:T|TIME)#(-)?(?:(%(float)s)D_?)?(?:(%(float)s)H_?)?(?:(%(float)s)M(?!S)_?)?(?:(%(float)s)S_?)?(?:(%(float)s)MS)?$" % {"float": "[0-9]+(?:\.[0-9]+)?"}) +IEC_TIME_MODEL = re.compile(r"(?:T|TIME)#(-)?(?:(%(float)s)D_?)?(?:(%(float)s)H_?)?(?:(%(float)s)M(?!S)_?)?(?:(%(float)s)S_?)?(?:(%(float)s)MS)?$" % {"float": r"[0-9]+(?:\.[0-9]+)?"}) # ------------------------------------------------------------------------------- diff -r 0f2e5303f212 -r f0a040f1de1b dialogs/ForceVariableDialog.py --- a/dialogs/ForceVariableDialog.py Tue Oct 09 11:43:39 2018 +0300 +++ b/dialogs/ForceVariableDialog.py Tue Oct 09 11:56:45 2018 +0300 @@ -70,10 +70,10 @@ HOUR = 60 * MINUTE DAY = 24 * HOUR -IEC_TIME_MODEL = re.compile("(?:(?:T|TIME)#)?(-)?(?:(%(float)s)D_?)?(?:(%(float)s)H_?)?(?:(%(float)s)M(?!S)_?)?(?:(%(float)s)S_?)?(?:(%(float)s)MS)?$" % {"float": "[0-9]+(?:\.[0-9]+)?"}) -IEC_DATE_MODEL = re.compile("(?:(?:D|DATE)#)?([0-9]{4})-([0-9]{2})-([0-9]{2})$") -IEC_DATETIME_MODEL = re.compile("(?:(?:DT|DATE_AND_TIME)#)?([0-9]{4})-([0-9]{2})-([0-9]{2})-([0-9]{2}):([0-9]{2}):([0-9]{2}(?:\.[0-9]+)?)$") -IEC_TIMEOFDAY_MODEL = re.compile("(?:(?:TOD|TIME_OF_DAY)#)?([0-9]{2}):([0-9]{2}):([0-9]{2}(?:\.[0-9]+)?)$") +IEC_TIME_MODEL = re.compile(r"(?:(?:T|TIME)#)?(-)?(?:(%(float)s)D_?)?(?:(%(float)s)H_?)?(?:(%(float)s)M(?!S)_?)?(?:(%(float)s)S_?)?(?:(%(float)s)MS)?$" % {"float": r"[0-9]+(?:\.[0-9]+)?"}) +IEC_DATE_MODEL = re.compile(r"(?:(?:D|DATE)#)?([0-9]{4})-([0-9]{2})-([0-9]{2})$") +IEC_DATETIME_MODEL = re.compile(r"(?:(?:DT|DATE_AND_TIME)#)?([0-9]{4})-([0-9]{2})-([0-9]{2})-([0-9]{2}):([0-9]{2}):([0-9]{2}(?:\.[0-9]+)?)$") +IEC_TIMEOFDAY_MODEL = re.compile(r"(?:(?:TOD|TIME_OF_DAY)#)?([0-9]{2}):([0-9]{2}):([0-9]{2}(?:\.[0-9]+)?)$") def gettime(v): diff -r 0f2e5303f212 -r f0a040f1de1b editors/DataTypeEditor.py --- a/editors/DataTypeEditor.py Tue Oct 09 11:43:39 2018 +0300 +++ b/editors/DataTypeEditor.py Tue Oct 09 11:56:45 2018 +0300 @@ -44,7 +44,7 @@ # Helpers # ------------------------------------------------------------------------------- -DIMENSION_MODEL = re.compile("([0-9]+)\.\.([0-9]+)$") +DIMENSION_MODEL = re.compile(r"([0-9]+)\.\.([0-9]+)$") def AppendMenu(parent, help, id, kind, text): diff -r 0f2e5303f212 -r f0a040f1de1b etherlab/ConfigEditor.py --- a/etherlab/ConfigEditor.py Tue Oct 09 11:43:39 2018 +0300 +++ b/etherlab/ConfigEditor.py Tue Oct 09 11:56:45 2018 +0300 @@ -72,7 +72,7 @@ ETHERCAT_INDEX_MODEL = re.compile("#x([0-9a-fA-F]{0,4})$") ETHERCAT_SUBINDEX_MODEL = re.compile("#x([0-9a-fA-F]{0,2})$") -LOCATION_MODEL = re.compile("(?:%[IQM](?:[XBWLD]?([0-9]+(?:\.[0-9]+)*)))$") +LOCATION_MODEL = re.compile(r"(?:%[IQM](?:[XBWLD]?([0-9]+(?:\.[0-9]+)*)))$") class NodeVariablesSizer(wx.FlexGridSizer): diff -r 0f2e5303f212 -r f0a040f1de1b i18n/mki18n.py --- a/i18n/mki18n.py Tue Oct 09 11:43:39 2018 +0300 +++ b/i18n/mki18n.py Tue Oct 09 11:56:45 2018 +0300 @@ -214,10 +214,10 @@ verbosePrint(verbose, cmd) os.system(cmd) - XSD_STRING_MODEL = re.compile("]*\>") + XSD_STRING_MODEL = re.compile(r"]*\>") processCustomFiles(filelist, fileout, XSD_STRING_MODEL, 'Extra XSD strings') - XML_TC6_STRING_MODEL = re.compile("\s*\s*", re.MULTILINE | re.DOTALL) + XML_TC6_STRING_MODEL = re.compile(r"\s*\s*", re.MULTILINE | re.DOTALL) processCustomFiles(filelist, fileout, XML_TC6_STRING_MODEL, 'Extra TC6 documentation strings') # generate messages.po diff -r 0f2e5303f212 -r f0a040f1de1b plcopen/plcopen.py --- a/plcopen/plcopen.py Tue Oct 09 11:43:39 2018 +0300 +++ b/plcopen/plcopen.py Tue Oct 09 11:56:45 2018 +0300 @@ -79,7 +79,7 @@ ("SL", True)]) -FILTER_ADDRESS_MODEL = "(%%[IQM](?:[XBWDL])?)(%s)((?:\.[0-9]+)*)" +FILTER_ADDRESS_MODEL = r"(%%[IQM](?:[XBWDL])?)(%s)((?:\.[0-9]+)*)" def update_address(address, address_model, new_leading): @@ -231,8 +231,8 @@ "http://www.plcopen.org/xml/tc6.xsd", "http://www.plcopen.org/xml/tc6_0201") for cre, repl in [ - (re.compile("(?)(?:)(?!)"), "]]>")]: + (re.compile(r"(?)(?:)(?!)"), "]]>")]: project_xml = cre.sub(repl, project_xml) try: @@ -2876,7 +2876,7 @@ cls = PLCOpenParser.GetElementClass("arrayValue", "value") if cls: - arrayValue_model = re.compile("([0-9]+)\((.*)\)$") + arrayValue_model = re.compile(r"([0-9]+)\((.*)\)$") _updateArrayValueValueClass(cls) # ---------------------------------------------------------------------- diff -r 0f2e5303f212 -r f0a040f1de1b py_ext/PythonFileCTNMixin.py --- a/py_ext/PythonFileCTNMixin.py Tue Oct 09 11:43:39 2018 +0300 +++ b/py_ext/PythonFileCTNMixin.py Tue Oct 09 11:56:45 2018 +0300 @@ -63,8 +63,8 @@ 'xmlns="http://www.w3.org/2001/XMLSchema"', 'xmlns:xhtml="http://www.w3.org/1999/xhtml"') for cre, repl in [ - (re.compile("(?)(?:)(?!)"), "]]>")]: + (re.compile(r"(?)(?:)(?!)"), "]]>")]: pythonfile_xml = cre.sub(repl, pythonfile_xml) try: diff -r 0f2e5303f212 -r f0a040f1de1b svgui/pyjs/build.py --- a/svgui/pyjs/build.py Tue Oct 09 11:43:39 2018 +0300 +++ b/svgui/pyjs/build.py Tue Oct 09 11:56:45 2018 +0300 @@ -45,7 +45,7 @@ # .cache.html files produces look like this -CACHE_HTML_PAT = re.compile('^[a-z]*.[0-9a-f]{32}\.cache\.html$') +CACHE_HTML_PAT = re.compile(r'^[a-z]*.[0-9a-f]{32}\.cache\.html$') # ok these are the three "default" library directories, containing # the builtins (str, List, Dict, ord, round, len, range etc.) diff -r 0f2e5303f212 -r f0a040f1de1b svgui/pyjs/lib/pyjslib.py --- a/svgui/pyjs/lib/pyjslib.py Tue Oct 09 11:43:39 2018 +0300 +++ b/svgui/pyjs/lib/pyjslib.py Tue Oct 09 11:56:45 2018 +0300 @@ -285,7 +285,7 @@ return "AttributeError: %s of %s" % (self.args[1], self.args[0]) -JS(""" +JS(r""" pyjslib.StopIteration = function () { }; pyjslib.StopIteration.prototype = new Error(); pyjslib.StopIteration.name = 'StopIteration'; diff -r 0f2e5303f212 -r f0a040f1de1b targets/toolchain_gcc.py --- a/targets/toolchain_gcc.py Tue Oct 09 11:43:39 2018 +0300 +++ b/targets/toolchain_gcc.py Tue Oct 09 11:56:45 2018 +0300 @@ -33,7 +33,7 @@ from util.ProcessLogger import ProcessLogger -includes_re = re.compile('\s*#include\s*["<]([^">]*)[">].*') +includes_re = re.compile(r'\s*#include\s*["<]([^">]*)[">].*') class toolchain_gcc(object): diff -r 0f2e5303f212 -r f0a040f1de1b targets/toolchain_makefile.py --- a/targets/toolchain_makefile.py Tue Oct 09 11:43:39 2018 +0300 +++ b/targets/toolchain_makefile.py Tue Oct 09 11:56:45 2018 +0300 @@ -32,7 +32,7 @@ from util.ProcessLogger import ProcessLogger -includes_re = re.compile('\s*#include\s*["<]([^">]*)[">].*') +includes_re = re.compile(r'\s*#include\s*["<]([^">]*)[">].*') class toolchain_makefile(object): diff -r 0f2e5303f212 -r f0a040f1de1b xmlclass/xmlclass.py --- a/xmlclass/xmlclass.py Tue Oct 09 11:43:39 2018 +0300 +++ b/xmlclass/xmlclass.py Tue Oct 09 11:56:45 2018 +0300 @@ -61,24 +61,24 @@ # Regular expression models for checking all kind of # string values defined in XML standard -Name_model = re.compile('([a-zA-Z_\:][\w\.\-\:]*)$') -Names_model = re.compile('([a-zA-Z_\:][\w\.\-\:]*(?: [a-zA-Z_\:][\w\.\-\:]*)*)$') -NMToken_model = re.compile('([\w\.\-\:]*)$') -NMTokens_model = re.compile('([\w\.\-\:]*(?: [\w\.\-\:]*)*)$') -QName_model = re.compile('((?:[a-zA-Z_][\w]*:)?[a-zA-Z_][\w]*)$') -QNames_model = re.compile('((?:[a-zA-Z_][\w]*:)?[a-zA-Z_][\w]*(?: (?:[a-zA-Z_][\w]*:)?[a-zA-Z_][\w]*)*)$') -NCName_model = re.compile('([a-zA-Z_][\w]*)$') -URI_model = re.compile('((?:htt(p|ps)://|/)?(?:[\w.-]*/?)*)$') -LANGUAGE_model = re.compile('([a-zA-Z]{1,8}(?:-[a-zA-Z0-9]{1,8})*)$') - -ONLY_ANNOTATION = re.compile("((?:annotation )?)") +Name_model = re.compile(r'([a-zA-Z_\:][\w\.\-\:]*)$') +Names_model = re.compile(r'([a-zA-Z_\:][\w\.\-\:]*(?: [a-zA-Z_\:][\w\.\-\:]*)*)$') +NMToken_model = re.compile(r'([\w\.\-\:]*)$') +NMTokens_model = re.compile(r'([\w\.\-\:]*(?: [\w\.\-\:]*)*)$') +QName_model = re.compile(r'((?:[a-zA-Z_][\w]*:)?[a-zA-Z_][\w]*)$') +QNames_model = re.compile(r'((?:[a-zA-Z_][\w]*:)?[a-zA-Z_][\w]*(?: (?:[a-zA-Z_][\w]*:)?[a-zA-Z_][\w]*)*)$') +NCName_model = re.compile(r'([a-zA-Z_][\w]*)$') +URI_model = re.compile(r'((?:htt(p|ps)://|/)?(?:[\w.-]*/?)*)$') +LANGUAGE_model = re.compile(r'([a-zA-Z]{1,8}(?:-[a-zA-Z0-9]{1,8})*)$') + +ONLY_ANNOTATION = re.compile(r"((?:annotation )?)") """ Regular expression models for extracting dates and times from a string """ -time_model = re.compile('([0-9]{2}):([0-9]{2}):([0-9]{2}(?:\.[0-9]*)?)(?:Z)?$') -date_model = re.compile('([0-9]{4})-([0-9]{2})-([0-9]{2})((?:[\-\+][0-9]{2}:[0-9]{2})|Z)?$') -datetime_model = re.compile('([0-9]{4})-([0-9]{2})-([0-9]{2})[ T]([0-9]{2}):([0-9]{2}):([0-9]{2}(?:\.[0-9]*)?)((?:[\-\+][0-9]{2}:[0-9]{2})|Z)?$') +time_model = re.compile(r'([0-9]{2}):([0-9]{2}):([0-9]{2}(?:\.[0-9]*)?)(?:Z)?$') +date_model = re.compile(r'([0-9]{4})-([0-9]{2})-([0-9]{2})((?:[\-\+][0-9]{2}:[0-9]{2})|Z)?$') +datetime_model = re.compile(r'([0-9]{4})-([0-9]{2})-([0-9]{2})[ T]([0-9]{2}):([0-9]{2}):([0-9]{2}(?:\.[0-9]*)?)((?:[\-\+][0-9]{2}:[0-9]{2})|Z)?$') class xml_timezone(datetime.tzinfo): @@ -1249,7 +1249,7 @@ if element["type"] == ANY: infos = element.copy() infos["minOccurs"] = 0 - elements.append(ComputeMultiplicity("#text |#cdata-section |\w* ", infos)) + elements.append(ComputeMultiplicity(r"#text |#cdata-section |\w* ", infos)) elif element["type"] == CHOICE: choices = [] for infos in element["choices"]: @@ -1721,7 +1721,7 @@ return countMethod -NAMESPACE_PATTERN = re.compile("xmlns(?:\:[^\=]*)?=\"[^\"]*\" ") +NAMESPACE_PATTERN = re.compile(r"xmlns(?:\:[^\=]*)?=\"[^\"]*\" ") class DefaultElementClass(etree.ElementBase):