-
Notifications
You must be signed in to change notification settings - Fork 2
Features #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: complaints-and-suggestions
Are you sure you want to change the base?
Features #14
Conversation
умеет на >1000, быстро работает
Renamed functions and added working with a period ahahahaha tokeni na githube ne hraniatsia hahahah
Renamed functions and added working with a period
Написал бота. Понимает некоторые штуки, но суть такова: получает формат: "group_id: .....; period: .....", пробелы важны. Возвращает процент онлайн - разово. Вырубается по команде stop
super bot
upgraded bot
Add files via upload
…то словарь они тебе график просто обалдеть
lpetrov02
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Короче добавь докстринги и немного больше комментируй происходящее, а то не всегда понятно.
| import matplotlib.dates as mdates | ||
|
|
||
|
|
||
| dict_with_data = {datetime.datetime(2020, 12, 7, 1): 53, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не очень понятно, что это за циферки
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Которыми ты заполняешь dict_with_data
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Если это просто чиселки для тестинга, то наверно лучше коммент поставить
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
да, оно не надо ни для чего, закомменчу
| return | ||
| day_of_week = [0, 1, 2, 3, 4, 5, 6] | ||
| online_on_this_weekday = [0, 0, 0, 0, 0, 0, 0] | ||
| for date in dict_with_data: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не очень понимаю здесь: ты бегаешь переменной date по dict_with_data, а потом итерируешься по date...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
date -- ключи в словаре, цикл нужен для того, чтобы узнать дельту данных. я просто не в курсе, как просто посмотреть разницу между соседними ячейками словаря
| for date in dict_with_data: | ||
| online_on_this_weekday[date.weekday()] = dict_with_data[date] | ||
| labels = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"] | ||
| pltt.rcParams['figure.figsize'] = 7, 5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Наверное был бы неплох коммент, где ты разъясняешь, что значат эти слова. Оно наверное понятно и так, но нужно ведь наверняка
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ну это просто оформление и всякие параметры картинки. так и напишу
| day_delta = 0 | ||
| prev_key = datetime.datetime.now() | ||
| for key in dict_with_data: | ||
| day_delta = key - prev_key |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А почему нельзя сразу в конец списка рассмотреть?
data_length = len(dict_with_data)
day_delta = dict_with_data[data_length - 1] - dict_with_data[data_length - 2]
Ну там ещё можно проверку на слишком короткий массив.
Просто суть в том, что ты меняешь значение переменной в цикле, при этом промежуточные никуда не складываешь.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
потому что из data_length - 1 -- не ключ словаря. ну промежуточные и правда не нужны, но это такой костыль, чтобы коротко написать
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ну смотри...
| for key in dict_with_data: | ||
| y_axis[int((key.minute + key.hour * 60) // period)] = dict_with_data[key] | ||
| figure, ax = plt.subplots(figsize=(number_of_dots, 10)) | ||
| ax.set_title(label_of_image) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Коротенькие комментарии напиши, наверное, что какой мини-блок делает
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
кок
| figure.savefig("images/" + label_of_image + ".png") | ||
|
|
||
|
|
||
| def create_graph_image(period, total_time, y_axis, label_of_graph): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Аналогично - комментики. И докстринги кстати!!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
кок
| month_length = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] | ||
|
|
||
|
|
||
| def upload_picture(picture_path): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Комментарии и докстринг
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
кок
это для ревью