Skip to content

Commit

Permalink
Fix import issues when asyncpg is not installed
Browse files Browse the repository at this point in the history
  • Loading branch information
MaT1g3R committed Aug 13, 2017
1 parent 7b3babb commit 82ded45
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.0
0.1.1
10 changes: 8 additions & 2 deletions minoshiro/data_controller/postgres_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@
from json import dumps, loads
from typing import Dict, Optional

from asyncpg import InterfaceError, create_pool
from asyncpg.pool import Pool
try:
from asyncpg import InterfaceError, create_pool
from asyncpg.pool import Pool
except ImportError:
print('asyncpg not installed, PostgresSQL function not available.')
Pool = None
InterfaceError = None
create_pool = None

from minoshiro.enums import Medium, Site
from minoshiro.logger import get_default_logger
Expand Down
9 changes: 7 additions & 2 deletions minoshiro/data_controller/postgres_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@

from typing import Optional

from asyncpg import Record
from asyncpg.pool import Pool
try:
from asyncpg import Record
from asyncpg.pool import Pool
except ImportError:
Record = None
Pool = None
print('asyncpg not installed, PostgresSQL function not available.')


def parse_record(record: Record) -> Optional[tuple]:
Expand Down

0 comments on commit 82ded45

Please sign in to comment.