Skip to content

Commit 5756337

Browse files
author
Matias Melograno
committed
removed six
1 parent 40e6891 commit 5756337

32 files changed

+51
-108
lines changed

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
'pyyaml>=5.1',
1919
'future>=0.15.2',
2020
'docopt>=0.6.2',
21-
'six>=1.10.0',
2221
'enum34;python_version<"3.4"',
2322
'futures>=3.0.5;python_version<"3"'
2423
]

splitio/api/telemetry.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""Telemetry API Module."""
22
import logging
33

4-
import six
54
from future.utils import raise_from
65

76
from splitio.api import APIException, headers_from_metadata
@@ -39,7 +38,7 @@ def _build_latencies(latencies):
3938
"""
4039
return [
4140
{'name': name, 'latencies': latencies_list}
42-
for name, latencies_list in six.iteritems(latencies)
41+
for name, latencies_list in latencies.items()
4342
]
4443

4544
def flush_latencies(self, latencies):
@@ -77,7 +76,7 @@ def _build_gauges(gauges):
7776
"""
7877
return [
7978
{'name': name, 'value': value}
80-
for name, value in six.iteritems(gauges)
79+
for name, value in gauges.items()
8180
]
8281

8382
def flush_gauges(self, gauges):
@@ -115,7 +114,7 @@ def _build_counters(counters):
115114
"""
116115
return [
117116
{'name': name, 'delta': value}
118-
for name, value in six.iteritems(counters)
117+
for name, value in counters.items()
119118
]
120119

121120
def flush_counters(self, counters):

