Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyiceberg/catalog/hive.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def __init__(self, uri: str, ugi: Optional[str] = None):
protocol = TBinaryProtocol.TBinaryProtocol(transport)

self._client = Client(protocol)
self._ugi = ugi.split(':') if ugi else None
self._ugi = ugi.split(":") if ugi else None

def __enter__(self) -> Client:
self._transport.open()
Expand Down
2 changes: 1 addition & 1 deletion pyiceberg/catalog/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class CreateTableRequest(IcebergBaseModel):
properties: Dict[str, str] = Field(default_factory=dict)

# validators
@field_validator('properties', mode='before')
@field_validator("properties", mode="before")
def transform_properties_dict_value_to_str(cls, properties: Properties) -> Dict[str, str]:
return transform_dict_value_to_str(properties)

Expand Down
10 changes: 5 additions & 5 deletions pyiceberg/expressions/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
identifier = Word(alphas, alphanums + "_$").set_results_name("identifier")
column = DelimitedList(identifier, delim=".", combine=False).set_results_name("column")

like_regex = r'(?P<valid_wildcard>(?<!\\)%$)|(?P<invalid_wildcard>(?<!\\)%)'
like_regex = r"(?P<valid_wildcard>(?<!\\)%$)|(?P<invalid_wildcard>(?<!\\)%)"


@column.set_parse_action
Expand Down Expand Up @@ -232,12 +232,12 @@ def _evaluate_like_statement(result: ParseResults) -> BooleanExpression:

match = re.search(like_regex, literal_like.value)

if match and match.groupdict()['invalid_wildcard']:
if match and match.groupdict()["invalid_wildcard"]:
raise ValueError("LIKE expressions only supports wildcard, '%', at the end of a string")
elif match and match.groupdict()['valid_wildcard']:
return StartsWith(result.column, StringLiteral(literal_like.value[:-1].replace('\\%', '%')))
elif match and match.groupdict()["valid_wildcard"]:
return StartsWith(result.column, StringLiteral(literal_like.value[:-1].replace("\\%", "%")))
else:
return EqualTo(result.column, StringLiteral(literal_like.value.replace('\\%', '%')))
return EqualTo(result.column, StringLiteral(literal_like.value.replace("\\%", "%")))


predicate = (comparison | in_check | null_check | nan_check | starts_check | boolean).set_results_name("predicate")
Expand Down
2 changes: 1 addition & 1 deletion pyiceberg/partitioning.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def partition_to_path(self, data: Record, schema: Schema) -> str:
partition_field = self.fields[pos]
value_str = partition_field.transform.to_human_string(field_types[pos].field_type, value=data[pos])

value_str = quote(value_str, safe='')
value_str = quote(value_str, safe="")
value_strs.append(value_str)
field_strs.append(partition_field.name)

Expand Down
10 changes: 5 additions & 5 deletions pyiceberg/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -1311,29 +1311,29 @@ def _valid_avro_name(name: str) -> bool:
length = len(name)
assert length > 0, ValueError("Can not validate empty avro name")
first = name[0]
if not (first.isalpha() or first == '_'):
if not (first.isalpha() or first == "_"):
return False

for character in name[1:]:
if not (character.isalnum() or character == '_'):
if not (character.isalnum() or character == "_"):
return False
return True


def _sanitize_name(name: str) -> str:
sb = []
first = name[0]
if not (first.isalpha() or first == '_'):
if not (first.isalpha() or first == "_"):
sb.append(_sanitize_char(first))
else:
sb.append(first)

for character in name[1:]:
if not (character.isalnum() or character == '_'):
if not (character.isalnum() or character == "_"):
sb.append(_sanitize_char(character))
else:
sb.append(character)
return ''.join(sb)
return "".join(sb)


def _sanitize_char(character: str) -> str:
Expand Down
Loading