Skip to content

Commit 16ef052

Browse files
authored
Remove use of future module (v3io#139)
This module was used to enable Python 2 support, which is no longer relevant. [IG-24291](https://iguazio.atlassian.net/browse/IG-24291)
1 parent dc741ef commit 16ef052

File tree

6 files changed

+19
-28
lines changed

6 files changed

+19
-28
lines changed

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,22 @@ all:
3232
.PHONY: fmt
3333
fmt:
3434
@echo "Running black fmt..."
35-
python -m black $(BLACK_OPTIONS) $(CHECKED_IN_PYTHON_FILES)
36-
python -m isort $(ISORT_OPTIONS) $(CHECKED_IN_PYTHON_FILES)
35+
@python -m black $(BLACK_OPTIONS) $(CHECKED_IN_PYTHON_FILES)
36+
@python -m isort $(ISORT_OPTIONS) $(CHECKED_IN_PYTHON_FILES)
3737

3838
.PHONY: lint
3939
lint: flake8 fmt-check
4040

4141
.PHONY: fmt-check
4242
fmt-check:
4343
@echo "Running black+isort fmt check..."
44-
python -m black $(BLACK_OPTIONS) --check --diff $(CHECKED_IN_PYTHON_FILES)
45-
python -m isort --check --diff $(ISORT_OPTIONS) $(CHECKED_IN_PYTHON_FILES)
44+
@python -m black $(BLACK_OPTIONS) --check --diff $(CHECKED_IN_PYTHON_FILES)
45+
@python -m isort --check --diff $(ISORT_OPTIONS) $(CHECKED_IN_PYTHON_FILES)
4646

4747
.PHONY: flake8
4848
flake8:
4949
@echo "Running flake8 lint..."
50-
python -m flake8 $(FLAKE8_OPTIONS) $(CHECKED_IN_PYTHON_FILES)
50+
@python -m flake8 $(FLAKE8_OPTIONS) $(CHECKED_IN_PYTHON_FILES)
5151

5252
.PHONY: clean_pyc
5353
clean_pyc:

tests/test_client.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
import unittest
2121
import unittest.mock
2222

23-
import future.utils
24-
2523
import v3io.common.helpers
2624
import v3io.dataplane
2725
import v3io.dataplane.output
@@ -340,7 +338,7 @@ def test_create_schema(self):
340338
"c": {"data_field_0": 3000, "data_field_1": 10000},
341339
}
342340

343-
for item_key, item_attributes in future.utils.viewitems(items):
341+
for item_key, item_attributes in items.items():
344342
self._client.kv.put(
345343
container=self._container, table_path=self._schema_dir, key=item_key, attributes=item_attributes
346344
)
@@ -460,7 +458,7 @@ def test_kv(self):
460458
"tina": {"age": 14, "feature": "butts"},
461459
}
462460

463-
for item_key, item_attributes in future.utils.viewitems(items):
461+
for item_key, item_attributes in items.items():
464462
self._client.kv.put(
465463
container=self._container, table_path=self._path, key=item_key, attributes=item_attributes
466464
)
@@ -566,7 +564,7 @@ def test_batch(self):
566564
}
567565

568566
# put the item in a batch
569-
for item_key, item_attributes in future.utils.viewitems(items):
567+
for item_key, item_attributes in items.items():
570568
self._client.batch.kv.put(
571569
container=self._container, table_path=self._path, key=item_key, attributes=item_attributes
572570
)
@@ -586,7 +584,7 @@ def test_batch(self):
586584

587585
def _delete_items(self, path, items):
588586
# delete items
589-
for item_key, _ in future.utils.viewitems(items):
587+
for item_key, _ in items.items():
590588
self._client.kv.delete(container=self._container, table_path=path, key=item_key)
591589

592590
# delete dir
@@ -737,7 +735,7 @@ def test_kv_batch(self):
737735
}
738736

