Skip to content

Commit

Permalink
Refactor: change fstrings to format. (#28)
Browse files Browse the repository at this point in the history
For compatibility with Python < 3.6
  • Loading branch information
Dimedrolity authored May 11, 2023
1 parent 5f2bccd commit 2315f99
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions moira_client/models/trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,9 @@ def _send_request(self, trigger_id=None):
api_response = TriggerManager(self._client).fetch_by_id(trigger_id)

if trigger_id and api_response:
res = self._client.put(f'trigger/{trigger_id}?{self.QUERY_PARAM_VALIDATE_FLAG}', json=data)
res = self._client.put('trigger/{}?{}'.format(trigger_id, self.QUERY_PARAM_VALIDATE_FLAG, json=data))
else:
res = self._client.put(f'trigger?{self.QUERY_PARAM_VALIDATE_FLAG}', json=data)
res = self._client.put('trigger?{}'.format(self.QUERY_PARAM_VALIDATE_FLAG, json=data))

if 'id' not in res:
raise ResponseStructureError('id not in response', res)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name='moira-python-client',
version='4.0.0',
version='4.0.1',
description='Client for Moira - Alerting system based on Graphite data',
keywords='moira monitoring client metrics alerting',
long_description="""
Expand Down
6 changes: 3 additions & 3 deletions tests/models/test_trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def test_save_new_trigger(self):

self.assertTrue(get_mock.called)
self.assertTrue(put_mock.called)
self.assertEqual(put_mock.call_args[0][0], f'trigger?{self.QUERY_PARAM_VALIDATE_FLAG}')
self.assertEqual(put_mock.call_args[0][0], 'trigger?{}'.format(self.QUERY_PARAM_VALIDATE_FLAG))
self.assertEqual(result['id'], trigger_id)

def test_save_existing_trigger(self):
Expand Down Expand Up @@ -171,7 +171,7 @@ def test_save_existing_trigger(self):

self.assertTrue(get_mock.called)
self.assertTrue(put_mock.called)
self.assertEqual(put_mock.call_args[0][0], f'trigger/{trigger_id}?{self.QUERY_PARAM_VALIDATE_FLAG}')
self.assertEqual(put_mock.call_args[0][0], 'trigger/{}?{}'.format(trigger_id, self.QUERY_PARAM_VALIDATE_FLAG))
self.assertEqual(result['id'], trigger_id)

def test_save_trigger_with_id(self):
Expand All @@ -197,5 +197,5 @@ def test_save_trigger_with_id(self):

self.assertTrue(get_mock.called)
self.assertTrue(put_mock.called)
self.assertEqual(put_mock.call_args[0][0], f'trigger/{trigger_id}?{self.QUERY_PARAM_VALIDATE_FLAG}')
self.assertEqual(put_mock.call_args[0][0], 'trigger/{}?{}'.format(trigger_id, self.QUERY_PARAM_VALIDATE_FLAG))
self.assertEqual(result['id'], trigger_id)

0 comments on commit 2315f99

Please sign in to comment.