fpythons 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.
Files changed (170) hide show
  1. fpythons/__init__.py +12 -0
  2. fpythons/__main__.py +4 -0
  3. fpythons/data/00_START_HERE.md +144 -0
  4. fpythons/data/ALL_SLIPS_CODE.txt +1854 -0
  5. fpythons/data/README.md +35 -0
  6. fpythons/data/Slip_01.md +160 -0
  7. fpythons/data/Slip_02.md +104 -0
  8. fpythons/data/Slip_03.md +95 -0
  9. fpythons/data/Slip_04.md +131 -0
  10. fpythons/data/Slip_05.md +120 -0
  11. fpythons/data/Slip_06.md +161 -0
  12. fpythons/data/Slip_07.md +121 -0
  13. fpythons/data/Slip_08.md +95 -0
  14. fpythons/data/Slip_09.md +92 -0
  15. fpythons/data/Slip_10.md +113 -0
  16. fpythons/data/Slip_11.md +109 -0
  17. fpythons/data/Slip_12.md +181 -0
  18. fpythons/data/Slip_13.md +163 -0
  19. fpythons/data/Slip_14.md +141 -0
  20. fpythons/data/Slip_15.md +100 -0
  21. fpythons/data/Slip_16.md +127 -0
  22. fpythons/data/Slip_17.md +93 -0
  23. fpythons/data/Slip_18.md +96 -0
  24. fpythons/data/Slip_19.md +94 -0
  25. fpythons/data/Slip_20.md +165 -0
  26. fpythons/data/Slip_21.md +122 -0
  27. fpythons/data/VIVA.md +195 -0
  28. fpythons/data/code/slip1/.gitignore +2 -0
  29. fpythons/data/code/slip1/package.json +31 -0
  30. fpythons/data/code/slip1/public/index.html +12 -0
  31. fpythons/data/code/slip1/src/App.js +7 -0
  32. fpythons/data/code/slip1/src/index.js +10 -0
  33. fpythons/data/code/slip1/src/slip1/loginForm.js +26 -0
  34. fpythons/data/code/slip1/src/slip1/style.css +46 -0
  35. fpythons/data/code/slip10/.gitignore +2 -0
  36. fpythons/data/code/slip10/package.json +31 -0
  37. fpythons/data/code/slip10/public/index.html +12 -0
  38. fpythons/data/code/slip10/src/App.js +7 -0
  39. fpythons/data/code/slip10/src/index.js +10 -0
  40. fpythons/data/code/slip10/src/slip10/SumOfDigits.js +37 -0
  41. fpythons/data/code/slip11/.gitignore +2 -0
  42. fpythons/data/code/slip11/package.json +31 -0
  43. fpythons/data/code/slip11/public/index.html +12 -0
  44. fpythons/data/code/slip11/src/App.js +7 -0
  45. fpythons/data/code/slip11/src/index.js +10 -0
  46. fpythons/data/code/slip11/src/slip11/StringOperation.js +33 -0
  47. fpythons/data/code/slip12/.gitignore +2 -0
  48. fpythons/data/code/slip12/package.json +33 -0
  49. fpythons/data/code/slip12/public/index.html +12 -0
  50. fpythons/data/code/slip12/src/App.js +7 -0
  51. fpythons/data/code/slip12/src/index.js +14 -0
  52. fpythons/data/code/slip12/src/slip12/NotesManagementApp.js +35 -0
  53. fpythons/data/code/slip12/src/slip12/redux/notesSlice.js +20 -0
  54. fpythons/data/code/slip12/src/slip12/redux/store.js +10 -0
  55. fpythons/data/code/slip13/.gitignore +2 -0
  56. fpythons/data/code/slip13/package.json +33 -0
  57. fpythons/data/code/slip13/public/index.html +12 -0
  58. fpythons/data/code/slip13/src/App.js +7 -0
  59. fpythons/data/code/slip13/src/index.js +14 -0
  60. fpythons/data/code/slip13/src/slip13/Counter.js +20 -0
  61. fpythons/data/code/slip13/src/slip13/redux/counterSlice.js +19 -0
  62. fpythons/data/code/slip13/src/slip13/redux/store.js +10 -0
  63. fpythons/data/code/slip14/.gitignore +2 -0
  64. fpythons/data/code/slip14/package.json +31 -0
  65. fpythons/data/code/slip14/public/index.html +12 -0
  66. fpythons/data/code/slip14/src/App.js +7 -0
  67. fpythons/data/code/slip14/src/index.js +10 -0
  68. fpythons/data/code/slip14/src/slip14/Calculator.js +64 -0
  69. fpythons/data/code/slip15/.gitignore +2 -0
  70. fpythons/data/code/slip15/package.json +31 -0
  71. fpythons/data/code/slip15/public/index.html +12 -0
  72. fpythons/data/code/slip15/src/App.js +7 -0
  73. fpythons/data/code/slip15/src/index.js +10 -0
  74. fpythons/data/code/slip15/src/slip15/Counter.js +24 -0
  75. fpythons/data/code/slip16/.gitignore +2 -0
  76. fpythons/data/code/slip16/package.json +31 -0
  77. fpythons/data/code/slip16/public/index.html +12 -0
  78. fpythons/data/code/slip16/src/App.js +7 -0
  79. fpythons/data/code/slip16/src/index.js +10 -0
  80. fpythons/data/code/slip16/src/slip16/TraditionalDOM.html +24 -0
  81. fpythons/data/code/slip16/src/slip16/VirtualDOM.js +16 -0
  82. fpythons/data/code/slip17/.gitignore +2 -0
  83. fpythons/data/code/slip17/package.json +31 -0
  84. fpythons/data/code/slip17/public/index.html +12 -0
  85. fpythons/data/code/slip17/src/App.js +7 -0
  86. fpythons/data/code/slip17/src/index.js +10 -0
  87. fpythons/data/code/slip17/src/slip17/Sign-in.js +17 -0
  88. fpythons/data/code/slip18/.gitignore +2 -0
  89. fpythons/data/code/slip18/package.json +31 -0
  90. fpythons/data/code/slip18/public/index.html +12 -0
  91. fpythons/data/code/slip18/public/logo192.png +0 -0
  92. fpythons/data/code/slip18/src/App.js +7 -0
  93. fpythons/data/code/slip18/src/index.js +10 -0
  94. fpythons/data/code/slip18/src/slip18/Profile.js +20 -0
  95. fpythons/data/code/slip19/.gitignore +2 -0
  96. fpythons/data/code/slip19/package.json +31 -0
  97. fpythons/data/code/slip19/public/index.html +12 -0
  98. fpythons/data/code/slip19/src/App.js +7 -0
  99. fpythons/data/code/slip19/src/index.js +10 -0
  100. fpythons/data/code/slip19/src/slip19/Movies.js +19 -0
  101. fpythons/data/code/slip2/.gitignore +2 -0
  102. fpythons/data/code/slip2/package.json +31 -0
  103. fpythons/data/code/slip2/public/index.html +12 -0
  104. fpythons/data/code/slip2/src/App.js +7 -0
  105. fpythons/data/code/slip2/src/index.js +10 -0
  106. fpythons/data/code/slip2/src/slip2/useEffect.js +23 -0
  107. fpythons/data/code/slip20/.gitignore +2 -0
  108. fpythons/data/code/slip20/package.json +32 -0
  109. fpythons/data/code/slip20/public/index.html +12 -0
  110. fpythons/data/code/slip20/src/App.js +16 -0
  111. fpythons/data/code/slip20/src/index.js +10 -0
  112. fpythons/data/code/slip20/src/slip20/Login.js +45 -0
  113. fpythons/data/code/slip20/src/slip20/Students.js +27 -0
  114. fpythons/data/code/slip21/.gitignore +2 -0
  115. fpythons/data/code/slip21/package.json +31 -0
  116. fpythons/data/code/slip21/public/index.html +12 -0
  117. fpythons/data/code/slip21/src/App.js +7 -0
  118. fpythons/data/code/slip21/src/index.js +10 -0
  119. fpythons/data/code/slip21/src/slip21/NumberString.js +46 -0
  120. fpythons/data/code/slip3/.gitignore +2 -0
  121. fpythons/data/code/slip3/package.json +31 -0
  122. fpythons/data/code/slip3/public/index.html +12 -0
  123. fpythons/data/code/slip3/src/App.js +7 -0
  124. fpythons/data/code/slip3/src/index.js +10 -0
  125. fpythons/data/code/slip3/src/slip3/toggleBtn.js +16 -0
  126. fpythons/data/code/slip4/.gitignore +2 -0
  127. fpythons/data/code/slip4/package.json +32 -0
  128. fpythons/data/code/slip4/public/index.html +12 -0
  129. fpythons/data/code/slip4/src/App.js +23 -0
  130. fpythons/data/code/slip4/src/index.js +10 -0
  131. fpythons/data/code/slip4/src/slip4/About.js +7 -0
  132. fpythons/data/code/slip4/src/slip4/Contact.js +7 -0
  133. fpythons/data/code/slip4/src/slip4/home.js +7 -0
  134. fpythons/data/code/slip5/.gitignore +2 -0
  135. fpythons/data/code/slip5/package.json +32 -0
  136. fpythons/data/code/slip5/public/index.html +12 -0
  137. fpythons/data/code/slip5/src/App.js +18 -0
  138. fpythons/data/code/slip5/src/index.js +10 -0
  139. fpythons/data/code/slip5/src/slip5/loginValidation.js +30 -0
  140. fpythons/data/code/slip6/.gitignore +2 -0
  141. fpythons/data/code/slip6/package.json +32 -0
  142. fpythons/data/code/slip6/public/index.html +12 -0
  143. fpythons/data/code/slip6/src/App.js +31 -0
  144. fpythons/data/code/slip6/src/index.js +10 -0
  145. fpythons/data/code/slip6/src/slip6/Dashboard.js +12 -0
  146. fpythons/data/code/slip6/src/slip6/Login.js +23 -0
  147. fpythons/data/code/slip6/src/slip6/ProtectedRoute.js +10 -0
  148. fpythons/data/code/slip7/.gitignore +2 -0
  149. fpythons/data/code/slip7/package.json +31 -0
  150. fpythons/data/code/slip7/public/index.html +12 -0
  151. fpythons/data/code/slip7/src/App.js +7 -0
  152. fpythons/data/code/slip7/src/index.js +10 -0
  153. fpythons/data/code/slip7/src/slip7/TodoList.js +42 -0
  154. fpythons/data/code/slip8/.gitignore +2 -0
  155. fpythons/data/code/slip8/package.json +31 -0
  156. fpythons/data/code/slip8/public/index.html +12 -0
  157. fpythons/data/code/slip8/src/App.js +7 -0
  158. fpythons/data/code/slip8/src/index.js +10 -0
  159. fpythons/data/code/slip8/src/slip8/ToggleButton.js +19 -0
  160. fpythons/data/code/slip9/.gitignore +2 -0
  161. fpythons/data/code/slip9/package.json +31 -0
  162. fpythons/data/code/slip9/public/index.html +12 -0
  163. fpythons/data/code/slip9/src/App.js +7 -0
  164. fpythons/data/code/slip9/src/index.js +10 -0
  165. fpythons/data/code/slip9/src/slip9/Counter.js +16 -0
  166. fpythons/main.py +226 -0
  167. fpythons-0.1.0.dist-info/METADATA +64 -0
  168. fpythons-0.1.0.dist-info/RECORD +170 -0
  169. fpythons-0.1.0.dist-info/WHEEL +4 -0
  170. fpythons-0.1.0.dist-info/entry_points.txt +2 -0
