Merge 5f3ccda520
into 7a094cec63
commit
4c21d7e29b
|
@ -1172,7 +1172,7 @@ def get_user(self, user_id):
|
||||||
if user is None:
|
if user is None:
|
||||||
user = db.query("SELECT * FROM users WHERE user_id = {0}", user_id)
|
user = db.query("SELECT * FROM users WHERE user_id = {0}", user_id)
|
||||||
if user is not None:
|
if user is not None:
|
||||||
key = "user.{0}".format(user_id)
|
key = f"user.{user_id}"
|
||||||
cache.set(key, json.dumps(user))
|
cache.set(key, json.dumps(user))
|
||||||
return user
|
return user
|
||||||
```
|
```
|
||||||
|
|
|
@ -1181,7 +1181,7 @@ def get_user(self, user_id):
|
||||||
if user is None:
|
if user is None:
|
||||||
user = db.query("SELECT * FROM users WHERE user_id = {0}", user_id)
|
user = db.query("SELECT * FROM users WHERE user_id = {0}", user_id)
|
||||||
if user is not None:
|
if user is not None:
|
||||||
key = "user.{0}".format(user_id)
|
key = f"user.{user_id}"
|
||||||
cache.set(key, json.dumps(user))
|
cache.set(key, json.dumps(user))
|
||||||
return user
|
return user
|
||||||
```
|
```
|
||||||
|
|
|
@ -1173,7 +1173,7 @@ def get_user(self, user_id):
|
||||||
if user is None:
|
if user is None:
|
||||||
user = db.query("SELECT * FROM users WHERE user_id = {0}", user_id)
|
user = db.query("SELECT * FROM users WHERE user_id = {0}", user_id)
|
||||||
if user is not None:
|
if user is not None:
|
||||||
key = "user.{0}".format(user_id)
|
key = f"user.{user_id}"
|
||||||
cache.set(key, json.dumps(user))
|
cache.set(key, json.dumps(user))
|
||||||
return user
|
return user
|
||||||
```
|
```
|
||||||
|
|
|
@ -1221,7 +1221,7 @@ def get_user(self, user_id):
|
||||||
if user is None:
|
if user is None:
|
||||||
user = db.query("SELECT * FROM users WHERE user_id = {0}", user_id)
|
user = db.query("SELECT * FROM users WHERE user_id = {0}", user_id)
|
||||||
if user is not None:
|
if user is not None:
|
||||||
key = "user.{0}".format(user_id)
|
key = f"user.{user_id}"
|
||||||
cache.set(key, json.dumps(user))
|
cache.set(key, json.dumps(user))
|
||||||
return user
|
return user
|
||||||
```
|
```
|
||||||
|
|
|
@ -158,7 +158,7 @@
|
||||||
"\n",
|
"\n",
|
||||||
" def dispatch_call(self, call):\n",
|
" def dispatch_call(self, call):\n",
|
||||||
" if call.rank not in (Rank.OPERATOR, Rank.SUPERVISOR, Rank.DIRECTOR):\n",
|
" if call.rank not in (Rank.OPERATOR, Rank.SUPERVISOR, Rank.DIRECTOR):\n",
|
||||||
" raise ValueError('Invalid call rank: {}'.format(call.rank))\n",
|
" raise ValueError(f'Invalid call rank: {call.rank}')\n",
|
||||||
" employee = None\n",
|
" employee = None\n",
|
||||||
" if call.rank == Rank.OPERATOR:\n",
|
" if call.rank == Rank.OPERATOR:\n",
|
||||||
" employee = self._dispatch_call(call, self.operators)\n",
|
" employee = self._dispatch_call(call, self.operators)\n",
|
||||||
|
|
|
@ -94,7 +94,7 @@ class CallCenter(object):
|
||||||
|
|
||||||
def dispatch_call(self, call):
|
def dispatch_call(self, call):
|
||||||
if call.rank not in (Rank.OPERATOR, Rank.SUPERVISOR, Rank.DIRECTOR):
|
if call.rank not in (Rank.OPERATOR, Rank.SUPERVISOR, Rank.DIRECTOR):
|
||||||
raise ValueError('Invalid call rank: {}'.format(call.rank))
|
raise ValueError(f'Invalid call rank: {call.rank}')
|
||||||
employee = None
|
employee = None
|
||||||
if call.rank == Rank.OPERATOR:
|
if call.rank == Rank.OPERATOR:
|
||||||
employee = self._dispatch_call(call, self.operators)
|
employee = self._dispatch_call(call, self.operators)
|
||||||
|
|
|
@ -109,7 +109,7 @@
|
||||||
" if 1 <= new_value <= 13:\n",
|
" if 1 <= new_value <= 13:\n",
|
||||||
" self._value = new_value\n",
|
" self._value = new_value\n",
|
||||||
" else:\n",
|
" else:\n",
|
||||||
" raise ValueError('Invalid card value: {}'.format(new_value))\n",
|
" raise ValueError(f'Invalid card value: {new_value}')\n",
|
||||||
"\n",
|
"\n",
|
||||||
"\n",
|
"\n",
|
||||||
"class Hand(object):\n",
|
"class Hand(object):\n",
|
||||||
|
|
|
@ -55,7 +55,7 @@ class BlackJackCard(Card):
|
||||||
if 1 <= new_value <= 13:
|
if 1 <= new_value <= 13:
|
||||||
self._value = new_value
|
self._value = new_value
|
||||||
else:
|
else:
|
||||||
raise ValueError('Invalid card value: {}'.format(new_value))
|
raise ValueError(f'Invalid card value: {new_value}')
|
||||||
|
|
||||||
|
|
||||||
class Hand(object):
|
class Hand(object):
|
||||||
|
|
Loading…
Reference in New Issue