7
7
import re
8
8
import warnings
9
9
10
- import six
11
-
12
10
from kazoo .exceptions import (
13
11
AuthFailedError ,
14
12
ConfigurationError ,
66
64
from kazoo .recipe .watchers import ChildrenWatch , DataWatch
67
65
68
66
69
- string_types = six .string_types
70
- bytes_types = (six .binary_type ,)
71
-
72
67
CLOSED_STATES = (
73
68
KeeperState .EXPIRED_SESSION ,
74
69
KeeperState .AUTH_FAILED ,
@@ -415,10 +410,10 @@ def _reset(self):
415
410
416
411
def _reset_watchers (self ):
417
412
watchers = []
418
- for child_watchers in six . itervalues ( self ._child_watchers ):
413
+ for child_watchers in self ._child_watchers . values ( ):
419
414
watchers .extend (child_watchers )
420
415
421
- for data_watchers in six . itervalues ( self ._data_watchers ):
416
+ for data_watchers in self ._data_watchers . values ( ):
422
417
watchers .extend (data_watchers )
423
418
424
419
self ._child_watchers = defaultdict (set )
@@ -821,7 +816,7 @@ def _is_valid(version):
821
816
version = _try_fetch ()
822
817
if _is_valid (version ):
823
818
return version
824
- for _i in six . moves . range (0 , retries ):
819
+ for _i in range (0 , retries ):
825
820
version = _try_fetch ()
826
821
if _is_valid (version ):
827
822
return version
@@ -854,9 +849,9 @@ def add_auth_async(self, scheme, credential):
854
849
:rtype: :class:`~kazoo.interfaces.IAsyncResult`
855
850
856
851
"""
857
- if not isinstance (scheme , string_types ):
852
+ if not isinstance (scheme , str ):
858
853
raise TypeError ("Invalid type for 'scheme' (string expected)" )
859
- if not isinstance (credential , string_types ):
854
+ if not isinstance (credential , str ):
860
855
raise TypeError ("Invalid type for 'credential' (string expected)" )
861
856
862
857
# we need this auth data to re-authenticate on reconnect
@@ -1034,15 +1029,15 @@ def create_async(
1034
1029
if acl is None and self .default_acl :
1035
1030
acl = self .default_acl
1036
1031
1037
- if not isinstance (path , string_types ):
1032
+ if not isinstance (path , str ):
1038
1033
raise TypeError ("Invalid type for 'path' (string expected)" )
1039
1034
if acl and (
1040
1035
isinstance (acl , ACL ) or not isinstance (acl , (tuple , list ))
1041
1036
):
1042
1037
raise TypeError (
1043
1038
"Invalid type for 'acl' (acl must be a tuple/list" " of ACL's"
1044
1039
)
1045
- if value is not None and not isinstance (value , bytes_types ):
1040
+ if value is not None and not isinstance (value , bytes ):
1046
1041
raise TypeError ("Invalid type for 'value' (must be a byte string)" )
1047
1042
if not isinstance (ephemeral , bool ):
1048
1043
raise TypeError ("Invalid type for 'ephemeral' (bool expected)" )
@@ -1205,7 +1200,7 @@ def exists_async(self, path, watch=None):
1205
1200
:rtype: :class:`~kazoo.interfaces.IAsyncResult`
1206
1201
1207
1202
"""
1208
- if not isinstance (path , string_types ):
1203
+ if not isinstance (path , str ):
1209
1204
raise TypeError ("Invalid type for 'path' (string expected)" )
1210
1205
if watch and not callable (watch ):
1211
1206
raise TypeError ("Invalid type for 'watch' (must be a callable)" )
@@ -1248,7 +1243,7 @@ def get_async(self, path, watch=None):
1248
1243
:rtype: :class:`~kazoo.interfaces.IAsyncResult`
1249
1244
1250
1245
"""
1251
- if not isinstance (path , string_types ):
1246
+ if not isinstance (path , str ):
1252
1247
raise TypeError ("Invalid type for 'path' (string expected)" )
1253
1248
if watch and not callable (watch ):
1254
1249
raise TypeError ("Invalid type for 'watch' (must be a callable)" )
@@ -1304,7 +1299,7 @@ def get_children_async(self, path, watch=None, include_data=False):
1304
1299
:rtype: :class:`~kazoo.interfaces.IAsyncResult`
1305
1300
1306
1301
"""
1307
- if not isinstance (path , string_types ):
1302
+ if not isinstance (path , str ):
1308
1303
raise TypeError ("Invalid type for 'path' (string expected)" )
1309
1304
if watch and not callable (watch ):
1310
1305
raise TypeError ("Invalid type for 'watch' (must be a callable)" )
@@ -1346,7 +1341,7 @@ def get_acls_async(self, path):
1346
1341
:rtype: :class:`~kazoo.interfaces.IAsyncResult`
1347
1342
1348
1343
"""
1349
- if not isinstance (path , string_types ):
1344
+ if not isinstance (path , str ):
1350
1345
raise TypeError ("Invalid type for 'path' (string expected)" )
1351
1346
1352
1347
async_result = self .handler .async_result ()
@@ -1389,7 +1384,7 @@ def set_acls_async(self, path, acls, version=-1):
1389
1384
:rtype: :class:`~kazoo.interfaces.IAsyncResult`
1390
1385
1391
1386
"""
1392
- if not isinstance (path , string_types ):
1387
+ if not isinstance (path , str ):
1393
1388
raise TypeError ("Invalid type for 'path' (string expected)" )
1394
1389
if isinstance (acls , ACL ) or not isinstance (acls , (tuple , list )):
1395
1390
raise TypeError (
@@ -1447,9 +1442,9 @@ def set_async(self, path, value, version=-1):
1447
1442
:rtype: :class:`~kazoo.interfaces.IAsyncResult`
1448
1443
1449
1444
"""
1450
- if not isinstance (path , string_types ):
1445
+ if not isinstance (path , str ):
1451
1446
raise TypeError ("Invalid type for 'path' (string expected)" )
1452
- if value is not None and not isinstance (value , bytes_types ):
1447
+ if value is not None and not isinstance (value , bytes ):
1453
1448
raise TypeError ("Invalid type for 'value' (must be a byte string)" )
1454
1449
if not isinstance (version , int ):
1455
1450
raise TypeError ("Invalid type for 'version' (int expected)" )
@@ -1523,7 +1518,7 @@ def delete_async(self, path, version=-1):
1523
1518
:rtype: :class:`~kazoo.interfaces.IAsyncResult`
1524
1519
1525
1520
"""
1526
- if not isinstance (path , string_types ):
1521
+ if not isinstance (path , str ):
1527
1522
raise TypeError ("Invalid type for 'path' (string expected)" )
1528
1523
if not isinstance (version , int ):
1529
1524
raise TypeError ("Invalid type for 'version' (int expected)" )
@@ -1632,11 +1627,11 @@ def reconfig_async(self, joining, leaving, new_members, from_config):
1632
1627
:rtype: :class:`~kazoo.interfaces.IAsyncResult`
1633
1628
1634
1629
"""
1635
- if joining and not isinstance (joining , string_types ):
1630
+ if joining and not isinstance (joining , str ):
1636
1631
raise TypeError ("Invalid type for 'joining' (string expected)" )
1637
- if leaving and not isinstance (leaving , string_types ):
1632
+ if leaving and not isinstance (leaving , str ):
1638
1633
raise TypeError ("Invalid type for 'leaving' (string expected)" )
1639
- if new_members and not isinstance (new_members , string_types ):
1634
+ if new_members and not isinstance (new_members , str ):
1640
1635
raise TypeError (
1641
1636
"Invalid type for 'new_members' (string " "expected)"
1642
1637
)
@@ -1690,13 +1685,13 @@ def create(
1690
1685
if acl is None and self .client .default_acl :
1691
1686
acl = self .client .default_acl
1692
1687
1693
- if not isinstance (path , string_types ):
1688
+ if not isinstance (path , str ):
1694
1689
raise TypeError ("Invalid type for 'path' (string expected)" )
1695
1690
if acl and not isinstance (acl , (tuple , list )):
1696
1691
raise TypeError (
1697
1692
"Invalid type for 'acl' (acl must be a tuple/list" " of ACL's"
1698
1693
)
1699
- if not isinstance (value , bytes_types ):
1694
+ if not isinstance (value , bytes ):
1700
1695
raise TypeError ("Invalid type for 'value' (must be a byte string)" )
1701
1696
if not isinstance (ephemeral , bool ):
1702
1697
raise TypeError ("Invalid type for 'ephemeral' (bool expected)" )
@@ -1722,7 +1717,7 @@ def delete(self, path, version=-1):
1722
1717
`recursive`.
1723
1718
1724
1719
"""
1725
- if not isinstance (path , string_types ):
1720
+ if not isinstance (path , str ):
1726
1721
raise TypeError ("Invalid type for 'path' (string expected)" )
1727
1722
if not isinstance (version , int ):
1728
1723
raise TypeError ("Invalid type for 'version' (int expected)" )
@@ -1733,9 +1728,9 @@ def set_data(self, path, value, version=-1):
1733
1728
arguments as :meth:`KazooClient.set`.
1734
1729
1735
1730
"""
1736
- if not isinstance (path , string_types ):
1731
+ if not isinstance (path , str ):
1737
1732
raise TypeError ("Invalid type for 'path' (string expected)" )
1738
- if not isinstance (value , bytes_types ):
1733
+ if not isinstance (value , bytes ):
1739
1734
raise TypeError ("Invalid type for 'value' (must be a byte string)" )
1740
1735
if not isinstance (version , int ):
1741
1736
raise TypeError ("Invalid type for 'version' (int expected)" )
@@ -1750,7 +1745,7 @@ def check(self, path, version):
1750
1745
does not match the specified version.
1751
1746
1752
1747
"""
1753
- if not isinstance (path , string_types ):
1748
+ if not isinstance (path , str ):
1754
1749
raise TypeError ("Invalid type for 'path' (string expected)" )
1755
1750
if not isinstance (version , int ):
1756
1751
raise TypeError ("Invalid type for 'version' (int expected)" )
0 commit comments