-
-
Notifications
You must be signed in to change notification settings - Fork 884
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add typehints and allow google docstrings #1023
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
33344dd
chore: allow google docstring
adehad cc504a1
bugfix: respect logging argument
adehad 096e048
bugfix: correct usage of JIRAError, add typehints
adehad c30ac81
feature: add typehints and coax mypy
adehad b5cad78
example, add _Comment helper
adehad 037359d
feature: add py.typed for PEP-561 compliance
adehad 998b869
bugfix: fix epic_id typehint, closes #968
adehad d974c75
Merge branch 'master' into feature/typehints_and_google_docstrings
adehad File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,90 @@ | ||
API Documentation | ||
***************** | ||
|
||
.. module:: jira | ||
|
||
.. contents:: Contents | ||
:local: | ||
|
||
JIRA | ||
==== | ||
jira package | ||
============ | ||
|
||
.. autoclass:: JIRA | ||
jira.client module | ||
------------------ | ||
|
||
Issue | ||
======== | ||
.. automodule:: jira.client | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
.. autoclass:: Issue | ||
jira.config module | ||
------------------ | ||
|
||
Priority | ||
======== | ||
.. automodule:: jira.config | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
.. autoclass:: Priority | ||
jira.exceptions module | ||
---------------------- | ||
|
||
Comment | ||
======= | ||
.. automodule:: jira.exceptions | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
.. autoclass:: Comment | ||
jira.jirashell module | ||
--------------------- | ||
|
||
Version | ||
======= | ||
.. automodule:: jira.jirashell | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
.. autoclass:: jira.resources.Version | ||
jira.resilientsession module | ||
---------------------------- | ||
|
||
Worklog | ||
======= | ||
.. automodule:: jira.resilientsession | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
.. autoclass:: Worklog | ||
jira.resources module | ||
--------------------- | ||
|
||
Watchers | ||
======== | ||
.. autodata:: jira.client.ResourceType | ||
:annotation: = alias of TypeVar(‘ResourceType’, contravariant=True, bound=jira.resources.Resource) | ||
|
||
.. autoclass:: Watchers | ||
.. automodule:: jira.resources | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
:private-members: | ||
|
||
JIRAError | ||
========= | ||
.. autoclass:: jira.resources.StatusCategory | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
.. autoclass:: JIRAError | ||
.. autoclass:: jira.resources.GreenHopperResource | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
.. autoclass:: jira.resources.Sprint | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
.. autoclass:: jira.resources.Board | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
|
||
jira.utils module | ||
----------------- | ||
|
||
.. automodule:: jira.utils | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,11 @@ | |
# username and password over HTTP BASIC authentication. | ||
|
||
from collections import Counter | ||
from typing import cast | ||
|
||
from jira import JIRA | ||
from jira.client import ResultList | ||
from jira.resources import Issue | ||
|
||
# By default, the client will connect to a Jira instance started from the Atlassian Plugin SDK. | ||
# See | ||
|
@@ -16,7 +19,9 @@ | |
props = jira.application_properties() | ||
|
||
# Find all issues reported by the admin | ||
issues = jira.search_issues("assignee=admin") | ||
# Note: we cast() for mypy's benefit, as search_issues can also return the raw json ! | ||
# This is if the following argument is used: `json_result=True` | ||
issues = cast(ResultList[Issue], jira.search_issues("assignee=admin")) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe explain this a little bit more => why cast? |
||
|
||
# Find the top three projects containing issues reported by admin | ||
top_three = Counter([issue.fields.project.key for issue in issues]).most_common(3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
napoleon_google_docstring
andnapoleon_use_param
already default toTrue
in plugin. Can be removed?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding the checks, this branch will definitely wait for the CI to pass before merging.
The background is currently the CI test suite is only run on PR's directed at the main branch, as currently this branch targetting an unmerged branch (the isort branch, which this branch is based off of) they aren't being run.
I have run the tests locally so have some confidence it will pass.
I did not know this, I will take a look. Thanks for raising.
This is true, it is just a personal preference to have these written explicitly so they are not accidentally changed in the future. Happy to remove if there is a preference either way.
Luckily 90% of the diff (probably ) is just docstrings hahaha. But yeah, I do regret creating such a monster of a PR, as the files and functions depend on one another it was hard to pick a stopping point, as mypy would be throwing warnings left and right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Completely understandable.
It's good to get the type hints! Even if the hints were invalid, the actual code should not break. So, if a few issues slip in on first go (despite passing 100% of checks), it's not the end of the world 💣.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
py.typed
file added, branch also rebased on to master confirming tests pass.