With the Python 2.7 deadline fast approaching, modernize the codebase
making use of the modernize module to switch to using six, as well as
other upcoming features, such as absolute imports . Stop using 2to3
for Travis, yay!
The path requested in Repository.get_contents() is appended to the URL,
so the root path should be requested with the empty string. If path is
'/', set it to the empty string. Copy the replay data from the original
test, since it is identical.
Drive-by renaming the test to include the missing 's'.
Closes#1059
Added support for the traffic endpoints found at https://developer.github.com/v3/repos/traffic/.
We added four functions to the Repository class (one for each of the endpoints) with corresponding unit tests.
Fixes#926
## Changes
- Add `affiliation` parameter to `get_collaborators()` and use it to filter collaborators through the API
- Resolves#937
PS: Would have loved to add a simple test for this but there seems to be a problem on my end using OAuth as I'm just not able to authenticate to the API during tests.
Wraps the parts of the notification API that allows the user to mark notifications as read.
New methods are :
- Notification.mark_as_read : marks a single notification thread as read
- Repository.mark_notifications_as_read : marks all the notifications for a given repository as read
- AuthenticatedUser.mark_notifications_as_read : marks all the notifications as read
Aims to fix : https://github.com/PyGithub/PyGithub/issues/571 and simply uses the APIs described on this page : https://developer.github.com/enterprise/11.10.340/v3/activity/notifications/
A weird thing I noticed doing this is that Repository.notifications_url doesn't seem to be usable directly. I used Repository.url + "/notifications" instead.
* Add a trailing slash to URL when updating or deleting a file.
* Update test files to match new create/update/delete_file Repo methods
* Add trailing slash to get_contents() method
* update tests
* add missing slash in get_dir_contents
* add example usage
* remove dup slashes in tests
* clarify example comments
Initial solution for [PyGithub support for projects](https://github.com/PyGithub/PyGithub/issues/606) (#606). Adds comprehensive project querying API.
Currently does not support for modifying projects, columns or cards. (I only need this interface for reporting purposes. Of course once I'm done others are more than welcome to add additional features!)
API that was integrated:
https://developer.github.com/v3/projectshttps://developer.github.com/v3/projects/columnshttps://developer.github.com/v3/projects/cards
Note that the Github project API is in preview mode - it requires a special header in order for requests to be processed, and the API is subject to change without notice.
## Summary
- new classes: Project, ProjectColumn, ProjectCard
- add Organization.get_projects method
- add Repository.get_projects method
- add MainClass.get_project method
- add test cases to exercise all new classes and methods and verify attributes are as expected; replay data is included, recorded (mostly) from my fork of PyGithub
- updated add_attribute script to:
- use makeXXXAttribute API
- be able to add to the end of the current set of properties
- handle both Completable and NonCompletable class types correctly
## Checklist
Not to be merged until these are done:
- [x] remaining Project properties
- [x] remaining ProjectColumn properties
- [x] remaining ProjectCard properties
- [x] support for archived_state parameter when getting cards: all,archived, or not_archived
- [x] get issue from card, not just pull request ("get_content" method?)
- [x] centralize header management for "preview" access to projects API
- [x] add test for retrieving organization projects
- [x] add test for getting issue / pull request content from card
Add a method to Repository, collaborator_permission that allows users
with push access to repositories to query the permission level of
collaborators.
Fixes#722
See Issue #855
The class [IssueEvent](https://github.com/PyGithub/PyGithub/blob/master/github/IssueEvent.py) is missing a large number of attributes documented in the [API](https://developer.github.com/v3/issues/events/).
This is also commented about in #653 to a degree
27 of the tests 27 known event types have tests.
**Currently Tested using Issue #30**
- [x] subscribed
- [x] assigned
- [x] referenced
- [x] closed
- [x] labeled
**Currently Tested using Issue/PR #538**
- [x] merged
- [x] mentioned
- [x] review_requested
**Currently Tested using Issue/PR #857**
- [x] reopened
- [x] unassigned
- [x] unlabeled
- [x] renamed
- [x] base_ref_changed
- [x] head_ref_deleted
- [x] head_ref_restored
- [x] milestoned
- [x] demilestoned
- [x] locked
- [x] unlocked
- [x] review_dismissed
- [x] review_request_removed
- [x] marked_as_duplicate
- [x] unmarked_as_duplicate
- [x] added_to_project
- [x] moved_columns_in_project
- [x] removed_from_project
- [x] converted_note_to_issue - Note: this event is tied into Issue #866
This PR is now ready to be merged
With both the custom Accept header and the new code that supports the
new Branch Protection API, Repository.get_protected_branch() is no
longer required, and it also was never tested, so remove it.
The Branch protection API has been radically changed by GitHub, add new
methods to Branch reflecting it. Branch protection methods are now
called on the Branch object itself, rather than awkwardly hanging off
the Repository object and requiring branch names to be passed in.
This adds an over-arching methods to get, edit and remove protection
entirely, as well as fine-grained methods for getting, setting and
dropping certain aspects of branch protection, as well as three new
objects to encompass querying those aspects.
This also destroys Repository.protect_branch(), the endpoint has been
removed. The old-style protection attributes on Branch have also been
removed to force users onto the new API, since they are still sent, but
no longer populated.
Fixes#586
Closes#784Closes#785
First commit fixes a small bug that I observed while trying to record some new test fixtures: the stringification of the headers is not correctly printed as a list of tuples, but as an `iteritems` object, so I forced the list evaluation.
Second commit adds the missing properties `allow_merge_commit`, `allow_rebase_merge`, `allow_squash_merge`, and `has_projects` to the `Repository` class.
Note however that I ran into some trouble while modifying the `edit` method of the `Repository` class to make use of the new properties, specifically while writing tests, so I will fix the `edit` method in a future PR.
Fixes ##840
Adding archival support to Repository.edit
No unit tests are included for this change because while you can archive a repository via the edit API, there is no way to un-archive a repository via the edit API. (See: https://developer.github.com/v3/repos/#edit )
The API docs for Repository.get_git_tree specify that the URL parameter
for fetching a tree recursively should be ?recursive=1, not a truthy
value. To not change the API we present, check if it is True before
setting it to 1. Change another callsite of Repository.get_git_tree to
specify recursive=False to make sure it doesn't appear in the query
string.
Fixes#560
The description attribute handling requirement is
a custom media type in the Accept header:
application/vnd.github.symmetra-preview+json
Limitation: Repository.get_labels does not report description,
possibly something has changed in the preview API.
* Added is_draft and is_prerelease property to GitRelease
* Added target_commitish option to Repository.create_git_release()
* Added test for Repository.create_git_release()
* Renamed attr of GitRelease: is_draft, is_prerelease -> draft, prerelease
* Add flag for maintainer can modify when creating pull requests
* Change default to be None to let github decide the behaviour
* Update docstring
* Follow conventions from other functions