diff --git a/src/rtmilk/_properties.py b/src/rtmilk/_properties.py index ac33ca2..6ee0e7c 100644 --- a/src/rtmilk/_properties.py +++ b/src/rtmilk/_properties.py @@ -124,11 +124,11 @@ def _Parameters(self, value): def Set(self, value: date | datetime | None): parameters = self._Parameters(value) - (self.__class__.F)(self._task._client.api, **parameters) # pylint: disable=no-member + (self.__class__.F)(self._task._client.api, **parameters) async def SetAsync(self, value: date | datetime | None): parameters = self._Parameters(value) - await (self.__class__.FA)(self._task._client.apiAsync, **parameters) # pylint: disable=no-member + await (self.__class__.FA)(self._task._client.apiAsync, **parameters) class StartDateProperty(DateProperty): """None means no start date""" diff --git a/src/rtmilk/_sansio.py b/src/rtmilk/_sansio.py index 09fb9aa..c98436b 100644 --- a/src/rtmilk/_sansio.py +++ b/src/rtmilk/_sansio.py @@ -5,7 +5,7 @@ from logging import getLogger from pprint import pformat -from pydantic import stricturl, validate_arguments, ValidationError # pylint: disable=no-name-in-module +from pydantic import stricturl, validate_arguments, ValidationError from .models import AuthResponse, EchoResponse, FailStat, ListsResponse, NotesResponse, PriorityDirectionEnum, PriorityEnum, RTMError, SettingsResponse, SingleListResponse, SubscriptionListResponse, SubscriptionResponse, TagListResponse, TaskListResponse, TaskPayload, TaskResponse, TimelineResponse, TopicListResponse @@ -100,7 +100,7 @@ def Out(cls, **rsp): AuthorizedCall = Call class ListsAdd(AuthorizedCall): - def In(self, timeline: str, name: str, filter: str | None = None): # pylint: disable=redefined-builtin + def In(self, timeline: str, name: str, filter: str | None = None): kwargs = _RebuildArgs(filter=filter) # TODO validate parameter return self.CommonParams('rtm.lists.add', timeline=timeline, name=name, **kwargs) @@ -179,7 +179,7 @@ def Out(cls, **rsp): class PushSubscribe(AuthorizedCall): @validate_arguments - def In(self, url: stricturl(allowed_schemes='https'), topics: str, push_format: str, timeline: str, lease_seconds: int | None = None, filter: str | None = None): # pylint: disable=redefined-builtin + def In(self, url: stricturl(allowed_schemes='https'), topics: str, push_format: str, timeline: str, lease_seconds: int | None = None, filter: str | None = None): kwargs = _RebuildArgs(lease_seconds=lease_seconds, filter=filter) # TODO validate parameters if 'lease_seconds' in kwargs: kwargs['lease_seconds'] = str(kwargs['lease_seconds']) @@ -256,7 +256,7 @@ def Out(cls, **rsp): return _ValidateReturn(TaskResponse, rsp) class TasksGetList(AuthorizedCall): - def In(self, list_id: str | None = None, filter: str | None = None, last_sync: datetime | None = None): # pylint: disable=redefined-builtin + def In(self, list_id: str | None = None, filter: str | None = None, last_sync: datetime | None = None): kwargs = _RebuildArgs(list_id=list_id, filter=filter, last_sync=last_sync) if 'last_sync' in kwargs and isinstance(kwargs['last_sync'], (datetime)): kwargs['last_sync'] = _RtmDatetime(kwargs['last_sync']) diff --git a/src/rtmilk/_utils.py b/src/rtmilk/_utils.py index 77aae87..c5835e3 100644 --- a/src/rtmilk/_utils.py +++ b/src/rtmilk/_utils.py @@ -3,7 +3,7 @@ from datetime import datetime, timezone from typing import Generic, TypeVar -from pydantic.fields import ModelField # pylint: disable=no-name-in-module +from pydantic.fields import ModelField PydanticField = TypeVar('PydanticField') diff --git a/src/rtmilk/api_async.py b/src/rtmilk/api_async.py index 6e0c358..854e758 100644 --- a/src/rtmilk/api_async.py +++ b/src/rtmilk/api_async.py @@ -5,7 +5,7 @@ from logging import getLogger from aiohttp import ClientResponseError, ClientSession -from pydantic import stricturl, validate_arguments # pylint: disable=no-name-in-module +from pydantic import stricturl, validate_arguments from .api_base import RTMError, UnauthorizedAPIBase from .models import AuthResponse, EchoResponse, ListsResponse, NotesResponse, PriorityDirectionEnum, PriorityEnum, SettingsResponse, SingleListResponse, SubscriptionListResponse, SubscriptionResponse, TagListResponse, TaskListResponse, TaskPayload, TaskResponse, TimelineResponse, TopicListResponse @@ -52,7 +52,7 @@ def secrets(self): return self._authSecrets @validate_arguments - async def ListsAdd(self, timeline: str, name: str, filter: str | None = None) -> SingleListResponse: # pylint: disable=redefined-builtin + async def ListsAdd(self, timeline: str, name: str, filter: str | None = None) -> SingleListResponse: return ListsAdd.Out(** await _CallAsync(ListsAdd(self._authSecrets).In(timeline=timeline, name=name, filter=filter))) @validate_arguments @@ -85,7 +85,7 @@ async def PushGetTopics(self) -> TopicListResponse: return PushGetTopics.Out(** await _CallAsync(PushGetTopics(self._authSecrets).In())) @validate_arguments - async def PushSubscribe(self, url: stricturl(allowed_schemes='https'), topics: str, push_format: str, timeline: str, lease_seconds: int | None = None, filter: str | None = None) -> SubscriptionResponse: # pylint: disable=redefined-builtin + async def PushSubscribe(self, url: stricturl(allowed_schemes='https'), topics: str, push_format: str, timeline: str, lease_seconds: int | None = None, filter: str | None = None) -> SubscriptionResponse: return PushSubscribe.Out(** await _CallAsync(PushSubscribe(self._authSecrets).In(url=url, topics=topics, push_format=push_format, timeline=timeline, lease_seconds=lease_seconds, filter=filter))) @validate_arguments @@ -122,7 +122,7 @@ async def TasksDelete(self, timeline: str, list_id: str, taskseries_id: str, tas return TasksDelete.Out(** await _CallAsync(TasksDelete(self._authSecrets).In(timeline=timeline, list_id=list_id, taskseries_id=taskseries_id, task_id=task_id))) @validate_arguments - async def TasksGetList(self, list_id: str | None = None, filter: str | None = None, last_sync: datetime | None = None) -> TaskListResponse: # pylint: disable=redefined-builtin + async def TasksGetList(self, list_id: str | None = None, filter: str | None = None, last_sync: datetime | None = None) -> TaskListResponse: return TasksGetList.Out(** await _CallAsync(TasksGetList(self._authSecrets).In(list_id=list_id, filter=filter, last_sync=last_sync))) @validate_arguments diff --git a/src/rtmilk/api_sync.py b/src/rtmilk/api_sync.py index 5747ecc..8700464 100644 --- a/src/rtmilk/api_sync.py +++ b/src/rtmilk/api_sync.py @@ -4,7 +4,7 @@ from logging import getLogger from pprint import pformat -from pydantic import stricturl, validate_arguments # pylint: disable=no-name-in-module +from pydantic import stricturl, validate_arguments from requests import get from requests.exceptions import RequestException @@ -62,7 +62,7 @@ def secrets(self): return self._authSecrets @validate_arguments - def ListsAdd(self, timeline: str, name: str, filter: str | None = None) -> SingleListResponse: # pylint: disable=redefined-builtin + def ListsAdd(self, timeline: str, name: str, filter: str | None = None) -> SingleListResponse: return ListsAdd.Out(**_CallSync(ListsAdd(self._authSecrets).In(timeline=timeline, name=name, filter=filter))) @validate_arguments @@ -95,7 +95,7 @@ def PushGetTopics(self) -> TopicListResponse: return PushGetTopics.Out(**_CallSync(PushGetTopics(self._authSecrets).In())) @validate_arguments - def PushSubscribe(self, url: stricturl(allowed_schemes='https'), topics: str, push_format: str, timeline: str, lease_seconds: int | None = None, filter: str | None = None) -> SubscriptionResponse: # pylint: disable=redefined-builtin + def PushSubscribe(self, url: stricturl(allowed_schemes='https'), topics: str, push_format: str, timeline: str, lease_seconds: int | None = None, filter: str | None = None) -> SubscriptionResponse: return PushSubscribe.Out(**_CallSync(PushSubscribe(self._authSecrets).In(url=url, topics=topics, push_format=push_format, timeline=timeline, lease_seconds=lease_seconds, filter=filter))) @validate_arguments @@ -132,7 +132,7 @@ def TasksDelete(self, timeline: str, list_id: str, taskseries_id: str, task_id: return TasksDelete.Out(**_CallSync(TasksDelete(self._authSecrets).In(timeline=timeline, list_id=list_id, taskseries_id=taskseries_id, task_id=task_id))) @validate_arguments - def TasksGetList(self, list_id: str | None = None, filter: str | None = None, last_sync: datetime | None = None) -> TaskListResponse: # pylint: disable=redefined-builtin + def TasksGetList(self, list_id: str | None = None, filter: str | None = None, last_sync: datetime | None = None) -> TaskListResponse: return TasksGetList.Out(**_CallSync(TasksGetList(self._authSecrets).In(list_id=list_id, filter=filter, last_sync=last_sync))) @validate_arguments diff --git a/src/rtmilk/client.py b/src/rtmilk/client.py index 19dee03..a047625 100644 --- a/src/rtmilk/client.py +++ b/src/rtmilk/client.py @@ -11,7 +11,7 @@ _log = getLogger(__name__) -class Task: # pylint: disable=too-many-instance-attributes +class Task: """Represents an RTM task""" def __init__(self, client, listId, taskSeriesId, taskId): diff --git a/src/rtmilk/models.py b/src/rtmilk/models.py index deec3eb..cbbe5b7 100644 --- a/src/rtmilk/models.py +++ b/src/rtmilk/models.py @@ -3,8 +3,8 @@ from datetime import datetime from enum import Enum, IntEnum -from pydantic import AnyHttpUrl, BaseModel, Field, constr, validator # pylint: disable=no-name-in-module -from pydantic.types import ConstrainedStr # pylint: disable=no-name-in-module +from pydantic import AnyHttpUrl, BaseModel, Field, constr, validator +from pydantic.types import ConstrainedStr from ._utils import EmptyStrToNone diff --git a/tests/conftest.py b/tests/conftest.py index 0089ba3..e2806a5 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -32,12 +32,12 @@ def apiAsync(): return APIAsync(apiKey, sharedSecret, token) @fixture() -def timeline(api): # pylint: disable=redefined-outer-name +def timeline(api): return api.TimelinesCreate().timeline @fixture() -def task(api, timeline): # pylint: disable=redefined-outer-name - task = api.TasksAdd(timeline, f'new task {uuid4()}') # pylint: disable=redefined-outer-name +def task(api, timeline): + task = api.TasksAdd(timeline, f'new task {uuid4()}') yield task api.TasksDelete( timeline, task.list.id, @@ -45,14 +45,14 @@ def task(api, timeline): # pylint: disable=redefined-outer-name task.list.taskseries[0].task[0].id) @fixture() -def newList(api, timeline): # pylint: disable=redefined-outer-name +def newList(api, timeline): list_ = api.ListsAdd(timeline, f'list {uuid4()}') yield list_ list_ = api.ListsDelete(timeline, list_.list.id) assert list_.list.deleted is True, list_ @fixture() -def newSmartList(api, timeline): # pylint: disable=redefined-outer-name +def newSmartList(api, timeline): list_ = api.ListsAdd(timeline, f'list {uuid4()}', filter='tag:tag1') yield list_ list_ = api.ListsDelete(timeline, list_.list.id) @@ -69,23 +69,23 @@ def Add(self, name): return task_ def Cleanup(self): - for task in self.tasks: # pylint: disable=redefined-outer-name + for task in self.tasks: task.Delete() self.tasks.clear() class TaskCreatorAPI: - def __init__(self, api, timeline): # pylint: disable=redefined-outer-name + def __init__(self, api, timeline): self.api = api self.timeline = timeline self.tasks = [] def Add(self, name): - task = self.api.TasksAdd(self.timeline, name) # pylint: disable=redefined-outer-name + task = self.api.TasksAdd(self.timeline, name) self.tasks.append(task) return task def Cleanup(self): - for task in self.tasks: # pylint: disable=redefined-outer-name + for task in self.tasks: self.api.TasksDelete( self.timeline, task.list.id, task.list.taskseries[0].id, @@ -93,13 +93,13 @@ def Cleanup(self): self.tasks.clear() @fixture() -def taskCreatorAPI(api, timeline): # pylint: disable=redefined-outer-name +def taskCreatorAPI(api, timeline): creator = TaskCreatorAPI(api, timeline) yield creator creator.Cleanup() @fixture() -def taskCreator(client): # pylint: disable=redefined-outer-name +def taskCreator(client): creator = TaskCreator(client) yield creator creator.Cleanup() diff --git a/tests/generate_credentials.py b/tests/generate_credentials.py index ebb85f7..2c462be 100755 --- a/tests/generate_credentials.py +++ b/tests/generate_credentials.py @@ -16,7 +16,7 @@ def Authorize(): authenticationSession = AuthorizationSession(environ['RTM_API_KEY'], environ['RTM_SHARED_SECRET'], 'delete') print(f'Go to {authenticationSession.url} and authorize') with suppress(ImportError): - from pyperclip import copy # pylint: disable=import-outside-toplevel + from pyperclip import copy copy(authenticationSession.url) print('URL copied to clipboard') input("Press ENTER when you've authorized the app")