Skip to content

Commit e2c16ae

Browse files
committed
update black and reformat failing file
1 parent f5c2d33 commit e2c16ae

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

app/database/models/user.py

+11-11
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class UserModel(db.Model):
6666
timezone = db.Column(db.Enum(Timezone))
6767

6868
def __init__(self, name, username, password, email, terms_and_conditions_checked):
69-
"""Initialises userModel class with name, username, password, email, and terms_and_conditions_checked. """
69+
"""Initialises userModel class with name, username, password, email, and terms_and_conditions_checked."""
7070
## required fields
7171

7272
self.name = name
@@ -123,49 +123,49 @@ def json(self):
123123
}
124124

125125
def __repr__(self):
126-
"""Returns the user's name and username. """
126+
"""Returns the user's name and username."""
127127
return f"User name {self.name} . Username is {self.username} ."
128128

129129
@classmethod
130130
def find_by_username(cls, username: str) -> "UserModel":
131-
"""Returns the user that has the username we searched for. """
131+
"""Returns the user that has the username we searched for."""
132132
return cls.query.filter_by(username=username).first()
133133

134134
@classmethod
135135
def find_by_email(cls, email: str) -> "UserModel":
136-
"""Returns the user that has the email we searched for. """
136+
"""Returns the user that has the email we searched for."""
137137
return cls.query.filter_by(email=email).first()
138138

139139
@classmethod
140140
def find_by_id(cls, _id: int) -> "UserModel":
141-
"""Returns the user that has the id we searched for. """
141+
"""Returns the user that has the id we searched for."""
142142
return cls.query.filter_by(id=_id).first()
143143

144144
@classmethod
145145
def get_all_admins(cls, is_admin=True):
146-
"""Returns all the admins. """
146+
"""Returns all the admins."""
147147
return cls.query.filter_by(is_admin=is_admin).all()
148148

149149
@classmethod
150150
def is_empty(cls) -> bool:
151-
"""Returns a boolean if the Usermodel is empty or not. """
151+
"""Returns a boolean if the Usermodel is empty or not."""
152152
return cls.query.first() is None
153153

154154
def set_password(self, password_plain_text: str) -> None:
155-
"""Sets user password when they create an account or when they are changing their password. """
155+
"""Sets user password when they create an account or when they are changing their password."""
156156
self.password_hash = generate_password_hash(password_plain_text)
157157

158158
# checks if password is the same, using its hash
159159
def check_password(self, password_plain_text: str) -> bool:
160-
"""Returns a boolean if password is the same as it hash or not. """
160+
"""Returns a boolean if password is the same as it hash or not."""
161161
return check_password_hash(self.password_hash, password_plain_text)
162162

163163
def save_to_db(self) -> None:
164-
"""Adds a user to the database. """
164+
"""Adds a user to the database."""
165165
db.session.add(self)
166166
db.session.commit()
167167

168168
def delete_from_db(self) -> None:
169-
"""Deletes a user from the database. """
169+
"""Deletes a user from the database."""
170170
db.session.delete(self)
171171
db.session.commit()

0 commit comments

Comments
 (0)