Skip to content

Commit

Permalink
chore: automitaclly fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
azmeuk committed Sep 11, 2024
1 parent 902f978 commit cfabcc4
Show file tree
Hide file tree
Showing 29 changed files with 69 additions and 58 deletions.
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,11 @@ repos:
rev: 3.0.6
hooks:
- id: djhtml
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
additional_dependencies:
- tomli
exclude: ".*\\.min\\..*|translations|\\.css$|^tests|fomanticui"
args: [--write-changes]
8 changes: 4 additions & 4 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ Fixed
preferred user email address.
- Password reset and initialization mails were not sent at all the user
addresses if one email address could not be reached.
- Password comparision was too permissive on login.
- Password comparison was too permissive on login.
- Encrypt passwords in the SQL backend.

[0.0.35] - 2023-11-25
Expand Down Expand Up @@ -612,7 +612,7 @@ Changed
Fixed
^^^^^
- ``HIDE_INVALID_LOGIN`` behavior and default value.
- mo files are not versionned anymore :pr:`49` :pr:`53`
- mo files are not versioned anymore :pr:`49` :pr:`53`

[0.0.8] - 2022-03-15
--------------------
Expand Down Expand Up @@ -679,7 +679,7 @@ Added
- Added an option to tune object IDs :pr:`26`
- Avatar support :pr:`27`
- Dynamical and configurable JWT claims :pr:`28`
- UI improvemnts :pr:`29`
- UI improvements :pr:`29`
- Invitation links expiration :pr:`30`
- Invitees can choose their IDs :pr:`31`
- LDAP backend refactoring :pr:`35`
Expand All @@ -705,7 +705,7 @@ Added
- Two-steps sign-in :issue:`49`
- Tokens can have several audiences. :issue:`62` :pr:`9`
- Configuration check command. :issue:`66` :pr:`8`
- Groups managament. :issue:`12` :pr:`6`
- Groups management. :issue:`12` :pr:`6`

Fixed
^^^^^
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ Code style
----------

We use `ruff <https://docs.astral.sh/ruff/>`_ along with other tools to format our code.
Please run ``tox -e style`` on your patches before submiting them.
Please run ``tox -e style`` on your patches before submitting them.
In order to perform a style check and correction at each commit you can use our
`pre-commit <https://pre-commit.com/>`_ configuration with ``pre-commit install``.

Expand Down
2 changes: 1 addition & 1 deletion canaille/app/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def render_field(self, field, *args, **kwargs):
abort(response)

