Skip to content

Commit e84831b

Browse files
committed
fix(h2non#7): use relative imports
1 parent 713d2f1 commit e84831b

File tree

10 files changed

+35
-28
lines changed

10 files changed

+35
-28
lines changed

filetype/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# -*- coding: utf-8 -*-
22

3-
from filetype.match import * # noqa
4-
from filetype.helpers import * # noqa
5-
from filetype.filetype import * # noqa
3+
from .match import * # noqa
4+
from .helpers import * # noqa
5+
from .filetype import * # noqa
66

77
# Current package semver version
88
__version__ = version = '0.1.1'

filetype/filetype.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22

3-
from filetype import match
4-
from filetype.types import types
3+
from .match import match
4+
from .types import types
55

66
# Expose supported matchers types
77
types = types

filetype/helpers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22

3-
from filetype.types import types
4-
from filetype import match
3+
from .types import types
4+
from .match import match
55

66

77
def is_extension_supported(ext):

filetype/match.py

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
# -*- coding: utf-8 -*-
22

3-
from filetype import types
4-
from filetype.utils import get_bytes
5-
6-
7-
def match(obj, matchers=types.types):
3+
from .utils import get_bytes
4+
from .types import (
5+
types,
6+
image as image_matchers,
7+
video as video_matchers,
8+
font as font_matchers,
9+
archive as archive_matchers,
10+
audio as audio_matchers
11+
)
12+
13+
14+
def match(obj, matchers=types):
815
"""
916
Matches the given input againts the available
1017
file type matchers.
@@ -41,7 +48,7 @@ def image(obj):
4148
Raises:
4249
TypeError: if obj is not a supported type.
4350
"""
44-
return match(obj, types.image)
51+
return match(obj, image_matchers)
4552

4653

4754
def font(obj):
@@ -58,7 +65,7 @@ def font(obj):
5865
Raises:
5966
TypeError: if obj is not a supported type.
6067
"""
61-
return match(obj, types.font)
68+
return match(obj, font_matchers)
6269

6370

6471
def video(obj):
@@ -75,7 +82,7 @@ def video(obj):
7582
Raises:
7683
TypeError: if obj is not a supported type.
7784
"""
78-
return match(obj, types.video)
85+
return match(obj, video_matchers)
7986

8087

8188
def audio(obj):
@@ -92,7 +99,7 @@ def audio(obj):
9299
Raises:
93100
TypeError: if obj is not a supported type.
94101
"""
95-
return match(obj, types.audio)
102+
return match(obj, audio_matchers)
96103

97104

98105
def archive(obj):
@@ -109,4 +116,4 @@ def archive(obj):
109116
Raises:
110117
TypeError: if obj is not a supported type.
111118
"""
112-
return match(obj, types.archive)
119+
return match(obj, archive_matchers)

filetype/types/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# -*- coding: utf-8 -*-
22

3-
from filetype.types import font
4-
from filetype.types import image
5-
from filetype.types import video
6-
from filetype.types import audio
7-
from filetype.types import archive
8-
from filetype.types.base import Type # noqa
3+
from . import font
4+
from . import image
5+
from . import video
6+
from . import audio
7+
from . import archive
8+
from .base import Type # noqa
99

1010
# Supported image types
1111
image = (

filetype/types/archive.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22

3-
from filetype.types.base import Type
3+
from .base import Type
44

55

66
class Epub(Type):

filetype/types/audio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22

3-
from filetype.types.base import Type
3+
from .base import Type
44

55

66
class Midi(Type):

filetype/types/font.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22

3-
from filetype.types.base import Type
3+
from .base import Type
44

55

66
class Woff(Type):

filetype/types/image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22

3-
from filetype.types.base import Type
3+
from .base import Type
44

55

66
class Jpeg(Type):

filetype/types/video.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22

3-
from filetype.types.base import Type
3+
from .base import Type
44

55

66
class Mp4(Type):

0 commit comments

Comments
 (0)