739737
# put the item in a batch
740-
for item_key, item_attributes in future.utils.viewitems(items):
738+
for item_key, item_attributes in items.items():
741739
self._client.batch.put_item(
742740
container=self._container,
743741
path=v3io.common.helpers.url_join(self._kv_path, item_key),

tests/test_client_aio.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
import os
1818
import unittest
1919

20-
import future.utils
21-
2220
import v3io.aio.dataplane
2321
import v3io.dataplane
2422

@@ -313,7 +311,7 @@ async def test_get_offset(self):
313311
# "c": {"data_field_0": 3000, "data_field_1": 10000},
314312
# }
315313
#
316-
# for item_key, item_attributes in future.utils.viewitems(items):
314+
# for item_key, item_attributes in items.items():
317315
# await self._client.kv.put(
318316
# container=self._container, table_path=self._schema_dir, key=item_key, attributes=item_attributes
319317
# )
@@ -428,7 +426,7 @@ async def test_kv(self):
428426
"tina": {"age": 14, "feature": "butts"},
429427
}
430428

431-
for item_key, item_attributes in future.utils.viewitems(items):
429+
for item_key, item_attributes in items.items():
432430
await self._client.kv.put(
433431
container=self._container, table_path=self._path, key=item_key, attributes=item_attributes
434432
)
@@ -529,7 +527,7 @@ async def test_limit(self):
529527

530528
async def _delete_items(self, path, items):
531529
# delete items
532-
for item_key, _ in future.utils.viewitems(items):
530+
for item_key, _ in items.items():
533531
await self._client.kv.delete(container=self._container, table_path=path, key=item_key)
534532

535533
# delete dir

v3io/dataplane/client.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import os
1616
import sys
1717

18-
import future.utils
1918
import orjson
2019

2120
import v3io.common.helpers
@@ -413,7 +412,7 @@ def put_items(self, container, path, items, access_key=None, raise_for_status=No
413412
"""
414413
responses = v3io.dataplane.response.Responses()
415414

416-
for item_path, item_attributes in future.utils.viewitems(items):
415+
for item_path, item_attributes in items.items():
417416
# create a put item input
418417
response = self.put_item(
419418
container,

v3io/dataplane/output.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
#
1515
import base64
1616

17-
import future.utils
18-
1917
import v3io.dataplane.kv_array
2018
import v3io.dataplane.kv_timestamp
2119

@@ -24,8 +22,8 @@ class Output(object):
2422
def _decode_typed_attributes(self, typed_attributes):
2523
decoded_attributes = {}
2624

27-
for attribute_key, typed_attribute_value in future.utils.viewitems(typed_attributes):
28-
for attribute_type, attribute_value in future.utils.viewitems(typed_attribute_value):
25+
for attribute_key, typed_attribute_value in typed_attributes.items():
26+
for attribute_type, attribute_value in typed_attribute_value.items():
2927
if attribute_type == "N":
3028
try:
3129
decoded_attribute = int(attribute_value)

v3io/dataplane/request.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
import datetime
1818
import os
1919

20-
import future.utils
21-
2220
try:
2321
from urllib.parse import quote, urlencode
2422
except BaseException:
@@ -421,11 +419,11 @@ def _to_base64(input):
421419
def _dict_to_typed_attributes(d):
422420
typed_attributes = {}
423421
max_string_length = 61199
424-
for key, value in future.utils.viewitems(d):
422+
for key, value in d.items():
425423
attribute_type = type(value)
426424
type_value = None
427425

428-
if isinstance(value, future.utils.text_type):
426+
if isinstance(value, str):
429427
type_key = "S"
430428
type_value = value
431429
if len(value) > max_string_length:
@@ -434,7 +432,7 @@ def _dict_to_typed_attributes(d):
434432
key, len(value), max_string_length
435433
)
436434
)
437-
elif isinstance(value, future.utils.string_types):
435+
elif isinstance(value, str):
438436
type_key = "S"
439437
type_value = str(value)
440438
if len(type_value) > max_string_length:

0 commit comments

Comments
 (0)