def form_control(self):
"""Check wether the current request is the result of the users adding
"""Check whether the current request is the result of the users adding
or removing a field from a FieldList."""
FIELDLIST_ADD_BUTTON = "fieldlist_add"
FIELDLIST_REMOVE_BUTTON = "fieldlist_remove"
Expand Down
6 changes: 3 additions & 3 deletions canaille/app/mails.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def type_from_filename(filename):
return maintype, subtype


def send_email(subject, recipient, text, html, attachements=None):
def send_email(subject, recipient, text, html, attachments=None):
current_app.logger.debug(f"Sending a mail to {recipient}: {subject}")
msg = email.message.EmailMessage()
msg.set_content(text)
Expand All @@ -68,8 +68,8 @@ def send_email(subject, recipient, text, html, attachements=None):

msg["From"] = f'"{name}" <{address}>'

attachements = attachements or []
for cid, filename, value in attachements:
attachments = attachments or []
for cid, filename, value in attachments:
maintype, subtype = type_from_filename(filename)
msg.get_payload()[1].add_related(
value, maintype=maintype, subtype=subtype, cid=cid
Expand Down
2 changes: 1 addition & 1 deletion canaille/backends/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def set_user_password(self, user, password: str):
raise NotImplementedError()

def has_account_lockability(self):
"""Indicate wether the backend supports locking user accounts."""
"""Indicate whether the backend supports locking user accounts."""
raise NotImplementedError()

def register_models(self):
Expand Down
2 changes: 1 addition & 1 deletion canaille/backends/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def serialize_attribute(attribute_name, value):


def get_factory(model):
"""Read informations about models.
"""Read information about models.
Options can be used to filter models::
Expand Down
8 changes: 4 additions & 4 deletions canaille/backends/memory/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,12 @@ def index_save(self, instance):
model, mirror_attribute
).setdefault(instance.id, set())
for subinstance_id in listify(instance._state.get(attribute, [])):
# add the current objet in the subinstance state
# add the current object in the subinstance state
subinstance_state = self.index(model)[subinstance_id]
subinstance_state.setdefault(mirror_attribute, [])
subinstance_state[mirror_attribute].append(instance.id)

# add the current objet in the subinstance index
# add the current object in the subinstance index
mirror_attribute_index.add(subinstance_id)

def index_delete(self, instance):
Expand Down Expand Up @@ -216,11 +216,11 @@ def index_delete(self, instance):
for subinstance_id in self.index(instance.__class__)[instance.id].get(
attribute, []
):
# remove the current objet from the subinstance state
# remove the current object from the subinstance state
subinstance_state = self.index(model)[subinstance_id]
subinstance_state[mirror_attribute].remove(instance.id)

# remove the current objet from the subinstance index
# remove the current object from the subinstance index
mirror_attribute_index.remove(subinstance_id)

# update the index for each attribute
Expand Down
10 changes: 5 additions & 5 deletions canaille/config.sample.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ SECRET_KEY = "change me before you go in production"
# If EMAIL_CONFIRMATION is set to true, users will need to click on a
# confirmation link sent by email when they want to add a new email.
# By default, this is true if SMTP is configured, else this is false.
# If explicitely set to true and SMTP is disabled, the email field
# If explicitly set to true and SMTP is disabled, the email field
# will be read-only.
# EMAIL_CONFIRMATION =

Expand All @@ -51,7 +51,7 @@ SECRET_KEY = "change me before you go in production"

# If HIDE_INVALID_LOGINS is set to true (the default), when a user
# tries to sign in with an invalid login, a message is shown indicating
# that the password is wrong, but does not give a clue wether the login
# that the password is wrong, but does not give a clue whether the login
# exists or not.
# If HIDE_INVALID_LOGINS is set to false, when a user tries to sign in with
# an invalid login, a message is shown indicating that the login does not
Expand All @@ -69,7 +69,7 @@ SECRET_KEY = "change me before you go in production"
# LOGGING configures the logging output:
# - if unset, everything is logged in the standard output
# the log level is debug if DEBUG is True, else this is INFO
# - if this is a dictionnary, it is passed to the python dictConfig method:
# - if this is a dictionary, it is passed to the python dictConfig method:
# https://docs.python.org/3/library/logging.config.html#logging.config.dictConfig
# - if this is a string, it is passed to the python fileConfig method
# https://docs.python.org/3/library/logging.config.html#logging.config.fileConfig
Expand Down Expand Up @@ -133,7 +133,7 @@ SECRET_KEY = "change me before you go in production"
# - {groups = 'moderators'}
#
# The 'PERMISSIONS' parameter that is an list of items the users in the access
# control will be able to manage. 'PERMISSIONS' is optionnal. Values can be:
# control will be able to manage. 'PERMISSIONS' is optional. Values can be:
# - "edit_self" to allow users to edit their own profile
# - "use_oidc" to allow OpenID Connect authentication
# - "manage_oidc" to allow OpenID Connect client managements
Expand Down Expand Up @@ -188,7 +188,7 @@ WRITE = [
]

[CANAILLE_OIDC]
# Wether a token is needed for the RFC7591 dynamical client registration.
# Whether a token is needed for the RFC7591 dynamical client registration.
# If true, no token is needed to register a client.
# If false, dynamical client registration needs a token defined
# in DYNAMIC_CLIENT_REGISTRATION_TOKENS
Expand Down
12 changes: 6 additions & 6 deletions canaille/core/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ class SMTPSettings(BaseModel):
"""The SMTP port."""

TLS: Optional[bool] = False
"""Wether to use TLS to connect to the SMTP server."""
"""Whether to use TLS to connect to the SMTP server."""

SSL: Optional[bool] = False
"""Wether to use SSL to connect to the SMTP server."""
"""Whether to use SSL to connect to the SMTP server."""

LOGIN: Optional[str] = None
"""The SMTP login."""
Expand Down Expand Up @@ -220,14 +220,14 @@ class CoreSettings(BaseModel):
"""Enables Javascript to smooth the user experience."""

HTMX: bool = True
"""Accelerates webpages loading with asynchroneous requests."""
"""Accelerates webpages loading with asynchronous requests."""

EMAIL_CONFIRMATION: bool = True
"""If :py:data:`True`, users will need to click on a confirmation link sent
by email when they want to add a new email.
By default, this is true
if ``SMTP`` is configured, else this is false. If explicitely set to true
if ``SMTP`` is configured, else this is false. If explicitly set to true
and ``SMTP`` is disabled, the email field will be read-only.
"""

Expand All @@ -242,7 +242,7 @@ class CoreSettings(BaseModel):
HIDE_INVALID_LOGINS: bool = True
"""If :py:data:`True`, when users try to sign in with an invalid login, a
message is shown indicating that the password is wrong, but does not give a
clue wether the login exists or not.
clue whether the login exists or not.
If :py:data:`False`,
when a user tries to sign in with an invalid login, a message is shown
Expand Down Expand Up @@ -292,7 +292,7 @@ class = "logging.handlers.WatchedFileHandler"
ACL: Optional[Dict[str, ACLSettings]] = {"DEFAULT": ACLSettings()}
"""Mapping of permission groups. See :class:`ACLSettings` for more details.
The ACL name can be freely choosed. For example::
The ACL name can be freely chosen. For example::
[CANAILLE.ACL.DEFAULT]
PERMISSIONS = ["edit_self", "use_oidc"]
Expand Down
2 changes: 1 addition & 1 deletion canaille/core/endpoints/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ def profile_delete(user, edited_user):

flash(
_(
"The user %(user)s has been sucessfuly deleted",
"The user %(user)s has been successfully deleted",
user=edited_user.formatted_name,
),
"success",
Expand Down
9 changes: 6 additions & 3 deletions canaille/core/endpoints/groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def create_group(user):
Backend.instance.save(group)
flash(
_(
"The group %(group)s has been sucessfully created",
"The group %(group)s has been successfully created",
group=group.display_name,
),
"success",
Expand Down Expand Up @@ -106,7 +106,7 @@ def edit_group(group):
Backend.instance.save(group)
flash(
_(
"The group %(group)s has been sucessfully edited.",
"The group %(group)s has been successfully edited.",
group=group.display_name,
),
"success",
Expand Down Expand Up @@ -159,7 +159,10 @@ def delete_member(group):

def delete_group(group):
flash(
_("The group %(group)s has been sucessfully deleted", group=group.display_name),
_(
"The group %(group)s has been successfully deleted",
group=group.display_name,
),
"success",
)
Backend.instance.delete(group)
Expand Down
12 changes: 6 additions & 6 deletions canaille/core/mails.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def send_test_mail(email):
recipient=email,
text=text_body,
html=html_body,
attachements=[(logo_cid, logo_filename, logo_raw)] if logo_filename else None,
attachments=[(logo_cid, logo_filename, logo_raw)] if logo_filename else None,
)


Expand Down Expand Up @@ -74,7 +74,7 @@ def send_password_reset_mail(user, mail):
recipient=mail,
text=text_body,
html=html_body,
attachements=[(logo_cid, logo_filename, logo_raw)] if logo_filename else None,
attachments=[(logo_cid, logo_filename, logo_raw)] if logo_filename else None,
)


Expand Down Expand Up @@ -115,7 +115,7 @@ def send_password_initialization_mail(user, email):
recipient=email,
text=text_body,
html=html_body,
attachements=[(logo_cid, logo_filename, logo_raw)] if logo_filename else None,
attachments=[(logo_cid, logo_filename, logo_raw)] if logo_filename else None,
)


Expand Down Expand Up @@ -146,7 +146,7 @@ def send_invitation_mail(email, registration_url):
recipient=email,
text=text_body,
html=html_body,
attachements=[(logo_cid, logo_filename, logo_raw)] if logo_filename else None,
attachments=[(logo_cid, logo_filename, logo_raw)] if logo_filename else None,
)


Expand Down Expand Up @@ -177,7 +177,7 @@ def send_confirmation_email(email, confirmation_url):
recipient=email,
text=text_body,
html=html_body,
attachements=[(logo_cid, logo_filename, logo_raw)] if logo_filename else None,
attachments=[(logo_cid, logo_filename, logo_raw)] if logo_filename else None,
)


Expand Down Expand Up @@ -208,5 +208,5 @@ def send_registration_mail(email, registration_url):
recipient=email,
text=text_body,
html=html_body,
attachements=[(logo_cid, logo_filename, logo_raw)] if logo_filename else None,
attachments=[(logo_cid, logo_filename, logo_raw)] if logo_filename else None,
)
6 changes: 3 additions & 3 deletions canaille/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ class User(Model):
_permissions = None

def has_password(self) -> bool:
"""Check wether a password has been set for the user."""
"""Check whether a password has been set for the user."""
return self.password is not None

def can_read(self, field: str):
Expand All @@ -266,7 +266,7 @@ def __getattribute__(self, name):
return super().__getattribute__(name)

def can(self, *permissions: Permission):
"""Wether or not the user has the
"""Whether or not the user has the
:class:`~canaille.core.configuration.Permission` according to the
:class:`configuration <canaille.core.configuration.ACLSettings>`."""
if self._permissions is None:
Expand All @@ -276,7 +276,7 @@ def can(self, *permissions: Permission):

