Skip to content

Commit

Permalink
refactor: use raw strings for regex
Browse files Browse the repository at this point in the history
Fixes #107
  • Loading branch information
eyeonus committed Dec 27, 2022
1 parent df01f9c commit 74a4c31
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion tradedangerous/commands/update_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ def getResults(self):
supply = "-"
elif not supply:
supply = "?"
elif re.match('^\d+$', supply):
elif re.match(r"^\d+$", supply):
if int(supply) != 0:
supply += '?'

Expand Down
5 changes: 4 additions & 1 deletion tradedangerous/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
from pkg_resources import resource_filename
import os
import sys
import traceback
Expand All @@ -47,6 +48,8 @@
import appJar

from tkinter import *
import tkinter.font as font
import tkinter.scrolledtext as scrolledtext
from tkinter.ttk import *

from . import commands
Expand Down Expand Up @@ -960,7 +963,7 @@ def makeWidgets(name, arg, sticky = 'ew', label = True, **kwargs):
buildArgDicts()

window.title('Trade Dangerous GUI (Beta), TD v.%s' % (__version__,))
window.iconbitmap('../tradedangerouscrest.ico')
window.iconbitmap(resource_filename(__name__, "../tradedangerouscrest.ico"))

widgets['Command'] = addWidget('combo', window, 3, 0, values = Commands, bind = updateCommandBox,
width = 10, state = 'readonly', height = len(Commands), default = Commands[0], columnspan = 4,
Expand Down
8 changes: 4 additions & 4 deletions tradedangerous/plugins/netlog_plug.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ def parseLogDirList(self):
tdb, tdenv = self.tdb, self.tdenv
optShow = self.getOption("show")

oldHeadRegEx = re.compile("^(?P<headDateTime>\d\d-\d\d-\d\d-\d\d:\d\d)\s+(?P<headTZName>.*[^\s])\s+(?P<headTimeGMT>\(.*GMT\))")
newHeadRegEx = re.compile("^(?P<headDateTime>\d\d\d\d-\d\d-\d\d\s+\d\d:\d\d)\s+(?P<headTZName>.*[^\s])")
oldHeadRegEx = re.compile(r"^(?P<headDateTime>\d\d-\d\d-\d\d-\d\d:\d\d)\s+(?P<headTZName>.*[^\s])\s+(?P<headTimeGMT>\(.*GMT\))")
newHeadRegEx = re.compile(r"^(?P<headDateTime>\d\d\d\d-\d\d-\d\d\s+\d\d:\d\d)\s+(?P<headTZName>.*[^\s])")

sysRegEx = re.compile('^\{[^\}]+\}\s+System:"(?P<sysName>[^"]+)".*StarPos:\((?P<sysPos>[^)]+)\)ly')
dateRegEx = re.compile('^\{(?P<logTime>\d\d:\d\d:\d\d)')
sysRegEx = re.compile(r'^\{[^\}]+\}\s+System:"(?P<sysName>[^"]+)".*StarPos:\((?P<sysPos>[^)]+)\)ly')
dateRegEx = re.compile(r'^\{(?P<logTime>\d\d:\d\d:\d\d)')

def calcSeconds(h=0, m=0, s=0):
return 3600*h + 60*m + s
Expand Down

0 comments on commit 74a4c31

Please sign in to comment.