repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1 value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1 value |
|---|---|---|---|---|---|---|---|---|---|---|---|
kislyuk/aegea | aegea/packages/github3/users.py | User.iter_events | def iter_events(self, public=False, number=-1, etag=None):
"""Iterate over events performed by this user.
:param bool public: (optional), only list public events for the
authenticated user
: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: list of :class:`Event <github3.events.Event>`\ s
"""
path = ['events']
if public:
path.append('public')
url = self._build_url(*path, base_url=self._api)
return self._iter(int(number), url, Event, etag=etag) | python | def iter_events(self, public=False, number=-1, etag=None):
"""Iterate over events performed by this user.
:param bool public: (optional), only list public events for the
authenticated user
: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: list of :class:`Event <github3.events.Event>`\ s
"""
path = ['events']
if public:
path.append('public')
url = self._build_url(*path, base_url=self._api)
return self._iter(int(number), url, Event, etag=etag) | [
"def",
"iter_events",
"(",
"self",
",",
"public",
"=",
"False",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"path",
"=",
"[",
"'events'",
"]",
"if",
"public",
":",
"path",
".",
"append",
"(",
"'public'",
")",
"url",
"=",
"self",
".",
"_build_url",
"(",
"*",
"path",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_iter",
"(",
"int",
"(",
"number",
")",
",",
"url",
",",
"Event",
",",
"etag",
"=",
"etag",
")"
] | Iterate over events performed by this user.
:param bool public: (optional), only list public events for the
authenticated user
: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: list of :class:`Event <github3.events.Event>`\ s | [
"Iterate",
"over",
"events",
"performed",
"by",
"this",
"user",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/users.py#L253-L268 | train |
kislyuk/aegea | aegea/packages/github3/users.py | User.iter_followers | def iter_followers(self, number=-1, etag=None):
"""Iterate over the followers of this user.
:param int number: (optional), number of followers to return. Default:
-1 returns all available
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`User <User>`\ s
"""
url = self._build_url('followers', base_url=self._api)
return self._iter(int(number), url, User, etag=etag) | python | def iter_followers(self, number=-1, etag=None):
"""Iterate over the followers of this user.
:param int number: (optional), number of followers to return. Default:
-1 returns all available
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`User <User>`\ s
"""
url = self._build_url('followers', base_url=self._api)
return self._iter(int(number), url, User, etag=etag) | [
"def",
"iter_followers",
"(",
"self",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'followers'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_iter",
"(",
"int",
"(",
"number",
")",
",",
"url",
",",
"User",
",",
"etag",
"=",
"etag",
")"
] | Iterate over the followers of this user.
:param int number: (optional), number of followers to return. Default:
-1 returns all available
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`User <User>`\ s | [
"Iterate",
"over",
"the",
"followers",
"of",
"this",
"user",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/users.py#L270-L280 | train |
kislyuk/aegea | aegea/packages/github3/users.py | User.iter_keys | def iter_keys(self, number=-1, etag=None):
"""Iterate over the public keys of this user.
.. versionadded:: 0.5
:param int number: (optional), number of keys to return. Default: -1
returns all available keys
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`Key <Key>`\ s
"""
url = self._build_url('keys', base_url=self._api)
return self._iter(int(number), url, Key, etag=etag) | python | def iter_keys(self, number=-1, etag=None):
"""Iterate over the public keys of this user.
.. versionadded:: 0.5
:param int number: (optional), number of keys to return. Default: -1
returns all available keys
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`Key <Key>`\ s
"""
url = self._build_url('keys', base_url=self._api)
return self._iter(int(number), url, Key, etag=etag) | [
"def",
"iter_keys",
"(",
"self",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'keys'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_iter",
"(",
"int",
"(",
"number",
")",
",",
"url",
",",
"Key",
",",
"etag",
"=",
"etag",
")"
] | Iterate over the public keys of this user.
.. versionadded:: 0.5
:param int number: (optional), number of keys to return. Default: -1
returns all available keys
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`Key <Key>`\ s | [
"Iterate",
"over",
"the",
"public",
"keys",
"of",
"this",
"user",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/users.py#L294-L306 | train |
kislyuk/aegea | aegea/packages/github3/users.py | User.iter_org_events | def iter_org_events(self, org, number=-1, etag=None):
"""Iterate over events as they appear on the user's organization
dashboard. You must be authenticated to view this.
:param str org: (required), name of the organization
: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: list of :class:`Event <github3.events.Event>`\ s
"""
url = ''
if org:
url = self._build_url('events', 'orgs', org, base_url=self._api)
return self._iter(int(number), url, Event, etag=etag) | python | def iter_org_events(self, org, number=-1, etag=None):
"""Iterate over events as they appear on the user's organization
dashboard. You must be authenticated to view this.
:param str org: (required), name of the organization
: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: list of :class:`Event <github3.events.Event>`\ s
"""
url = ''
if org:
url = self._build_url('events', 'orgs', org, base_url=self._api)
return self._iter(int(number), url, Event, etag=etag) | [
"def",
"iter_org_events",
"(",
"self",
",",
"org",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"url",
"=",
"''",
"if",
"org",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'events'",
",",
"'orgs'",
",",
"org",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_iter",
"(",
"int",
"(",
"number",
")",
",",
"url",
",",
"Event",
",",
"etag",
"=",
"etag",
")"
] | Iterate over events as they appear on the user's organization
dashboard. You must be authenticated to view this.
:param str org: (required), name of the organization
: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: list of :class:`Event <github3.events.Event>`\ s | [
"Iterate",
"over",
"events",
"as",
"they",
"appear",
"on",
"the",
"user",
"s",
"organization",
"dashboard",
".",
"You",
"must",
"be",
"authenticated",
"to",
"view",
"this",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/users.py#L308-L322 | train |
kislyuk/aegea | aegea/packages/github3/users.py | User.iter_orgs | def iter_orgs(self, number=-1, etag=None):
"""Iterate over organizations the user is member of
:param int number: (optional), number of organizations to return.
Default: -1 returns all available organization
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: list of :class:`Event <github3.orgs.Organization>`\ s
"""
# Import here, because a toplevel import causes an import loop
from .orgs import Organization
url = self._build_url('orgs', base_url=self._api)
return self._iter(int(number), url, Organization, etag=etag) | python | def iter_orgs(self, number=-1, etag=None):
"""Iterate over organizations the user is member of
:param int number: (optional), number of organizations to return.
Default: -1 returns all available organization
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: list of :class:`Event <github3.orgs.Organization>`\ s
"""
# Import here, because a toplevel import causes an import loop
from .orgs import Organization
url = self._build_url('orgs', base_url=self._api)
return self._iter(int(number), url, Organization, etag=etag) | [
"def",
"iter_orgs",
"(",
"self",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"# Import here, because a toplevel import causes an import loop",
"from",
".",
"orgs",
"import",
"Organization",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'orgs'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_iter",
"(",
"int",
"(",
"number",
")",
",",
"url",
",",
"Organization",
",",
"etag",
"=",
"etag",
")"
] | Iterate over organizations the user is member of
:param int number: (optional), number of organizations to return.
Default: -1 returns all available organization
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: list of :class:`Event <github3.orgs.Organization>`\ s | [
"Iterate",
"over",
"organizations",
"the",
"user",
"is",
"member",
"of"
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/users.py#L343-L355 | train |
kislyuk/aegea | aegea/packages/github3/users.py | User.iter_starred | def iter_starred(self, sort=None, direction=None, number=-1, etag=None):
"""Iterate over repositories starred by this user.
.. versionchanged:: 0.5
Added sort and direction parameters (optional) as per the change in
GitHub's API.
:param int number: (optional), number of starred repos to return.
Default: -1, returns all available repos
:param str sort: (optional), either 'created' (when the star was
created) or 'updated' (when the repository was last pushed to)
:param str direction: (optional), either 'asc' or 'desc'. Default:
'desc'
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`Repository <github3.repos.Repository>`
"""
from .repos import Repository
params = {'sort': sort, 'direction': direction}
self._remove_none(params)
url = self.starred_urlt.expand(owner=None, repo=None)
return self._iter(int(number), url, Repository, params, etag) | python | def iter_starred(self, sort=None, direction=None, number=-1, etag=None):
"""Iterate over repositories starred by this user.
.. versionchanged:: 0.5
Added sort and direction parameters (optional) as per the change in
GitHub's API.
:param int number: (optional), number of starred repos to return.
Default: -1, returns all available repos
:param str sort: (optional), either 'created' (when the star was
created) or 'updated' (when the repository was last pushed to)
:param str direction: (optional), either 'asc' or 'desc'. Default:
'desc'
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`Repository <github3.repos.Repository>`
"""
from .repos import Repository
params = {'sort': sort, 'direction': direction}
self._remove_none(params)
url = self.starred_urlt.expand(owner=None, repo=None)
return self._iter(int(number), url, Repository, params, etag) | [
"def",
"iter_starred",
"(",
"self",
",",
"sort",
"=",
"None",
",",
"direction",
"=",
"None",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"from",
".",
"repos",
"import",
"Repository",
"params",
"=",
"{",
"'sort'",
":",
"sort",
",",
"'direction'",
":",
"direction",
"}",
"self",
".",
"_remove_none",
"(",
"params",
")",
"url",
"=",
"self",
".",
"starred_urlt",
".",
"expand",
"(",
"owner",
"=",
"None",
",",
"repo",
"=",
"None",
")",
"return",
"self",
".",
"_iter",
"(",
"int",
"(",
"number",
")",
",",
"url",
",",
"Repository",
",",
"params",
",",
"etag",
")"
] | Iterate over repositories starred by this user.
.. versionchanged:: 0.5
Added sort and direction parameters (optional) as per the change in
GitHub's API.
:param int number: (optional), number of starred repos to return.
Default: -1, returns all available repos
:param str sort: (optional), either 'created' (when the star was
created) or 'updated' (when the repository was last pushed to)
:param str direction: (optional), either 'asc' or 'desc'. Default:
'desc'
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`Repository <github3.repos.Repository>` | [
"Iterate",
"over",
"repositories",
"starred",
"by",
"this",
"user",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/users.py#L357-L379 | train |
kislyuk/aegea | aegea/packages/github3/users.py | User.iter_subscriptions | def iter_subscriptions(self, number=-1, etag=None):
"""Iterate over repositories subscribed to by this user.
:param int number: (optional), number of subscriptions to return.
Default: -1, returns all available
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`Repository <github3.repos.Repository>`
"""
from .repos import Repository
url = self._build_url('subscriptions', base_url=self._api)
return self._iter(int(number), url, Repository, etag=etag) | python | def iter_subscriptions(self, number=-1, etag=None):
"""Iterate over repositories subscribed to by this user.
:param int number: (optional), number of subscriptions to return.
Default: -1, returns all available
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`Repository <github3.repos.Repository>`
"""
from .repos import Repository
url = self._build_url('subscriptions', base_url=self._api)
return self._iter(int(number), url, Repository, etag=etag) | [
"def",
"iter_subscriptions",
"(",
"self",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"from",
".",
"repos",
"import",
"Repository",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'subscriptions'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_iter",
"(",
"int",
"(",
"number",
")",
",",
"url",
",",
"Repository",
",",
"etag",
"=",
"etag",
")"
] | Iterate over repositories subscribed to by this user.
:param int number: (optional), number of subscriptions to return.
Default: -1, returns all available
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`Repository <github3.repos.Repository>` | [
"Iterate",
"over",
"repositories",
"subscribed",
"to",
"by",
"this",
"user",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/users.py#L381-L392 | train |
kislyuk/aegea | aegea/packages/github3/users.py | User.update | def update(self, name=None, email=None, blog=None, company=None,
location=None, hireable=False, bio=None):
"""If authenticated as this user, update the information with
the information provided in the parameters.
:param str name: e.g., 'John Smith', not login name
:param str email: e.g., 'john.smith@example.com'
:param str blog: e.g., 'http://www.example.com/jsmith/blog'
:param str company:
:param str location:
:param bool hireable: defaults to False
:param str bio: GitHub flavored markdown
:returns: bool
"""
user = {'name': name, 'email': email, 'blog': blog,
'company': company, 'location': location,
'hireable': hireable, 'bio': bio}
self._remove_none(user)
url = self._build_url('user')
json = self._json(self._patch(url, data=dumps(user)), 200)
if json:
self._update_(json)
return True
return False | python | def update(self, name=None, email=None, blog=None, company=None,
location=None, hireable=False, bio=None):
"""If authenticated as this user, update the information with
the information provided in the parameters.
:param str name: e.g., 'John Smith', not login name
:param str email: e.g., 'john.smith@example.com'
:param str blog: e.g., 'http://www.example.com/jsmith/blog'
:param str company:
:param str location:
:param bool hireable: defaults to False
:param str bio: GitHub flavored markdown
:returns: bool
"""
user = {'name': name, 'email': email, 'blog': blog,
'company': company, 'location': location,
'hireable': hireable, 'bio': bio}
self._remove_none(user)
url = self._build_url('user')
json = self._json(self._patch(url, data=dumps(user)), 200)
if json:
self._update_(json)
return True
return False | [
"def",
"update",
"(",
"self",
",",
"name",
"=",
"None",
",",
"email",
"=",
"None",
",",
"blog",
"=",
"None",
",",
"company",
"=",
"None",
",",
"location",
"=",
"None",
",",
"hireable",
"=",
"False",
",",
"bio",
"=",
"None",
")",
":",
"user",
"=",
"{",
"'name'",
":",
"name",
",",
"'email'",
":",
"email",
",",
"'blog'",
":",
"blog",
",",
"'company'",
":",
"company",
",",
"'location'",
":",
"location",
",",
"'hireable'",
":",
"hireable",
",",
"'bio'",
":",
"bio",
"}",
"self",
".",
"_remove_none",
"(",
"user",
")",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'user'",
")",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_patch",
"(",
"url",
",",
"data",
"=",
"dumps",
"(",
"user",
")",
")",
",",
"200",
")",
"if",
"json",
":",
"self",
".",
"_update_",
"(",
"json",
")",
"return",
"True",
"return",
"False"
] | If authenticated as this user, update the information with
the information provided in the parameters.
:param str name: e.g., 'John Smith', not login name
:param str email: e.g., 'john.smith@example.com'
:param str blog: e.g., 'http://www.example.com/jsmith/blog'
:param str company:
:param str location:
:param bool hireable: defaults to False
:param str bio: GitHub flavored markdown
:returns: bool | [
"If",
"authenticated",
"as",
"this",
"user",
"update",
"the",
"information",
"with",
"the",
"information",
"provided",
"in",
"the",
"parameters",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/users.py#L395-L418 | train |
kislyuk/aegea | aegea/packages/github3/notifications.py | Thread.delete_subscription | def delete_subscription(self):
"""Delete subscription for this thread.
:returns: bool
"""
url = self._build_url('subscription', base_url=self._api)
return self._boolean(self._delete(url), 204, 404) | python | def delete_subscription(self):
"""Delete subscription for this thread.
:returns: bool
"""
url = self._build_url('subscription', base_url=self._api)
return self._boolean(self._delete(url), 204, 404) | [
"def",
"delete_subscription",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'subscription'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_boolean",
"(",
"self",
".",
"_delete",
"(",
"url",
")",
",",
"204",
",",
"404",
")"
] | Delete subscription for this thread.
:returns: bool | [
"Delete",
"subscription",
"for",
"this",
"thread",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/notifications.py#L63-L69 | train |
kislyuk/aegea | aegea/packages/github3/notifications.py | Thread.set_subscription | def set_subscription(self, subscribed, ignored):
"""Set the user's subscription for this thread
:param bool subscribed: (required), determines if notifications should
be received from this thread.
:param bool ignored: (required), determines if notifications should be
ignored from this thread.
:returns: :class:`Subscription <Subscription>`
"""
url = self._build_url('subscription', base_url=self._api)
sub = {'subscribed': subscribed, 'ignored': ignored}
json = self._json(self._put(url, data=dumps(sub)), 200)
return Subscription(json, self) if json else None | python | def set_subscription(self, subscribed, ignored):
"""Set the user's subscription for this thread
:param bool subscribed: (required), determines if notifications should
be received from this thread.
:param bool ignored: (required), determines if notifications should be
ignored from this thread.
:returns: :class:`Subscription <Subscription>`
"""
url = self._build_url('subscription', base_url=self._api)
sub = {'subscribed': subscribed, 'ignored': ignored}
json = self._json(self._put(url, data=dumps(sub)), 200)
return Subscription(json, self) if json else None | [
"def",
"set_subscription",
"(",
"self",
",",
"subscribed",
",",
"ignored",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'subscription'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"sub",
"=",
"{",
"'subscribed'",
":",
"subscribed",
",",
"'ignored'",
":",
"ignored",
"}",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_put",
"(",
"url",
",",
"data",
"=",
"dumps",
"(",
"sub",
")",
")",
",",
"200",
")",
"return",
"Subscription",
"(",
"json",
",",
"self",
")",
"if",
"json",
"else",
"None"
] | Set the user's subscription for this thread
:param bool subscribed: (required), determines if notifications should
be received from this thread.
:param bool ignored: (required), determines if notifications should be
ignored from this thread.
:returns: :class:`Subscription <Subscription>` | [
"Set",
"the",
"user",
"s",
"subscription",
"for",
"this",
"thread"
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/notifications.py#L82-L94 | train |
kislyuk/aegea | aegea/packages/github3/notifications.py | Thread.subscription | def subscription(self):
"""Checks the status of the user's subscription to this thread.
:returns: :class:`Subscription <Subscription>`
"""
url = self._build_url('subscription', base_url=self._api)
json = self._json(self._get(url), 200)
return Subscription(json, self) if json else None | python | def subscription(self):
"""Checks the status of the user's subscription to this thread.
:returns: :class:`Subscription <Subscription>`
"""
url = self._build_url('subscription', base_url=self._api)
json = self._json(self._get(url), 200)
return Subscription(json, self) if json else None | [
"def",
"subscription",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'subscription'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_get",
"(",
"url",
")",
",",
"200",
")",
"return",
"Subscription",
"(",
"json",
",",
"self",
")",
"if",
"json",
"else",
"None"
] | Checks the status of the user's subscription to this thread.
:returns: :class:`Subscription <Subscription>` | [
"Checks",
"the",
"status",
"of",
"the",
"user",
"s",
"subscription",
"to",
"this",
"thread",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/notifications.py#L96-L103 | train |
kislyuk/aegea | aegea/packages/github3/notifications.py | Subscription.set | def set(self, subscribed, ignored):
"""Set the user's subscription for this subscription
:param bool subscribed: (required), determines if notifications should
be received from this thread.
:param bool ignored: (required), determines if notifications should be
ignored from this thread.
"""
sub = {'subscribed': subscribed, 'ignored': ignored}
json = self._json(self._put(self._api, data=dumps(sub)), 200)
self.__init__(json, self._session) | python | def set(self, subscribed, ignored):
"""Set the user's subscription for this subscription
:param bool subscribed: (required), determines if notifications should
be received from this thread.
:param bool ignored: (required), determines if notifications should be
ignored from this thread.
"""
sub = {'subscribed': subscribed, 'ignored': ignored}
json = self._json(self._put(self._api, data=dumps(sub)), 200)
self.__init__(json, self._session) | [
"def",
"set",
"(",
"self",
",",
"subscribed",
",",
"ignored",
")",
":",
"sub",
"=",
"{",
"'subscribed'",
":",
"subscribed",
",",
"'ignored'",
":",
"ignored",
"}",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_put",
"(",
"self",
".",
"_api",
",",
"data",
"=",
"dumps",
"(",
"sub",
")",
")",
",",
"200",
")",
"self",
".",
"__init__",
"(",
"json",
",",
"self",
".",
"_session",
")"
] | Set the user's subscription for this subscription
:param bool subscribed: (required), determines if notifications should
be received from this thread.
:param bool ignored: (required), determines if notifications should be
ignored from this thread. | [
"Set",
"the",
"user",
"s",
"subscription",
"for",
"this",
"subscription"
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/notifications.py#L139-L149 | train |
kislyuk/aegea | aegea/util/aws/__init__.py | locate_ami | def locate_ami(product, region=None, channel="releases", stream="released", root_store="ssd", virt="hvm"):
"""
Examples::
locate_ami(product="com.ubuntu.cloud:server:16.04:amd64", channel="daily", stream="daily", region="us-west-2")
locate_ami(product="Amazon Linux AMI 2016.09")
"""
if region is None:
region = clients.ec2.meta.region_name
if product.startswith("com.ubuntu.cloud"):
partition = "aws"
if region.startswith("cn-"):
partition = "aws-cn"
elif region.startswith("us-gov-"):
partition = "aws-govcloud"
if partition not in {"aws", "aws-cn", "aws-govcloud"}:
raise AegeaException("Unrecognized partition {}".format(partition))
manifest_url = "https://cloud-images.ubuntu.com/{channel}/streams/v1/com.ubuntu.cloud:{stream}:{partition}.json"
manifest_url = manifest_url.format(partition=partition, channel=channel, stream=stream)
manifest = requests.get(manifest_url).json()
if product not in manifest["products"]:
raise AegeaException("Ubuntu version {} not found in Ubuntu cloud image manifest".format(product))
versions = manifest["products"][product]["versions"]
for version in sorted(versions.keys(), reverse=True)[:8]:
for ami in versions[version]["items"].values():
if ami["crsn"] == region and ami["root_store"] == root_store and ami["virt"] == virt:
logger.info("Found %s for %s", ami["id"], ":".join([product, version, region, root_store, virt]))
return ami["id"]
elif product.startswith("Amazon Linux"):
filters = {"root-device-type": "ebs" if root_store == "ssd" else root_store, "virtualization-type": virt,
"architecture": "x86_64", "owner-alias": "amazon", "state": "available"}
images = resources.ec2.images.filter(Filters=[dict(Name=k, Values=[v]) for k, v in filters.items()])
for image in sorted(images, key=lambda i: i.creation_date, reverse=True):
if root_store == "ebs" and not image.name.endswith("x86_64-gp2"):
continue
if image.name.startswith("amzn-ami-" + virt) and image.description.startswith(product):
return image.image_id
raise AegeaException("No AMI found for {} {} {} {}".format(product, region, root_store, virt)) | python | def locate_ami(product, region=None, channel="releases", stream="released", root_store="ssd", virt="hvm"):
"""
Examples::
locate_ami(product="com.ubuntu.cloud:server:16.04:amd64", channel="daily", stream="daily", region="us-west-2")
locate_ami(product="Amazon Linux AMI 2016.09")
"""
if region is None:
region = clients.ec2.meta.region_name
if product.startswith("com.ubuntu.cloud"):
partition = "aws"
if region.startswith("cn-"):
partition = "aws-cn"
elif region.startswith("us-gov-"):
partition = "aws-govcloud"
if partition not in {"aws", "aws-cn", "aws-govcloud"}:
raise AegeaException("Unrecognized partition {}".format(partition))
manifest_url = "https://cloud-images.ubuntu.com/{channel}/streams/v1/com.ubuntu.cloud:{stream}:{partition}.json"
manifest_url = manifest_url.format(partition=partition, channel=channel, stream=stream)
manifest = requests.get(manifest_url).json()
if product not in manifest["products"]:
raise AegeaException("Ubuntu version {} not found in Ubuntu cloud image manifest".format(product))
versions = manifest["products"][product]["versions"]
for version in sorted(versions.keys(), reverse=True)[:8]:
for ami in versions[version]["items"].values():
if ami["crsn"] == region and ami["root_store"] == root_store and ami["virt"] == virt:
logger.info("Found %s for %s", ami["id"], ":".join([product, version, region, root_store, virt]))
return ami["id"]
elif product.startswith("Amazon Linux"):
filters = {"root-device-type": "ebs" if root_store == "ssd" else root_store, "virtualization-type": virt,
"architecture": "x86_64", "owner-alias": "amazon", "state": "available"}
images = resources.ec2.images.filter(Filters=[dict(Name=k, Values=[v]) for k, v in filters.items()])
for image in sorted(images, key=lambda i: i.creation_date, reverse=True):
if root_store == "ebs" and not image.name.endswith("x86_64-gp2"):
continue
if image.name.startswith("amzn-ami-" + virt) and image.description.startswith(product):
return image.image_id
raise AegeaException("No AMI found for {} {} {} {}".format(product, region, root_store, virt)) | [
"def",
"locate_ami",
"(",
"product",
",",
"region",
"=",
"None",
",",
"channel",
"=",
"\"releases\"",
",",
"stream",
"=",
"\"released\"",
",",
"root_store",
"=",
"\"ssd\"",
",",
"virt",
"=",
"\"hvm\"",
")",
":",
"if",
"region",
"is",
"None",
":",
"region",
"=",
"clients",
".",
"ec2",
".",
"meta",
".",
"region_name",
"if",
"product",
".",
"startswith",
"(",
"\"com.ubuntu.cloud\"",
")",
":",
"partition",
"=",
"\"aws\"",
"if",
"region",
".",
"startswith",
"(",
"\"cn-\"",
")",
":",
"partition",
"=",
"\"aws-cn\"",
"elif",
"region",
".",
"startswith",
"(",
"\"us-gov-\"",
")",
":",
"partition",
"=",
"\"aws-govcloud\"",
"if",
"partition",
"not",
"in",
"{",
"\"aws\"",
",",
"\"aws-cn\"",
",",
"\"aws-govcloud\"",
"}",
":",
"raise",
"AegeaException",
"(",
"\"Unrecognized partition {}\"",
".",
"format",
"(",
"partition",
")",
")",
"manifest_url",
"=",
"\"https://cloud-images.ubuntu.com/{channel}/streams/v1/com.ubuntu.cloud:{stream}:{partition}.json\"",
"manifest_url",
"=",
"manifest_url",
".",
"format",
"(",
"partition",
"=",
"partition",
",",
"channel",
"=",
"channel",
",",
"stream",
"=",
"stream",
")",
"manifest",
"=",
"requests",
".",
"get",
"(",
"manifest_url",
")",
".",
"json",
"(",
")",
"if",
"product",
"not",
"in",
"manifest",
"[",
"\"products\"",
"]",
":",
"raise",
"AegeaException",
"(",
"\"Ubuntu version {} not found in Ubuntu cloud image manifest\"",
".",
"format",
"(",
"product",
")",
")",
"versions",
"=",
"manifest",
"[",
"\"products\"",
"]",
"[",
"product",
"]",
"[",
"\"versions\"",
"]",
"for",
"version",
"in",
"sorted",
"(",
"versions",
".",
"keys",
"(",
")",
",",
"reverse",
"=",
"True",
")",
"[",
":",
"8",
"]",
":",
"for",
"ami",
"in",
"versions",
"[",
"version",
"]",
"[",
"\"items\"",
"]",
".",
"values",
"(",
")",
":",
"if",
"ami",
"[",
"\"crsn\"",
"]",
"==",
"region",
"and",
"ami",
"[",
"\"root_store\"",
"]",
"==",
"root_store",
"and",
"ami",
"[",
"\"virt\"",
"]",
"==",
"virt",
":",
"logger",
".",
"info",
"(",
"\"Found %s for %s\"",
",",
"ami",
"[",
"\"id\"",
"]",
",",
"\":\"",
".",
"join",
"(",
"[",
"product",
",",
"version",
",",
"region",
",",
"root_store",
",",
"virt",
"]",
")",
")",
"return",
"ami",
"[",
"\"id\"",
"]",
"elif",
"product",
".",
"startswith",
"(",
"\"Amazon Linux\"",
")",
":",
"filters",
"=",
"{",
"\"root-device-type\"",
":",
"\"ebs\"",
"if",
"root_store",
"==",
"\"ssd\"",
"else",
"root_store",
",",
"\"virtualization-type\"",
":",
"virt",
",",
"\"architecture\"",
":",
"\"x86_64\"",
",",
"\"owner-alias\"",
":",
"\"amazon\"",
",",
"\"state\"",
":",
"\"available\"",
"}",
"images",
"=",
"resources",
".",
"ec2",
".",
"images",
".",
"filter",
"(",
"Filters",
"=",
"[",
"dict",
"(",
"Name",
"=",
"k",
",",
"Values",
"=",
"[",
"v",
"]",
")",
"for",
"k",
",",
"v",
"in",
"filters",
".",
"items",
"(",
")",
"]",
")",
"for",
"image",
"in",
"sorted",
"(",
"images",
",",
"key",
"=",
"lambda",
"i",
":",
"i",
".",
"creation_date",
",",
"reverse",
"=",
"True",
")",
":",
"if",
"root_store",
"==",
"\"ebs\"",
"and",
"not",
"image",
".",
"name",
".",
"endswith",
"(",
"\"x86_64-gp2\"",
")",
":",
"continue",
"if",
"image",
".",
"name",
".",
"startswith",
"(",
"\"amzn-ami-\"",
"+",
"virt",
")",
"and",
"image",
".",
"description",
".",
"startswith",
"(",
"product",
")",
":",
"return",
"image",
".",
"image_id",
"raise",
"AegeaException",
"(",
"\"No AMI found for {} {} {} {}\"",
".",
"format",
"(",
"product",
",",
"region",
",",
"root_store",
",",
"virt",
")",
")"
] | Examples::
locate_ami(product="com.ubuntu.cloud:server:16.04:amd64", channel="daily", stream="daily", region="us-west-2")
locate_ami(product="Amazon Linux AMI 2016.09") | [
"Examples",
"::",
"locate_ami",
"(",
"product",
"=",
"com",
".",
"ubuntu",
".",
"cloud",
":",
"server",
":",
"16",
".",
"04",
":",
"amd64",
"channel",
"=",
"daily",
"stream",
"=",
"daily",
"region",
"=",
"us",
"-",
"west",
"-",
"2",
")",
"locate_ami",
"(",
"product",
"=",
"Amazon",
"Linux",
"AMI",
"2016",
".",
"09",
")"
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/util/aws/__init__.py#L30-L66 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.add_collaborator | def add_collaborator(self, login):
"""Add ``login`` as a collaborator to a repository.
:param str login: (required), login of the user
:returns: bool -- True if successful, False otherwise
"""
resp = False
if login:
url = self._build_url('collaborators', login, base_url=self._api)
resp = self._boolean(self._put(url), 204, 404)
return resp | python | def add_collaborator(self, login):
"""Add ``login`` as a collaborator to a repository.
:param str login: (required), login of the user
:returns: bool -- True if successful, False otherwise
"""
resp = False
if login:
url = self._build_url('collaborators', login, base_url=self._api)
resp = self._boolean(self._put(url), 204, 404)
return resp | [
"def",
"add_collaborator",
"(",
"self",
",",
"login",
")",
":",
"resp",
"=",
"False",
"if",
"login",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'collaborators'",
",",
"login",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"resp",
"=",
"self",
".",
"_boolean",
"(",
"self",
".",
"_put",
"(",
"url",
")",
",",
"204",
",",
"404",
")",
"return",
"resp"
] | Add ``login`` as a collaborator to a repository.
:param str login: (required), login of the user
:returns: bool -- True if successful, False otherwise | [
"Add",
"login",
"as",
"a",
"collaborator",
"to",
"a",
"repository",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L302-L312 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.archive | def archive(self, format, path='', ref='master'):
"""Get the tarball or zipball archive for this repo at ref.
See: http://developer.github.com/v3/repos/contents/#get-archive-link
:param str format: (required), accepted values: ('tarball',
'zipball')
:param path: (optional), path where the file should be saved
to, default is the filename provided in the headers and will be
written in the current directory.
it can take a file-like object as well
:type path: str, file
:param str ref: (optional)
:returns: bool -- True if successful, False otherwise
"""
resp = None
if format in ('tarball', 'zipball'):
url = self._build_url(format, ref, base_url=self._api)
resp = self._get(url, allow_redirects=True, stream=True)
if resp and self._boolean(resp, 200, 404):
stream_response_to_file(resp, path)
return True
return False | python | def archive(self, format, path='', ref='master'):
"""Get the tarball or zipball archive for this repo at ref.
See: http://developer.github.com/v3/repos/contents/#get-archive-link
:param str format: (required), accepted values: ('tarball',
'zipball')
:param path: (optional), path where the file should be saved
to, default is the filename provided in the headers and will be
written in the current directory.
it can take a file-like object as well
:type path: str, file
:param str ref: (optional)
:returns: bool -- True if successful, False otherwise
"""
resp = None
if format in ('tarball', 'zipball'):
url = self._build_url(format, ref, base_url=self._api)
resp = self._get(url, allow_redirects=True, stream=True)
if resp and self._boolean(resp, 200, 404):
stream_response_to_file(resp, path)
return True
return False | [
"def",
"archive",
"(",
"self",
",",
"format",
",",
"path",
"=",
"''",
",",
"ref",
"=",
"'master'",
")",
":",
"resp",
"=",
"None",
"if",
"format",
"in",
"(",
"'tarball'",
",",
"'zipball'",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"format",
",",
"ref",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"resp",
"=",
"self",
".",
"_get",
"(",
"url",
",",
"allow_redirects",
"=",
"True",
",",
"stream",
"=",
"True",
")",
"if",
"resp",
"and",
"self",
".",
"_boolean",
"(",
"resp",
",",
"200",
",",
"404",
")",
":",
"stream_response_to_file",
"(",
"resp",
",",
"path",
")",
"return",
"True",
"return",
"False"
] | Get the tarball or zipball archive for this repo at ref.
See: http://developer.github.com/v3/repos/contents/#get-archive-link
:param str format: (required), accepted values: ('tarball',
'zipball')
:param path: (optional), path where the file should be saved
to, default is the filename provided in the headers and will be
written in the current directory.
it can take a file-like object as well
:type path: str, file
:param str ref: (optional)
:returns: bool -- True if successful, False otherwise | [
"Get",
"the",
"tarball",
"or",
"zipball",
"archive",
"for",
"this",
"repo",
"at",
"ref",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L314-L338 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.asset | def asset(self, id):
"""Returns a single Asset.
:param int id: (required), id of the asset
:returns: :class:`Asset <github3.repos.release.Asset>`
"""
data = None
if int(id) > 0:
url = self._build_url('releases', 'assets', str(id),
base_url=self._api)
data = self._json(self._get(url, headers=Release.CUSTOM_HEADERS),
200)
return Asset(data, self) if data else None | python | def asset(self, id):
"""Returns a single Asset.
:param int id: (required), id of the asset
:returns: :class:`Asset <github3.repos.release.Asset>`
"""
data = None
if int(id) > 0:
url = self._build_url('releases', 'assets', str(id),
base_url=self._api)
data = self._json(self._get(url, headers=Release.CUSTOM_HEADERS),
200)
return Asset(data, self) if data else None | [
"def",
"asset",
"(",
"self",
",",
"id",
")",
":",
"data",
"=",
"None",
"if",
"int",
"(",
"id",
")",
">",
"0",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'releases'",
",",
"'assets'",
",",
"str",
"(",
"id",
")",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"data",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_get",
"(",
"url",
",",
"headers",
"=",
"Release",
".",
"CUSTOM_HEADERS",
")",
",",
"200",
")",
"return",
"Asset",
"(",
"data",
",",
"self",
")",
"if",
"data",
"else",
"None"
] | Returns a single Asset.
:param int id: (required), id of the asset
:returns: :class:`Asset <github3.repos.release.Asset>` | [
"Returns",
"a",
"single",
"Asset",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L340-L352 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.blob | def blob(self, sha):
"""Get the blob indicated by ``sha``.
:param str sha: (required), sha of the blob
:returns: :class:`Blob <github3.git.Blob>` if successful, otherwise
None
"""
url = self._build_url('git', 'blobs', sha, base_url=self._api)
json = self._json(self._get(url), 200)
return Blob(json) if json else None | python | def blob(self, sha):
"""Get the blob indicated by ``sha``.
:param str sha: (required), sha of the blob
:returns: :class:`Blob <github3.git.Blob>` if successful, otherwise
None
"""
url = self._build_url('git', 'blobs', sha, base_url=self._api)
json = self._json(self._get(url), 200)
return Blob(json) if json else None | [
"def",
"blob",
"(",
"self",
",",
"sha",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'git'",
",",
"'blobs'",
",",
"sha",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_get",
"(",
"url",
")",
",",
"200",
")",
"return",
"Blob",
"(",
"json",
")",
"if",
"json",
"else",
"None"
] | Get the blob indicated by ``sha``.
:param str sha: (required), sha of the blob
:returns: :class:`Blob <github3.git.Blob>` if successful, otherwise
None | [
"Get",
"the",
"blob",
"indicated",
"by",
"sha",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L354-L363 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.branch | def branch(self, name):
"""Get the branch ``name`` of this repository.
:param str name: (required), branch name
:type name: str
:returns: :class:`Branch <github3.repos.branch.Branch>`
"""
json = None
if name:
url = self._build_url('branches', name, base_url=self._api)
json = self._json(self._get(url), 200)
return Branch(json, self) if json else None | python | def branch(self, name):
"""Get the branch ``name`` of this repository.
:param str name: (required), branch name
:type name: str
:returns: :class:`Branch <github3.repos.branch.Branch>`
"""
json = None
if name:
url = self._build_url('branches', name, base_url=self._api)
json = self._json(self._get(url), 200)
return Branch(json, self) if json else None | [
"def",
"branch",
"(",
"self",
",",
"name",
")",
":",
"json",
"=",
"None",
"if",
"name",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'branches'",
",",
"name",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_get",
"(",
"url",
")",
",",
"200",
")",
"return",
"Branch",
"(",
"json",
",",
"self",
")",
"if",
"json",
"else",
"None"
] | Get the branch ``name`` of this repository.
:param str name: (required), branch name
:type name: str
:returns: :class:`Branch <github3.repos.branch.Branch>` | [
"Get",
"the",
"branch",
"name",
"of",
"this",
"repository",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L365-L376 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.commit | def commit(self, sha):
"""Get a single (repo) commit. See :func:`git_commit` for the Git Data
Commit.
:param str sha: (required), sha of the commit
:returns: :class:`RepoCommit <github3.repos.commit.RepoCommit>` if
successful, otherwise None
"""
url = self._build_url('commits', sha, base_url=self._api)
json = self._json(self._get(url), 200)
return RepoCommit(json, self) if json else None | python | def commit(self, sha):
"""Get a single (repo) commit. See :func:`git_commit` for the Git Data
Commit.
:param str sha: (required), sha of the commit
:returns: :class:`RepoCommit <github3.repos.commit.RepoCommit>` if
successful, otherwise None
"""
url = self._build_url('commits', sha, base_url=self._api)
json = self._json(self._get(url), 200)
return RepoCommit(json, self) if json else None | [
"def",
"commit",
"(",
"self",
",",
"sha",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'commits'",
",",
"sha",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_get",
"(",
"url",
")",
",",
"200",
")",
"return",
"RepoCommit",
"(",
"json",
",",
"self",
")",
"if",
"json",
"else",
"None"
] | Get a single (repo) commit. See :func:`git_commit` for the Git Data
Commit.
:param str sha: (required), sha of the commit
:returns: :class:`RepoCommit <github3.repos.commit.RepoCommit>` if
successful, otherwise None | [
"Get",
"a",
"single",
"(",
"repo",
")",
"commit",
".",
"See",
":",
"func",
":",
"git_commit",
"for",
"the",
"Git",
"Data",
"Commit",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L378-L388 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.commit_comment | def commit_comment(self, comment_id):
"""Get a single commit comment.
:param int comment_id: (required), id of the comment used by GitHub
:returns: :class:`RepoComment <github3.repos.comment.RepoComment>` if
successful, otherwise None
"""
url = self._build_url('comments', str(comment_id), base_url=self._api)
json = self._json(self._get(url), 200)
return RepoComment(json, self) if json else None | python | def commit_comment(self, comment_id):
"""Get a single commit comment.
:param int comment_id: (required), id of the comment used by GitHub
:returns: :class:`RepoComment <github3.repos.comment.RepoComment>` if
successful, otherwise None
"""
url = self._build_url('comments', str(comment_id), base_url=self._api)
json = self._json(self._get(url), 200)
return RepoComment(json, self) if json else None | [
"def",
"commit_comment",
"(",
"self",
",",
"comment_id",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'comments'",
",",
"str",
"(",
"comment_id",
")",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_get",
"(",
"url",
")",
",",
"200",
")",
"return",
"RepoComment",
"(",
"json",
",",
"self",
")",
"if",
"json",
"else",
"None"
] | Get a single commit comment.
:param int comment_id: (required), id of the comment used by GitHub
:returns: :class:`RepoComment <github3.repos.comment.RepoComment>` if
successful, otherwise None | [
"Get",
"a",
"single",
"commit",
"comment",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L390-L399 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.compare_commits | def compare_commits(self, base, head):
"""Compare two commits.
:param str base: (required), base for the comparison
:param str head: (required), compare this against base
:returns: :class:`Comparison <github3.repos.comparison.Comparison>` if
successful, else None
"""
url = self._build_url('compare', base + '...' + head,
base_url=self._api)
json = self._json(self._get(url), 200)
return Comparison(json) if json else None | python | def compare_commits(self, base, head):
"""Compare two commits.
:param str base: (required), base for the comparison
:param str head: (required), compare this against base
:returns: :class:`Comparison <github3.repos.comparison.Comparison>` if
successful, else None
"""
url = self._build_url('compare', base + '...' + head,
base_url=self._api)
json = self._json(self._get(url), 200)
return Comparison(json) if json else None | [
"def",
"compare_commits",
"(",
"self",
",",
"base",
",",
"head",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'compare'",
",",
"base",
"+",
"'...'",
"+",
"head",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_get",
"(",
"url",
")",
",",
"200",
")",
"return",
"Comparison",
"(",
"json",
")",
"if",
"json",
"else",
"None"
] | Compare two commits.
:param str base: (required), base for the comparison
:param str head: (required), compare this against base
:returns: :class:`Comparison <github3.repos.comparison.Comparison>` if
successful, else None | [
"Compare",
"two",
"commits",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L401-L412 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.contents | def contents(self, path, ref=None):
"""Get the contents of the file pointed to by ``path``.
If the path provided is actually a directory, you will receive a
dictionary back of the form::
{
'filename.md': Contents(), # Where Contents an instance
'github.py': Contents(),
}
:param str path: (required), path to file, e.g.
github3/repo.py
:param str ref: (optional), the string name of a commit/branch/tag.
Default: master
:returns: :class:`Contents <github3.repos.contents.Contents>` or dict
if successful, else None
"""
url = self._build_url('contents', path, base_url=self._api)
json = self._json(self._get(url, params={'ref': ref}), 200)
if isinstance(json, dict):
return Contents(json, self)
elif isinstance(json, list):
return dict((j.get('name'), Contents(j, self)) for j in json)
return None | python | def contents(self, path, ref=None):
"""Get the contents of the file pointed to by ``path``.
If the path provided is actually a directory, you will receive a
dictionary back of the form::
{
'filename.md': Contents(), # Where Contents an instance
'github.py': Contents(),
}
:param str path: (required), path to file, e.g.
github3/repo.py
:param str ref: (optional), the string name of a commit/branch/tag.
Default: master
:returns: :class:`Contents <github3.repos.contents.Contents>` or dict
if successful, else None
"""
url = self._build_url('contents', path, base_url=self._api)
json = self._json(self._get(url, params={'ref': ref}), 200)
if isinstance(json, dict):
return Contents(json, self)
elif isinstance(json, list):
return dict((j.get('name'), Contents(j, self)) for j in json)
return None | [
"def",
"contents",
"(",
"self",
",",
"path",
",",
"ref",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'contents'",
",",
"path",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_get",
"(",
"url",
",",
"params",
"=",
"{",
"'ref'",
":",
"ref",
"}",
")",
",",
"200",
")",
"if",
"isinstance",
"(",
"json",
",",
"dict",
")",
":",
"return",
"Contents",
"(",
"json",
",",
"self",
")",
"elif",
"isinstance",
"(",
"json",
",",
"list",
")",
":",
"return",
"dict",
"(",
"(",
"j",
".",
"get",
"(",
"'name'",
")",
",",
"Contents",
"(",
"j",
",",
"self",
")",
")",
"for",
"j",
"in",
"json",
")",
"return",
"None"
] | Get the contents of the file pointed to by ``path``.
If the path provided is actually a directory, you will receive a
dictionary back of the form::
{
'filename.md': Contents(), # Where Contents an instance
'github.py': Contents(),
}
:param str path: (required), path to file, e.g.
github3/repo.py
:param str ref: (optional), the string name of a commit/branch/tag.
Default: master
:returns: :class:`Contents <github3.repos.contents.Contents>` or dict
if successful, else None | [
"Get",
"the",
"contents",
"of",
"the",
"file",
"pointed",
"to",
"by",
"path",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L414-L438 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.create_blob | def create_blob(self, content, encoding):
"""Create a blob with ``content``.
:param str content: (required), content of the blob
:param str encoding: (required), ('base64', 'utf-8')
:returns: string of the SHA returned
"""
sha = ''
if encoding in ('base64', 'utf-8'):
url = self._build_url('git', 'blobs', base_url=self._api)
data = {'content': content, 'encoding': encoding}
json = self._json(self._post(url, data=data), 201)
if json:
sha = json.get('sha')
return sha | python | def create_blob(self, content, encoding):
"""Create a blob with ``content``.
:param str content: (required), content of the blob
:param str encoding: (required), ('base64', 'utf-8')
:returns: string of the SHA returned
"""
sha = ''
if encoding in ('base64', 'utf-8'):
url = self._build_url('git', 'blobs', base_url=self._api)
data = {'content': content, 'encoding': encoding}
json = self._json(self._post(url, data=data), 201)
if json:
sha = json.get('sha')
return sha | [
"def",
"create_blob",
"(",
"self",
",",
"content",
",",
"encoding",
")",
":",
"sha",
"=",
"''",
"if",
"encoding",
"in",
"(",
"'base64'",
",",
"'utf-8'",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'git'",
",",
"'blobs'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"data",
"=",
"{",
"'content'",
":",
"content",
",",
"'encoding'",
":",
"encoding",
"}",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_post",
"(",
"url",
",",
"data",
"=",
"data",
")",
",",
"201",
")",
"if",
"json",
":",
"sha",
"=",
"json",
".",
"get",
"(",
"'sha'",
")",
"return",
"sha"
] | Create a blob with ``content``.
:param str content: (required), content of the blob
:param str encoding: (required), ('base64', 'utf-8')
:returns: string of the SHA returned | [
"Create",
"a",
"blob",
"with",
"content",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L441-L455 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.create_comment | def create_comment(self, body, sha, path=None, position=None, line=1):
"""Create a comment on a commit.
:param str body: (required), body of the message
:param str sha: (required), commit id
:param str path: (optional), relative path of the file to comment
on
:param str position: (optional), line index in the diff to comment on
:param int line: (optional), line number of the file to comment on,
default: 1
:returns: :class:`RepoComment <github3.repos.comment.RepoComment>` if
successful, otherwise None
"""
json = None
if body and sha and (line and int(line) > 0):
data = {'body': body, 'line': line, 'path': path,
'position': position}
self._remove_none(data)
url = self._build_url('commits', sha, 'comments',
base_url=self._api)
json = self._json(self._post(url, data=data), 201)
return RepoComment(json, self) if json else None | python | def create_comment(self, body, sha, path=None, position=None, line=1):
"""Create a comment on a commit.
:param str body: (required), body of the message
:param str sha: (required), commit id
:param str path: (optional), relative path of the file to comment
on
:param str position: (optional), line index in the diff to comment on
:param int line: (optional), line number of the file to comment on,
default: 1
:returns: :class:`RepoComment <github3.repos.comment.RepoComment>` if
successful, otherwise None
"""
json = None
if body and sha and (line and int(line) > 0):
data = {'body': body, 'line': line, 'path': path,
'position': position}
self._remove_none(data)
url = self._build_url('commits', sha, 'comments',
base_url=self._api)
json = self._json(self._post(url, data=data), 201)
return RepoComment(json, self) if json else None | [
"def",
"create_comment",
"(",
"self",
",",
"body",
",",
"sha",
",",
"path",
"=",
"None",
",",
"position",
"=",
"None",
",",
"line",
"=",
"1",
")",
":",
"json",
"=",
"None",
"if",
"body",
"and",
"sha",
"and",
"(",
"line",
"and",
"int",
"(",
"line",
")",
">",
"0",
")",
":",
"data",
"=",
"{",
"'body'",
":",
"body",
",",
"'line'",
":",
"line",
",",
"'path'",
":",
"path",
",",
"'position'",
":",
"position",
"}",
"self",
".",
"_remove_none",
"(",
"data",
")",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'commits'",
",",
"sha",
",",
"'comments'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_post",
"(",
"url",
",",
"data",
"=",
"data",
")",
",",
"201",
")",
"return",
"RepoComment",
"(",
"json",
",",
"self",
")",
"if",
"json",
"else",
"None"
] | Create a comment on a commit.
:param str body: (required), body of the message
:param str sha: (required), commit id
:param str path: (optional), relative path of the file to comment
on
:param str position: (optional), line index in the diff to comment on
:param int line: (optional), line number of the file to comment on,
default: 1
:returns: :class:`RepoComment <github3.repos.comment.RepoComment>` if
successful, otherwise None | [
"Create",
"a",
"comment",
"on",
"a",
"commit",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L458-L480 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.create_commit | def create_commit(self, message, tree, parents, author={}, committer={}):
"""Create a commit on this repository.
:param str message: (required), commit message
:param str tree: (required), SHA of the tree object this
commit points to
:param list parents: (required), SHAs of the commits that were parents
of this commit. If empty, the commit will be written as the root
commit. Even if there is only one parent, this should be an
array.
:param dict author: (optional), if omitted, GitHub will
use the authenticated user's credentials and the current
time. Format: {'name': 'Committer Name', 'email':
'name@example.com', 'date': 'YYYY-MM-DDTHH:MM:SS+HH:00'}
:param dict committer: (optional), if ommitted, GitHub will use the
author parameters. Should be the same format as the author
parameter.
:returns: :class:`Commit <github3.git.Commit>` if successful, else
None
"""
json = None
if message and tree and isinstance(parents, list):
url = self._build_url('git', 'commits', base_url=self._api)
data = {'message': message, 'tree': tree, 'parents': parents,
'author': author, 'committer': committer}
json = self._json(self._post(url, data=data), 201)
return Commit(json, self) if json else None | python | def create_commit(self, message, tree, parents, author={}, committer={}):
"""Create a commit on this repository.
:param str message: (required), commit message
:param str tree: (required), SHA of the tree object this
commit points to
:param list parents: (required), SHAs of the commits that were parents
of this commit. If empty, the commit will be written as the root
commit. Even if there is only one parent, this should be an
array.
:param dict author: (optional), if omitted, GitHub will
use the authenticated user's credentials and the current
time. Format: {'name': 'Committer Name', 'email':
'name@example.com', 'date': 'YYYY-MM-DDTHH:MM:SS+HH:00'}
:param dict committer: (optional), if ommitted, GitHub will use the
author parameters. Should be the same format as the author
parameter.
:returns: :class:`Commit <github3.git.Commit>` if successful, else
None
"""
json = None
if message and tree and isinstance(parents, list):
url = self._build_url('git', 'commits', base_url=self._api)
data = {'message': message, 'tree': tree, 'parents': parents,
'author': author, 'committer': committer}
json = self._json(self._post(url, data=data), 201)
return Commit(json, self) if json else None | [
"def",
"create_commit",
"(",
"self",
",",
"message",
",",
"tree",
",",
"parents",
",",
"author",
"=",
"{",
"}",
",",
"committer",
"=",
"{",
"}",
")",
":",
"json",
"=",
"None",
"if",
"message",
"and",
"tree",
"and",
"isinstance",
"(",
"parents",
",",
"list",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'git'",
",",
"'commits'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"data",
"=",
"{",
"'message'",
":",
"message",
",",
"'tree'",
":",
"tree",
",",
"'parents'",
":",
"parents",
",",
"'author'",
":",
"author",
",",
"'committer'",
":",
"committer",
"}",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_post",
"(",
"url",
",",
"data",
"=",
"data",
")",
",",
"201",
")",
"return",
"Commit",
"(",
"json",
",",
"self",
")",
"if",
"json",
"else",
"None"
] | Create a commit on this repository.
:param str message: (required), commit message
:param str tree: (required), SHA of the tree object this
commit points to
:param list parents: (required), SHAs of the commits that were parents
of this commit. If empty, the commit will be written as the root
commit. Even if there is only one parent, this should be an
array.
:param dict author: (optional), if omitted, GitHub will
use the authenticated user's credentials and the current
time. Format: {'name': 'Committer Name', 'email':
'name@example.com', 'date': 'YYYY-MM-DDTHH:MM:SS+HH:00'}
:param dict committer: (optional), if ommitted, GitHub will use the
author parameters. Should be the same format as the author
parameter.
:returns: :class:`Commit <github3.git.Commit>` if successful, else
None | [
"Create",
"a",
"commit",
"on",
"this",
"repository",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L483-L509 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.create_deployment | def create_deployment(self, ref, force=False, payload='',
auto_merge=False, description='', environment=None):
"""Create a deployment.
:param str ref: (required), The ref to deploy. This can be a branch,
tag, or sha.
:param bool force: Optional parameter to bypass any ahead/behind
checks or commit status checks. Default: False
:param str payload: Optional JSON payload with extra information about
the deployment. Default: ""
:param bool auto_merge: Optional parameter to merge the default branch
into the requested deployment branch if necessary. Default: False
:param str description: Optional short description. Default: ""
:param str environment: Optional name for the target deployment
environment (e.g., production, staging, qa). Default: "production"
:returns: :class:`Deployment <github3.repos.deployment.Deployment>`
"""
json = None
if ref:
url = self._build_url('deployments', base_url=self._api)
data = {'ref': ref, 'force': force, 'payload': payload,
'auto_merge': auto_merge, 'description': description,
'environment': environment}
self._remove_none(data)
headers = Deployment.CUSTOM_HEADERS
json = self._json(self._post(url, data=data, headers=headers),
201)
return Deployment(json, self) if json else None | python | def create_deployment(self, ref, force=False, payload='',
auto_merge=False, description='', environment=None):
"""Create a deployment.
:param str ref: (required), The ref to deploy. This can be a branch,
tag, or sha.
:param bool force: Optional parameter to bypass any ahead/behind
checks or commit status checks. Default: False
:param str payload: Optional JSON payload with extra information about
the deployment. Default: ""
:param bool auto_merge: Optional parameter to merge the default branch
into the requested deployment branch if necessary. Default: False
:param str description: Optional short description. Default: ""
:param str environment: Optional name for the target deployment
environment (e.g., production, staging, qa). Default: "production"
:returns: :class:`Deployment <github3.repos.deployment.Deployment>`
"""
json = None
if ref:
url = self._build_url('deployments', base_url=self._api)
data = {'ref': ref, 'force': force, 'payload': payload,
'auto_merge': auto_merge, 'description': description,
'environment': environment}
self._remove_none(data)
headers = Deployment.CUSTOM_HEADERS
json = self._json(self._post(url, data=data, headers=headers),
201)
return Deployment(json, self) if json else None | [
"def",
"create_deployment",
"(",
"self",
",",
"ref",
",",
"force",
"=",
"False",
",",
"payload",
"=",
"''",
",",
"auto_merge",
"=",
"False",
",",
"description",
"=",
"''",
",",
"environment",
"=",
"None",
")",
":",
"json",
"=",
"None",
"if",
"ref",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'deployments'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"data",
"=",
"{",
"'ref'",
":",
"ref",
",",
"'force'",
":",
"force",
",",
"'payload'",
":",
"payload",
",",
"'auto_merge'",
":",
"auto_merge",
",",
"'description'",
":",
"description",
",",
"'environment'",
":",
"environment",
"}",
"self",
".",
"_remove_none",
"(",
"data",
")",
"headers",
"=",
"Deployment",
".",
"CUSTOM_HEADERS",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_post",
"(",
"url",
",",
"data",
"=",
"data",
",",
"headers",
"=",
"headers",
")",
",",
"201",
")",
"return",
"Deployment",
"(",
"json",
",",
"self",
")",
"if",
"json",
"else",
"None"
] | Create a deployment.
:param str ref: (required), The ref to deploy. This can be a branch,
tag, or sha.
:param bool force: Optional parameter to bypass any ahead/behind
checks or commit status checks. Default: False
:param str payload: Optional JSON payload with extra information about
the deployment. Default: ""
:param bool auto_merge: Optional parameter to merge the default branch
into the requested deployment branch if necessary. Default: False
:param str description: Optional short description. Default: ""
:param str environment: Optional name for the target deployment
environment (e.g., production, staging, qa). Default: "production"
:returns: :class:`Deployment <github3.repos.deployment.Deployment>` | [
"Create",
"a",
"deployment",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L512-L539 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.create_file | def create_file(self, path, message, content, branch=None,
committer=None, author=None):
"""Create a file in this repository.
See also: http://developer.github.com/v3/repos/contents/#create-a-file
:param str path: (required), path of the file in the repository
:param str message: (required), commit message
:param bytes content: (required), the actual data in the file
:param str branch: (optional), branch to create the commit on.
Defaults to the default branch of the repository
:param dict committer: (optional), if no information is given the
authenticated user's information will be used. You must specify
both a name and email.
:param dict author: (optional), if omitted this will be filled in with
committer information. If passed, you must specify both a name and
email.
:returns: {
'content': :class:`Contents <github3.repos.contents.Contents>`:,
'commit': :class:`Commit <github3.git.Commit>`}
"""
if content and not isinstance(content, bytes):
raise ValueError( # (No coverage)
'content must be a bytes object') # (No coverage)
json = None
if path and message and content:
url = self._build_url('contents', path, base_url=self._api)
content = b64encode(content).decode('utf-8')
data = {'message': message, 'content': content, 'branch': branch,
'committer': validate_commmitter(committer),
'author': validate_commmitter(author)}
self._remove_none(data)
json = self._json(self._put(url, data=dumps(data)), 201)
if 'content' in json and 'commit' in json:
json['content'] = Contents(json['content'], self)
json['commit'] = Commit(json['commit'], self)
return json | python | def create_file(self, path, message, content, branch=None,
committer=None, author=None):
"""Create a file in this repository.
See also: http://developer.github.com/v3/repos/contents/#create-a-file
:param str path: (required), path of the file in the repository
:param str message: (required), commit message
:param bytes content: (required), the actual data in the file
:param str branch: (optional), branch to create the commit on.
Defaults to the default branch of the repository
:param dict committer: (optional), if no information is given the
authenticated user's information will be used. You must specify
both a name and email.
:param dict author: (optional), if omitted this will be filled in with
committer information. If passed, you must specify both a name and
email.
:returns: {
'content': :class:`Contents <github3.repos.contents.Contents>`:,
'commit': :class:`Commit <github3.git.Commit>`}
"""
if content and not isinstance(content, bytes):
raise ValueError( # (No coverage)
'content must be a bytes object') # (No coverage)
json = None
if path and message and content:
url = self._build_url('contents', path, base_url=self._api)
content = b64encode(content).decode('utf-8')
data = {'message': message, 'content': content, 'branch': branch,
'committer': validate_commmitter(committer),
'author': validate_commmitter(author)}
self._remove_none(data)
json = self._json(self._put(url, data=dumps(data)), 201)
if 'content' in json and 'commit' in json:
json['content'] = Contents(json['content'], self)
json['commit'] = Commit(json['commit'], self)
return json | [
"def",
"create_file",
"(",
"self",
",",
"path",
",",
"message",
",",
"content",
",",
"branch",
"=",
"None",
",",
"committer",
"=",
"None",
",",
"author",
"=",
"None",
")",
":",
"if",
"content",
"and",
"not",
"isinstance",
"(",
"content",
",",
"bytes",
")",
":",
"raise",
"ValueError",
"(",
"# (No coverage)",
"'content must be a bytes object'",
")",
"# (No coverage)",
"json",
"=",
"None",
"if",
"path",
"and",
"message",
"and",
"content",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'contents'",
",",
"path",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"content",
"=",
"b64encode",
"(",
"content",
")",
".",
"decode",
"(",
"'utf-8'",
")",
"data",
"=",
"{",
"'message'",
":",
"message",
",",
"'content'",
":",
"content",
",",
"'branch'",
":",
"branch",
",",
"'committer'",
":",
"validate_commmitter",
"(",
"committer",
")",
",",
"'author'",
":",
"validate_commmitter",
"(",
"author",
")",
"}",
"self",
".",
"_remove_none",
"(",
"data",
")",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_put",
"(",
"url",
",",
"data",
"=",
"dumps",
"(",
"data",
")",
")",
",",
"201",
")",
"if",
"'content'",
"in",
"json",
"and",
"'commit'",
"in",
"json",
":",
"json",
"[",
"'content'",
"]",
"=",
"Contents",
"(",
"json",
"[",
"'content'",
"]",
",",
"self",
")",
"json",
"[",
"'commit'",
"]",
"=",
"Commit",
"(",
"json",
"[",
"'commit'",
"]",
",",
"self",
")",
"return",
"json"
] | Create a file in this repository.
See also: http://developer.github.com/v3/repos/contents/#create-a-file
:param str path: (required), path of the file in the repository
:param str message: (required), commit message
:param bytes content: (required), the actual data in the file
:param str branch: (optional), branch to create the commit on.
Defaults to the default branch of the repository
:param dict committer: (optional), if no information is given the
authenticated user's information will be used. You must specify
both a name and email.
:param dict author: (optional), if omitted this will be filled in with
committer information. If passed, you must specify both a name and
email.
:returns: {
'content': :class:`Contents <github3.repos.contents.Contents>`:,
'commit': :class:`Commit <github3.git.Commit>`} | [
"Create",
"a",
"file",
"in",
"this",
"repository",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L542-L580 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.create_fork | def create_fork(self, organization=None):
"""Create a fork of this repository.
:param str organization: (required), login for organization to create
the fork under
:returns: :class:`Repository <Repository>` if successful, else None
"""
url = self._build_url('forks', base_url=self._api)
if organization:
resp = self._post(url, data={'organization': organization})
else:
resp = self._post(url)
json = self._json(resp, 202)
return Repository(json, self) if json else None | python | def create_fork(self, organization=None):
"""Create a fork of this repository.
:param str organization: (required), login for organization to create
the fork under
:returns: :class:`Repository <Repository>` if successful, else None
"""
url = self._build_url('forks', base_url=self._api)
if organization:
resp = self._post(url, data={'organization': organization})
else:
resp = self._post(url)
json = self._json(resp, 202)
return Repository(json, self) if json else None | [
"def",
"create_fork",
"(",
"self",
",",
"organization",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'forks'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"if",
"organization",
":",
"resp",
"=",
"self",
".",
"_post",
"(",
"url",
",",
"data",
"=",
"{",
"'organization'",
":",
"organization",
"}",
")",
"else",
":",
"resp",
"=",
"self",
".",
"_post",
"(",
"url",
")",
"json",
"=",
"self",
".",
"_json",
"(",
"resp",
",",
"202",
")",
"return",
"Repository",
"(",
"json",
",",
"self",
")",
"if",
"json",
"else",
"None"
] | Create a fork of this repository.
:param str organization: (required), login for organization to create
the fork under
:returns: :class:`Repository <Repository>` if successful, else None | [
"Create",
"a",
"fork",
"of",
"this",
"repository",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L583-L597 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.create_hook | def create_hook(self, name, config, events=['push'], active=True):
"""Create a hook on this repository.
:param str name: (required), name of the hook
:param dict config: (required), key-value pairs which act as settings
for this hook
:param list events: (optional), events the hook is triggered for
:param bool active: (optional), whether the hook is actually
triggered
:returns: :class:`Hook <github3.repos.hook.Hook>` if successful,
otherwise None
"""
json = None
if name and config and isinstance(config, dict):
url = self._build_url('hooks', base_url=self._api)
data = {'name': name, 'config': config, 'events': events,
'active': active}
json = self._json(self._post(url, data=data), 201)
return Hook(json, self) if json else None | python | def create_hook(self, name, config, events=['push'], active=True):
"""Create a hook on this repository.
:param str name: (required), name of the hook
:param dict config: (required), key-value pairs which act as settings
for this hook
:param list events: (optional), events the hook is triggered for
:param bool active: (optional), whether the hook is actually
triggered
:returns: :class:`Hook <github3.repos.hook.Hook>` if successful,
otherwise None
"""
json = None
if name and config and isinstance(config, dict):
url = self._build_url('hooks', base_url=self._api)
data = {'name': name, 'config': config, 'events': events,
'active': active}
json = self._json(self._post(url, data=data), 201)
return Hook(json, self) if json else None | [
"def",
"create_hook",
"(",
"self",
",",
"name",
",",
"config",
",",
"events",
"=",
"[",
"'push'",
"]",
",",
"active",
"=",
"True",
")",
":",
"json",
"=",
"None",
"if",
"name",
"and",
"config",
"and",
"isinstance",
"(",
"config",
",",
"dict",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'hooks'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"data",
"=",
"{",
"'name'",
":",
"name",
",",
"'config'",
":",
"config",
",",
"'events'",
":",
"events",
",",
"'active'",
":",
"active",
"}",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_post",
"(",
"url",
",",
"data",
"=",
"data",
")",
",",
"201",
")",
"return",
"Hook",
"(",
"json",
",",
"self",
")",
"if",
"json",
"else",
"None"
] | Create a hook on this repository.
:param str name: (required), name of the hook
:param dict config: (required), key-value pairs which act as settings
for this hook
:param list events: (optional), events the hook is triggered for
:param bool active: (optional), whether the hook is actually
triggered
:returns: :class:`Hook <github3.repos.hook.Hook>` if successful,
otherwise None | [
"Create",
"a",
"hook",
"on",
"this",
"repository",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L600-L618 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.create_issue | def create_issue(self,
title,
body=None,
assignee=None,
milestone=None,
labels=None):
"""Creates an issue on this repository.
:param str title: (required), title of the issue
:param str body: (optional), body of the issue
:param str assignee: (optional), login of the user to assign the
issue to
:param int milestone: (optional), id number of the milestone to
attribute this issue to (e.g. ``m`` is a :class:`Milestone
<github3.issues.milestone.Milestone>` object, ``m.number`` is
what you pass here.)
:param labels: (optional), labels to apply to this
issue
:type labels: list of strings
:returns: :class:`Issue <github3.issues.issue.Issue>` if successful,
otherwise None
"""
issue = {'title': title, 'body': body, 'assignee': assignee,
'milestone': milestone, 'labels': labels}
self._remove_none(issue)
json = None
if issue:
url = self._build_url('issues', base_url=self._api)
json = self._json(self._post(url, data=issue), 201)
return Issue(json, self) if json else None | python | def create_issue(self,
title,
body=None,
assignee=None,
milestone=None,
labels=None):
"""Creates an issue on this repository.
:param str title: (required), title of the issue
:param str body: (optional), body of the issue
:param str assignee: (optional), login of the user to assign the
issue to
:param int milestone: (optional), id number of the milestone to
attribute this issue to (e.g. ``m`` is a :class:`Milestone
<github3.issues.milestone.Milestone>` object, ``m.number`` is
what you pass here.)
:param labels: (optional), labels to apply to this
issue
:type labels: list of strings
:returns: :class:`Issue <github3.issues.issue.Issue>` if successful,
otherwise None
"""
issue = {'title': title, 'body': body, 'assignee': assignee,
'milestone': milestone, 'labels': labels}
self._remove_none(issue)
json = None
if issue:
url = self._build_url('issues', base_url=self._api)
json = self._json(self._post(url, data=issue), 201)
return Issue(json, self) if json else None | [
"def",
"create_issue",
"(",
"self",
",",
"title",
",",
"body",
"=",
"None",
",",
"assignee",
"=",
"None",
",",
"milestone",
"=",
"None",
",",
"labels",
"=",
"None",
")",
":",
"issue",
"=",
"{",
"'title'",
":",
"title",
",",
"'body'",
":",
"body",
",",
"'assignee'",
":",
"assignee",
",",
"'milestone'",
":",
"milestone",
",",
"'labels'",
":",
"labels",
"}",
"self",
".",
"_remove_none",
"(",
"issue",
")",
"json",
"=",
"None",
"if",
"issue",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'issues'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_post",
"(",
"url",
",",
"data",
"=",
"issue",
")",
",",
"201",
")",
"return",
"Issue",
"(",
"json",
",",
"self",
")",
"if",
"json",
"else",
"None"
] | Creates an issue on this repository.
:param str title: (required), title of the issue
:param str body: (optional), body of the issue
:param str assignee: (optional), login of the user to assign the
issue to
:param int milestone: (optional), id number of the milestone to
attribute this issue to (e.g. ``m`` is a :class:`Milestone
<github3.issues.milestone.Milestone>` object, ``m.number`` is
what you pass here.)
:param labels: (optional), labels to apply to this
issue
:type labels: list of strings
:returns: :class:`Issue <github3.issues.issue.Issue>` if successful,
otherwise None | [
"Creates",
"an",
"issue",
"on",
"this",
"repository",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L621-L652 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.create_key | def create_key(self, title, key):
"""Create a deploy key.
:param str title: (required), title of key
:param str key: (required), key text
:returns: :class:`Key <github3.users.Key>` if successful, else None
"""
json = None
if title and key:
data = {'title': title, 'key': key}
url = self._build_url('keys', base_url=self._api)
json = self._json(self._post(url, data=data), 201)
return Key(json, self) if json else None | python | def create_key(self, title, key):
"""Create a deploy key.
:param str title: (required), title of key
:param str key: (required), key text
:returns: :class:`Key <github3.users.Key>` if successful, else None
"""
json = None
if title and key:
data = {'title': title, 'key': key}
url = self._build_url('keys', base_url=self._api)
json = self._json(self._post(url, data=data), 201)
return Key(json, self) if json else None | [
"def",
"create_key",
"(",
"self",
",",
"title",
",",
"key",
")",
":",
"json",
"=",
"None",
"if",
"title",
"and",
"key",
":",
"data",
"=",
"{",
"'title'",
":",
"title",
",",
"'key'",
":",
"key",
"}",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'keys'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_post",
"(",
"url",
",",
"data",
"=",
"data",
")",
",",
"201",
")",
"return",
"Key",
"(",
"json",
",",
"self",
")",
"if",
"json",
"else",
"None"
] | Create a deploy key.
:param str title: (required), title of key
:param str key: (required), key text
:returns: :class:`Key <github3.users.Key>` if successful, else None | [
"Create",
"a",
"deploy",
"key",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L655-L667 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.create_label | def create_label(self, name, color):
"""Create a label for this repository.
:param str name: (required), name to give to the label
:param str color: (required), value of the color to assign to the
label, e.g., '#fafafa' or 'fafafa' (the latter is what is sent)
:returns: :class:`Label <github3.issues.label.Label>` if successful,
else None
"""
json = None
if name and color:
data = {'name': name, 'color': color.strip('#')}
url = self._build_url('labels', base_url=self._api)
json = self._json(self._post(url, data=data), 201)
return Label(json, self) if json else None | python | def create_label(self, name, color):
"""Create a label for this repository.
:param str name: (required), name to give to the label
:param str color: (required), value of the color to assign to the
label, e.g., '#fafafa' or 'fafafa' (the latter is what is sent)
:returns: :class:`Label <github3.issues.label.Label>` if successful,
else None
"""
json = None
if name and color:
data = {'name': name, 'color': color.strip('#')}
url = self._build_url('labels', base_url=self._api)
json = self._json(self._post(url, data=data), 201)
return Label(json, self) if json else None | [
"def",
"create_label",
"(",
"self",
",",
"name",
",",
"color",
")",
":",
"json",
"=",
"None",
"if",
"name",
"and",
"color",
":",
"data",
"=",
"{",
"'name'",
":",
"name",
",",
"'color'",
":",
"color",
".",
"strip",
"(",
"'#'",
")",
"}",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'labels'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_post",
"(",
"url",
",",
"data",
"=",
"data",
")",
",",
"201",
")",
"return",
"Label",
"(",
"json",
",",
"self",
")",
"if",
"json",
"else",
"None"
] | Create a label for this repository.
:param str name: (required), name to give to the label
:param str color: (required), value of the color to assign to the
label, e.g., '#fafafa' or 'fafafa' (the latter is what is sent)
:returns: :class:`Label <github3.issues.label.Label>` if successful,
else None | [
"Create",
"a",
"label",
"for",
"this",
"repository",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L670-L684 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.create_milestone | def create_milestone(self, title, state=None, description=None,
due_on=None):
"""Create a milestone for this repository.
:param str title: (required), title of the milestone
:param str state: (optional), state of the milestone, accepted
values: ('open', 'closed'), default: 'open'
:param str description: (optional), description of the milestone
:param str due_on: (optional), ISO 8601 formatted due date
:returns: :class:`Milestone <github3.issues.milestone.Milestone>` if
successful, otherwise None
"""
url = self._build_url('milestones', base_url=self._api)
if state not in ('open', 'closed'):
state = None
data = {'title': title, 'state': state,
'description': description, 'due_on': due_on}
self._remove_none(data)
json = None
if data:
json = self._json(self._post(url, data=data), 201)
return Milestone(json, self) if json else None | python | def create_milestone(self, title, state=None, description=None,
due_on=None):
"""Create a milestone for this repository.
:param str title: (required), title of the milestone
:param str state: (optional), state of the milestone, accepted
values: ('open', 'closed'), default: 'open'
:param str description: (optional), description of the milestone
:param str due_on: (optional), ISO 8601 formatted due date
:returns: :class:`Milestone <github3.issues.milestone.Milestone>` if
successful, otherwise None
"""
url = self._build_url('milestones', base_url=self._api)
if state not in ('open', 'closed'):
state = None
data = {'title': title, 'state': state,
'description': description, 'due_on': due_on}
self._remove_none(data)
json = None
if data:
json = self._json(self._post(url, data=data), 201)
return Milestone(json, self) if json else None | [
"def",
"create_milestone",
"(",
"self",
",",
"title",
",",
"state",
"=",
"None",
",",
"description",
"=",
"None",
",",
"due_on",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'milestones'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"if",
"state",
"not",
"in",
"(",
"'open'",
",",
"'closed'",
")",
":",
"state",
"=",
"None",
"data",
"=",
"{",
"'title'",
":",
"title",
",",
"'state'",
":",
"state",
",",
"'description'",
":",
"description",
",",
"'due_on'",
":",
"due_on",
"}",
"self",
".",
"_remove_none",
"(",
"data",
")",
"json",
"=",
"None",
"if",
"data",
":",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_post",
"(",
"url",
",",
"data",
"=",
"data",
")",
",",
"201",
")",
"return",
"Milestone",
"(",
"json",
",",
"self",
")",
"if",
"json",
"else",
"None"
] | Create a milestone for this repository.
:param str title: (required), title of the milestone
:param str state: (optional), state of the milestone, accepted
values: ('open', 'closed'), default: 'open'
:param str description: (optional), description of the milestone
:param str due_on: (optional), ISO 8601 formatted due date
:returns: :class:`Milestone <github3.issues.milestone.Milestone>` if
successful, otherwise None | [
"Create",
"a",
"milestone",
"for",
"this",
"repository",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L687-L708 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.create_pull | def create_pull(self, title, base, head, body=None):
"""Create a pull request of ``head`` onto ``base`` branch in this repo.
:param str title: (required)
:param str base: (required), e.g., 'master'
:param str head: (required), e.g., 'username:branch'
:param str body: (optional), markdown formatted description
:returns: :class:`PullRequest <github3.pulls.PullRequest>` if
successful, else None
"""
data = {'title': title, 'body': body, 'base': base,
'head': head}
return self._create_pull(data) | python | def create_pull(self, title, base, head, body=None):
"""Create a pull request of ``head`` onto ``base`` branch in this repo.
:param str title: (required)
:param str base: (required), e.g., 'master'
:param str head: (required), e.g., 'username:branch'
:param str body: (optional), markdown formatted description
:returns: :class:`PullRequest <github3.pulls.PullRequest>` if
successful, else None
"""
data = {'title': title, 'body': body, 'base': base,
'head': head}
return self._create_pull(data) | [
"def",
"create_pull",
"(",
"self",
",",
"title",
",",
"base",
",",
"head",
",",
"body",
"=",
"None",
")",
":",
"data",
"=",
"{",
"'title'",
":",
"title",
",",
"'body'",
":",
"body",
",",
"'base'",
":",
"base",
",",
"'head'",
":",
"head",
"}",
"return",
"self",
".",
"_create_pull",
"(",
"data",
")"
] | Create a pull request of ``head`` onto ``base`` branch in this repo.
:param str title: (required)
:param str base: (required), e.g., 'master'
:param str head: (required), e.g., 'username:branch'
:param str body: (optional), markdown formatted description
:returns: :class:`PullRequest <github3.pulls.PullRequest>` if
successful, else None | [
"Create",
"a",
"pull",
"request",
"of",
"head",
"onto",
"base",
"branch",
"in",
"this",
"repo",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L711-L723 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.create_pull_from_issue | def create_pull_from_issue(self, issue, base, head):
"""Create a pull request from issue #``issue``.
:param int issue: (required), issue number
:param str base: (required), e.g., 'master'
:param str head: (required), e.g., 'username:branch'
:returns: :class:`PullRequest <github3.pulls.PullRequest>` if
successful, else None
"""
if int(issue) > 0:
data = {'issue': issue, 'base': base, 'head': head}
return self._create_pull(data)
return None | python | def create_pull_from_issue(self, issue, base, head):
"""Create a pull request from issue #``issue``.
:param int issue: (required), issue number
:param str base: (required), e.g., 'master'
:param str head: (required), e.g., 'username:branch'
:returns: :class:`PullRequest <github3.pulls.PullRequest>` if
successful, else None
"""
if int(issue) > 0:
data = {'issue': issue, 'base': base, 'head': head}
return self._create_pull(data)
return None | [
"def",
"create_pull_from_issue",
"(",
"self",
",",
"issue",
",",
"base",
",",
"head",
")",
":",
"if",
"int",
"(",
"issue",
")",
">",
"0",
":",
"data",
"=",
"{",
"'issue'",
":",
"issue",
",",
"'base'",
":",
"base",
",",
"'head'",
":",
"head",
"}",
"return",
"self",
".",
"_create_pull",
"(",
"data",
")",
"return",
"None"
] | Create a pull request from issue #``issue``.
:param int issue: (required), issue number
:param str base: (required), e.g., 'master'
:param str head: (required), e.g., 'username:branch'
:returns: :class:`PullRequest <github3.pulls.PullRequest>` if
successful, else None | [
"Create",
"a",
"pull",
"request",
"from",
"issue",
"#",
"issue",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L726-L738 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.create_ref | def create_ref(self, ref, sha):
"""Create a reference in this repository.
:param str ref: (required), fully qualified name of the reference,
e.g. ``refs/heads/master``. If it doesn't start with ``refs`` and
contain at least two slashes, GitHub's API will reject it.
:param str sha: (required), SHA1 value to set the reference to
:returns: :class:`Reference <github3.git.Reference>` if successful
else None
"""
json = None
if ref and ref.count('/') >= 2 and sha:
data = {'ref': ref, 'sha': sha}
url = self._build_url('git', 'refs', base_url=self._api)
json = self._json(self._post(url, data=data), 201)
return Reference(json, self) if json else None | python | def create_ref(self, ref, sha):
"""Create a reference in this repository.
:param str ref: (required), fully qualified name of the reference,
e.g. ``refs/heads/master``. If it doesn't start with ``refs`` and
contain at least two slashes, GitHub's API will reject it.
:param str sha: (required), SHA1 value to set the reference to
:returns: :class:`Reference <github3.git.Reference>` if successful
else None
"""
json = None
if ref and ref.count('/') >= 2 and sha:
data = {'ref': ref, 'sha': sha}
url = self._build_url('git', 'refs', base_url=self._api)
json = self._json(self._post(url, data=data), 201)
return Reference(json, self) if json else None | [
"def",
"create_ref",
"(",
"self",
",",
"ref",
",",
"sha",
")",
":",
"json",
"=",
"None",
"if",
"ref",
"and",
"ref",
".",
"count",
"(",
"'/'",
")",
">=",
"2",
"and",
"sha",
":",
"data",
"=",
"{",
"'ref'",
":",
"ref",
",",
"'sha'",
":",
"sha",
"}",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'git'",
",",
"'refs'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_post",
"(",
"url",
",",
"data",
"=",
"data",
")",
",",
"201",
")",
"return",
"Reference",
"(",
"json",
",",
"self",
")",
"if",
"json",
"else",
"None"
] | Create a reference in this repository.
:param str ref: (required), fully qualified name of the reference,
e.g. ``refs/heads/master``. If it doesn't start with ``refs`` and
contain at least two slashes, GitHub's API will reject it.
:param str sha: (required), SHA1 value to set the reference to
:returns: :class:`Reference <github3.git.Reference>` if successful
else None | [
"Create",
"a",
"reference",
"in",
"this",
"repository",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L741-L756 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.create_release | def create_release(self, tag_name, target_commitish=None, name=None,
body=None, draft=False, prerelease=False):
"""Create a release for this repository.
:param str tag_name: (required), name to give to the tag
:param str target_commitish: (optional), vague concept of a target,
either a SHA or a branch name.
:param str name: (optional), name of the release
:param str body: (optional), description of the release
:param bool draft: (optional), whether this release is a draft or not
:param bool prerelease: (optional), whether this is a prerelease or
not
:returns: :class:`Release <github3.repos.release.Release>`
"""
data = {'tag_name': str(tag_name),
'target_commitish': target_commitish,
'name': name,
'body': body,
'draft': draft,
'prerelease': prerelease
}
self._remove_none(data)
url = self._build_url('releases', base_url=self._api)
json = self._json(self._post(
url, data=data, headers=Release.CUSTOM_HEADERS
), 201)
return Release(json, self) | python | def create_release(self, tag_name, target_commitish=None, name=None,
body=None, draft=False, prerelease=False):
"""Create a release for this repository.
:param str tag_name: (required), name to give to the tag
:param str target_commitish: (optional), vague concept of a target,
either a SHA or a branch name.
:param str name: (optional), name of the release
:param str body: (optional), description of the release
:param bool draft: (optional), whether this release is a draft or not
:param bool prerelease: (optional), whether this is a prerelease or
not
:returns: :class:`Release <github3.repos.release.Release>`
"""
data = {'tag_name': str(tag_name),
'target_commitish': target_commitish,
'name': name,
'body': body,
'draft': draft,
'prerelease': prerelease
}
self._remove_none(data)
url = self._build_url('releases', base_url=self._api)
json = self._json(self._post(
url, data=data, headers=Release.CUSTOM_HEADERS
), 201)
return Release(json, self) | [
"def",
"create_release",
"(",
"self",
",",
"tag_name",
",",
"target_commitish",
"=",
"None",
",",
"name",
"=",
"None",
",",
"body",
"=",
"None",
",",
"draft",
"=",
"False",
",",
"prerelease",
"=",
"False",
")",
":",
"data",
"=",
"{",
"'tag_name'",
":",
"str",
"(",
"tag_name",
")",
",",
"'target_commitish'",
":",
"target_commitish",
",",
"'name'",
":",
"name",
",",
"'body'",
":",
"body",
",",
"'draft'",
":",
"draft",
",",
"'prerelease'",
":",
"prerelease",
"}",
"self",
".",
"_remove_none",
"(",
"data",
")",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'releases'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_post",
"(",
"url",
",",
"data",
"=",
"data",
",",
"headers",
"=",
"Release",
".",
"CUSTOM_HEADERS",
")",
",",
"201",
")",
"return",
"Release",
"(",
"json",
",",
"self",
")"
] | Create a release for this repository.
:param str tag_name: (required), name to give to the tag
:param str target_commitish: (optional), vague concept of a target,
either a SHA or a branch name.
:param str name: (optional), name of the release
:param str body: (optional), description of the release
:param bool draft: (optional), whether this release is a draft or not
:param bool prerelease: (optional), whether this is a prerelease or
not
:returns: :class:`Release <github3.repos.release.Release>` | [
"Create",
"a",
"release",
"for",
"this",
"repository",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L759-L786 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.create_status | def create_status(self, sha, state, target_url=None, description=None,
context='default'):
"""Create a status object on a commit.
:param str sha: (required), SHA of the commit to create the status on
:param str state: (required), state of the test; only the following
are accepted: 'pending', 'success', 'error', 'failure'
:param str target_url: (optional), URL to associate with this status.
:param str description: (optional), short description of the status
:param str context: (optional), A string label to differentiate this
status from the status of other systems
:returns: the status created if successful
:rtype: :class:`~github3.repos.status.Status`
"""
json = None
if sha and state:
data = {'state': state, 'target_url': target_url,
'description': description, 'context': context}
url = self._build_url('statuses', sha, base_url=self._api)
self._remove_none(data)
json = self._json(self._post(url, data=data), 201)
return Status(json) if json else None | python | def create_status(self, sha, state, target_url=None, description=None,
context='default'):
"""Create a status object on a commit.
:param str sha: (required), SHA of the commit to create the status on
:param str state: (required), state of the test; only the following
are accepted: 'pending', 'success', 'error', 'failure'
:param str target_url: (optional), URL to associate with this status.
:param str description: (optional), short description of the status
:param str context: (optional), A string label to differentiate this
status from the status of other systems
:returns: the status created if successful
:rtype: :class:`~github3.repos.status.Status`
"""
json = None
if sha and state:
data = {'state': state, 'target_url': target_url,
'description': description, 'context': context}
url = self._build_url('statuses', sha, base_url=self._api)
self._remove_none(data)
json = self._json(self._post(url, data=data), 201)
return Status(json) if json else None | [
"def",
"create_status",
"(",
"self",
",",
"sha",
",",
"state",
",",
"target_url",
"=",
"None",
",",
"description",
"=",
"None",
",",
"context",
"=",
"'default'",
")",
":",
"json",
"=",
"None",
"if",
"sha",
"and",
"state",
":",
"data",
"=",
"{",
"'state'",
":",
"state",
",",
"'target_url'",
":",
"target_url",
",",
"'description'",
":",
"description",
",",
"'context'",
":",
"context",
"}",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'statuses'",
",",
"sha",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"self",
".",
"_remove_none",
"(",
"data",
")",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_post",
"(",
"url",
",",
"data",
"=",
"data",
")",
",",
"201",
")",
"return",
"Status",
"(",
"json",
")",
"if",
"json",
"else",
"None"
] | Create a status object on a commit.
:param str sha: (required), SHA of the commit to create the status on
:param str state: (required), state of the test; only the following
are accepted: 'pending', 'success', 'error', 'failure'
:param str target_url: (optional), URL to associate with this status.
:param str description: (optional), short description of the status
:param str context: (optional), A string label to differentiate this
status from the status of other systems
:returns: the status created if successful
:rtype: :class:`~github3.repos.status.Status` | [
"Create",
"a",
"status",
"object",
"on",
"a",
"commit",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L789-L810 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.create_tag | def create_tag(self, tag, message, sha, obj_type, tagger,
lightweight=False):
"""Create a tag in this repository.
:param str tag: (required), name of the tag
:param str message: (required), tag message
:param str sha: (required), SHA of the git object this is tagging
:param str obj_type: (required), type of object being tagged, e.g.,
'commit', 'tree', 'blob'
:param dict tagger: (required), containing the name, email of the
tagger and the date it was tagged
:param bool lightweight: (optional), if False, create an annotated
tag, otherwise create a lightweight tag (a Reference).
:returns: If lightweight == False: :class:`Tag <github3.git.Tag>` if
successful, else None. If lightweight == True: :class:`Reference
<github3.git.Reference>`
"""
if lightweight and tag and sha:
return self.create_ref('refs/tags/' + tag, sha)
json = None
if tag and message and sha and obj_type and len(tagger) == 3:
data = {'tag': tag, 'message': message, 'object': sha,
'type': obj_type, 'tagger': tagger}
url = self._build_url('git', 'tags', base_url=self._api)
json = self._json(self._post(url, data=data), 201)
if json:
self.create_ref('refs/tags/' + tag, sha)
return Tag(json) if json else None | python | def create_tag(self, tag, message, sha, obj_type, tagger,
lightweight=False):
"""Create a tag in this repository.
:param str tag: (required), name of the tag
:param str message: (required), tag message
:param str sha: (required), SHA of the git object this is tagging
:param str obj_type: (required), type of object being tagged, e.g.,
'commit', 'tree', 'blob'
:param dict tagger: (required), containing the name, email of the
tagger and the date it was tagged
:param bool lightweight: (optional), if False, create an annotated
tag, otherwise create a lightweight tag (a Reference).
:returns: If lightweight == False: :class:`Tag <github3.git.Tag>` if
successful, else None. If lightweight == True: :class:`Reference
<github3.git.Reference>`
"""
if lightweight and tag and sha:
return self.create_ref('refs/tags/' + tag, sha)
json = None
if tag and message and sha and obj_type and len(tagger) == 3:
data = {'tag': tag, 'message': message, 'object': sha,
'type': obj_type, 'tagger': tagger}
url = self._build_url('git', 'tags', base_url=self._api)
json = self._json(self._post(url, data=data), 201)
if json:
self.create_ref('refs/tags/' + tag, sha)
return Tag(json) if json else None | [
"def",
"create_tag",
"(",
"self",
",",
"tag",
",",
"message",
",",
"sha",
",",
"obj_type",
",",
"tagger",
",",
"lightweight",
"=",
"False",
")",
":",
"if",
"lightweight",
"and",
"tag",
"and",
"sha",
":",
"return",
"self",
".",
"create_ref",
"(",
"'refs/tags/'",
"+",
"tag",
",",
"sha",
")",
"json",
"=",
"None",
"if",
"tag",
"and",
"message",
"and",
"sha",
"and",
"obj_type",
"and",
"len",
"(",
"tagger",
")",
"==",
"3",
":",
"data",
"=",
"{",
"'tag'",
":",
"tag",
",",
"'message'",
":",
"message",
",",
"'object'",
":",
"sha",
",",
"'type'",
":",
"obj_type",
",",
"'tagger'",
":",
"tagger",
"}",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'git'",
",",
"'tags'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_post",
"(",
"url",
",",
"data",
"=",
"data",
")",
",",
"201",
")",
"if",
"json",
":",
"self",
".",
"create_ref",
"(",
"'refs/tags/'",
"+",
"tag",
",",
"sha",
")",
"return",
"Tag",
"(",
"json",
")",
"if",
"json",
"else",
"None"
] | Create a tag in this repository.
:param str tag: (required), name of the tag
:param str message: (required), tag message
:param str sha: (required), SHA of the git object this is tagging
:param str obj_type: (required), type of object being tagged, e.g.,
'commit', 'tree', 'blob'
:param dict tagger: (required), containing the name, email of the
tagger and the date it was tagged
:param bool lightweight: (optional), if False, create an annotated
tag, otherwise create a lightweight tag (a Reference).
:returns: If lightweight == False: :class:`Tag <github3.git.Tag>` if
successful, else None. If lightweight == True: :class:`Reference
<github3.git.Reference>` | [
"Create",
"a",
"tag",
"in",
"this",
"repository",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L813-L841 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.create_tree | def create_tree(self, tree, base_tree=''):
"""Create a tree on this repository.
:param list tree: (required), specifies the tree structure.
Format: [{'path': 'path/file', 'mode':
'filemode', 'type': 'blob or tree', 'sha': '44bfc6d...'}]
:param str base_tree: (optional), SHA1 of the tree you want
to update with new data
:returns: :class:`Tree <github3.git.Tree>` if successful, else None
"""
json = None
if tree and isinstance(tree, list):
data = {'tree': tree, 'base_tree': base_tree}
url = self._build_url('git', 'trees', base_url=self._api)
json = self._json(self._post(url, data=data), 201)
return Tree(json) if json else None | python | def create_tree(self, tree, base_tree=''):
"""Create a tree on this repository.
:param list tree: (required), specifies the tree structure.
Format: [{'path': 'path/file', 'mode':
'filemode', 'type': 'blob or tree', 'sha': '44bfc6d...'}]
:param str base_tree: (optional), SHA1 of the tree you want
to update with new data
:returns: :class:`Tree <github3.git.Tree>` if successful, else None
"""
json = None
if tree and isinstance(tree, list):
data = {'tree': tree, 'base_tree': base_tree}
url = self._build_url('git', 'trees', base_url=self._api)
json = self._json(self._post(url, data=data), 201)
return Tree(json) if json else None | [
"def",
"create_tree",
"(",
"self",
",",
"tree",
",",
"base_tree",
"=",
"''",
")",
":",
"json",
"=",
"None",
"if",
"tree",
"and",
"isinstance",
"(",
"tree",
",",
"list",
")",
":",
"data",
"=",
"{",
"'tree'",
":",
"tree",
",",
"'base_tree'",
":",
"base_tree",
"}",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'git'",
",",
"'trees'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_post",
"(",
"url",
",",
"data",
"=",
"data",
")",
",",
"201",
")",
"return",
"Tree",
"(",
"json",
")",
"if",
"json",
"else",
"None"
] | Create a tree on this repository.
:param list tree: (required), specifies the tree structure.
Format: [{'path': 'path/file', 'mode':
'filemode', 'type': 'blob or tree', 'sha': '44bfc6d...'}]
:param str base_tree: (optional), SHA1 of the tree you want
to update with new data
:returns: :class:`Tree <github3.git.Tree>` if successful, else None | [
"Create",
"a",
"tree",
"on",
"this",
"repository",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L844-L859 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.delete_file | def delete_file(self, path, message, sha, branch=None, committer=None,
author=None):
"""Delete the file located at ``path``.
This is part of the Contents CrUD (Create Update Delete) API. See
http://developer.github.com/v3/repos/contents/#delete-a-file for more
information.
:param str path: (required), path to the file being removed
:param str message: (required), commit message for the deletion
:param str sha: (required), blob sha of the file being removed
:param str branch: (optional), if not provided, uses the repository's
default branch
:param dict committer: (optional), if no information is given the
authenticated user's information will be used. You must specify
both a name and email.
:param dict author: (optional), if omitted this will be filled in with
committer information. If passed, you must specify both a name and
email.
:returns: :class:`Commit <github3.git.Commit>` if successful
"""
json = None
if path and message and sha:
url = self._build_url('contents', path, base_url=self._api)
data = {'message': message, 'sha': sha, 'branch': branch,
'committer': validate_commmitter(committer),
'author': validate_commmitter(author)}
self._remove_none(data)
json = self._json(self._delete(url, data=dumps(data)), 200)
if json and 'commit' in json:
json = Commit(json['commit'])
return json | python | def delete_file(self, path, message, sha, branch=None, committer=None,
author=None):
"""Delete the file located at ``path``.
This is part of the Contents CrUD (Create Update Delete) API. See
http://developer.github.com/v3/repos/contents/#delete-a-file for more
information.
:param str path: (required), path to the file being removed
:param str message: (required), commit message for the deletion
:param str sha: (required), blob sha of the file being removed
:param str branch: (optional), if not provided, uses the repository's
default branch
:param dict committer: (optional), if no information is given the
authenticated user's information will be used. You must specify
both a name and email.
:param dict author: (optional), if omitted this will be filled in with
committer information. If passed, you must specify both a name and
email.
:returns: :class:`Commit <github3.git.Commit>` if successful
"""
json = None
if path and message and sha:
url = self._build_url('contents', path, base_url=self._api)
data = {'message': message, 'sha': sha, 'branch': branch,
'committer': validate_commmitter(committer),
'author': validate_commmitter(author)}
self._remove_none(data)
json = self._json(self._delete(url, data=dumps(data)), 200)
if json and 'commit' in json:
json = Commit(json['commit'])
return json | [
"def",
"delete_file",
"(",
"self",
",",
"path",
",",
"message",
",",
"sha",
",",
"branch",
"=",
"None",
",",
"committer",
"=",
"None",
",",
"author",
"=",
"None",
")",
":",
"json",
"=",
"None",
"if",
"path",
"and",
"message",
"and",
"sha",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'contents'",
",",
"path",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"data",
"=",
"{",
"'message'",
":",
"message",
",",
"'sha'",
":",
"sha",
",",
"'branch'",
":",
"branch",
",",
"'committer'",
":",
"validate_commmitter",
"(",
"committer",
")",
",",
"'author'",
":",
"validate_commmitter",
"(",
"author",
")",
"}",
"self",
".",
"_remove_none",
"(",
"data",
")",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_delete",
"(",
"url",
",",
"data",
"=",
"dumps",
"(",
"data",
")",
")",
",",
"200",
")",
"if",
"json",
"and",
"'commit'",
"in",
"json",
":",
"json",
"=",
"Commit",
"(",
"json",
"[",
"'commit'",
"]",
")",
"return",
"json"
] | Delete the file located at ``path``.
This is part of the Contents CrUD (Create Update Delete) API. See
http://developer.github.com/v3/repos/contents/#delete-a-file for more
information.
:param str path: (required), path to the file being removed
:param str message: (required), commit message for the deletion
:param str sha: (required), blob sha of the file being removed
:param str branch: (optional), if not provided, uses the repository's
default branch
:param dict committer: (optional), if no information is given the
authenticated user's information will be used. You must specify
both a name and email.
:param dict author: (optional), if omitted this will be filled in with
committer information. If passed, you must specify both a name and
email.
:returns: :class:`Commit <github3.git.Commit>` if successful | [
"Delete",
"the",
"file",
"located",
"at",
"path",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L870-L902 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.delete_key | def delete_key(self, key_id):
"""Delete the key with the specified id from your deploy keys list.
:returns: bool -- True if successful, False otherwise
"""
if int(key_id) <= 0:
return False
url = self._build_url('keys', str(key_id), base_url=self._api)
return self._boolean(self._delete(url), 204, 404) | python | def delete_key(self, key_id):
"""Delete the key with the specified id from your deploy keys list.
:returns: bool -- True if successful, False otherwise
"""
if int(key_id) <= 0:
return False
url = self._build_url('keys', str(key_id), base_url=self._api)
return self._boolean(self._delete(url), 204, 404) | [
"def",
"delete_key",
"(",
"self",
",",
"key_id",
")",
":",
"if",
"int",
"(",
"key_id",
")",
"<=",
"0",
":",
"return",
"False",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'keys'",
",",
"str",
"(",
"key_id",
")",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_boolean",
"(",
"self",
".",
"_delete",
"(",
"url",
")",
",",
"204",
",",
"404",
")"
] | Delete the key with the specified id from your deploy keys list.
:returns: bool -- True if successful, False otherwise | [
"Delete",
"the",
"key",
"with",
"the",
"specified",
"id",
"from",
"your",
"deploy",
"keys",
"list",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L905-L913 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.edit | def edit(self,
name,
description=None,
homepage=None,
private=None,
has_issues=None,
has_wiki=None,
has_downloads=None,
default_branch=None):
"""Edit this repository.
:param str name: (required), name of the repository
:param str description: (optional), If not ``None``, change the
description for this repository. API default: ``None`` - leave
value unchanged.
:param str homepage: (optional), If not ``None``, change the homepage
for this repository. API default: ``None`` - leave value unchanged.
:param bool private: (optional), If ``True``, make the repository
private. If ``False``, make the repository public. API default:
``None`` - leave value unchanged.
:param bool has_issues: (optional), If ``True``, enable issues for
this repository. If ``False``, disable issues for this repository.
API default: ``None`` - leave value unchanged.
:param bool has_wiki: (optional), If ``True``, enable the wiki for
this repository. If ``False``, disable the wiki for this
repository. API default: ``None`` - leave value unchanged.
:param bool has_downloads: (optional), If ``True``, enable downloads
for this repository. If ``False``, disable downloads for this
repository. API default: ``None`` - leave value unchanged.
:param str default_branch: (optional), If not ``None``, change the
default branch for this repository. API default: ``None`` - leave
value unchanged.
:returns: bool -- True if successful, False otherwise
"""
edit = {'name': name, 'description': description, 'homepage': homepage,
'private': private, 'has_issues': has_issues,
'has_wiki': has_wiki, 'has_downloads': has_downloads,
'default_branch': default_branch}
self._remove_none(edit)
json = None
if edit:
json = self._json(self._patch(self._api, data=dumps(edit)), 200)
self._update_(json)
return True
return False | python | def edit(self,
name,
description=None,
homepage=None,
private=None,
has_issues=None,
has_wiki=None,
has_downloads=None,
default_branch=None):
"""Edit this repository.
:param str name: (required), name of the repository
:param str description: (optional), If not ``None``, change the
description for this repository. API default: ``None`` - leave
value unchanged.
:param str homepage: (optional), If not ``None``, change the homepage
for this repository. API default: ``None`` - leave value unchanged.
:param bool private: (optional), If ``True``, make the repository
private. If ``False``, make the repository public. API default:
``None`` - leave value unchanged.
:param bool has_issues: (optional), If ``True``, enable issues for
this repository. If ``False``, disable issues for this repository.
API default: ``None`` - leave value unchanged.
:param bool has_wiki: (optional), If ``True``, enable the wiki for
this repository. If ``False``, disable the wiki for this
repository. API default: ``None`` - leave value unchanged.
:param bool has_downloads: (optional), If ``True``, enable downloads
for this repository. If ``False``, disable downloads for this
repository. API default: ``None`` - leave value unchanged.
:param str default_branch: (optional), If not ``None``, change the
default branch for this repository. API default: ``None`` - leave
value unchanged.
:returns: bool -- True if successful, False otherwise
"""
edit = {'name': name, 'description': description, 'homepage': homepage,
'private': private, 'has_issues': has_issues,
'has_wiki': has_wiki, 'has_downloads': has_downloads,
'default_branch': default_branch}
self._remove_none(edit)
json = None
if edit:
json = self._json(self._patch(self._api, data=dumps(edit)), 200)
self._update_(json)
return True
return False | [
"def",
"edit",
"(",
"self",
",",
"name",
",",
"description",
"=",
"None",
",",
"homepage",
"=",
"None",
",",
"private",
"=",
"None",
",",
"has_issues",
"=",
"None",
",",
"has_wiki",
"=",
"None",
",",
"has_downloads",
"=",
"None",
",",
"default_branch",
"=",
"None",
")",
":",
"edit",
"=",
"{",
"'name'",
":",
"name",
",",
"'description'",
":",
"description",
",",
"'homepage'",
":",
"homepage",
",",
"'private'",
":",
"private",
",",
"'has_issues'",
":",
"has_issues",
",",
"'has_wiki'",
":",
"has_wiki",
",",
"'has_downloads'",
":",
"has_downloads",
",",
"'default_branch'",
":",
"default_branch",
"}",
"self",
".",
"_remove_none",
"(",
"edit",
")",
"json",
"=",
"None",
"if",
"edit",
":",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_patch",
"(",
"self",
".",
"_api",
",",
"data",
"=",
"dumps",
"(",
"edit",
")",
")",
",",
"200",
")",
"self",
".",
"_update_",
"(",
"json",
")",
"return",
"True",
"return",
"False"
] | Edit this repository.
:param str name: (required), name of the repository
:param str description: (optional), If not ``None``, change the
description for this repository. API default: ``None`` - leave
value unchanged.
:param str homepage: (optional), If not ``None``, change the homepage
for this repository. API default: ``None`` - leave value unchanged.
:param bool private: (optional), If ``True``, make the repository
private. If ``False``, make the repository public. API default:
``None`` - leave value unchanged.
:param bool has_issues: (optional), If ``True``, enable issues for
this repository. If ``False``, disable issues for this repository.
API default: ``None`` - leave value unchanged.
:param bool has_wiki: (optional), If ``True``, enable the wiki for
this repository. If ``False``, disable the wiki for this
repository. API default: ``None`` - leave value unchanged.
:param bool has_downloads: (optional), If ``True``, enable downloads
for this repository. If ``False``, disable downloads for this
repository. API default: ``None`` - leave value unchanged.
:param str default_branch: (optional), If not ``None``, change the
default branch for this repository. API default: ``None`` - leave
value unchanged.
:returns: bool -- True if successful, False otherwise | [
"Edit",
"this",
"repository",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L925-L969 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.git_commit | def git_commit(self, sha):
"""Get a single (git) commit.
:param str sha: (required), sha of the commit
:returns: :class:`Commit <github3.git.Commit>` if successful,
otherwise None
"""
json = {}
if sha:
url = self._build_url('git', 'commits', sha, base_url=self._api)
json = self._json(self._get(url), 200)
return Commit(json, self) if json else None | python | def git_commit(self, sha):
"""Get a single (git) commit.
:param str sha: (required), sha of the commit
:returns: :class:`Commit <github3.git.Commit>` if successful,
otherwise None
"""
json = {}
if sha:
url = self._build_url('git', 'commits', sha, base_url=self._api)
json = self._json(self._get(url), 200)
return Commit(json, self) if json else None | [
"def",
"git_commit",
"(",
"self",
",",
"sha",
")",
":",
"json",
"=",
"{",
"}",
"if",
"sha",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'git'",
",",
"'commits'",
",",
"sha",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_get",
"(",
"url",
")",
",",
"200",
")",
"return",
"Commit",
"(",
"json",
",",
"self",
")",
"if",
"json",
"else",
"None"
] | Get a single (git) commit.
:param str sha: (required), sha of the commit
:returns: :class:`Commit <github3.git.Commit>` if successful,
otherwise None | [
"Get",
"a",
"single",
"(",
"git",
")",
"commit",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L982-L993 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.hook | def hook(self, id_num):
"""Get a single hook.
:param int id_num: (required), id of the hook
:returns: :class:`Hook <github3.repos.hook.Hook>` if successful,
otherwise None
"""
json = None
if int(id_num) > 0:
url = self._build_url('hooks', str(id_num), base_url=self._api)
json = self._json(self._get(url), 200)
return Hook(json, self) if json else None | python | def hook(self, id_num):
"""Get a single hook.
:param int id_num: (required), id of the hook
:returns: :class:`Hook <github3.repos.hook.Hook>` if successful,
otherwise None
"""
json = None
if int(id_num) > 0:
url = self._build_url('hooks', str(id_num), base_url=self._api)
json = self._json(self._get(url), 200)
return Hook(json, self) if json else None | [
"def",
"hook",
"(",
"self",
",",
"id_num",
")",
":",
"json",
"=",
"None",
"if",
"int",
"(",
"id_num",
")",
">",
"0",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'hooks'",
",",
"str",
"(",
"id_num",
")",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_get",
"(",
"url",
")",
",",
"200",
")",
"return",
"Hook",
"(",
"json",
",",
"self",
")",
"if",
"json",
"else",
"None"
] | Get a single hook.
:param int id_num: (required), id of the hook
:returns: :class:`Hook <github3.repos.hook.Hook>` if successful,
otherwise None | [
"Get",
"a",
"single",
"hook",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L996-L1007 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.is_assignee | def is_assignee(self, login):
"""Check if the user is a possible assignee for an issue on this
repository.
:returns: :class:`bool`
"""
if not login:
return False
url = self._build_url('assignees', login, base_url=self._api)
return self._boolean(self._get(url), 204, 404) | python | def is_assignee(self, login):
"""Check if the user is a possible assignee for an issue on this
repository.
:returns: :class:`bool`
"""
if not login:
return False
url = self._build_url('assignees', login, base_url=self._api)
return self._boolean(self._get(url), 204, 404) | [
"def",
"is_assignee",
"(",
"self",
",",
"login",
")",
":",
"if",
"not",
"login",
":",
"return",
"False",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'assignees'",
",",
"login",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_boolean",
"(",
"self",
".",
"_get",
"(",
"url",
")",
",",
"204",
",",
"404",
")"
] | Check if the user is a possible assignee for an issue on this
repository.
:returns: :class:`bool` | [
"Check",
"if",
"the",
"user",
"is",
"a",
"possible",
"assignee",
"for",
"an",
"issue",
"on",
"this",
"repository",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L1009-L1018 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.issue | def issue(self, number):
"""Get the issue specified by ``number``.
:param int number: (required), number of the issue on this repository
:returns: :class:`Issue <github3.issues.issue.Issue>` if successful,
otherwise None
"""
json = None
if int(number) > 0:
url = self._build_url('issues', str(number), base_url=self._api)
json = self._json(self._get(url), 200)
return Issue(json, self) if json else None | python | def issue(self, number):
"""Get the issue specified by ``number``.
:param int number: (required), number of the issue on this repository
:returns: :class:`Issue <github3.issues.issue.Issue>` if successful,
otherwise None
"""
json = None
if int(number) > 0:
url = self._build_url('issues', str(number), base_url=self._api)
json = self._json(self._get(url), 200)
return Issue(json, self) if json else None | [
"def",
"issue",
"(",
"self",
",",
"number",
")",
":",
"json",
"=",
"None",
"if",
"int",
"(",
"number",
")",
">",
"0",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'issues'",
",",
"str",
"(",
"number",
")",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_get",
"(",
"url",
")",
",",
"200",
")",
"return",
"Issue",
"(",
"json",
",",
"self",
")",
"if",
"json",
"else",
"None"
] | Get the issue specified by ``number``.
:param int number: (required), number of the issue on this repository
:returns: :class:`Issue <github3.issues.issue.Issue>` if successful,
otherwise None | [
"Get",
"the",
"issue",
"specified",
"by",
"number",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L1020-L1031 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.key | def key(self, id_num):
"""Get the specified deploy key.
:param int id_num: (required), id of the key
:returns: :class:`Key <github3.users.Key>` if successful, else None
"""
json = None
if int(id_num) > 0:
url = self._build_url('keys', str(id_num), base_url=self._api)
json = self._json(self._get(url), 200)
return Key(json, self) if json else None | python | def key(self, id_num):
"""Get the specified deploy key.
:param int id_num: (required), id of the key
:returns: :class:`Key <github3.users.Key>` if successful, else None
"""
json = None
if int(id_num) > 0:
url = self._build_url('keys', str(id_num), base_url=self._api)
json = self._json(self._get(url), 200)
return Key(json, self) if json else None | [
"def",
"key",
"(",
"self",
",",
"id_num",
")",
":",
"json",
"=",
"None",
"if",
"int",
"(",
"id_num",
")",
">",
"0",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'keys'",
",",
"str",
"(",
"id_num",
")",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_get",
"(",
"url",
")",
",",
"200",
")",
"return",
"Key",
"(",
"json",
",",
"self",
")",
"if",
"json",
"else",
"None"
] | Get the specified deploy key.
:param int id_num: (required), id of the key
:returns: :class:`Key <github3.users.Key>` if successful, else None | [
"Get",
"the",
"specified",
"deploy",
"key",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L1034-L1044 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.label | def label(self, name):
"""Get the label specified by ``name``
:param str name: (required), name of the label
:returns: :class:`Label <github3.issues.label.Label>` if successful,
else None
"""
json = None
if name:
url = self._build_url('labels', name, base_url=self._api)
json = self._json(self._get(url), 200)
return Label(json, self) if json else None | python | def label(self, name):
"""Get the label specified by ``name``
:param str name: (required), name of the label
:returns: :class:`Label <github3.issues.label.Label>` if successful,
else None
"""
json = None
if name:
url = self._build_url('labels', name, base_url=self._api)
json = self._json(self._get(url), 200)
return Label(json, self) if json else None | [
"def",
"label",
"(",
"self",
",",
"name",
")",
":",
"json",
"=",
"None",
"if",
"name",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'labels'",
",",
"name",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_get",
"(",
"url",
")",
",",
"200",
")",
"return",
"Label",
"(",
"json",
",",
"self",
")",
"if",
"json",
"else",
"None"
] | Get the label specified by ``name``
:param str name: (required), name of the label
:returns: :class:`Label <github3.issues.label.Label>` if successful,
else None | [
"Get",
"the",
"label",
"specified",
"by",
"name"
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L1046-L1057 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.iter_branches | def iter_branches(self, number=-1, etag=None):
"""Iterate over the branches in this repository.
:param int number: (optional), number of branches to return. Default:
-1 returns all branches
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of
:class:`Branch <github3.repos.branch.Branch>`\ es
"""
url = self._build_url('branches', base_url=self._api)
return self._iter(int(number), url, Branch, etag=etag) | python | def iter_branches(self, number=-1, etag=None):
"""Iterate over the branches in this repository.
:param int number: (optional), number of branches to return. Default:
-1 returns all branches
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of
:class:`Branch <github3.repos.branch.Branch>`\ es
"""
url = self._build_url('branches', base_url=self._api)
return self._iter(int(number), url, Branch, etag=etag) | [
"def",
"iter_branches",
"(",
"self",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'branches'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_iter",
"(",
"int",
"(",
"number",
")",
",",
"url",
",",
"Branch",
",",
"etag",
"=",
"etag",
")"
] | Iterate over the branches in this repository.
:param int number: (optional), number of branches to return. Default:
-1 returns all branches
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of
:class:`Branch <github3.repos.branch.Branch>`\ es | [
"Iterate",
"over",
"the",
"branches",
"in",
"this",
"repository",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L1082-L1093 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.iter_code_frequency | def iter_code_frequency(self, number=-1, etag=None):
"""Iterate over the code frequency per week.
Returns a weekly aggregate of the number of additions and deletions
pushed to this repository.
:param int number: (optional), number of weeks to return. Default: -1
returns all weeks
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of lists ``[seconds_from_epoch, additions,
deletions]``
.. note:: All statistics methods may return a 202. On those occasions,
you will not receive any objects. You should store your
iterator and check the new ``last_status`` attribute. If it
is a 202 you should wait before re-requesting.
.. versionadded:: 0.7
"""
url = self._build_url('stats', 'code_frequency', base_url=self._api)
return self._iter(int(number), url, list, etag=etag) | python | def iter_code_frequency(self, number=-1, etag=None):
"""Iterate over the code frequency per week.
Returns a weekly aggregate of the number of additions and deletions
pushed to this repository.
:param int number: (optional), number of weeks to return. Default: -1
returns all weeks
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of lists ``[seconds_from_epoch, additions,
deletions]``
.. note:: All statistics methods may return a 202. On those occasions,
you will not receive any objects. You should store your
iterator and check the new ``last_status`` attribute. If it
is a 202 you should wait before re-requesting.
.. versionadded:: 0.7
"""
url = self._build_url('stats', 'code_frequency', base_url=self._api)
return self._iter(int(number), url, list, etag=etag) | [
"def",
"iter_code_frequency",
"(",
"self",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'stats'",
",",
"'code_frequency'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_iter",
"(",
"int",
"(",
"number",
")",
",",
"url",
",",
"list",
",",
"etag",
"=",
"etag",
")"
] | Iterate over the code frequency per week.
Returns a weekly aggregate of the number of additions and deletions
pushed to this repository.
:param int number: (optional), number of weeks to return. Default: -1
returns all weeks
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of lists ``[seconds_from_epoch, additions,
deletions]``
.. note:: All statistics methods may return a 202. On those occasions,
you will not receive any objects. You should store your
iterator and check the new ``last_status`` attribute. If it
is a 202 you should wait before re-requesting.
.. versionadded:: 0.7 | [
"Iterate",
"over",
"the",
"code",
"frequency",
"per",
"week",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L1095-L1117 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.iter_comments_on_commit | def iter_comments_on_commit(self, sha, number=1, etag=None):
"""Iterate over comments for a single commit.
:param sha: (required), sha of the commit to list comments on
:type sha: str
:param int number: (optional), number of comments to return. Default:
-1 returns all comments
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of
:class:`RepoComment <github3.repos.comment.RepoComment>`\ s
"""
url = self._build_url('commits', sha, 'comments', base_url=self._api)
return self._iter(int(number), url, RepoComment, etag=etag) | python | def iter_comments_on_commit(self, sha, number=1, etag=None):
"""Iterate over comments for a single commit.
:param sha: (required), sha of the commit to list comments on
:type sha: str
:param int number: (optional), number of comments to return. Default:
-1 returns all comments
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of
:class:`RepoComment <github3.repos.comment.RepoComment>`\ s
"""
url = self._build_url('commits', sha, 'comments', base_url=self._api)
return self._iter(int(number), url, RepoComment, etag=etag) | [
"def",
"iter_comments_on_commit",
"(",
"self",
",",
"sha",
",",
"number",
"=",
"1",
",",
"etag",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'commits'",
",",
"sha",
",",
"'comments'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_iter",
"(",
"int",
"(",
"number",
")",
",",
"url",
",",
"RepoComment",
",",
"etag",
"=",
"etag",
")"
] | Iterate over comments for a single commit.
:param sha: (required), sha of the commit to list comments on
:type sha: str
:param int number: (optional), number of comments to return. Default:
-1 returns all comments
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of
:class:`RepoComment <github3.repos.comment.RepoComment>`\ s | [
"Iterate",
"over",
"comments",
"for",
"a",
"single",
"commit",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L1144-L1157 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.iter_commit_activity | def iter_commit_activity(self, number=-1, etag=None):
"""Iterate over last year of commit activity by week.
See: http://developer.github.com/v3/repos/statistics/
:param int number: (optional), number of weeks to return. Default -1
will return all of the weeks.
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of dictionaries
.. note:: All statistics methods may return a 202. On those occasions,
you will not receive any objects. You should store your
iterator and check the new ``last_status`` attribute. If it
is a 202 you should wait before re-requesting.
.. versionadded:: 0.7
"""
url = self._build_url('stats', 'commit_activity', base_url=self._api)
return self._iter(int(number), url, dict, etag=etag) | python | def iter_commit_activity(self, number=-1, etag=None):
"""Iterate over last year of commit activity by week.
See: http://developer.github.com/v3/repos/statistics/
:param int number: (optional), number of weeks to return. Default -1
will return all of the weeks.
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of dictionaries
.. note:: All statistics methods may return a 202. On those occasions,
you will not receive any objects. You should store your
iterator and check the new ``last_status`` attribute. If it
is a 202 you should wait before re-requesting.
.. versionadded:: 0.7
"""
url = self._build_url('stats', 'commit_activity', base_url=self._api)
return self._iter(int(number), url, dict, etag=etag) | [
"def",
"iter_commit_activity",
"(",
"self",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'stats'",
",",
"'commit_activity'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_iter",
"(",
"int",
"(",
"number",
")",
",",
"url",
",",
"dict",
",",
"etag",
"=",
"etag",
")"
] | Iterate over last year of commit activity by week.
See: http://developer.github.com/v3/repos/statistics/
:param int number: (optional), number of weeks to return. Default -1
will return all of the weeks.
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of dictionaries
.. note:: All statistics methods may return a 202. On those occasions,
you will not receive any objects. You should store your
iterator and check the new ``last_status`` attribute. If it
is a 202 you should wait before re-requesting.
.. versionadded:: 0.7 | [
"Iterate",
"over",
"last",
"year",
"of",
"commit",
"activity",
"by",
"week",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L1159-L1179 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.iter_commits | def iter_commits(self, sha=None, path=None, author=None, number=-1,
etag=None, since=None, until=None):
"""Iterate over commits in this repository.
:param str sha: (optional), sha or branch to start listing commits
from
:param str path: (optional), commits containing this path will be
listed
:param str author: (optional), GitHub login, real name, or email to
filter commits by (using commit author)
:param int number: (optional), number of commits to return. Default:
-1 returns all commits
:param str etag: (optional), ETag from a previous request to the same
endpoint
:param since: (optional), Only commits after this date will
be returned. This can be a `datetime` or an `ISO8601` formatted
date string.
:type since: datetime or string
:param until: (optional), Only commits before this date will
be returned. This can be a `datetime` or an `ISO8601` formatted
date string.
:type until: datetime or string
:returns: generator of
:class:`RepoCommit <github3.repos.commit.RepoCommit>`\ s
"""
params = {'sha': sha, 'path': path, 'author': author,
'since': timestamp_parameter(since),
'until': timestamp_parameter(until)}
self._remove_none(params)
url = self._build_url('commits', base_url=self._api)
return self._iter(int(number), url, RepoCommit, params, etag) | python | def iter_commits(self, sha=None, path=None, author=None, number=-1,
etag=None, since=None, until=None):
"""Iterate over commits in this repository.
:param str sha: (optional), sha or branch to start listing commits
from
:param str path: (optional), commits containing this path will be
listed
:param str author: (optional), GitHub login, real name, or email to
filter commits by (using commit author)
:param int number: (optional), number of commits to return. Default:
-1 returns all commits
:param str etag: (optional), ETag from a previous request to the same
endpoint
:param since: (optional), Only commits after this date will
be returned. This can be a `datetime` or an `ISO8601` formatted
date string.
:type since: datetime or string
:param until: (optional), Only commits before this date will
be returned. This can be a `datetime` or an `ISO8601` formatted
date string.
:type until: datetime or string
:returns: generator of
:class:`RepoCommit <github3.repos.commit.RepoCommit>`\ s
"""
params = {'sha': sha, 'path': path, 'author': author,
'since': timestamp_parameter(since),
'until': timestamp_parameter(until)}
self._remove_none(params)
url = self._build_url('commits', base_url=self._api)
return self._iter(int(number), url, RepoCommit, params, etag) | [
"def",
"iter_commits",
"(",
"self",
",",
"sha",
"=",
"None",
",",
"path",
"=",
"None",
",",
"author",
"=",
"None",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
",",
"since",
"=",
"None",
",",
"until",
"=",
"None",
")",
":",
"params",
"=",
"{",
"'sha'",
":",
"sha",
",",
"'path'",
":",
"path",
",",
"'author'",
":",
"author",
",",
"'since'",
":",
"timestamp_parameter",
"(",
"since",
")",
",",
"'until'",
":",
"timestamp_parameter",
"(",
"until",
")",
"}",
"self",
".",
"_remove_none",
"(",
"params",
")",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'commits'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_iter",
"(",
"int",
"(",
"number",
")",
",",
"url",
",",
"RepoCommit",
",",
"params",
",",
"etag",
")"
] | Iterate over commits in this repository.
:param str sha: (optional), sha or branch to start listing commits
from
:param str path: (optional), commits containing this path will be
listed
:param str author: (optional), GitHub login, real name, or email to
filter commits by (using commit author)
:param int number: (optional), number of commits to return. Default:
-1 returns all commits
:param str etag: (optional), ETag from a previous request to the same
endpoint
:param since: (optional), Only commits after this date will
be returned. This can be a `datetime` or an `ISO8601` formatted
date string.
:type since: datetime or string
:param until: (optional), Only commits before this date will
be returned. This can be a `datetime` or an `ISO8601` formatted
date string.
:type until: datetime or string
:returns: generator of
:class:`RepoCommit <github3.repos.commit.RepoCommit>`\ s | [
"Iterate",
"over",
"commits",
"in",
"this",
"repository",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L1181-L1213 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.iter_contributors | def iter_contributors(self, anon=False, number=-1, etag=None):
"""Iterate over the contributors to this repository.
:param bool anon: (optional), True lists anonymous contributors as
well
:param int number: (optional), number of contributors to return.
Default: -1 returns all contributors
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`User <github3.users.User>`\ s
"""
url = self._build_url('contributors', base_url=self._api)
params = {}
if anon:
params = {'anon': True}
return self._iter(int(number), url, User, params, etag) | python | def iter_contributors(self, anon=False, number=-1, etag=None):
"""Iterate over the contributors to this repository.
:param bool anon: (optional), True lists anonymous contributors as
well
:param int number: (optional), number of contributors to return.
Default: -1 returns all contributors
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`User <github3.users.User>`\ s
"""
url = self._build_url('contributors', base_url=self._api)
params = {}
if anon:
params = {'anon': True}
return self._iter(int(number), url, User, params, etag) | [
"def",
"iter_contributors",
"(",
"self",
",",
"anon",
"=",
"False",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'contributors'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"params",
"=",
"{",
"}",
"if",
"anon",
":",
"params",
"=",
"{",
"'anon'",
":",
"True",
"}",
"return",
"self",
".",
"_iter",
"(",
"int",
"(",
"number",
")",
",",
"url",
",",
"User",
",",
"params",
",",
"etag",
")"
] | Iterate over the contributors to this repository.
:param bool anon: (optional), True lists anonymous contributors as
well
:param int number: (optional), number of contributors to return.
Default: -1 returns all contributors
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`User <github3.users.User>`\ s | [
"Iterate",
"over",
"the",
"contributors",
"to",
"this",
"repository",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L1215-L1230 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.iter_contributor_statistics | def iter_contributor_statistics(self, number=-1, etag=None):
"""Iterate over the contributors list.
See also: http://developer.github.com/v3/repos/statistics/
:param int number: (optional), number of weeks to return. Default -1
will return all of the weeks.
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of
:class:`ContributorStats <github3.repos.stats.ContributorStats>`
.. note:: All statistics methods may return a 202. On those occasions,
you will not receive any objects. You should store your
iterator and check the new ``last_status`` attribute. If it
is a 202 you should wait before re-requesting.
.. versionadded:: 0.7
"""
url = self._build_url('stats', 'contributors', base_url=self._api)
return self._iter(int(number), url, ContributorStats, etag=etag) | python | def iter_contributor_statistics(self, number=-1, etag=None):
"""Iterate over the contributors list.
See also: http://developer.github.com/v3/repos/statistics/
:param int number: (optional), number of weeks to return. Default -1
will return all of the weeks.
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of
:class:`ContributorStats <github3.repos.stats.ContributorStats>`
.. note:: All statistics methods may return a 202. On those occasions,
you will not receive any objects. You should store your
iterator and check the new ``last_status`` attribute. If it
is a 202 you should wait before re-requesting.
.. versionadded:: 0.7
"""
url = self._build_url('stats', 'contributors', base_url=self._api)
return self._iter(int(number), url, ContributorStats, etag=etag) | [
"def",
"iter_contributor_statistics",
"(",
"self",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'stats'",
",",
"'contributors'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_iter",
"(",
"int",
"(",
"number",
")",
",",
"url",
",",
"ContributorStats",
",",
"etag",
"=",
"etag",
")"
] | Iterate over the contributors list.
See also: http://developer.github.com/v3/repos/statistics/
:param int number: (optional), number of weeks to return. Default -1
will return all of the weeks.
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of
:class:`ContributorStats <github3.repos.stats.ContributorStats>`
.. note:: All statistics methods may return a 202. On those occasions,
you will not receive any objects. You should store your
iterator and check the new ``last_status`` attribute. If it
is a 202 you should wait before re-requesting.
.. versionadded:: 0.7 | [
"Iterate",
"over",
"the",
"contributors",
"list",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L1232-L1253 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.iter_deployments | def iter_deployments(self, number=-1, etag=None):
"""Iterate over deployments for this repository.
:param int number: (optional), number of deployments to return.
Default: -1, returns all available deployments
:param str etag: (optional), ETag from a previous request for all
deployments
:returns: generator of
:class:`Deployment <github3.repos.deployment.Deployment>`\ s
"""
url = self._build_url('deployments', base_url=self._api)
i = self._iter(int(number), url, Deployment, etag=etag)
i.headers.update(Deployment.CUSTOM_HEADERS)
return i | python | def iter_deployments(self, number=-1, etag=None):
"""Iterate over deployments for this repository.
:param int number: (optional), number of deployments to return.
Default: -1, returns all available deployments
:param str etag: (optional), ETag from a previous request for all
deployments
:returns: generator of
:class:`Deployment <github3.repos.deployment.Deployment>`\ s
"""
url = self._build_url('deployments', base_url=self._api)
i = self._iter(int(number), url, Deployment, etag=etag)
i.headers.update(Deployment.CUSTOM_HEADERS)
return i | [
"def",
"iter_deployments",
"(",
"self",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'deployments'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"i",
"=",
"self",
".",
"_iter",
"(",
"int",
"(",
"number",
")",
",",
"url",
",",
"Deployment",
",",
"etag",
"=",
"etag",
")",
"i",
".",
"headers",
".",
"update",
"(",
"Deployment",
".",
"CUSTOM_HEADERS",
")",
"return",
"i"
] | Iterate over deployments for this repository.
:param int number: (optional), number of deployments to return.
Default: -1, returns all available deployments
:param str etag: (optional), ETag from a previous request for all
deployments
:returns: generator of
:class:`Deployment <github3.repos.deployment.Deployment>`\ s | [
"Iterate",
"over",
"deployments",
"for",
"this",
"repository",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L1255-L1268 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.iter_forks | def iter_forks(self, sort='', number=-1, etag=None):
"""Iterate over forks of this repository.
:param str sort: (optional), accepted values:
('newest', 'oldest', 'watchers'), API default: 'newest'
:param int number: (optional), number of forks to return. Default: -1
returns all forks
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`Repository <Repository>`
"""
url = self._build_url('forks', base_url=self._api)
params = {}
if sort in ('newest', 'oldest', 'watchers'):
params = {'sort': sort}
return self._iter(int(number), url, Repository, params, etag) | python | def iter_forks(self, sort='', number=-1, etag=None):
"""Iterate over forks of this repository.
:param str sort: (optional), accepted values:
('newest', 'oldest', 'watchers'), API default: 'newest'
:param int number: (optional), number of forks to return. Default: -1
returns all forks
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`Repository <Repository>`
"""
url = self._build_url('forks', base_url=self._api)
params = {}
if sort in ('newest', 'oldest', 'watchers'):
params = {'sort': sort}
return self._iter(int(number), url, Repository, params, etag) | [
"def",
"iter_forks",
"(",
"self",
",",
"sort",
"=",
"''",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'forks'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"params",
"=",
"{",
"}",
"if",
"sort",
"in",
"(",
"'newest'",
",",
"'oldest'",
",",
"'watchers'",
")",
":",
"params",
"=",
"{",
"'sort'",
":",
"sort",
"}",
"return",
"self",
".",
"_iter",
"(",
"int",
"(",
"number",
")",
",",
"url",
",",
"Repository",
",",
"params",
",",
"etag",
")"
] | Iterate over forks of this repository.
:param str sort: (optional), accepted values:
('newest', 'oldest', 'watchers'), API default: 'newest'
:param int number: (optional), number of forks to return. Default: -1
returns all forks
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`Repository <Repository>` | [
"Iterate",
"over",
"forks",
"of",
"this",
"repository",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L1282-L1297 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.iter_hooks | def iter_hooks(self, number=-1, etag=None):
"""Iterate over hooks registered on this repository.
:param int number: (optional), number of hoks to return. Default: -1
returns all hooks
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`Hook <github3.repos.hook.Hook>`\ s
"""
url = self._build_url('hooks', base_url=self._api)
return self._iter(int(number), url, Hook, etag=etag) | python | def iter_hooks(self, number=-1, etag=None):
"""Iterate over hooks registered on this repository.
:param int number: (optional), number of hoks to return. Default: -1
returns all hooks
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`Hook <github3.repos.hook.Hook>`\ s
"""
url = self._build_url('hooks', base_url=self._api)
return self._iter(int(number), url, Hook, etag=etag) | [
"def",
"iter_hooks",
"(",
"self",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'hooks'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_iter",
"(",
"int",
"(",
"number",
")",
",",
"url",
",",
"Hook",
",",
"etag",
"=",
"etag",
")"
] | Iterate over hooks registered on this repository.
:param int number: (optional), number of hoks to return. Default: -1
returns all hooks
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`Hook <github3.repos.hook.Hook>`\ s | [
"Iterate",
"over",
"hooks",
"registered",
"on",
"this",
"repository",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L1300-L1310 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.iter_issues | def iter_issues(self,
milestone=None,
state=None,
assignee=None,
mentioned=None,
labels=None,
sort=None,
direction=None,
since=None,
number=-1,
etag=None):
"""Iterate over issues on this repo based upon parameters passed.
.. versionchanged:: 0.9.0
The ``state`` parameter now accepts 'all' in addition to 'open'
and 'closed'.
:param int milestone: (optional), 'none', or '*'
:param str state: (optional), accepted values: ('all', 'open',
'closed')
:param str assignee: (optional), 'none', '*', or login name
:param str mentioned: (optional), user's login name
:param str labels: (optional), comma-separated list of labels, e.g.
'bug,ui,@high'
:param sort: (optional), accepted values:
('created', 'updated', 'comments', 'created')
:param str direction: (optional), accepted values: ('asc', '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.
By default all issues are returned
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`Issue <github3.issues.issue.Issue>`\ s
"""
url = self._build_url('issues', base_url=self._api)
params = {'assignee': assignee, 'mentioned': mentioned}
if milestone in ('*', 'none') or isinstance(milestone, int):
params['milestone'] = milestone
self._remove_none(params)
params.update(
issue_params(None, state, labels, sort, direction,
since)
)
return self._iter(int(number), url, Issue, params, etag) | python | def iter_issues(self,
milestone=None,
state=None,
assignee=None,
mentioned=None,
labels=None,
sort=None,
direction=None,
since=None,
number=-1,
etag=None):
"""Iterate over issues on this repo based upon parameters passed.
.. versionchanged:: 0.9.0
The ``state`` parameter now accepts 'all' in addition to 'open'
and 'closed'.
:param int milestone: (optional), 'none', or '*'
:param str state: (optional), accepted values: ('all', 'open',
'closed')
:param str assignee: (optional), 'none', '*', or login name
:param str mentioned: (optional), user's login name
:param str labels: (optional), comma-separated list of labels, e.g.
'bug,ui,@high'
:param sort: (optional), accepted values:
('created', 'updated', 'comments', 'created')
:param str direction: (optional), accepted values: ('asc', '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.
By default all issues are returned
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`Issue <github3.issues.issue.Issue>`\ s
"""
url = self._build_url('issues', base_url=self._api)
params = {'assignee': assignee, 'mentioned': mentioned}
if milestone in ('*', 'none') or isinstance(milestone, int):
params['milestone'] = milestone
self._remove_none(params)
params.update(
issue_params(None, state, labels, sort, direction,
since)
)
return self._iter(int(number), url, Issue, params, etag) | [
"def",
"iter_issues",
"(",
"self",
",",
"milestone",
"=",
"None",
",",
"state",
"=",
"None",
",",
"assignee",
"=",
"None",
",",
"mentioned",
"=",
"None",
",",
"labels",
"=",
"None",
",",
"sort",
"=",
"None",
",",
"direction",
"=",
"None",
",",
"since",
"=",
"None",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'issues'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"params",
"=",
"{",
"'assignee'",
":",
"assignee",
",",
"'mentioned'",
":",
"mentioned",
"}",
"if",
"milestone",
"in",
"(",
"'*'",
",",
"'none'",
")",
"or",
"isinstance",
"(",
"milestone",
",",
"int",
")",
":",
"params",
"[",
"'milestone'",
"]",
"=",
"milestone",
"self",
".",
"_remove_none",
"(",
"params",
")",
"params",
".",
"update",
"(",
"issue_params",
"(",
"None",
",",
"state",
",",
"labels",
",",
"sort",
",",
"direction",
",",
"since",
")",
")",
"return",
"self",
".",
"_iter",
"(",
"int",
"(",
"number",
")",
",",
"url",
",",
"Issue",
",",
"params",
",",
"etag",
")"
] | Iterate over issues on this repo based upon parameters passed.
.. versionchanged:: 0.9.0
The ``state`` parameter now accepts 'all' in addition to 'open'
and 'closed'.
:param int milestone: (optional), 'none', or '*'
:param str state: (optional), accepted values: ('all', 'open',
'closed')
:param str assignee: (optional), 'none', '*', or login name
:param str mentioned: (optional), user's login name
:param str labels: (optional), comma-separated list of labels, e.g.
'bug,ui,@high'
:param sort: (optional), accepted values:
('created', 'updated', 'comments', 'created')
:param str direction: (optional), accepted values: ('asc', '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.
By default all issues are returned
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`Issue <github3.issues.issue.Issue>`\ s | [
"Iterate",
"over",
"issues",
"on",
"this",
"repo",
"based",
"upon",
"parameters",
"passed",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L1312-L1361 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.iter_issue_events | def iter_issue_events(self, number=-1, etag=None):
"""Iterates over issue events on this repository.
: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:`IssueEvent <github3.issues.event.IssueEvent>`\ s
"""
url = self._build_url('issues', 'events', base_url=self._api)
return self._iter(int(number), url, IssueEvent, etag=etag) | python | def iter_issue_events(self, number=-1, etag=None):
"""Iterates over issue events on this repository.
: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:`IssueEvent <github3.issues.event.IssueEvent>`\ s
"""
url = self._build_url('issues', 'events', base_url=self._api)
return self._iter(int(number), url, IssueEvent, etag=etag) | [
"def",
"iter_issue_events",
"(",
"self",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'issues'",
",",
"'events'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_iter",
"(",
"int",
"(",
"number",
")",
",",
"url",
",",
"IssueEvent",
",",
"etag",
"=",
"etag",
")"
] | Iterates over issue events on this repository.
: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:`IssueEvent <github3.issues.event.IssueEvent>`\ s | [
"Iterates",
"over",
"issue",
"events",
"on",
"this",
"repository",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L1363-L1374 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.iter_languages | def iter_languages(self, number=-1, etag=None):
"""Iterate over the programming languages used in the repository.
:param int number: (optional), number of languages to return. Default:
-1 returns all used languages
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of tuples
"""
url = self._build_url('languages', base_url=self._api)
return self._iter(int(number), url, tuple, etag=etag) | python | def iter_languages(self, number=-1, etag=None):
"""Iterate over the programming languages used in the repository.
:param int number: (optional), number of languages to return. Default:
-1 returns all used languages
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of tuples
"""
url = self._build_url('languages', base_url=self._api)
return self._iter(int(number), url, tuple, etag=etag) | [
"def",
"iter_languages",
"(",
"self",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'languages'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_iter",
"(",
"int",
"(",
"number",
")",
",",
"url",
",",
"tuple",
",",
"etag",
"=",
"etag",
")"
] | Iterate over the programming languages used in the repository.
:param int number: (optional), number of languages to return. Default:
-1 returns all used languages
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of tuples | [
"Iterate",
"over",
"the",
"programming",
"languages",
"used",
"in",
"the",
"repository",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L1401-L1411 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.iter_milestones | def iter_milestones(self, state=None, sort=None, direction=None,
number=-1, etag=None):
"""Iterates over the milestones on this repository.
:param str state: (optional), state of the milestones, accepted
values: ('open', 'closed')
:param str sort: (optional), how to sort the milestones, accepted
values: ('due_date', 'completeness')
:param str direction: (optional), direction to sort the milestones,
accepted values: ('asc', 'desc')
:param int number: (optional), number of milestones to return.
Default: -1 returns all milestones
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of
:class:`Milestone <github3.issues.milestone.Milestone>`\ s
"""
url = self._build_url('milestones', base_url=self._api)
accepted = {'state': ('open', 'closed'),
'sort': ('due_date', 'completeness'),
'direction': ('asc', 'desc')}
params = {'state': state, 'sort': sort, 'direction': direction}
for (k, v) in list(params.items()):
if not (v and (v in accepted[k])): # e.g., '' or None
del params[k]
if not params:
params = None
return self._iter(int(number), url, Milestone, params, etag) | python | def iter_milestones(self, state=None, sort=None, direction=None,
number=-1, etag=None):
"""Iterates over the milestones on this repository.
:param str state: (optional), state of the milestones, accepted
values: ('open', 'closed')
:param str sort: (optional), how to sort the milestones, accepted
values: ('due_date', 'completeness')
:param str direction: (optional), direction to sort the milestones,
accepted values: ('asc', 'desc')
:param int number: (optional), number of milestones to return.
Default: -1 returns all milestones
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of
:class:`Milestone <github3.issues.milestone.Milestone>`\ s
"""
url = self._build_url('milestones', base_url=self._api)
accepted = {'state': ('open', 'closed'),
'sort': ('due_date', 'completeness'),
'direction': ('asc', 'desc')}
params = {'state': state, 'sort': sort, 'direction': direction}
for (k, v) in list(params.items()):
if not (v and (v in accepted[k])): # e.g., '' or None
del params[k]
if not params:
params = None
return self._iter(int(number), url, Milestone, params, etag) | [
"def",
"iter_milestones",
"(",
"self",
",",
"state",
"=",
"None",
",",
"sort",
"=",
"None",
",",
"direction",
"=",
"None",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'milestones'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"accepted",
"=",
"{",
"'state'",
":",
"(",
"'open'",
",",
"'closed'",
")",
",",
"'sort'",
":",
"(",
"'due_date'",
",",
"'completeness'",
")",
",",
"'direction'",
":",
"(",
"'asc'",
",",
"'desc'",
")",
"}",
"params",
"=",
"{",
"'state'",
":",
"state",
",",
"'sort'",
":",
"sort",
",",
"'direction'",
":",
"direction",
"}",
"for",
"(",
"k",
",",
"v",
")",
"in",
"list",
"(",
"params",
".",
"items",
"(",
")",
")",
":",
"if",
"not",
"(",
"v",
"and",
"(",
"v",
"in",
"accepted",
"[",
"k",
"]",
")",
")",
":",
"# e.g., '' or None",
"del",
"params",
"[",
"k",
"]",
"if",
"not",
"params",
":",
"params",
"=",
"None",
"return",
"self",
".",
"_iter",
"(",
"int",
"(",
"number",
")",
",",
"url",
",",
"Milestone",
",",
"params",
",",
"etag",
")"
] | Iterates over the milestones on this repository.
:param str state: (optional), state of the milestones, accepted
values: ('open', 'closed')
:param str sort: (optional), how to sort the milestones, accepted
values: ('due_date', 'completeness')
:param str direction: (optional), direction to sort the milestones,
accepted values: ('asc', 'desc')
:param int number: (optional), number of milestones to return.
Default: -1 returns all milestones
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of
:class:`Milestone <github3.issues.milestone.Milestone>`\ s | [
"Iterates",
"over",
"the",
"milestones",
"on",
"this",
"repository",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L1413-L1440 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.iter_network_events | def iter_network_events(self, number=-1, etag=None):
"""Iterates over events on a network of repositories.
: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 <github3.events.Event>`\ s
"""
base = self._api.replace('repos', 'networks', 1)
url = self._build_url('events', base_url=base)
return self._iter(int(number), url, Event, etag) | python | def iter_network_events(self, number=-1, etag=None):
"""Iterates over events on a network of repositories.
: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 <github3.events.Event>`\ s
"""
base = self._api.replace('repos', 'networks', 1)
url = self._build_url('events', base_url=base)
return self._iter(int(number), url, Event, etag) | [
"def",
"iter_network_events",
"(",
"self",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"base",
"=",
"self",
".",
"_api",
".",
"replace",
"(",
"'repos'",
",",
"'networks'",
",",
"1",
")",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'events'",
",",
"base_url",
"=",
"base",
")",
"return",
"self",
".",
"_iter",
"(",
"int",
"(",
"number",
")",
",",
"url",
",",
"Event",
",",
"etag",
")"
] | Iterates over events on a network of repositories.
: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 <github3.events.Event>`\ s | [
"Iterates",
"over",
"events",
"on",
"a",
"network",
"of",
"repositories",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L1442-L1453 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.iter_notifications | def iter_notifications(self, all=False, participating=False, since=None,
number=-1, etag=None):
"""Iterates over the notifications for this repository.
:param bool all: (optional), show all notifications, including ones
marked as read
:param bool participating: (optional), show only the notifications the
user is participating in directly
:param since: (optional), filters out any notifications updated
before the given time. This can be a `datetime` or an `ISO8601`
formatted date string, e.g., 2012-05-20T23:10:27Z
:type since: datetime or string
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`Thread <github3.notifications.Thread>`
"""
url = self._build_url('notifications', base_url=self._api)
params = {
'all': all,
'participating': participating,
'since': timestamp_parameter(since)
}
for (k, v) in list(params.items()):
if not v:
del params[k]
return self._iter(int(number), url, Thread, params, etag) | python | def iter_notifications(self, all=False, participating=False, since=None,
number=-1, etag=None):
"""Iterates over the notifications for this repository.
:param bool all: (optional), show all notifications, including ones
marked as read
:param bool participating: (optional), show only the notifications the
user is participating in directly
:param since: (optional), filters out any notifications updated
before the given time. This can be a `datetime` or an `ISO8601`
formatted date string, e.g., 2012-05-20T23:10:27Z
:type since: datetime or string
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`Thread <github3.notifications.Thread>`
"""
url = self._build_url('notifications', base_url=self._api)
params = {
'all': all,
'participating': participating,
'since': timestamp_parameter(since)
}
for (k, v) in list(params.items()):
if not v:
del params[k]
return self._iter(int(number), url, Thread, params, etag) | [
"def",
"iter_notifications",
"(",
"self",
",",
"all",
"=",
"False",
",",
"participating",
"=",
"False",
",",
"since",
"=",
"None",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'notifications'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"params",
"=",
"{",
"'all'",
":",
"all",
",",
"'participating'",
":",
"participating",
",",
"'since'",
":",
"timestamp_parameter",
"(",
"since",
")",
"}",
"for",
"(",
"k",
",",
"v",
")",
"in",
"list",
"(",
"params",
".",
"items",
"(",
")",
")",
":",
"if",
"not",
"v",
":",
"del",
"params",
"[",
"k",
"]",
"return",
"self",
".",
"_iter",
"(",
"int",
"(",
"number",
")",
",",
"url",
",",
"Thread",
",",
"params",
",",
"etag",
")"
] | Iterates over the notifications for this repository.
:param bool all: (optional), show all notifications, including ones
marked as read
:param bool participating: (optional), show only the notifications the
user is participating in directly
:param since: (optional), filters out any notifications updated
before the given time. This can be a `datetime` or an `ISO8601`
formatted date string, e.g., 2012-05-20T23:10:27Z
:type since: datetime or string
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`Thread <github3.notifications.Thread>` | [
"Iterates",
"over",
"the",
"notifications",
"for",
"this",
"repository",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L1456-L1481 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.iter_pages_builds | def iter_pages_builds(self, number=-1, etag=None):
"""Iterate over pages builds of this repository.
:returns: generator of :class:`PagesBuild
<github3.repos.pages.PagesBuild>`
"""
url = self._build_url('pages', 'builds', base_url=self._api)
return self._iter(int(number), url, PagesBuild, etag=etag) | python | def iter_pages_builds(self, number=-1, etag=None):
"""Iterate over pages builds of this repository.
:returns: generator of :class:`PagesBuild
<github3.repos.pages.PagesBuild>`
"""
url = self._build_url('pages', 'builds', base_url=self._api)
return self._iter(int(number), url, PagesBuild, etag=etag) | [
"def",
"iter_pages_builds",
"(",
"self",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'pages'",
",",
"'builds'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_iter",
"(",
"int",
"(",
"number",
")",
",",
"url",
",",
"PagesBuild",
",",
"etag",
"=",
"etag",
")"
] | Iterate over pages builds of this repository.
:returns: generator of :class:`PagesBuild
<github3.repos.pages.PagesBuild>` | [
"Iterate",
"over",
"pages",
"builds",
"of",
"this",
"repository",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L1484-L1491 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.iter_pulls | def iter_pulls(self, state=None, head=None, base=None, sort='created',
direction='desc', number=-1, etag=None):
"""List pull requests on repository.
.. versionchanged:: 0.9.0
- The ``state`` parameter now accepts 'all' in addition to 'open'
and 'closed'.
- The ``sort`` parameter was added.
- The ``direction`` parameter was added.
:param str state: (optional), accepted values: ('all', 'open',
'closed')
:param str head: (optional), filters pulls by head user and branch
name in the format ``user:ref-name``, e.g., ``seveas:debian``
:param str base: (optional), filter pulls by base branch name.
Example: ``develop``.
:param str sort: (optional), Sort pull requests by ``created``,
``updated``, ``popularity``, ``long-running``. Default: 'created'
:param str direction: (optional), Choose the direction to list pull
requests. Accepted values: ('desc', 'asc'). Default: 'desc'
:param int number: (optional), number of pulls to return. Default: -1
returns all available pull requests
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of
:class:`PullRequest <github3.pulls.PullRequest>`\ s
"""
url = self._build_url('pulls', base_url=self._api)
params = {}
if state and state.lower() in ('all', 'open', 'closed'):
params['state'] = state.lower()
params.update(head=head, base=base, sort=sort, direction=direction)
self._remove_none(params)
return self._iter(int(number), url, PullRequest, params, etag) | python | def iter_pulls(self, state=None, head=None, base=None, sort='created',
direction='desc', number=-1, etag=None):
"""List pull requests on repository.
.. versionchanged:: 0.9.0
- The ``state`` parameter now accepts 'all' in addition to 'open'
and 'closed'.
- The ``sort`` parameter was added.
- The ``direction`` parameter was added.
:param str state: (optional), accepted values: ('all', 'open',
'closed')
:param str head: (optional), filters pulls by head user and branch
name in the format ``user:ref-name``, e.g., ``seveas:debian``
:param str base: (optional), filter pulls by base branch name.
Example: ``develop``.
:param str sort: (optional), Sort pull requests by ``created``,
``updated``, ``popularity``, ``long-running``. Default: 'created'
:param str direction: (optional), Choose the direction to list pull
requests. Accepted values: ('desc', 'asc'). Default: 'desc'
:param int number: (optional), number of pulls to return. Default: -1
returns all available pull requests
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of
:class:`PullRequest <github3.pulls.PullRequest>`\ s
"""
url = self._build_url('pulls', base_url=self._api)
params = {}
if state and state.lower() in ('all', 'open', 'closed'):
params['state'] = state.lower()
params.update(head=head, base=base, sort=sort, direction=direction)
self._remove_none(params)
return self._iter(int(number), url, PullRequest, params, etag) | [
"def",
"iter_pulls",
"(",
"self",
",",
"state",
"=",
"None",
",",
"head",
"=",
"None",
",",
"base",
"=",
"None",
",",
"sort",
"=",
"'created'",
",",
"direction",
"=",
"'desc'",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'pulls'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"params",
"=",
"{",
"}",
"if",
"state",
"and",
"state",
".",
"lower",
"(",
")",
"in",
"(",
"'all'",
",",
"'open'",
",",
"'closed'",
")",
":",
"params",
"[",
"'state'",
"]",
"=",
"state",
".",
"lower",
"(",
")",
"params",
".",
"update",
"(",
"head",
"=",
"head",
",",
"base",
"=",
"base",
",",
"sort",
"=",
"sort",
",",
"direction",
"=",
"direction",
")",
"self",
".",
"_remove_none",
"(",
"params",
")",
"return",
"self",
".",
"_iter",
"(",
"int",
"(",
"number",
")",
",",
"url",
",",
"PullRequest",
",",
"params",
",",
"etag",
")"
] | List pull requests on repository.
.. versionchanged:: 0.9.0
- The ``state`` parameter now accepts 'all' in addition to 'open'
and 'closed'.
- The ``sort`` parameter was added.
- The ``direction`` parameter was added.
:param str state: (optional), accepted values: ('all', 'open',
'closed')
:param str head: (optional), filters pulls by head user and branch
name in the format ``user:ref-name``, e.g., ``seveas:debian``
:param str base: (optional), filter pulls by base branch name.
Example: ``develop``.
:param str sort: (optional), Sort pull requests by ``created``,
``updated``, ``popularity``, ``long-running``. Default: 'created'
:param str direction: (optional), Choose the direction to list pull
requests. Accepted values: ('desc', 'asc'). Default: 'desc'
:param int number: (optional), number of pulls to return. Default: -1
returns all available pull requests
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of
:class:`PullRequest <github3.pulls.PullRequest>`\ s | [
"List",
"pull",
"requests",
"on",
"repository",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L1493-L1529 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.iter_refs | def iter_refs(self, subspace='', number=-1, etag=None):
"""Iterates over references for this repository.
:param str subspace: (optional), e.g. 'tags', 'stashes', 'notes'
:param int number: (optional), number of refs to return. Default: -1
returns all available refs
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`Reference <github3.git.Reference>`\ s
"""
if subspace:
args = ('git', 'refs', subspace)
else:
args = ('git', 'refs')
url = self._build_url(*args, base_url=self._api)
return self._iter(int(number), url, Reference, etag=etag) | python | def iter_refs(self, subspace='', number=-1, etag=None):
"""Iterates over references for this repository.
:param str subspace: (optional), e.g. 'tags', 'stashes', 'notes'
:param int number: (optional), number of refs to return. Default: -1
returns all available refs
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`Reference <github3.git.Reference>`\ s
"""
if subspace:
args = ('git', 'refs', subspace)
else:
args = ('git', 'refs')
url = self._build_url(*args, base_url=self._api)
return self._iter(int(number), url, Reference, etag=etag) | [
"def",
"iter_refs",
"(",
"self",
",",
"subspace",
"=",
"''",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"if",
"subspace",
":",
"args",
"=",
"(",
"'git'",
",",
"'refs'",
",",
"subspace",
")",
"else",
":",
"args",
"=",
"(",
"'git'",
",",
"'refs'",
")",
"url",
"=",
"self",
".",
"_build_url",
"(",
"*",
"args",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_iter",
"(",
"int",
"(",
"number",
")",
",",
"url",
",",
"Reference",
",",
"etag",
"=",
"etag",
")"
] | Iterates over references for this repository.
:param str subspace: (optional), e.g. 'tags', 'stashes', 'notes'
:param int number: (optional), number of refs to return. Default: -1
returns all available refs
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`Reference <github3.git.Reference>`\ s | [
"Iterates",
"over",
"references",
"for",
"this",
"repository",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L1531-L1546 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.iter_releases | def iter_releases(self, number=-1, etag=None):
"""Iterates over releases for this repository.
:param int number: (optional), number of refs to return. Default: -1
returns all available refs
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of
:class:`Release <github3.repos.release.Release>`\ s
"""
url = self._build_url('releases', base_url=self._api)
iterator = self._iter(int(number), url, Release, etag=etag)
iterator.headers.update(Release.CUSTOM_HEADERS)
return iterator | python | def iter_releases(self, number=-1, etag=None):
"""Iterates over releases for this repository.
:param int number: (optional), number of refs to return. Default: -1
returns all available refs
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of
:class:`Release <github3.repos.release.Release>`\ s
"""
url = self._build_url('releases', base_url=self._api)
iterator = self._iter(int(number), url, Release, etag=etag)
iterator.headers.update(Release.CUSTOM_HEADERS)
return iterator | [
"def",
"iter_releases",
"(",
"self",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'releases'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"iterator",
"=",
"self",
".",
"_iter",
"(",
"int",
"(",
"number",
")",
",",
"url",
",",
"Release",
",",
"etag",
"=",
"etag",
")",
"iterator",
".",
"headers",
".",
"update",
"(",
"Release",
".",
"CUSTOM_HEADERS",
")",
"return",
"iterator"
] | Iterates over releases for this repository.
:param int number: (optional), number of refs to return. Default: -1
returns all available refs
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of
:class:`Release <github3.repos.release.Release>`\ s | [
"Iterates",
"over",
"releases",
"for",
"this",
"repository",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L1548-L1561 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.iter_statuses | def iter_statuses(self, sha, number=-1, etag=None):
"""Iterates over the statuses for a specific SHA.
:param str sha: SHA of the commit to list the statuses of
:param int number: (optional), return up to number statuses. Default:
-1 returns all available statuses.
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`Status <github3.repos.status.Status>`
"""
url = ''
if sha:
url = self._build_url('statuses', sha, base_url=self._api)
return self._iter(int(number), url, Status, etag=etag) | python | def iter_statuses(self, sha, number=-1, etag=None):
"""Iterates over the statuses for a specific SHA.
:param str sha: SHA of the commit to list the statuses of
:param int number: (optional), return up to number statuses. Default:
-1 returns all available statuses.
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`Status <github3.repos.status.Status>`
"""
url = ''
if sha:
url = self._build_url('statuses', sha, base_url=self._api)
return self._iter(int(number), url, Status, etag=etag) | [
"def",
"iter_statuses",
"(",
"self",
",",
"sha",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"url",
"=",
"''",
"if",
"sha",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'statuses'",
",",
"sha",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_iter",
"(",
"int",
"(",
"number",
")",
",",
"url",
",",
"Status",
",",
"etag",
"=",
"etag",
")"
] | Iterates over the statuses for a specific SHA.
:param str sha: SHA of the commit to list the statuses of
:param int number: (optional), return up to number statuses. Default:
-1 returns all available statuses.
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`Status <github3.repos.status.Status>` | [
"Iterates",
"over",
"the",
"statuses",
"for",
"a",
"specific",
"SHA",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L1587-L1600 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.iter_tags | def iter_tags(self, number=-1, etag=None):
"""Iterates over tags on this repository.
:param int number: (optional), return up to at most number tags.
Default: -1 returns all available tags.
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`RepoTag <github3.repos.tag.RepoTag>`\ s
"""
url = self._build_url('tags', base_url=self._api)
return self._iter(int(number), url, RepoTag, etag=etag) | python | def iter_tags(self, number=-1, etag=None):
"""Iterates over tags on this repository.
:param int number: (optional), return up to at most number tags.
Default: -1 returns all available tags.
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`RepoTag <github3.repos.tag.RepoTag>`\ s
"""
url = self._build_url('tags', base_url=self._api)
return self._iter(int(number), url, RepoTag, etag=etag) | [
"def",
"iter_tags",
"(",
"self",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'tags'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_iter",
"(",
"int",
"(",
"number",
")",
",",
"url",
",",
"RepoTag",
",",
"etag",
"=",
"etag",
")"
] | Iterates over tags on this repository.
:param int number: (optional), return up to at most number tags.
Default: -1 returns all available tags.
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`RepoTag <github3.repos.tag.RepoTag>`\ s | [
"Iterates",
"over",
"tags",
"on",
"this",
"repository",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L1602-L1612 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.mark_notifications | def mark_notifications(self, last_read=''):
"""Mark all notifications in this repository as read.
:param str last_read: (optional), Describes the last point that
notifications were checked. Anything updated since this time will
not be updated. Default: Now. Expected in ISO 8601 format:
``YYYY-MM-DDTHH:MM:SSZ``. Example: "2012-10-09T23:39:01Z".
:returns: bool
"""
url = self._build_url('notifications', base_url=self._api)
mark = {'read': True}
if last_read:
mark['last_read_at'] = last_read
return self._boolean(self._put(url, data=dumps(mark)),
205, 404) | python | def mark_notifications(self, last_read=''):
"""Mark all notifications in this repository as read.
:param str last_read: (optional), Describes the last point that
notifications were checked. Anything updated since this time will
not be updated. Default: Now. Expected in ISO 8601 format:
``YYYY-MM-DDTHH:MM:SSZ``. Example: "2012-10-09T23:39:01Z".
:returns: bool
"""
url = self._build_url('notifications', base_url=self._api)
mark = {'read': True}
if last_read:
mark['last_read_at'] = last_read
return self._boolean(self._put(url, data=dumps(mark)),
205, 404) | [
"def",
"mark_notifications",
"(",
"self",
",",
"last_read",
"=",
"''",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'notifications'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"mark",
"=",
"{",
"'read'",
":",
"True",
"}",
"if",
"last_read",
":",
"mark",
"[",
"'last_read_at'",
"]",
"=",
"last_read",
"return",
"self",
".",
"_boolean",
"(",
"self",
".",
"_put",
"(",
"url",
",",
"data",
"=",
"dumps",
"(",
"mark",
")",
")",
",",
"205",
",",
"404",
")"
] | Mark all notifications in this repository as read.
:param str last_read: (optional), Describes the last point that
notifications were checked. Anything updated since this time will
not be updated. Default: Now. Expected in ISO 8601 format:
``YYYY-MM-DDTHH:MM:SSZ``. Example: "2012-10-09T23:39:01Z".
:returns: bool | [
"Mark",
"all",
"notifications",
"in",
"this",
"repository",
"as",
"read",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L1629-L1643 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.merge | def merge(self, base, head, message=''):
"""Perform a merge from ``head`` into ``base``.
:param str base: (required), where you're merging into
:param str head: (required), where you're merging from
:param str message: (optional), message to be used for the commit
:returns: :class:`RepoCommit <github3.repos.commit.RepoCommit>`
"""
url = self._build_url('merges', base_url=self._api)
data = {'base': base, 'head': head}
if message:
data['commit_message'] = message
json = self._json(self._post(url, data=data), 201)
return RepoCommit(json, self) if json else None | python | def merge(self, base, head, message=''):
"""Perform a merge from ``head`` into ``base``.
:param str base: (required), where you're merging into
:param str head: (required), where you're merging from
:param str message: (optional), message to be used for the commit
:returns: :class:`RepoCommit <github3.repos.commit.RepoCommit>`
"""
url = self._build_url('merges', base_url=self._api)
data = {'base': base, 'head': head}
if message:
data['commit_message'] = message
json = self._json(self._post(url, data=data), 201)
return RepoCommit(json, self) if json else None | [
"def",
"merge",
"(",
"self",
",",
"base",
",",
"head",
",",
"message",
"=",
"''",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'merges'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"data",
"=",
"{",
"'base'",
":",
"base",
",",
"'head'",
":",
"head",
"}",
"if",
"message",
":",
"data",
"[",
"'commit_message'",
"]",
"=",
"message",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_post",
"(",
"url",
",",
"data",
"=",
"data",
")",
",",
"201",
")",
"return",
"RepoCommit",
"(",
"json",
",",
"self",
")",
"if",
"json",
"else",
"None"
] | Perform a merge from ``head`` into ``base``.
:param str base: (required), where you're merging into
:param str head: (required), where you're merging from
:param str message: (optional), message to be used for the commit
:returns: :class:`RepoCommit <github3.repos.commit.RepoCommit>` | [
"Perform",
"a",
"merge",
"from",
"head",
"into",
"base",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L1646-L1659 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.milestone | def milestone(self, number):
"""Get the milestone indicated by ``number``.
:param int number: (required), unique id number of the milestone
:returns: :class:`Milestone <github3.issues.milestone.Milestone>`
"""
json = None
if int(number) > 0:
url = self._build_url('milestones', str(number),
base_url=self._api)
json = self._json(self._get(url), 200)
return Milestone(json, self) if json else None | python | def milestone(self, number):
"""Get the milestone indicated by ``number``.
:param int number: (required), unique id number of the milestone
:returns: :class:`Milestone <github3.issues.milestone.Milestone>`
"""
json = None
if int(number) > 0:
url = self._build_url('milestones', str(number),
base_url=self._api)
json = self._json(self._get(url), 200)
return Milestone(json, self) if json else None | [
"def",
"milestone",
"(",
"self",
",",
"number",
")",
":",
"json",
"=",
"None",
"if",
"int",
"(",
"number",
")",
">",
"0",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'milestones'",
",",
"str",
"(",
"number",
")",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_get",
"(",
"url",
")",
",",
"200",
")",
"return",
"Milestone",
"(",
"json",
",",
"self",
")",
"if",
"json",
"else",
"None"
] | Get the milestone indicated by ``number``.
:param int number: (required), unique id number of the milestone
:returns: :class:`Milestone <github3.issues.milestone.Milestone>` | [
"Get",
"the",
"milestone",
"indicated",
"by",
"number",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L1661-L1672 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.pages | def pages(self):
"""Get information about this repository's pages site.
:returns: :class:`PagesInfo <github3.repos.pages.PagesInfo>`
"""
url = self._build_url('pages', base_url=self._api)
json = self._json(self._get(url), 200)
return PagesInfo(json) if json else None | python | def pages(self):
"""Get information about this repository's pages site.
:returns: :class:`PagesInfo <github3.repos.pages.PagesInfo>`
"""
url = self._build_url('pages', base_url=self._api)
json = self._json(self._get(url), 200)
return PagesInfo(json) if json else None | [
"def",
"pages",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'pages'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_get",
"(",
"url",
")",
",",
"200",
")",
"return",
"PagesInfo",
"(",
"json",
")",
"if",
"json",
"else",
"None"
] | Get information about this repository's pages site.
:returns: :class:`PagesInfo <github3.repos.pages.PagesInfo>` | [
"Get",
"information",
"about",
"this",
"repository",
"s",
"pages",
"site",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L1675-L1682 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.pull_request | def pull_request(self, number):
"""Get the pull request indicated by ``number``.
:param int number: (required), number of the pull request.
:returns: :class:`PullRequest <github3.pulls.PullRequest>`
"""
json = None
if int(number) > 0:
url = self._build_url('pulls', str(number), base_url=self._api)
json = self._json(self._get(url), 200)
return PullRequest(json, self) if json else None | python | def pull_request(self, number):
"""Get the pull request indicated by ``number``.
:param int number: (required), number of the pull request.
:returns: :class:`PullRequest <github3.pulls.PullRequest>`
"""
json = None
if int(number) > 0:
url = self._build_url('pulls', str(number), base_url=self._api)
json = self._json(self._get(url), 200)
return PullRequest(json, self) if json else None | [
"def",
"pull_request",
"(",
"self",
",",
"number",
")",
":",
"json",
"=",
"None",
"if",
"int",
"(",
"number",
")",
">",
"0",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'pulls'",
",",
"str",
"(",
"number",
")",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_get",
"(",
"url",
")",
",",
"200",
")",
"return",
"PullRequest",
"(",
"json",
",",
"self",
")",
"if",
"json",
"else",
"None"
] | Get the pull request indicated by ``number``.
:param int number: (required), number of the pull request.
:returns: :class:`PullRequest <github3.pulls.PullRequest>` | [
"Get",
"the",
"pull",
"request",
"indicated",
"by",
"number",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L1684-L1694 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.readme | def readme(self):
"""Get the README for this repository.
:returns: :class:`Contents <github3.repos.contents.Contents>`
"""
url = self._build_url('readme', base_url=self._api)
json = self._json(self._get(url), 200)
return Contents(json, self) if json else None | python | def readme(self):
"""Get the README for this repository.
:returns: :class:`Contents <github3.repos.contents.Contents>`
"""
url = self._build_url('readme', base_url=self._api)
json = self._json(self._get(url), 200)
return Contents(json, self) if json else None | [
"def",
"readme",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'readme'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_get",
"(",
"url",
")",
",",
"200",
")",
"return",
"Contents",
"(",
"json",
",",
"self",
")",
"if",
"json",
"else",
"None"
] | Get the README for this repository.
:returns: :class:`Contents <github3.repos.contents.Contents>` | [
"Get",
"the",
"README",
"for",
"this",
"repository",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L1696-L1703 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.ref | def ref(self, ref):
"""Get a reference pointed to by ``ref``.
The most common will be branches and tags. For a branch, you must
specify 'heads/branchname' and for a tag, 'tags/tagname'. Essentially,
the system should return any reference you provide it in the namespace,
including notes and stashes (provided they exist on the server).
:param str ref: (required)
:returns: :class:`Reference <github3.git.Reference>`
"""
json = None
if ref:
url = self._build_url('git', 'refs', ref, base_url=self._api)
json = self._json(self._get(url), 200)
return Reference(json, self) if json else None | python | def ref(self, ref):
"""Get a reference pointed to by ``ref``.
The most common will be branches and tags. For a branch, you must
specify 'heads/branchname' and for a tag, 'tags/tagname'. Essentially,
the system should return any reference you provide it in the namespace,
including notes and stashes (provided they exist on the server).
:param str ref: (required)
:returns: :class:`Reference <github3.git.Reference>`
"""
json = None
if ref:
url = self._build_url('git', 'refs', ref, base_url=self._api)
json = self._json(self._get(url), 200)
return Reference(json, self) if json else None | [
"def",
"ref",
"(",
"self",
",",
"ref",
")",
":",
"json",
"=",
"None",
"if",
"ref",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'git'",
",",
"'refs'",
",",
"ref",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_get",
"(",
"url",
")",
",",
"200",
")",
"return",
"Reference",
"(",
"json",
",",
"self",
")",
"if",
"json",
"else",
"None"
] | Get a reference pointed to by ``ref``.
The most common will be branches and tags. For a branch, you must
specify 'heads/branchname' and for a tag, 'tags/tagname'. Essentially,
the system should return any reference you provide it in the namespace,
including notes and stashes (provided they exist on the server).
:param str ref: (required)
:returns: :class:`Reference <github3.git.Reference>` | [
"Get",
"a",
"reference",
"pointed",
"to",
"by",
"ref",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L1705-L1720 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.release | def release(self, id):
"""Get a single release.
:param int id: (required), id of release
:returns: :class:`Release <github3.repos.release.Release>`
"""
json = None
if int(id) > 0:
url = self._build_url('releases', str(id), base_url=self._api)
json = self._json(self._get(url), 200)
return Release(json, self) if json else None | python | def release(self, id):
"""Get a single release.
:param int id: (required), id of release
:returns: :class:`Release <github3.repos.release.Release>`
"""
json = None
if int(id) > 0:
url = self._build_url('releases', str(id), base_url=self._api)
json = self._json(self._get(url), 200)
return Release(json, self) if json else None | [
"def",
"release",
"(",
"self",
",",
"id",
")",
":",
"json",
"=",
"None",
"if",
"int",
"(",
"id",
")",
">",
"0",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'releases'",
",",
"str",
"(",
"id",
")",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_get",
"(",
"url",
")",
",",
"200",
")",
"return",
"Release",
"(",
"json",
",",
"self",
")",
"if",
"json",
"else",
"None"
] | Get a single release.
:param int id: (required), id of release
:returns: :class:`Release <github3.repos.release.Release>` | [
"Get",
"a",
"single",
"release",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L1722-L1732 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.remove_collaborator | def remove_collaborator(self, login):
"""Remove collaborator ``login`` from the repository.
:param str login: (required), login name of the collaborator
:returns: bool
"""
resp = False
if login:
url = self._build_url('collaborators', login, base_url=self._api)
resp = self._boolean(self._delete(url), 204, 404)
return resp | python | def remove_collaborator(self, login):
"""Remove collaborator ``login`` from the repository.
:param str login: (required), login name of the collaborator
:returns: bool
"""
resp = False
if login:
url = self._build_url('collaborators', login, base_url=self._api)
resp = self._boolean(self._delete(url), 204, 404)
return resp | [
"def",
"remove_collaborator",
"(",
"self",
",",
"login",
")",
":",
"resp",
"=",
"False",
"if",
"login",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'collaborators'",
",",
"login",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"resp",
"=",
"self",
".",
"_boolean",
"(",
"self",
".",
"_delete",
"(",
"url",
")",
",",
"204",
",",
"404",
")",
"return",
"resp"
] | Remove collaborator ``login`` from the repository.
:param str login: (required), login name of the collaborator
:returns: bool | [
"Remove",
"collaborator",
"login",
"from",
"the",
"repository",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L1735-L1745 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.tag | def tag(self, sha):
"""Get an annotated tag.
http://learn.github.com/p/tagging.html
:param str sha: (required), sha of the object for this tag
:returns: :class:`Tag <github3.git.Tag>`
"""
json = None
if sha:
url = self._build_url('git', 'tags', sha, base_url=self._api)
json = self._json(self._get(url), 200)
return Tag(json) if json else None | python | def tag(self, sha):
"""Get an annotated tag.
http://learn.github.com/p/tagging.html
:param str sha: (required), sha of the object for this tag
:returns: :class:`Tag <github3.git.Tag>`
"""
json = None
if sha:
url = self._build_url('git', 'tags', sha, base_url=self._api)
json = self._json(self._get(url), 200)
return Tag(json) if json else None | [
"def",
"tag",
"(",
"self",
",",
"sha",
")",
":",
"json",
"=",
"None",
"if",
"sha",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'git'",
",",
"'tags'",
",",
"sha",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_get",
"(",
"url",
")",
",",
"200",
")",
"return",
"Tag",
"(",
"json",
")",
"if",
"json",
"else",
"None"
] | Get an annotated tag.
http://learn.github.com/p/tagging.html
:param str sha: (required), sha of the object for this tag
:returns: :class:`Tag <github3.git.Tag>` | [
"Get",
"an",
"annotated",
"tag",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L1772-L1784 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.tree | def tree(self, sha):
"""Get a tree.
:param str sha: (required), sha of the object for this tree
:returns: :class:`Tree <github3.git.Tree>`
"""
json = None
if sha:
url = self._build_url('git', 'trees', sha, base_url=self._api)
json = self._json(self._get(url), 200)
return Tree(json, self) if json else None | python | def tree(self, sha):
"""Get a tree.
:param str sha: (required), sha of the object for this tree
:returns: :class:`Tree <github3.git.Tree>`
"""
json = None
if sha:
url = self._build_url('git', 'trees', sha, base_url=self._api)
json = self._json(self._get(url), 200)
return Tree(json, self) if json else None | [
"def",
"tree",
"(",
"self",
",",
"sha",
")",
":",
"json",
"=",
"None",
"if",
"sha",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'git'",
",",
"'trees'",
",",
"sha",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_get",
"(",
"url",
")",
",",
"200",
")",
"return",
"Tree",
"(",
"json",
",",
"self",
")",
"if",
"json",
"else",
"None"
] | Get a tree.
:param str sha: (required), sha of the object for this tree
:returns: :class:`Tree <github3.git.Tree>` | [
"Get",
"a",
"tree",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L1786-L1796 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.update_label | def update_label(self, name, color, new_name=''):
"""Update the label ``name``.
:param str name: (required), name of the label
:param str color: (required), color code
:param str new_name: (optional), new name of the label
:returns: bool
"""
label = self.label(name)
resp = False
if label:
upd = label.update
resp = upd(new_name, color) if new_name else upd(name, color)
return resp | python | def update_label(self, name, color, new_name=''):
"""Update the label ``name``.
:param str name: (required), name of the label
:param str color: (required), color code
:param str new_name: (optional), new name of the label
:returns: bool
"""
label = self.label(name)
resp = False
if label:
upd = label.update
resp = upd(new_name, color) if new_name else upd(name, color)
return resp | [
"def",
"update_label",
"(",
"self",
",",
"name",
",",
"color",
",",
"new_name",
"=",
"''",
")",
":",
"label",
"=",
"self",
".",
"label",
"(",
"name",
")",
"resp",
"=",
"False",
"if",
"label",
":",
"upd",
"=",
"label",
".",
"update",
"resp",
"=",
"upd",
"(",
"new_name",
",",
"color",
")",
"if",
"new_name",
"else",
"upd",
"(",
"name",
",",
"color",
")",
"return",
"resp"
] | Update the label ``name``.
:param str name: (required), name of the label
:param str color: (required), color code
:param str new_name: (optional), new name of the label
:returns: bool | [
"Update",
"the",
"label",
"name",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L1840-L1853 | train |
kislyuk/aegea | aegea/packages/github3/repos/repo.py | Repository.weekly_commit_count | def weekly_commit_count(self):
"""Returns the total commit counts.
The dictionary returned has two entries: ``all`` and ``owner``. Each
has a fifty-two element long list of commit counts. (Note: ``all``
includes the owner.) ``d['all'][0]`` will be the oldest week,
``d['all'][51]`` will be the most recent.
:returns: dict
.. note:: All statistics methods may return a 202. If github3.py
receives a 202 in this case, it will return an emtpy dictionary.
You should give the API a moment to compose the data and then re
-request it via this method.
..versionadded:: 0.7
"""
url = self._build_url('stats', 'participation', base_url=self._api)
resp = self._get(url)
if resp.status_code == 202:
return {}
json = self._json(resp, 200)
if json.get('ETag'):
del json['ETag']
if json.get('Last-Modified'):
del json['Last-Modified']
return json | python | def weekly_commit_count(self):
"""Returns the total commit counts.
The dictionary returned has two entries: ``all`` and ``owner``. Each
has a fifty-two element long list of commit counts. (Note: ``all``
includes the owner.) ``d['all'][0]`` will be the oldest week,
``d['all'][51]`` will be the most recent.
:returns: dict
.. note:: All statistics methods may return a 202. If github3.py
receives a 202 in this case, it will return an emtpy dictionary.
You should give the API a moment to compose the data and then re
-request it via this method.
..versionadded:: 0.7
"""
url = self._build_url('stats', 'participation', base_url=self._api)
resp = self._get(url)
if resp.status_code == 202:
return {}
json = self._json(resp, 200)
if json.get('ETag'):
del json['ETag']
if json.get('Last-Modified'):
del json['Last-Modified']
return json | [
"def",
"weekly_commit_count",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'stats'",
",",
"'participation'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"resp",
"=",
"self",
".",
"_get",
"(",
"url",
")",
"if",
"resp",
".",
"status_code",
"==",
"202",
":",
"return",
"{",
"}",
"json",
"=",
"self",
".",
"_json",
"(",
"resp",
",",
"200",
")",
"if",
"json",
".",
"get",
"(",
"'ETag'",
")",
":",
"del",
"json",
"[",
"'ETag'",
"]",
"if",
"json",
".",
"get",
"(",
"'Last-Modified'",
")",
":",
"del",
"json",
"[",
"'Last-Modified'",
"]",
"return",
"json"
] | Returns the total commit counts.
The dictionary returned has two entries: ``all`` and ``owner``. Each
has a fifty-two element long list of commit counts. (Note: ``all``
includes the owner.) ``d['all'][0]`` will be the oldest week,
``d['all'][51]`` will be the most recent.
:returns: dict
.. note:: All statistics methods may return a 202. If github3.py
receives a 202 in this case, it will return an emtpy dictionary.
You should give the API a moment to compose the data and then re
-request it via this method.
..versionadded:: 0.7 | [
"Returns",
"the",
"total",
"commit",
"counts",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L1855-L1882 | train |
kislyuk/aegea | aegea/instance_ctl.py | rename | def rename(args):
"""Supply two names: Existing instance name or ID, and new name to assign to the instance."""
old_name, new_name = args.names
add_tags(resources.ec2.Instance(resolve_instance_id(old_name)), Name=new_name, dry_run=args.dry_run) | python | def rename(args):
"""Supply two names: Existing instance name or ID, and new name to assign to the instance."""
old_name, new_name = args.names
add_tags(resources.ec2.Instance(resolve_instance_id(old_name)), Name=new_name, dry_run=args.dry_run) | [
"def",
"rename",
"(",
"args",
")",
":",
"old_name",
",",
"new_name",
"=",
"args",
".",
"names",
"add_tags",
"(",
"resources",
".",
"ec2",
".",
"Instance",
"(",
"resolve_instance_id",
"(",
"old_name",
")",
")",
",",
"Name",
"=",
"new_name",
",",
"dry_run",
"=",
"args",
".",
"dry_run",
")"
] | Supply two names: Existing instance name or ID, and new name to assign to the instance. | [
"Supply",
"two",
"names",
":",
"Existing",
"instance",
"name",
"or",
"ID",
"and",
"new",
"name",
"to",
"assign",
"to",
"the",
"instance",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/instance_ctl.py#L40-L43 | train |
kislyuk/aegea | aegea/packages/github3/repos/deployment.py | Deployment.create_status | def create_status(self, state, target_url='', description=''):
"""Create a new deployment status for this deployment.
:param str state: (required), The state of the status. Can be one of
``pending``, ``success``, ``error``, or ``failure``.
:param str target_url: The target URL to associate with this status.
This URL should contain output to keep the user updated while the
task is running or serve as historical information for what
happened in the deployment. Default: ''.
:param str description: A short description of the status. Default: ''.
:return: partial :class:`DeploymentStatus <DeploymentStatus>`
"""
json = None
if state in ('pending', 'success', 'error', 'failure'):
data = {'state': state, 'target_url': target_url,
'description': description}
response = self._post(self.statuses_url, data=data,
headers=Deployment.CUSTOM_HEADERS)
json = self._json(response, 201)
return DeploymentStatus(json, self) if json else None | python | def create_status(self, state, target_url='', description=''):
"""Create a new deployment status for this deployment.
:param str state: (required), The state of the status. Can be one of
``pending``, ``success``, ``error``, or ``failure``.
:param str target_url: The target URL to associate with this status.
This URL should contain output to keep the user updated while the
task is running or serve as historical information for what
happened in the deployment. Default: ''.
:param str description: A short description of the status. Default: ''.
:return: partial :class:`DeploymentStatus <DeploymentStatus>`
"""
json = None
if state in ('pending', 'success', 'error', 'failure'):
data = {'state': state, 'target_url': target_url,
'description': description}
response = self._post(self.statuses_url, data=data,
headers=Deployment.CUSTOM_HEADERS)
json = self._json(response, 201)
return DeploymentStatus(json, self) if json else None | [
"def",
"create_status",
"(",
"self",
",",
"state",
",",
"target_url",
"=",
"''",
",",
"description",
"=",
"''",
")",
":",
"json",
"=",
"None",
"if",
"state",
"in",
"(",
"'pending'",
",",
"'success'",
",",
"'error'",
",",
"'failure'",
")",
":",
"data",
"=",
"{",
"'state'",
":",
"state",
",",
"'target_url'",
":",
"target_url",
",",
"'description'",
":",
"description",
"}",
"response",
"=",
"self",
".",
"_post",
"(",
"self",
".",
"statuses_url",
",",
"data",
"=",
"data",
",",
"headers",
"=",
"Deployment",
".",
"CUSTOM_HEADERS",
")",
"json",
"=",
"self",
".",
"_json",
"(",
"response",
",",
"201",
")",
"return",
"DeploymentStatus",
"(",
"json",
",",
"self",
")",
"if",
"json",
"else",
"None"
] | Create a new deployment status for this deployment.
:param str state: (required), The state of the status. Can be one of
``pending``, ``success``, ``error``, or ``failure``.
:param str target_url: The target URL to associate with this status.
This URL should contain output to keep the user updated while the
task is running or serve as historical information for what
happened in the deployment. Default: ''.
:param str description: A short description of the status. Default: ''.
:return: partial :class:`DeploymentStatus <DeploymentStatus>` | [
"Create",
"a",
"new",
"deployment",
"status",
"for",
"this",
"deployment",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/deployment.py#L53-L74 | train |
kislyuk/aegea | aegea/packages/github3/repos/deployment.py | Deployment.iter_statuses | def iter_statuses(self, number=-1, etag=None):
"""Iterate over the deployment statuses for this deployment.
:param int number: (optional), the number of statuses to return.
Default: -1, returns all statuses.
:param str etag: (optional), the ETag header value from the last time
you iterated over the statuses.
:returns: generator of :class:`DeploymentStatus`\ es
"""
i = self._iter(int(number), self.statuses_url, DeploymentStatus,
etag=etag)
i.headers = Deployment.CUSTOM_HEADERS
return i | python | def iter_statuses(self, number=-1, etag=None):
"""Iterate over the deployment statuses for this deployment.
:param int number: (optional), the number of statuses to return.
Default: -1, returns all statuses.
:param str etag: (optional), the ETag header value from the last time
you iterated over the statuses.
:returns: generator of :class:`DeploymentStatus`\ es
"""
i = self._iter(int(number), self.statuses_url, DeploymentStatus,
etag=etag)
i.headers = Deployment.CUSTOM_HEADERS
return i | [
"def",
"iter_statuses",
"(",
"self",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"i",
"=",
"self",
".",
"_iter",
"(",
"int",
"(",
"number",
")",
",",
"self",
".",
"statuses_url",
",",
"DeploymentStatus",
",",
"etag",
"=",
"etag",
")",
"i",
".",
"headers",
"=",
"Deployment",
".",
"CUSTOM_HEADERS",
"return",
"i"
] | Iterate over the deployment statuses for this deployment.
:param int number: (optional), the number of statuses to return.
Default: -1, returns all statuses.
:param str etag: (optional), the ETag header value from the last time
you iterated over the statuses.
:returns: generator of :class:`DeploymentStatus`\ es | [
"Iterate",
"over",
"the",
"deployment",
"statuses",
"for",
"this",
"deployment",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/deployment.py#L76-L88 | train |
kislyuk/aegea | aegea/packages/github3/gists/history.py | GistHistory.get_gist | def get_gist(self):
"""Retrieve the gist at this version.
:returns: :class:`Gist <github3.gists.gist.Gist>`
"""
from .gist import Gist
json = self._json(self._get(self._api), 200)
return Gist(json, self) | python | def get_gist(self):
"""Retrieve the gist at this version.
:returns: :class:`Gist <github3.gists.gist.Gist>`
"""
from .gist import Gist
json = self._json(self._get(self._api), 200)
return Gist(json, self) | [
"def",
"get_gist",
"(",
"self",
")",
":",
"from",
".",
"gist",
"import",
"Gist",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_get",
"(",
"self",
".",
"_api",
")",
",",
"200",
")",
"return",
"Gist",
"(",
"json",
",",
"self",
")"
] | Retrieve the gist at this version.
:returns: :class:`Gist <github3.gists.gist.Gist>` | [
"Retrieve",
"the",
"gist",
"at",
"this",
"version",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/gists/history.py#L60-L68 | train |
kislyuk/aegea | aegea/packages/github3/git.py | Reference.update | def update(self, sha, force=False):
"""Update this reference.
:param str sha: (required), sha of the reference
:param bool force: (optional), force the update or not
:returns: bool
"""
data = {'sha': sha, 'force': force}
json = self._json(self._patch(self._api, data=dumps(data)), 200)
if json:
self._update_(json)
return True
return False | python | def update(self, sha, force=False):
"""Update this reference.
:param str sha: (required), sha of the reference
:param bool force: (optional), force the update or not
:returns: bool
"""
data = {'sha': sha, 'force': force}
json = self._json(self._patch(self._api, data=dumps(data)), 200)
if json:
self._update_(json)
return True
return False | [
"def",
"update",
"(",
"self",
",",
"sha",
",",
"force",
"=",
"False",
")",
":",
"data",
"=",
"{",
"'sha'",
":",
"sha",
",",
"'force'",
":",
"force",
"}",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_patch",
"(",
"self",
".",
"_api",
",",
"data",
"=",
"dumps",
"(",
"data",
")",
")",
",",
"200",
")",
"if",
"json",
":",
"self",
".",
"_update_",
"(",
"json",
")",
"return",
"True",
"return",
"False"
] | Update this reference.
:param str sha: (required), sha of the reference
:param bool force: (optional), force the update or not
:returns: bool | [
"Update",
"this",
"reference",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/git.py#L148-L161 | train |
kislyuk/aegea | aegea/packages/github3/git.py | Tree.recurse | def recurse(self):
"""Recurse into the tree.
:returns: :class:`Tree <Tree>`
"""
json = self._json(self._get(self._api, params={'recursive': '1'}),
200)
return Tree(json, self._session) if json else None | python | def recurse(self):
"""Recurse into the tree.
:returns: :class:`Tree <Tree>`
"""
json = self._json(self._get(self._api, params={'recursive': '1'}),
200)
return Tree(json, self._session) if json else None | [
"def",
"recurse",
"(",
"self",
")",
":",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_get",
"(",
"self",
".",
"_api",
",",
"params",
"=",
"{",
"'recursive'",
":",
"'1'",
"}",
")",
",",
"200",
")",
"return",
"Tree",
"(",
"json",
",",
"self",
".",
"_session",
")",
"if",
"json",
"else",
"None"
] | Recurse into the tree.
:returns: :class:`Tree <Tree>` | [
"Recurse",
"into",
"the",
"tree",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/git.py#L216-L223 | train |
kislyuk/aegea | aegea/util/printing.py | format_table | def format_table(table, column_names=None, column_specs=None, max_col_width=32, auto_col_width=False):
"""
Table pretty printer. Expects tables to be given as arrays of arrays::
print(format_table([[1, "2"], [3, "456"]], column_names=['A', 'B']))
"""
orig_col_args = dict(column_names=column_names, column_specs=column_specs)
if len(table) > 0:
col_widths = [0] * len(table[0])
elif column_specs is not None:
col_widths = [0] * (len(column_specs) + 1)
elif column_names is not None:
col_widths = [0] * len(column_names)
my_col_names, id_column = [], None
if column_specs is not None:
column_names = ["Row"]
column_names.extend([col["name"] for col in column_specs])
column_specs = [{"name": "Row", "type": "float"}] + column_specs
if column_names is not None:
for i in range(len(column_names)):
if column_names[i].lower() == "id":
id_column = i
my_col = ansi_truncate(str(column_names[i]), max_col_width if i not in {0, id_column} else 99)
my_col_names.append(my_col)
col_widths[i] = max(col_widths[i], len(strip_ansi_codes(my_col)))
trunc_table = []
for row in table:
my_row = []
for i in range(len(row)):
my_item = ansi_truncate(str(row[i]), max_col_width if i not in {0, id_column} else 99)
my_row.append(my_item)
col_widths[i] = max(col_widths[i], len(strip_ansi_codes(my_item)))
trunc_table.append(my_row)
type_colormap = {"boolean": BLUE(),
"integer": YELLOW(),
"float": WHITE(),
"string": GREEN()}
for i in "uint8", "int16", "uint16", "int32", "uint32", "int64":
type_colormap[i] = type_colormap["integer"]
type_colormap["double"] = type_colormap["float"]
def col_head(i):
if column_specs is not None:
return BOLD() + type_colormap[column_specs[i]["type"]] + column_names[i] + ENDC()
else:
return BOLD() + WHITE() + column_names[i] + ENDC()
formatted_table = [border("┌") + border("┬").join(border("─") * i for i in col_widths) + border("┐")]
if len(my_col_names) > 0:
padded_column_names = [col_head(i) + " " * (col_widths[i] - len(my_col_names[i]))
for i in range(len(my_col_names))]
formatted_table.append(border("│") + border("│").join(padded_column_names) + border("│"))
formatted_table.append(border("├") + border("┼").join(border("─") * i for i in col_widths) + border("┤"))
for row in trunc_table:
padded_row = [row[i] + " " * (col_widths[i] - len(strip_ansi_codes(row[i]))) for i in range(len(row))]
formatted_table.append(border("│") + border("│").join(padded_row) + border("│"))
formatted_table.append(border("└") + border("┴").join(border("─") * i for i in col_widths) + border("┘"))
if auto_col_width:
if not sys.stdout.isatty():
raise AegeaException("Cannot auto-format table, output is not a terminal")
table_width = len(strip_ansi_codes(formatted_table[0]))
tty_cols, tty_rows = get_terminal_size()
if table_width > max(tty_cols, 80):
return format_table(table, max_col_width=max_col_width - 1, auto_col_width=True, **orig_col_args)
return "\n".join(formatted_table) | python | def format_table(table, column_names=None, column_specs=None, max_col_width=32, auto_col_width=False):
"""
Table pretty printer. Expects tables to be given as arrays of arrays::
print(format_table([[1, "2"], [3, "456"]], column_names=['A', 'B']))
"""
orig_col_args = dict(column_names=column_names, column_specs=column_specs)
if len(table) > 0:
col_widths = [0] * len(table[0])
elif column_specs is not None:
col_widths = [0] * (len(column_specs) + 1)
elif column_names is not None:
col_widths = [0] * len(column_names)
my_col_names, id_column = [], None
if column_specs is not None:
column_names = ["Row"]
column_names.extend([col["name"] for col in column_specs])
column_specs = [{"name": "Row", "type": "float"}] + column_specs
if column_names is not None:
for i in range(len(column_names)):
if column_names[i].lower() == "id":
id_column = i
my_col = ansi_truncate(str(column_names[i]), max_col_width if i not in {0, id_column} else 99)
my_col_names.append(my_col)
col_widths[i] = max(col_widths[i], len(strip_ansi_codes(my_col)))
trunc_table = []
for row in table:
my_row = []
for i in range(len(row)):
my_item = ansi_truncate(str(row[i]), max_col_width if i not in {0, id_column} else 99)
my_row.append(my_item)
col_widths[i] = max(col_widths[i], len(strip_ansi_codes(my_item)))
trunc_table.append(my_row)
type_colormap = {"boolean": BLUE(),
"integer": YELLOW(),
"float": WHITE(),
"string": GREEN()}
for i in "uint8", "int16", "uint16", "int32", "uint32", "int64":
type_colormap[i] = type_colormap["integer"]
type_colormap["double"] = type_colormap["float"]
def col_head(i):
if column_specs is not None:
return BOLD() + type_colormap[column_specs[i]["type"]] + column_names[i] + ENDC()
else:
return BOLD() + WHITE() + column_names[i] + ENDC()
formatted_table = [border("┌") + border("┬").join(border("─") * i for i in col_widths) + border("┐")]
if len(my_col_names) > 0:
padded_column_names = [col_head(i) + " " * (col_widths[i] - len(my_col_names[i]))
for i in range(len(my_col_names))]
formatted_table.append(border("│") + border("│").join(padded_column_names) + border("│"))
formatted_table.append(border("├") + border("┼").join(border("─") * i for i in col_widths) + border("┤"))
for row in trunc_table:
padded_row = [row[i] + " " * (col_widths[i] - len(strip_ansi_codes(row[i]))) for i in range(len(row))]
formatted_table.append(border("│") + border("│").join(padded_row) + border("│"))
formatted_table.append(border("└") + border("┴").join(border("─") * i for i in col_widths) + border("┘"))
if auto_col_width:
if not sys.stdout.isatty():
raise AegeaException("Cannot auto-format table, output is not a terminal")
table_width = len(strip_ansi_codes(formatted_table[0]))
tty_cols, tty_rows = get_terminal_size()
if table_width > max(tty_cols, 80):
return format_table(table, max_col_width=max_col_width - 1, auto_col_width=True, **orig_col_args)
return "\n".join(formatted_table) | [
"def",
"format_table",
"(",
"table",
",",
"column_names",
"=",
"None",
",",
"column_specs",
"=",
"None",
",",
"max_col_width",
"=",
"32",
",",
"auto_col_width",
"=",
"False",
")",
":",
"orig_col_args",
"=",
"dict",
"(",
"column_names",
"=",
"column_names",
",",
"column_specs",
"=",
"column_specs",
")",
"if",
"len",
"(",
"table",
")",
">",
"0",
":",
"col_widths",
"=",
"[",
"0",
"]",
"*",
"len",
"(",
"table",
"[",
"0",
"]",
")",
"elif",
"column_specs",
"is",
"not",
"None",
":",
"col_widths",
"=",
"[",
"0",
"]",
"*",
"(",
"len",
"(",
"column_specs",
")",
"+",
"1",
")",
"elif",
"column_names",
"is",
"not",
"None",
":",
"col_widths",
"=",
"[",
"0",
"]",
"*",
"len",
"(",
"column_names",
")",
"my_col_names",
",",
"id_column",
"=",
"[",
"]",
",",
"None",
"if",
"column_specs",
"is",
"not",
"None",
":",
"column_names",
"=",
"[",
"\"Row\"",
"]",
"column_names",
".",
"extend",
"(",
"[",
"col",
"[",
"\"name\"",
"]",
"for",
"col",
"in",
"column_specs",
"]",
")",
"column_specs",
"=",
"[",
"{",
"\"name\"",
":",
"\"Row\"",
",",
"\"type\"",
":",
"\"float\"",
"}",
"]",
"+",
"column_specs",
"if",
"column_names",
"is",
"not",
"None",
":",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"column_names",
")",
")",
":",
"if",
"column_names",
"[",
"i",
"]",
".",
"lower",
"(",
")",
"==",
"\"id\"",
":",
"id_column",
"=",
"i",
"my_col",
"=",
"ansi_truncate",
"(",
"str",
"(",
"column_names",
"[",
"i",
"]",
")",
",",
"max_col_width",
"if",
"i",
"not",
"in",
"{",
"0",
",",
"id_column",
"}",
"else",
"99",
")",
"my_col_names",
".",
"append",
"(",
"my_col",
")",
"col_widths",
"[",
"i",
"]",
"=",
"max",
"(",
"col_widths",
"[",
"i",
"]",
",",
"len",
"(",
"strip_ansi_codes",
"(",
"my_col",
")",
")",
")",
"trunc_table",
"=",
"[",
"]",
"for",
"row",
"in",
"table",
":",
"my_row",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"row",
")",
")",
":",
"my_item",
"=",
"ansi_truncate",
"(",
"str",
"(",
"row",
"[",
"i",
"]",
")",
",",
"max_col_width",
"if",
"i",
"not",
"in",
"{",
"0",
",",
"id_column",
"}",
"else",
"99",
")",
"my_row",
".",
"append",
"(",
"my_item",
")",
"col_widths",
"[",
"i",
"]",
"=",
"max",
"(",
"col_widths",
"[",
"i",
"]",
",",
"len",
"(",
"strip_ansi_codes",
"(",
"my_item",
")",
")",
")",
"trunc_table",
".",
"append",
"(",
"my_row",
")",
"type_colormap",
"=",
"{",
"\"boolean\"",
":",
"BLUE",
"(",
")",
",",
"\"integer\"",
":",
"YELLOW",
"(",
")",
",",
"\"float\"",
":",
"WHITE",
"(",
")",
",",
"\"string\"",
":",
"GREEN",
"(",
")",
"}",
"for",
"i",
"in",
"\"uint8\"",
",",
"\"int16\"",
",",
"\"uint16\"",
",",
"\"int32\"",
",",
"\"uint32\"",
",",
"\"int64\"",
":",
"type_colormap",
"[",
"i",
"]",
"=",
"type_colormap",
"[",
"\"integer\"",
"]",
"type_colormap",
"[",
"\"double\"",
"]",
"=",
"type_colormap",
"[",
"\"float\"",
"]",
"def",
"col_head",
"(",
"i",
")",
":",
"if",
"column_specs",
"is",
"not",
"None",
":",
"return",
"BOLD",
"(",
")",
"+",
"type_colormap",
"[",
"column_specs",
"[",
"i",
"]",
"[",
"\"type\"",
"]",
"]",
"+",
"column_names",
"[",
"i",
"]",
"+",
"ENDC",
"(",
")",
"else",
":",
"return",
"BOLD",
"(",
")",
"+",
"WHITE",
"(",
")",
"+",
"column_names",
"[",
"i",
"]",
"+",
"ENDC",
"(",
")",
"formatted_table",
"=",
"[",
"border",
"(",
"\"┌\") ",
"+",
"b",
"rder(\"",
"┬",
"\").jo",
"i",
"n",
"(bor",
"d",
"er(\"─\"",
")",
" * i ",
"f",
"r",
"i",
"in ",
"o",
"_w",
"dths) + bo",
"r",
"e",
"(\"┐\")]",
"",
"",
"",
"",
"if",
"len",
"(",
"my_col_names",
")",
">",
"0",
":",
"padded_column_names",
"=",
"[",
"col_head",
"(",
"i",
")",
"+",
"\" \"",
"*",
"(",
"col_widths",
"[",
"i",
"]",
"-",
"len",
"(",
"my_col_names",
"[",
"i",
"]",
")",
")",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"my_col_names",
")",
")",
"]",
"formatted_table",
".",
"append",
"(",
"border",
"(",
"\"│\") ",
"+",
"b",
"rder(\"",
"│",
"\").jo",
"i",
"n",
"(pad",
"d",
"ed_column_names) + ",
"b",
"r",
"er(\"│\"",
")",
")",
"",
"",
"formatted_table",
".",
"append",
"(",
"border",
"(",
"\"├\") ",
"+",
"b",
"rder(\"",
"┼",
"\").jo",
"i",
"n",
"(bor",
"d",
"er(\"─\"",
")",
" * i ",
"f",
"r",
"i",
"in ",
"o",
"_w",
"dths) + bo",
"r",
"e",
"(\"┤\"))",
"",
"",
"",
"",
"for",
"row",
"in",
"trunc_table",
":",
"padded_row",
"=",
"[",
"row",
"[",
"i",
"]",
"+",
"\" \"",
"*",
"(",
"col_widths",
"[",
"i",
"]",
"-",
"len",
"(",
"strip_ansi_codes",
"(",
"row",
"[",
"i",
"]",
")",
")",
")",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"row",
")",
")",
"]",
"formatted_table",
".",
"append",
"(",
"border",
"(",
"\"│\") ",
"+",
"b",
"rder(\"",
"│",
"\").jo",
"i",
"n",
"(pad",
"d",
"ed_row) + ",
"b",
"r",
"er(\"│\"",
")",
")",
"",
"",
"formatted_table",
".",
"append",
"(",
"border",
"(",
"\"└\") ",
"+",
"b",
"rder(\"",
"┴",
"\").jo",
"i",
"n",
"(bor",
"d",
"er(\"─\"",
")",
" * i ",
"f",
"r",
"i",
"in ",
"o",
"_w",
"dths) + bo",
"r",
"e",
"(\"┘\"))",
"",
"",
"",
"",
"if",
"auto_col_width",
":",
"if",
"not",
"sys",
".",
"stdout",
".",
"isatty",
"(",
")",
":",
"raise",
"AegeaException",
"(",
"\"Cannot auto-format table, output is not a terminal\"",
")",
"table_width",
"=",
"len",
"(",
"strip_ansi_codes",
"(",
"formatted_table",
"[",
"0",
"]",
")",
")",
"tty_cols",
",",
"tty_rows",
"=",
"get_terminal_size",
"(",
")",
"if",
"table_width",
">",
"max",
"(",
"tty_cols",
",",
"80",
")",
":",
"return",
"format_table",
"(",
"table",
",",
"max_col_width",
"=",
"max_col_width",
"-",
"1",
",",
"auto_col_width",
"=",
"True",
",",
"*",
"*",
"orig_col_args",
")",
"return",
"\"\\n\"",
".",
"join",
"(",
"formatted_table",
")"
] | Table pretty printer. Expects tables to be given as arrays of arrays::
print(format_table([[1, "2"], [3, "456"]], column_names=['A', 'B'])) | [
"Table",
"pretty",
"printer",
".",
"Expects",
"tables",
"to",
"be",
"given",
"as",
"arrays",
"of",
"arrays",
"::"
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/util/printing.py#L81-L148 | train |
kislyuk/aegea | aegea/aegea_config.py | get | def get(args):
"""Get an Aegea configuration parameter by name"""
from . import config
for key in args.key.split("."):
config = getattr(config, key)
print(json.dumps(config)) | python | def get(args):
"""Get an Aegea configuration parameter by name"""
from . import config
for key in args.key.split("."):
config = getattr(config, key)
print(json.dumps(config)) | [
"def",
"get",
"(",
"args",
")",
":",
"from",
".",
"import",
"config",
"for",
"key",
"in",
"args",
".",
"key",
".",
"split",
"(",
"\".\"",
")",
":",
"config",
"=",
"getattr",
"(",
"config",
",",
"key",
")",
"print",
"(",
"json",
".",
"dumps",
"(",
"config",
")",
")"
] | Get an Aegea configuration parameter by name | [
"Get",
"an",
"Aegea",
"configuration",
"parameter",
"by",
"name"
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/aegea_config.py#L37-L42 | train |
kislyuk/aegea | aegea/aegea_config.py | set | def set(args):
"""Set an Aegea configuration parameter to a given value"""
from . import config, tweak
class ConfigSaver(tweak.Config):
@property
def config_files(self):
return [config.config_files[2]]
config_saver = ConfigSaver(use_yaml=True, save_on_exit=False)
c = config_saver
for key in args.key.split(".")[:-1]:
try:
c = c[key]
except KeyError:
c[key] = {}
c = c[key]
c[args.key.split(".")[-1]] = json.loads(args.value) if args.json else args.value
config_saver.save() | python | def set(args):
"""Set an Aegea configuration parameter to a given value"""
from . import config, tweak
class ConfigSaver(tweak.Config):
@property
def config_files(self):
return [config.config_files[2]]
config_saver = ConfigSaver(use_yaml=True, save_on_exit=False)
c = config_saver
for key in args.key.split(".")[:-1]:
try:
c = c[key]
except KeyError:
c[key] = {}
c = c[key]
c[args.key.split(".")[-1]] = json.loads(args.value) if args.json else args.value
config_saver.save() | [
"def",
"set",
"(",
"args",
")",
":",
"from",
".",
"import",
"config",
",",
"tweak",
"class",
"ConfigSaver",
"(",
"tweak",
".",
"Config",
")",
":",
"@",
"property",
"def",
"config_files",
"(",
"self",
")",
":",
"return",
"[",
"config",
".",
"config_files",
"[",
"2",
"]",
"]",
"config_saver",
"=",
"ConfigSaver",
"(",
"use_yaml",
"=",
"True",
",",
"save_on_exit",
"=",
"False",
")",
"c",
"=",
"config_saver",
"for",
"key",
"in",
"args",
".",
"key",
".",
"split",
"(",
"\".\"",
")",
"[",
":",
"-",
"1",
"]",
":",
"try",
":",
"c",
"=",
"c",
"[",
"key",
"]",
"except",
"KeyError",
":",
"c",
"[",
"key",
"]",
"=",
"{",
"}",
"c",
"=",
"c",
"[",
"key",
"]",
"c",
"[",
"args",
".",
"key",
".",
"split",
"(",
"\".\"",
")",
"[",
"-",
"1",
"]",
"]",
"=",
"json",
".",
"loads",
"(",
"args",
".",
"value",
")",
"if",
"args",
".",
"json",
"else",
"args",
".",
"value",
"config_saver",
".",
"save",
"(",
")"
] | Set an Aegea configuration parameter to a given value | [
"Set",
"an",
"Aegea",
"configuration",
"parameter",
"to",
"a",
"given",
"value"
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/aegea_config.py#L47-L65 | train |
kislyuk/aegea | aegea/packages/github3/api.py | authorize | def authorize(login, password, scopes, note='', note_url='', client_id='',
client_secret='', two_factor_callback=None):
"""Obtain an authorization token for the GitHub API.
:param str login: (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.
:returns: :class:`Authorization <Authorization>`
"""
gh = GitHub()
gh.login(two_factor_callback=two_factor_callback)
return gh.authorize(login, password, scopes, note, note_url, client_id,
client_secret) | python | def authorize(login, password, scopes, note='', note_url='', client_id='',
client_secret='', two_factor_callback=None):
"""Obtain an authorization token for the GitHub API.
:param str login: (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.
:returns: :class:`Authorization <Authorization>`
"""
gh = GitHub()
gh.login(two_factor_callback=two_factor_callback)
return gh.authorize(login, password, scopes, note, note_url, client_id,
client_secret) | [
"def",
"authorize",
"(",
"login",
",",
"password",
",",
"scopes",
",",
"note",
"=",
"''",
",",
"note_url",
"=",
"''",
",",
"client_id",
"=",
"''",
",",
"client_secret",
"=",
"''",
",",
"two_factor_callback",
"=",
"None",
")",
":",
"gh",
"=",
"GitHub",
"(",
")",
"gh",
".",
"login",
"(",
"two_factor_callback",
"=",
"two_factor_callback",
")",
"return",
"gh",
".",
"authorize",
"(",
"login",
",",
"password",
",",
"scopes",
",",
"note",
",",
"note_url",
",",
"client_id",
",",
"client_secret",
")"
] | Obtain an authorization token for the GitHub API.
:param str login: (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.
:returns: :class:`Authorization <Authorization>` | [
"Obtain",
"an",
"authorization",
"token",
"for",
"the",
"GitHub",
"API",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/api.py#L16-L38 | train |
kislyuk/aegea | aegea/packages/github3/api.py | login | def login(username=None, password=None, token=None, url=None,
two_factor_callback=None):
"""Construct and return an authenticated GitHub session.
This will return a GitHubEnterprise session if a url is provided.
:param str username: login name
:param str password: password for the login
:param str token: OAuth token
:param str url: (optional), URL of a GitHub Enterprise instance
:param func two_factor_callback: (optional), function you implement to
provide the Two Factor Authentication code to GitHub when necessary
:returns: :class:`GitHub <github3.github.GitHub>`
"""
g = None
if (username and password) or token:
g = GitHubEnterprise(url) if url is not None else GitHub()
g.login(username, password, token, two_factor_callback)
return g | python | def login(username=None, password=None, token=None, url=None,
two_factor_callback=None):
"""Construct and return an authenticated GitHub session.
This will return a GitHubEnterprise session if a url is provided.
:param str username: login name
:param str password: password for the login
:param str token: OAuth token
:param str url: (optional), URL of a GitHub Enterprise instance
:param func two_factor_callback: (optional), function you implement to
provide the Two Factor Authentication code to GitHub when necessary
:returns: :class:`GitHub <github3.github.GitHub>`
"""
g = None
if (username and password) or token:
g = GitHubEnterprise(url) if url is not None else GitHub()
g.login(username, password, token, two_factor_callback)
return g | [
"def",
"login",
"(",
"username",
"=",
"None",
",",
"password",
"=",
"None",
",",
"token",
"=",
"None",
",",
"url",
"=",
"None",
",",
"two_factor_callback",
"=",
"None",
")",
":",
"g",
"=",
"None",
"if",
"(",
"username",
"and",
"password",
")",
"or",
"token",
":",
"g",
"=",
"GitHubEnterprise",
"(",
"url",
")",
"if",
"url",
"is",
"not",
"None",
"else",
"GitHub",
"(",
")",
"g",
".",
"login",
"(",
"username",
",",
"password",
",",
"token",
",",
"two_factor_callback",
")",
"return",
"g"
] | Construct and return an authenticated GitHub session.
This will return a GitHubEnterprise session if a url is provided.
:param str username: login name
:param str password: password for the login
:param str token: OAuth token
:param str url: (optional), URL of a GitHub Enterprise instance
:param func two_factor_callback: (optional), function you implement to
provide the Two Factor Authentication code to GitHub when necessary
:returns: :class:`GitHub <github3.github.GitHub>` | [
"Construct",
"and",
"return",
"an",
"authenticated",
"GitHub",
"session",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/api.py#L41-L62 | train |
kislyuk/aegea | aegea/packages/github3/api.py | iter_followers | def iter_followers(username, number=-1, etag=None):
"""List the followers of ``username``.
: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 <github3.users.User>`
"""
return gh.iter_followers(username, number, etag) if username else [] | python | def iter_followers(username, number=-1, etag=None):
"""List the followers of ``username``.
: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 <github3.users.User>`
"""
return gh.iter_followers(username, number, etag) if username else [] | [
"def",
"iter_followers",
"(",
"username",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"return",
"gh",
".",
"iter_followers",
"(",
"username",
",",
"number",
",",
"etag",
")",
"if",
"username",
"else",
"[",
"]"
] | List the followers of ``username``.
: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 <github3.users.User>` | [
"List",
"the",
"followers",
"of",
"username",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/api.py#L137-L149 | train |
kislyuk/aegea | aegea/packages/github3/api.py | iter_following | def iter_following(username, number=-1, etag=None):
"""List the people ``username`` follows.
: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 <github3.users.User>`
"""
return gh.iter_following(username, number, etag) if username else [] | python | def iter_following(username, number=-1, etag=None):
"""List the people ``username`` follows.
: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 <github3.users.User>`
"""
return gh.iter_following(username, number, etag) if username else [] | [
"def",
"iter_following",
"(",
"username",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"return",
"gh",
".",
"iter_following",
"(",
"username",
",",
"number",
",",
"etag",
")",
"if",
"username",
"else",
"[",
"]"
] | List the people ``username`` follows.
: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 <github3.users.User>` | [
"List",
"the",
"people",
"username",
"follows",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/api.py#L152-L163 | train |
kislyuk/aegea | aegea/packages/github3/api.py | iter_repo_issues | def iter_repo_issues(owner, repository, milestone=None, state=None,
assignee=None, mentioned=None, labels=None, sort=None,
direction=None, since=None, number=-1, etag=None):
"""List issues on owner/repository. Only owner and repository are
required.
.. 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:`Issue <github3.issues.Issue>`\ s
"""
if owner and repository:
return gh.iter_repo_issues(owner, repository, milestone, state,
assignee, mentioned, labels, sort,
direction, since, number, etag)
return iter([]) | python | def iter_repo_issues(owner, repository, milestone=None, state=None,
assignee=None, mentioned=None, labels=None, sort=None,
direction=None, since=None, number=-1, etag=None):
"""List issues on owner/repository. Only owner and repository are
required.
.. 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:`Issue <github3.issues.Issue>`\ s
"""
if owner and repository:
return gh.iter_repo_issues(owner, repository, milestone, state,
assignee, mentioned, labels, sort,
direction, since, number, etag)
return iter([]) | [
"def",
"iter_repo_issues",
"(",
"owner",
",",
"repository",
",",
"milestone",
"=",
"None",
",",
"state",
"=",
"None",
",",
"assignee",
"=",
"None",
",",
"mentioned",
"=",
"None",
",",
"labels",
"=",
"None",
",",
"sort",
"=",
"None",
",",
"direction",
"=",
"None",
",",
"since",
"=",
"None",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"if",
"owner",
"and",
"repository",
":",
"return",
"gh",
".",
"iter_repo_issues",
"(",
"owner",
",",
"repository",
",",
"milestone",
",",
"state",
",",
"assignee",
",",
"mentioned",
",",
"labels",
",",
"sort",
",",
"direction",
",",
"since",
",",
"number",
",",
"etag",
")",
"return",
"iter",
"(",
"[",
"]",
")"
] | List issues on owner/repository. Only owner and repository are
required.
.. 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:`Issue <github3.issues.Issue>`\ s | [
"List",
"issues",
"on",
"owner",
"/",
"repository",
".",
"Only",
"owner",
"and",
"repository",
"are",
"required",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/api.py#L181-L220 | train |
kislyuk/aegea | aegea/packages/github3/api.py | iter_orgs | def iter_orgs(username, number=-1, etag=None):
"""List the organizations associated with ``username``.
: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:`Organization <github3.orgs.Organization>`
"""
return gh.iter_orgs(username, number, etag) if username else [] | python | def iter_orgs(username, number=-1, etag=None):
"""List the organizations associated with ``username``.
: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:`Organization <github3.orgs.Organization>`
"""
return gh.iter_orgs(username, number, etag) if username else [] | [
"def",
"iter_orgs",
"(",
"username",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"return",
"gh",
".",
"iter_orgs",
"(",
"username",
",",
"number",
",",
"etag",
")",
"if",
"username",
"else",
"[",
"]"
] | List the organizations associated with ``username``.
: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:`Organization <github3.orgs.Organization>` | [
"List",
"the",
"organizations",
"associated",
"with",
"username",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/api.py#L223-L235 | train |
kislyuk/aegea | aegea/packages/github3/api.py | iter_user_repos | def iter_user_repos(login, type=None, sort=None, direction=None, number=-1,
etag=None):
"""List public repositories for the specified ``login``.
.. versionadded:: 0.6
.. note:: This replaces github3.iter_repos
:param str login: (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 <github3.repos.Repository>`
objects
"""
if login:
return gh.iter_user_repos(login, type, sort, direction, number, etag)
return iter([]) | python | def iter_user_repos(login, type=None, sort=None, direction=None, number=-1,
etag=None):
"""List public repositories for the specified ``login``.
.. versionadded:: 0.6
.. note:: This replaces github3.iter_repos
:param str login: (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 <github3.repos.Repository>`
objects
"""
if login:
return gh.iter_user_repos(login, type, sort, direction, number, etag)
return iter([]) | [
"def",
"iter_user_repos",
"(",
"login",
",",
"type",
"=",
"None",
",",
"sort",
"=",
"None",
",",
"direction",
"=",
"None",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"if",
"login",
":",
"return",
"gh",
".",
"iter_user_repos",
"(",
"login",
",",
"type",
",",
"sort",
",",
"direction",
",",
"number",
",",
"etag",
")",
"return",
"iter",
"(",
"[",
"]",
")"
] | List public repositories for the specified ``login``.
.. versionadded:: 0.6
.. note:: This replaces github3.iter_repos
:param str login: (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 <github3.repos.Repository>`
objects | [
"List",
"public",
"repositories",
"for",
"the",
"specified",
"login",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/api.py#L238-L266 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.