@property
def locked(self) -> bool:
"""Wether the user account has been locked or has expired."""
"""Whether the user account has been locked or has expired."""
return bool(self.lock_date) and self.lock_date < datetime.datetime.now(
datetime.timezone.utc
)
Expand Down
2 changes: 1 addition & 1 deletion canaille/core/templates/partial/group-members.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
<div class="header">
{% trans %}No item matches your request{% endtrans %}
</div>
<p>{% trans %}Maybe try with different criterias?{% endtrans %}</p>
<p>{% trans %}Maybe try with different criteria?{% endtrans %}</p>
{% else %}
<div class="header">
{% trans %}There is nothing here{% endtrans %}
Expand Down
2 changes: 1 addition & 1 deletion canaille/core/templates/partial/groups.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<div class="header">
{% trans %}No item matches your request{% endtrans %}
</div>
<p>{% trans %}Maybe try with different criterias?{% endtrans %}</p>
<p>{% trans %}Maybe try with different criteria?{% endtrans %}</p>
{% else %}
<div class="header">
{% trans %}There is nothing here{% endtrans %}
Expand Down
2 changes: 1 addition & 1 deletion canaille/core/templates/partial/users.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
<div class="header">
{% trans %}No item matches your request{% endtrans %}
</div>
<p>{% trans %}Maybe try with different criterias?{% endtrans %}</p>
<p>{% trans %}Maybe try with different criteria?{% endtrans %}</p>
{% else %}
<div class="header">
{% trans %}There is nothing here{% endtrans %}
Expand Down
4 changes: 2 additions & 2 deletions canaille/oidc/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class JWTMappingSettings(BaseModel):
"""Mapping between the user model and the JWT fields.
Fiels are evaluated with jinja.
Fields are evaluated with jinja.
A ``user`` var is available.
"""

Expand Down Expand Up @@ -87,7 +87,7 @@ class OIDCSettings(BaseModel):
"""

DYNAMIC_CLIENT_REGISTRATION_OPEN: bool = False
"""Wether a token is needed for the RFC7591 dynamical client registration.
"""Whether a token is needed for the RFC7591 dynamical client registration.
If :py:data:`True`, no token is needed to register a client.
If :py:data:`False`, dynamical client registration needs a token defined in
Expand Down
2 changes: 1 addition & 1 deletion canaille/oidc/oauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ def get_server_metadata(self):

def resolve_public_key(self, request):
# At the moment the only keypair accepted in software statement
# is the one used to isues JWTs. This might change somedays.
# is the one used to issues JWTs. This might change somedays.
return current_app.config["CANAILLE_OIDC"]["JWT"]["PUBLIC_KEY"]

def client_convert_data(self, **kwargs):
Expand Down
Loading

0 comments on commit cfabcc4

Please sign in to comment.