Change py2 octal literals into the new py2/3 syntax

This commit is contained in:
Adam 2015-06-10 06:32:13 +08:00
parent 839b2489df
commit b7dbd87625
6 changed files with 17 additions and 13 deletions

View file

@ -34,6 +34,7 @@
* Add py2/3 regression testing for exception clauses
* Change py2 exception clauses to py2/3 compatible clauses
* Change py2 print statements to py2/3 compatible functions
* Change py2 octal literals into the new py2/3 syntax
* Change Kodi notifier to use requests as opposed to urllib
* Change to consolidate scene exceptions and name cache code

View file

@ -243,7 +243,7 @@ class SickGear(object):
# Make sure that we can create the data dir
if not os.access(sickbeard.DATA_DIR, os.F_OK):
try:
os.makedirs(sickbeard.DATA_DIR, 0744)
os.makedirs(sickbeard.DATA_DIR, 0o744)
except os.error:
sys.exit(u'Unable to create data directory: %s Exiting.' % sickbeard.DATA_DIR)

View file

@ -51,7 +51,7 @@ class TVShow():
def __init__(self):
self.name = "Show Name"
self.genre = "Comedy"
self.indexerid = 00001
self.indexerid = 1
self.air_by_date = 0
self.sports = 0
self.anime = 0

View file

@ -16,7 +16,10 @@ class CompatibilityTests(unittest.TestCase):
pyfiles.append(os.path.join(path,'SickBeard.py'))
output = subprocess.Popen('2to3 -f except -f print -p %s' % ' '.join(pyfiles), shell=True, stdout=subprocess.PIPE,
output = subprocess.Popen('2to3'
' -f except'
' -f numliterals'
' %s' % ' '.join(pyfiles), shell=True, stdout=subprocess.PIPE,
stderr=subprocess.PIPE).communicate()[0]
if output:
print('Changes to be made for Python 2/3 compatibility as follows:')

View file

@ -127,8 +127,8 @@ simple_test_cases = {
'[HorribleSubs] D Gray-Man - 312 (480p) [F501C9BE]': parser.ParseResult(None, 'D Gray-Man', None, [], '480p', 'HorribleSubs', None, [312]),
'[SGKK] Tengen Toppa Gurren Lagann - 45-46 (720p h264) [F501C9BE]': parser.ParseResult(None, 'Tengen Toppa Gurren Lagann', None, [], '720p h264', 'SGKK', None, [45, 46]),
'[Stratos-Subs]_Infinite_Stratos_-_12_(1280x720_H.264_AAC)_[379759DB]': parser.ParseResult(None, 'Infinite Stratos', None, [], '1280x720_H.264_AAC', 'Stratos-Subs', None, [12]),
'[ShinBunBu-Subs] Bleach - 02-03 (CX 1280x720 x264 AAC)': parser.ParseResult(None, 'Bleach', None, [], 'CX 1280x720 x264 AAC', 'ShinBunBu-Subs', None, [02, 03]),
'[Doki] Hanasaku Iroha - 03 (848x480 h264 AAC) [CB1AA73B]': parser.ParseResult(None, 'Hanasaku Iroha', None, [], '848x480 h264 AAC', 'Doki', None, [03]),
'[ShinBunBu-Subs] Bleach - 02-03 (CX 1280x720 x264 AAC)': parser.ParseResult(None, 'Bleach', None, [], 'CX 1280x720 x264 AAC', 'ShinBunBu-Subs', None, [2, 3]),
'[Doki] Hanasaku Iroha - 03 (848x480 h264 AAC) [CB1AA73B]': parser.ParseResult(None, 'Hanasaku Iroha', None, [], '848x480 h264 AAC', 'Doki', None, [3]),
'[UTW]_Fractal_-_01_[h264-720p][96D3F1BF]': parser.ParseResult(None, 'Fractal', None, [], 'h264-720p', 'UTW', None, [1]),
'[a-s]_inuyasha_-_028_rs2_[BFDDF9F2]': parser.ParseResult(None, 'inuyasha', None, [], 'BFDDF9F2', 'a-s', None, [28]),
'[HorribleSubs] Fairy Tail S2 - 37 [1080p]': parser.ParseResult(None,'Fairy Tail S2', None, [], '1080p', 'HorribleSubs', None, [37]),

View file

@ -31,11 +31,11 @@ class TVShowTests(test.SickbeardTestDBCase):
sickbeard.showList = []
def test_init_indexerid(self):
show = TVShow(1, 0001, "en")
self.assertEqual(show.indexerid, 0001)
show = TVShow(1, 1, "en")
self.assertEqual(show.indexerid, 1)
def test_change_indexerid(self):
show = TVShow(1, 0001, "en")
show = TVShow(1, 1, "en")
show.name = "show name"
show.tvrname = "show name"
show.network = "cbs"
@ -48,14 +48,14 @@ class TVShowTests(test.SickbeardTestDBCase):
show.saveToDB()
show.loadFromDB(skipNFO=True)
show.indexerid = 0002
show.indexerid = 2
show.saveToDB()
show.loadFromDB(skipNFO=True)
self.assertEqual(show.indexerid, 0002)
self.assertEqual(show.indexerid, 2)
def test_set_name(self):
show = TVShow(1, 0001, "en")
show = TVShow(1, 1, "en")
show.name = "newName"
show.saveToDB()
show.loadFromDB(skipNFO=True)
@ -69,7 +69,7 @@ class TVEpisodeTests(test.SickbeardTestDBCase):
sickbeard.showList = []
def test_init_empty_db(self):
show = TVShow(1, 0001, "en")
show = TVShow(1, 1, "en")
ep = TVEpisode(show, 1, 1)
ep.name = "asdasdasdajkaj"
ep.saveToDB()
@ -84,7 +84,7 @@ class TVTests(test.SickbeardTestDBCase):
sickbeard.showList = []
def test_getEpisode(self):
show = TVShow(1, 0001, "en")
show = TVShow(1, 1, "en")
show.name = "show name"
show.tvrname = "show name"
show.network = "cbs"