dooma 0.1.0__py3-none-any.whl
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.
- dooma/__init__.py +5 -0
- dooma/cli/__init__.py +3 -0
- dooma/cli/main.py +182 -0
- dooma/dataset/companies.json +126843 -0
- dooma-0.1.0.dist-info/METADATA +86 -0
- dooma-0.1.0.dist-info/RECORD +10 -0
- dooma-0.1.0.dist-info/WHEEL +5 -0
- dooma-0.1.0.dist-info/entry_points.txt +2 -0
- dooma-0.1.0.dist-info/licenses/LICENSE +21 -0
- dooma-0.1.0.dist-info/top_level.txt +1 -0
dooma/__init__.py
ADDED
dooma/cli/__init__.py
ADDED
dooma/cli/main.py
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import json
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
import typer
|
|
5
|
+
from rich.console import Console
|
|
6
|
+
from rich.table import Table
|
|
7
|
+
from rich.prompt import Prompt
|
|
8
|
+
from rich.panel import Panel
|
|
9
|
+
from rich.columns import Columns
|
|
10
|
+
|
|
11
|
+
app = typer.Typer(add_completion=False)
|
|
12
|
+
console = Console()
|
|
13
|
+
|
|
14
|
+
def load_data():
|
|
15
|
+
dataset_path = Path(__file__).parent.parent / "dataset" / "companies.json"
|
|
16
|
+
if not dataset_path.exists():
|
|
17
|
+
console.print(f"[red]Dataset not found at {dataset_path}![/red]")
|
|
18
|
+
raise typer.Exit(1)
|
|
19
|
+
with open(dataset_path, "r", encoding="utf-8") as f:
|
|
20
|
+
return json.load(f)
|
|
21
|
+
|
|
22
|
+
@app.callback(invoke_without_command=True)
|
|
23
|
+
def interactive_loop(ctx: typer.Context):
|
|
24
|
+
if ctx.invoked_subcommand is not None:
|
|
25
|
+
return
|
|
26
|
+
|
|
27
|
+
data = load_data()
|
|
28
|
+
companies = sorted(list(data.keys()))
|
|
29
|
+
|
|
30
|
+
# Group companies by first letter
|
|
31
|
+
groups = {}
|
|
32
|
+
for company in companies:
|
|
33
|
+
first_char = company[0].upper()
|
|
34
|
+
if not first_char.isalpha():
|
|
35
|
+
first_char = '#'
|
|
36
|
+
|
|
37
|
+
if first_char not in groups:
|
|
38
|
+
groups[first_char] = []
|
|
39
|
+
groups[first_char].append(company)
|
|
40
|
+
|
|
41
|
+
sorted_letters = sorted(list(groups.keys()))
|
|
42
|
+
|
|
43
|
+
while True:
|
|
44
|
+
console.clear()
|
|
45
|
+
console.print(Panel("[bold cyan]Welcome to Dooma - Your Ultimate DSA Preparation Companion[/bold cyan]"))
|
|
46
|
+
console.print("[bold magenta]--- Step 1: Select the First Letter of the Company You Want to Prepare For ---[/bold magenta]\n")
|
|
47
|
+
|
|
48
|
+
# Display letters nicely
|
|
49
|
+
letter_display = []
|
|
50
|
+
for letter in sorted_letters:
|
|
51
|
+
count = len(groups[letter])
|
|
52
|
+
letter_display.append(f"[bold yellow]{letter}[/bold yellow] [dim]({count})[/dim]")
|
|
53
|
+
|
|
54
|
+
console.print(Columns(letter_display, expand=True, equal=True))
|
|
55
|
+
|
|
56
|
+
console.print("\n[dim]Options:[/dim]")
|
|
57
|
+
console.print("[dim]- Type a letter to explore companies (e.g., 'A', 'G', '#')[/dim]")
|
|
58
|
+
console.print("[dim]- Enter '0' to safely exit the application[/dim]")
|
|
59
|
+
|
|
60
|
+
choice = Prompt.ask("\nYour choice", default="")
|
|
61
|
+
choice = choice.upper().strip()
|
|
62
|
+
|
|
63
|
+
if choice == "0":
|
|
64
|
+
console.print("[green]Goodbye![/green]")
|
|
65
|
+
raise typer.Exit()
|
|
66
|
+
elif choice in groups:
|
|
67
|
+
show_company_list(choice, groups[choice], data)
|
|
68
|
+
else:
|
|
69
|
+
console.print("[red]Invalid letter. Please select a letter from the list above.[/red]")
|
|
70
|
+
Prompt.ask("[dim]Press Enter to continue...[/dim]")
|
|
71
|
+
|
|
72
|
+
def show_company_list(letter, group_companies, data):
|
|
73
|
+
page = 0
|
|
74
|
+
items_per_page = 30
|
|
75
|
+
|
|
76
|
+
while True:
|
|
77
|
+
console.clear()
|
|
78
|
+
console.print(Panel(f"[bold cyan]Step 2: Choose Your Target Company (Starting with '{letter}')[/bold cyan]"))
|
|
79
|
+
console.print(f"[bold magenta]--- Page {page + 1} ---[/bold magenta]\n")
|
|
80
|
+
|
|
81
|
+
start_idx = page * items_per_page
|
|
82
|
+
end_idx = min(start_idx + items_per_page, len(group_companies))
|
|
83
|
+
|
|
84
|
+
for i in range(start_idx, end_idx):
|
|
85
|
+
console.print(f" [bold yellow]{i + 1}.[/bold yellow] {group_companies[i]}")
|
|
86
|
+
|
|
87
|
+
console.print("\n[dim]Options:[/dim]")
|
|
88
|
+
console.print("[dim]- Type the number next to the company name to view its questions[/dim]")
|
|
89
|
+
if end_idx < len(group_companies):
|
|
90
|
+
console.print("[dim]- Enter 'n' for the next page[/dim]")
|
|
91
|
+
if page > 0:
|
|
92
|
+
console.print("[dim]- Enter 'p' for the previous page[/dim]")
|
|
93
|
+
console.print("[dim]- Enter '0' to go one step back to the alphabet menu[/dim]")
|
|
94
|
+
|
|
95
|
+
choice = Prompt.ask("\nYour choice", default="")
|
|
96
|
+
choice = choice.strip()
|
|
97
|
+
|
|
98
|
+
if choice == "0":
|
|
99
|
+
return
|
|
100
|
+
elif choice.lower() == 'n' and end_idx < len(group_companies):
|
|
101
|
+
page += 1
|
|
102
|
+
elif choice.lower() == 'p' and page > 0:
|
|
103
|
+
page -= 1
|
|
104
|
+
elif choice.isdigit():
|
|
105
|
+
idx = int(choice) - 1
|
|
106
|
+
if 0 <= idx < len(group_companies):
|
|
107
|
+
company_name = group_companies[idx]
|
|
108
|
+
show_company_questions(company_name, data[company_name])
|
|
109
|
+
else:
|
|
110
|
+
console.print("[red]Invalid selection.[/red]")
|
|
111
|
+
Prompt.ask("[dim]Press Enter to continue...[/dim]")
|
|
112
|
+
else:
|
|
113
|
+
console.print("[red]Invalid input.[/red]")
|
|
114
|
+
Prompt.ask("[dim]Press Enter to continue...[/dim]")
|
|
115
|
+
|
|
116
|
+
def show_company_questions(company_name, questions):
|
|
117
|
+
page = 0
|
|
118
|
+
items_per_page = 15
|
|
119
|
+
|
|
120
|
+
while True:
|
|
121
|
+
console.clear()
|
|
122
|
+
table = Table(
|
|
123
|
+
title=f"Step 3: Interview Questions for [bold cyan]{company_name}[/bold cyan] (Page {page + 1})",
|
|
124
|
+
show_header=True,
|
|
125
|
+
header_style="bold magenta",
|
|
126
|
+
expand=True
|
|
127
|
+
)
|
|
128
|
+
table.add_column("No.", justify="right", style="cyan", no_wrap=True)
|
|
129
|
+
table.add_column("Title", style="white")
|
|
130
|
+
table.add_column("Difficulty", style="white")
|
|
131
|
+
table.add_column("Frequency", style="yellow")
|
|
132
|
+
table.add_column("URL", style="blue")
|
|
133
|
+
|
|
134
|
+
start_idx = page * items_per_page
|
|
135
|
+
end_idx = min(start_idx + items_per_page, len(questions))
|
|
136
|
+
|
|
137
|
+
for i in range(start_idx, end_idx):
|
|
138
|
+
q = questions[i]
|
|
139
|
+
diff = q.get("difficulty", "N/A")
|
|
140
|
+
if diff == "Easy":
|
|
141
|
+
diff_color = "green"
|
|
142
|
+
elif diff == "Medium":
|
|
143
|
+
diff_color = "yellow"
|
|
144
|
+
elif diff == "Hard":
|
|
145
|
+
diff_color = "red"
|
|
146
|
+
else:
|
|
147
|
+
diff_color = "white"
|
|
148
|
+
|
|
149
|
+
diff_formatted = f"[{diff_color}]{diff}[/{diff_color}]"
|
|
150
|
+
|
|
151
|
+
table.add_row(
|
|
152
|
+
str(i + 1),
|
|
153
|
+
q.get("title", "N/A"),
|
|
154
|
+
diff_formatted,
|
|
155
|
+
q.get("frequency", "N/A"),
|
|
156
|
+
q.get("url", "N/A")
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
console.print(table)
|
|
160
|
+
|
|
161
|
+
console.print("\n[dim]Options:[/dim]")
|
|
162
|
+
if end_idx < len(questions):
|
|
163
|
+
console.print("[dim]- Enter 'n' for the next page of questions[/dim]")
|
|
164
|
+
if page > 0:
|
|
165
|
+
console.print("[dim]- Enter 'p' for the previous page of questions[/dim]")
|
|
166
|
+
console.print("[dim]- Enter '0' to go one step back to the company list[/dim]")
|
|
167
|
+
|
|
168
|
+
choice = Prompt.ask("\nYour choice", default="")
|
|
169
|
+
choice = choice.strip()
|
|
170
|
+
|
|
171
|
+
if choice == "0":
|
|
172
|
+
return # Go back to company list
|
|
173
|
+
elif choice.lower() == 'n' and end_idx < len(questions):
|
|
174
|
+
page += 1
|
|
175
|
+
elif choice.lower() == 'p' and page > 0:
|
|
176
|
+
page -= 1
|
|
177
|
+
else:
|
|
178
|
+
console.print("[red]Invalid input.[/red]")
|
|
179
|
+
Prompt.ask("[dim]Press Enter to continue...[/dim]")
|
|
180
|
+
|
|
181
|
+
if __name__ == "__main__":
|
|
182
|
+
app()
|