Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitca463b4

Browse files
authored
Merge pull requestalexmojaki#167 from alexmojaki/remove-master.py
stuff
2 parents7310ddd +8566890 commitca463b4

File tree

4 files changed

+23
-138
lines changed

4 files changed

+23
-138
lines changed

‎core/chapters/c11_tic_tac_toe_project.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ def column_winner(board):
301301
Looping through all columns means looking at the first element of every row, then the second element of every row, etc.
302302
So you need to loop through numbers representing the positions first, second, etc.
303303
How do you find the number of columns in `board`?
304-
That covers the outer loop, which goes through each column. Then you need an inner loop to gothread each element in the column.
304+
That covers the outer loop, which goes through each column. Then you need an inner loop to gothrough each element in the column.
305305
The different entries of a column are NOT on the same row. So how can you access them?
306306
You can loop through rows of the board and find the element corresponding to that row and the current column.
307307
To access all the entries of, say, the 5th column, you can loop through all the rows, and access the 5th element in each row.

‎core/utils.py‎

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,15 @@
44
importos
55
importre
66
importsys
7-
importthreading
87
importtraceback
9-
fromfunctoolsimportlru_cache
108
fromioimportStringIO
119
fromitertoolsimportcombinations
1210
fromrandomimportshuffle
1311
fromtypesimportModuleType
1412
fromtypingimportUnion
1513

1614
importpygments
17-
fromlittleutilsimportstrip_required_prefix,strip_required_suffix,withattrs
15+
fromlittleutilsimportstrip_required_prefix,strip_required_suffix
1816
frompygments.formattersimportHtmlFormatter
1917
frompygments.lexersimportget_lexer_by_name
2018
frompygments.stylesimportget_style_by_name
@@ -47,13 +45,6 @@ def stub_module(name):
4745
))
4846

4947

50-
defassign(**attrs):
51-
defdecorator(f):
52-
returnwithattrs(f,**attrs)
53-
54-
returndecorator
55-
56-
5748
defno_weird_whitespace(string):
5849
spaces=set(re.findall(r"\s",string))
5950
assertspaces<= {" ","\n"},spaces
@@ -162,31 +153,6 @@ def format_exception_string():
162153
return''.join(traceback.format_exception_only(*sys.exc_info()[:2]))
163154

164155

165-
defrow_to_dict(row):
166-
d=row.__dict__.copy()
167-
deld["_sa_instance_state"]
168-
returnd
169-
170-
171-
defrows_to_dicts(rows):
172-
return [row_to_dict(row)forrowinrows]
173-
174-
175-
defthread_separate_lru_cache(*cache_args,**cache_kwargs):
176-
defdecorator(func):
177-
@lru_cache(*cache_args,**cache_kwargs)
178-
defcached(_thread_id,*args,**kwargs):
179-
returnfunc(*args,**kwargs)
180-
181-
@functools.wraps(func)
182-
defwrapper(*args,**kwargs):
183-
returncached(threading.get_ident(),*args,**kwargs)
184-
185-
returnwrapper
186-
187-
returndecorator
188-
189-
190156
defis_valid_syntax(text):
191157
try:
192158
ast.parse(text)

‎core/workers/master.py‎

Lines changed: 0 additions & 93 deletions
This file was deleted.

‎how_to_contribute.md‎

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ This page explains how to help build the futurecoder platform by writing code or
44

55
**If you'd like to donate money, please do so at[open collective](https://opencollective.com/futurecoder).**
66

7-
For starters, try using the platform to see what it's like.You can go straight tothe[site](https://futurecoder.io/) and quickly sign up for anaccount. See the[Controls](README.md#controls) section for instructions on enabling developer mode, this will allow you to skip or replay steps in a page to allow exploring more freely and quickly.
7+
For starters, try using the platform to see what it's like.Fromthe[table of contents](https://futurecoder.io/course/#toc) you can jump to any page and start immediately. Noaccount needed. If you want to try all the debuggers, pick a page close to the end of the course where everything is enabled. See the[Controls](README.md#controls) section for instructions on enabling developer mode, this will allow you to skip or replay steps in a page to allow exploring more freely and quickly.
88

