ed-api-client 0.1.4__tar.gz → 0.1.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ed_api_client-0.1.4 → ed_api_client-0.1.6}/PKG-INFO +1 -1
- {ed_api_client-0.1.4 → ed_api_client-0.1.6}/ed_api_client/workspaces.py +22 -23
- {ed_api_client-0.1.4 → ed_api_client-0.1.6}/pyproject.toml +1 -1
- {ed_api_client-0.1.4 → ed_api_client-0.1.6}/README.md +0 -0
- {ed_api_client-0.1.4 → ed_api_client-0.1.6}/ed_api_client/__init__.py +0 -0
- {ed_api_client-0.1.4 → ed_api_client-0.1.6}/ed_api_client/assignments.py +0 -0
- {ed_api_client-0.1.4 → ed_api_client-0.1.6}/ed_api_client/canvas.py +0 -0
- {ed_api_client-0.1.4 → ed_api_client-0.1.6}/ed_api_client/challenges.py +0 -0
- {ed_api_client-0.1.4 → ed_api_client-0.1.6}/ed_api_client/client.py +0 -0
- {ed_api_client-0.1.4 → ed_api_client-0.1.6}/ed_api_client/quizzes.py +0 -0
- {ed_api_client-0.1.4 → ed_api_client-0.1.6}/ed_api_client/slides.py +0 -0
- {ed_api_client-0.1.4 → ed_api_client-0.1.6}/ed_api_client/threads.py +0 -0
- {ed_api_client-0.1.4 → ed_api_client-0.1.6}/ed_api_client/users.py +0 -0
- {ed_api_client-0.1.4 → ed_api_client-0.1.6}/ed_api_client/websockets.py +0 -0
|
@@ -8,29 +8,29 @@ import re
|
|
|
8
8
|
|
|
9
9
|
from ed_api_client.websockets import File
|
|
10
10
|
|
|
11
|
-
class
|
|
11
|
+
class Selections(List[str]):
|
|
12
12
|
def __init__(self):
|
|
13
|
-
|
|
13
|
+
super().__init__()
|
|
14
14
|
|
|
15
15
|
def add(self, s: str):
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
stripped_s = s.strip()
|
|
18
|
+
|
|
19
|
+
if self.is_subsumed(stripped_s):
|
|
18
20
|
return
|
|
19
21
|
|
|
20
|
-
for candidate in list(self
|
|
21
|
-
if candidate in
|
|
22
|
-
self.
|
|
23
|
-
|
|
24
|
-
self.
|
|
22
|
+
for candidate in list(self):
|
|
23
|
+
if candidate in stripped_s:
|
|
24
|
+
self.remove(candidate)
|
|
25
|
+
|
|
26
|
+
self.add(stripped_s)
|
|
25
27
|
|
|
26
28
|
def contains(self, s: str) -> bool:
|
|
27
|
-
return s.strip() in self.strings
|
|
28
|
-
|
|
29
|
-
def is_subsumed(self, s: str) -> bool:
|
|
30
29
|
stripped_s = s.strip()
|
|
31
30
|
for candidate in self.strings:
|
|
32
|
-
if
|
|
31
|
+
if stripped_s in candidate :
|
|
33
32
|
return True
|
|
33
|
+
|
|
34
34
|
return False
|
|
35
35
|
|
|
36
36
|
|
|
@@ -449,7 +449,7 @@ class FileSummary(File):
|
|
|
449
449
|
typing_time: datetime.timedelta = datetime.timedelta(0)
|
|
450
450
|
prev_typing_time: datetime.datetime = None
|
|
451
451
|
|
|
452
|
-
selections:
|
|
452
|
+
selections: Selections = field(default_factory=list)
|
|
453
453
|
external_pastes: List[str] = field(default_factory=list)
|
|
454
454
|
|
|
455
455
|
pasted_proportion: float = 0
|
|
@@ -516,8 +516,7 @@ class WorkspaceSummary:
|
|
|
516
516
|
total_typing_time: datetime.timedelta
|
|
517
517
|
|
|
518
518
|
file_summaries: Dict[int, FileSummary]
|
|
519
|
-
|
|
520
|
-
|
|
519
|
+
|
|
521
520
|
def from_log(
|
|
522
521
|
files: List[File],
|
|
523
522
|
log: WorkspaceLog,
|
|
@@ -565,7 +564,7 @@ class WorkspaceSummary:
|
|
|
565
564
|
for file in files:
|
|
566
565
|
file_summaries[file.id] = FileSummary.from_file(file)
|
|
567
566
|
|
|
568
|
-
selected_content =
|
|
567
|
+
selected_content = Selections()
|
|
569
568
|
|
|
570
569
|
for selection in acceptable_selections:
|
|
571
570
|
selected_content.add(selection)
|
|
@@ -587,7 +586,7 @@ class WorkspaceSummary:
|
|
|
587
586
|
selected_content.add(sel_text.strip())
|
|
588
587
|
sel_file = file_summaries.get(sel_file_id)
|
|
589
588
|
if sel_file is not None:
|
|
590
|
-
sel_file.selections.
|
|
589
|
+
sel_file.selections.add(sel_text.strip())
|
|
591
590
|
if '\n' in sel_text:
|
|
592
591
|
sel_file.multiline_selection_count += 1
|
|
593
592
|
|
|
@@ -691,7 +690,7 @@ class WorkspaceSummary:
|
|
|
691
690
|
)
|
|
692
691
|
|
|
693
692
|
if len(edit.value) > min_suspicious_paste_chars:
|
|
694
|
-
if not selected_content.
|
|
693
|
+
if not selected_content.contains(edit.value):
|
|
695
694
|
file.external_pastes.append(edit.value)
|
|
696
695
|
|
|
697
696
|
file._insert_positions.append(pos / max(len(file.content), 1))
|
|
@@ -714,10 +713,10 @@ class WorkspaceSummary:
|
|
|
714
713
|
if pending_selection is not None:
|
|
715
714
|
sel_text, sel_file_id = pending_selection[2], pending_selection[3]
|
|
716
715
|
selected_content.add(sel_text.strip())
|
|
717
|
-
|
|
718
|
-
if
|
|
719
|
-
sel_file
|
|
720
|
-
if
|
|
716
|
+
sel_file = file_summaries.get(sel_file_id)
|
|
717
|
+
if sel_file is not None:
|
|
718
|
+
sel_file.selections.append(sel_text.strip())
|
|
719
|
+
if '\n' in sel_text:
|
|
721
720
|
sel_file.multiline_selection_count += 1
|
|
722
721
|
|
|
723
722
|
total_active_time = datetime.timedelta(0)
|
|
@@ -750,4 +749,4 @@ class WorkspaceSummary:
|
|
|
750
749
|
if file._pending_deletion and '\n' in file._pending_deletion:
|
|
751
750
|
file.multiline_deletion_count += 1
|
|
752
751
|
|
|
753
|
-
return WorkspaceSummary(total_active_time, total_typing_time, file_summaries
|
|
752
|
+
return WorkspaceSummary(total_active_time, total_typing_time, file_summaries)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|