From 8990a4ed290874c88d8323d06e0fa512d01b0e16 Mon Sep 17 00:00:00 2001 From: staticdev Date: Sat, 2 Jan 2021 21:39:45 +0100 Subject: [PATCH 1/3] Deprecated code removal --- docs/source/release-notes/2.0.0.rst | 48 +- setup.py | 2 +- src/github3/__init__.py | 31 -- src/github3/api.py | 806 ---------------------------- src/github3/git.py | 12 - src/github3/issues/issue.py | 32 -- src/github3/orgs.py | 164 ------ tests/integration/test_issue.py | 12 - tests/integration/test_orgs.py | 32 -- tests/integration/test_orgs_team.py | 21 - tests/unit/test_api.py | 175 ------ tests/unit/test_issues_issue.py | 24 - tests/unit/test_orgs.py | 29 - tests/unit/test_orgs_team.py | 35 -- 14 files changed, 48 insertions(+), 1375 deletions(-) diff --git a/docs/source/release-notes/2.0.0.rst b/docs/source/release-notes/2.0.0.rst index 81fa60881..3697ac325 100644 --- a/docs/source/release-notes/2.0.0.rst +++ b/docs/source/release-notes/2.0.0.rst @@ -1,4 +1,4 @@ -1.4.0: 2020-12-29 +2.0.0: 2020-01-02 ----------------- Features Added @@ -9,3 +9,49 @@ Features Added - Update CI/CD to thoroughly test all supported version. - Remove compatibility imports for Python 2. - Remove dev-dependency for mock. + +Removals +```````` + +Removal of already deprecated code on version 1.x: + + - ``Api#all_events`` use ``github.GitHub.all_events`` + - ``Api#all_repositories`` use ``github.GitHub.all_repositories`` + - ``Api#all_users`` use ``github.GitHub.all_users`` + - ``Api#authorize`` use ``github.GitHub.authorize`` + - ``Api#create_gist`` use ``github.GitHub.create_gist`` + - ``Api#emojis`` + - ``Api#followed_by`` use ``github.GitHub.followed_by`` + - ``Api#followers_of`` use ``github.GitHub.followers_of`` + - ``Api#gist`` use ``github.GitHub.gist`` + - ``Api#gists_by`` use ``github.GitHub.gists_by`` + - ``Api#gitignore_template`` use ``github.GitHub.gitignore_template`` + - ``Api#gitignore_templates`` use ``github.GitHub.gitignore_templates`` + - ``Api#issue`` use ``github.GitHub.issue`` + - ``Api#issues_on`` use ``github.GitHub.issues_on`` + - ``Api#markdown`` use ``github.GitHub.markdown`` + - ``Api#octocat`` use ``github.GitHub.octocat`` + - ``Api#organization`` + - ``Api#organizations_with`` use ``github.GitHub.organizations_with`` + - ``Api#public_gists`` use ``github.GitHub.public_gists`` + - ``Api#pull_request`` use ``github.GitHub.pull_request`` + - ``Api#rate_limit`` + - ``Api#repositories_by`` use ``github.GitHub.organizations_with`` + - ``Api#repository`` + - ``Api#search_code`` use ``github.GitHub.search_code`` + - ``Api#search_issues`` use ``github.GitHub.search_issues`` + - ``Api#search_repositories`` use ``github.GitHub.search_repositories`` + - ``Api#search_users`` use ``github.GitHub.search_users`` + - ``Api#starred_by`` use ``github.GitHub.starred_by`` + - ``Api#subscriptions_for`` use ``github.GitHub.subscriptions_for`` + - ``Api#user`` + - ``Api#zen`` use ``github.GitHub.zen`` + - ``Git#Blob.decoded`` use ``Git#Blob.decode_content`` + - ``Team#is_member`` use ``Login#is_member`` + - ``Team#add_member`` use ``Team#add_or_update_membership`` + - ``Team#invite`` use ``Team#add_or_update_membership`` + - ``Team#remove_member`` use ``Team#add_or_update_membership`` + - ``Organization#add_member`` add ``username`` to ``team``. + - ``Organization#events`` use ``Organization#public_events`` + - ``Issue#assign`` use ``issues.issue.Issue.add_assignees`` + diff --git a/setup.py b/setup.py index 5d0c107bc..56f9e8fe8 100755 --- a/setup.py +++ b/setup.py @@ -62,7 +62,7 @@ def run_tests(self): # noqa: D102 # import here, cause outside the eggs aren't loaded import pytest - warnings.warn("pyton setup.py test support is deprecated.", DeprecationWarning) + warnings.warn("python setup.py test support is deprecated.", DeprecationWarning) errno = pytest.main(self.test_args) sys.exit(errno) diff --git a/src/github3/__init__.py b/src/github3/__init__.py index 785f1d8ca..550dd6378 100644 --- a/src/github3/__init__.py +++ b/src/github3/__init__.py @@ -22,39 +22,8 @@ __url__, ) from .api import ( - all_events, - all_repositories, - all_users, - authorize, - create_gist, - emojis, enterprise_login, - followed_by, - followers_of, - gist, - gists_by, - gitignore_template, - gitignore_templates, - issue, - issues_on, login, - markdown, - octocat, - organization, - organizations_with, - public_gists, - pull_request, - rate_limit, - repositories_by, - repository, - search_code, - search_issues, - search_repositories, - search_users, - starred_by, - subscriptions_for, - user, - zen, ) from .github import GitHub, GitHubEnterprise from .exceptions import GitHubError diff --git a/src/github3/api.py b/src/github3/api.py index 03166c3d0..3bff69e9d 100644 --- a/src/github3/api.py +++ b/src/github3/api.py @@ -8,71 +8,11 @@ """ -import warnings -from functools import wraps from .github import GitHub, GitHubEnterprise gh = GitHub() -def deprecated(func): - """Decorator to mark a function as deprecated.""" - - @wraps(func) - def deprecation_wrapper(*args, **kwargs): - warnings.warn( - "The anonymous API function `github3.api.{0}` is deprecated. Use " - "`GitHub.{0}` instead.".format(func.__name__), - DeprecationWarning, - stacklevel=2, - ) - return func(*args, **kwargs) - - return deprecation_wrapper - - -@deprecated -def authorize( - username, - password, - scopes, - note="", - note_url="", - client_id="", - client_secret="", - two_factor_callback=None, - github=None, -): - """Obtain an authorization token for the GitHub API. - - .. deprecated:: 1.2.0 - - Use :meth:`github3.github.GitHub.authorize` instead. - - :param str username: (required) - :param str password: (required) - :param list scopes: (required), areas you want this token to apply to, - i.e., 'gist', 'user' - :param str note: (optional), note about the authorization - :param str note_url: (optional), url for the application - :param str client_id: (optional), 20 character OAuth client key for which - to create a token - :param str client_secret: (optional), 40 character OAuth client secret for - which to create the token - :param func two_factor_callback: (optional), function to call when a - Two-Factor Authentication code needs to be provided by the user. - :param GitHub github: (optional), GitHub (or GitHubEnterprise) object for - login. - :returns: :class:`Authorization ` - - """ - gh = github or GitHub() - gh.login(two_factor_callback=two_factor_callback) - return gh.authorize( - username, password, scopes, note, note_url, client_id, client_secret - ) - - def login(username=None, password=None, token=None, two_factor_callback=None): """Construct and return an authenticated GitHub session. @@ -136,749 +76,3 @@ def enterprise_login( g.login(username, password, token, two_factor_callback) return g - - -@deprecated -def emojis(): - return gh.emojis() - - -emojis.__doc__ = gh.emojis.__doc__ - - -@deprecated -def gist(id_num): - """Retrieve the gist identified by ``id_num``. - - .. deprecated:: 1.2.0 - - Use :meth:`github3.github.GitHub.gist` instead. - - :param int id_num: (required), unique id of the gist - :returns: :class:`Gist ` - - """ - return gh.gist(id_num) - - -@deprecated -def gitignore_template(language): - """Return the template for language. - - .. deprecated:: 1.2.0 - - Use :meth:`github3.github.GitHub.gitignore_template` instead. - - :returns: str - - """ - return gh.gitignore_template(language) - - -@deprecated -def gitignore_templates(): - """Return the list of available templates. - - .. deprecated:: 1.2.0 - - Use :meth:`github3.github.GitHub.gitignore_templates` instead. - - :returns: list of template names - - """ - return gh.gitignore_templates() - - -@deprecated -def all_repositories(number=-1, etag=None): - """Iterate over every repository in the order they were created. - - .. deprecated:: 1.2.0 - - Use :meth:`github3.github.GitHub.all_repositories` instead. - - :param int number: (optional), number of repositories to return. - Default: -1, returns all of them - :param str etag: (optional), ETag from a previous request to the same - endpoint - :returns: generator of :class:`Repository ` - - """ - return gh.all_repositories(number, etag) - - -@deprecated -def all_users(number=-1, etag=None): - """Iterate over every user in the order they signed up for GitHub. - - .. deprecated:: 1.2.0 - - Use :meth:`github3.github.GitHub.all_users` instead. - - :param int number: (optional), number of users to return. Default: -1, - returns all of them - :param str etag: (optional), ETag from a previous request to the same - endpoint - :returns: generator of :class:`User ` - - """ - return gh.all_users(number, etag) - - -@deprecated -def all_events(number=-1, etag=None): - """Iterate over public events. - - .. deprecated:: 1.2.0 - - Use :meth:`github3.github.GitHub.all_events` instead. - - :param int number: (optional), number of events to return. Default: -1 - returns all available events - :param str etag: (optional), ETag from a previous request to the same - endpoint - :returns: generator of :class:`Event ` - - """ - return gh.all_events(number, etag) - - -@deprecated -def followers_of(username, number=-1, etag=None): - """List the followers of ``username``. - - .. deprecated:: 1.2.0 - - Use :meth:`github3.github.GitHub.followers_of` instead. - - :param str username: (required), login of the person to list the followers - of - :param int number: (optional), number of followers to return, Default: -1, - return all of them - :param str etag: (optional), ETag from a previous request to the same - endpoint - :returns: generator of :class:`User ` - - """ - return gh.followers_of(username, number, etag) if username else [] - - -@deprecated -def followed_by(username, number=-1, etag=None): - """List the people ``username`` follows. - - .. deprecated:: 1.2.0 - - Use :meth:`github3.github.GitHub.followed_by` instead. - - :param str username: (required), login of the user - :param int number: (optional), number of users being followed by username - to return. Default: -1, return all of them - :param str etag: (optional), ETag from a previous request to the same - endpoint - :returns: generator of :class:`User ` - - """ - return gh.followed_by(username, number, etag) if username else [] - - -@deprecated -def public_gists(number=-1, etag=None): - """Iterate over all public gists. - - .. deprecated:: 1.2.0 - - Use :meth:`github3.github.GitHub.public_gists` instead. - - .. versionadded:: 1.0 - - This was split from ``github3.iter_gists`` before 1.0. - - :param int number: (optional), number of gists to return. Default: -1, - return all of them - :param str etag: (optional), ETag from a previous request to the same - endpoint - :returns: generator of :class:`Gist ` - - """ - return gh.public_gists(number, etag) - - -@deprecated -def gists_by(username, number=-1, etag=None): - """Iterate over gists created by the provided username. - - .. deprecated:: 1.2.0 - - Use :meth:`github3.github.GitHub.gists_by` instead. - - :param str username: (required), if provided, get the gists for this user - instead of the authenticated user. - :param int number: (optional), number of gists to return. Default: -1, - return all of them - :param str etag: (optional), ETag from a previous request to the same - endpoint - :returns: generator of :class:`Gist ` - - """ - if username: - return gh.gists_by(username, number, etag) - return iter([]) - - -@deprecated -def issues_on( - owner, - repository, - milestone=None, - state=None, - assignee=None, - mentioned=None, - labels=None, - sort=None, - direction=None, - since=None, - number=-1, - etag=None, -): - r"""Iterate over issues on owner/repository. - - .. deprecated:: 1.2.0 - - Use :meth:`github3.github.GitHub.issues_on` instead. - - .. versionchanged:: 0.9.0 - - - The ``state`` parameter now accepts 'all' in addition to 'open' - and 'closed'. - - :param str owner: login of the owner of the repository - :param str repository: name of the repository - :param int milestone: None, '*', or ID of milestone - :param str state: accepted values: ('all', 'open', 'closed') - api-default: 'open' - :param str assignee: '*' or login of the user - :param str mentioned: login of the user - :param str labels: comma-separated list of label names, e.g., - 'bug,ui,@high' - :param str sort: accepted values: ('created', 'updated', 'comments') - api-default: created - :param str direction: accepted values: ('asc', 'desc') - api-default: desc - :param since: (optional), Only issues after this date will - be returned. This can be a `datetime` or an ISO8601 formatted - date string, e.g., 2012-05-20T23:10:27Z - :type since: datetime or string - :param int number: (optional), number of issues to return. - Default: -1 returns all issues - :param str etag: (optional), ETag from a previous request to the same - endpoint - :returns: generator of :class:`ShortIssue `\ s - - """ - if owner and repository: - return gh.issues_on( - owner, - repository, - milestone, - state, - assignee, - mentioned, - labels, - sort, - direction, - since, - number, - etag, - ) - return iter([]) - - -@deprecated -def organizations_with(username, number=-1, etag=None): - """List the organizations with ``username`` as a member. - - .. deprecated:: 1.2.0 - - Use :meth:`github3.github.GitHub.organizations_with` instead. - - :param str username: (required), login of the user - :param int number: (optional), number of orgs to return. Default: -1, - return all of the issues - :param str etag: (optional), ETag from a previous request to the same - endpoint - :returns: generator of - :class:`ShortOrganization ` - - """ - return gh.organizations_with(username, number, etag) - - -@deprecated -def repositories_by( - username, type=None, sort=None, direction=None, number=-1, etag=None -): - """List public repositories for the specified ``username``. - - .. deprecated:: 1.2.0 - - Use :meth:`github3.github.GitHub.organizations_with` instead. - - .. versionadded:: 0.6 - - .. note:: This replaces github3.iter_repos - - :param str username: (required) - :param str type: (optional), accepted values: - ('all', 'owner', 'member') - API default: 'all' - :param str sort: (optional), accepted values: - ('created', 'updated', 'pushed', 'full_name') - API default: 'created' - :param str direction: (optional), accepted values: - ('asc', 'desc'), API default: 'asc' when using 'full_name', - 'desc' otherwise - :param int number: (optional), number of repositories to return. - Default: -1 returns all repositories - :param str etag: (optional), ETag from a previous request to the same - endpoint - :returns: generator of :class:`Repository ` - objects - - """ - if login: - return gh.repositories_by( - username, type, sort, direction, number, etag - ) - return iter([]) - - -@deprecated -def starred_by(username, number=-1, etag=None): - """Iterate over repositories starred by ``username``. - - .. deprecated:: 1.2.0 - - Use :meth:`github3.github.GitHub.starred_by` instead. - - :param str username: (optional), name of user whose stars you want to see - :param int number: (optional), number of repositories to return. - Default: -1 returns all repositories - :param str etag: (optional), ETag from a previous request to the same - endpoint - :returns: generator of :class:`Repository ` - - """ - return gh.starred_by(username, number, etag) - - -@deprecated -def subscriptions_for(username, number=-1, etag=None): - """Iterate over repositories subscribed to by ``username``. - - .. deprecated:: 1.2.0 - - Use :meth:`github3.github.GitHub.subscriptions_for` instead. - - :param str username: name of user whose subscriptions you want to see - :param int number: (optional), number of repositories to return. - Default: -1 returns all repositories - :param str etag: (optional), ETag from a previous request to the same - endpoint - :returns: generator of :class:`Repository ` - - """ - return gh.subscriptions_for(username, number, etag) - - -@deprecated -def create_gist(description, files): - """Create an anonymous public gist. - - .. deprecated:: 1.2.0 - - Use :meth:`github3.github.GitHub.create_gist` instead. - - :param str description: (required), short description of the gist - :param dict files: (required), file names with associated - dictionaries for content, e.g. - {'spam.txt': {'content': 'File contents ...'}} - :returns: :class:`Gist ` - - """ - return gh.create_gist(description, files) # (No coverage) - - -@deprecated -def issue(owner, repository, number): - """Anonymously gets issue :number on :owner/:repository. - - .. deprecated:: 1.2.0 - - Use :meth:`github3.github.GitHub.issue` instead. - - :param str owner: (required), repository owner - :param str repository: (required), repository name - :param int number: (required), issue number - :returns: :class:`Issue ` - - """ - return gh.issue(owner, repository, number) - - -@deprecated -def markdown(text, mode="", context="", raw=False): - """Render an arbitrary markdown document. - - .. deprecated:: 1.2.0 - - Use :meth:`github3.github.GitHub.markdown` instead. - - :param str text: (required), the text of the document to render - :param str mode: (optional), 'markdown' or 'gfm' - :param str context: (optional), only important when using mode 'gfm', - this is the repository to use as the context for the rendering - :param bool raw: (optional), renders a document like a README.md, no gfm, - no context - :returns: str -- HTML formatted text - - """ - return gh.markdown(text, mode, context, raw) - - -@deprecated -def octocat(say=None): - """Return an easter egg from the API. - - .. deprecated:: 1.2.0 - - Use :meth:`github3.github.GitHub.octocat` instead. - - :params str say: (optional), pass in what you'd like Octocat to say - :returns: ascii art of Octocat - - """ - return gh.octocat(say) - - -@deprecated -def organization(name): - return gh.organization(name) - - -organization.__doc__ = gh.organization.__doc__ - - -@deprecated -def pull_request(owner, repository, number): - """Anonymously retrieve pull request :number on :owner/:repository. - - .. deprecated:: 1.2.0 - - Use :meth:`github3.github.GitHub.pull_request` instead. - - :param str owner: (required), repository owner - :param str repository: (required), repository name - :param int number: (required), pull request number - :returns: :class:`PullRequest ` - - """ - return gh.pull_request(owner, repository, number) - - -@deprecated -def rate_limit(): - return gh.rate_limit() - - -rate_limit.__doc__ = gh.rate_limit.__doc__ - - -@deprecated -def repository(owner, repository): - return gh.repository(owner, repository) - - -repository.__doc__ = gh.repository.__doc__ - - -@deprecated -def search_code( - query, - sort=None, - order=None, - per_page=None, - text_match=False, - number=-1, - etag=None, -): - """Find code via the code search API. - - .. deprecated:: 1.2.0 - - Use :meth:`github3.github.GitHub.search_code` instead. - - .. warning:: - - You will only be able to make 5 calls with this or other search - functions. To raise the rate-limit on this set of endpoints, create an - authenticated :class:`GitHub ` Session with - ``login``. - - The query can contain any combination of the following supported - qualifiers: - - - ``in`` Qualifies which fields are searched. With this qualifier you - can restrict the search to just the file contents, the file path, or - both. - - ``language`` Searches code based on the language it’s written in. - - ``fork`` Specifies that code from forked repositories should be - searched. Repository forks will not be searchable unless the fork - has more stars than the parent repository. - - ``size`` Finds files that match a certain size (in bytes). - - ``path`` Specifies the path that the resulting file must be at. - - ``extension`` Matches files with a certain extension. - - ``user`` or ``repo`` Limits searches to a specific user or - repository. - - For more information about these qualifiers, see: http://git.io/-DvAuA - - :param str query: (required), a valid query as described above, e.g., - ``addClass in:file language:js repo:jquery/jquery`` - :param str sort: (optional), how the results should be sorted; - option(s): ``indexed``; default: best match - :param str order: (optional), the direction of the sorted results, - options: ``asc``, ``desc``; default: ``desc`` - :param int per_page: (optional) - :param bool text_match: (optional), if True, return matching search - terms. See http://git.io/4ct1eQ for more information - :param int number: (optional), number of repositories to return. - Default: -1, returns all available repositories - :param str etag: (optional), previous ETag header value - :return: generator of :class:`CodeSearchResult - ` - """ - return gh.search_code( - query, sort, order, per_page, text_match, number, etag - ) - - -@deprecated -def search_issues( - query, - sort=None, - order=None, - per_page=None, - text_match=False, - number=-1, - etag=None, -): - """Find issues by state and keyword - - .. deprecated:: 1.2.0 - - Use :meth:`github3.github.GitHub.search_issues` instead. - - .. warning:: - - You will only be able to make 5 calls with this or other search - functions. To raise the rate-limit on this set of endpoints, create an - authenticated :class:`GitHub ` Session with - ``login``. - - The query can contain any combination of the following supported - qualifers: - - - ``type`` With this qualifier you can restrict the search to issues or - pull request only. - - ``in`` Qualifies which fields are searched. With this qualifier you can - restrict the search to just the title, body, comments, or any - combination of these. - - ``author`` Finds issues created by a certain user. - - ``assignee`` Finds issues that are assigned to a certain user. - - ``mentions`` Finds issues that mention a certain user. - - ``commenter`` Finds issues that a certain user commented on. - - ``involves`` Finds issues that were either created by a certain user, - assigned to that user, mention that user, or were commented on by that - user. - - ``state`` Filter issues based on whether they’re open or closed. - - ``labels`` Filters issues based on their labels. - - ``language`` Searches for issues within repositories that match a - certain language. - - ``created`` or ``updated`` Filters issues based on times of creation, or - when they were last updated. - - ``comments`` Filters issues based on the quantity of comments. - - ``user`` or ``repo`` Limits searches to a specific user or repository. - - For more information about these qualifiers, see: http://git.io/d1oELA - - :param str query: (required), a valid query as described above, e.g., - ``windows label:bug`` - :param str sort: (optional), how the results should be sorted; - options: ``created``, ``comments``, ``updated``; default: best match - :param str order: (optional), the direction of the sorted results, - options: ``asc``, ``desc``; default: ``desc`` - :param int per_page: (optional) - :param bool text_match: (optional), if True, return matching search - terms. See http://git.io/QLQuSQ for more information - :param int number: (optional), number of issues to return. - Default: -1, returns all available issues - :param str etag: (optional), previous ETag header value - :return: generator of :class:`IssueSearchResult - ` - """ - return gh.search_issues( - query, sort, order, per_page, text_match, number, etag - ) - - -@deprecated -def search_repositories( - query, - sort=None, - order=None, - per_page=None, - text_match=False, - number=-1, - etag=None, -): - """Find repositories via various criteria. - - .. deprecated:: 1.2.0 - - Use :meth:`github3.github.GitHub.search_repositories` instead. - - .. warning:: - - You will only be able to make 5 calls with this or other search - functions. To raise the rate-limit on this set of endpoints, create an - authenticated :class:`GitHub ` Session with - ``login``. - - The query can contain any combination of the following supported - qualifers: - - - ``in`` Qualifies which fields are searched. With this qualifier you - can restrict the search to just the repository name, description, - readme, or any combination of these. - - ``size`` Finds repositories that match a certain size (in - kilobytes). - - ``forks`` Filters repositories based on the number of forks, and/or - whether forked repositories should be included in the results at - all. - - ``created`` or ``pushed`` Filters repositories based on times of - creation, or when they were last updated. Format: ``YYYY-MM-DD``. - Examples: ``created:<2011``, ``pushed:<2013-02``, - ``pushed:>=2013-03-06`` - - ``user`` or ``repo`` Limits searches to a specific user or - repository. - - ``language`` Searches repositories based on the language they're - written in. - - ``stars`` Searches repositories based on the number of stars. - - For more information about these qualifiers, see: http://git.io/4Z8AkA - - :param str query: (required), a valid query as described above, e.g., - ``tetris language:assembly`` - :param str sort: (optional), how the results should be sorted; - options: ``stars``, ``forks``, ``updated``; default: best match - :param str order: (optional), the direction of the sorted results, - options: ``asc``, ``desc``; default: ``desc`` - :param int per_page: (optional) - :param bool text_match: (optional), if True, return matching search - terms. See http://git.io/4ct1eQ for more information - :param int number: (optional), number of repositories to return. - Default: -1, returns all available repositories - :param str etag: (optional), previous ETag header value - :return: generator of :class:`Repository ` - """ - return gh.search_repositories( - query, sort, order, per_page, text_match, number, etag - ) - - -@deprecated -def search_users( - query, - sort=None, - order=None, - per_page=None, - text_match=False, - number=-1, - etag=None, -): - """Find users via the Search API. - - .. deprecated:: 1.2.0 - - Use :meth:`github3.github.GitHub.search_users` instead. - - .. warning:: - - You will only be able to make 5 calls with this or other search - functions. To raise the rate-limit on this set of endpoints, create an - authenticated :class:`GitHub ` Session with - ``login``. - - The query can contain any combination of the following supported - qualifers: - - - - ``type`` With this qualifier you can restrict the search to just - personal accounts or just organization accounts. - - ``in`` Qualifies which fields are searched. With this qualifier you - can restrict the search to just the username, public email, full - name, or any combination of these. - - ``repos`` Filters users based on the number of repositories they - have. - - ``location`` Filter users by the location indicated in their - profile. - - ``language`` Search for users that have repositories that match a - certain language. - - ``created`` Filter users based on when they joined. - - ``followers`` Filter users based on the number of followers they - have. - - For more information about these qualifiers see: http://git.io/wjVYJw - - :param str query: (required), a valid query as described above, e.g., - ``tom repos:>42 followers:>1000`` - :param str sort: (optional), how the results should be sorted; - options: ``followers``, ``repositories``, or ``joined``; default: - best match - :param str order: (optional), the direction of the sorted results, - options: ``asc``, ``desc``; default: ``desc`` - :param int per_page: (optional) - :param bool text_match: (optional), if True, return matching search - terms. See http://git.io/_V1zRwa for more information - :param int number: (optional), number of search results to return; - Default: -1 returns all available - :param str etag: (optional), ETag header value of the last request. - :return: generator of :class:`UserSearchResult - ` - """ - return gh.search_users( - query, sort, order, per_page, text_match, number, etag - ) - - -@deprecated -def user(username): - return gh.user(username) - - -user.__doc__ = gh.user.__doc__ - - -@deprecated -def zen(): - """Return a quote from the Zen of GitHub. Yet another API Easter Egg. - - .. deprecated:: 1.2.0 - - Use :meth:`github3.github.GitHub.zen` instead. - - :returns: str - - """ - return gh.zen() diff --git a/src/github3/git.py b/src/github3/git.py index fdb796325..ef0bc82b8 100644 --- a/src/github3/git.py +++ b/src/github3/git.py @@ -6,7 +6,6 @@ """ from __future__ import unicode_literals import base64 -import warnings from json import dumps @@ -22,7 +21,6 @@ class Blob(models.GitHubCore): .. versionchanged:: 1.0.0 - The :attr:`content` is no longer forcibly coerced to bytes. - - The :attr:`decoded` is deprecated in favor of :meth:`decode_content`. This object has the following atributes @@ -54,16 +52,6 @@ def _update_attributes(self, blob): def _repr(self): return "".format(self.sha) - @property - def decoded(self): - """Compatibility shim for the deprecated attribute.""" - warnings.warn( - "The decoded attribute is deprecated. Use decode_content" - " instead.", - DeprecationWarning, - ) - return self.decode_content() - def decode_content(self): """Return the unencoded content of this blob. diff --git a/src/github3/issues/issue.py b/src/github3/issues/issue.py index 1b02804a2..38d161edc 100644 --- a/src/github3/issues/issue.py +++ b/src/github3/issues/issue.py @@ -2,7 +2,6 @@ """Module containing the Issue logic.""" from __future__ import unicode_literals -import warnings from json import dumps from uritemplate import URITemplate @@ -104,37 +103,6 @@ def add_labels(self, *args): json = self._json(self._post(url, data=args), 200) return [label.ShortLabel(lbl, self) for lbl in json] if json else [] - @requires_auth - def assign(self, username): - """Assign user ``username`` to this issue. - - .. deprecated:: 1.2.0 - - Use :meth:`github3.issues.issue.Issue.add_assignees` instead. - - This is a short cut for :meth:`~github3.issues.issue.Issue.edit`. - - :param str username: - username of the person to assign this issue to - :returns: - True if successful, False, otherwise - :rtype: - bool - """ - warnings.warn( - "This method is deprecated. Please use ``add_assignees`` " - "instead.", - DeprecationWarning, - stacklevel=2, - ) - if not username: - return False - number = self.milestone.number if self.milestone else None - labels = [str(lbl) for lbl in self.original_labels] - return self.edit( - self.title, self.body, username, self.state, number, labels - ) - @requires_auth def close(self): """Close this issue. diff --git a/src/github3/orgs.py b/src/github3/orgs.py index 323f78dba..29ec5e3f7 100644 --- a/src/github3/orgs.py +++ b/src/github3/orgs.py @@ -2,7 +2,6 @@ """This module contains all of the classes related to organizations.""" from __future__ import unicode_literals -import warnings from json import dumps from uritemplate import URITemplate @@ -35,30 +34,6 @@ def _update_attributes(self, team): def _repr(self): return "<{s.class_name} [{s.name}]>".format(s=self) - @requires_auth - def add_member(self, username): - """Add ``username`` to this team. - - .. deprecated:: 1.0.0 - - Use :meth:`add_or_update_membership` instead. - - :param str username: - the username of the user you would like to add to this team. - :returns: - True if successfully added, False otherwise - :rtype: - bool - """ - warnings.warn( - "This is no longer supported by the GitHub API, see " - "https://developer.github.com/changes/2014-09-23-one-more-week" - "-before-the-add-team-member-api-breaking-change/", - DeprecationWarning, - ) - url = self._build_url("members", username, base_url=self._api) - return self._boolean(self._put(url), 204, 404) - @requires_auth def add_or_update_membership(self, username, role="member"): """Add or update the user's membership in this team. @@ -160,51 +135,6 @@ def has_repository(self, repository): url = self._build_url("repos", repository, base_url=self._api) return self._boolean(self._get(url), 204, 404) - @requires_auth - def invite(self, username): - """Invite the user to join this team. - - .. deprecated:: 1.2.0 - - Use :meth:`add_or_update_membership` instead. - - This returns a dictionary like so:: - - {'state': 'pending', 'url': 'https://api.github.com/teams/...'} - - :param str username: - (required), login of user to invite to join this team. - :returns: - dictionary of the invitation response - :rtype: - dict - """ - warnings.warn( - "This method is deprecated. Please use " - "``add_or_update_membership`` instead.", - DeprecationWarning, - ) - return self.add_or_update_membership(username) - - @requires_auth - def is_member(self, username): - """Check if ``login`` is a member of this team. - - :param str username: - (required), username name of the user - :returns: - True if the user is a member, False otherwise - :rtype: - bool - """ - warnings.warn( - "This method is deprecated. Please use " - "``membership_for`` instead.", - DeprecationWarning, - ) - url = self._build_url("members", username, base_url=self._api) - return self._boolean(self._get(url), 204, 404) - @requires_auth def members(self, role=None, number=-1, etag=None): """Iterate over the members of this team. @@ -273,30 +203,6 @@ def membership_for(self, username): json = self._json(self._get(url), 200) return json or {} - @requires_auth - def remove_member(self, username): - """Remove ``username`` from this team. - - .. deprecated:: 1.0.0 - - Use :meth:`revoke_membership` instead. - - :param str username: - (required), username of the member to remove - :returns: - True if successful, False otherwise - :rtype: - bool - """ - warnings.warn( - "This is no longer supported by the GitHub API, see " - "https://developer.github.com/changes/2014-09-23-one-more-week" - "-before-the-add-team-member-api-breaking-change/", - DeprecationWarning, - ) - url = self._build_url("members", username, base_url=self._api) - return self._boolean(self._delete(url), 204, 404) - @requires_auth def revoke_membership(self, username): """Revoke this user's team membership. @@ -474,53 +380,6 @@ def _repr(self): s=self, display=display_name ) - @requires_auth - def add_member(self, username, team_id): - """Add ``username`` to ``team`` and thereby to this organization. - - .. warning:: - - This method is no longer valid. To add a member to a team, you - must now retrieve the team directly, and use the ``invite`` - method. - - .. warning:: - - This method is no longer valid. To add a member to a team, you - must now retrieve the team directly, and use the ``invite`` - method. - - Any user that is to be added to an organization, must be added - to a team as per the GitHub api. - - .. versionchanged:: 1.0 - - The second parameter used to be ``team`` but has been changed to - ``team_id``. This parameter is now required to be an integer to - improve performance of this method. - - :param str username: - (required), login name of the user to be added - :param int team_id: - (required), team id - :returns: - True if successful, False otherwise - :rtype: - bool - """ - warnings.warn( - "This is no longer supported by the GitHub API, see " - "https://developer.github.com/changes/2014-09-23-one-more-week" - "-before-the-add-team-member-api-breaking-change/", - DeprecationWarning, - ) - - if int(team_id) < 0: - return False - - url = self._build_url("teams", str(team_id), "members", str(username)) - return self._boolean(self._put(url), 204, 404) - @requires_auth def add_or_update_membership(self, username, role="member"): """Add a member or update their role. @@ -979,29 +838,6 @@ def all_events(self, username, number=-1, etag=None): url = self._build_url("users", username, "events", "orgs", self.login) return self._iter(int(number), url, Event, etag=etag) - def events(self, number=-1, etag=None): - """Iterate over public events for this org (deprecated). - - .. deprecated:: 1.0.0 - - Use :meth:`public_events` instead. - - :param int number: - (optional), number of events to return. Default: -1 iterates over - all events available. - :param str etag: - (optional), ETag from a previous request to the same endpoint - :returns: - generator of events - :rtype: - :class:`~github3.events.Event` - """ - warnings.warn( - "This method is deprecated. Please use ``public_events`` instead.", - DeprecationWarning, - ) - return self.public_events(number, etag=etag) - def public_events(self, number=-1, etag=None): """Iterate over public events for this org. diff --git a/tests/integration/test_issue.py b/tests/integration/test_issue.py index 756a79c53..2b3a68d16 100644 --- a/tests/integration/test_issue.py +++ b/tests/integration/test_issue.py @@ -38,18 +38,6 @@ def test_add_labels(self): for label in labels: assert isinstance(label, github3.issues.label.ShortLabel) - def test_assign(self): - """Test the ability to assign a user to an issue.""" - self.auto_login() - cassette_name = self.cassette_name("assign") - with self.recorder.use_cassette(cassette_name): - issue = self.gh.issue( - username="sigmavirus24", repository="github3.py", number=497 - ) - assigned = issue.assign("itsmemattchung") - - assert assigned is True - def test_comment(self): """Test the ability to retrieve an issue comment.""" cassette_name = self.cassette_name("comment") diff --git a/tests/integration/test_orgs.py b/tests/integration/test_orgs.py index 1bc8cfa76..43b99e705 100644 --- a/tests/integration/test_orgs.py +++ b/tests/integration/test_orgs.py @@ -31,15 +31,6 @@ def get_team(self, organization, team_name="Do Not Delete"): return team - def test_add_member(self): - """Test the ability to add a member to an organization.""" - self.auto_login() - cassette_name = self.cassette_name("add_member") - with self.recorder.use_cassette(cassette_name): - o = self.get_organization() - team = self.get_team(o) - assert o.add_member("esacteksab", team.id) is True - def test_add_repository(self): """Test the ability to add a repository to an organization.""" self.auto_login() @@ -153,16 +144,6 @@ def test_all_events(self): for event in o.all_events(username="gh3test"): assert isinstance(event, github3.events.Event) - def test_events(self): - """Test retrieving an organization's public event stream.""" - cassette_name = self.cassette_name("public_events") - with self.recorder.use_cassette(cassette_name): - o = self.get_organization() - - for event in o.events(): - assert isinstance(event, github3.events.Event) - assert isinstance(event.as_json(), str) - def test_public_events(self): """Test retrieving an organization's public event stream.""" cassette_name = self.cassette_name("public_events") @@ -275,19 +256,6 @@ def test_publicize_member(self): assert o.publicize_member("omgjlk") is True - def test_remove_member(self): - """Test the ability to remove a member of the organization.""" - self.auto_login() - cassette_name = self.cassette_name("remove_member") - with self.recorder.use_cassette(cassette_name): - o = self.get_organization() - team = self.get_team(o) - - # First add the user - assert o.add_member("gh3test", team.id) is True - # Now remove them - assert o.remove_member("gh3test") is True - def test_remove_repository(self): """Test the ability to remove a repository from a team.""" self.auto_login() diff --git a/tests/integration/test_orgs_team.py b/tests/integration/test_orgs_team.py index bebefc126..793433cb3 100644 --- a/tests/integration/test_orgs_team.py +++ b/tests/integration/test_orgs_team.py @@ -28,13 +28,6 @@ def get_team(self, organization="github3py", id=189901): assert isinstance(t, github3.orgs.Team) return t - def test_add_member(self): - """Show a user can add a member to a team.""" - cassette_name = self.cassette_name("add_member") - with self.recorder.use_cassette(cassette_name): - team = self.get_team() - assert team.add_member("esacteksab") is True - def test_add_repository(self): """Show that a user can add a repository to a team.""" cassette_name = self.cassette_name("add_repository") @@ -73,13 +66,6 @@ def test_has_repository(self): t = self.get_team() assert t.has_repository("github3py/urllib3") is True - def test_is_member(self): - """Show that a user can check if another user is a team member.""" - cassette_name = self.cassette_name("is_member") - with self.recorder.use_cassette(cassette_name): - t = self.get_team() - assert t.is_member("sigmavirus24") is True - def test_members(self): """Show that a user can retrieve a team's members.""" cassette_name = self.cassette_name("members") @@ -105,13 +91,6 @@ def test_repositories(self): for repository in t.repositories(): assert isinstance(repository, github3.repos.ShortRepository) - def test_remove_member(self): - """Show a user can remove a member from a team.""" - cassette_name = self.cassette_name("remove_member") - with self.recorder.use_cassette(cassette_name): - team = self.get_team() - assert team.remove_member("esacteksab") is True - def test_remove_repository(self): """Show a user can remove a repository from a team.""" cassette_name = self.cassette_name("remove_repository") diff --git a/tests/unit/test_api.py b/tests/unit/test_api.py index 19136ed96..50ac6efcb 100644 --- a/tests/unit/test_api.py +++ b/tests/unit/test_api.py @@ -8,59 +8,6 @@ class TestAPI(unittest.TestCase): """All tests for the github3.api module.""" - def setUp(self): - self.mocked_github = unittest.mock.patch( - "github3.api.gh", autospec=github3.GitHub - ) - self.gh = self.mocked_github.start() - - def tearDown(self): - self.mocked_github.stop() - - def test_all_events(self): - """Show that github3.all_events proxies to GitHub.""" - github3.all_events() - self.gh.all_events.assert_called_once_with(-1, None) - - def test_public_gists(self): - """Show that github3.public_gists proxies to GitHub.""" - github3.public_gists() - self.gh.public_gists.assert_called_once_with(-1, None) - - def test_all_repositories(self): - """Show that github3.all_repositories proxies to GitHub.""" - github3.all_repositories() - # TODO(Ian): When you fix GitHub, fix this test too - self.gh.all_repositories.assert_called_once_with(-1, None) - - def test_all_users(self): - """Show that github3.all_users proxies to GitHub.""" - github3.all_users() - # TODO(Ian): Fix this when GitHub changes - self.gh.all_users.assert_called_once_with(-1, None) - - def test_authorize(self): - """Show that github3.authorize proxies to GitHub.""" - args = ("login", "password", ["scope"], "note", "url.com", "", "") - with unittest.mock.patch("github3.api.GitHub") as gh: - github3.authorize(*args) - gh().authorize.assert_called_once_with(*args) - - def test_authorize_with_github_argument(self): - """Show that github3.authorize can use an existing GitHub object.""" - args = ("login", "password", ["scope"], "note", "url.com", "", "") - github = unittest.mock.Mock(spec_set=github3.GitHub) - with unittest.mock.patch("github3.api.GitHub") as gh: - github3.authorize(*args, github=github) - gh().assert_not_called() - github.authorize.assert_called_once_with(*args) - - def test_create_gist(self): - """Show that github3.create_gist proxies to GitHub.""" - args = ("description", {"files": ["file"]}) - github3.create_gist(*args) - self.gh.create_gist.assert_called_once_with(*args) - def test_enterprise_login(self): """Show that github3.enterprise_login returns GitHubEnterprise.""" args = ("login", "password", None, "https://url.com/", None) @@ -71,43 +18,6 @@ def test_enterprise_login(self): assert isinstance(g, github3.GitHubEnterprise) login.assert_called_once_with("login", "password", None, None) - def test_followers_of(self): - """Show that github3.followers_of proxies to GitHub.""" - github3.followers_of("login") - self.gh.followers_of.assert_called_with("login", -1, None) - - def test_followed_by(self): - """Show that github3.followed_by proxies to GitHub.""" - github3.followed_by("login") - self.gh.followed_by.assert_called_with("login", -1, None) - - def test_gist(self): - """Show that github3.gist proxies to GitHub.""" - gist_id = 123 - github3.gist(gist_id) - self.gh.gist.assert_called_once_with(gist_id) - - def test_gists_by(self): - """Show that github3.gists_by proxies to GitHub.""" - github3.gists_by("username") - self.gh.gists_by.assert_called_once_with("username", -1, None) - - def test_gitignore_template(self): - """Show that github3.gitignore_template proxies to GitHub.""" - language = "Python" - github3.gitignore_template(language) - self.gh.gitignore_template.assert_called_once_with(language) - - def test_gitignore_templates(self): - """Show that github3.gitignore_templates proxies to GitHub.""" - github3.gitignore_templates() - assert self.gh.gitignore_templates.called is True - - def test_issue(self): - """Show that github3.issue proxies to GitHub.""" - github3.issue("sigmavirus24", "github3.py", 100) - self.gh.issue.assert_called_with("sigmavirus24", "github3.py", 100) - def test_login(self): """Show that github3.login proxies to GitHub.""" args = ("login", "password", None, None) @@ -116,88 +26,3 @@ def test_login(self): assert isinstance(g, github3.GitHub) assert not isinstance(g, github3.GitHubEnterprise) login.assert_called_once_with(*args) - - def test_markdown(self): - """Show that github3.markdown proxies to GitHub.""" - github3.markdown("text", "", "", False) - self.gh.markdown.assert_called_once_with("text", "", "", False) - - def test_octocat(self): - """Show that github3.octocat proxies to GitHub.""" - github3.octocat() - self.gh.octocat.assert_called_once_with(None) - - def test_organization(self): - """Show that github3.organization proxies to GitHub.""" - github3.organization("orgname") - self.gh.organization.assert_called_once_with("orgname") - - def test_organizations_with(self): - """Show that github3.organizations_with proxies to GitHub.""" - args = ("login", -1, None) - github3.organizations_with(*args) - self.gh.organizations_with.assert_called_with(*args) - - def test_pull_request(self): - """Show that github3.pull_request proxies to GitHub.""" - github3.pull_request("sigmavirus24", "github3.py", 24) - self.gh.pull_request.assert_called_once_with( - "sigmavirus24", "github3.py", 24 - ) - - def test_rate_limit(self): - """Show that github3.rate_limit proxies to GitHub.""" - github3.rate_limit() - self.gh.rate_limit.assert_called_once_with() - - def test_repository(self): - """Show that github3.repository proxies to GitHub.""" - github3.repository("sigmavirus24", "github3.py") - self.gh.repository.assert_called_once_with( - "sigmavirus24", "github3.py" - ) - - def test_issues_on(self): - """Show that github3.issues_on proxies to GitHub.""" - args = ( - "owner", - "repository", - None, - None, - None, - None, - None, - None, - None, - None, - -1, - None, - ) - github3.issues_on(*args) - self.gh.issues_on.assert_called_with(*args) - - def test_repositories_by(self): - """Show that github3.repositories_by proxies to GitHub.""" - args = ("login", None, None, None, -1, None) - github3.repositories_by("login") - self.gh.repositories_by.assert_called_with(*args) - - def test_starred(self): - """Show that github3.starred proxies to GitHub.""" - github3.starred_by("login") - self.gh.starred_by.assert_called_with("login", -1, None) - - def test_subcriptions_for(self): - """Show that github3.subscriptions_for proxies to GitHub.""" - github3.subscriptions_for("login") - self.gh.subscriptions_for.assert_called_with("login", -1, None) - - def test_user(self): - """Show that github3.user proxies to GitHub.""" - github3.user("sigmavirus24") - self.gh.user.assert_called_once_with("sigmavirus24") - - def test_zen(self): - """Show that github3.zen proxies to GitHub.""" - github3.zen() - assert self.gh.zen.called is True diff --git a/tests/unit/test_issues_issue.py b/tests/unit/test_issues_issue.py index 45027a2b6..9f2be8363 100644 --- a/tests/unit/test_issues_issue.py +++ b/tests/unit/test_issues_issue.py @@ -50,10 +50,6 @@ def test_add_labels(self): """Verify that adding a label requires authentication.""" self.assert_requires_auth(self.instance.add_labels, "enhancement") - def test_assign(self): - """Verify that assigning an issue requires authentication.""" - self.assert_requires_auth(self.instance.assign, "sigmavirus24") - def test_close(self): """Verify that closing an issue requires authentication.""" self.assert_requires_auth(self.instance.close) @@ -112,26 +108,6 @@ def test_add_labels(self): self.instance.add_labels("enhancement") self.post_called_with(url_for("labels"), data=["enhancement"]) - def test_assign(self): - """Verify the request for assigning an issue.""" - with unittest.mock.patch.object(Issue, "edit") as edit: - edit.return_value = True - labels = [str(label) for label in self.instance.original_labels] - self.instance.assign(username="sigmavirus24") - edit.assert_called_once_with( - self.instance.title, - self.instance.body, - "sigmavirus24", - self.instance.state, - self.instance.milestone.number, - labels, - ) - - def test_assign_empty_username(self): - """Verify the request when assigning a username.""" - self.instance.assign("") - assert self.session.patch.called is False - def test_close(self): """Verify the request for closing an issue.""" self.instance.close() diff --git a/tests/unit/test_orgs.py b/tests/unit/test_orgs.py index 76f28effe..ef8256906 100644 --- a/tests/unit/test_orgs.py +++ b/tests/unit/test_orgs.py @@ -1,5 +1,4 @@ """Organization unit tests.""" -import unittest.mock import pytest from github3 import GitHubError @@ -26,14 +25,6 @@ class TestOrganization(helper.UnitHelper): described_class = Organization example_data = get_org_example_data() - def test_add_member(self): - """Show that an authenticated user can add a member to an org.""" - self.instance.add_member("user", 10) - - self.session.put.assert_called_once_with( - "https://api.github.com/teams/10/members/user" - ) - def test_add_repository(self): """Show that one can add a repository to an organization.""" self.instance.add_repository("name-of-repo", 10) @@ -296,11 +287,6 @@ class TestOrganizationRequiresAuth(helper.UnitRequiresAuthenticationHelper): described_class = Organization example_data = get_org_example_data() - def test_add_member(self): - """Show that one must be authenticated to add a member to an org.""" - with pytest.raises(GitHubError): - self.instance.add_member("user", 10) - def test_add_repository(self): """Show that one must be authenticated to add a repo to an org.""" with pytest.raises(GitHubError): @@ -404,21 +390,6 @@ def test_all_events(self): headers={}, ) - @unittest.mock.patch("warnings.warn") - def test_events(self, warn_mock): - """Show that one can iterate over an organization's events.""" - i = self.instance.events() - self.get_next(i) - - self.session.get.assert_called_once_with( - url_for("events"), params={"per_page": 100}, headers={} - ) - - warn_mock.assert_called_once_with( - "This method is deprecated. Please use ``public_events`` instead.", - DeprecationWarning, - ) - def test_members(self): """Show that one can iterate over all members.""" i = self.instance.members() diff --git a/tests/unit/test_orgs_team.py b/tests/unit/test_orgs_team.py index 0f79f6067..c1ceb405e 100644 --- a/tests/unit/test_orgs_team.py +++ b/tests/unit/test_orgs_team.py @@ -14,12 +14,6 @@ class TestTeam(helper.UnitHelper): described_class = Team example_data = get_team_example_data() - def test_add_member(self): - """Show that one can add a member to an organization team.""" - self.instance.add_member("user") - - self.session.put.assert_called_once_with(url_for("members/user")) - def test_add_repository(self): """Show that one can add a repository to an organization team.""" self.instance.add_repository("name-of-repo") @@ -52,20 +46,6 @@ def test_has_repository(self): self.session.get.assert_called_once_with(url_for("repos/org/repo")) - def test_is_member(self): - """Show that a user can check if another user is a team member.""" - self.instance.is_member("username") - - self.session.get.assert_called_once_with(url_for("members/username")) - - def test_remove_member(self): - """Show that a user can check if another user is a team member.""" - self.instance.remove_member("username") - - self.session.delete.assert_called_once_with( - url_for("members/username") - ) - def test_remove_repository(self): """Show that a user can remove a repository from a team.""" self.instance.remove_repository("repo") @@ -77,11 +57,6 @@ class TestTeamRequiresAuth(helper.UnitRequiresAuthenticationHelper): described_class = Team example_data = get_team_example_data() - def test_add_member_requires_auth(self): - """Show that adding a repo to a team requires authentication.""" - with pytest.raises(GitHubError): - self.instance.add_member("user") - def test_add_repository_requires_auth(self): """Show that adding a repo to a team requires authentication.""" with pytest.raises(GitHubError): @@ -102,16 +77,6 @@ def test_has_repository_requires_auth(self): with pytest.raises(GitHubError): self.instance.has_repository("org/repo") - def test_is_member_requires_auth(self): - """Show that checking a user's team membership requires auth.""" - with pytest.raises(GitHubError): - self.instance.is_member("user") - - def test_remove_member_requires_auth(self): - """Show that removing a team member requires authentication.""" - with pytest.raises(GitHubError): - self.instance.remove_member("user") - def test_remove_repository_requires_auth(self): """Show that removing a repo from a team requires authentication.""" with pytest.raises(GitHubError): From 442f687a8e855421f294fb576bef36cdf07ee7e5 Mon Sep 17 00:00:00 2001 From: staticdev Date: Sat, 2 Jan 2021 21:52:24 +0100 Subject: [PATCH 2/3] Remove unused imports on documentation --- docs/source/api-reference/api.rst | 73 ------------------------------- 1 file changed, 73 deletions(-) diff --git a/docs/source/api-reference/api.rst b/docs/source/api-reference/api.rst index 5c4c59494..857ed4028 100644 --- a/docs/source/api-reference/api.rst +++ b/docs/source/api-reference/api.rst @@ -35,79 +35,6 @@ To use the API anonymously, you can also create a new gh = GitHub() -Or you can use the following functions: - -Anonymous Functions -------------------- - -.. autofunction:: github3.authorize - -Deprecated Functions -~~~~~~~~~~~~~~~~~~~~ - -.. warning:: - - Due to GitHub's anonymous rate limits, it's strongly advised that you don't - use these functions. - -.. autofunction:: github3.create_gist - -.. autofunction:: github3.gist - -.. autofunction:: github3.gitignore_template - -.. autofunction:: github3.gitignore_templates - -.. autofunction:: github3.issue - -.. autofunction:: github3.issues_on - -.. autofunction:: github3.all_repositories - -.. autofunction:: github3.all_users - -.. autofunction:: github3.all_events - -.. autofunction:: github3.followers_of - -.. autofunction:: github3.followed_by - -.. autofunction:: github3.public_gists - -.. autofunction:: github3.gists_by - -.. autofunction:: github3.organizations_with - -.. autofunction:: github3.repositories_by - -.. autofunction:: github3.starred_by - -.. autofunction:: github3.subscriptions_for - -.. autofunction:: github3.markdown - -.. autofunction:: github3.octocat - -.. autofunction:: github3.organization - -.. autofunction:: github3.pull_request - -.. autofunction:: github3.rate_limit - -.. autofunction:: github3.repository - -.. autofunction:: github3.search_code - -.. autofunction:: github3.search_issues - -.. autofunction:: github3.search_repositories - -.. autofunction:: github3.search_users - -.. autofunction:: github3.user - -.. autofunction:: github3.zen - Enterprise Use ============== From 4881f53bdce617e64c47a6d6a035a45e2cd90841 Mon Sep 17 00:00:00 2001 From: staticdev Date: Sun, 3 Jan 2021 19:12:34 +0100 Subject: [PATCH 3/3] Fix release notes --- docs/source/release-notes/2.0.0.rst | 78 ++++++++++++++--------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/docs/source/release-notes/2.0.0.rst b/docs/source/release-notes/2.0.0.rst index 3697ac325..33c755df9 100644 --- a/docs/source/release-notes/2.0.0.rst +++ b/docs/source/release-notes/2.0.0.rst @@ -15,43 +15,43 @@ Removals Removal of already deprecated code on version 1.x: - - ``Api#all_events`` use ``github.GitHub.all_events`` - - ``Api#all_repositories`` use ``github.GitHub.all_repositories`` - - ``Api#all_users`` use ``github.GitHub.all_users`` - - ``Api#authorize`` use ``github.GitHub.authorize`` - - ``Api#create_gist`` use ``github.GitHub.create_gist`` - - ``Api#emojis`` - - ``Api#followed_by`` use ``github.GitHub.followed_by`` - - ``Api#followers_of`` use ``github.GitHub.followers_of`` - - ``Api#gist`` use ``github.GitHub.gist`` - - ``Api#gists_by`` use ``github.GitHub.gists_by`` - - ``Api#gitignore_template`` use ``github.GitHub.gitignore_template`` - - ``Api#gitignore_templates`` use ``github.GitHub.gitignore_templates`` - - ``Api#issue`` use ``github.GitHub.issue`` - - ``Api#issues_on`` use ``github.GitHub.issues_on`` - - ``Api#markdown`` use ``github.GitHub.markdown`` - - ``Api#octocat`` use ``github.GitHub.octocat`` - - ``Api#organization`` - - ``Api#organizations_with`` use ``github.GitHub.organizations_with`` - - ``Api#public_gists`` use ``github.GitHub.public_gists`` - - ``Api#pull_request`` use ``github.GitHub.pull_request`` - - ``Api#rate_limit`` - - ``Api#repositories_by`` use ``github.GitHub.organizations_with`` - - ``Api#repository`` - - ``Api#search_code`` use ``github.GitHub.search_code`` - - ``Api#search_issues`` use ``github.GitHub.search_issues`` - - ``Api#search_repositories`` use ``github.GitHub.search_repositories`` - - ``Api#search_users`` use ``github.GitHub.search_users`` - - ``Api#starred_by`` use ``github.GitHub.starred_by`` - - ``Api#subscriptions_for`` use ``github.GitHub.subscriptions_for`` - - ``Api#user`` - - ``Api#zen`` use ``github.GitHub.zen`` - - ``Git#Blob.decoded`` use ``Git#Blob.decode_content`` - - ``Team#is_member`` use ``Login#is_member`` - - ``Team#add_member`` use ``Team#add_or_update_membership`` - - ``Team#invite`` use ``Team#add_or_update_membership`` - - ``Team#remove_member`` use ``Team#add_or_update_membership`` - - ``Organization#add_member`` add ``username`` to ``team``. - - ``Organization#events`` use ``Organization#public_events`` - - ``Issue#assign`` use ``issues.issue.Issue.add_assignees`` +- ``github3.api.all_events`` use ``github.GitHub.all_events`` +- ``github3.api.all_repositories`` use ``github.GitHub.all_repositories`` +- ``github3.api.all_users`` use ``github.GitHub.all_users`` +- ``github3.api.authorize`` use ``github.GitHub.authorize`` +- ``github3.api.create_gist`` use ``github.GitHub.create_gist`` +- ``github3.api.emojis`` +- ``github3.api.followed_by`` use ``github.GitHub.followed_by`` +- ``github3.api.followers_of`` use ``github.GitHub.followers_of`` +- ``github3.api.gist`` use ``github.GitHub.gist`` +- ``github3.api.gists_by`` use ``github.GitHub.gists_by`` +- ``github3.api.gitignore_template`` use ``github.GitHub.gitignore_template`` +- ``github3.api.gitignore_templates`` use ``github.GitHub.gitignore_templates`` +- ``github3.api.issue`` use ``github.GitHub.issue`` +- ``github3.api.issues_on`` use ``github.GitHub.issues_on`` +- ``github3.api.markdown`` use ``github.GitHub.markdown`` +- ``github3.api.octocat`` use ``github.GitHub.octocat`` +- ``github3.api.organization`` +- ``github3.api.organizations_with`` use ``github.GitHub.organizations_with`` +- ``github3.api.public_gists`` use ``github.GitHub.public_gists`` +- ``github3.api.pull_request`` use ``github.GitHub.pull_request`` +- ``github3.api.rate_limit`` +- ``github3.api.repositories_by`` use ``github.GitHub.organizations_with`` +- ``github3.api.repository`` +- ``github3.api.search_code`` use ``github.GitHub.search_code`` +- ``github3.api.search_issues`` use ``github.GitHub.search_issues`` +- ``github3.api.search_repositories`` use ``github.GitHub.search_repositories`` +- ``github3.api.search_users`` use ``github.GitHub.search_users`` +- ``github3.api.starred_by`` use ``github.GitHub.starred_by`` +- ``github3.api.subscriptions_for`` use ``github.GitHub.subscriptions_for`` +- ``github3.api.user`` +- ``github3.api.zen`` use ``github.GitHub.zen`` +- ``Git#Blob.decoded`` use ``Git#Blob.decode_content`` +- ``Team#is_member`` use ``Login#is_member`` +- ``Team#add_member`` use ``Team#add_or_update_membership`` +- ``Team#invite`` use ``Team#add_or_update_membership`` +- ``Team#remove_member`` use ``Team#add_or_update_membership`` +- ``Organization#add_member`` add ``username`` to ``team``. +- ``Organization#events`` use ``Organization#public_events`` +- ``Issue#assign`` use ``issues.issue.Issue.add_assignees``