99
Please[open an issue](https://github.com/alexmojaki/futurecoder/issues/new) about anything that's confusing, could be done better, or doesn't work. All suggestions and feedback are welcome. Tell me what interests you!
1010

1111
The easiest way to contribute concretely is to write learning material for the course and participate in related discussions. This doesn't require any expertise beyond knowing how Python works. See[Helping with course content](#helping-with-course-content) for more information.
1212

13-
Beyond that, there's plenty of coding work to do on the platform, including frontend, backend,anddevops work. See the[list of issues](https://github.com/alexmojaki/futurecoder/issues) for some ideas, or open a new one if you want. The main priority is to choose something that interests you. If nothing really does, pick something from the["good first issue" label](https://github.com/alexmojaki/futurecoder/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) - these are easier and will help you become familiar with the project.
13+
Beyond that, there's plenty of coding work to do on the platform in PythonandJavaScript. See the[list of issues](https://github.com/alexmojaki/futurecoder/issues) for some ideas, or open a new one if you want. The main priority is to choose something that interests you. If nothing really does, pick something from the["good first issue" label](https://github.com/alexmojaki/futurecoder/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) - these are easier and will help you become familiar with the project.
1414

1515
Consider adding your thoughts and ideas to[issues labeled 'discussion'](https://github.com/alexmojaki/futurecoder/issues?q=is%3Aissue+is%3Aopen+label%3Adiscussion). Or[come have a chat about anything on slack](https://join.slack.com/t/futurecoder/shared_invite/zt-tp8cmwra-CbdEeX9u3k1VyoMLDupAeQ).
1616

@@ -26,20 +26,32 @@ This test runs through the course, submitting the solution/program for each step
2626

2727
If you make some changes to the course, the tests will likely fail the comparison to`test_transcript.json`. Run the test again with the environment variable`FIX_TESTS=1` to update the file. Then check that the git diff looks sensible.
2828

29-
<!--
30-
TODO update
3129
##System overview
3230

33-
The course UI is written in React. It communicates with the web server using the `rpc` function, e.g. `rpc("run_code", {entry}, onSuccess)`. This eventually reaches a method in the `API` class, e.g. `def run_code(self, entry):`.
34-
35-
After the code finishes running, it checks the `Page` and `Step` that the user is currently on, and calls the `Step.check` method. In most cases this is a `VerbatimStep` - the user is supposed to enter exactly the code in the text, using the AST to check for equality. Next most common is an `ExerciseStep` where a function has to pass tests and produce the same output as a given solution. The result of `Step.check` determines if the user succeeded and advances to the next step. It may also return a message to show the user, e.g. if they made a common mistake.
36-
-->
31+
-**Python runs in the browser with[Pyodide](https://pyodide.org/)**. There are no backend servers.
32+
- This runs in a web worker (`Worker.js`) in the background so it doesn't interfere with the UI.
33+
-`SharedArrayBuffer` is used for some features (`input()` and`KeyboardInterrupt`) which comes with certain restrictions, including not working on Safari.
34+
- The entire`core` folder as well as several libraries are packaged into a single archive which the worker downloads (`load.py`) and extracts into Pyodide's virtual filesystem.
35+
- The script`core/generate_static_files.py` creates the above archive and some other files and puts them under`frontend/src` to be packaged by React.
36+
- When a user runs code,`Worker.js` calls the Python function`check_entry_catch_internal_errors` in`worker.py`.
37+
- After the code finishes running, it checks the`Page` and`Step` that the user is currently on, and calls the`Step.check` method.
38+
- In most cases this is a`VerbatimStep` - the user is supposed to enter exactly the code in the text, using the AST to check for equality.
39+
- Next most common is an`ExerciseStep` where a function has to pass tests and produce the same output as a given solution.
40+
- The result of`Step.check` determines if the user succeeded and advances to the next step. It may also return a message to show the user, e.g. if they made a common mistake.
41+
-**React JS** provides the course UI.
42+
- It's mostly just a standard Create-React-App, very slightly customised by craco.
43+
- The UI communicates with the web worker using Comlink (`RunCode.js`).
44+
- State is managed by Redux (`store.js`) with some custom utilities (`frontendlib`).
45+
-**Firebase** handles:
46+
- Authentication: signup, login, and anonymous accounts
47+
- Realtime Database stores user data: progress on each page and last page visited
48+
- Hosting for the main site, although since it's just static files so it can be hosted anywhere quite easily.
3749

3850
##Helping with course content
3951

4052
Take a look at[the issues labeled "course material"](https://github.com/alexmojaki/futurecoder/issues?q=is%3Aissue+is%3Aopen+label%3A%22course+material%22). These include discussions that need opinions/ideas and small tweaks that need to be made to existing content.
4153

42-
If you want to write fresh content, see[this issue](https://github.com/alexmojaki/futurecoder/issues/92) for the central discussion.
54+
If you want to write fresh content, see[this issue](https://github.com/alexmojaki/futurecoder/issues/165) for the central discussion.
4355

4456
Before writing anything, it's a good idea to go through some of the course to get a feel for the style. Reading all the hints on a few exercises would also help. See the[developer mode instructions](https://github.com/alexmojaki/futurecoder#controls) to quickly move back and forth between steps.
4557

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp