Skip to content
This repository has been archived by the owner on Oct 22, 2022. It is now read-only.

Commit

Permalink
Bump black from 19.10b0 to 20.8b1 (#50)
Browse files Browse the repository at this point in the history
* Bump black from 19.10b0 to 20.8b1

Bumps [black](https://github.com/psf/black) from 19.10b0 to 20.8b1.
- [Release notes](https://github.com/psf/black/releases)
- [Changelog](https://github.com/psf/black/blob/master/CHANGES.md)
- [Commits](https://github.com/psf/black/commits)

Signed-off-by: dependabot-preview[bot] <[email protected]>

* apply new black rule

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Nik Sidnev <[email protected]>
  • Loading branch information
dependabot-preview[bot] and nsidnev authored Sep 1, 2020
1 parent bf09bc3 commit 0162052
Show file tree
Hide file tree
Showing 14 changed files with 86 additions and 40 deletions.
3 changes: 2 additions & 1 deletion edgeql_queries/contrib/aiosql/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
10 changes: 8 additions & 2 deletions edgeql_queries/executors/async_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 3 additions & 1 deletion edgeql_queries/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
6 changes: 4 additions & 2 deletions edgeql_queries/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
)
3 changes: 2 additions & 1 deletion edgeql_queries/query_loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 6 additions & 2 deletions example/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)

Expand Down
5 changes: 4 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
)


Expand Down
18 changes: 10 additions & 8 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
10 changes: 7 additions & 3 deletions tests/test_async_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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"
Expand All @@ -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
13 changes: 9 additions & 4 deletions tests/test_contrib/test_aiosql/test_async_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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:
Expand All @@ -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"
Expand All @@ -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
22 changes: 15 additions & 7 deletions tests/test_contrib/test_aiosql/test_sync_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
19 changes: 13 additions & 6 deletions tests/test_sync_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@


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)
assert movie.title == "Blade Runner 2049"


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)
Expand All @@ -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

1 comment on commit 0162052

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.