-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.log
More file actions
189 lines (154 loc) · 4.47 KB
/
Copy pathserver.log
File metadata and controls
189 lines (154 loc) · 4.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
[1m[34mPreparing to preview[39m[22m
[1m[34m[1/8] ja/book/99-self-review-1.qmd[39m[22m
Starting python3 kernel...Done
Executing '99-self-review-1.quarto_ipynb'
Cell 1/4: ''...Done
Cell 2/4: ''...Done
Cell 3/4: ''...Done
Cell 4/4: ''...Done
[1m[34m[2/8] ja/book/03-syntax.qmd[39m[22m
Starting python3 kernel...Done
Executing '03-syntax.quarto_ipynb'
Cell 1/19: ''..............Done
Cell 2/19: 'test-upload'...Done
Cell 3/19: ''..............Done
Cell 4/19: ''..............Done
Cell 5/19: ''..............Done
Cell 6/19: ''..............Done
Cell 7/19: ''..............Done
Cell 8/19: ''..............Done
Cell 9/19: ''..............Done
Cell 10/19: ''..............Done
Cell 11/19: ''..............Done
Cell 12/19: ''..............Done
Cell 13/19: ''..............Done
Cell 14/19: ''..............Done
Cell 15/19: ''..............Done
Cell 16/19: ''..............Done
Cell 17/19: ''..............Done
Cell 18/19: ''..............Done
Cell 19/19: ''..............Done
[1m[34m[3/8] ja/book/05-control-flow.qmd[39m[22m
Starting python3 kernel...Done
Executing '05-control-flow.quarto_ipynb'
Cell 1/14: ''...Done
Cell 2/14: ''...Done
Cell 3/14: ''...Done
Cell 4/14: ''...Done
Cell 5/14: ''...Done
Cell 6/14: ''...Done
Cell 7/14: ''...Done
Cell 8/14: ''...Done
Cell 9/14: ''...Done
Cell 10/14: ''...Done
Cell 11/14: ''...Done
Cell 12/14: ''...Done
Cell 13/14: ''...Done
Cell 14/14: ''...Done
[1m[34m[4/8] ja/book/06-functions.qmd[39m[22m
[1m[34m[5/8] ja/book/09-classes.qmd[39m[22m
[1m[34m[6/8] ja/book/07-error-handling.qmd[39m[22m
[1m[34m[7/8] ja/book/08-modules.qmd[39m[22m
[1m[34m[8/8] en/book/13-applications.qmd[39m[22m
Starting python3 kernel...Done
Executing '13-applications.quarto_ipynb'
Cell 1/7: ''...Done
Cell 2/7: ''...Done
Cell 3/7: ''...Done
Cell 4/7: ''...Done
Cell 5/7: ''...Done
Cell 6/7: ''...
An error occurred while executing the following cell:
------------------
import os
from pathlib import Path
from datetime import datetime
from typing import Dict
class ProjectGenerator:
"""Generate project templates for different types of Python projects."""
def __init__(self):
self.templates = {
'web': self._create_web_project,
'cli': self._create_cli_project,
'data': self._create_data_project,
'api': self._create_api_project
}
def _create_web_project(self, name: str, path: Path) -> Dict[str, str]:
"""Create a Flask web application template."""
files = {
'app.py': '''from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def home():
return render_template('index.html')
if __name__ == '__main__':
app.run(debug=True)
''',
'requirements.txt': '''Flask==2.3.3
python-dotenv==1.0.0
''',
'templates/index.html': '''<!DOCTYPE html>
<html>
<head>
<title>{{ project_name }}</title>
</head>
<body>
<h1>Welcome to {{ project_name }}</h1>
</body>
</html>
''',
'.env': '''FLASK_APP=app.py
FLASK_ENV=development
''',
'README.md': f'''# {name}
A Flask web application.
## Setup
1. Install dependencies: `pip install -r requirements.txt`
2. Run the application: `python app.py`
3. Open http://localhost:5000
Created on {datetime.now().strftime("%Y-%m-%d")}
'''
}
return files
def _create_cli_project(self, name: str, path: Path) -> Dict[str, str]:
"""Create a command-line application template."""
files = {
'main.py': '''#!/usr/bin/env python3
"""
Command-line application template.
"""
import argparse
import sys
def main():
parser = argparse.ArgumentParser(description='Command line tool')
parser.add_argument('--version', action='version', version='1.0.0')
parser.add_argument('--verbose', '-v', action='store_true',
help='Enable verbose output')
args = parser.parse_args()
if args.verbose:
print("Verbose mode enabled")
print("Hello from the command line!")
if __name__ == '__main__':
main()
''',
'requirements.txt': '''click==8.1.7
''',
'README.md': f'''# {name}
A command-line application.
## Usage
```bash
python main.py --help
python main.py --verbose
------------------
[36mCell[39m[36m [39m[32mIn[6][39m[32m, line 90[39m
[31m [39m[31m'README.md': f'''# {name}[39m
^
[31mSyntaxError[39m[31m:[39m incomplete input