Skip to content

Commit

Permalink
Fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
JimMadge committed Jan 15, 2024
1 parent 50d83a9 commit 672d7df
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint_code.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
- name: Install hatch
run: pip install hatch
- name: Print Ruff version
run: ruff --version
run: hatch run lint:ruff --version
- name: Lint Python
run: hatch run lint:all

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def add(self, new_users: Sequence[ResearchUser]) -> None:
for line in output.split("\n"):
self.logger.parse(line)

def list(self, sre_name: str | None = None) -> Sequence[ResearchUser]: # noqa: A003
def list(self, sre_name: str | None = None) -> Sequence[ResearchUser]:
"""List users in a local Active Directory"""
list_users_script = FileReader(
self.resources_path / "active_directory" / "list_users.ps1"
Expand Down Expand Up @@ -142,7 +142,7 @@ def remove(self, users: Sequence[ResearchUser]) -> None:
for line in output.split("\n"):
self.logger.parse(line)

def set(self, users: Sequence[ResearchUser]) -> None: # noqa: A003
def set(self, users: Sequence[ResearchUser]) -> None:
"""Set local Active Directory users to specified list"""
users_to_remove = [user for user in self.list() if user not in users]
self.remove(users_to_remove)
Expand Down
4 changes: 2 additions & 2 deletions data_safe_haven/administration/users/azure_ad_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def add(self, new_users: Sequence[ResearchUser]) -> None:
# # Also add the user to the research users group
# self.graph_api.add_user_to_group(user.username, self.researchers_group_name)

def list(self) -> Sequence[ResearchUser]: # noqa: A003
def list(self) -> Sequence[ResearchUser]:
user_list = self.graph_api.read_users()
return [
ResearchUser(
Expand Down Expand Up @@ -105,7 +105,7 @@ def remove(self, users: Sequence[ResearchUser]) -> None:
# )
pass

def set(self, users: Sequence[ResearchUser]) -> None: # noqa: A003
def set(self, users: Sequence[ResearchUser]) -> None:
"""Set Guacamole users to specified list"""
users_to_remove = [user for user in self.list() if user not in users]
self.remove(users_to_remove)
Expand Down
2 changes: 1 addition & 1 deletion data_safe_haven/administration/users/guacamole_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def __init__(self, config: Config, sre_name: str, *args: Any, **kwargs: Any):
self.sre_name = sre_name
self.group_name = f"Data Safe Haven SRE {sre_name} Users"

def list(self) -> Sequence[ResearchUser]: # noqa: A003
def list(self) -> Sequence[ResearchUser]:
"""List all Guacamole users"""
if self.users_ is None: # Allow for the possibility of an empty list of users
postgres_output = self.postgres_provisioner.execute_scripts(
Expand Down
4 changes: 2 additions & 2 deletions data_safe_haven/administration/users/user_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def get_usernames_guacamole(self, sre_name: str) -> list[str]:
self.logger.error(f"Could not load users for SRE '{sre_name}'.")
return []

def list(self) -> None: # noqa: A003
def list(self) -> None:
"""List Active Directory, AzureAD and Guacamole users
Raises:
Expand Down Expand Up @@ -157,7 +157,7 @@ def remove(self, user_names: Sequence[str]) -> None:
msg = f"Could not remove users: {user_names}.\n{exc}"
raise DataSafeHavenUserHandlingError(msg) from exc

def set(self, users_csv_path: str) -> None: # noqa: A003
def set(self, users_csv_path: str) -> None:
"""Set AzureAD and Guacamole users
Raises:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ dependencies = [
"black>=23.1.0",
"mypy>=1.0.0",
"pydantic>=2.4",
"ruff>=0.0.243",
"ruff>=0.1.0",
"types-appdirs>=1.4.3.5",
"types-chevron>=0.14.2.5",
"types-pytz>=2023.3.0.0",
Expand Down

0 comments on commit 672d7df

Please sign in to comment.