Python: Add style checking with Flake8 to CI (#1034) · apache/iceberg-python@faec5d6 · GitHub
Skip to content

Commit faec5d6

Browse files
committed
Python: Add style checking with Flake8 to CI (#1034)
1 parent f1e53d9 commit faec5d6

12 files changed

Lines changed: 17 additions & 16 deletions

File tree

‎README.md‎

Lines changed: 1 addition & 0 deletions

‎iceberg/api/io/closeable_iterable.py‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,8 @@
2020

2121
class CloseableIterable(collections.Iterator):
2222

23-
def next(self):
24-
raise NotImplementedError()
25-
2623
def __next__(self):
27-
return self.next()
24+
raise NotImplementedError()
2825

2926
def close(self):
3027
raise NotImplementedError()

‎iceberg/api/partition_spec.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def fields(self):
5858
def java_classes(self):
5959
if self.__java_classes is None:
6060
self.__java_classes
61-
for i, field in enumerate(self.__fields):
61+
for field in self.__fields:
6262
source_type = self.schema.find_type(field.source_id)
6363
result = field.transform().get_result_by_type(source_type)
6464
self.__java_classes.append(result.type_id.java_class())

‎iceberg/api/types/type_util.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ def struct(self, struct, field_results):
403403
length = len(struct.fields)
404404
new_ids = list()
405405

406-
for i in range(length):
406+
for _ in range(length):
407407
new_ids.append(self.next_id())
408408

409409
new_fields = list()

‎iceberg/core/avro/avro_to_iceberg.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,7 @@ def convert_map_type(avro_field, next_id=None):
203203
avro_field_type = avro_field.get(AvroToIceberg.FIELD_TYPE_PROP)
204204
avro_logical_type = avro_field.get(AvroToIceberg.FIELD_LOGICAL_TYPE_PROP)
205205
if avro_field_type != "array" or avro_logical_type != "map":
206-
raise RuntimeError("Avro type must be array and logical type must be map: %s" % (avro_field_type,
207-
avro_logical_type))
206+
raise RuntimeError("Avro type must be array and logical type must be map: %s" % avro_logical_type)
208207
is_optional = False
209208
items = avro_field.get(AvroToIceberg.FIELD_ITEMS_PROP)
210209
for field in items.get(AvroToIceberg.FIELD_FIELDS_PROP, list()):

‎iceberg/core/base_metastore_tables.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,4 @@ def default_warehouse_location(self, conf, database, table):
5050
if warehouse_location is None:
5151
raise RuntimeError("Warehouse location is not set: hive.metastore.warehouse.dir=null")
5252

53-
return "%s/%s.db/%s".format(warehouse_location, database, table)
53+
return f"{warehouse_location}/{database}.db/{table}"

‎iceberg/core/data_files.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def copy_partition_data(spec, partition_data, reuse):
3737
if data is None:
3838
data = DataFiles.new_partition_data(spec)
3939

40-
for i, field in enumerate(spec.fields):
40+
for i, _ in enumerate(spec.fields):
4141
data.set(i, partition_data.get(i))
4242

4343
return data

‎iceberg/core/filesystem/s3_filesystem.py‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def close(self):
182182
def flush(self):
183183
pass
184184

185-
def next(self):
185+
def __next__(self):
186186
return next(self.readline())
187187

188188
def read(self, n=0):
@@ -251,6 +251,3 @@ def __exit__(self, exc_type, exc_val, exc_tb):
251251

252252
def __iter__(self):
253253
return self
254-
255-
def __next__(self):
256-
return self.next()

‎iceberg/core/scan_summary.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def from_partition_summaries(self, snapshots):
184184
or str_as_bool(snap.summary.get(SnapshotSummary.PARTITION_SUMMARY_PROP, "false")):
185185
return None
186186

187-
for key, val in snap.summary.items():
187+
for key, _ in snap.summary.items():
188188
if key.startswith(SnapshotSummary.CHANGED_PARTITION_PREFIX):
189189
part_key = key[len(SnapshotSummary.CHANGED_PARTITION_PREFIX):]
190190
# part = dict(entry.split("=") for entry in val.split(","))

‎setup.py‎

Lines changed: 6 additions & 0 deletions

0 commit comments

Comments
 (0)