You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+8-17
Original file line number
Diff line number
Diff line change
@@ -74,19 +74,12 @@ We want your work to be readable by others; therefore, we encourage you to note
74
74
75
75
- We encourage the use of Python [f-strings](https://realpython.com/python-f-strings/#f-strings-a-new-and-improved-way-to-format-strings-in-python) where they make the code easier to read.
76
76
77
-
- Please consider running [__psf/black__](https://github.com/python/black) on your Python file(s) before submitting your pull request. This is not yet a requirement but it does make your code more readable and automatically aligns it with much of [PEP 8](https://www.python.org/dev/peps/pep-0008/). There are other code formatters (autopep8, yapf) but the __black__ formatter is now hosted by the Python Software Foundation. To use it,
78
-
79
-
```bash
80
-
python3 -m pip install black # only required the first time
81
-
black .
82
-
```
83
-
84
-
- All submissions will need to pass the test `flake8 . --ignore=E203,W503 --max-line-length=88` before they will be accepted so if possible, try this test locally on your Python file(s) before submitting your pull request.
85
-
86
-
```bash
87
-
python3 -m pip install flake8 # only required the first time
- Original code submission require docstrings or comments to describe your work.
92
85
@@ -148,15 +141,14 @@ We want your work to be readable by others; therefore, we encourage you to note
148
141
starting_value =int(input("Please enter a starting value: ").strip())
149
142
```
150
143
151
-
The use of [Python type hints](https://docs.python.org/3/library/typing.html) is encouraged for function parameters and return values. Our automated testing will run [mypy](http://mypy-lang.org) so run that locally before making your submission.
144
+
The use of [Python type hints](https://docs.python.org/3/library/typing.html) is encouraged for function parameters and return values.
145
+
Our automated testing will run [mypy](http://mypy-lang.org) so run that locally with pre-commit before making your submission.
152
146
153
147
```python
154
148
defsum_ab(a: int, b: int) -> int:
155
149
return a + b
156
150
```
157
151
158
-
Instructions on how to install mypy can be found [here](https://github.com/python/mypy). Please use the command `mypy --ignore-missing-imports .` to test all files or `mypy --ignore-missing-imports path/to/file.py` to test a specific file.
159
-
160
152
-[__List comprehensions and generators__](https://docs.python.org/3/tutorial/datastructures.html#list-comprehensions) are preferred over the use of `lambda`, `map`, `filter`, `reduce` but the important thing is to demonstrate the power of Python in code that is easy to read and maintain.
161
153
162
154
- Avoid importing external libraries for basic algorithms. Only use those libraries for complicated algorithms.
@@ -172,7 +164,6 @@ We want your work to be readable by others; therefore, we encourage you to note
172
164
- If you have modified/added documentation work, ensure your language is concise and contains no grammar errors.
173
165
- Do not update the README.md or DIRECTORY.md file which will be periodically autogenerated by our GitHub Actions processes.
174
166
- Add a corresponding explanation to [Algorithms-Explanation](https://github.com/TheAlgorithms/Algorithms-Explanation) (Optional but recommended).
175
-
- All submissions will be tested with [__mypy__](http://www.mypy-lang.org) so we encourage you to add [__Python type hints__](https://docs.python.org/3/library/typing.html) where it makes sense to do so.
176
167
177
168
- Most importantly,
178
169
-__Be consistent in the use of these guidelines when submitting.__
0 commit comments