INSTRUCTION
stringlengths
1
8.43k
RESPONSE
stringlengths
75
104k
: calls: DELETE/ user/ subscriptions/: owner/: repo <http:// developer. github. com/ v3/ activity/ watching > _: param subscription:: class: github. Repository. Repository: rtype: None
def remove_from_subscriptions(self, subscription): """ :calls: `DELETE /user/subscriptions/:owner/:repo <http://developer.github.com/v3/activity/watching>`_ :param subscription: :class:`github.Repository.Repository` :rtype: None """ assert isinstance(subscription, github....
: calls: DELETE/ repos/: owner/: repo/ subscription <http:// developer. github. com/ v3/ activity/ watching > _: param watched:: class: github. Repository. Repository: rtype: None
def remove_from_watched(self, watched): """ :calls: `DELETE /repos/:owner/:repo/subscription <http://developer.github.com/v3/activity/watching>`_ :param watched: :class:`github.Repository.Repository` :rtype: None """ assert isinstance(watched, github.Repository.Repository...
: calls: PATCH/ user/ repository_invitations/: invitation_id <https:// developer. github. com/ v3/ repos/ invitations/ >: param invitation:: class: github. Invitation. Invitation or int: rtype: None
def accept_invitation(self, invitation): """ :calls: `PATCH /user/repository_invitations/:invitation_id <https://developer.github.com/v3/repos/invitations/>` :param invitation: :class:`github.Invitation.Invitation` or int :rtype: None """ assert isinstance(invitation, git...
: calls: POST/ user/ migrations _: param repos: list or tuple of str: param lock_repositories: bool: param exclude_attachments: bool: rtype:: class: github. Migration. Migration
def create_migration(self, repos, lock_repositories=github.GithubObject.NotSet, exclude_attachments=github.GithubObject.NotSet): """ :calls: `POST /user/migrations`_ :param repos: list or tuple of str :param lock_repositories: bool :param exclude_attachments: bool :rtype:...
: calls: GET/ installation/ repositories <https:// developer. github. com/ v3/ integrations/ installations/ #list - repositories > _: rtype:: class: github. PaginatedList. PaginatedList of: class: github. Repository. Repository
def get_repos(self): """ :calls: `GET /installation/repositories <https://developer.github.com/v3/integrations/installations/#list-repositories>`_ :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Repository.Repository` """ url_parameters = dict() ret...
: calls: PATCH/ repos/: owner/: repo/ pulls/ comments/: number <http:// developer. github. com/ v3/ pulls/ comments > _: param body: string: rtype: None
def edit(self, body): """ :calls: `PATCH /repos/:owner/:repo/pulls/comments/:number <http://developer.github.com/v3/pulls/comments>`_ :param body: string :rtype: None """ assert isinstance(body, (str, unicode)), body post_parameters = { "body": body, ...
: calls: PATCH/ authorizations/: id <http:// developer. github. com/ v3/ oauth > _: param scopes: list of string: param add_scopes: list of string: param remove_scopes: list of string: param note: string: param note_url: string: rtype: None
def edit(self, scopes=github.GithubObject.NotSet, add_scopes=github.GithubObject.NotSet, remove_scopes=github.GithubObject.NotSet, note=github.GithubObject.NotSet, note_url=github.GithubObject.NotSet): """ :calls: `PATCH /authorizations/:id <http://developer.github.com/v3/oauth>`_ :param scopes:...
: calls: GET/ projects/ columns/: column_id/ cards <https:// developer. github. com/ v3/ projects/ cards/ #list - project - cards > _: rtype:: class: github. PaginatedList. PaginatedList of: class: github. ProjectCard. ProjectCard: param archived_state: string
def get_cards(self, archived_state=github.GithubObject.NotSet): """ :calls: `GET /projects/columns/:column_id/cards <https://developer.github.com/v3/projects/cards/#list-project-cards>`_ :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.ProjectCard.ProjectCard` :param...
: calls: POST/ projects/ columns/: column_id/ cards <https:// developer. github. com/ v3/ projects/ cards/ #create - a - project - card > _: param note: string: param content_id: integer: param content_type: string
def create_card(self, note=github.GithubObject.NotSet, content_id=github.GithubObject.NotSet, content_type=github.GithubObject.NotSet): """ :calls: `POST /projects/columns/:column_id/cards <https://developer.github.com/v3/projects/cards/#create-a-project-card>`_ ...
: calls: POST/ repos/: owner/: repo/ commits/: sha/ comments <http:// developer. github. com/ v3/ repos/ comments > _: param body: string: param line: integer: param path: string: param position: integer: rtype:: class: github. CommitComment. CommitComment
def create_comment(self, body, line=github.GithubObject.NotSet, path=github.GithubObject.NotSet, position=github.GithubObject.NotSet): """ :calls: `POST /repos/:owner/:repo/commits/:sha/comments <http://developer.github.com/v3/repos/comments>`_ :param body: string :param line: integer ...
: calls: POST/ repos/: owner/: repo/ statuses/: sha <http:// developer. github. com/ v3/ repos/ statuses > _: param state: string: param target_url: string: param description: string: param context: string: rtype:: class: github. CommitStatus. CommitStatus
def create_status(self, state, target_url=github.GithubObject.NotSet, description=github.GithubObject.NotSet, context=github.GithubObject.NotSet): """ :calls: `POST /repos/:owner/:repo/statuses/:sha <http://developer.github.com/v3/repos/statuses>`_ :param state: string :param target_url:...
: calls: GET/ repos/: owner/: repo/ statuses/: ref <http:// developer. github. com/ v3/ repos/ statuses > _: rtype:: class: github. PaginatedList. PaginatedList of: class: github. CommitStatus. CommitStatus
def get_statuses(self): """ :calls: `GET /repos/:owner/:repo/statuses/:ref <http://developer.github.com/v3/repos/statuses>`_ :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.CommitStatus.CommitStatus` """ return github.PaginatedList.PaginatedList( ...
: calls: GET/ repos/: owner/: repo/ commits/: ref/ status/ <http:// developer. github. com/ v3/ repos/ statuses > _: rtype:: class: github. CommitCombinedStatus. CommitCombinedStatus
def get_combined_status(self): """ :calls: `GET /repos/:owner/:repo/commits/:ref/status/ <http://developer.github.com/v3/repos/statuses>`_ :rtype: :class:`github.CommitCombinedStatus.CommitCombinedStatus` """ headers, data = self._requester.requestJsonAndCheck( "GET",...
: calls: DELETE/ reactions/: id <https:// developer. github. com/ v3/ reactions/ #delete - a - reaction > _: rtype: None
def delete(self): """ :calls: `DELETE /reactions/:id <https://developer.github.com/v3/reactions/#delete-a-reaction>`_ :rtype: None """ self._requester.requestJsonAndCheck( "DELETE", self._parentUrl("") + "/reactions/" + str(self.id), headers={'...
: calls: GET/ repos/: owner/: repo/ branches/: branch/ protection <https:// developer. github. com/ v3/ repos/ branches > _
def get_protection(self): """ :calls: `GET /repos/:owner/:repo/branches/:branch/protection <https://developer.github.com/v3/repos/branches>`_ """ headers, data = self._requester.requestJsonAndCheck( "GET", self.protection_url, headers={'Accept': Consts...
: calls: PUT/ repos/: owner/: repo/ branches/: branch/ protection <https:// developer. github. com/ v3/ repos/ branches > _: strict: bool: contexts: list of strings: enforce_admins: bool: dismissal_users: list of strings: dismissal_teams: list of strings: dismiss_stale_reviews: bool: require_code_owner_reviews: bool: r...
def edit_protection(self, strict=github.GithubObject.NotSet, contexts=github.GithubObject.NotSet, enforce_admins=github.GithubObject.NotSet, dismissal_users=github.GithubObject.NotSet, dismissal_teams=github.GithubObject.NotSet, dismiss_stale_reviews=github.GithubObject.NotSet, require_code_owner_reviews=github.GithubO...
: calls: GET/ repos/: owner/: repo/ branches/: branch/ protection/ required_status_checks <https:// developer. github. com/ v3/ repos/ branches > _: rtype:: class: github. RequiredStatusChecks. RequiredStatusChecks
def get_required_status_checks(self): """ :calls: `GET /repos/:owner/:repo/branches/:branch/protection/required_status_checks <https://developer.github.com/v3/repos/branches>`_ :rtype: :class:`github.RequiredStatusChecks.RequiredStatusChecks` """ headers, data = self._requester.r...
: calls: PATCH/ repos/: owner/: repo/ branches/: branch/ protection/ required_status_checks <https:// developer. github. com/ v3/ repos/ branches > _: strict: bool: contexts: list of strings
def edit_required_status_checks(self, strict=github.GithubObject.NotSet, contexts=github.GithubObject.NotSet): """ :calls: `PATCH /repos/:owner/:repo/branches/:branch/protection/required_status_checks <https://developer.github.com/v3/repos/branches>`_ :strict: bool :contexts: list of str...
: calls: GET/ repos/: owner/: repo/ branches/: branch/ protection/ required_pull_request_reviews <https:// developer. github. com/ v3/ repos/ branches > _: rtype:: class: github. RequiredPullRequestReviews. RequiredPullRequestReviews
def get_required_pull_request_reviews(self): """ :calls: `GET /repos/:owner/:repo/branches/:branch/protection/required_pull_request_reviews <https://developer.github.com/v3/repos/branches>`_ :rtype: :class:`github.RequiredPullRequestReviews.RequiredPullRequestReviews` """ headers...
: calls: PATCH/ repos/: owner/: repo/ branches/: branch/ protection/ required_pull_request_reviews <https:// developer. github. com/ v3/ repos/ branches > _: dismissal_users: list of strings: dismissal_teams: list of strings: dismiss_stale_reviews: bool: require_code_owner_reviews: bool: required_approving_review_count...
def edit_required_pull_request_reviews(self, dismissal_users=github.GithubObject.NotSet, dismissal_teams=github.GithubObject.NotSet, dismiss_stale_reviews=github.GithubObject.NotSet, require_code_owner_reviews=github.GithubObject.NotSet, required_approving_review_count=github.GithubObject.NotSet): """ :...
: calls: GET/ repos/: owner/: repo/ branches/: branch/ protection/ enforce_admins <https:// developer. github. com/ v3/ repos/ branches > _: rtype: bool
def get_admin_enforcement(self): """ :calls: `GET /repos/:owner/:repo/branches/:branch/protection/enforce_admins <https://developer.github.com/v3/repos/branches>`_ :rtype: bool """ headers, data = self._requester.requestJsonAndCheck( "GET", self.protection...
: calls: GET/ repos/: owner/: repo/ branches/: branch/ protection/ restrictions/ users <https:// developer. github. com/ v3/ repos/ branches > _: rtype:: class: github. PaginatedList. PaginatedList of: class: github. NamedUser. NamedUser
def get_user_push_restrictions(self): """ :calls: `GET /repos/:owner/:repo/branches/:branch/protection/restrictions/users <https://developer.github.com/v3/repos/branches>`_ :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser` """ return githu...
: calls: GET/ repos/: owner/: repo/ branches/: branch/ protection/ restrictions/ teams <https:// developer. github. com/ v3/ repos/ branches > _: rtype:: class: github. PaginatedList. PaginatedList of: class: github. Team. Team
def get_team_push_restrictions(self): """ :calls: `GET /repos/:owner/:repo/branches/:branch/protection/restrictions/teams <https://developer.github.com/v3/repos/branches>`_ :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Team.Team` """ return github.Paginate...
: calls: POST/ repos/: owner/: repo/ branches/: branch/ protection/ restrictions <https:// developer. github. com/ v3/ repos/ branches > _: users: list of strings
def edit_user_push_restrictions(self, *users): """ :calls: `POST /repos/:owner/:repo/branches/:branch/protection/restrictions <https://developer.github.com/v3/repos/branches>`_ :users: list of strings """ assert all(isinstance(element, (str, unicode)) or isinstance(element, (str,...
: calls: POST/ repos/: owner/: repo/ branches/: branch/ protection/ restrictions <https:// developer. github. com/ v3/ repos/ branches > _: teams: list of strings
def edit_team_push_restrictions(self, *teams): """ :calls: `POST /repos/:owner/:repo/branches/:branch/protection/restrictions <https://developer.github.com/v3/repos/branches>`_ :teams: list of strings """ assert all(isinstance(element, (str, unicode)) or isinstance(element, (str,...
: calls: GET/ repos/: owner/: repo/ branches/: branch/ protection/ required_signatures <https:// developer. github. com/ v3/ repos/ branches >
def get_required_signatures(self): """ :calls: `GET /repos/:owner/:repo/branches/:branch/protection/required_signatures <https://developer.github.com/v3/repos/branches>` """ headers, data = self._requester.requestJsonAndCheck( "GET", self.protection_url + "/requir...
: calls: PATCH/ repos/: owner/: repo/ hooks/: id <http:// developer. github. com/ v3/ repos/ hooks > _: param name: string: param config: dict: param events: list of string: param add_events: list of string: param remove_events: list of string: param active: bool: rtype: None
def edit(self, name, config, events=github.GithubObject.NotSet, add_events=github.GithubObject.NotSet, remove_events=github.GithubObject.NotSet, active=github.GithubObject.NotSet): """ :calls: `PATCH /repos/:owner/:repo/hooks/:id <http://developer.github.com/v3/repos/hooks>`_ :param name: string...
: calls: GET/ users/: user/ followers <http:// developer. github. com/ v3/ users/ followers > _: rtype:: class: github. PaginatedList. PaginatedList of: class: github. NamedUser. NamedUser
def get_followers(self): """ :calls: `GET /users/:user/followers <http://developer.github.com/v3/users/followers>`_ :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser` """ return github.PaginatedList.PaginatedList( NamedUser, ...
: calls: GET/ users/: user/ following <http:// developer. github. com/ v3/ users/ followers > _: rtype:: class: github. PaginatedList. PaginatedList of: class: github. NamedUser. NamedUser
def get_following(self): """ :calls: `GET /users/:user/following <http://developer.github.com/v3/users/followers>`_ :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser` """ return github.PaginatedList.PaginatedList( NamedUser, ...
: calls: GET/ users/: user/ keys <http:// developer. github. com/ v3/ users/ keys > _: rtype:: class: github. PaginatedList. PaginatedList of: class: github. UserKey. UserKey
def get_keys(self): """ :calls: `GET /users/:user/keys <http://developer.github.com/v3/users/keys>`_ :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.UserKey.UserKey` """ return github.PaginatedList.PaginatedList( github.UserKey.UserKey, ...
: calls: GET/ users/: user/ events/ public <http:// developer. github. com/ v3/ activity/ events > _: rtype:: class: github. PaginatedList. PaginatedList of: class: github. Event. Event
def get_public_events(self): """ :calls: `GET /users/:user/events/public <http://developer.github.com/v3/activity/events>`_ :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Event.Event` """ return github.PaginatedList.PaginatedList( github.Event.E...
: calls: GET/ users/: user/ received_events/ public <http:// developer. github. com/ v3/ activity/ events > _: rtype:: class: github. PaginatedList. PaginatedList of: class: github. Event. Event
def get_public_received_events(self): """ :calls: `GET /users/:user/received_events/public <http://developer.github.com/v3/activity/events>`_ :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Event.Event` """ return github.PaginatedList.PaginatedList( ...
: calls: GET/ users/: user/ received_events <http:// developer. github. com/ v3/ activity/ events > _: rtype:: class: github. PaginatedList. PaginatedList of: class: github. Event. Event
def get_received_events(self): """ :calls: `GET /users/:user/received_events <http://developer.github.com/v3/activity/events>`_ :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Event.Event` """ return github.PaginatedList.PaginatedList( github.Eve...
: calls: GET/ users/: user/ repos <http:// developer. github. com/ v3/ repos > _: param type: string: param sort: string: param direction: string: rtype:: class: github. PaginatedList. PaginatedList of: class: github. Repository. Repository
def get_repos(self, type=github.GithubObject.NotSet, sort=github.GithubObject.NotSet, direction=github.GithubObject.NotSet): """ :calls: `GET /users/:user/repos <http://developer.github.com/v3/repos>`_ :param type: string :param sort: string :param direction: st...
: calls: GET/ users/: user/ subscriptions <http:// developer. github. com/ v3/ activity/ watching > _: rtype:: class: github. PaginatedList. PaginatedList of: class: github. Repository. Repository
def get_subscriptions(self): """ :calls: `GET /users/:user/subscriptions <http://developer.github.com/v3/activity/watching>`_ :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Repository.Repository` """ return github.PaginatedList.PaginatedList( gi...
: calls: GET/ users/: user/ watched <http:// developer. github. com/ v3/ activity/ starring > _: rtype:: class: github. PaginatedList. PaginatedList of: class: github. Repository. Repository
def get_watched(self): """ :calls: `GET /users/:user/watched <http://developer.github.com/v3/activity/starring>`_ :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Repository.Repository` """ return github.PaginatedList.PaginatedList( github.Reposit...
: calls: PATCH/ repos/: owner/: repo/ releases/: release_id <https:// developer. github. com/ v3/ repos/ releases/ #edit - a - release > _: rtype:: class: github. GitRelease. GitRelease
def update_release(self, name, message, draft=False, prerelease=False, tag_name=github.GithubObject.NotSet, target_commitish=github.GithubObject.NotSet): """ :calls: `PATCH /repos/:owner/:repo/releases/:release_id <https://developer.github.com/v3/repos/relea...
: calls: POST https:// <upload_url >/ repos/: owner/: repo/ releases/: release_id/ assets?name = foo. zip <https:// developer. github. com/ v3/ repos/ releases/ #upload - a - release - asset > _: rtype:: class: github. GitReleaseAsset. GitReleaseAsset
def upload_asset(self, path, label="", content_type=""): """ :calls: `POST https://<upload_url>/repos/:owner/:repo/releases/:release_id/assets?name=foo.zip <https://developer.github.com/v3/repos/releases/#upload-a-release-asset>`_ :rtype: :class:`github.GitReleaseAsset.GitReleaseAsset` "...
: calls: GET/ repos/: owner/: repo/ releases/: release_id/ assets <https:// developer. github. com/ v3/ repos/ releases/ #list - assets - for - a - release > _: rtype:: class: github. PaginatedList. PaginatedList
def get_assets(self): """ :calls: `GET /repos/:owner/:repo/releases/:release_id/assets <https://developer.github.com/v3/repos/releases/#list-assets-for-a-release>`_ :rtype: :class:`github.PaginatedList.PaginatedList` """ return github.PaginatedList.PaginatedList( gith...
: calls: PATCH/ repos/: owner/: repo/ git/ refs/: ref <http:// developer. github. com/ v3/ git/ refs > _: param sha: string: param force: bool: rtype: None
def edit(self, sha, force=github.GithubObject.NotSet): """ :calls: `PATCH /repos/:owner/:repo/git/refs/:ref <http://developer.github.com/v3/git/refs>`_ :param sha: string :param force: bool :rtype: None """ assert isinstance(sha, (str, unicode)), sha asser...
This function sets up a very simple logging configuration ( log everything on standard output ) that is useful for troubleshooting.
def enable_console_debug_logging(): # pragma no cover (Function useful only outside test environment) """ This function sets up a very simple logging configuration (log everything on standard output) that is useful for troubleshooting. """ logger = logging.getLogger("github") logger.setLevel(loggi...
First value is requests remaining second value is request limit.
def rate_limiting(self): """ First value is requests remaining, second value is request limit. :type: (int, int) """ remaining, limit = self.__requester.rate_limiting if limit < 0: self.get_rate_limit() return self.__requester.rate_limiting
Unix timestamp indicating when rate limiting will reset.
def rate_limiting_resettime(self): """ Unix timestamp indicating when rate limiting will reset. :type: int """ if self.__requester.rate_limiting_resettime == 0: self.get_rate_limit() return self.__requester.rate_limiting_resettime
Rate limit status for different resources ( core/ search/ graphql ).
def get_rate_limit(self): """ Rate limit status for different resources (core/search/graphql). :calls: `GET /rate_limit <http://developer.github.com/v3/rate_limit>`_ :rtype: :class:`github.RateLimit.RateLimit` """ headers, data = self.__requester.requestJsonAndCheck( ...
: calls: GET/ license/: license <https:// developer. github. com/ v3/ licenses/ #get - an - individual - license > _: param key: string: rtype:: class: github. License. License
def get_license(self, key=github.GithubObject.NotSet): """ :calls: `GET /license/:license <https://developer.github.com/v3/licenses/#get-an-individual-license>`_ :param key: string :rtype: :class:`github.License.License` """ assert isinstance(key, (str, unicode)), key ...
: calls: GET/ licenses <https:// developer. github. com/ v3/ licenses/ #list - all - licenses > _: rtype:: class: github. PaginatedList. PaginatedList of: class: github. License. License
def get_licenses(self): """ :calls: `GET /licenses <https://developer.github.com/v3/licenses/#list-all-licenses>`_ :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.License.License` """ url_parameters = dict() return github.PaginatedList.PaginatedLis...
: calls: GET/ users/: user <http:// developer. github. com/ v3/ users > _ or GET/ user <http:// developer. github. com/ v3/ users > _: param login: string: rtype:: class: github. NamedUser. NamedUser
def get_user(self, login=github.GithubObject.NotSet): """ :calls: `GET /users/:user <http://developer.github.com/v3/users>`_ or `GET /user <http://developer.github.com/v3/users>`_ :param login: string :rtype: :class:`github.NamedUser.NamedUser` """ assert login is github....
: calls: GET/ orgs/: org <http:// developer. github. com/ v3/ orgs > _: param login: string: rtype:: class: github. Organization. Organization
def get_organization(self, login): """ :calls: `GET /orgs/:org <http://developer.github.com/v3/orgs>`_ :param login: string :rtype: :class:`github.Organization.Organization` """ assert isinstance(login, (str, unicode)), login headers, data = self.__requester.reque...
: calls: GET/ organizations <http:// developer. github. com/ v3/ orgs#list - all - organizations > _: param since: integer: rtype:: class: github. PaginatedList. PaginatedList of: class: github. Organization. Organization
def get_organizations(self, since=github.GithubObject.NotSet): """ :calls: `GET /organizations <http://developer.github.com/v3/orgs#list-all-organizations>`_ :param since: integer :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Organization.Organization` """...
: calls: GET/ repos/: owner/: repo <http:// developer. github. com/ v3/ repos > _ or GET/ repositories/: id <http:// developer. github. com/ v3/ repos > _: rtype:: class: github. Repository. Repository
def get_repo(self, full_name_or_id, lazy=False): """ :calls: `GET /repos/:owner/:repo <http://developer.github.com/v3/repos>`_ or `GET /repositories/:id <http://developer.github.com/v3/repos>`_ :rtype: :class:`github.Repository.Repository` """ assert isinstance(full_name_or_id, (...
: calls: GET/ repositories <http:// developer. github. com/ v3/ repos/ #list - all - public - repositories > _: param since: integer: rtype:: class: github. PaginatedList. PaginatedList of: class: github. Repository. Repository
def get_repos(self, since=github.GithubObject.NotSet): """ :calls: `GET /repositories <http://developer.github.com/v3/repos/#list-all-public-repositories>`_ :param since: integer :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Repository.Repository` """ ...
: calls: GET/ projects/: project_id <https:// developer. github. com/ v3/ projects/ #get - a - project > _: rtype:: class: github. Project. Project: param id: integer
def get_project(self, id): """ :calls: `GET /projects/:project_id <https://developer.github.com/v3/projects/#get-a-project>`_ :rtype: :class:`github.Project.Project` :param id: integer """ headers, data = self.__requester.requestJsonAndCheck( "GET", ...
: calls: GET/ gists/: id <http:// developer. github. com/ v3/ gists > _: param id: string: rtype:: class: github. Gist. Gist
def get_gist(self, id): """ :calls: `GET /gists/:id <http://developer.github.com/v3/gists>`_ :param id: string :rtype: :class:`github.Gist.Gist` """ assert isinstance(id, (str, unicode)), id headers, data = self.__requester.requestJsonAndCheck( "GET", ...
: calls: GET/ search/ users <http:// developer. github. com/ v3/ search > _: param query: string: param sort: string ( followers repositories joined ): param order: string ( asc desc ): param qualifiers: keyword dict query qualifiers: rtype:: class: github. PaginatedList. PaginatedList of: class: github. NamedUser. Nam...
def search_users(self, query, sort=github.GithubObject.NotSet, order=github.GithubObject.NotSet, **qualifiers): """ :calls: `GET /search/users <http://developer.github.com/v3/search>`_ :param query: string :param sort: string ('followers', 'repositories', 'joined') :param order: ...
: calls: GET/ search/ code <http:// developer. github. com/ v3/ search > _: param query: string: param sort: string ( indexed ): param order: string ( asc desc ): param highlight: boolean ( True False ): param qualifiers: keyword dict query qualifiers: rtype:: class: github. PaginatedList. PaginatedList of: class: gith...
def search_code(self, query, sort=github.GithubObject.NotSet, order=github.GithubObject.NotSet, highlight=False, **qualifiers): """ :calls: `GET /search/code <http://developer.github.com/v3/search>`_ :param query: string :param sort: string ('indexed') :param order: string ('asc'...
: calls: GET/ search/ commits <http:// developer. github. com/ v3/ search > _: param query: string: param sort: string ( author - date committer - date ): param order: string ( asc desc ): param qualifiers: keyword dict query qualifiers: rtype:: class: github. PaginatedList. PaginatedList of: class: github. Commit. Com...
def search_commits(self, query, sort=github.GithubObject.NotSet, order=github.GithubObject.NotSet, **qualifiers): """ :calls: `GET /search/commits <http://developer.github.com/v3/search>`_ :param query: string :param sort: string ('author-date', 'committer-date') :param order: st...
: calls: GET/ search/ topics <http:// developer. github. com/ v3/ search > _: param query: string: param qualifiers: keyword dict query qualifiers: rtype:: class: github. PaginatedList. PaginatedList of: class: github. Topic. Topic
def search_topics(self, query, **qualifiers): """ :calls: `GET /search/topics <http://developer.github.com/v3/search>`_ :param query: string :param qualifiers: keyword dict query qualifiers :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Topic.Topic` ...
: calls: POST/ markdown <http:// developer. github. com/ v3/ markdown > _: param text: string: param context:: class: github. Repository. Repository: rtype: string
def render_markdown(self, text, context=github.GithubObject.NotSet): """ :calls: `POST /markdown <http://developer.github.com/v3/markdown>`_ :param text: string :param context: :class:`github.Repository.Repository` :rtype: string """ assert isinstance(text, (str, ...
: calls: GET/ hooks/: name <http:// developer. github. com/ v3/ repos/ hooks/ > _: param name: string: rtype:: class: github. HookDescription. HookDescription
def get_hook(self, name): """ :calls: `GET /hooks/:name <http://developer.github.com/v3/repos/hooks/>`_ :param name: string :rtype: :class:`github.HookDescription.HookDescription` """ assert isinstance(name, (str, unicode)), name headers, attributes = self.__reque...
: calls: GET/ hooks <http:// developer. github. com/ v3/ repos/ hooks/ > _: rtype: list of: class: github. HookDescription. HookDescription
def get_hooks(self): """ :calls: `GET /hooks <http://developer.github.com/v3/repos/hooks/>`_ :rtype: list of :class:`github.HookDescription.HookDescription` """ headers, data = self.__requester.requestJsonAndCheck( "GET", "/hooks" ) return ...
: calls: GET/ gitignore/ templates/: name <http:// developer. github. com/ v3/ gitignore > _: rtype:: class: github. GitignoreTemplate. GitignoreTemplate
def get_gitignore_template(self, name): """ :calls: `GET /gitignore/templates/:name <http://developer.github.com/v3/gitignore>`_ :rtype: :class:`github.GitignoreTemplate.GitignoreTemplate` """ assert isinstance(name, (str, unicode)), name headers, attributes = self.__requ...
Creates an object from raw_data previously obtained by: attr: github. GithubObject. GithubObject. raw_data and optionaly headers previously obtained by: attr: github. GithubObject. GithubObject. raw_headers.
def create_from_raw_data(self, klass, raw_data, headers={}): """ Creates an object from raw_data previously obtained by :attr:`github.GithubObject.GithubObject.raw_data`, and optionaly headers previously obtained by :attr:`github.GithubObject.GithubObject.raw_headers`. :param klass: the...
Dumps ( pickles ) a PyGithub object to a file - like object. Some effort is made to not pickle sensitive informations like the Github credentials used in the: class: Github instance. But NO EFFORT is made to remove sensitive information from the object s attributes.
def dump(self, obj, file, protocol=0): """ Dumps (pickles) a PyGithub object to a file-like object. Some effort is made to not pickle sensitive informations like the Github credentials used in the :class:`Github` instance. But NO EFFORT is made to remove sensitive information from the ob...
Creates a signed JWT valid for 60 seconds by default. The expiration can be extended beyond this to a maximum of 600 seconds.
def create_jwt(self, expiration=60): """ Creates a signed JWT, valid for 60 seconds by default. The expiration can be extended beyond this, to a maximum of 600 seconds. :param expiration: int :return: """ now = int(time.time()) payload = { "ia...
Get an access token for the given installation id. POSTs https:// api. github. com/ app/ installations/ <installation_id >/ access_tokens: param user_id: int: param installation_id: int: return:: class: github. InstallationAuthorization. InstallationAuthorization
def get_access_token(self, installation_id, user_id=None): """ Get an access token for the given installation id. POSTs https://api.github.com/app/installations/<installation_id>/access_tokens :param user_id: int :param installation_id: int :return: :class:`github.Install...
: calls: PATCH/ repos/: owner/: repo/ labels/: name <http:// developer. github. com/ v3/ issues/ labels > _: param name: string: param color: string: param description: string: rtype: None
def edit(self, name, color, description=github.GithubObject.NotSet): """ :calls: `PATCH /repos/:owner/:repo/labels/:name <http://developer.github.com/v3/issues/labels>`_ :param name: string :param color: string :param description: string :rtype: None """ a...
: calls: GET/ repos/: owner/: repo/ pulls/: number <https:// developer. github. com/ v3/ pulls/ #get - a - single - pull - request > _: rtype:: class: github. PullRequest. PullRequest or: class: github. Issue. Issue
def get_content(self, content_type=github.GithubObject.NotSet): """ :calls: `GET /repos/:owner/:repo/pulls/:number <https://developer.github.com/v3/pulls/#get-a-single-pull-request>`_ :rtype: :class:`github.PullRequest.PullRequest` or :class:`github.Issue.Issue` """ if self.conte...
: calls: POST/ gists/: id/ forks <http:// developer. github. com/ v3/ gists > _: rtype:: class: github. Gist. Gist
def create_fork(self): """ :calls: `POST /gists/:id/forks <http://developer.github.com/v3/gists>`_ :rtype: :class:`github.Gist.Gist` """ headers, data = self._requester.requestJsonAndCheck( "POST", self.url + "/forks" ) return Gist(self._re...
: calls: PATCH/ gists/: id <http:// developer. github. com/ v3/ gists > _: param description: string: param files: dict of string to: class: github. InputFileContent. InputFileContent: rtype: None
def edit(self, description=github.GithubObject.NotSet, files=github.GithubObject.NotSet): """ :calls: `PATCH /gists/:id <http://developer.github.com/v3/gists>`_ :param description: string :param files: dict of string to :class:`github.InputFileContent.InputFileContent` :rtype: No...
: calls: GET/ gists/: gist_id/ comments/: id <http:// developer. github. com/ v3/ gists/ comments > _: param id: integer: rtype:: class: github. GistComment. GistComment
def get_comment(self, id): """ :calls: `GET /gists/:gist_id/comments/:id <http://developer.github.com/v3/gists/comments>`_ :param id: integer :rtype: :class:`github.GistComment.GistComment` """ assert isinstance(id, (int, long)), id headers, data = self._requester...
: calls: GET/ gists/: gist_id/ comments <http:// developer. github. com/ v3/ gists/ comments > _: rtype:: class: github. PaginatedList. PaginatedList of: class: github. GistComment. GistComment
def get_comments(self): """ :calls: `GET /gists/:gist_id/comments <http://developer.github.com/v3/gists/comments>`_ :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.GistComment.GistComment` """ return github.PaginatedList.PaginatedList( github.Gis...
: calls: GET/ gists/: id/ star <http:// developer. github. com/ v3/ gists > _: rtype: bool
def is_starred(self): """ :calls: `GET /gists/:id/star <http://developer.github.com/v3/gists>`_ :rtype: bool """ status, headers, data = self._requester.requestJson( "GET", self.url + "/star" ) return status == 204
For most ordinary keys the keysym is the same as the corresponding ASCII value. Other common keys are shown in the KEY_ constants.
def send_KeyEvent(self, key, down): """For most ordinary keys, the "keysym" is the same as the corresponding ASCII value. Other common keys are shown in the KEY_ constants. """ self.sendMessage(struct.pack('!BBxxI', 4, down, key))
Indicates either pointer movement or a pointer button press or release. The pointer is now at ( x - position y - position ) and the current state of buttons 1 to 8 are represented by bits 0 to 7 of button - mask respectively 0 meaning up 1 meaning down ( pressed ).
def send_PointerEvent(self, x, y, buttonmask=0): """Indicates either pointer movement or a pointer button press or release. The pointer is now at (x-position, y-position), and the current state of buttons 1 to 8 are represented by bits 0 to 7 of button-mask respectively, 0 meani...
The client has new text in its clipboard.
def send_ClientCutText(self, message): """The client has new text in its clipboard. """ self.sendMessage(struct.pack("!BxxxI", 6, len(message))) self.sendMessage(message)
Atomically set the environment state tracking variables.
def set_env_info(self, env_state=None, env_id=None, episode_id=None, bump_past=None, fps=None): """Atomically set the environment state tracking variables. """ with self.cv: if env_id is None: env_id = self._env_id if env_state is None: env...
Construct a container object from the output of GET/ containers/ json.
def from_ps(cls, client, dictionary, **kwargs): """ Construct a container object from the output of GET /containers/json. """ name = get_container_name(dictionary) if name is None: return None new_dictionary = { 'Id': dictionary['Id'], ...
A log stream can only be attached if the container uses a json - file log driver.
def attach_log_stream(self): """A log stream can only be attached if the container uses a json-file log driver. """ if self.has_api_logs: self.log_stream = self.attach(stdout=True, stderr=True, stream=True)
Return a value from the container or None if the value is not set.
def get(self, key): """Return a value from the container or None if the value is not set. :param key: a string using dotted notation for nested dictionary lookups """ self.inspect_if_not_inspected() def get_value(dictionary, key): return (diction...
Rename the container to a hopefully unique temporary container name by prepending the short id.
def rename_to_tmp_name(self): """Rename the container to a hopefully unique temporary container name by prepending the short id. """ self.client.rename( self.id, '%s_%s' % (self.short_id, self.name) )
Build a key combination such as:
def build(cls, keys, down=None): """Build a key combination, such as: ctrl-t """ codes = [] for key in keys.split('-'): key = keycode(key) codes.append(key) events = [] if down is None or down: for code in codes: ...
id is a string describing the runtime e. g flashgames
def runtime_spec(self, id): """ id is a string describing the runtime, e.g 'flashgames Returns a configured DockerRuntime object """ try: return self.runtimes[id] except KeyError: raise UnregisteredRuntime('No registered runtime with name: {}'.for...
Used in the tests
def _manual_recv(self, method, body, headers={}): """Used in the tests""" headers.setdefault('sent_at', time.time()) return self.recv(self._make_context(), {'method': method, 'body': body, 'headers': headers})
Install a signal handler for HUP INT and TERM to call exit allowing clean shutdown. When running a universe environment it s important to shut down the container when the agent dies so you should either call this or otherwise arrange to exit on signals.
def exit_on_signal(): """ Install a signal handler for HUP, INT, and TERM to call exit, allowing clean shutdown. When running a universe environment, it's important to shut down the container when the agent dies so you should either call this or otherwise arrange to exit on signals. """ def shut...
We currently close our fbs files by killing them so sometimes they end up with bad data at the end. Close our reader if we expect size bytes and get fewer.
def read_safe(self, size=None): """ We currently close our fbs files by killing them, so sometimes they end up with bad data at the end. Close our reader if we expect `size` bytes and get fewer. This is a hack and should be removed when we cleanly close our connections i...
Call from main thread. Returns the list of newly - available ( handle env ) pairs.
def pop(self, n=None): """Call from main thread. Returns the list of newly-available (handle, env) pairs.""" self.error_buffer.check() envs = [] if n is None: while True: try: envs += self.ready.get(block=False) except que...
Call from main thread. Initiate a request for more environments
def allocate(self, handles, initial=False, params={}): """Call from main thread. Initiate a request for more environments""" assert all(re.search('^\d+$', h) for h in handles), "All handles must be numbers: {}".format(handles) self.requests.put(('allocate', (handles, initial, params)))
Universe method to configure the environment.
def configure(self, remotes=None, client_id=None, start_timeout=None, docker_image=None, ignore_clock_skew=False, disable_action_probes=False, vnc_driver=None, vnc_kwargs=None, rewarder_driver=None, replace_on_cr...
return { pid: { user: 0. 0 sys: 0. 0 }} chrome_reset
def cpu_times(self): ''' return {pid: {'user': 0.0, 'sys': 0.0}}, chrome_reset ''' chrome_procs = self.get_chrome_procs() new_pids = {p.pid for p in chrome_procs} old_pids = {pid for pid in self.last_cpu_times} try: cpu_times = {p.pid: p.cpu_times() for p in chrome_pr...
We often need to aggregate together multiple infos. Most keys can just be clobbered by the new info but e. g. any keys which contain counts should be added. The merge schema is indicated by the key namespace.
def merge_infos(info1, info2): """We often need to aggregate together multiple infos. Most keys can just be clobbered by the new info, but e.g. any keys which contain counts should be added. The merge schema is indicated by the key namespace. Namespaces: - stats.timers: Timing - stats.gaug...
Old visual observation is discarded because it is outdated frame. Text observations are merged because they are messages sent from the rewarder.
def _merge_observation(accum_observation, observation): """ Old visual observation is discarded, because it is outdated frame. Text observations are merged, because they are messages sent from the rewarder. """ if observation is None: # We're currently masking. So accum_observation probably ...
Open the file and write the metadata header to describe this recording. Called after we establish an end - to - end connection This uses Version 1 of our protocol
def begin_recording(self): """ Open the file and write the metadata header to describe this recording. Called after we establish an end-to-end connection This uses Version 1 of our protocol Version 0 can be seen here: https://github.com/openai/universe/blob/f85a7779c3847fa86ec7bb513a1da...
Record a message to our rewards. demo file if it is has been opened
def record_message(self, msg, from_rewarder): """Record a message to our rewards.demo file if it is has been opened""" if self.file: # Include an authoritative timestamp (because the `sent_at` from the server is likely to be different timestamped_message = { 'time...
Takes a list of the following form: [ ( a1 b1 ) ( a2 b2 )... ] and returns a string a_mean - b_mean flooring out at 0.
def display_timestamps_pair_compact(time_m_2): """Takes a list of the following form: [(a1, b1), (a2, b2), ...] and returns a string a_mean-b_mean, flooring out at 0. """ if len(time_m_2) == 0: return '(empty)' time_m_2 = np.array(time_m_2) low = time_m_2[:, 0].mean() high = time_m...
Takes a list of the following form: [ ( a1 b1 ) ( a2 b2 )... ] and returns a string ( a_mean +/ - a_error b_mean +/ - b_error ).
def display_timestamps_pair(time_m_2): """Takes a list of the following form: [(a1, b1), (a2, b2), ...] and returns a string (a_mean+/-a_error, b_mean+/-b_error). """ if len(time_m_2) == 0: return '(empty)' time_m_2 = np.array(time_m_2) return '({}, {})'.format( display_timestam...
Return a string describing a set of modifiers.
def modifiers_string(modifiers): '''Return a string describing a set of modifiers. Example:: >>> modifiers_string(MOD_SHIFT | MOD_CTRL) 'MOD_SHIFT|MOD_CTRL' :Parameters: `modifiers` : int Bitwise combination of modifier constants. :rtype: str ''' mod_names...
Mutates the info_n dictionary.
def add_metadata(self, observation_n, info_n, available_at=None): """Mutates the info_n dictionary.""" if self.instance_n is None: return with pyprofile.push('vnc_env.diagnostics.Diagnostics.add_metadata'): async = self.pool.imap_unordered( self._add_meta...
Extract metadata from a pixel observation and add it to the info
def add_metadata(self, observation, info, available_at=None): """Extract metadata from a pixel observation and add it to the info """ observation = observation['vision'] if observation is None: return if self.network is not None and not self.network.active(): return ...
Assumes you hold the lock
def _print_if_needed(self): """Assumes you hold the lock""" if self._in_txn or self.print_frequency is None: return elif self.last_export is not None and \ self.last_export + self.print_frequency > time.time(): return self.export()
Given a generator which yields strings and a splitter function joins all input splits on the separator and yields each chunk.
def split_buffer(stream, splitter=None, decoder=lambda a: a): """Given a generator which yields strings and a splitter function, joins all input, splits on the separator and yields each chunk. Unlike string.split(), each chunk includes the trailing separator, except for the last one if none was found o...