Skip to content

Commit

Permalink
Fix unnecessary type hint
Browse files Browse the repository at this point in the history
  • Loading branch information
ABizzinotto committed Sep 13, 2023
1 parent 0f01e24 commit fc5448d
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 38 deletions.
2 changes: 1 addition & 1 deletion freckle_client/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# -*- coding: utf-8 -*-
"""Freckle client package."""
__version__ = "1.0.2" # pragma: no cover
__version__ = "1.0.3" # pragma: no cover
2 changes: 1 addition & 1 deletion noko_client/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# -*- coding: utf-8 -*-
"""Noko client package."""
__version__ = "1.0.2" # pragma: no cover
__version__ = "1.0.3" # pragma: no cover
66 changes: 31 additions & 35 deletions noko_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class NokoClient(BaseClient):

# Entry related methods

def list_entries(self, **kwargs: dict) -> list[dict]:
def list_entries(self, **kwargs) -> list[dict]:
"""List all entries.
By default, retrieves all entries. The entries to retrieve can be filtered based on accepted Keyword Arguments.
Expand Down Expand Up @@ -103,7 +103,7 @@ def get_single_entry(self, entry_id: str | int) -> list[dict]:
"""
return self.fetch_json(f"entries/{entry_id}", http_method="GET")

def create_entry(self, **kwargs: dict) -> list[dict]:
def create_entry(self, **kwargs) -> list[dict]:
"""Create new entry in Noko.
Keyword Args:
Expand All @@ -127,7 +127,7 @@ def create_entry(self, **kwargs: dict) -> list[dict]:
data = CreateNokoEntryParameters(**kwargs).model_dump()
return self.fetch_json("entries", post_args=data, http_method="POST")

def edit_entry(self, entry_id: int | str, **kwargs: dict) -> list[dict]:
def edit_entry(self, entry_id: int | str, **kwargs) -> list[dict]:
"""Edit an existing entry.
Args:
Expand Down Expand Up @@ -252,7 +252,7 @@ def delete_entry(self, entry_id: str | int) -> None:

# Tag related methods

def list_tags(self, **kwargs: dict) -> list[dict]:
def list_tags(self, **kwargs) -> list[dict]:
"""List all tags.
By default, retrieves all tags. The tags to retrieve can be filtered based on accepted Keyword Arguments.
Expand Down Expand Up @@ -292,7 +292,7 @@ def get_single_tag(self, tag_id: int | str) -> list[dict]:
"""
return self.fetch_json(f"tags/{tag_id}", http_method="GET")

def get_all_entries_for_tag(self, tag_id: str | int, **kwargs: dict) -> list[dict]:
def get_all_entries_for_tag(self, tag_id: str | int, **kwargs) -> list[dict]:
"""Retrieve all time entries associated with a tag.
Results can be filtered using the same keyword arguments as the ones used for the list entries endpoint.
Expand Down Expand Up @@ -408,7 +408,7 @@ def delete_tags(self, tag_ids: list[str | int]) -> None:

# Project related methods

def list_projects(self, **kwargs: dict) -> list[dict]:
def list_projects(self, **kwargs) -> list[dict]:
"""List all projects from Noko.
By default, retrieves all projects. Projects to retrieve can be filtered based on accepted Keyword Arguments.
Expand Down Expand Up @@ -439,7 +439,7 @@ def get_single_project(self, project_id: str | int) -> list[dict]:
"""
return self.fetch_json(f"projects/{project_id}", http_method="GET")

def create_project(self, **kwargs: dict) -> list[dict]:
def create_project(self, **kwargs) -> list[dict]:
"""Create new project in Noko.
Keyword Args:
Expand All @@ -459,7 +459,7 @@ def create_project(self, **kwargs: dict) -> list[dict]:
return self.fetch_json("projects", post_args=data, http_method="POST")

def get_all_entries_for_project(
self, project_id: str | int, **kwargs: dict
self, project_id: str | int, **kwargs
) -> list[dict]:
"""Retrieve all time entries associated with a project.
Expand Down Expand Up @@ -503,9 +503,7 @@ def get_all_entries_for_project(
f"projects/{project_id}/entries", query_params=params, http_method="GET"
)

def get_expenses_for_project(
self, project_id: str | int, **kwargs: dict
) -> list[dict]:
def get_expenses_for_project(self, project_id: str | int, **kwargs) -> list[dict]:
"""Get all expenses associated with a project.
Results can be filtered using the same keyword arguments as the ones used for the list expenses endpoint.
Expand Down Expand Up @@ -541,7 +539,7 @@ def get_expenses_for_project(
f"projects/{project_id}/expenses", query_params=params, http_method="GET"
)

