Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
myrrc committed Jul 6, 2023
1 parent 824d51a commit 317af19
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/chtools/chadmin/cli/chs3_backup_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ def cleanup_backups(ctx, dry_run, keep_going):


def delete_chs3_backups(
ctx: Context, chs3_backups: List[str], *, keep_going=False, dry_run=False
) -> None:
ctx, chs3_backups, *, keep_going=False, dry_run=False
):
"""
Delete CHS3 backups.
"""
Expand Down
12 changes: 5 additions & 7 deletions src/chtools/chadmin/cli/object_storage_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import sys
from datetime import datetime, timedelta, timezone
from gzip import GzipFile
from io import BufferedIOBase, IOBase, TextIOWrapper
from io import TextIOWrapper, IOBase
from pathlib import Path
from typing import Dict, Iterator, List, Optional, Union

Expand Down Expand Up @@ -173,7 +173,7 @@ def list_objects(
help="Input stream is compressed using GZIP format",
)
@pass_context
def clean_object_storage(ctx: Context, file: IOBase, compressed: bool) -> None:
def clean_object_storage(ctx , file , compressed ):
disk_conf: S3DiskConfiguration = ctx.obj["disk_configuration"]

if compressed:
Expand All @@ -190,13 +190,11 @@ def clean_object_storage(ctx: Context, file: IOBase, compressed: bool) -> None:

@contextlib.contextmanager
def dump_writer(
compressed: bool, file_path: Optional[Path] = None
) -> Iterator[Union[BufferedIOBase, GzipFile]]:
compressed, file_path = None
):
writer = open(file_path, "wb") if file_path is not None else sys.stdout.buffer
if compressed:
writer = GzipFile(mode="wb", fileobj=writer)
try:
yield writer
yield GzipFile(mode="wb", fileobj=writer) if compressed else writer
finally:
if file_path is not None or compressed:
writer.close()
Expand Down
8 changes: 4 additions & 4 deletions src/chtools/chadmin/internal/diagnostics/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import yaml
from requests.exceptions import RequestException

from chtools.common.clickhouse.client import OutputFormat
from chtools.common.clickhouse.client import OutputFormat, ClickhouseClient

from .utils import delayed

Expand Down Expand Up @@ -195,8 +195,8 @@ def _write_result(buffer_, result, format_=None):

@delayed
def add_query(
diagnostics, name, client, query, format_: OutputFormat, section=None
) -> None:
diagnostics, name, client, query, format_, section=None
):
query_args = {
"normalize_queries": diagnostics.normalize_queries,
}
Expand All @@ -210,7 +210,7 @@ def add_query(


def execute_query(
client: ClickHouseClient,
client: ClickhouseClient,
query: str,
render_query: bool = True,
format_: OutputFormat = OutputFormat.Default,
Expand Down
4 changes: 2 additions & 2 deletions src/chtools/common/clickhouse/client/clickhouse_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ def query(
query: str,
query_args: Optional[Dict[str, Any]] = None,
format_: Optional[str] = None,
post_data=None,
post_data: Any = None,
timeout: Optional[int] = None,
echo: bool = False,
dry_run: bool = False,
):
) -> Any:
"""
Execute query.
"""
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/common/type/test_typed_enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ def test_typed_enum(
stringified: Sequence[str] = [str(i) for i in inputs]
assert_that(stringified, equal_to(stringified_expected))

summed = reduce(lambda a, b: a + b, inputs)
summed = reduce(lambda a, b: a + b, inputs) # type: ignore
assert_that(summed, equal_to(summed_expected))

0 comments on commit 317af19

Please sign in to comment.