From dd88c8103e13f108a0fed51a82221fdf60f6a188 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sun, 19 Jun 2016 01:36:19 +0300 Subject: add Pylint configuration & fix the warnings --- vk/tracking/__init__.py | 4 ++-- vk/tracking/db/backend/__init__.py | 4 +++- vk/tracking/db/backend/log.py | 2 +- vk/tracking/db/format.py | 12 ++++++------ vk/tracking/online_streaks.py | 2 -- vk/tracking/status_tracker.py | 10 +++++----- 6 files changed, 17 insertions(+), 17 deletions(-) (limited to 'vk/tracking') diff --git a/vk/tracking/__init__.py b/vk/tracking/__init__.py index 0f9c422..cfc80ea 100644 --- a/vk/tracking/__init__.py +++ b/vk/tracking/__init__.py @@ -2,7 +2,7 @@ # This file is licensed under the terms of the MIT License. # See LICENSE.txt for details. -from .online_streaks import OnlineStreakEnumerator +from .online_streaks import OnlineStreakEnumerator, Weekday from .status_tracker import StatusTracker -__all__ = 'online_streaks', 'status_tracker', +__all__ = 'online_streaks', 'status_tracker', diff --git a/vk/tracking/db/backend/__init__.py b/vk/tracking/db/backend/__init__.py index 4b3c278..68de924 100644 --- a/vk/tracking/db/backend/__init__.py +++ b/vk/tracking/db/backend/__init__.py @@ -2,4 +2,6 @@ # This file is licensed under the terms of the MIT License. # See LICENSE.txt for details. -__all__ = 'csv', 'log', 'null' +from . import csv, log, null + +__all__ = 'csv', 'log', 'null', diff --git a/vk/tracking/db/backend/log.py b/vk/tracking/db/backend/log.py index 625257b..03548eb 100644 --- a/vk/tracking/db/backend/log.py +++ b/vk/tracking/db/backend/log.py @@ -64,7 +64,7 @@ class Writer: return '{} was last seen at {} using {}.'.format( Writer._format_user(user), user.get_last_seen_time_local(), - user.get_last_seen_platform().get_description_for_sentence()) + user.get_last_seen_platform().get_descr_text()) @staticmethod def _format_user_went_online(user): diff --git a/vk/tracking/db/format.py b/vk/tracking/db/format.py index 4856094..862c20e 100644 --- a/vk/tracking/db/format.py +++ b/vk/tracking/db/format.py @@ -4,7 +4,7 @@ from enum import Enum -from .backend import * +from . import backend class Format(Enum): CSV = 'csv' @@ -13,21 +13,21 @@ class Format(Enum): def create_writer(self, fd): if self is Format.CSV: - return csv.Writer(fd) + return backend.csv.Writer(fd) elif self is Format.LOG: - return log.Writer(fd) + return backend.log.Writer(fd) elif self is Format.NULL: - return null.Writer(fd) + return backend.null.Writer(fd) else: raise NotImplementedError('unsupported database format: ' + str(self)) def create_reader(self, fd): if self is Format.CSV: - return csv.Reader(fd) + return backend.csv.Reader(fd) elif self is Format.LOG: raise NotImplementedError() elif self is Format.NULL: - return null.Reader(fd) + return backend.null.Reader(fd) else: raise NotImplementedError('unsupported database format: ' + str(self)) diff --git a/vk/tracking/online_streaks.py b/vk/tracking/online_streaks.py index 467a1d5..db24053 100644 --- a/vk/tracking/online_streaks.py +++ b/vk/tracking/online_streaks.py @@ -7,8 +7,6 @@ from collections.abc import MutableMapping from datetime import timedelta from enum import Enum -from vk.user import User - class Weekday(Enum): MONDAY = 0 TUESDAY = 1 diff --git a/vk/tracking/status_tracker.py b/vk/tracking/status_tracker.py index 8faea8e..bb5f186 100644 --- a/vk/tracking/status_tracker.py +++ b/vk/tracking/status_tracker.py @@ -22,9 +22,9 @@ class StatusTracker: time.sleep(self._timeout) def add_database_writer(self, writer): - self.add_initial_status_handler(lambda user: writer.on_initial_status(user)) - self.add_status_update_handler(lambda user: writer.on_status_update(user)) - self.add_connection_error_handler(lambda e: writer.on_connection_error(e)) + self.add_initial_status_handler(writer.on_initial_status) + self.add_status_update_handler(writer.on_status_update) + self.add_connection_error_handler(writer.on_connection_error) def add_initial_status_handler(self, fn): self._assert_is_callback(fn) @@ -64,7 +64,7 @@ class StatusTracker: while True: try: return self._query_status(uids) - except vk.error.ConnectionError as e: + except vk.error.APIConnectionError as e: self._notify_connection_error(e) self._wait_after_connection_error() @@ -73,7 +73,7 @@ class StatusTracker: self._wait_after_connection_error() try: return self._query_status(uids) - except vk.error.ConnectionError as e: + except vk.error.APIConnectionError as e: self._notify_connection_error(e) @staticmethod -- cgit v1.2.3