fpythons/__init__.py ADDED
@@ -0,0 +1,12 @@
1
+ """React (FSD) practical slips: code, guides and solved projects.
2
+
3
+ import fpythons
4
+ fpythons.list_slips()
5
+ print(fpythons.get_code(1))
6
+ print(fpythons.get_guide(1))
7
+ fpythons.export_slip(1, "my_folder")
8
+ """
9
+ from .main import export_slip, get_code, get_guide, list_slips
10
+
11
+ __version__ = "0.1.0"
12
+ __all__ = ["list_slips", "get_code", "get_guide", "export_slip", "__version__"]
fpythons/__main__.py ADDED
@@ -0,0 +1,4 @@
1
+ """Allows: python -m fpythons"""
2
+ from .main import main
3
+
4
+ main()
@@ -0,0 +1,144 @@
1
+ # Start here: how to write React code
2
+
3
+ [All slips](README.md) | [Viva](VIVA.md)
4
+
5
+ ## 1. Set up your computer (do once)
6
+
7
+ Install Node.js (LTS), then check:
8
+
9
+ ```powershell
10
+ node --version
11
+ npm --version
12
+ ```
13
+
14
+ ## 2. Create a project
15
+
16
+ ```powershell
17
+ npx create-react-app slip1
18
+ cd slip1
19
+ npm start
20
+ ```
21
+
22
+ The app opens at http://localhost:3000/. Stop it with **Ctrl+C**.
23
+
24
+ - `create-react-app` is deprecated by the React team. The solved projects here use it, with `react-scripts` 5.
25
+ - Creating a project and installing packages need internet. Ask your college whether the exam lab has it.
26
+
27
+ ## 3. What each file is
28
+
29
+ ```text
30
+ slip1/
31
+ package.json packages and scripts
32
+ public/index.html the only HTML page (has <div id="root">)
33
+ src/index.js starts React, shows <App />
34
+ src/App.js main component (edit)
35
+ src/slip1/ YOU CREATE THIS: your components
36
+ ```
37
+
38
+ ## 4. The writing order
39
+
40
+ | Step | What to do |
41
+ |---|---|
42
+ | 1 | `create-react-app`, `cd`, install extra packages |
43
+ | 2 | Redux slips only: slice file, then store file |
44
+ | 3 | Component files |
45
+ | 4 | `App.js`: import and show the component (routes go here) |
46
+ | 5 | Redux slips only: `Provider` in `index.js` |
47
+ | 6 | `npm start` |
48
+
49
+ ## 5. Building blocks to memorise
50
+
51
+ ### 5.1 Component
52
+
53
+ ```jsx
54
+ import React from 'react';
55
+
56
+ const Hello = () => {
57
+ return (
58
+ <div>
59
+ <h2>Hello</h2>
60
+ </div>
61
+ );
62
+ };
63
+
64
+ export default Hello;
65
+ ```
66
+
67
+ ### 5.2 State and events
68
+
69
+ ```jsx
70
+ const [name, setName] = useState('');
71
+
72
+ <input value={name} onChange={(e) => setName(e.target.value)} />
73
+ <button onClick={() => setName('')}>Clear</button>
74
+ ```
75
+
76
+ ### 5.3 Form submit
77
+
78
+ ```jsx
79
+ const handleSubmit = (e) => {
80
+ e.preventDefault();
81
+ };
82
+
83
+ <form onSubmit={handleSubmit}> ... <button type="submit">OK</button></form>
84
+ ```
85
+
86
+ ### 5.4 Lists
87
+
88
+ ```jsx
89
+ <ul>
90
+ {items.map((item, index) => <li key={index}>{item}</li>)}
91
+ </ul>
92
+ ```
93
+
94
+ ### 5.5 Routing (`npm install react-router-dom`)
95
+
96
+ ```jsx
97
+ <BrowserRouter>
98
+ <Link to="/about">About</Link>
99
+ <Routes>
100
+ <Route path="/about" element={<About />} />
101
+ <Route path="*" element={<h1>Page Not Found</h1>} />
102
+ </Routes>
103
+ </BrowserRouter>
104
+ ```
105
+
106
+ ### 5.6 Redux Toolkit (`npm install @reduxjs/toolkit react-redux`)
107
+
108
+ ```text
109
+ createSlice -> configureStore -> <Provider store> -> useSelector / useDispatch
110
+ ```
111
+
112
+ ## 6. Commands
113
+
114
+ | Command | What it does |
115
+ |---|---|
116
+ | `npm install` | installs everything in `package.json` |
117
+ | `npm install <name>` | adds a package |
118
+ | `npm start` | runs the app |
119
+ | `npm run build` | makes the production build |
120
+
121
+ ## 7. Reading an error
122
+
123
+ 1. Read the message in the terminal or on the red browser screen.
124
+ 2. Find the file name and line number.
125
+ 3. Check these usual causes:
126
+
127
+ | Message | Usual cause |
128
+ |---|---|
129
+ | `Module not found` | wrong path or file name, or package not installed |
130
+ | `is not defined` | forgot an `import` |
131
+ | `Adjacent JSX elements must be wrapped` | wrap them in one `<div>` or `<>...</>` |
132
+ | `Too many re-renders` | a function is called in `onClick` instead of passed |
133
+ | Blank page | open the console (F12) and read the first error |
134
+
135
+ ## 8. How to practise
136
+
137
+ | Pattern | Learn slip | Then you also know |
138
+ |---|---|---|
139
+ | State and buttons | [3](Slip_03.md) | [8](Slip_08.md), [9](Slip_09.md), [17](Slip_17.md), [16](Slip_16.md) |
140
+ | Forms and inputs | [1](Slip_01.md) | [10](Slip_10.md), [11](Slip_11.md), [14](Slip_14.md), [21](Slip_21.md) |
141
+ | Lists | [19](Slip_19.md) | [7](Slip_07.md), [18](Slip_18.md) |
142
+ | useEffect and useReducer | [2](Slip_02.md) | [15](Slip_15.md) |
143
+ | Routing | [4](Slip_04.md) | [5](Slip_05.md), [6](Slip_06.md), [20](Slip_20.md) |
144
+ | Redux | [13](Slip_13.md) | [12](Slip_12.md) |