From 1cc0f19647be1c3630edec1dcabfdbca66faa445 Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Sun, 31 Jan 2016 15:28:40 -0500 Subject: [PATCH 1/2] Fix import locations --- pysteam/_shortcut_parser.py | 2 +- pysteam/grid.py | 2 +- pysteam/shortcuts.py | 8 ++++---- pysteam/steam.py | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pysteam/_shortcut_parser.py b/pysteam/_shortcut_parser.py index 3ee0112..a14eb4f 100755 --- a/pysteam/_shortcut_parser.py +++ b/pysteam/_shortcut_parser.py @@ -10,7 +10,7 @@ import os import re -from model import Shortcut +from .model import Shortcut class ShortcutParser(object): diff --git a/pysteam/grid.py b/pysteam/grid.py index 3295b41..95ede62 100644 --- a/pysteam/grid.py +++ b/pysteam/grid.py @@ -3,7 +3,7 @@ import os import shutil -import paths +from . import paths VALID_EXTENSIONS = [ '.png', diff --git a/pysteam/shortcuts.py b/pysteam/shortcuts.py index 669e1e2..bb40cf8 100644 --- a/pysteam/shortcuts.py +++ b/pysteam/shortcuts.py @@ -1,10 +1,10 @@ # encoding: utf-8 -import paths +from . import paths -from _crc_algorithms import Crc -from _shortcut_generator import ShortcutGenerator -from _shortcut_parser import ShortcutParser +from ._crc_algorithms import Crc +from ._shortcut_generator import ShortcutGenerator +from ._shortcut_parser import ShortcutParser def shortcut_app_id(shortcut): """ diff --git a/pysteam/steam.py b/pysteam/steam.py index 97c02dc..0f39ae6 100644 --- a/pysteam/steam.py +++ b/pysteam/steam.py @@ -4,10 +4,10 @@ import os import platform -import paths -import winutils +from . import paths +from . import winutils -from model import LocalUserContext, Steam +from .model import LocalUserContext, Steam def get_steam(): """ From d9cf9ceb43876ba2ed9721e3000799470e13a020 Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Sun, 31 Jan 2016 16:31:39 -0500 Subject: [PATCH 2/2] Fix Python 3 regex --- pysteam/_shortcut_parser.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pysteam/_shortcut_parser.py b/pysteam/_shortcut_parser.py index a14eb4f..308a583 100755 --- a/pysteam/_shortcut_parser.py +++ b/pysteam/_shortcut_parser.py @@ -24,7 +24,7 @@ def parse(self, path, require_exists=False): return self.match_base(file_contents) def match_base(self,string): - match = re.match(ur"\u0000shortcuts\u0000(.*)\u0008\u0008$",string, re.IGNORECASE) + match = re.match(u"\u0000shortcuts\u0000(.*)\u0008\u0008$",string, re.IGNORECASE) if match: return self.match_array_string(match.groups()[0]) else: @@ -39,7 +39,7 @@ def match_array_string(self,string): # ignoring it for now shortcuts = [] while True: - match = re.match(ur"(.*)\u0000[0-9]+\u0000(\u0001AppName.*)\u0008",string, re.IGNORECASE) + match = re.match(u"(.*)\u0000[0-9]+\u0000(\u0001AppName.*)\u0008",string, re.IGNORECASE) if match: groups = match.groups() string = groups[0] @@ -53,7 +53,7 @@ def match_shortcut_string(self,string): # for the shortcut string (Appname, Exe, StartDir, etc), as oppposed # to matching for general Key-Value pairs. This could possibly create a # lot of work for me later, but for now it will get the job done - match = re.match(ur"\u0001AppName\u0000(.*)\u0000\u0001Exe\u0000(.*)\u0000\u0001StartDir\u0000(.*)\u0000\u0001icon\u0000(.*)\u0000\u0000tags\u0000(.*)\u0008",string, re.IGNORECASE) + match = re.match(u"\u0001AppName\u0000(.*)\u0000\u0001Exe\u0000(.*)\u0000\u0001StartDir\u0000(.*)\u0000\u0001icon\u0000(.*)\u0000\u0000tags\u0000(.*)\u0008",string, re.IGNORECASE) if match: # The 'groups' that are returned by the match should be the data # contained in the file. Now just make a Shortcut out of that data @@ -70,7 +70,7 @@ def match_shortcut_string(self,string): def match_tags_string(self,string): tags = [] while True: - match = re.match(ur"(.*)\u0001[0-9]+\u0000(.*?)\u0000",string) + match = re.match(u"(.*)\u0001[0-9]+\u0000(.*?)\u0000",string) if match: groups = match.groups() string = groups[0]