Skip to content

Commit

Permalink
Remove pylint ignore directives
Browse files Browse the repository at this point in the history
  • Loading branch information
rkhwaja committed Sep 20, 2023
1 parent 76ca4ea commit d1aa041
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 30 deletions.
4 changes: 2 additions & 2 deletions src/rtmilk/_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand Down
8 changes: 4 additions & 4 deletions src/rtmilk/_sansio.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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'])
Expand Down Expand Up @@ -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'])
Expand Down
2 changes: 1 addition & 1 deletion src/rtmilk/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down
8 changes: 4 additions & 4 deletions src/rtmilk/api_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/rtmilk/api_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/rtmilk/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions src/rtmilk/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
22 changes: 11 additions & 11 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,27 @@ 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,
task.list.taskseries[0].id,
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)
Expand All @@ -69,37 +69,37 @@ 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,
task.list.taskseries[0].task[0].id)
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()
Expand Down
2 changes: 1 addition & 1 deletion tests/generate_credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit d1aa041

Please sign in to comment.