Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sourcery refactored main branch #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented May 18, 2023

Branch main refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the main branch, then run:

git fetch origin sourcery/main
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from jeffamaxey May 18, 2023 21:08
encoder.update(custom_encoder)
encoder |= custom_encoder
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function jsonable_encoder refactored with the following changes:

user_id = re.match(r"^/users/(\d+)", pathname).group(1)
user_id = re.match(r"^/users/(\d+)", pathname)[1]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function route refactored with the following changes:

trigger_id = triggered[0]["prop_id"].split(".")[0]
if trigger_id:
if trigger_id := triggered[0]["prop_id"].split(".")[0]:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function get_trigger_index refactored with the following changes:

Comment on lines -18 to +31
else:
if request.method == "POST":
db = SessionLocal()
email = request.form.get("email")
password = request.form.get("password")
rememberMe = request.form.get("rememberMe") is not None
try:
user = CRUDUser.authenticate(db, email=email, password=password)
if user:
login_user(user, remember=rememberMe)
return redirect("/")
finally:
db.close()
error = True
return render_template("login.html", error=error)
if request.method == "POST":
db = SessionLocal()
email = request.form.get("email")
password = request.form.get("password")
rememberMe = request.form.get("rememberMe") is not None
try:
user = CRUDUser.authenticate(db, email=email, password=password)
if user:
login_user(user, remember=rememberMe)
return redirect("/")
finally:
db.close()
error = True
return render_template("login.html", error=error)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function FlaskLogin.__init__ refactored with the following changes:

Comment on lines -46 to +45
if self.is_authorized():
return f(*args, **kwargs)
else:
return self.login_request()
return f(*args, **kwargs) if self.is_authorized() else self.login_request()
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function FlaskLogin.auth_wrapper refactored with the following changes:

if v == "":
return None
return v
return None if v == "" else v
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function UserBase.passwords_match refactored with the following changes:

Comment on lines -40 to +38
if v == "":
return None
return v
return None if v == "" else v
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function UserUpdate.password_pre refactored with the following changes:

Comment on lines -46 to +42
if v == "":
return None
return v
return None if v == "" else v
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function UserUpdate.password2_pre refactored with the following changes:

user = CRUDUser.get_by_email(db, email=email)
if user:
if user := CRUDUser.get_by_email(db, email=email):
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function create_user refactored with the following changes:

user_id = re.match(r"^/users/(\d+)", pathname).group(1)
user_id = re.match(r"^/users/(\d+)", pathname)[1]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function update_user refactored with the following changes:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants