Skip to content

Commit 30e0de4

Browse files
authored
Implement pre-commit (#1664)
* Add pre-commit * Fix docstring formatter * Fix docstring formatter even more * Add black configuration * Run pre-commit formatting
1 parent 9cd72bc commit 30e0de4

File tree

188 files changed

+9326
-6574
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

188 files changed

+9326
-6574
lines changed

.flake8

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[flake8]
2+
min_python_version = 3.8
3+
ignore =
4+
E203, W503, # Incompatible with black see https://github.com/ambv/black/issues/315
5+
6+
max-line-length=120
7+
max-complexity=39

.github/CODE_OF_CONDUCT.md

Lines changed: 65 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -2,124 +2,116 @@
22

33
## Our Pledge
44

5-
We as members, contributors, and leaders pledge to make participation in our
6-
community a harassment-free experience for everyone, regardless of age, body
7-
size, visible or invisible disability, ethnicity, sex characteristics, gender
8-
identity and expression, level of experience, education, socio-economic status,
9-
nationality, personal appearance, race, religion, or sexual identity
10-
and orientation.
5+
We as members, contributors, and leaders pledge to make participation in our community a
6+
harassment-free experience for everyone, regardless of age, body size, visible or
7+
invisible disability, ethnicity, sex characteristics, gender identity and expression,
8+
level of experience, education, socio-economic status, nationality, personal appearance,
9+
race, religion, or sexual identity and orientation.
1110

12-
We pledge to act and interact in ways that contribute to an open, welcoming,
13-
diverse, inclusive, and healthy community.
11+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse,
12+
inclusive, and healthy community.
1413

1514
## Our Standards
1615

17-
Examples of behavior that contributes to a positive environment for our
18-
community include:
16+
Examples of behavior that contributes to a positive environment for our community
17+
include:
1918

20-
* Demonstrating empathy and kindness toward other people
21-
* Being respectful of differing opinions, viewpoints, and experiences
22-
* Giving and gracefully accepting constructive feedback
23-
* Accepting responsibility and apologizing to those affected by our mistakes,
24-
and learning from the experience
25-
* Focusing on what is best not just for us as individuals, but for the
26-
overall community
19+
- Demonstrating empathy and kindness toward other people
20+
- Being respectful of differing opinions, viewpoints, and experiences
21+
- Giving and gracefully accepting constructive feedback
22+
- Accepting responsibility and apologizing to those affected by our mistakes, and
23+
learning from the experience
24+
- Focusing on what is best not just for us as individuals, but for the overall community
2725

2826
Examples of unacceptable behavior include:
2927

30-
* The use of sexualized language or imagery, and sexual attention or
31-
advances of any kind
32-
* Trolling, insulting or derogatory comments, and personal or political attacks
33-
* Public or private harassment
34-
* Publishing others' private information, such as a physical or email
35-
address, without their explicit permission
36-
* Other conduct which could reasonably be considered inappropriate in a
37-
professional setting
28+
- The use of sexualized language or imagery, and sexual attention or advances of any
29+
kind
30+
- Trolling, insulting or derogatory comments, and personal or political attacks
31+
- Public or private harassment
32+
- Publishing others' private information, such as a physical or email address, without
33+
their explicit permission
34+
- Other conduct which could reasonably be considered inappropriate in a professional
35+
setting
3836

3937
## Enforcement Responsibilities
4038

4139
Community leaders are responsible for clarifying and enforcing our standards of
42-
acceptable behavior and will take appropriate and fair corrective action in
43-
response to any behavior that they deem inappropriate, threatening, offensive,
44-
or harmful.
40+
acceptable behavior and will take appropriate and fair corrective action in response to
41+
any behavior that they deem inappropriate, threatening, offensive, or harmful.
4542

46-
Community leaders have the right and responsibility to remove, edit, or reject
47-
comments, commits, code, wiki edits, issues, and other contributions that are
48-
not aligned to this Code of Conduct, and will communicate reasons for moderation
49-
decisions when appropriate.
43+
Community leaders have the right and responsibility to remove, edit, or reject comments,
44+
commits, code, wiki edits, issues, and other contributions that are not aligned to this
45+
Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
5046

5147
## Scope
5248

53-
This Code of Conduct applies within all community spaces, and also applies when
54-
an individual is officially representing the community in public spaces.
55-
Examples of representing our community include using an official e-mail address,
56-
posting via an official social media account, or acting as an appointed
57-
representative at an online or offline event.
49+
This Code of Conduct applies within all community spaces, and also applies when an
50+
individual is officially representing the community in public spaces. Examples of
51+
representing our community include using an official e-mail address, posting via an
52+
official social media account, or acting as an appointed representative at an online or
53+
offline event.
5854

5955
## Enforcement
6056

61-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62-
reported to the community leaders responsible for enforcement at
63-
Our Discord server.
64-
All complaints will be reviewed and investigated promptly and fairly.
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to
58+
the community leaders responsible for enforcement at Our Discord server. All complaints
59+
will be reviewed and investigated promptly and fairly.
6560

66-
All community leaders are obligated to respect the privacy and security of the
67-
reporter of any incident.
61+
All community leaders are obligated to respect the privacy and security of the reporter
62+
of any incident.
6863

6964
## Enforcement Guidelines
7065

71-
Community leaders will follow these Community Impact Guidelines in determining
72-
the consequences for any action they deem in violation of this Code of Conduct:
66+
Community leaders will follow these Community Impact Guidelines in determining the
67+
consequences for any action they deem in violation of this Code of Conduct:
7368

7469
### 1. Correction
7570

7671
**Community Impact**: Use of inappropriate language or other behavior deemed
7772
unprofessional or unwelcome in the community.
7873

79-
**Consequence**: A private, written warning from community leaders, providing
80-
clarity around the nature of the violation and an explanation of why the
81-
behavior was inappropriate. A public apology may be requested.
74+
**Consequence**: A private, written warning from community leaders, providing clarity
75+
around the nature of the violation and an explanation of why the behavior was
76+
inappropriate. A public apology may be requested.
8277

8378
### 2. Warning
8479

85-
**Community Impact**: A violation through a single incident or series
86-
of actions.
80+
**Community Impact**: A violation through a single incident or series of actions.
8781

88-
**Consequence**: A warning with consequences for continued behavior. No
89-
interaction with the people involved, including unsolicited interaction with
90-
those enforcing the Code of Conduct, for a specified period of time. This
91-
includes avoiding interactions in community spaces as well as external channels
92-
like social media. Violating these terms may lead to a temporary or
93-
permanent ban.
82+
**Consequence**: A warning with consequences for continued behavior. No interaction with
83+
the people involved, including unsolicited interaction with those enforcing the Code of
84+
Conduct, for a specified period of time. This includes avoiding interactions in
85+
community spaces as well as external channels like social media. Violating these terms
86+
may lead to a temporary or permanent ban.
9487

9588
### 3. Temporary Ban
9689

97-
**Community Impact**: A serious violation of community standards, including
98-
sustained inappropriate behavior.
90+
**Community Impact**: A serious violation of community standards, including sustained
91+
inappropriate behavior.
9992

100-
**Consequence**: A temporary ban from any sort of interaction or public
101-
communication with the community for a specified period of time. No public or
102-
private interaction with the people involved, including unsolicited interaction
103-
with those enforcing the Code of Conduct, is allowed during this period.
104-
Violating these terms may lead to a permanent ban.
93+
**Consequence**: A temporary ban from any sort of interaction or public communication
94+
with the community for a specified period of time. No public or private interaction with
95+
the people involved, including unsolicited interaction with those enforcing the Code of
96+
Conduct, is allowed during this period. Violating these terms may lead to a permanent
97+
ban.
10598

10699
### 4. Permanent Ban
107100

108-
**Community Impact**: Demonstrating a pattern of violation of community
109-
standards, including sustained inappropriate behavior, harassment of an
110-
individual, or aggression toward or disparagement of classes of individuals.
101+
**Community Impact**: Demonstrating a pattern of violation of community standards,
102+
including sustained inappropriate behavior, harassment of an individual, or aggression
103+
toward or disparagement of classes of individuals.
111104

112-
**Consequence**: A permanent ban from any sort of public interaction within
113-
the community.
105+
**Consequence**: A permanent ban from any sort of public interaction within the
106+
community.
114107

115108
## Attribution
116109

117-
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118-
version 2.0, available at
119-
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
110+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
111+
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120112

121-
Community Impact Guidelines were inspired by [Mozilla's code of conduct
122-
enforcement ladder](https://github.com/mozilla/diversity).
113+
Community Impact Guidelines were inspired by
114+
[Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
123115

124116
[homepage]: https://www.contributor-covenant.org
125117

.github/CONTRIBUTING.md

Lines changed: 51 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
## Contributing to Pycord
22

3-
First off, thanks for taking the time to contribute. It makes the library substantially better. :+1:
3+
First off, thanks for taking the time to contribute. It makes the library substantially
4+
better. :+1:
45

5-
The following is a set of guidelines for contributing to the repository. These are guidelines, not hard rules.
6+
The following is a set of guidelines for contributing to the repository. These are
7+
guidelines, not hard rules.
68

79
## This is too much to read! I want to ask a question!
810

@@ -12,44 +14,71 @@ Generally speaking questions are better suited in our resources below.
1214
- [The FAQ in the documentation](https://docs.pycord.dev/en/master/faq.html)
1315
- [StackOverflow's `pycord` tag](https://stackoverflow.com/questions/tagged/pycord)
1416

15-
Please try your best not to ask questions in our issue tracker. Most of them don't belong there unless they provide value to a larger audience.
17+
Please try your best not to ask questions in our issue tracker. Most of them don't
18+
belong there unless they provide value to a larger audience.
1619

1720
## Good Bug Reports
1821

1922
Please be aware of the following things when filing bug reports.
2023

21-
1. Don't open duplicate issues. Please search your issue to see if it has been asked already. Duplicate issues will be closed.
22-
2. When filing a bug about exceptions or tracebacks, please include the *complete* traceback. Without the complete traceback the issue might be **unsolvable** and you will be asked to provide more information.
23-
3. Make sure to provide enough information to make the issue workable. The issue template will generally walk you through the process but they are enumerated here as well:
24-
- A **summary** of your bug report. This is generally a quick sentence or two to describe the issue in human terms.
25-
- Guidance on **how to reproduce the issue**. Ideally, this should have a small code sample that allows us to run and see the issue for ourselves to debug. **Please make sure that the token is not displayed**. If you cannot provide a code snippet, then let us know what the steps were, how often it happens, etc.
26-
- Tell us **what you expected to happen**. That way we can meet that expectation.
27-
- Tell us **what actually happens**. What ends up happening in reality? It's not helpful to say "it fails" or "it doesn't work". Say *how* it failed, do you get an exception? Does it hang? How are the expectations different from reality?
28-
- Tell us **information about your environment**. What version of Pycord are you using? How was it installed? What operating system are you running on? These are valuable questions and information that we use.
29-
30-
If the bug report is missing this information then it'll take us longer to fix the issue. We will probably ask for clarification, and barring that if no response was given then the issue will be closed.
24+
1. Don't open duplicate issues. Please search your issue to see if it has been asked
25+
already. Duplicate issues will be closed.
26+
2. When filing a bug about exceptions or tracebacks, please include the _complete_
27+
traceback. Without the complete traceback the issue might be **unsolvable** and you
28+
will be asked to provide more information.
29+
3. Make sure to provide enough information to make the issue workable. The issue
30+
template will generally walk you through the process but they are enumerated here as
31+
well:
32+
- A **summary** of your bug report. This is generally a quick sentence or two to
33+
describe the issue in human terms.
34+
- Guidance on **how to reproduce the issue**. Ideally, this should have a small code
35+
sample that allows us to run and see the issue for ourselves to debug. **Please
36+
make sure that the token is not displayed**. If you cannot provide a code snippet,
37+
then let us know what the steps were, how often it happens, etc.
38+
- Tell us **what you expected to happen**. That way we can meet that expectation.
39+
- Tell us **what actually happens**. What ends up happening in reality? It's not
40+
helpful to say "it fails" or "it doesn't work". Say _how_ it failed, do you get an
41+
exception? Does it hang? How are the expectations different from reality?
42+
- Tell us **information about your environment**. What version of Pycord are you
43+
using? How was it installed? What operating system are you running on? These are
44+
valuable questions and information that we use.
45+
46+
If the bug report is missing this information then it'll take us longer to fix the
47+
issue. We will probably ask for clarification, and barring that if no response was given
48+
then the issue will be closed.
3149

3250
## Submitting a Pull Request
3351

34-
Submitting a pull request is fairly simple, just make sure it focuses on a single aspect and doesn't manage to have scope creep and it's probably good to go. It would be incredibly lovely if the style is consistent to that found in the project. This project follows PEP-8 guidelines (mostly) with a column limit of 120.
52+
Submitting a pull request is fairly simple, just make sure it focuses on a single aspect
53+
and doesn't manage to have scope creep and it's probably good to go. It would be
54+
incredibly lovely if the style is consistent to that found in the project. This project
55+
follows PEP-8 guidelines (mostly) with a column limit of 120.
3556

3657
## Use of "type: ignore" comments
37-
In some cases, it might be necessary to ignore type checker warnings for one reason or another.
38-
If that is that case, it is **required** that a comment is left explaining why you are
39-
deciding to ignore type checking warnings.
58+
59+
In some cases, it might be necessary to ignore type checker warnings for one reason or
60+
another. If that is that case, it is **required** that a comment is left explaining why
61+
you are deciding to ignore type checking warnings.
4062

4163
### Licensing
4264

43-
By submitting a pull request, you agree that; 1) You hold the copyright on all submitted code inside said pull request; 2) You agree to transfer all rights to the owner of this repository, and; 3) If you are found to be in fault with any of the above, we shall not be held responsible in any way after the pull request has been merged.
65+
By submitting a pull request, you agree that; 1) You hold the copyright on all submitted
66+
code inside said pull request; 2) You agree to transfer all rights to the owner of this
67+
repository, and; 3) If you are found to be in fault with any of the above, we shall not
68+
be held responsible in any way after the pull request has been merged.
4469