def edit_project(self, project_id: str | int, **kwargs: dict) -> list[dict]:
def edit_project(self, project_id: str | int, **kwargs) -> list[dict]:
"""Edit an existing project.
Args:
Expand Down Expand Up @@ -671,7 +669,7 @@ def delete_projects(self, project_ids: list[int | str]) -> None:

# Project group related methods

def list_project_groups(self, **kwargs: dict) -> list[dict]:
def list_project_groups(self, **kwargs) -> list[dict]:
"""List all project groups from Noko.
Keyword Args:
Expand All @@ -685,7 +683,7 @@ def list_project_groups(self, **kwargs: dict) -> list[dict]:
params = GetNokoProjectGroupsParameters(**kwargs).model_dump()
return self.fetch_json("project_groups", query_params=params, http_method="GET")

def create_project_group(self, **kwargs: dict) -> list[dict]:
def create_project_group(self, **kwargs) -> list[dict]:
"""Create a new project group.
Keyword Args:
Expand Down Expand Up @@ -728,7 +726,7 @@ def edit_project_group(self, project_group_id: str | int, name: str) -> list[dic
)

def get_all_entries_for_project_in_project_group(
self, project_group_id: str | int, **kwargs: dict
self, project_group_id: str | int, **kwargs
) -> list[dict]:
"""Retrieve all time entries associated with the projects in a project group.
Expand Down Expand Up @@ -775,7 +773,7 @@ def get_all_entries_for_project_in_project_group(
)

def get_all_projects_in_project_group(
self, project_group_id: str | int, **kwargs: dict
self, project_group_id: str | int, **kwargs
) -> list[dict]:
"""Retrieve all projects in a project group.
Expand Down Expand Up @@ -876,7 +874,7 @@ def delete_project_group(self, project_group_id: str | int) -> None:

# Invoice related methods

def list_invoices(self, **kwargs: dict) -> list[dict]:
def list_invoices(self, **kwargs) -> list[dict]:
"""List Noko invoices.
Keyword Args:
Expand Down Expand Up @@ -953,7 +951,7 @@ def get_single_invoice(self, invoice_id: str | int) -> list[dict]:
"""
return self.fetch_json(f"invoices/{invoice_id}", http_method="GET")

def create_invoice(self, **kwargs: dict) -> list[dict]:
def create_invoice(self, **kwargs) -> list[dict]:
"""Create a new invoice in Noko.
For additional information on options available for rate_calculation, taxes and customisation, refer to the
Expand Down Expand Up @@ -1004,7 +1002,7 @@ def create_invoice(self, **kwargs: dict) -> list[dict]:
data = CreateNokoInvoiceParameters(**kwargs).model_dump()
return self.fetch_json("invoices", post_args=data, http_method="POST")

def edit_invoice(self, invoice_id: str | int, **kwargs: dict) -> list[dict]:
def edit_invoice(self, invoice_id: str | int, **kwargs) -> list[dict]:
"""Edit a Noko invoice.
Args:
Expand Down Expand Up @@ -1079,7 +1077,7 @@ def mark_invoice_as_unpaid(self, invoice_id: str | int) -> None:
"""
self.fetch_json(f"invoices/{invoice_id}/unpaid", http_method="PUT")

def get_invoice_entries(self, invoice_id: str | int, **kwargs: dict) -> list[dict]:
def get_invoice_entries(self, invoice_id: str | int, **kwargs) -> list[dict]:
"""Retrieve all time entries associated with an invoice.
Results can be filtered using the same keyword arguments as the ones used for the list entries endpoint.
Expand Down Expand Up @@ -1122,7 +1120,7 @@ def get_invoice_entries(self, invoice_id: str | int, **kwargs: dict) -> list[dic
f"invoices/{invoice_id}/entries", query_params=params, http_method="GET"
)

def get_invoice_expenses(self, invoice_id: str | int, **kwargs: dict) -> list[dict]:
def get_invoice_expenses(self, invoice_id: str | int, **kwargs) -> list[dict]:
"""Retrieve all expenses associated with an invoice.
Results can be filtered using the same keyword arguments as the ones used for the list expenses endpoint.
Expand Down Expand Up @@ -1319,7 +1317,7 @@ def delete_invoice(self, invoice_id: int | str) -> None:

# Expenses related methods

def list_expenses(self, **kwargs: dict) -> list[dict]:
def list_expenses(self, **kwargs) -> list[dict]:
"""List expenses from Noko.
Keyword Args:
Expand Down Expand Up @@ -1358,7 +1356,7 @@ def get_single_expense(self, expense_id: str | int) -> list[dict]:
"""
return self.fetch_json(f"expenses/{expense_id}", http_method="GET")

def create_expense(self, **kwargs: dict) -> list[dict]:
def create_expense(self, **kwargs) -> list[dict]:
"""Create a new expense in Noko.
Keyword Args:
Expand All @@ -1379,7 +1377,7 @@ def create_expense(self, **kwargs: dict) -> list[dict]:
data = CreateNokoExpenseParameters(**kwargs).model_dump()
return self.fetch_json("expenses", post_args=data, http_method="POST")

def edit_expense(self, expense_id: str | int, **kwargs: dict) -> list[dict]:
def edit_expense(self, expense_id: str | int, **kwargs) -> list[dict]:
"""Edit an expense in Noko.
Args:
Expand Down Expand Up @@ -1427,7 +1425,7 @@ def get_account_details(self) -> list[dict]:

