Skip to content

Commit

Permalink
'Refactored by Sourcery'
Browse files Browse the repository at this point in the history
  • Loading branch information
Sourcery AI committed Dec 9, 2023
1 parent 7b0703a commit c90a426
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions scripts/update_changelog.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Insert the new version changes in the changelog."""


import re
import sys

Expand All @@ -25,8 +26,7 @@
version_re = re.compile(version_regex)
last_released = None
for line in old_lines:
match = version_re.search(line)
if match:
if match := version_re.search(line):
last_released = match.groupdict()["version"]
break
# only keep more recent versions
Expand Down
2 changes: 1 addition & 1 deletion starlette_session/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def __init__(
if custom_session_backend
else self._get_predefined_session_backend(backend_client)
)
self.signer = itsdangerous.TimestampSigner(str(secret_key))
self.signer = itsdangerous.TimestampSigner(secret_key)
self.cookie_name = cookie_name
self.max_age = max_age
self.domain = domain
Expand Down
4 changes: 1 addition & 3 deletions starlette_session/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@

class MemcacheJSONSerde(object):
def serialize(self, key, value):
if isinstance(value, str):
return value, 1
return json.dumps(value), 2
return (value, 1) if isinstance(value, str) else (json.dumps(value), 2)

def deserialize(self, key, value, flags):
if flags == 1:
Expand Down

0 comments on commit c90a426

Please sign in to comment.