aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/vk/utils
diff options
context:
space:
mode:
Diffstat (limited to 'vk/utils')
-rw-r--r--vk/utils/tracking/__init__.py4
-rw-r--r--vk/utils/tracking/online_streaks.py (renamed from vk/utils/tracking/online_periods.py)8
-rw-r--r--vk/utils/tracking/utils/online_streak_duration.py (renamed from vk/utils/tracking/utils/how_much_online.py)6
3 files changed, 9 insertions, 9 deletions
diff --git a/vk/utils/tracking/__init__.py b/vk/utils/tracking/__init__.py
index 8934d94..0f9c422 100644
--- a/vk/utils/tracking/__init__.py
+++ b/vk/utils/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_periods import OnlinePeriodEnumerator
+from .online_streaks import OnlineStreakEnumerator
from .status_tracker import StatusTracker
-__all__ = 'online_periods', 'status_tracker',
+__all__ = 'online_streaks', 'status_tracker',
diff --git a/vk/utils/tracking/online_periods.py b/vk/utils/tracking/online_streaks.py
index 8bd2bda..7523750 100644
--- a/vk/utils/tracking/online_periods.py
+++ b/vk/utils/tracking/online_streaks.py
@@ -8,7 +8,7 @@ from datetime import timedelta
from vk.user import User
-class OnlinePeriodEnumerator(MutableMapping):
+class OnlineStreakEnumerator(MutableMapping):
def __init__(self):
self._records = {}
@@ -33,7 +33,7 @@ class OnlinePeriodEnumerator(MutableMapping):
if period is not None:
yield period
- def duration_by_user(self, db_reader):
+ def group_by_user(self, db_reader):
by_user = {}
for user, time_from, time_to in self.enum(db_reader):
if user not in by_user:
@@ -41,7 +41,7 @@ class OnlinePeriodEnumerator(MutableMapping):
by_user[user] += time_to - time_from
return by_user
- def duration_by_date(self, db_reader):
+ def group_by_date(self, db_reader):
by_date = OrderedDict()
for _, time_from, time_to in self.enum(db_reader):
for date, duration in self._enum_dates_and_durations(time_from, time_to):
@@ -50,7 +50,7 @@ class OnlinePeriodEnumerator(MutableMapping):
by_date[date] += duration
return by_date
- def duration_by_weekday(self, db_reader):
+ def group_by_weekday(self, db_reader):
by_weekday = OrderedDict()
for weekday in range(7):
by_weekday[weekday] = timedelta()
diff --git a/vk/utils/tracking/utils/how_much_online.py b/vk/utils/tracking/utils/online_streak_duration.py
index 6ab4d1e..aa99152 100644
--- a/vk/utils/tracking/utils/how_much_online.py
+++ b/vk/utils/tracking/utils/online_streak_duration.py
@@ -12,12 +12,12 @@ import sys
import matplotlib.pyplot as plt
import numpy as np
-from .. import OnlinePeriodEnumerator
+from .. import OnlineStreakEnumerator
from ..db import Format as DatabaseFormat
from vk.user import UserField
def process_database(db_reader, writer):
- by_user = OnlinePeriodEnumerator().duration_by_user(db_reader)
+ by_user = OnlineStreakEnumerator().group_by_user(db_reader)
for user, duration in by_user.items():
writer.add_user_duration(user, duration)
@@ -192,7 +192,7 @@ class PlotBuilder:
def __exit__(self, *args):
bar_chart = BarChartBuilder()
- bar_chart.set_title('How much time do people spend online?')
+ bar_chart.set_title('How much time people spend online?')
bar_chart.set_value_grid()
bar_chart.set_integer_values_only()