# User related methods

def list_users(self, **kwargs: dict) -> list[dict]:
def list_users(self, **kwargs) -> list[dict]:
"""List all Noko users in the account.
Keyword Args:
Expand Down Expand Up @@ -1455,7 +1453,7 @@ def get_single_user(self, user_id: int | str) -> list[dict]:
"""
return self.fetch_json(f"users/{user_id}", http_method="GET")

def get_user_entries(self, user_id: int | str, **kwargs: dict) -> list[dict]:
def get_user_entries(self, user_id: int | str, **kwargs) -> list[dict]:
"""Get all entries associated with a user.
Results can be filtered using the same keyword arguments as the ones used for the list entries endpoint.
Expand Down Expand Up @@ -1498,7 +1496,7 @@ def get_user_entries(self, user_id: int | str, **kwargs: dict) -> list[dict]:
f"users/{user_id}/entries", query_params=params, http_method="GET"
)

def get_user_expenses(self, user_id: str | int, **kwargs: dict) -> list[dict]:
def get_user_expenses(self, user_id: str | int, **kwargs) -> list[dict]:
"""Retrieve all expenses associated with a user.
Results can be filtered using the same keyword arguments as the ones used for the list expenses endpoint.
Expand Down Expand Up @@ -1534,7 +1532,7 @@ def get_user_expenses(self, user_id: str | int, **kwargs: dict) -> list[dict]:
f"users/{user_id}/expenses", query_params=params, http_method="GET"
)

def create_user(self, **kwargs: dict) -> list[dict]:
def create_user(self, **kwargs) -> list[dict]:
"""Create a new Noko user.
If your account has per-user billing, adding a new user will affect the total of your next invoice.
Expand All @@ -1552,7 +1550,7 @@ def create_user(self, **kwargs: dict) -> list[dict]:
data = CreateNokoUserParameters(**kwargs).model_dump()
return self.fetch_json("users", post_args=data, http_method="POST")

def edit_user(self, user_id: str | int, **kwargs: dict) -> list[dict]:
def edit_user(self, user_id: str | int, **kwargs) -> list[dict]:
"""Edit a Noko user's details.
Args:
Expand Down Expand Up @@ -1686,7 +1684,7 @@ def deactivate_user(self, user_id: str | int) -> None:

# Team related methods

def list_teams(self, **kwargs: dict) -> list[dict]:
def list_teams(self, **kwargs) -> list[dict]:
"""List all teams in Noko.
Keyword Args:
Expand All @@ -1711,7 +1709,7 @@ def get_single_team(self, team_id: str | int) -> list[dict]:
"""
return self.fetch_json(f"teams/{team_id}", http_method="GET")

def create_team(self, **kwargs: dict) -> list[dict]:
def create_team(self, **kwargs) -> list[dict]:
"""Create a new team in Noko.
Keyword Args:
Expand Down Expand Up @@ -1740,9 +1738,7 @@ def edit_team(self, team_id: str | int, name: str) -> list[dict]:
f"teams/{team_id}", post_args=post_args, http_method="PUT"
)

def get_entries_for_users_in_team(
self, team_id: str | int, **kwargs: dict
) -> list[dict]:
def get_entries_for_users_in_team(self, team_id: str | int, **kwargs) -> list[dict]:
"""Get all entries associated with a team.
Results can be filtered using the same keyword arguments as the ones used for the list entries endpoint.
Expand Down Expand Up @@ -1785,7 +1781,7 @@ def get_entries_for_users_in_team(
f"teams/{team_id}/entries", post_args=data, http_method="GET"
)

def get_users_in_team(self, team_id: str | int, **kwargs: dict) -> list[dict]:
def get_users_in_team(self, team_id: str | int, **kwargs) -> list[dict]:
"""Get all users in a team.
Results can be filtered using the same keyword arguments as the ones used for the users entries endpoint.
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ filter_files = true

[tool.flake8]
exclude = ["venv"]
# Ignore missing type annotation on **kwargs: ANN003
# Ignore missing type annotation for self: ANN101
# Ignore missing type annotation for cls: ANN102
# Ignore missing type annotation for special methods (i.e. __init__): ANN204
# Disable import order errors: AZ100
# Ignore missing docstrings in __init__: D107
# Ignore line too long errors: E501. Flake8 flags comments and docstrings, while black doesn't. Let black handle line length.
# Conflicts with W504 and no longer conforms to PEP8: W503
extend-ignore = ["ANN101", "ANN102", "ANN204", "AZ100", "D107", "E501", "I900", "W503"]
extend-ignore = ["ANN003", "ANN101", "ANN102", "ANN204", "AZ100", "D107", "E501", "I900", "W503"]
literal-inline-quotes = "double"
literal-multiline-quotes = "double"
known-modules=":[noko_client],python-dateutil:[dateutil]"
Expand Down

0 comments on commit fc5448d

Please sign in to comment.