Skip to content

Commit

Permalink
Remove Python 2.7 support and six.py
Browse files Browse the repository at this point in the history
  • Loading branch information
sepeth committed May 22, 2024
1 parent 2ce0973 commit 4485534
Show file tree
Hide file tree
Showing 18 changed files with 173 additions and 1,119 deletions.
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ ignore = E203, E266, E402, E501, W503, F403, F401, E711, C901, E721, W605
max-line-length = 88
max-complexity = 18
select = B,C,E,F,W,T4,B9
exclude = bindings/python/fdb/six.py,contrib/Implib.so/implib-gen.py,documentation/sphinx/extensions/rubydomain.py
exclude = contrib/Implib.so/implib-gen.py,documentation/sphinx/extensions/rubydomain.py
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ repos:
- id: black
exclude: |
(?x)^(
bindings/python/fdb/six.py|
contrib/Implib.so/implib-gen.py|
documentation/sphinx/extensions/rubydomain.py
)$
Expand Down
9 changes: 0 additions & 9 deletions bindings/bindingtester/known_testers.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,6 @@ def _absolute_path(path):
testers = {
"python": Tester(
"python",
"python " + _absolute_path("python/tests/tester.py"),
2040,
23,
MAX_API_VERSION,
types=ALL_TYPES,
tenants_enabled=True,
),
"python3": Tester(
"python3",
"python3 " + _absolute_path("python/tests/tester.py"),
2040,
23,
Expand Down
2 changes: 0 additions & 2 deletions bindings/bindingtester/run_tester_loop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ function scripted() {

function run_scripted() {
scripted python
scripted python3
scripted ruby
scripted java
scripted java_async
Expand All @@ -35,7 +34,6 @@ while `true`; do
echo "Pass $i"
i=$((i+1))
run python
run python3
run ruby
run java
run java_async
Expand Down
1 change: 0 additions & 1 deletion bindings/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ set(SRCS
fdb/directory_impl.py
fdb/impl.py
fdb/locality.py
fdb/six.py
fdb/subspace_impl.py
fdb/tenant_management.py
fdb/tuple.py
Expand Down
9 changes: 4 additions & 5 deletions bindings/python/fdb/directory_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import threading

from fdb import impl as _impl
from fdb import six
import fdb.tuple
from .subspace_impl import Subspace

Expand Down Expand Up @@ -613,17 +612,17 @@ def _is_prefix_empty(self, tr, prefix):

def _to_unicode_path(path):
if isinstance(path, bytes):
path = six.text_type(path)
path = str(path)

if isinstance(path, six.text_type):
if isinstance(path, str):
return (path,)

if isinstance(path, tuple):
path = list(path)
for i, name in enumerate(path):
if isinstance(name, bytes):
path[i] = six.text_type(path[i])
elif not isinstance(name, six.text_type):
path[i] = str(path[i])
elif not isinstance(name, str):
raise ValueError(
"Invalid path: must be a unicode string or a tuple of unicode strings"
)
Expand Down
6 changes: 2 additions & 4 deletions bindings/python/fdb/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@
import weakref

import fdb
from fdb import six
from fdb.tuple import pack
from fdb.tuple import pack, int2byte

from fdb import fdboptions as _opts

Expand Down Expand Up @@ -137,7 +136,6 @@ def fill_options(scope, predicates=False):
elif paramType == type(""):
f = option_wrap_string(code)
elif paramType == type(b""):
# This won't happen in Python 2 because type("") == type(b""), but it will happen in Python 3
f = option_wrap_bytes(code)
elif paramType == type(0):
f = option_wrap_int(code)
Expand Down Expand Up @@ -2169,4 +2167,4 @@ def strinc(key):
if len(key) == 0:
raise ValueError("Key must contain at least one byte not equal to 0xFF.")

return key[:-1] + six.int2byte(ord(key[-1:]) + 1)
return key[:-1] + int2byte(ord(key[-1:]) + 1)
Loading

0 comments on commit 4485534

Please sign in to comment.