Skip to content

Commit a48a22a

Browse files
committed
Switch to always using absolute imports.
1 parent 79aeb5e commit a48a22a

File tree

6 files changed

+36
-28
lines changed

6 files changed

+36
-28
lines changed

sc2reader/__init__.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,19 @@
1616
:copyright: (c) 2011 Graylin Kim
1717
:license: MIT, See LICENSE.txt for details
1818
"""
19+
from __future__ import absolute_import
1920

2021
__version__ = '0.3-dev'
2122

23+
2224
#System imports
2325
import os
2426

2527
#PyPi imports
2628
import mpyq
2729

2830
#Package imports
29-
import config
30-
import objects
31-
import utils
32-
import processors
33-
import exceptions
31+
from sc2reader import config, objects, utils, processors, exceptions
3432

3533

3634
class Reader(object):

sc2reader/objects.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
from constants import LOCALIZED_RACES
2-
from collections import defaultdict
1+
from __future__ import absolute_import
32

3+
from collections import defaultdict, namedtuple
44
import datetime
55

6-
from .constants import *
7-
from .data import GameObject, ABILITIES
8-
from .utils import PersonDict, Selection, read_header, AttributeDict, Length
9-
10-
from collections import namedtuple
6+
from sc2reader.constants import *
7+
from sc2reader.data import GameObject, ABILITIES
8+
from sc2reader.utils import PersonDict, Selection, read_header, AttributeDict, Length
119

1210
Location = namedtuple('Location',('x','y'))
1311
Details = namedtuple('Details',['players','map','unknown1','unknown2','unknown3','file_time','unknown4','unknown5','unknown6','unknown7','unknown8','unknown9','unknown10','unknown11'])
@@ -510,4 +508,4 @@ def apply(self):
510508
self.selected = selected
511509

512510
def __str__(self):
513-
return self._str_prefix() + "Selection: " + str(self.selected)
511+
return self._str_prefix() + "Selection: " + str(self.selected)

sc2reader/parsers.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
from itertools import chain
1+
from __future__ import absolute_import
2+
23
from collections import defaultdict
4+
from itertools import chain
5+
6+
from sc2reader.exceptions import ParseError
7+
from sc2reader.objects import *
8+
from sc2reader.utils import BIG_ENDIAN,LITTLE_ENDIAN
39

4-
from .objects import *
5-
from .utils import BIG_ENDIAN,LITTLE_ENDIAN
6-
from .exceptions import ParseError
710

811
class SetupParser(object):
912
def parse_join_event(self, buffer, frames, type, code, pid):

sc2reader/processors.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1+
from __future__ import absolute_import
2+
3+
import datetime
4+
15
from collections import defaultdict
2-
from .objects import *
3-
from .utils import key_in_bases, windows_to_unix, Length
4-
from datetime import datetime
5-
from .constants import REGIONS
6+
7+
from sc2reader.constants import REGIONS
8+
from sc2reader.objects import *
9+
from sc2reader.utils import windows_to_unix
10+
611

712
def Full(replay):
813
# Populate replay with details
@@ -20,8 +25,8 @@ def Full(replay):
2025
replay.map = replay.raw.details.map
2126
replay.file_time = replay.raw.details.file_time
2227
replay.unix_timestamp = windows_to_unix(replay.file_time)
23-
replay.date = datetime.fromtimestamp(replay.unix_timestamp)
24-
replay.utc_date = datetime.utcfromtimestamp(replay.unix_timestamp)
28+
replay.date = datetime.datetime.fromtimestamp(replay.unix_timestamp)
29+
replay.utc_date = datetime.datetime.utcfromtimestamp(replay.unix_timestamp)
2530

2631
if 'attributes_events' in replay.raw:
2732
# Organize the attribute data to be useful

sc2reader/readers.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
from .parsers import *
2-
from .objects import *
3-
from .utils import AttributeDict, LITTLE_ENDIAN
4-
from .exceptions import ParseError, ReadError
1+
from __future__ import absolute_import
2+
3+
from sc2reader.exceptions import ParseError, ReadError
4+
from sc2reader.objects import *
5+
from sc2reader.parsers import *
6+
from sc2reader.utils import AttributeDict, LITTLE_ENDIAN
57

68
class InitDataReader(object):
79
def __call__(self,buffer, replay):

sc2reader/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import absolute_import
2+
13
import argparse
24
import cStringIO
35
import fnmatch
@@ -8,7 +10,7 @@
810

911
from itertools import groupby
1012

11-
from .exceptions import FileError
13+
from sc2reader.exceptions import FileError
1214

1315
LITTLE_ENDIAN,BIG_ENDIAN = '<','>'
1416

0 commit comments

Comments
 (0)