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
+13-13
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
## Before contributing
4
4
5
-
Welcome to [TheAlgorithms/Python](https://github.com/TheAlgorithms/Python)! Before sending your pull requests, make sure that you **read the whole guidelines**. If you have any doubt on the contributing guide, please feel free to [state it clearly in an issue](https://github.com/TheAlgorithms/Python/issues/new) or ask the community in [Gitter](https://gitter.im/TheAlgorithms).
5
+
Welcome to [TheAlgorithms/Python](https://github.com/TheAlgorithms/Python)! Before sending your pull requests, make sure that you __read the whole guidelines__. If you have any doubt on the contributing guide, please feel free to [state it clearly in an issue](https://github.com/TheAlgorithms/Python/issues/new) or ask the community in [Gitter](https://gitter.im/TheAlgorithms).
6
6
7
7
## Contributing
8
8
@@ -15,9 +15,9 @@ We are very happy that you consider implementing algorithms and data structure f
15
15
- Your work will be distributed under [MIT License](LICENSE.md) once your pull request is merged
16
16
- You submitted work fulfils or mostly fulfils our styles and standards
17
17
18
-
**New implementation** is welcome! For example, new solutions for a problem, different representations for a graph data structure or algorithm designs with different complexity but **identical implementation** of an existing implementation is not allowed. Please check whether the solution is already implemented or not before submitting your pull request.
18
+
__New implementation__ is welcome! For example, new solutions for a problem, different representations for a graph data structure or algorithm designs with different complexity but __identical implementation__ of an existing implementation is not allowed. Please check whether the solution is already implemented or not before submitting your pull request.
19
19
20
-
**Improving comments** and **writing proper tests** are also highly welcome.
20
+
__Improving comments__ and __writing proper tests__ are also highly welcome.
21
21
22
22
### Contribution
23
23
@@ -33,7 +33,7 @@ An Algorithm is one or more functions (or classes) that:
33
33
* take one or more inputs,
34
34
* perform some internal calculations or data manipulations,
35
35
* return one or more outputs,
36
-
* have minimal side effects (Ex. print(), plot(), read(), write()).
36
+
* have minimal side effects (Ex. `print()`, `plot()`, `read()`, `write()`).
37
37
38
38
Algorithms should be packaged in a way that would make it easy for readers to put them into larger programs.
39
39
@@ -42,7 +42,7 @@ Algorithms should:
42
42
* use Python naming conventions and intuitive variable names to ease comprehension
43
43
* be flexible to take different input values
44
44
* have Python type hints for their input parameters and return values
45
-
* raise Python exceptions (ValueError, etc.) on erroneous input values
45
+
* raise Python exceptions (`ValueError`, etc.) on erroneous input values
46
46
* have docstrings with clear explanations and/or URLs to source materials
47
47
* contain doctests that test both valid and erroneous input values
48
48
* return all calculation results instead of printing or plotting them
@@ -66,10 +66,10 @@ pre-commit run --all-files --show-diff-on-failure
66
66
67
67
We want your work to be readable by others; therefore, we encourage you to note the following:
68
68
69
-
- Please write in Python 3.7+. For instance: __print()__ is a function in Python 3 so __print "Hello"__ will _not_ work but __print("Hello")__ will.
69
+
- Please write in Python 3.7+. For instance: `print()` is a function in Python 3 so `print "Hello"` will *not* work but `print("Hello")` will.
70
70
- Please focus hard on naming of functions, classes, and variables. Help your reader by using __descriptive names__ that can help you to remove redundant comments.
71
-
- Single letter variable names are _old school_ so please avoid them unless their life only spans a few lines.
72
-
- Expand acronyms because __gcd()__ is hard to understand but __greatest_common_divisor()__ is not.
71
+
- Single letter variable names are *old school* so please avoid them unless their life only spans a few lines.
72
+
- Expand acronyms because `gcd()` is hard to understand but `greatest_common_divisor()` is not.
73
73
- Please follow the [Python Naming Conventions](https://pep8.org/#prescriptive-naming-conventions) so variable_names and function_names should be lower_case, CONSTANTS in UPPERCASE, ClassNames should be CamelCase, etc.
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.
@@ -81,7 +81,7 @@ We want your work to be readable by others; therefore, we encourage you to note
81
81
black .
82
82
```
83
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.
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
85
86
86
```bash
87
87
python3 -m pip install flake8 # only required the first time
@@ -134,15 +134,15 @@ We want your work to be readable by others; therefore, we encourage you to note
134
134
python3 -m doctest -v my_submission.py
135
135
```
136
136
137
-
The use of the Python builtin __input()__ function is **not** encouraged:
137
+
The use of the Python builtin `input()` function is __not__ encouraged:
138
138
139
139
```python
140
140
input('Enter your input:')
141
141
# Or even worse...
142
142
input=eval(input("Enter your input: "))
143
143
```
144
144
145
-
However, if your code uses __input()__ then we encourage you to gracefully deal with leading and trailing whitespace in user input by adding __.strip()__ as in:
145
+
However, if your code uses `input()` then we encourage you to gracefully deal with leading and trailing whitespace in user input by adding `.strip()` as in:
146
146
147
147
```python
148
148
starting_value =int(input("Please enter a starting value: ").strip())
@@ -175,8 +175,8 @@ We want your work to be readable by others; therefore, we encourage you to note
175
175
- All submissions will be tested with [__mypy__](http://www.mypy-lang.org) so we encourage to add [__Python type hints__](https://docs.python.org/3/library/typing.html) where it makes sense to do so.
176
176
177
177
- Most importantly,
178
-
-**Be consistent in the use of these guidelines when submitting.**
0 commit comments