From 2ebab0430103975c5fbd77a0a8bd80fdbf4a26e4 Mon Sep 17 00:00:00 2001 From: Eli Bishop Date: Tue, 11 Jun 2019 14:46:14 -0700 Subject: [PATCH] prepare 6.9.3 release (#126) --- ldclient/client.py | 26 +++++++++---------- ldclient/config.py | 2 +- ldclient/flag.py | 2 +- .../integrations/files/file_data_source.py | 2 +- ldclient/operators.py | 8 +++--- ldclient/sse_client.py | 4 +-- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/ldclient/client.py b/ldclient/client.py index 16d91b0a..5a65201a 100644 --- a/ldclient/client.py +++ b/ldclient/client.py @@ -82,7 +82,7 @@ def __init__(self, sdk_key=None, config=None, start_wait=5): "Only one of either is expected") if sdk_key is not None: - log.warn("Deprecated sdk_key argument was passed to init. Use config object instead.") + log.warning("Deprecated sdk_key argument was passed to init. Use config object instead.") self._config = Config(sdk_key=sdk_key) else: self._config = config or Config.default() @@ -113,7 +113,7 @@ def __init__(self, sdk_key=None, config=None, start_wait=5): if self._update_processor.initialized() is True: log.info("Started LaunchDarkly Client: OK") else: - log.warn("Initialization timeout exceeded for LaunchDarkly Client or an error occurred. " + log.warning("Initialization timeout exceeded for LaunchDarkly Client or an error occurred. " "Feature Flags may not yet be available.") def _make_event_processor(self, config): @@ -139,7 +139,7 @@ def _make_update_processor(self, config, store, ready): return StreamingUpdateProcessor(config, feature_requester, store, ready) log.info("Disabling streaming API") - log.warn("You should only disable the streaming API if instructed to do so by LaunchDarkly support") + log.warning("You should only disable the streaming API if instructed to do so by LaunchDarkly support") return PollingUpdateProcessor(config, feature_requester, store, ready) def get_sdk_key(self): @@ -180,7 +180,7 @@ def track(self, event_name, user, data=None): :param data: optional additional data associated with the event """ if user is None or user.get('key') is None: - log.warn("Missing user or user key when calling track().") + log.warning("Missing user or user key when calling track().") else: self._send_event({'kind': 'custom', 'key': event_name, 'user': user, 'data': data}) @@ -194,7 +194,7 @@ def identify(self, user): :param dict user: attributes of the user to register """ if user is None or user.get('key') is None: - log.warn("Missing user or user key when calling identify().") + log.warning("Missing user or user key when calling identify().") else: self._send_event({'kind': 'identify', 'key': str(user.get('key')), 'user': user}) @@ -234,7 +234,7 @@ def toggle(self, key, user, default): .. deprecated:: 2.0.0 """ - log.warn("Deprecated method: toggle() called. Use variation() instead.") + log.warning("Deprecated method: toggle() called. Use variation() instead.") return self.variation(key, user, default) def variation(self, key, user, default): @@ -281,16 +281,16 @@ def send_event(value, variation=None, flag=None, reason=None): if not self.is_initialized(): if self._store.initialized: - log.warn("Feature Flag evaluation attempted before client has initialized - using last known values from feature store for feature key: " + key) + log.warning("Feature Flag evaluation attempted before client has initialized - using last known values from feature store for feature key: " + key) else: - log.warn("Feature Flag evaluation attempted before client has initialized! Feature store unavailable - returning default: " + log.warning("Feature Flag evaluation attempted before client has initialized! Feature store unavailable - returning default: " + str(default) + " for feature key: " + key) reason = error_reason('CLIENT_NOT_READY') send_event(default, None, None, reason) return EvaluationDetail(default, None, reason) if user is not None and user.get('key', "") == "": - log.warn("User key is blank. Flag evaluation will proceed, but the user will not be stored in LaunchDarkly.") + log.warning("User key is blank. Flag evaluation will proceed, but the user will not be stored in LaunchDarkly.") try: flag = self._store.get(FEATURES, key, lambda x: x) @@ -369,18 +369,18 @@ def all_flags_state(self, user, **kwargs): :rtype: FeatureFlagsState """ if self._config.offline: - log.warn("all_flags_state() called, but client is in offline mode. Returning empty state") + log.warning("all_flags_state() called, but client is in offline mode. Returning empty state") return FeatureFlagsState(False) if not self.is_initialized(): if self._store.initialized: - log.warn("all_flags_state() called before client has finished initializing! Using last known values from feature store") + log.warning("all_flags_state() called before client has finished initializing! Using last known values from feature store") else: - log.warn("all_flags_state() called before client has finished initializing! Feature store unavailable - returning empty state") + log.warning("all_flags_state() called before client has finished initializing! Feature store unavailable - returning empty state") return FeatureFlagsState(False) if user is None or user.get('key') is None: - log.warn("User or user key is None when calling all_flags_state(). Returning empty state.") + log.warning("User or user key is None when calling all_flags_state(). Returning empty state.") return FeatureFlagsState(False) state = FeatureFlagsState(True) diff --git a/ldclient/config.py b/ldclient/config.py index f8ef61d0..b0283d95 100644 --- a/ldclient/config.py +++ b/ldclient/config.py @@ -280,4 +280,4 @@ def inline_users_in_events(self): def _validate(self): if self.offline is False and self.sdk_key is None or self.sdk_key is '': - log.warn("Missing or blank sdk_key.") + log.warning("Missing or blank sdk_key.") diff --git a/ldclient/flag.py b/ldclient/flag.py index dceb699c..c7515e63 100644 --- a/ldclient/flag.py +++ b/ldclient/flag.py @@ -147,7 +147,7 @@ def _check_prerequisites(flag, user, store, events, include_reasons_in_events): for prereq in flag.get('prerequisites') or []: prereq_flag = store.get(FEATURES, prereq.get('key'), lambda x: x) if prereq_flag is None: - log.warn("Missing prereq flag: " + prereq.get('key')) + log.warning("Missing prereq flag: " + prereq.get('key')) failed_prereq = prereq else: prereq_res = _evaluate(prereq_flag, user, store, events, include_reasons_in_events) diff --git a/ldclient/impl/integrations/files/file_data_source.py b/ldclient/impl/integrations/files/file_data_source.py index 9ba6e561..785a3851 100644 --- a/ldclient/impl/integrations/files/file_data_source.py +++ b/ldclient/impl/integrations/files/file_data_source.py @@ -107,7 +107,7 @@ def _start_auto_updater(self): try: resolved_paths.append(os.path.realpath(path)) except: - log.warn('Cannot watch for changes to data file "%s" because it is an invalid path' % path) + log.warning('Cannot watch for changes to data file "%s" because it is an invalid path' % path) if have_watchdog and not self._force_polling: return _FileDataSource.WatchdogAutoUpdater(resolved_paths, self._load_all) else: diff --git a/ldclient/operators.py b/ldclient/operators.py index 253e8a8b..158455ca 100644 --- a/ldclient/operators.py +++ b/ldclient/operators.py @@ -27,7 +27,7 @@ def _string_operator(u, c, fn): def _numeric_operator(u, c, fn): # bool is a subtype of int, and we don't want to try and compare it as a number. if isinstance(input, bool): - log.warn("Got unexpected bool type when attempting to parse time") + log.warning("Got unexpected bool type when attempting to parse time") return None if isinstance(u, Number): @@ -44,7 +44,7 @@ def _parse_time(input): # bool is a subtype of int, and we don't want to try and compare it as a time. if isinstance(input, bool): - log.warn("Got unexpected bool type when attempting to parse time") + log.warning("Got unexpected bool type when attempting to parse time") return None if isinstance(input, Number): @@ -56,10 +56,10 @@ def _parse_time(input): timestamp = (parsed_time - epoch).total_seconds() return timestamp * 1000.0 except Exception as e: - log.warn("Couldn't parse timestamp:" + str(input) + " with message: " + str(e)) + log.warning("Couldn't parse timestamp:" + str(input) + " with message: " + str(e)) return None - log.warn("Got unexpected type: " + type(input) + " with value: " + str(input) + " when attempting to parse time") + log.warning("Got unexpected type: " + type(input) + " with value: " + str(input) + " when attempting to parse time") return None def _time_operator(u, c, fn): diff --git a/ldclient/sse_client.py b/ldclient/sse_client.py index 49d853c7..fcd255a3 100644 --- a/ldclient/sse_client.py +++ b/ldclient/sse_client.py @@ -7,13 +7,13 @@ import re import time -import warnings import six import urllib3 from ldclient.util import create_http_pool_manager +from ldclient.util import log from ldclient.util import throw_if_unsuccessful_response # Technically, we should support streams that mix line endings. This regex, @@ -158,7 +158,7 @@ def parse(cls, raw): m = cls.sse_line_pattern.match(line) if m is None: # Malformed line. Discard but warn. - warnings.warn('Invalid SSE line: "%s"' % line, SyntaxWarning) + log.warning('Invalid SSE line: "%s"' % line) continue name = m.groupdict()['name']