diff --git a/edgeql_queries/contrib/aiosql/queries.py b/edgeql_queries/contrib/aiosql/queries.py index 6c340cd..e67f306 100644 --- a/edgeql_queries/contrib/aiosql/queries.py +++ b/edgeql_queries/contrib/aiosql/queries.py @@ -42,5 +42,6 @@ def load_from_tree(self, queries_tree: QueriesTree) -> eq_queries.Queries: Built collection of queries with binded executors. """ return eq_queries.load_from_tree( - eq_queries.Queries(self._use_async), queries_tree, + eq_queries.Queries(self._use_async), + queries_tree, ) diff --git a/edgeql_queries/executors/async_executor.py b/edgeql_queries/executors/async_executor.py index cf0b940..78c28d8 100644 --- a/edgeql_queries/executors/async_executor.py +++ b/edgeql_queries/executors/async_executor.py @@ -17,13 +17,19 @@ async def _execute(__edgeql_query__: Query, conn: _AsyncFetcher) -> None: async def _set_return( - __edgeql_query__: Query, conn: _AsyncFetcher, *query_args: Any, **query_kwargs: Any, + __edgeql_query__: Query, + conn: _AsyncFetcher, + *query_args: Any, + **query_kwargs: Any, ) -> datatypes.Set: return await conn.query(__edgeql_query__.edgeql, *query_args, **query_kwargs) async def _single_return( - __edgeql_query__: Query, conn: _AsyncFetcher, *query_args: Any, **query_kwargs: Any, + __edgeql_query__: Query, + conn: _AsyncFetcher, + *query_args: Any, + **query_kwargs: Any, ) -> Any: return await conn.query_one(__edgeql_query__.edgeql, *query_args, **query_kwargs) diff --git a/edgeql_queries/models.py b/edgeql_queries/models.py index b650e0d..f81e629 100644 --- a/edgeql_queries/models.py +++ b/edgeql_queries/models.py @@ -55,5 +55,7 @@ def __repr__(self) -> str: Raw string representation of query that contains all fields. """ return "Query(name: {0!r}, operation_type: {1}, edgeql: {2!r})".format( - self.name, self.operation_type.name, self.edgeql, + self.name, + self.operation_type.name, + self.edgeql, ) diff --git a/edgeql_queries/queries.py b/edgeql_queries/queries.py index 0f7c9b5..f3554c2 100644 --- a/edgeql_queries/queries.py +++ b/edgeql_queries/queries.py @@ -103,7 +103,8 @@ def add_query(self, name: str, query_handler: Union[Queries, Query]) -> None: self._available_queries.add(query_handler) handler_for_query = _create_handler_from_query( - query_handler, self._is_async, + query_handler, + self._is_async, ) else: handler_for_query = query_handler @@ -140,5 +141,6 @@ def __repr__(self) -> str: Raw string for queries collection. """ return "Queries(queries: {0}, groups: {1})".format( - self.available_queries, self._available_queries_groups, + self.available_queries, + self._available_queries_groups, ) diff --git a/edgeql_queries/query_loaders.py b/edgeql_queries/query_loaders.py index 5d2cd51..aada6ab 100644 --- a/edgeql_queries/query_loaders.py +++ b/edgeql_queries/query_loaders.py @@ -47,7 +47,8 @@ def load_query_data_from_edgeql(edgeql: str) -> List[Query]: end_position = len(edgeql) query_data.append( parse_query_from_string( - start_match.groups()[0], edgeql[start_match.end() : end_position], + start_match.groups()[0], + edgeql[start_match.end() : end_position], ), ) return query_data diff --git a/example/app/main.py b/example/app/main.py index ddc07d5..fb99e01 100644 --- a/example/app/main.py +++ b/example/app/main.py @@ -13,7 +13,9 @@ async def main() -> None: direcror_id = ( await queries.create_new_person( - conn, first_name="Denis", last_name="Villeneuve", + conn, + first_name="Denis", + last_name="Villeneuve", ) ).id @@ -25,7 +27,9 @@ async def main() -> None: person_ids = [] for person in persons: created_person = await queries.create_new_person( - conn, first_name=person.first_name, last_name=person.last_name, + conn, + first_name=person.first_name, + last_name=person.last_name, ) person_ids.append(created_person.id) diff --git a/noxfile.py b/noxfile.py index 39f4a5e..d804041 100644 --- a/noxfile.py +++ b/noxfile.py @@ -38,7 +38,10 @@ def _process_add_single_comma_path(session: Session, path: pathlib.Path) -> None return session.run( - "add-trailing-comma", "--py36-plus", "--exit-zero-even-if-changed", str(path), + "add-trailing-comma", + "--py36-plus", + "--exit-zero-even-if-changed", + str(path), ) diff --git a/poetry.lock b/poetry.lock index e2f7cf5..711ee8b 100644 --- a/poetry.lock +++ b/poetry.lock @@ -121,18 +121,20 @@ description = "The uncompromising code formatter." name = "black" optional = false python-versions = ">=3.6" -version = "19.10b0" +version = "20.8b1" [package.dependencies] appdirs = "*" -attrs = ">=18.1.0" -click = ">=6.5" +click = ">=7.1.2" +mypy-extensions = ">=0.4.3" pathspec = ">=0.6,<1" -regex = "*" -toml = ">=0.9.4" +regex = ">=2020.1.8" +toml = ">=0.10.1" typed-ast = ">=1.4.0" +typing-extensions = ">=3.7.4" [package.extras] +colorama = ["colorama (>=0.4.3)"] d = ["aiohttp (>=3.3.2)", "aiohttp-cors"] [[package]] @@ -1135,7 +1137,7 @@ docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"] testing = ["jaraco.itertools", "func-timeout"] [metadata] -content-hash = "22ba427af12c8f446ad798316dfc092a20630ee4ea36596d5bb2a373f32496e9" +content-hash = "2692a82a625a9b08fb8abe9513540866a22607ef16df70f3357b6b3c26cf2eae" lock-version = "1.0" python-versions = "^3.7" @@ -1181,8 +1183,8 @@ beautifulsoup4 = [ {file = "beautifulsoup4-4.9.1.tar.gz", hash = "sha256:73cc4d115b96f79c7d77c1c7f7a0a8d4c57860d1041df407dd1aae7f07a77fd7"}, ] black = [ - {file = "black-19.10b0-py36-none-any.whl", hash = "sha256:1b30e59be925fafc1ee4565e5e08abef6b03fe455102883820fe5ee2e4734e0b"}, - {file = "black-19.10b0.tar.gz", hash = "sha256:c2edb73a08e9e0e6f65a0e6af18b059b8b1cdd5bef997d7a0b181df93dc81539"}, + {file = "black-20.8b1-py3-none-any.whl", hash = "sha256:70b62ef1527c950db59062cda342ea224d772abdf6adc58b86a45421bab20a6b"}, + {file = "black-20.8b1.tar.gz", hash = "sha256:1c02557aa099101b9d21496f8a914e9ed2222ef70336404eeeac8edba836fbea"}, ] click = [ {file = "click-7.1.2-py2.py3-none-any.whl", hash = "sha256:dacca89f4bfadd5de3d7489b7c8a566eee0d3676333fbb50030263894c38c0dc"}, diff --git a/pyproject.toml b/pyproject.toml index 1ab365f..8b9e330 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,7 +16,7 @@ edgedb = ">= 0.9.0" # common tasks nox = "^2020.5.24" # formatters -black = "^19.10b0" +black = "^20.8b1" isort = "^4.3.21" # TODO: update after support in WPS autoflake = "^1.3.1" add-trailing-comma = "^2.0.1" diff --git a/tests/conftest.py b/tests/conftest.py index eb60b44..374eea1 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -46,7 +46,8 @@ def sync_fetcher(edgedb_dsn: str) -> edgedb.BlockingIOConnection: @pytest.fixture(autouse=True) def setup_database( - sync_fetcher: edgedb.BlockingIOConnection, sync_queries: Queries, + sync_fetcher: edgedb.BlockingIOConnection, + sync_queries: Queries, ) -> None: sync_queries.migrations.create_movies(sync_fetcher) sync_fetcher.execute( diff --git a/tests/test_async_queries.py b/tests/test_async_queries.py index 04beac7..c388f2c 100644 --- a/tests/test_async_queries.py +++ b/tests/test_async_queries.py @@ -11,7 +11,8 @@ async def test_selecting_single_object( ) -> None: title_regex = "blade runner%" movie = await async_queries.movies.select_movie_by_title( - async_fetcher, title=title_regex, + async_fetcher, + title=title_regex, ) assert movie.title == "Blade Runner 2049" @@ -33,7 +34,8 @@ async def test_executing_statemnt( await async_queries.persons.create_keanu_reeves(async_fetcher) person = await async_queries.persons.get_person_by_first_name( - async_fetcher, first_name=keanu_first_name, + async_fetcher, + first_name=keanu_first_name, ) assert person.first_name == keanu_first_name assert person.last_name == "Reeves" @@ -45,6 +47,8 @@ async def test_selecting_using_positional_arguments( first_arg = "Harry Potter and the Philosopher's Stone" second_arg = "Harry Potter%" check_result = await async_queries.check_string_matches_regex( - async_fetcher, first_arg, second_arg, + async_fetcher, + first_arg, + second_arg, ) assert check_result diff --git a/tests/test_contrib/test_aiosql/test_async_queries.py b/tests/test_contrib/test_aiosql/test_async_queries.py index f610ffa..f6a3ea6 100644 --- a/tests/test_contrib/test_aiosql/test_async_queries.py +++ b/tests/test_contrib/test_aiosql/test_async_queries.py @@ -11,7 +11,8 @@ async def test_selecting_single_object( ) -> None: title_regex = "blade runner%" movie = await aiosql_async_queries.movies.select_movie_by_title( - async_fetcher, title=title_regex, + async_fetcher, + title=title_regex, ) assert movie.title == "Blade Runner 2049" @@ -21,7 +22,8 @@ async def test_selecting_multiple_objects( ) -> None: year = 2017 movies = await aiosql_async_queries.movies.select_movies_by_year( - async_fetcher, year=year, + async_fetcher, + year=year, ) assert movies for movie in movies: @@ -35,7 +37,8 @@ async def test_executing_statemnt( await aiosql_async_queries.persons.create_keanu_reeves(async_fetcher) person = await aiosql_async_queries.persons.get_person_by_first_name( - async_fetcher, first_name=keanu_first_name, + async_fetcher, + first_name=keanu_first_name, ) assert person.first_name == keanu_first_name assert person.last_name == "Reeves" @@ -47,6 +50,8 @@ async def test_selecting_using_positional_arguments( first_arg = "Harry Potter and the Philosopher's Stone" second_arg = "Harry Potter%" check_result = await aiosql_async_queries.check_string_matches_regex( - async_fetcher, first_arg, second_arg, + async_fetcher, + first_arg, + second_arg, ) assert check_result diff --git a/tests/test_contrib/test_aiosql/test_sync_queries.py b/tests/test_contrib/test_aiosql/test_sync_queries.py index 9d3b8a8..11bc3ad 100644 --- a/tests/test_contrib/test_aiosql/test_sync_queries.py +++ b/tests/test_contrib/test_aiosql/test_sync_queries.py @@ -4,17 +4,20 @@ def test_selecting_single_object( - sync_fetcher: edgedb.BlockingIOConnection, aiosql_sync_queries: Queries, + sync_fetcher: edgedb.BlockingIOConnection, + aiosql_sync_queries: Queries, ) -> None: title_regex = "blade runner%" movie = aiosql_sync_queries.movies.select_movie_by_title( - sync_fetcher, title=title_regex, + sync_fetcher, + title=title_regex, ) assert movie.title == "Blade Runner 2049" def test_selecting_multiple_objects( - sync_fetcher: edgedb.BlockingIOConnection, aiosql_sync_queries: Queries, + sync_fetcher: edgedb.BlockingIOConnection, + aiosql_sync_queries: Queries, ) -> None: year = 2017 movies = aiosql_sync_queries.movies.select_movies_by_year(sync_fetcher, year=year) @@ -24,24 +27,29 @@ def test_selecting_multiple_objects( def test_executing_statemnt( - sync_fetcher: edgedb.BlockingIOConnection, aiosql_sync_queries: Queries, + sync_fetcher: edgedb.BlockingIOConnection, + aiosql_sync_queries: Queries, ) -> None: keanu_first_name = "Keanu" aiosql_sync_queries.persons.create_keanu_reeves(sync_fetcher) person = aiosql_sync_queries.persons.get_person_by_first_name( - sync_fetcher, first_name=keanu_first_name, + sync_fetcher, + first_name=keanu_first_name, ) assert person.first_name == keanu_first_name assert person.last_name == "Reeves" def test_selecting_using_positional_arguments( - sync_fetcher: edgedb.BlockingIOConnection, aiosql_sync_queries: Queries, + sync_fetcher: edgedb.BlockingIOConnection, + aiosql_sync_queries: Queries, ) -> None: first_arg = "Harry Potter and the Philosopher's Stone" second_arg = "Harry Potter%" check_result = aiosql_sync_queries.check_string_matches_regex( - sync_fetcher, first_arg, second_arg, + sync_fetcher, + first_arg, + second_arg, ) assert check_result diff --git a/tests/test_sync_queries.py b/tests/test_sync_queries.py index 1a99971..51d7cd8 100644 --- a/tests/test_sync_queries.py +++ b/tests/test_sync_queries.py @@ -4,7 +4,8 @@ def test_selecting_single_object( - sync_fetcher: edgedb.BlockingIOConnection, sync_queries: Queries, + sync_fetcher: edgedb.BlockingIOConnection, + sync_queries: Queries, ) -> None: title_regex = "blade runner%" movie = sync_queries.movies.select_movie_by_title(sync_fetcher, title=title_regex) @@ -12,7 +13,8 @@ def test_selecting_single_object( def test_selecting_multiple_objects( - sync_fetcher: edgedb.BlockingIOConnection, sync_queries: Queries, + sync_fetcher: edgedb.BlockingIOConnection, + sync_queries: Queries, ) -> None: year = 2017 movies = sync_queries.movies.select_movies_by_year(sync_fetcher, year=year) @@ -22,24 +24,29 @@ def test_selecting_multiple_objects( def test_executing_statemnt( - sync_fetcher: edgedb.BlockingIOConnection, sync_queries: Queries, + sync_fetcher: edgedb.BlockingIOConnection, + sync_queries: Queries, ) -> None: keanu_first_name = "Keanu" sync_queries.persons.create_keanu_reeves(sync_fetcher) person = sync_queries.persons.get_person_by_first_name( - sync_fetcher, first_name=keanu_first_name, + sync_fetcher, + first_name=keanu_first_name, ) assert person.first_name == keanu_first_name assert person.last_name == "Reeves" def test_selecting_using_positional_arguments( - sync_fetcher: edgedb.BlockingIOConnection, sync_queries: Queries, + sync_fetcher: edgedb.BlockingIOConnection, + sync_queries: Queries, ) -> None: first_arg = "Harry Potter and the Philosopher's Stone" second_arg = "Harry Potter%" check_result = sync_queries.check_string_matches_regex( - sync_fetcher, first_arg, second_arg, + sync_fetcher, + first_arg, + second_arg, ) assert check_result