Fokko commented on code in PR #7829:
URL: https://github.com/apache/iceberg/pull/7829#discussion_r1229096159
##########
python/pyiceberg/catalog/__init__.py:
##########
@@ -413,34 +413,34 @@ def identifier_to_tuple(identifier: Union[str,
Identifier]) -> Identifier:
If the identifier is a string, it is split into a tuple on '.'. If it
is a tuple, it is used as-is.
Args:
- identifier (str | Identifier: an identifier, either a string or
tuple of strings
+ identifier (str | Identifier: an identifier, either a string or
tuple of strings.
Returns:
- Identifier: a tuple of strings
+ Identifier: a tuple of strings.
"""
return identifier if isinstance(identifier, tuple) else
tuple(str.split(identifier, "."))
@staticmethod
def table_name_from(identifier: Union[str, Identifier]) -> str:
- """Extracts table name from a table identifier
+ """Extracts table name from a table identifier.
Args:
- identifier (str | Identifier: a table identifier
+ identifier (str | Identifier: a table identifier.
Returns:
- str: Table name
+ str: Table name.
"""
return Catalog.identifier_to_tuple(identifier)[-1]
@staticmethod
def namespace_from(identifier: Union[str, Identifier]) -> Identifier:
- """Extracts table namespace from a table identifier
+ """Extracts table namespace from a table identifier.
Args:
- identifier (str | Identifier: a table identifier
+ identifier (str | Identifier: a table identifier.
Review Comment:
Found a missing bracket!
```suggestion
identifier (Union[str, Identifier]): a table identifier.
```
##########
python/pyiceberg/io/pyarrow.py:
##########
@@ -505,16 +505,16 @@ def pyarrow_to_schema(schema: pa.Schema) -> Schema:
@singledispatch
def visit_pyarrow(obj: pa.DataType | pa.Schema, visitor:
PyArrowSchemaVisitor[T]) -> T:
- """A generic function for applying a pyarrow schema visitor to any point
within a schema
+ """A generic function for applying a pyarrow schema visitor to any point
within a schema.
- The function traverses the schema in post-order fashion
+ The function traverses the schema in post-order fashion.
Args:
- obj(pa.DataType): An instance of a Schema or an IcebergType
- visitor (PyArrowSchemaVisitor[T]): An instance of an implementation of
the generic PyarrowSchemaVisitor base class
+ obj(pa.DataType): An instance of a Schema or an IcebergType.
Review Comment:
```suggestion
obj (Union[pa.DataType, pa.Schema]): An instance of a Schema or an
IcebergType.
```
##########
python/pyiceberg/serializers.py:
##########
@@ -23,49 +23,49 @@
class FromByteStream:
- """A collection of methods that deserialize dictionaries into Iceberg
objects"""
+ """A collection of methods that deserialize dictionaries into Iceberg
objects."""
@staticmethod
def table_metadata(byte_stream: InputStream, encoding: str = "utf-8") ->
TableMetadata:
- """Instantiate a TableMetadata object from a byte stream
+ """Instantiate a TableMetadata object from a byte stream.
Args:
- byte_stream: A file-like byte stream object
- encoding (default "utf-8"): The byte encoder to use for the reader
+ byte_stream: A file-like byte stream object.
+ encoding (default "utf-8"): The byte encoder to use for the reader.
"""
reader = codecs.getreader(encoding)
metadata = json.load(reader(byte_stream))
return TableMetadataUtil.parse_obj(metadata)
class FromInputFile:
- """A collection of methods that deserialize InputFiles into Iceberg
objects"""
+ """A collection of methods that deserialize InputFiles into Iceberg
objects."""
@staticmethod
def table_metadata(input_file: InputFile, encoding: str = "utf-8") ->
TableMetadata:
- """Create a TableMetadata instance from an input file
+ """Create a TableMetadata instance from an input file.
Args:
- input_file (InputFile): A custom implementation of the
iceberg.io.file.InputFile abstract base class
- encoding (str): Encoding to use when loading bytestream
+ input_file (InputFile): A custom implementation of the
iceberg.io.file.InputFile abstract base class.
+ encoding (str): Encoding to use when loading bytestream.
Returns:
- TableMetadata: A table metadata instance
+ TableMetadata: A table metadata instance.
"""
with input_file.open() as input_stream:
return FromByteStream.table_metadata(byte_stream=input_stream,
encoding=encoding)
class ToOutputFile:
- """A collection of methods that serialize Iceberg objects into files given
an OutputFile instance"""
+ """A collection of methods that serialize Iceberg objects into files given
an OutputFile instance..."""
Review Comment:
```suggestion
"""A collection of methods that serialize Iceberg objects into files
given an OutputFile instance."""
```
##########
python/pyiceberg/io/pyarrow.py:
##########
@@ -505,16 +505,16 @@ def pyarrow_to_schema(schema: pa.Schema) -> Schema:
@singledispatch
def visit_pyarrow(obj: pa.DataType | pa.Schema, visitor:
PyArrowSchemaVisitor[T]) -> T:
Review Comment:
```suggestion
def visit_pyarrow(obj: Union[pa.DataType, pa.Schema], visitor:
PyArrowSchemaVisitor[T]) -> T:
```
##########
python/pyiceberg/conversions.py:
##########
@@ -109,8 +109,9 @@ def _(primitive_type: BooleanType, value_str: str) ->
Union[int, float, str, uui
@handle_none
def _(primitive_type: PrimitiveType, value_str: str) -> int:
"""
+ Conversion function.
Review Comment:
This one needs to go a line up, but we can do that in a separate PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]