Skip to content

Commit

Permalink
Add Makefile, move Travis CI items to Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
eigenein committed Mar 31, 2019
1 parent c6ed40f commit 85414bd
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Expand Up @@ -7,6 +7,9 @@ insert_final_newline = true
indent_style = space
indent_size = 4

[Makefile]
indent_style = tab

[*.py]
line_length = 119
default_section = THIRDPARTY
Expand Down
5 changes: 1 addition & 4 deletions .travis.yml
Expand Up @@ -6,9 +6,6 @@ python:
install:
- pip install --upgrade -e .[dev]
script:
- pytest --cov-report term-missing --cov sqlitemap
- flake8 sqlitemap tests
- isort -rc -c --diff sqlitemap tests
# TODO: mypy
- make test
after_success:
- coveralls
11 changes: 11 additions & 0 deletions Makefile
@@ -0,0 +1,11 @@
.PHONY: venv
venv:
@virtualenv -p python3.7 venv
@venv/bin/pip install -e .[dev]

.PHONY: test
test:
@pytest --cov-report term-missing --cov sqlitemap
@flake8 sqlitemap tests
@isort -rc -c --diff sqlitemap tests
@mypy sqlitemap
5 changes: 3 additions & 2 deletions sqlitemap/__init__.py
Expand Up @@ -11,7 +11,7 @@
from sqlitemap.constants import table_name_re
from sqlitemap.json import dumps, loads

T = TypeVar('T')
T = TypeVar('T', bound='ConnectionWrapper')


class ConnectionWrapper(AbstractContextManager, ABC):
Expand Down Expand Up @@ -90,7 +90,8 @@ def __iter__(self) -> Iterator[str]:
with closing(self.connection.execute(f'SELECT `key` from "{self.name}"')) as cursor:
return iter([key for key, in cursor])

def values(self) -> List[Any]:
# noinspection PyTypeHints
def values(self) -> List[Any]: # type: ignore
"""
Get the collection values.
This is not really effective since it keeps the entire value set in memory.
Expand Down
6 changes: 3 additions & 3 deletions sqlitemap/json.py
Expand Up @@ -14,8 +14,8 @@ def stdlib_dumps(value: Any) -> bytes:
return json.dumps(value).encode()


loads = stdlib_loads
dumps = stdlib_dumps
loads: Callable[[bytes], Any] = stdlib_loads
dumps: Callable[[Any], bytes] = stdlib_dumps

try:
import ujson
Expand All @@ -32,7 +32,7 @@ def ujson_dumps(value: Any) -> bytes:
dumps = ujson_dumps

try:
import orjson
import orjson # type: ignore
except ImportError:
pass
else:
Expand Down

0 comments on commit 85414bd

Please sign in to comment.