splitio/client/client.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import logging
66
import time
7-
import six
87
from splitio.engine.evaluator import Evaluator, CONTROL
98
from splitio.engine.splitters import Splitter
109
from splitio.models.impressions import Impression, Label
@@ -309,7 +308,7 @@ def get_treatments(self, key, features, attributes=None):
309308
"""
310309
with_config = self._make_evaluations(key, features, attributes, 'get_treatments',
311310
self._METRIC_GET_TREATMENTS)
312-
return {feature: result[0] for (feature, result) in six.iteritems(with_config)}
311+
return {feature: result[0] for (feature, result) in with_config.items()}
313312

314313
def _build_impression( # pylint: disable=too-many-arguments
315314
self,

splitio/client/input_validator.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
import re
88
import math
99

10-
import six
11-
1210
from splitio.api import APIException
1311
from splitio.client.key import Key
1412
from splitio.engine.evaluator import CONTROL
@@ -53,7 +51,7 @@ def _check_is_string(value, name, operation):
5351
:return: The result of validation
5452
:rtype: True|False
5553
"""
56-
if isinstance(value, six.string_types) is False:
54+
if isinstance(value, str) is False:
5755
_LOGGER.error(
5856
'%s: you passed an invalid %s, %s must be a non-empty string.',
5957
operation, name, name
@@ -121,7 +119,7 @@ def _check_can_convert(value, name, operation):
121119
:return: The result of validation
122120
:rtype: None|string
123121
"""
124-
if isinstance(value, six.string_types):
122+
if isinstance(value, str):
125123
return value
126124
else:
127125
# check whether if isnan and isinf are really necessary
@@ -173,7 +171,7 @@ def _check_valid_object_key(key, name, operation):
173171
'%s: you passed a null %s, %s must be a non-empty string.',
174172
operation, name, name)
175173
return None
176-
if isinstance(key, six.string_types):
174+
if isinstance(key, str):
177175
if not _check_string_not_empty(key, name, operation):
178176
return None
179177
key_str = _check_can_convert(key, name, operation)
@@ -515,8 +513,8 @@ def valid_properties(properties):
515513

516514
valid_properties = dict()
517515

518-
for property, element in six.iteritems(properties):
519-
if not isinstance(property, six.string_types): # Exclude property if is not string
516+
for property, element in properties.items():
517+
if not isinstance(property, str): # Exclude property if is not string
520518
continue
521519

522520
valid_properties[property] = None
@@ -525,14 +523,14 @@ def valid_properties(properties):
525523
if element is None:
526524
continue
527525

528-
if not isinstance(element, six.string_types) and not isinstance(element, Number) \
526+
if not isinstance(element, str) and not isinstance(element, Number) \
529527
and not isinstance(element, bool):
530528
_LOGGER.warning('Property %s is of invalid type. Setting value to None', element)
531529
element = None
532530

533531
valid_properties[property] = element
534532

535-
if isinstance(element, six.string_types):
533+
if isinstance(element, str):
536534
size += len(element)
537535

538536
if size > MAX_PROPERTIES_LENGTH_BYTES:

splitio/client/listener.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import abc
44

5-
from six import add_metaclass
65
from future.utils import raise_from
76

87

@@ -56,8 +55,7 @@ def log_impression(self, impression, attributes=None):
5655
exc
5756
)
5857

59-
@add_metaclass(abc.ABCMeta) #pylint: disable=too-few-public-methods
60-
class ImpressionListener(object):
58+
class ImpressionListener(object, metaclass=abc.ABCMeta):
6159
"""Impression listener interface."""
6260

6361
@abc.abstractmethod

splitio/engine/evaluator.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Split evaluator module."""
22
import logging
3-
import six
43
from splitio.models.grammar.condition import ConditionType
54
from splitio.models.impressions import Label
65

@@ -135,7 +134,7 @@ def evaluate_features(self, features, matching_key, bucketing_key, attributes=No
135134
return {
136135
feature: self._evaluate_treatment(feature, matching_key,
137136
bucketing_key, attributes, split)
138-
for (feature, split) in six.iteritems(self._split_storage.fetch_many(features))
137+
for (feature, split) in self._split_storage.fetch_many(features).items()
139138
}
140139

141140
def _get_treatment_for_split(self, split, matching_key, bucketing_key, attributes=None):

splitio/engine/hashfns/murmur3py.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
from __future__ import absolute_import, division, print_function, \
44
unicode_literals
55

6-
from six.moves import range
7-
8-
96
def murmur32_py(key, seed=0x0):
107
"""
118
Pure python implementation of murmur32 hash.

splitio/engine/impressions.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
from collections import defaultdict, namedtuple
55
from enum import Enum
66

7-
import six
8-
97
from splitio.models.impressions import Impression
108
from splitio.engine.hashfns import murmur_128
119
from splitio.engine.cache.lru import SimpleLruCache
@@ -151,7 +149,7 @@ def pop_all(self):
151149
self._data = defaultdict(lambda: 0)
152150

153151
return [Counter.CountPerFeature(k.feature, k.timeframe, v)
154-
for (k, v) in six.iteritems(old)]
152+
for (k, v) in old.items()]
155153

156154

157155
class Manager(object): # pylint:disable=too-few-public-methods

splitio/models/grammar/condition.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from enum import Enum
44
from future.utils import python_2_unicode_compatible
5-
import six
65

76
from splitio.models.grammar import matchers
87
from splitio.models.grammar import partitions
@@ -103,7 +102,7 @@ def to_json(self):
103102
'label': self._label,
104103
'matcherGroup': {
105104
'combiner': next(
106-
(k, v) for k, v in six.iteritems(_MATCHER_COMBINERS) if v == self._combiner
105+
(k, v) for k, v in _MATCHER_COMBINERS.items() if v == self._combiner
107106
)[0],
108107
'matchers': [m.to_json() for m in self.matchers]
109108
},

splitio/models/grammar/matchers/base.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
"""Abstract matcher module."""
22
import abc
33

4-
from six import add_metaclass
5-
64
from splitio.client.key import Key
75

86

9-
@add_metaclass(abc.ABCMeta)
10-
class Matcher(object):
7+
class Matcher(object, metaclass=abc.ABCMeta):
118
"""Matcher abstract class."""
129

1310
def __init__(self, raw_matcher):

0 commit comments

Comments
 (0)