Implemented most of the api placeholders #23
111
frontend/api.py
@@ -13,10 +13,10 @@ API_TODO_ITEMS_DELETE = "api/todo_items/{0}/"
|
|||||||
|
|
||||||
API_LISTS_LIST = "api/lists/"
|
API_LISTS_LIST = "api/lists/"
|
||||||
API_LISTS_CREATE = "api/lists/"
|
API_LISTS_CREATE = "api/lists/"
|
||||||
API_LISTS_READ = "lists/{0}/"
|
API_LISTS_READ = "api/lists/{0}/"
|
||||||
API_LISTS_UPDATE = "lists/{0}/"
|
API_LISTS_UPDATE = "api/lists/{0}/"
|
||||||
API_LISTS_PARTIAL_UPDATE = "lists/{0}/"
|
API_LISTS_PARTIAL_UPDATE = "api/lists/{0}/"
|
||||||
API_LISTS_DELETE = "lists/{0}/"
|
API_LISTS_DELETE = "api/lists/{0}/"
|
||||||
|
|
||||||
API_TOKEN = "api/token/"
|
API_TOKEN = "api/token/"
|
||||||
|
|
||||||
@@ -102,6 +102,43 @@ class UserApi(object):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def lists_delete(self, id):
|
||||||
|
"""
|
||||||
|
Auth required
|
||||||
|
|
||||||
|
Deletes a to-do list by id
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
id: to-do list id to delete
|
||||||
|
"""
|
||||||
|
return UserApi._raise_or_return_(
|
||||||
|
requests.delete(
|
||||||
|
url=self.get_api(API_LISTS_DELETE.format(id)),
|
||||||
|
headers=self._access_token_(),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
def lists_update(self, title, id):
|
||||||
|
"""
|
||||||
|
Rename a new to-do list
|
||||||
|
Auth required
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
title : str
|
||||||
|
New name for a list.
|
||||||
|
id : int
|
||||||
|
|
||||||
|
"""
|
||||||
|
return UserApi._raise_or_return_(
|
||||||
|
requests.put(
|
||||||
|
url=self.get_api(API_LISTS_UPDATE.format(id)),
|
||||||
|
json={"title": title},
|
||||||
|
headers=self._access_token_(),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
def todo_items_list(self, **argv):
|
def todo_items_list(self, **argv):
|
||||||
"""
|
"""
|
||||||
List all the exsiting to-do items.
|
List all the exsiting to-do items.
|
||||||
@@ -119,6 +156,67 @@ class UserApi(object):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def todo_items_create(self, parent, text="Note"):
|
||||||
|
"""
|
||||||
|
Create a new to-do item
|
||||||
|
Auth required
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
parent : id of parent list
|
||||||
|
text : str, optional
|
||||||
|
New note. The default is "Note".
|
||||||
|
|
||||||
|
"""
|
||||||
|
return UserApi._raise_or_return_(
|
||||||
|
requests.post(
|
||||||
|
url=self.get_api(API_TODO_ITEMS_CREATE),
|
||||||
|
json={"text": text, "parent":parent, "finished":False},
|
||||||
|
headers=self._access_token_(),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
def todo_items_delete(self, id):
|
||||||
|
"""
|
||||||
|
Auth required
|
||||||
|
|
||||||
|
Deletes a to-do item by id
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
id: to-do item id to delete
|
||||||
|
"""
|
||||||
|
return UserApi._raise_or_return_(
|
||||||
|
requests.delete(
|
||||||
|
url=self.get_api(API_TODO_ITEMS_DELETE.format(id)),
|
||||||
|
headers=self._access_token_(),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
def todo_items_update(self, id, text, finished, parent):
|
||||||
|
"""
|
||||||
|
Rename a new to-do list
|
||||||
|
Auth required
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
id : int
|
||||||
|
Note id
|
||||||
|
text : str
|
||||||
|
New note for the item.
|
||||||
|
finished : bool
|
||||||
|
New state for the item
|
||||||
|
parent : int
|
||||||
|
Parent list id
|
||||||
|
"""
|
||||||
|
return UserApi._raise_or_return_(
|
||||||
|
requests.put(
|
||||||
|
url=self.get_api(API_TODO_ITEMS_UPDATE.format(id)),
|
||||||
|
json={"text": text, "finished":finished, "parent":parent},
|
||||||
|
headers=self._access_token_(),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
# def create(self, title="Untitled"):
|
# def create(self, title="Untitled"):
|
||||||
# """
|
# """
|
||||||
# Create a new to-do list
|
# Create a new to-do list
|
||||||
@@ -215,4 +313,7 @@ class UserApi(object):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def _raise_or_return_(response):
|
def _raise_or_return_(response):
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
return response.json()
|
try:
|
||||||
|
return response.json()
|
||||||
|
except:
|
||||||
|
return response.content
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
|
|
|||||||
|
import numpy as np
|
||||||
|
Зачем тут numpy? Лучше нинада Зачем тут numpy? Лучше нинада
|
|||||||
from user import User
|
from user import User
|
||||||
|
|
||||||
|
|
||||||
def print_lists(lists):
|
def print_lists(lists):
|
||||||
for item in lists:
|
for item in lists:
|
||||||
print(f"List: '{item}'", f"Id: {item.id}", "|", "|".join([str(x) for x in item.items]))
|
print(f"List: '{item.title}'", f"Id: {item.id}", "|", "|".join([str(x) for x in item.items_]))
|
||||||
|
Зачем тут numpy? Лучше нинада Зачем тут numpy? Лучше нинада
Зачем тут numpy? Лучше нинада Зачем тут numpy? Лучше нинада
|
|||||||
|
|
||||||
|
|
||||||
DEFAULT_URL = "http://127.0.0.1:8000"
|
DEFAULT_URL = "http://127.0.0.1:8000"
|
||||||
@@ -12,37 +13,35 @@ user = User(url=DEFAULT_URL)
|
|||||||
|
Зачем тут numpy? Лучше нинада Зачем тут numpy? Лучше нинада
Зачем тут numpy? Лучше нинада Зачем тут numpy? Лучше нинада
|
|||||||
user.auth("root", "root")
|
user.auth("root", "root")
|
||||||
|
|
||||||
```suggestion
user.lists_[0].modify(title=f"A new title {random.random()}")
```
|
|||||||
# Fetch existing lists:
|
# Fetch existing lists:
|
||||||
lists = user.fetchUserLists()
|
print_lists(user.fetchUserLists())
|
||||||
|
Зачем тут numpy? Лучше нинада Зачем тут numpy? Лучше нинада
Зачем тут numpy? Лучше нинада Зачем тут numpy? Лучше нинада
|
|||||||
print("Fecthing...")
|
|
||||||
|
Зачем тут numpy? Лучше нинада Зачем тут numpy? Лучше нинада
|
|||||||
print_lists(lists)
|
|
||||||
|
Зачем тут numpy? Лучше нинада Зачем тут numpy? Лучше нинада
|
|||||||
|
|
||||||
|
Зачем тут numpy? Лучше нинада Зачем тут numpy? Лучше нинада
|
|||||||
# Remove user list by id:
|
|
||||||
|
Зачем тут numpy? Лучше нинада Зачем тут numpy? Лучше нинада
|
|||||||
user.removeUserList(5)
|
|
||||||
|
Зачем тут numpy? Лучше нинада Зачем тут numpy? Лучше нинада
|
|||||||
lists = user.fetchUserLists()
|
|
||||||
|
Зачем тут numpy? Лучше нинада Зачем тут numpy? Лучше нинада
|
|||||||
print(f"Removing {5}...")
|
|
||||||
|
Зачем тут numpy? Лучше нинада Зачем тут numpy? Лучше нинада
|
|||||||
print_lists(lists)
|
|
||||||
|
Зачем тут numpy? Лучше нинада Зачем тут numpy? Лучше нинада
|
|||||||
|
|
||||||
# Append a new list to user:
|
# Append a new list to user:
|
||||||
print("Appending list...")
|
print("Appending list...")
|
||||||
scroll = user.appendUserList(title="a new list!")
|
scroll = user.appendUserList(title="a new list!")
|
||||||
print_lists(lists)
|
print_lists(user.fetchUserLists())
|
||||||
|
Зачем тут numpy? Лучше нинада Зачем тут numpy? Лучше нинада
Зачем тут numpy? Лучше нинада Зачем тут numpy? Лучше нинада
|
|||||||
|
|
||||||
|
Зачем тут numpy? Лучше нинада Зачем тут numpy? Лучше нинада
|
|||||||
|
# Remove user list by id:
|
||||||
|
Зачем тут numpy? Лучше нинада Зачем тут numpy? Лучше нинада
|
|||||||
|
i = user.lists_[0].id
|
||||||
|
Зачем тут numpy? Лучше нинада Зачем тут numpy? Лучше нинада
|
|||||||
|
print(f"Removing {i}...")
|
||||||
|
Зачем тут numpy? Лучше нинада Зачем тут numpy? Лучше нинада
|
|||||||
|
user.removeUserList(i)
|
||||||
|
Зачем тут numpy? Лучше нинада Зачем тут numpy? Лучше нинада
|
|||||||
|
print_lists(user.fetchUserLists())
|
||||||
|
Зачем тут numpy? Лучше нинада Зачем тут numpy? Лучше нинада
|
|||||||
|
|
||||||
# Modify list 0:
|
# Modify list 0:
|
||||||
print("Modifyng list...")
|
print("Modifyng list...")
|
||||||
lists[0].modify(title="A new title")
|
user.lists_[0].modify(title=f"A new title {np.random.random()}")
|
||||||
|
Зачем тут numpy? Лучше нинада Зачем тут numpy? Лучше нинада
Зачем тут numpy? Лучше нинада Зачем тут numpy? Лучше нинада
|
|||||||
print_lists(lists)
|
print_lists(user.fetchUserLists())
|
||||||
|
Зачем тут numpy? Лучше нинада Зачем тут numpy? Лучше нинада
Зачем тут numpy? Лучше нинада Зачем тут numpy? Лучше нинада
|
|||||||
|
|
||||||
# Append item to list:
|
# Append item to list:
|
||||||
print("Appending item to last list...")
|
print("Appending item to last list...")
|
||||||
item = lists[-1].append(text="this is an item")
|
item = user.lists_[-1].append(text="this is an item")
|
||||||
|
Зачем тут numpy? Лучше нинада Зачем тут numpy? Лучше нинада
Зачем тут numpy? Лучше нинада Зачем тут numpy? Лучше нинада
|
|||||||
print_lists(lists)
|
print_lists(user.fetchUserLists())
|
||||||
|
Зачем тут numpy? Лучше нинада Зачем тут numpy? Лучше нинада
Зачем тут numpy? Лучше нинада Зачем тут numpy? Лучше нинада
|
|||||||
|
|
||||||
# Modifying item
|
# Modifying item
|
||||||
print("Modifyng appended item...")
|
print("Modifyng appended item...")
|
||||||
item.modify(finished=True, text="this is an updated item")
|
item.modify(finished=True, text="this is an updated item")
|
||||||
print_lists(lists)
|
print_lists(user.fetchUserLists())
|
||||||
|
Зачем тут numpy? Лучше нинада Зачем тут numpy? Лучше нинада
Зачем тут numpy? Лучше нинада Зачем тут numpy? Лучше нинада
|
|||||||
|
|
||||||
# Removing item at 0
|
# Removing item at 0
|
||||||
print("Removing item 0 from list 0...")
|
print("Removing last item from last list...")
|
||||||
|
Зачем тут numpy? Лучше нинада Зачем тут numpy? Лучше нинада
Зачем тут numpy? Лучше нинада Зачем тут numpy? Лучше нинада
|
|||||||
lists[0].remove(0)
|
user.lists_[-1].remove(-1)
|
||||||
|
Зачем тут numpy? Лучше нинада Зачем тут numpy? Лучше нинада
Зачем тут numpy? Лучше нинада Зачем тут numpy? Лучше нинада
|
|||||||
print_lists(lists)
|
print_lists(user.fetchUserLists())
|
||||||
|
Зачем тут numpy? Лучше нинада Зачем тут numpy? Лучше нинада
Зачем тут numpy? Лучше нинада Зачем тут numpy? Лучше нинада
|
|||||||
|
|||||||
|
Зачем тут numpy? Лучше нинада Зачем тут numpy? Лучше нинада
Зачем тут numpy? Лучше нинада Зачем тут numpy? Лучше нинада
|
|||||||
174
frontend/user.py
@@ -1,85 +1,135 @@
|
|||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
Кажется, лишний print Кажется, лишний print
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
|
from types import SimpleNamespace
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
import numpy as np
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
from api import UserApi
|
from api import UserApi
|
||||||
|
|
||||||
|
LIST_UPDATEBLE = ["title"]
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
TODO_ITEM_UPDATEBLE = ["text", "finished"]
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
UPDATE_ERROR = "Failed to update property: {0}"
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
DATETIME_STR = "%Y-%m-%dT%H:%M:%S.%fZ"
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
def bad_arguments(x, d):
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
return list((set(x) - set(d)))
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
|
||||||
class ToDoList(object):
|
class ToDoList(object):
|
||||||
def __init__(self, id, title, created_at=None, items=[], parent=None):
|
def __init__(self, id, title, created_at=None, items=None,
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
parent=None, user=None):
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
self.id = id
|
self.id = id
|
||||||
self.title = title
|
self.title = title
|
||||||
self.items = items
|
self.items_ = [] if items is None else items
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
self.created_at = created_at
|
if type(created_at) is datetime:
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
self.created_at = created_at
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
else:
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
self.created_at = datetime.strptime(created_at, DATETIME_STR)
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
self.user = user
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
for item in self.items:
|
for item in self.items_:
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
yield item
|
yield item
|
||||||
|
|
||||||
def __getitem__(self, index):
|
def __getitem__(self, index):
|
||||||
return self.items[index]
|
return self.items_[index]
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
|
||||||
def __len__(self):
|
def __len__(self):
|
||||||
return len(self.items)
|
return len(self.items_)
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"[{self.id}] {self.title}"
|
return f"[{self.id}] {self.title}"
|
||||||
|
|
||||||
def index(self, value):
|
def index(self, value):
|
||||||
return self.items.index(value)
|
return self.items_.index(value)
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
|
||||||
# ToDo
|
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
def remove(self, index):
|
def remove(self, index):
|
||||||
self.items.remove(self.items[index])
|
"""
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
self.sync()
|
Remove item at index from db
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
"""
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
item = self.items_[index]
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
self.items_.remove(item)
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
item.dispose()
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
|
||||||
# ToDo
|
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
def append(self, text):
|
def append(self, text):
|
||||||
item = ToDoItem(id=None, text=text, created_at=datetime.now())
|
"""
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
self.items.append(item)
|
Add a new item to db
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
item.sync()
|
"""
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
self.sync()
|
if "DEBUG" in os.environ:
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
return item
|
created_item = ToDoItem(id=np.random.randint(100, 1000), text=text, user=self.user)
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
else:
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
created_item = self.user.todo_items_create(parent=self.id, text=text)
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
created_item = ToDoItem(**created_item, user=self.user)
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
self.items_.append(created_item)
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
return created_item
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
|
||||||
def modify(self, **argv):
|
def modify(self, **argv):
|
||||||
|
bad = bad_arguments(argv.keys(), LIST_UPDATEBLE)
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
if len(bad) > 0:
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
raise RuntimeError(UPDATE_ERROR.format(bad[0]))
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
for key, value in argv.items():
|
for key, value in argv.items():
|
||||||
setattr(self, key, value)
|
setattr(self, key, value)
|
||||||
self.sync()
|
self.sync()
|
||||||
|
|
||||||
# ToDo
|
def dispose(self):
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
print(f"To-do list id '{self.id}' is being disposed of...")
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
if "DEBUG" in os.environ:
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
return
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
for item in self.items_:
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
item.dispose()
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
self.user.lists_delete(self.id)
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
def sync(self):
|
def sync(self):
|
||||||
# ToDo send request or store in form
|
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
print(f"Item '{self}' is being synchronized...")
|
print(f"Item '{self}' is being synchronized...")
|
||||||
|
if "DEBUG" in os.environ:
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
return
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
self.user.lists_update(title=self.title, id=self.id)
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
|
||||||
|
|
||||||
class ToDoItem(object):
|
class ToDoItem(object):
|
||||||
def __init__(self, id, text, finished=False, created_at=None, parent=None):
|
def __init__(self, id, text, finished=False, created_at=None,
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
parent=None, user=None):
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
self.id = id
|
self.id = id
|
||||||
self.text = text
|
self.text = text
|
||||||
self.finished = finished
|
self.finished = finished
|
||||||
self.created_at = created_at
|
if type(created_at) is datetime:
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
self.created_at = created_at
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
else:
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
self.created_at = datetime.strptime(created_at, DATETIME_STR)
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
self.parent = parent
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
self.user = user
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"[{self.id}] {self.text}"
|
return f"[{self.id}] {self.text}"
|
||||||
|
|
||||||
def modify(self, **argv):
|
def modify(self, **argv):
|
||||||
|
bad = bad_arguments(argv.keys(), TODO_ITEM_UPDATEBLE)
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
if len(bad) > 0:
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
print(argv)
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
raise RuntimeError(UPDATE_ERROR.format(bad[0]))
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
for key, value in argv.items():
|
for key, value in argv.items():
|
||||||
setattr(self, key, value)
|
setattr(self, key, value)
|
||||||
self.sync()
|
self.sync()
|
||||||
|
|
||||||
# ToDo
|
def dispose(self):
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
def sync(self):
|
print(f"To-do item id '{self.id}' is being disposed of...")
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
# ToDo send request or store in form
|
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
print(f"Item '{self}' is being synchronized...")
|
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
class User(UserApi):
|
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
def auth(self, user, passwd):
|
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
if "DEBUG" in os.environ:
|
if "DEBUG" in os.environ:
|
||||||
return
|
return
|
||||||
UserApi.auth(self, user, passwd)
|
self.user.todo_items_delete(self.id)
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
|
||||||
# ToDo
|
# ToDo
|
||||||
items = [
|
def sync(self):
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
print(f"Item '{self}' is being synchronized...")
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
if "DEBUG" in os.environ:
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
return
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
self.user.todo_items_update(id=self.id, text=self.text, finished=self.finished, parent=self.parent)
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
def make_debug_lists():
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
return [
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
ToDoList(
|
ToDoList(
|
||||||
id=i,
|
id=i,
|
||||||
title=f"List {i}",
|
title=f"List {i}",
|
||||||
@@ -92,17 +142,63 @@ class User(UserApi):
|
|||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
Кажется, лишний print Кажется, лишний print
|
|||||||
for i in range(10)
|
for i in range(10)
|
||||||
]
|
]
|
||||||
|
|
||||||
# ToDo
|
class User(UserApi):
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
def auth(self, user, passwd):
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
"""
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
Basic authentification
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
"""
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
if "DEBUG" in os.environ:
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
return
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
UserApi.auth(self, user, passwd)
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
# Storing lists - mostly for debug purposes
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
lists_ = make_debug_lists()
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
def fetchUserLists(self):
|
def fetchUserLists(self):
|
||||||
return self.items
|
"""
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
Fetch existing user lists from the server
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
returns: fetched list of ToDoList sorted by creation datetime
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
"""
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
print("Fetching lists...")
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
if "DEBUG" in os.environ:
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
return self.lists_
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
user_lists = self.lists_list()["results"]
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
user_items = self.todo_items_list()["results"]
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
toDoLists = {x["id"]:ToDoList(**x, user=self) for x in user_lists}
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
toDoItems = [ToDoItem(**x, user=self) for x in user_items]
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
for toDoItem in toDoItems:
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
# Catching stray items
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
if not hasattr(toDoItem, "parent"):
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
toDoItem.dispose()
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
continue
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
toDoLists[toDoItem.parent].items_.append(toDoItem)
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
for toDoList in toDoLists.values():
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
toDoList.items_ = sorted(toDoList.items_, key=lambda x: x.created_at)
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
self.lists_ = sorted(toDoLists.values(), key=lambda x: x.created_at)
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
return self.lists_
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
|
||||||
# ToDo
|
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
def removeUserList(self, id):
|
def removeUserList(self, id):
|
||||||
self.items = [item for item in self.items if item.id != id]
|
"""
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
Remove existing user to-do list from the serverreturns:
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
"""
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
to_remove = [item for item in self.lists_ if item.id == id][0]
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
self.lists_.remove(to_remove)
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
if not ("DEBUG" in os.environ):
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
to_remove.dispose()
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
return self.lists_
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
|
||||||
# ToDo
|
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
def appendUserList(self, title):
|
def appendUserList(self, title):
|
||||||
item = ToDoList(id=None, title=title, created_at=datetime.now())
|
"""
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
self.items.append(item)
|
Create a new user list
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
item.sync()
|
title: title of list to create
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
return item
|
returns: created item
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
"""
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
if "DEBUG" in os.environ:
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
item = ToDoList(id=np.random.randint(100, 1000), title=title, created_at=datetime.now())
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
self.lists_.append(item)
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
return item
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
created_list = self.lists_create(title=title)
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
created_list = ToDoList(**created_list)
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
return created_list
|
||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
|
|||||||
|
|||||||
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
```suggestion
created_item = ToDoItem(id=random.randint(100, 1000), text=text, user=self.user)
```
Кажется, лишний print Кажется, лишний print
Кажется, лишний print Кажется, лишний print
|
|||||||
@@ -123,10 +123,10 @@ class WorkSpaceFrame(tk.Frame):
|
|||||||
# data
|
# data
|
||||||
self.lists = user.fetchUserLists()
|
self.lists = user.fetchUserLists()
|
||||||
|
|
||||||
text = tk.Text(self, width=15, height=1)
|
self.add_list_text = tk.Text(self, width=15, height=1)
|
||||||
text.pack(anchor="sw")
|
self.add_list_text.pack(anchor="sw")
|
||||||
|
|
||||||
add = tk.Button(self, text="Добавить лист", command=placeholder)
|
add = tk.Button(self, text="Добавить лист", command=self.add_list)
|
||||||
add.pack(anchor="sw")
|
add.pack(anchor="sw")
|
||||||
|
|
||||||
# select list box
|
# select list box
|
||||||
@@ -153,6 +153,23 @@ class WorkSpaceFrame(tk.Frame):
|
|||||||
self.toToList = ToDoListWidget(self)
|
self.toToList = ToDoListWidget(self)
|
||||||
self.toToList.pack(side="left", fill="both", expand=1)
|
self.toToList.pack(side="left", fill="both", expand=1)
|
||||||
|
|
||||||
|
def add_list(self, *args):
|
||||||
|
text = self.add_list_text.get(1.0, "end").strip()
|
||||||
|
if len(text) == 0:
|
||||||
|
print("empty name! Not adding!")
|
||||||
|
return
|
||||||
|
self.user.appendUserList(title=text)
|
||||||
|
self.lists = self.user.fetchUserLists()
|
||||||
|
|
||||||
|
# fill list box
|
||||||
|
self.listBox.delete(0,'end')
|
||||||
|
for item in self.lists:
|
||||||
|
s = f"{str(item)}: {item.created_at.strftime('%Y-%m-%d %H:%M:%S')}"
|
||||||
|
self.listBox.insert(tk.END, s)
|
||||||
|
self.listBox.pack()
|
||||||
|
len(self.lists) > 0 and self.listBox.selection_set(first=0)
|
||||||
|
|
||||||
|
|
||||||
def listBox_selected(self, *args):
|
def listBox_selected(self, *args):
|
||||||
|
|
||||||
self.toToList.clear()
|
self.toToList.clear()
|
||||||
|
|||||||
Зачем тут numpy? Лучше нинада
Зачем тут numpy? Лучше нинада