-
Notifications
You must be signed in to change notification settings - Fork 410
Add support for repository topics #859
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
Merged
sigmavirus24
merged 1 commit into
sigmavirus24:develop
from
jacquerie:add-support-for-repository-topics
Jul 13, 2018
Merged
Changes from all commits
Commits
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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # -*- coding: utf-8 -*- | ||
| """Topics related logic.""" | ||
| from __future__ import unicode_literals | ||
|
|
||
| from .. import models | ||
|
|
||
|
|
||
| class Topics(models.GitHubCore): | ||
| """Representation of the repository topics. | ||
|
|
||
| .. attribute:: names | ||
|
|
||
| The names of the topics. | ||
| """ | ||
|
|
||
| def _update_attributes(self, topics): | ||
| self.names = topics['names'] | ||
|
|
||
| def _repr(self): | ||
| return '<Topics [{0}]>'.format(', '.join(self.names)) | ||
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| {"http_interactions": [{"request": {"body": {"string": "", "encoding": "utf-8"}, "headers": {"Accept-Encoding": ["gzip, deflate"], "Accept": ["application/vnd.github.v3.full+json"], "User-Agent": ["github3.py/1.1.0"], "Accept-Charset": ["utf-8"], "Connection": ["keep-alive"], "Content-Type": ["application/json"], "Authorization": ["token <AUTH_TOKEN>"]}, "method": "GET", "uri": "https://api.github.com/repos/jacquerie/flask-shell-bpython"}, "response": {"body": {"string": "", "base64_string": "H4sIAAAAAAAAA62Yb3PiNhDGvwrD2wYM5D8zmWs7vblJp1zbG669yRtG2AIryJJPkqHEk+/eR5KNbSaXOInfJGC0Pz1e7653lfdZ1J9ejM8vJ9eTy5O+kBFd2Ev92W8fd3/y33n46fqBfPuyDcVmMpt/PZ3db/afdzc3fSwmCcXKFSd6M9Ax5XywTPcmlgI/rjLOF8WKexJ+z6hiNHh6rdwJqvrTvM/lmgkgDwYAWTWnV+PJ1agp7++Lf7595uH97Gw2vz2b/eIkkS0xRC0yxUGJjUn1NAj8RT0ZrpmJs2WmqQqlMFSYYSiTIAs8/sP25gyItSogzg24cARLWcHxxoDpoK43Ngk/EuD3devrK1eSc7mD/bHeZ7cIDmbWyw7BxPotCJjlgTQxhcNwG4/25pk2r5TjTPLA/kPkWIjGI1A0ep2kwgiCbDA85oGiqXS0bKlDxVLDpHiltIYpUFKtiWAP5A0omGoQrKhXinAmMKVbBNwrbb1NHqSKbUm4t+5QNKRsC+++hXdkDJzZpzaHv+L5W18zQxckSmwSrgjX9PGk7/Y2WOQunCCrWsX3D1I9ooeHiW2/0JSTkPYQg72IrkjGTc+ViJ4rJz1kTEJE1NshcXukp1nCOFE9KWhPZUIggHu//uUqzhDqV1JtDjKfzVr3TKpc/IFWy3vhgbUAIV+BgbwN3XdAs5Q8wN8i2UJUALKUihj5UiFpI7aBy4P6Vxt9hpKkg5twGOBiKbvwsMMAx7TOaKvEaOMKR9NBmYMiS5a+SLbJvDYbeA50E63ZWlDagWcPqDwoa/pSERHGXcBLUh74Ty4iyLoD2ZYC2JLLZQc0vG8Dh8oDHRP/XjOLbpRatiU10IquOpJtSQe0UZ3EhJNsUQcwXrYG4dGB5pIU5IWnORHrjKy7YB9QiAzbHqzJw4vNUpu8q1gA205QsWXWVfmsaFa1711QN7pwdQWr0K4ter7TauWSWpPlnJIk7KVmpQ23ADWSpTO4jevjDez3l/usttItKQ+qyu9fMMUe7/d68YYpNdd3KgaUDsKmJAX5Tykxsa2G2DAlir7/BgpQkC8JesXhcJjHlLgZIKGqkxrgOQASFcboe9+vOS9J6MsSYtyksbKSI0weXJKoA58fUMD6h/x+3Z5Tj5EUI3YHYh2mzkWTTbVBk90BvGLVdxDSsBUL2wxibVK1gcs/aCZCekI4P0GUGxYyxD1GBfuM0SrTLnzmObglHIH4qYxTpEAHDlPUk/LAD9MRRiS576im1WC2DCiKwS5aEINRbDIaXwxGF4PJaD6+no4m0/HZHdZkadRYczUYXQ7Gp3MsOL2YjtyaNMO0VmGw5HwwwpKr6eR0OrqyS1CqiwzAJxzJPHUi8tQUZo9aYK51XJn/XBlPnz1ZKoxDjlA+yr/X7r89fse2BUB8LBOaoiPyp0maPeDTeNxoaUKZCTyE05P+jhj06mgXqktlGwR7P+taJtELXxD6U6MyO5bjSqrkPQ2Nrl+rSlFt4Y5tWMPQNmyH0dnPvZWAhCkli0M1gWJxKMY4ICsOBWRKRSGoVD5BtrGQCo3bze3wC/1oKiC+OBWc3c57fxQr4I00+q84ebyd28BrHuE1j8QKsA4KYO3UMryYf+L3d/+eP9zNPz70cYDh52/r3JrK/hT6Smc7zxfnDws/2lixRBt3KpJSlcDZ9vzJ3kpxPuLdbmO/9KQtpP4zdkX5kbuF/p4RxK57i5XL/C/uEnxlG63mL4rat2nTRlCzwzFCLSrqrWXxqMaP/wPrRXVIzxUAAA==", "encoding": "utf-8"}, "headers": {"X-XSS-Protection": ["1; mode=block"], "Content-Security-Policy": ["default-src 'none'"], "Access-Control-Expose-Headers": ["ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval"], "Transfer-Encoding": ["chunked"], "Last-Modified": ["Fri, 13 Jul 2018 02:36:04 GMT"], "Access-Control-Allow-Origin": ["*"], "X-Frame-Options": ["deny"], "Status": ["200 OK"], "X-GitHub-Request-Id": ["9A4E:7DB6:8AB0F67:11AD54DE:5B48110E"], "ETag": ["W/\"7107ffa6cfdb88d58106f3cb7649cbfb\""], "Date": ["Fri, 13 Jul 2018 02:40:15 GMT"], "X-RateLimit-Remaining": ["4992"], "Strict-Transport-Security": ["max-age=31536000; includeSubdomains; preload"], "Server": ["GitHub.com"], "X-OAuth-Scopes": ["public_repo"], "X-GitHub-Media-Type": ["github.v3; param=full; format=json"], "X-Content-Type-Options": ["nosniff"], "Content-Encoding": ["gzip"], "X-Runtime-rack": ["0.057600"], "Vary": ["Accept, Authorization, Cookie, X-GitHub-OTP"], "X-RateLimit-Limit": ["5000"], "Cache-Control": ["private, max-age=60, s-maxage=60"], "Referrer-Policy": ["origin-when-cross-origin, strict-origin-when-cross-origin"], "Content-Type": ["application/json; charset=utf-8"], "X-Accepted-OAuth-Scopes": ["repo"], "X-RateLimit-Reset": ["1531452513"]}, "status": {"message": "OK", "code": 200}, "url": "https://api.github.com/repos/jacquerie/flask-shell-bpython"}, "recorded_at": "2018-07-13T02:40:15"}, {"request": {"body": {"string": "{\"names\": [\"flask\", \"bpython\", \"python\"]}", "encoding": "utf-8"}, "headers": {"Content-Length": ["41"], "Accept-Encoding": ["gzip, deflate"], "Accept": ["application/vnd.github.mercy-preview+json"], "User-Agent": ["github3.py/1.1.0"], "Accept-Charset": ["utf-8"], "Connection": ["keep-alive"], "Content-Type": ["application/json"], "Authorization": ["token <AUTH_TOKEN>"]}, "method": "PUT", "uri": "https://api.github.com/repos/jacquerie/flask-shell-bpython/topics"}, "response": {"body": {"string": "", "base64_string": "H4sIAAAAAAAAA6tWykvMTS1WsopWSstJLM5W0lFKKqgsycjPA7KgjNhaAGF4mvYmAAAA", "encoding": "utf-8"}, "headers": {"X-XSS-Protection": ["1; mode=block"], "Content-Security-Policy": ["default-src 'none'"], "Access-Control-Expose-Headers": ["ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval"], "Transfer-Encoding": ["chunked"], "Access-Control-Allow-Origin": ["*"], "X-Frame-Options": ["deny"], "Status": ["200 OK"], "X-GitHub-Request-Id": ["9A4E:7DB6:8AB0F76:11AD54FF:5B48110F"], "ETag": ["W/\"8ae34e77215a659579641afb01a6a267\""], "Date": ["Fri, 13 Jul 2018 02:40:15 GMT"], "X-RateLimit-Remaining": ["4991"], "Strict-Transport-Security": ["max-age=31536000; includeSubdomains; preload"], "Server": ["GitHub.com"], "X-OAuth-Scopes": ["public_repo"], "X-GitHub-Media-Type": ["github.mercy-preview; format=json"], "X-Content-Type-Options": ["nosniff"], "Content-Encoding": ["gzip"], "X-Runtime-rack": ["0.105731"], "Vary": ["Accept, Authorization, Cookie, X-GitHub-OTP"], "X-RateLimit-Limit": ["5000"], "Cache-Control": ["private, max-age=60, s-maxage=60"], "Referrer-Policy": ["origin-when-cross-origin, strict-origin-when-cross-origin"], "Content-Type": ["application/json; charset=utf-8"], "X-Accepted-OAuth-Scopes": ["repo"], "X-RateLimit-Reset": ["1531452513"]}, "status": {"message": "OK", "code": 200}, "url": "https://api.github.com/repos/jacquerie/flask-shell-bpython/topics"}, "recorded_at": "2018-07-13T02:40:15"}], "recorded_with": "betamax/0.8.1"} |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| {"http_interactions": [{"request": {"body": {"string": "", "encoding": "utf-8"}, "headers": {"Accept-Encoding": ["gzip, deflate"], "Accept": ["application/vnd.github.v3.full+json"], "User-Agent": ["github3.py/1.1.0"], "Accept-Charset": ["utf-8"], "Connection": ["keep-alive"], "Content-Type": ["application/json"]}, "method": "GET", "uri": "https://api.github.com/repos/jacquerie/flask-shell-bpython"}, "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21RAbplSz979ACSL5nKJX7Pf7ecyonwESplupAQUHQKrDGH3v+zXnOxL6soRaP2ksnOQIk4dQNGrB53sUsMUhv193wanHSIoRuwWxHlPnoslmxqLJbgFeseo7SGX5godNBrEmqXqAyz8YLkPWpUJ0EeWWhxxxj1HBnTFaZdaGzwoOXglXIMVUJhhSoAWHaVaQclIM0xFGJLVpqabVYK4MaIbBLppRi1FsNBhe9gaXvdFgOrwZD0bj4fk91mRpdLDmuje46g3PplhwPhgPL9yaNMO0VmGw5KI3wJLr8ehsPLh2S1CqywzAb7iSee5G5LkpzF21wNyYuDL/uTIev3izVBqHAqF8lH+n7r86/sY2BUB8rBKWoiMqbpMM3+K34fCgpQlVJnEIZ91gTS16dbQL1aNdGwT7YtZ1TGpmRUEIxlZnbizHk1SrBxZaU39WlaLawjV/5AeGrmHbj87F3FsJSLjWqrxUkygW+2KMC7LyUkClTJaCdspHyDYeMmnwurkbfqEfTQXEl7eCk7tp549yBbyRRv+VN493Uxd4h1d4h1diJdiQEli7tQwvp5/Ew/0/F9v76cdtgAuMYv52zq2pDMbQt3O293x5/zArRhsnlhrrb0Uks2vM8LUjqfd1pZ+GT/8D5BPhF0wVAAA=", "encoding": "utf-8"}, "headers": {"X-XSS-Protection": ["1; mode=block"], "Content-Security-Policy": ["default-src 'none'"], "Access-Control-Expose-Headers": ["ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval"], "Transfer-Encoding": ["chunked"], "Last-Modified": ["Fri, 13 Jul 2018 02:40:15 GMT"], "Access-Control-Allow-Origin": ["*"], "X-Frame-Options": ["deny"], "Status": ["200 OK"], "X-GitHub-Request-Id": ["9AC2:7DB7:B5F3A84:1538CBC2:5B481450"], "ETag": ["W/\"d029658658da401bc28144b5257f64c6\""], "Date": ["Fri, 13 Jul 2018 02:54:09 GMT"], "X-RateLimit-Remaining": ["57"], "Strict-Transport-Security": ["max-age=31536000; includeSubdomains; preload"], "Server": ["GitHub.com"], "X-GitHub-Media-Type": ["github.v3; param=full; format=json"], "X-Content-Type-Options": ["nosniff"], "Content-Encoding": ["gzip"], "X-Runtime-rack": ["0.046247"], "Vary": ["Accept"], "X-RateLimit-Limit": ["60"], "Cache-Control": ["public, max-age=60, s-maxage=60"], "Referrer-Policy": ["origin-when-cross-origin, strict-origin-when-cross-origin"], "Content-Type": ["application/json; charset=utf-8"], "X-RateLimit-Reset": ["1531452470"]}, "status": {"message": "OK", "code": 200}, "url": "https://api.github.com/repos/jacquerie/flask-shell-bpython"}, "recorded_at": "2018-07-13T02:54:09"}, {"request": {"body": {"string": "", "encoding": "utf-8"}, "headers": {"Accept-Encoding": ["gzip, deflate"], "Accept": ["application/vnd.github.mercy-preview+json"], "User-Agent": ["github3.py/1.1.0"], "Accept-Charset": ["utf-8"], "Connection": ["keep-alive"], "Content-Type": ["application/json"]}, "method": "GET", "uri": "https://api.github.com/repos/jacquerie/flask-shell-bpython/topics"}, "response": {"body": {"string": "", "base64_string": "H4sIAAAAAAAAA6tWykvMTS1WsopWSstJLM5W0lFKKqgsycjPA7KgjNhaAGF4mvYmAAAA", "encoding": "utf-8"}, "headers": {"X-XSS-Protection": ["1; mode=block"], "Content-Security-Policy": ["default-src 'none'"], "Access-Control-Expose-Headers": ["ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval"], "Transfer-Encoding": ["chunked"], "Access-Control-Allow-Origin": ["*"], "X-Frame-Options": ["deny"], "Status": ["200 OK"], "X-GitHub-Request-Id": ["9AC2:7DB7:B5F3AD4:1538CC0C:5B481451"], "ETag": ["W/\"61a23bad4105517f68226fb33bebcb2d\""], "Date": ["Fri, 13 Jul 2018 02:54:09 GMT"], "X-RateLimit-Remaining": ["56"], "Strict-Transport-Security": ["max-age=31536000; includeSubdomains; preload"], "Server": ["GitHub.com"], "X-GitHub-Media-Type": ["github.mercy-preview; format=json"], "X-Content-Type-Options": ["nosniff"], "Content-Encoding": ["gzip"], "X-Runtime-rack": ["0.048572"], "Vary": ["Accept"], "X-RateLimit-Limit": ["60"], "Cache-Control": ["public, max-age=60, s-maxage=60"], "Referrer-Policy": ["origin-when-cross-origin, strict-origin-when-cross-origin"], "Content-Type": ["application/json; charset=utf-8"], "X-RateLimit-Reset": ["1531452470"]}, "status": {"message": "OK", "code": 200}, "url": "https://api.github.com/repos/jacquerie/flask-shell-bpython/topics"}, "recorded_at": "2018-07-13T02:54:09"}], "recorded_with": "betamax/0.8.1"} |
This file contains hidden or 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 hidden or 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
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.
WDYT of adding an
__iter__and a__len__, so that essentiallyTopicsbecomes a facade of itsnamesattribute? I didn't do it outright as this pattern (AFAICT) is not used elsewhere in the code base.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.
I'd rather not. As you mentioned we don't have that precedent anywhere else.
Further, if GitHub adds more attributes to this endpoint (which I'm guess they will based on the structure of the JSON [1]) then iterating over the Topics object will be more confusing.
It almost feels like we shouldn't have an object for this, but again, I suspect they'll be expanding the response without telling anyone.
[1] I'm assuming that they haven't given up on consistency for the API behaviour which is what this looks like on first blush.
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.
Good point, that's an excellent argument for avoiding this magic 👍