Skip to content

Commit

Permalink
RM-45 fix mypy errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ryantimjohn committed Apr 12, 2023
1 parent cd69605 commit 9a344ab
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
12 changes: 6 additions & 6 deletions records_mover/db/redshift/records_copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

class RedshiftCopyParamaters:
def __init__(self,
records_format: BaseRecordsFormat,
records_format: DelimitedRecordsFormat,
fail_if_cant_handle_hint: bool,
unhandled_hints: Set[str]):
self.redshift_options: RedshiftCopyOptions = {}
Expand All @@ -32,10 +32,10 @@ def process_compression(redshift_options: RedshiftCopyOptions,
'BZIP': Compression.bzip2,
None: None
}

compression = compression_map.get(hints.compression)
if compression is None and hints.compression is not None:
_assert_never(hints.compression)
hints_compression: Optional[str] = hints.compression
compression = compression_map.get(hints_compression)
if compression is None and hints_compression is not None:
_assert_never(hints_compression)
else:
redshift_options['compression'] = compression
quiet_remove(unhandled_hints, 'compression')
Expand Down Expand Up @@ -204,7 +204,7 @@ def redshift_copy_options(unhandled_hints: Set[str],
fail_if_cant_handle_hint: bool,
fail_if_row_invalid: bool,
max_failure_rows: Optional[int]) -> RedshiftCopyOptions:
redshift_options: RedshiftCopyOptions() = dict()
redshift_options: RedshiftCopyOptions = dict()

if isinstance(records_format, AvroRecordsFormat):
redshift_options['format'] = Format.avro
Expand Down
3 changes: 1 addition & 2 deletions records_mover/records/targets/fileobj.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ def write_dfs(path_or_buf: Union[str, IO[str]]) -> int:
move_count = write_dfs(text_fileobj)
text_fileobj.detach()
else:
with NamedTemporaryFile(prefix='mover_fileobj_target') as output_file:
move_count = write_dfs(output_file.name)
with NamedTemporaryFile(prefix='mover_fileobj_target') as output_file: # noqa
with open(output_file.name, "rb") as output_fileobj:
copyfileobj(output_fileobj, self.fileobj)

Expand Down

0 comments on commit 9a344ab

Please sign in to comment.