4570
## Git Commit Styling
4671

47-
Not following this guideline could lead to your pull being squashed for a cleaner commit history
72+
Not following this guideline could lead to your pull being squashed for a cleaner commit
73+
history
4874

4975
Some style guides we would recommend using in your pulls:
5076

51-
The [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) style is a very widely used style and a good style to start with.
77+
The [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) style is a
78+
very widely used style and a good style to start with.
5279

53-
The [gitmoji](https://gitmoji.dev) style guide would make your pull look more lively and different to others.
80+
The [gitmoji](https://gitmoji.dev) style guide would make your pull look more lively and
81+
different to others.
5482

55-
We don't limit nor deny your pulls when you're using another style although, please make sure it is appropriate and makes sense in this library.
83+
We don't limit nor deny your pulls when you're using another style although, please make
84+
sure it is appropriate and makes sense in this library.

.github/DEVELOPER_CERTIFICATE_OF_ORIGIN.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Developer Certificate of Origin (DCO)
2+
23
```
34
Version 1.1
45

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ body:
55
- type: markdown
66
attributes:
77
value: >
8-
Thanks for taking the time to fill out a bug.
9-
If you want real-time support, consider joining our Discord at https://pycord.dev/discord instead.
8+
Thanks for taking the time to fill out a bug. If you want real-time support,
9+
consider joining our Discord at https://pycord.dev/discord instead.
1010
1111
Please note that this form is for bugs only!
1212
- type: input
@@ -19,7 +19,7 @@ body:
1919
attributes:
2020
label: Reproduction Steps
2121
description: >
22-
What you did to make it happen.
22+
What you did to make it happen.
2323
validations:
2424
required: true
2525
- type: textarea
@@ -46,8 +46,8 @@ body:
4646
attributes:
4747
label: Intents
4848
description: >
49-
What intents are you using for your bot?
50-
This is the `discord.Intents` class you pass to the client.
49+
What intents are you using for your bot? This is the `discord.Intents` class you
50+
pass to the client.
5151
validations:
5252
required: true
5353
- type: textarea
@@ -56,8 +56,9 @@ body:
5656
description: >
5757
Run `python -m discord -v` and paste this information below.
5858
59-
This command required v1.1.0 or higher of the library. If this errors out then show some basic
60-
information involving your system such as operating system and Python version.
59+
This command required v1.1.0 or higher of the library. If this errors out then
60+
show some basic information involving your system such as operating system and
61+
Python version.
6162
validations:
6263
required: true
6364
- type: checkboxes

.github/ISSUE_TEMPLATE/feature_request.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@ body:
2626
attributes:
2727
label: The Problem
2828
description: >
29-
What problem is your feature trying to solve?
30-
What becomes easier or possible when this feature is implemented?
29+
What problem is your feature trying to solve? What becomes easier or possible
30+
when this feature is implemented?
3131
validations:
3232
required: true
3333
- type: textarea
3434
attributes:
3535
label: The Ideal Solution
3636
description: >
37-
What is your ideal solution to the problem?
38-
What would you like this feature to do?
37+
What is your ideal solution to the problem? What would you like this feature to
38+
do?
3939
validations:
4040
required: true
4141
- type: textarea

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
- [ ] This PR fixes an issue.
1010
- [ ] This PR adds something new (e.g. new method or parameters).
1111
- [ ] This PR is a breaking change (e.g. methods or parameters removed/renamed).
12-
- [ ] This PR is **not** a code change (e.g. documentation, README, typehinting, examples, ...).
12+
- [ ] This PR is **not** a code change (e.g. documentation, README, typehinting,
13+
examples, ...).
1314

1415
## Checklist
1516

0 commit comments

Comments
 (0)