repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
listlengths
20
707
docstring
stringlengths
3
17.3k
docstring_tokens
listlengths
3
222
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
idx
int64
0
252k
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.editproject
def editproject(self, project_id, **kwargs): """ Edit an existing project. :param name: new project name :param path: custom repository name for new project. By default generated based on name :param default_branch: they default branch :param description: short project d...
python
def editproject(self, project_id, **kwargs): """ Edit an existing project. :param name: new project name :param path: custom repository name for new project. By default generated based on name :param default_branch: they default branch :param description: short project d...
[ "def", "editproject", "(", "self", ",", "project_id", ",", "*", "*", "kwargs", ")", ":", "data", "=", "{", "\"id\"", ":", "project_id", "}", "if", "kwargs", ":", "data", ".", "update", "(", "kwargs", ")", "request", "=", "requests", ".", "put", "(", ...
Edit an existing project. :param name: new project name :param path: custom repository name for new project. By default generated based on name :param default_branch: they default branch :param description: short project description :param issues_enabled: :param merge_re...
[ "Edit", "an", "existing", "project", "." ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L137-L169
train
59,000
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.shareproject
def shareproject(self, project_id, group_id, group_access): """ Allow to share project with group. :param project_id: The ID of a project :param group_id: The ID of a group :param group_access: Level of permissions for sharing :return: True is success """ ...
python
def shareproject(self, project_id, group_id, group_access): """ Allow to share project with group. :param project_id: The ID of a project :param group_id: The ID of a group :param group_access: Level of permissions for sharing :return: True is success """ ...
[ "def", "shareproject", "(", "self", ",", "project_id", ",", "group_id", ",", "group_access", ")", ":", "data", "=", "{", "'id'", ":", "project_id", ",", "'group_id'", ":", "group_id", ",", "'group_access'", ":", "group_access", "}", "request", "=", "requests...
Allow to share project with group. :param project_id: The ID of a project :param group_id: The ID of a group :param group_access: Level of permissions for sharing :return: True is success
[ "Allow", "to", "share", "project", "with", "group", "." ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L171-L186
train
59,001
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.delete_project
def delete_project(self, id): """ Delete a project from the Gitlab server Gitlab currently returns a Boolean True if the deleted and as such we return an empty Dictionary :param id: The ID of the project or NAMESPACE/PROJECT_NAME :return: Dictionary :raise: Http...
python
def delete_project(self, id): """ Delete a project from the Gitlab server Gitlab currently returns a Boolean True if the deleted and as such we return an empty Dictionary :param id: The ID of the project or NAMESPACE/PROJECT_NAME :return: Dictionary :raise: Http...
[ "def", "delete_project", "(", "self", ",", "id", ")", ":", "url", "=", "'/projects/{id}'", ".", "format", "(", "id", "=", "id", ")", "response", "=", "self", ".", "delete", "(", "url", ")", "if", "response", "is", "True", ":", "return", "{", "}", "...
Delete a project from the Gitlab server Gitlab currently returns a Boolean True if the deleted and as such we return an empty Dictionary :param id: The ID of the project or NAMESPACE/PROJECT_NAME :return: Dictionary :raise: HttpError: If invalid response returned
[ "Delete", "a", "project", "from", "the", "Gitlab", "server" ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L188-L205
train
59,002
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.createprojectuser
def createprojectuser(self, user_id, name, **kwargs): """ Creates a new project owned by the specified user. Available only for admins. :param user_id: user_id of owner :param name: new project name :param description: short project description :param default_branch: 'ma...
python
def createprojectuser(self, user_id, name, **kwargs): """ Creates a new project owned by the specified user. Available only for admins. :param user_id: user_id of owner :param name: new project name :param description: short project description :param default_branch: 'ma...
[ "def", "createprojectuser", "(", "self", ",", "user_id", ",", "name", ",", "*", "*", "kwargs", ")", ":", "data", "=", "{", "'name'", ":", "name", "}", "if", "kwargs", ":", "data", ".", "update", "(", "kwargs", ")", "request", "=", "requests", ".", ...
Creates a new project owned by the specified user. Available only for admins. :param user_id: user_id of owner :param name: new project name :param description: short project description :param default_branch: 'master' by default :param issues_enabled: :param merge_reque...
[ "Creates", "a", "new", "project", "owned", "by", "the", "specified", "user", ".", "Available", "only", "for", "admins", "." ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L221-L252
train
59,003
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.deleteprojectmember
def deleteprojectmember(self, project_id, user_id): """Delete a project member :param project_id: project id :param user_id: user id :return: always true """ request = requests.delete( '{0}/{1}/members/{2}'.format(self.projects_url, project_id, user_id), ...
python
def deleteprojectmember(self, project_id, user_id): """Delete a project member :param project_id: project id :param user_id: user id :return: always true """ request = requests.delete( '{0}/{1}/members/{2}'.format(self.projects_url, project_id, user_id), ...
[ "def", "deleteprojectmember", "(", "self", ",", "project_id", ",", "user_id", ")", ":", "request", "=", "requests", ".", "delete", "(", "'{0}/{1}/members/{2}'", ".", "format", "(", "self", ".", "projects_url", ",", "project_id", ",", "user_id", ")", ",", "he...
Delete a project member :param project_id: project id :param user_id: user id :return: always true
[ "Delete", "a", "project", "member" ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L334-L346
train
59,004
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.addprojecthook
def addprojecthook(self, project_id, url, push=False, issues=False, merge_requests=False, tag_push=False): """ add a hook to a project :param project_id: project id :param url: url of the hook :return: True if success """ data = { 'id': project_id, ...
python
def addprojecthook(self, project_id, url, push=False, issues=False, merge_requests=False, tag_push=False): """ add a hook to a project :param project_id: project id :param url: url of the hook :return: True if success """ data = { 'id': project_id, ...
[ "def", "addprojecthook", "(", "self", ",", "project_id", ",", "url", ",", "push", "=", "False", ",", "issues", "=", "False", ",", "merge_requests", "=", "False", ",", "tag_push", "=", "False", ")", ":", "data", "=", "{", "'id'", ":", "project_id", ",",...
add a hook to a project :param project_id: project id :param url: url of the hook :return: True if success
[ "add", "a", "hook", "to", "a", "project" ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L382-L406
train
59,005
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.editprojecthook
def editprojecthook(self, project_id, hook_id, url, push=False, issues=False, merge_requests=False, tag_push=False): """ edit an existing hook from a project :param id_: project id :param hook_id: hook id :param url: the new url :return: True if success """ ...
python
def editprojecthook(self, project_id, hook_id, url, push=False, issues=False, merge_requests=False, tag_push=False): """ edit an existing hook from a project :param id_: project id :param hook_id: hook id :param url: the new url :return: True if success """ ...
[ "def", "editprojecthook", "(", "self", ",", "project_id", ",", "hook_id", ",", "url", ",", "push", "=", "False", ",", "issues", "=", "False", ",", "merge_requests", "=", "False", ",", "tag_push", "=", "False", ")", ":", "data", "=", "{", "\"id\"", ":",...
edit an existing hook from a project :param id_: project id :param hook_id: hook id :param url: the new url :return: True if success
[ "edit", "an", "existing", "hook", "from", "a", "project" ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L408-L434
train
59,006
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.getsystemhooks
def getsystemhooks(self, page=1, per_page=20): """ Get all system hooks :param page: Page number :param per_page: Records per page :return: list of hooks """ data = {'page': page, 'per_page': per_page} request = requests.get( self.hook_url, p...
python
def getsystemhooks(self, page=1, per_page=20): """ Get all system hooks :param page: Page number :param per_page: Records per page :return: list of hooks """ data = {'page': page, 'per_page': per_page} request = requests.get( self.hook_url, p...
[ "def", "getsystemhooks", "(", "self", ",", "page", "=", "1", ",", "per_page", "=", "20", ")", ":", "data", "=", "{", "'page'", ":", "page", ",", "'per_page'", ":", "per_page", "}", "request", "=", "requests", ".", "get", "(", "self", ".", "hook_url",...
Get all system hooks :param page: Page number :param per_page: Records per page :return: list of hooks
[ "Get", "all", "system", "hooks" ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L453-L470
train
59,007
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.addsystemhook
def addsystemhook(self, url): """ Add a system hook :param url: url of the hook :return: True if success """ data = {"url": url} request = requests.post( self.hook_url, headers=self.headers, data=data, verify=self.verify_ssl, auth=self.au...
python
def addsystemhook(self, url): """ Add a system hook :param url: url of the hook :return: True if success """ data = {"url": url} request = requests.post( self.hook_url, headers=self.headers, data=data, verify=self.verify_ssl, auth=self.au...
[ "def", "addsystemhook", "(", "self", ",", "url", ")", ":", "data", "=", "{", "\"url\"", ":", "url", "}", "request", "=", "requests", ".", "post", "(", "self", ".", "hook_url", ",", "headers", "=", "self", ".", "headers", ",", "data", "=", "data", "...
Add a system hook :param url: url of the hook :return: True if success
[ "Add", "a", "system", "hook" ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L472-L488
train
59,008
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.deletesystemhook
def deletesystemhook(self, hook_id): """ Delete a project hook :param hook_id: hook id :return: True if success """ data = {"id": hook_id} request = requests.delete( '{0}/{1}'.format(self.hook_url, hook_id), data=data, headers=self.header...
python
def deletesystemhook(self, hook_id): """ Delete a project hook :param hook_id: hook id :return: True if success """ data = {"id": hook_id} request = requests.delete( '{0}/{1}'.format(self.hook_url, hook_id), data=data, headers=self.header...
[ "def", "deletesystemhook", "(", "self", ",", "hook_id", ")", ":", "data", "=", "{", "\"id\"", ":", "hook_id", "}", "request", "=", "requests", ".", "delete", "(", "'{0}/{1}'", ".", "format", "(", "self", ".", "hook_url", ",", "hook_id", ")", ",", "data...
Delete a project hook :param hook_id: hook id :return: True if success
[ "Delete", "a", "project", "hook" ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L508-L524
train
59,009
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.createbranch
def createbranch(self, project_id, branch, ref): """ Create branch from commit SHA or existing branch :param project_id: The ID of a project :param branch: The name of the branch :param ref: Create branch from commit SHA or existing branch :return: True if success, Fals...
python
def createbranch(self, project_id, branch, ref): """ Create branch from commit SHA or existing branch :param project_id: The ID of a project :param branch: The name of the branch :param ref: Create branch from commit SHA or existing branch :return: True if success, Fals...
[ "def", "createbranch", "(", "self", ",", "project_id", ",", "branch", ",", "ref", ")", ":", "data", "=", "{", "\"id\"", ":", "project_id", ",", "\"branch_name\"", ":", "branch", ",", "\"ref\"", ":", "ref", "}", "request", "=", "requests", ".", "post", ...
Create branch from commit SHA or existing branch :param project_id: The ID of a project :param branch: The name of the branch :param ref: Create branch from commit SHA or existing branch :return: True if success, False if not
[ "Create", "branch", "from", "commit", "SHA", "or", "existing", "branch" ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L561-L579
train
59,010
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.protectbranch
def protectbranch(self, project_id, branch): """ Protect a branch from changes :param project_id: project id :param branch: branch id :return: True if success """ request = requests.put( '{0}/{1}/repository/branches/{2}/protect'.format(self.projects_u...
python
def protectbranch(self, project_id, branch): """ Protect a branch from changes :param project_id: project id :param branch: branch id :return: True if success """ request = requests.put( '{0}/{1}/repository/branches/{2}/protect'.format(self.projects_u...
[ "def", "protectbranch", "(", "self", ",", "project_id", ",", "branch", ")", ":", "request", "=", "requests", ".", "put", "(", "'{0}/{1}/repository/branches/{2}/protect'", ".", "format", "(", "self", ".", "projects_url", ",", "project_id", ",", "branch", ")", "...
Protect a branch from changes :param project_id: project id :param branch: branch id :return: True if success
[ "Protect", "a", "branch", "from", "changes" ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L599-L614
train
59,011
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.createforkrelation
def createforkrelation(self, project_id, from_project_id): """ Create a fork relation. This DO NOT create a fork but only adds a link as fork the relation between 2 repositories :param project_id: project id :param from_project_id: from id :return: true if success ...
python
def createforkrelation(self, project_id, from_project_id): """ Create a fork relation. This DO NOT create a fork but only adds a link as fork the relation between 2 repositories :param project_id: project id :param from_project_id: from id :return: true if success ...
[ "def", "createforkrelation", "(", "self", ",", "project_id", ",", "from_project_id", ")", ":", "data", "=", "{", "'id'", ":", "project_id", ",", "'forked_from_id'", ":", "from_project_id", "}", "request", "=", "requests", ".", "post", "(", "'{0}/{1}/fork/{2}'", ...
Create a fork relation. This DO NOT create a fork but only adds a link as fork the relation between 2 repositories :param project_id: project id :param from_project_id: from id :return: true if success
[ "Create", "a", "fork", "relation", "." ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L633-L653
train
59,012
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.removeforkrelation
def removeforkrelation(self, project_id): """ Remove an existing fork relation. this DO NOT remove the fork,only the relation between them :param project_id: project id :return: true if success """ request = requests.delete( '{0}/{1}/fork'.format(self.project...
python
def removeforkrelation(self, project_id): """ Remove an existing fork relation. this DO NOT remove the fork,only the relation between them :param project_id: project id :return: true if success """ request = requests.delete( '{0}/{1}/fork'.format(self.project...
[ "def", "removeforkrelation", "(", "self", ",", "project_id", ")", ":", "request", "=", "requests", ".", "delete", "(", "'{0}/{1}/fork'", ".", "format", "(", "self", ".", "projects_url", ",", "project_id", ")", ",", "headers", "=", "self", ".", "headers", "...
Remove an existing fork relation. this DO NOT remove the fork,only the relation between them :param project_id: project id :return: true if success
[ "Remove", "an", "existing", "fork", "relation", ".", "this", "DO", "NOT", "remove", "the", "fork", "only", "the", "relation", "between", "them" ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L655-L670
train
59,013
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.createfork
def createfork(self, project_id): """ Forks a project into the user namespace of the authenticated user. :param project_id: Project ID to fork :return: True if succeed """ request = requests.post( '{0}/fork/{1}'.format(self.projects_url, project_id), ...
python
def createfork(self, project_id): """ Forks a project into the user namespace of the authenticated user. :param project_id: Project ID to fork :return: True if succeed """ request = requests.post( '{0}/fork/{1}'.format(self.projects_url, project_id), ...
[ "def", "createfork", "(", "self", ",", "project_id", ")", ":", "request", "=", "requests", ".", "post", "(", "'{0}/fork/{1}'", ".", "format", "(", "self", ".", "projects_url", ",", "project_id", ")", ",", "timeout", "=", "self", ".", "timeout", ",", "ver...
Forks a project into the user namespace of the authenticated user. :param project_id: Project ID to fork :return: True if succeed
[ "Forks", "a", "project", "into", "the", "user", "namespace", "of", "the", "authenticated", "user", "." ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L672-L687
train
59,014
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.createissue
def createissue(self, project_id, title, **kwargs): """ Create a new issue :param project_id: project id :param title: title of the issue :return: dict with the issue created """ data = {'id': id, 'title': title} if kwargs: data.update(kwargs)...
python
def createissue(self, project_id, title, **kwargs): """ Create a new issue :param project_id: project id :param title: title of the issue :return: dict with the issue created """ data = {'id': id, 'title': title} if kwargs: data.update(kwargs)...
[ "def", "createissue", "(", "self", ",", "project_id", ",", "title", ",", "*", "*", "kwargs", ")", ":", "data", "=", "{", "'id'", ":", "id", ",", "'title'", ":", "title", "}", "if", "kwargs", ":", "data", ".", "update", "(", "kwargs", ")", "request"...
Create a new issue :param project_id: project id :param title: title of the issue :return: dict with the issue created
[ "Create", "a", "new", "issue" ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L748-L766
train
59,015
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.editissue
def editissue(self, project_id, issue_id, **kwargs): """ Edit an existing issue data :param project_id: project id :param issue_id: issue id :return: true if success """ data = {'id': project_id, 'issue_id': issue_id} if kwargs: data.update(kw...
python
def editissue(self, project_id, issue_id, **kwargs): """ Edit an existing issue data :param project_id: project id :param issue_id: issue id :return: true if success """ data = {'id': project_id, 'issue_id': issue_id} if kwargs: data.update(kw...
[ "def", "editissue", "(", "self", ",", "project_id", ",", "issue_id", ",", "*", "*", "kwargs", ")", ":", "data", "=", "{", "'id'", ":", "project_id", ",", "'issue_id'", ":", "issue_id", "}", "if", "kwargs", ":", "data", ".", "update", "(", "kwargs", "...
Edit an existing issue data :param project_id: project id :param issue_id: issue id :return: true if success
[ "Edit", "an", "existing", "issue", "data" ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L768-L786
train
59,016
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.enable_deploy_key
def enable_deploy_key(self, project, key_id): """ Enables a deploy key for a project. >>> gitlab = Gitlab(host='http://localhost:10080', verify_ssl=False) >>> gitlab.login(user='root', password='5iveL!fe') >>> gitlab.enable_deploy_key(15, 5) :param project: The ID or UR...
python
def enable_deploy_key(self, project, key_id): """ Enables a deploy key for a project. >>> gitlab = Gitlab(host='http://localhost:10080', verify_ssl=False) >>> gitlab.login(user='root', password='5iveL!fe') >>> gitlab.enable_deploy_key(15, 5) :param project: The ID or UR...
[ "def", "enable_deploy_key", "(", "self", ",", "project", ",", "key_id", ")", ":", "url", "=", "'/projects/{project}/deploy_keys/{key_id}/enable'", ".", "format", "(", "project", "=", "project", ",", "key_id", "=", "key_id", ")", "return", "self", ".", "post", ...
Enables a deploy key for a project. >>> gitlab = Gitlab(host='http://localhost:10080', verify_ssl=False) >>> gitlab.login(user='root', password='5iveL!fe') >>> gitlab.enable_deploy_key(15, 5) :param project: The ID or URL-encoded path of the project owned by the authenticated user ...
[ "Enables", "a", "deploy", "key", "for", "a", "project", "." ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L909-L924
train
59,017
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.adddeploykey
def adddeploykey(self, project_id, title, key): """ Creates a new deploy key for a project. :param project_id: project id :param title: title of the key :param key: the key itself :return: true if success, false if not """ data = {'id': project_id, 'title...
python
def adddeploykey(self, project_id, title, key): """ Creates a new deploy key for a project. :param project_id: project id :param title: title of the key :param key: the key itself :return: true if success, false if not """ data = {'id': project_id, 'title...
[ "def", "adddeploykey", "(", "self", ",", "project_id", ",", "title", ",", "key", ")", ":", "data", "=", "{", "'id'", ":", "project_id", ",", "'title'", ":", "title", ",", "'key'", ":", "key", "}", "request", "=", "requests", ".", "post", "(", "'{0}/{...
Creates a new deploy key for a project. :param project_id: project id :param title: title of the key :param key: the key itself :return: true if success, false if not
[ "Creates", "a", "new", "deploy", "key", "for", "a", "project", "." ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L960-L978
train
59,018
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.moveproject
def moveproject(self, group_id, project_id): """ Move a given project into a given group :param group_id: ID of the destination group :param project_id: ID of the project to be moved :return: dict of the updated project """ request = requests.post( '{...
python
def moveproject(self, group_id, project_id): """ Move a given project into a given group :param group_id: ID of the destination group :param project_id: ID of the project to be moved :return: dict of the updated project """ request = requests.post( '{...
[ "def", "moveproject", "(", "self", ",", "group_id", ",", "project_id", ")", ":", "request", "=", "requests", ".", "post", "(", "'{0}/{1}/projects/{2}'", ".", "format", "(", "self", ".", "groups_url", ",", "group_id", ",", "project_id", ")", ",", "headers", ...
Move a given project into a given group :param group_id: ID of the destination group :param project_id: ID of the project to be moved :return: dict of the updated project
[ "Move", "a", "given", "project", "into", "a", "given", "group" ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L1041-L1056
train
59,019
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.getmergerequests
def getmergerequests(self, project_id, page=1, per_page=20, state=None): """ Get all the merge requests for a project. :param project_id: ID of the project to retrieve merge requests for :param page: Page Number :param per_page: Records per page :param state: Passes merg...
python
def getmergerequests(self, project_id, page=1, per_page=20, state=None): """ Get all the merge requests for a project. :param project_id: ID of the project to retrieve merge requests for :param page: Page Number :param per_page: Records per page :param state: Passes merg...
[ "def", "getmergerequests", "(", "self", ",", "project_id", ",", "page", "=", "1", ",", "per_page", "=", "20", ",", "state", "=", "None", ")", ":", "data", "=", "{", "'page'", ":", "page", ",", "'per_page'", ":", "per_page", ",", "'state'", ":", "stat...
Get all the merge requests for a project. :param project_id: ID of the project to retrieve merge requests for :param page: Page Number :param per_page: Records per page :param state: Passes merge request state to filter them by it :return: list with all the merge requests
[ "Get", "all", "the", "merge", "requests", "for", "a", "project", "." ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L1058-L1077
train
59,020
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.getmergerequest
def getmergerequest(self, project_id, mergerequest_id): """ Get information about a specific merge request. :param project_id: ID of the project :param mergerequest_id: ID of the merge request :return: dict of the merge request """ request = requests.get( ...
python
def getmergerequest(self, project_id, mergerequest_id): """ Get information about a specific merge request. :param project_id: ID of the project :param mergerequest_id: ID of the merge request :return: dict of the merge request """ request = requests.get( ...
[ "def", "getmergerequest", "(", "self", ",", "project_id", ",", "mergerequest_id", ")", ":", "request", "=", "requests", ".", "get", "(", "'{0}/{1}/merge_request/{2}'", ".", "format", "(", "self", ".", "projects_url", ",", "project_id", ",", "mergerequest_id", ")...
Get information about a specific merge request. :param project_id: ID of the project :param mergerequest_id: ID of the merge request :return: dict of the merge request
[ "Get", "information", "about", "a", "specific", "merge", "request", "." ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L1079-L1094
train
59,021
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.createmergerequest
def createmergerequest(self, project_id, sourcebranch, targetbranch, title, target_project_id=None, assignee_id=None): """ Create a new merge request. :param project_id: ID of the project originating the merge request :param sourcebranch: name of the branch to...
python
def createmergerequest(self, project_id, sourcebranch, targetbranch, title, target_project_id=None, assignee_id=None): """ Create a new merge request. :param project_id: ID of the project originating the merge request :param sourcebranch: name of the branch to...
[ "def", "createmergerequest", "(", "self", ",", "project_id", ",", "sourcebranch", ",", "targetbranch", ",", "title", ",", "target_project_id", "=", "None", ",", "assignee_id", "=", "None", ")", ":", "data", "=", "{", "'source_branch'", ":", "sourcebranch", ","...
Create a new merge request. :param project_id: ID of the project originating the merge request :param sourcebranch: name of the branch to merge from :param targetbranch: name of the branch to merge to :param title: Title of the merge request :param assignee_id: Assignee user ID ...
[ "Create", "a", "new", "merge", "request", "." ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L1134-L1161
train
59,022
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.acceptmergerequest
def acceptmergerequest(self, project_id, mergerequest_id, merge_commit_message=None): """ Update an existing merge request. :param project_id: ID of the project originating the merge request :param mergerequest_id: ID of the merge request to accept :param merge_commit_message: C...
python
def acceptmergerequest(self, project_id, mergerequest_id, merge_commit_message=None): """ Update an existing merge request. :param project_id: ID of the project originating the merge request :param mergerequest_id: ID of the merge request to accept :param merge_commit_message: C...
[ "def", "acceptmergerequest", "(", "self", ",", "project_id", ",", "mergerequest_id", ",", "merge_commit_message", "=", "None", ")", ":", "data", "=", "{", "'merge_commit_message'", ":", "merge_commit_message", "}", "request", "=", "requests", ".", "put", "(", "'...
Update an existing merge request. :param project_id: ID of the project originating the merge request :param mergerequest_id: ID of the merge request to accept :param merge_commit_message: Custom merge commit message :return: dict of the modified merge request
[ "Update", "an", "existing", "merge", "request", "." ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L1190-L1209
train
59,023
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.addcommenttomergerequest
def addcommenttomergerequest(self, project_id, mergerequest_id, note): """ Add a comment to a merge request. :param project_id: ID of the project originating the merge request :param mergerequest_id: ID of the merge request to comment on :param note: Text of comment :ret...
python
def addcommenttomergerequest(self, project_id, mergerequest_id, note): """ Add a comment to a merge request. :param project_id: ID of the project originating the merge request :param mergerequest_id: ID of the merge request to comment on :param note: Text of comment :ret...
[ "def", "addcommenttomergerequest", "(", "self", ",", "project_id", ",", "mergerequest_id", ",", "note", ")", ":", "request", "=", "requests", ".", "post", "(", "'{0}/{1}/merge_request/{2}/comments'", ".", "format", "(", "self", ".", "projects_url", ",", "project_i...
Add a comment to a merge request. :param project_id: ID of the project originating the merge request :param mergerequest_id: ID of the merge request to comment on :param note: Text of comment :return: True if success
[ "Add", "a", "comment", "to", "a", "merge", "request", "." ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L1211-L1224
train
59,024
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.createsnippet
def createsnippet(self, project_id, title, file_name, code, visibility_level=0): """ Creates an snippet :param project_id: project id to create the snippet under :param title: title of the snippet :param file_name: filename for the snippet :param code: content of the sni...
python
def createsnippet(self, project_id, title, file_name, code, visibility_level=0): """ Creates an snippet :param project_id: project id to create the snippet under :param title: title of the snippet :param file_name: filename for the snippet :param code: content of the sni...
[ "def", "createsnippet", "(", "self", ",", "project_id", ",", "title", ",", "file_name", ",", "code", ",", "visibility_level", "=", "0", ")", ":", "data", "=", "{", "'id'", ":", "project_id", ",", "'title'", ":", "title", ",", "'file_name'", ":", "file_na...
Creates an snippet :param project_id: project id to create the snippet under :param title: title of the snippet :param file_name: filename for the snippet :param code: content of the snippet :param visibility_level: snippets can be either private (0), internal(10) or public(20) ...
[ "Creates", "an", "snippet" ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L1261-L1284
train
59,025
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.deletesnippet
def deletesnippet(self, project_id, snippet_id): """Deletes a given snippet :param project_id: project_id :param snippet_id: snippet id :return: True if success """ request = requests.delete( '{0}/{1}/snippets/{2}'.format(self.projects_url, project_id, snippe...
python
def deletesnippet(self, project_id, snippet_id): """Deletes a given snippet :param project_id: project_id :param snippet_id: snippet id :return: True if success """ request = requests.delete( '{0}/{1}/snippets/{2}'.format(self.projects_url, project_id, snippe...
[ "def", "deletesnippet", "(", "self", ",", "project_id", ",", "snippet_id", ")", ":", "request", "=", "requests", ".", "delete", "(", "'{0}/{1}/snippets/{2}'", ".", "format", "(", "self", ".", "projects_url", ",", "project_id", ",", "snippet_id", ")", ",", "h...
Deletes a given snippet :param project_id: project_id :param snippet_id: snippet id :return: True if success
[ "Deletes", "a", "given", "snippet" ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L1303-L1314
train
59,026
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.unprotectrepositorybranch
def unprotectrepositorybranch(self, project_id, branch): """ Unprotects a single project repository branch. This is an idempotent function, unprotecting an already unprotected repository branch still returns a 200 OK status code. :param project_id: project id :param branch: bran...
python
def unprotectrepositorybranch(self, project_id, branch): """ Unprotects a single project repository branch. This is an idempotent function, unprotecting an already unprotected repository branch still returns a 200 OK status code. :param project_id: project id :param branch: bran...
[ "def", "unprotectrepositorybranch", "(", "self", ",", "project_id", ",", "branch", ")", ":", "request", "=", "requests", ".", "put", "(", "'{0}/{1}/repository/branches/{2}/unprotect'", ".", "format", "(", "self", ".", "projects_url", ",", "project_id", ",", "branc...
Unprotects a single project repository branch. This is an idempotent function, unprotecting an already unprotected repository branch still returns a 200 OK status code. :param project_id: project id :param branch: branch to unprotect :return: dict with the branch
[ "Unprotects", "a", "single", "project", "repository", "branch", ".", "This", "is", "an", "idempotent", "function", "unprotecting", "an", "already", "unprotected", "repository", "branch", "still", "returns", "a", "200", "OK", "status", "code", "." ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L1375-L1391
train
59,027
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.createrepositorytag
def createrepositorytag(self, project_id, tag_name, ref, message=None): """ Creates new tag in the repository that points to the supplied ref :param project_id: project id :param tag_name: tag :param ref: sha1 of the commit or branch to tag :param message: message ...
python
def createrepositorytag(self, project_id, tag_name, ref, message=None): """ Creates new tag in the repository that points to the supplied ref :param project_id: project id :param tag_name: tag :param ref: sha1 of the commit or branch to tag :param message: message ...
[ "def", "createrepositorytag", "(", "self", ",", "project_id", ",", "tag_name", ",", "ref", ",", "message", "=", "None", ")", ":", "data", "=", "{", "'id'", ":", "project_id", ",", "'tag_name'", ":", "tag_name", ",", "'ref'", ":", "ref", ",", "'message'",...
Creates new tag in the repository that points to the supplied ref :param project_id: project id :param tag_name: tag :param ref: sha1 of the commit or branch to tag :param message: message :return: dict
[ "Creates", "new", "tag", "in", "the", "repository", "that", "points", "to", "the", "supplied", "ref" ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L1412-L1431
train
59,028
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.delete_repository_tag
def delete_repository_tag(self, project_id, tag_name): """ Deletes a tag of a repository with given name. :param project_id: The ID of a project :param tag_name: The name of a tag :return: Dictionary containing delete tag :raise: HttpError: If invalid response returned ...
python
def delete_repository_tag(self, project_id, tag_name): """ Deletes a tag of a repository with given name. :param project_id: The ID of a project :param tag_name: The name of a tag :return: Dictionary containing delete tag :raise: HttpError: If invalid response returned ...
[ "def", "delete_repository_tag", "(", "self", ",", "project_id", ",", "tag_name", ")", ":", "return", "self", ".", "delete", "(", "'/projects/{project_id}/repository/tags/{tag_name}'", ".", "format", "(", "project_id", "=", "project_id", ",", "tag_name", "=", "tag_na...
Deletes a tag of a repository with given name. :param project_id: The ID of a project :param tag_name: The name of a tag :return: Dictionary containing delete tag :raise: HttpError: If invalid response returned
[ "Deletes", "a", "tag", "of", "a", "repository", "with", "given", "name", "." ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L1433-L1443
train
59,029
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.addcommenttocommit
def addcommenttocommit(self, project_id, author, sha, path, line, note): """ Adds an inline comment to a specific commit :param project_id: project id :param author: The author info as returned by create mergerequest :param sha: The name of a repository branch or tag or if not g...
python
def addcommenttocommit(self, project_id, author, sha, path, line, note): """ Adds an inline comment to a specific commit :param project_id: project id :param author: The author info as returned by create mergerequest :param sha: The name of a repository branch or tag or if not g...
[ "def", "addcommenttocommit", "(", "self", ",", "project_id", ",", "author", ",", "sha", ",", "path", ",", "line", ",", "note", ")", ":", "data", "=", "{", "'author'", ":", "author", ",", "'note'", ":", "note", ",", "'path'", ":", "path", ",", "'line'...
Adds an inline comment to a specific commit :param project_id: project id :param author: The author info as returned by create mergerequest :param sha: The name of a repository branch or tag or if not given the default branch :param path: The file path :param line: The line numb...
[ "Adds", "an", "inline", "comment", "to", "a", "specific", "commit" ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L1445-L1473
train
59,030
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.getrepositorytree
def getrepositorytree(self, project_id, **kwargs): """ Get a list of repository files and directories in a project. :param project_id: The ID of a project :param path: The path inside repository. Used to get contend of subdirectories :param ref_name: The name of a repository bra...
python
def getrepositorytree(self, project_id, **kwargs): """ Get a list of repository files and directories in a project. :param project_id: The ID of a project :param path: The path inside repository. Used to get contend of subdirectories :param ref_name: The name of a repository bra...
[ "def", "getrepositorytree", "(", "self", ",", "project_id", ",", "*", "*", "kwargs", ")", ":", "data", "=", "{", "}", "if", "kwargs", ":", "data", ".", "update", "(", "kwargs", ")", "request", "=", "requests", ".", "get", "(", "'{0}/{1}/repository/tree'"...
Get a list of repository files and directories in a project. :param project_id: The ID of a project :param path: The path inside repository. Used to get contend of subdirectories :param ref_name: The name of a repository branch or tag or if not given the default branch :return: dict wit...
[ "Get", "a", "list", "of", "repository", "files", "and", "directories", "in", "a", "project", "." ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L1534-L1555
train
59,031
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.getrawfile
def getrawfile(self, project_id, sha1, filepath): """ Get the raw file contents for a file by commit SHA and path. :param project_id: The ID of a project :param sha1: The commit or branch name :param filepath: The path the file :return: raw file contents """ ...
python
def getrawfile(self, project_id, sha1, filepath): """ Get the raw file contents for a file by commit SHA and path. :param project_id: The ID of a project :param sha1: The commit or branch name :param filepath: The path the file :return: raw file contents """ ...
[ "def", "getrawfile", "(", "self", ",", "project_id", ",", "sha1", ",", "filepath", ")", ":", "data", "=", "{", "'filepath'", ":", "filepath", "}", "request", "=", "requests", ".", "get", "(", "'{0}/{1}/repository/blobs/{2}'", ".", "format", "(", "self", "....
Get the raw file contents for a file by commit SHA and path. :param project_id: The ID of a project :param sha1: The commit or branch name :param filepath: The path the file :return: raw file contents
[ "Get", "the", "raw", "file", "contents", "for", "a", "file", "by", "commit", "SHA", "and", "path", "." ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L1557-L1576
train
59,032
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.getrawblob
def getrawblob(self, project_id, sha1): """ Get the raw file contents for a blob by blob SHA. :param project_id: The ID of a project :param sha1: the commit sha :return: raw blob """ request = requests.get( '{0}/{1}/repository/raw_blobs/{2}'.format(se...
python
def getrawblob(self, project_id, sha1): """ Get the raw file contents for a blob by blob SHA. :param project_id: The ID of a project :param sha1: the commit sha :return: raw blob """ request = requests.get( '{0}/{1}/repository/raw_blobs/{2}'.format(se...
[ "def", "getrawblob", "(", "self", ",", "project_id", ",", "sha1", ")", ":", "request", "=", "requests", ".", "get", "(", "'{0}/{1}/repository/raw_blobs/{2}'", ".", "format", "(", "self", ".", "projects_url", ",", "project_id", ",", "sha1", ")", ",", "verify"...
Get the raw file contents for a blob by blob SHA. :param project_id: The ID of a project :param sha1: the commit sha :return: raw blob
[ "Get", "the", "raw", "file", "contents", "for", "a", "blob", "by", "blob", "SHA", "." ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L1578-L1593
train
59,033
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.compare_branches_tags_commits
def compare_branches_tags_commits(self, project_id, from_id, to_id): """ Compare branches, tags or commits :param project_id: The ID of a project :param from_id: the commit sha or branch name :param to_id: the commit sha or branch name :return: commit list and diff betwe...
python
def compare_branches_tags_commits(self, project_id, from_id, to_id): """ Compare branches, tags or commits :param project_id: The ID of a project :param from_id: the commit sha or branch name :param to_id: the commit sha or branch name :return: commit list and diff betwe...
[ "def", "compare_branches_tags_commits", "(", "self", ",", "project_id", ",", "from_id", ",", "to_id", ")", ":", "data", "=", "{", "'from'", ":", "from_id", ",", "'to'", ":", "to_id", "}", "request", "=", "requests", ".", "get", "(", "'{0}/{1}/repository/comp...
Compare branches, tags or commits :param project_id: The ID of a project :param from_id: the commit sha or branch name :param to_id: the commit sha or branch name :return: commit list and diff between two branches tags or commits provided by name :raise: HttpError: If invalid re...
[ "Compare", "branches", "tags", "or", "commits" ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L1615-L1635
train
59,034
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.searchproject
def searchproject(self, search, page=1, per_page=20): """ Search for projects by name which are accessible to the authenticated user :param search: Query to search for :param page: Page number :param per_page: Records per page :return: list of results """ ...
python
def searchproject(self, search, page=1, per_page=20): """ Search for projects by name which are accessible to the authenticated user :param search: Query to search for :param page: Page number :param per_page: Records per page :return: list of results """ ...
[ "def", "searchproject", "(", "self", ",", "search", ",", "page", "=", "1", ",", "per_page", "=", "20", ")", ":", "data", "=", "{", "'page'", ":", "page", ",", "'per_page'", ":", "per_page", "}", "request", "=", "requests", ".", "get", "(", "\"{0}/{1}...
Search for projects by name which are accessible to the authenticated user :param search: Query to search for :param page: Page number :param per_page: Records per page :return: list of results
[ "Search", "for", "projects", "by", "name", "which", "are", "accessible", "to", "the", "authenticated", "user" ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L1637-L1653
train
59,035
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.getfilearchive
def getfilearchive(self, project_id, filepath=None): """ Get an archive of the repository :param project_id: project id :param filepath: path to save the file to :return: True if the file was saved to the filepath """ if not filepath: filepath = '' ...
python
def getfilearchive(self, project_id, filepath=None): """ Get an archive of the repository :param project_id: project id :param filepath: path to save the file to :return: True if the file was saved to the filepath """ if not filepath: filepath = '' ...
[ "def", "getfilearchive", "(", "self", ",", "project_id", ",", "filepath", "=", "None", ")", ":", "if", "not", "filepath", ":", "filepath", "=", "''", "request", "=", "requests", ".", "get", "(", "'{0}/{1}/repository/archive'", ".", "format", "(", "self", "...
Get an archive of the repository :param project_id: project id :param filepath: path to save the file to :return: True if the file was saved to the filepath
[ "Get", "an", "archive", "of", "the", "repository" ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L1655-L1680
train
59,036
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.deletegroup
def deletegroup(self, group_id): """ Deletes an group by ID :param group_id: id of the group to delete :return: True if it deleted, False if it couldn't. False could happen for several reasons, but there isn't a good way of differentiating them """ request = requests.del...
python
def deletegroup(self, group_id): """ Deletes an group by ID :param group_id: id of the group to delete :return: True if it deleted, False if it couldn't. False could happen for several reasons, but there isn't a good way of differentiating them """ request = requests.del...
[ "def", "deletegroup", "(", "self", ",", "group_id", ")", ":", "request", "=", "requests", ".", "delete", "(", "'{0}/{1}'", ".", "format", "(", "self", ".", "groups_url", ",", "group_id", ")", ",", "headers", "=", "self", ".", "headers", ",", "verify", ...
Deletes an group by ID :param group_id: id of the group to delete :return: True if it deleted, False if it couldn't. False could happen for several reasons, but there isn't a good way of differentiating them
[ "Deletes", "an", "group", "by", "ID" ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L1682-L1693
train
59,037
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.getgroupmembers
def getgroupmembers(self, group_id, page=1, per_page=20): """ Lists the members of a given group id :param group_id: the group id :param page: which page to return (default is 1) :param per_page: number of items to return per page (default is 20) :return: the group's mem...
python
def getgroupmembers(self, group_id, page=1, per_page=20): """ Lists the members of a given group id :param group_id: the group id :param page: which page to return (default is 1) :param per_page: number of items to return per page (default is 20) :return: the group's mem...
[ "def", "getgroupmembers", "(", "self", ",", "group_id", ",", "page", "=", "1", ",", "per_page", "=", "20", ")", ":", "data", "=", "{", "'page'", ":", "page", ",", "'per_page'", ":", "per_page", "}", "request", "=", "requests", ".", "get", "(", "'{0}/...
Lists the members of a given group id :param group_id: the group id :param page: which page to return (default is 1) :param per_page: number of items to return per page (default is 20) :return: the group's members
[ "Lists", "the", "members", "of", "a", "given", "group", "id" ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L1695-L1713
train
59,038
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.deletegroupmember
def deletegroupmember(self, group_id, user_id): """ Delete a group member :param group_id: group id to remove the member from :param user_id: user id :return: always true """ request = requests.delete( '{0}/{1}/members/{2}'.format(self.groups_url, gro...
python
def deletegroupmember(self, group_id, user_id): """ Delete a group member :param group_id: group id to remove the member from :param user_id: user id :return: always true """ request = requests.delete( '{0}/{1}/members/{2}'.format(self.groups_url, gro...
[ "def", "deletegroupmember", "(", "self", ",", "group_id", ",", "user_id", ")", ":", "request", "=", "requests", ".", "delete", "(", "'{0}/{1}/members/{2}'", ".", "format", "(", "self", ".", "groups_url", ",", "group_id", ",", "user_id", ")", ",", "headers", ...
Delete a group member :param group_id: group id to remove the member from :param user_id: user id :return: always true
[ "Delete", "a", "group", "member" ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L1776-L1789
train
59,039
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.addldapgrouplink
def addldapgrouplink(self, group_id, cn, group_access, provider): """ Add LDAP group link :param id: The ID of a group :param cn: The CN of a LDAP group :param group_access: Minimum access level for members of the LDAP group :param provider: LDAP provider for the LDAP gr...
python
def addldapgrouplink(self, group_id, cn, group_access, provider): """ Add LDAP group link :param id: The ID of a group :param cn: The CN of a LDAP group :param group_access: Minimum access level for members of the LDAP group :param provider: LDAP provider for the LDAP gr...
[ "def", "addldapgrouplink", "(", "self", ",", "group_id", ",", "cn", ",", "group_access", ",", "provider", ")", ":", "data", "=", "{", "'id'", ":", "group_id", ",", "'cn'", ":", "cn", ",", "'group_access'", ":", "group_access", ",", "'provider'", ":", "pr...
Add LDAP group link :param id: The ID of a group :param cn: The CN of a LDAP group :param group_access: Minimum access level for members of the LDAP group :param provider: LDAP provider for the LDAP group (when using several providers) :return: True if success
[ "Add", "LDAP", "group", "link" ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L1791-L1807
train
59,040
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.createissuewallnote
def createissuewallnote(self, project_id, issue_id, content): """Create a new note :param project_id: Project ID :param issue_id: Issue ID :param content: Contents :return: Json or False """ data = {'body': content} request = requests.post( '...
python
def createissuewallnote(self, project_id, issue_id, content): """Create a new note :param project_id: Project ID :param issue_id: Issue ID :param content: Contents :return: Json or False """ data = {'body': content} request = requests.post( '...
[ "def", "createissuewallnote", "(", "self", ",", "project_id", ",", "issue_id", ",", "content", ")", ":", "data", "=", "{", "'body'", ":", "content", "}", "request", "=", "requests", ".", "post", "(", "'{0}/{1}/issues/{2}/notes'", ".", "format", "(", "self", ...
Create a new note :param project_id: Project ID :param issue_id: Issue ID :param content: Contents :return: Json or False
[ "Create", "a", "new", "note" ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L1864-L1880
train
59,041
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.createfile
def createfile(self, project_id, file_path, branch_name, encoding, content, commit_message): """ Creates a new file in the repository :param project_id: project id :param file_path: Full path to new file. Ex. lib/class.rb :param branch_name: The name of branch :param con...
python
def createfile(self, project_id, file_path, branch_name, encoding, content, commit_message): """ Creates a new file in the repository :param project_id: project id :param file_path: Full path to new file. Ex. lib/class.rb :param branch_name: The name of branch :param con...
[ "def", "createfile", "(", "self", ",", "project_id", ",", "file_path", ",", "branch_name", ",", "encoding", ",", "content", ",", "commit_message", ")", ":", "data", "=", "{", "'file_path'", ":", "file_path", ",", "'branch_name'", ":", "branch_name", ",", "'e...
Creates a new file in the repository :param project_id: project id :param file_path: Full path to new file. Ex. lib/class.rb :param branch_name: The name of branch :param content: File content :param commit_message: Commit message :return: true if success, false if not
[ "Creates", "a", "new", "file", "in", "the", "repository" ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L1999-L2022
train
59,042
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.updatefile
def updatefile(self, project_id, file_path, branch_name, content, commit_message): """ Updates an existing file in the repository :param project_id: project id :param file_path: Full path to new file. Ex. lib/class.rb :param branch_name: The name of branch :param content...
python
def updatefile(self, project_id, file_path, branch_name, content, commit_message): """ Updates an existing file in the repository :param project_id: project id :param file_path: Full path to new file. Ex. lib/class.rb :param branch_name: The name of branch :param content...
[ "def", "updatefile", "(", "self", ",", "project_id", ",", "file_path", ",", "branch_name", ",", "content", ",", "commit_message", ")", ":", "data", "=", "{", "'file_path'", ":", "file_path", ",", "'branch_name'", ":", "branch_name", ",", "'content'", ":", "c...
Updates an existing file in the repository :param project_id: project id :param file_path: Full path to new file. Ex. lib/class.rb :param branch_name: The name of branch :param content: File content :param commit_message: Commit message :return: true if success, false if...
[ "Updates", "an", "existing", "file", "in", "the", "repository" ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L2024-L2046
train
59,043
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.getfile
def getfile(self, project_id, file_path, ref): """ Allows you to receive information about file in repository like name, size, content. Note that file content is Base64 encoded. :param project_id: project_id :param file_path: Full path to file. Ex. lib/class.rb :param re...
python
def getfile(self, project_id, file_path, ref): """ Allows you to receive information about file in repository like name, size, content. Note that file content is Base64 encoded. :param project_id: project_id :param file_path: Full path to file. Ex. lib/class.rb :param re...
[ "def", "getfile", "(", "self", ",", "project_id", ",", "file_path", ",", "ref", ")", ":", "data", "=", "{", "'file_path'", ":", "file_path", ",", "'ref'", ":", "ref", "}", "request", "=", "requests", ".", "get", "(", "'{0}/{1}/repository/files'", ".", "f...
Allows you to receive information about file in repository like name, size, content. Note that file content is Base64 encoded. :param project_id: project_id :param file_path: Full path to file. Ex. lib/class.rb :param ref: The name of branch, tag or commit :return:
[ "Allows", "you", "to", "receive", "information", "about", "file", "in", "repository", "like", "name", "size", "content", ".", "Note", "that", "file", "content", "is", "Base64", "encoded", "." ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L2048-L2067
train
59,044
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.deletefile
def deletefile(self, project_id, file_path, branch_name, commit_message): """ Deletes existing file in the repository :param project_id: project id :param file_path: Full path to new file. Ex. lib/class.rb :param branch_name: The name of branch :param commit_message: Com...
python
def deletefile(self, project_id, file_path, branch_name, commit_message): """ Deletes existing file in the repository :param project_id: project id :param file_path: Full path to new file. Ex. lib/class.rb :param branch_name: The name of branch :param commit_message: Com...
[ "def", "deletefile", "(", "self", ",", "project_id", ",", "file_path", ",", "branch_name", ",", "commit_message", ")", ":", "data", "=", "{", "'file_path'", ":", "file_path", ",", "'branch_name'", ":", "branch_name", ",", "'commit_message'", ":", "commit_message...
Deletes existing file in the repository :param project_id: project id :param file_path: Full path to new file. Ex. lib/class.rb :param branch_name: The name of branch :param commit_message: Commit message :return: true if success, false if not
[ "Deletes", "existing", "file", "in", "the", "repository" ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L2069-L2089
train
59,045
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.setgitlabciservice
def setgitlabciservice(self, project_id, token, project_url): """ Set GitLab CI service for project :param project_id: project id :param token: CI project token :param project_url: CI project url :return: true if success, false if not """ data = {'token':...
python
def setgitlabciservice(self, project_id, token, project_url): """ Set GitLab CI service for project :param project_id: project id :param token: CI project token :param project_url: CI project url :return: true if success, false if not """ data = {'token':...
[ "def", "setgitlabciservice", "(", "self", ",", "project_id", ",", "token", ",", "project_url", ")", ":", "data", "=", "{", "'token'", ":", "token", ",", "'project_url'", ":", "project_url", "}", "request", "=", "requests", ".", "put", "(", "'{0}/{1}/services...
Set GitLab CI service for project :param project_id: project id :param token: CI project token :param project_url: CI project url :return: true if success, false if not
[ "Set", "GitLab", "CI", "service", "for", "project" ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L2091-L2106
train
59,046
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.deletegitlabciservice
def deletegitlabciservice(self, project_id, token, project_url): """ Delete GitLab CI service settings :param project_id: Project ID :param token: Token :param project_url: Project URL :return: true if success, false if not """ request = requests.delete( ...
python
def deletegitlabciservice(self, project_id, token, project_url): """ Delete GitLab CI service settings :param project_id: Project ID :param token: Token :param project_url: Project URL :return: true if success, false if not """ request = requests.delete( ...
[ "def", "deletegitlabciservice", "(", "self", ",", "project_id", ",", "token", ",", "project_url", ")", ":", "request", "=", "requests", ".", "delete", "(", "'{0}/{1}/services/gitlab-ci'", ".", "format", "(", "self", ".", "projects_url", ",", "project_id", ")", ...
Delete GitLab CI service settings :param project_id: Project ID :param token: Token :param project_url: Project URL :return: true if success, false if not
[ "Delete", "GitLab", "CI", "service", "settings" ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L2108-L2121
train
59,047
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.createlabel
def createlabel(self, project_id, name, color): """ Creates a new label for given repository with given name and color. :param project_id: The ID of a project :param name: The name of the label :param color: Color of the label given in 6-digit hex notation with leading '#' sign ...
python
def createlabel(self, project_id, name, color): """ Creates a new label for given repository with given name and color. :param project_id: The ID of a project :param name: The name of the label :param color: Color of the label given in 6-digit hex notation with leading '#' sign ...
[ "def", "createlabel", "(", "self", ",", "project_id", ",", "name", ",", "color", ")", ":", "data", "=", "{", "'name'", ":", "name", ",", "'color'", ":", "color", "}", "request", "=", "requests", ".", "post", "(", "'{0}/{1}/labels'", ".", "format", "(",...
Creates a new label for given repository with given name and color. :param project_id: The ID of a project :param name: The name of the label :param color: Color of the label given in 6-digit hex notation with leading '#' sign (e.g. #FFAABB) :return:
[ "Creates", "a", "new", "label", "for", "given", "repository", "with", "given", "name", "and", "color", "." ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L2139-L2157
train
59,048
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.deletelabel
def deletelabel(self, project_id, name): """ Deletes a label given by its name. :param project_id: The ID of a project :param name: The name of the label :return: True if succeed """ data = {'name': name} request = requests.delete( '{0}/{1}/l...
python
def deletelabel(self, project_id, name): """ Deletes a label given by its name. :param project_id: The ID of a project :param name: The name of the label :return: True if succeed """ data = {'name': name} request = requests.delete( '{0}/{1}/l...
[ "def", "deletelabel", "(", "self", ",", "project_id", ",", "name", ")", ":", "data", "=", "{", "'name'", ":", "name", "}", "request", "=", "requests", ".", "delete", "(", "'{0}/{1}/labels'", ".", "format", "(", "self", ".", "projects_url", ",", "project_...
Deletes a label given by its name. :param project_id: The ID of a project :param name: The name of the label :return: True if succeed
[ "Deletes", "a", "label", "given", "by", "its", "name", "." ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L2159-L2173
train
59,049
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.editlabel
def editlabel(self, project_id, name, new_name=None, color=None): """ Updates an existing label with new name or now color. At least one parameter is required, to update the label. :param project_id: The ID of a project :param name: The name of the label :return: True if...
python
def editlabel(self, project_id, name, new_name=None, color=None): """ Updates an existing label with new name or now color. At least one parameter is required, to update the label. :param project_id: The ID of a project :param name: The name of the label :return: True if...
[ "def", "editlabel", "(", "self", ",", "project_id", ",", "name", ",", "new_name", "=", "None", ",", "color", "=", "None", ")", ":", "data", "=", "{", "'name'", ":", "name", ",", "'new_name'", ":", "new_name", ",", "'color'", ":", "color", "}", "reque...
Updates an existing label with new name or now color. At least one parameter is required, to update the label. :param project_id: The ID of a project :param name: The name of the label :return: True if succeed
[ "Updates", "an", "existing", "label", "with", "new", "name", "or", "now", "color", ".", "At", "least", "one", "parameter", "is", "required", "to", "update", "the", "label", "." ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L2175-L2193
train
59,050
pyapi-gitlab/pyapi-gitlab
gitlab/__init__.py
Gitlab.getnamespaces
def getnamespaces(self, search=None, page=1, per_page=20): """ Return a namespace list :param search: Optional search query :param page: Which page to return (default is 1) :param per_page: Number of items to return per page (default is 20) :return: returns a list of nam...
python
def getnamespaces(self, search=None, page=1, per_page=20): """ Return a namespace list :param search: Optional search query :param page: Which page to return (default is 1) :param per_page: Number of items to return per page (default is 20) :return: returns a list of nam...
[ "def", "getnamespaces", "(", "self", ",", "search", "=", "None", ",", "page", "=", "1", ",", "per_page", "=", "20", ")", ":", "data", "=", "{", "'page'", ":", "page", ",", "'per_page'", ":", "per_page", "}", "if", "search", ":", "data", "[", "'sear...
Return a namespace list :param search: Optional search query :param page: Which page to return (default is 1) :param per_page: Number of items to return per page (default is 20) :return: returns a list of namespaces, false if there is an error
[ "Return", "a", "namespace", "list" ]
f74b6fb5c13cecae9524997847e928905cc60acf
https://github.com/pyapi-gitlab/pyapi-gitlab/blob/f74b6fb5c13cecae9524997847e928905cc60acf/gitlab/__init__.py#L2195-L2215
train
59,051
HazardDede/argresolver
argresolver/utils.py
get_field_mro
def get_field_mro(cls, field_name): """Goes up the mro and looks for the specified field.""" res = set() if hasattr(cls, '__mro__'): for _class in inspect.getmro(cls): values_ = getattr(_class, field_name, None) if values_ is not None: res = res.union(set(make...
python
def get_field_mro(cls, field_name): """Goes up the mro and looks for the specified field.""" res = set() if hasattr(cls, '__mro__'): for _class in inspect.getmro(cls): values_ = getattr(_class, field_name, None) if values_ is not None: res = res.union(set(make...
[ "def", "get_field_mro", "(", "cls", ",", "field_name", ")", ":", "res", "=", "set", "(", ")", "if", "hasattr", "(", "cls", ",", "'__mro__'", ")", ":", "for", "_class", "in", "inspect", ".", "getmro", "(", "cls", ")", ":", "values_", "=", "getattr", ...
Goes up the mro and looks for the specified field.
[ "Goes", "up", "the", "mro", "and", "looks", "for", "the", "specified", "field", "." ]
b5801af01ae3926ed1289d80826fec92ce7facbc
https://github.com/HazardDede/argresolver/blob/b5801af01ae3926ed1289d80826fec92ce7facbc/argresolver/utils.py#L32-L40
train
59,052
Duke-GCB/lando-messaging
lando_messaging/workqueue.py
WorkQueueConnection.connect
def connect(self): """ Create internal connection to AMQP service. """ logging.info("Connecting to {} with user {}.".format(self.host, self.username)) credentials = pika.PlainCredentials(self.username, self.password) connection_params = pika.ConnectionParameters(host=self...
python
def connect(self): """ Create internal connection to AMQP service. """ logging.info("Connecting to {} with user {}.".format(self.host, self.username)) credentials = pika.PlainCredentials(self.username, self.password) connection_params = pika.ConnectionParameters(host=self...
[ "def", "connect", "(", "self", ")", ":", "logging", ".", "info", "(", "\"Connecting to {} with user {}.\"", ".", "format", "(", "self", ".", "host", ",", "self", ".", "username", ")", ")", "credentials", "=", "pika", ".", "PlainCredentials", "(", "self", "...
Create internal connection to AMQP service.
[ "Create", "internal", "connection", "to", "AMQP", "service", "." ]
b90ccc79a874714e0776af8badf505bb2b56c0ec
https://github.com/Duke-GCB/lando-messaging/blob/b90ccc79a874714e0776af8badf505bb2b56c0ec/lando_messaging/workqueue.py#L52-L61
train
59,053
Duke-GCB/lando-messaging
lando_messaging/workqueue.py
WorkQueueConnection.close
def close(self): """ Close internal connection to AMQP if connected. """ if self.connection: logging.info("Closing connection to {}.".format(self.host)) self.connection.close() self.connection = None
python
def close(self): """ Close internal connection to AMQP if connected. """ if self.connection: logging.info("Closing connection to {}.".format(self.host)) self.connection.close() self.connection = None
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "connection", ":", "logging", ".", "info", "(", "\"Closing connection to {}.\"", ".", "format", "(", "self", ".", "host", ")", ")", "self", ".", "connection", ".", "close", "(", ")", "self", "."...
Close internal connection to AMQP if connected.
[ "Close", "internal", "connection", "to", "AMQP", "if", "connected", "." ]
b90ccc79a874714e0776af8badf505bb2b56c0ec
https://github.com/Duke-GCB/lando-messaging/blob/b90ccc79a874714e0776af8badf505bb2b56c0ec/lando_messaging/workqueue.py#L63-L70
train
59,054
Duke-GCB/lando-messaging
lando_messaging/workqueue.py
WorkQueueProcessor.process_messages_loop
def process_messages_loop(self): """ Processes incoming WorkRequest messages one at a time via functions specified by add_command. """ self.receiving_messages = True try: self.process_messages_loop_internal() except pika.exceptions.ConnectionClosed as ex: ...
python
def process_messages_loop(self): """ Processes incoming WorkRequest messages one at a time via functions specified by add_command. """ self.receiving_messages = True try: self.process_messages_loop_internal() except pika.exceptions.ConnectionClosed as ex: ...
[ "def", "process_messages_loop", "(", "self", ")", ":", "self", ".", "receiving_messages", "=", "True", "try", ":", "self", ".", "process_messages_loop_internal", "(", ")", "except", "pika", ".", "exceptions", ".", "ConnectionClosed", "as", "ex", ":", "logging", ...
Processes incoming WorkRequest messages one at a time via functions specified by add_command.
[ "Processes", "incoming", "WorkRequest", "messages", "one", "at", "a", "time", "via", "functions", "specified", "by", "add_command", "." ]
b90ccc79a874714e0776af8badf505bb2b56c0ec
https://github.com/Duke-GCB/lando-messaging/blob/b90ccc79a874714e0776af8badf505bb2b56c0ec/lando_messaging/workqueue.py#L251-L260
train
59,055
Duke-GCB/lando-messaging
lando_messaging/workqueue.py
WorkQueueProcessor.process_messages_loop_internal
def process_messages_loop_internal(self): """ Busy loop that processes incoming WorkRequest messages via functions specified by add_command. Terminates if a command runs shutdown method """ logging.info("Starting work queue loop.") self.connection.receive_loop_with_callba...
python
def process_messages_loop_internal(self): """ Busy loop that processes incoming WorkRequest messages via functions specified by add_command. Terminates if a command runs shutdown method """ logging.info("Starting work queue loop.") self.connection.receive_loop_with_callba...
[ "def", "process_messages_loop_internal", "(", "self", ")", ":", "logging", ".", "info", "(", "\"Starting work queue loop.\"", ")", "self", ".", "connection", ".", "receive_loop_with_callback", "(", "self", ".", "queue_name", ",", "self", ".", "process_message", ")" ...
Busy loop that processes incoming WorkRequest messages via functions specified by add_command. Terminates if a command runs shutdown method
[ "Busy", "loop", "that", "processes", "incoming", "WorkRequest", "messages", "via", "functions", "specified", "by", "add_command", ".", "Terminates", "if", "a", "command", "runs", "shutdown", "method" ]
b90ccc79a874714e0776af8badf505bb2b56c0ec
https://github.com/Duke-GCB/lando-messaging/blob/b90ccc79a874714e0776af8badf505bb2b56c0ec/lando_messaging/workqueue.py#L262-L268
train
59,056
Duke-GCB/lando-messaging
lando_messaging/workqueue.py
DisconnectingWorkQueueProcessor.process_messages_loop_internal
def process_messages_loop_internal(self): """ Busy loop that processes incoming WorkRequest messages via functions specified by add_command. Disconnects while servicing a message, reconnects once finished processing a message Terminates if a command runs shutdown method """ ...
python
def process_messages_loop_internal(self): """ Busy loop that processes incoming WorkRequest messages via functions specified by add_command. Disconnects while servicing a message, reconnects once finished processing a message Terminates if a command runs shutdown method """ ...
[ "def", "process_messages_loop_internal", "(", "self", ")", ":", "while", "self", ".", "receiving_messages", ":", "# connect to AMQP server and listen for 1 message then disconnect", "self", ".", "work_request", "=", "None", "self", ".", "connection", ".", "receive_loop_with...
Busy loop that processes incoming WorkRequest messages via functions specified by add_command. Disconnects while servicing a message, reconnects once finished processing a message Terminates if a command runs shutdown method
[ "Busy", "loop", "that", "processes", "incoming", "WorkRequest", "messages", "via", "functions", "specified", "by", "add_command", ".", "Disconnects", "while", "servicing", "a", "message", "reconnects", "once", "finished", "processing", "a", "message", "Terminates", ...
b90ccc79a874714e0776af8badf505bb2b56c0ec
https://github.com/Duke-GCB/lando-messaging/blob/b90ccc79a874714e0776af8badf505bb2b56c0ec/lando_messaging/workqueue.py#L314-L325
train
59,057
Duke-GCB/lando-messaging
lando_messaging/workqueue.py
DisconnectingWorkQueueProcessor.save_work_request_and_close
def save_work_request_and_close(self, ch, method, properties, body): """ Save message body and close connection """ self.work_request = pickle.loads(body) ch.basic_ack(delivery_tag=method.delivery_tag) ch.stop_consuming() self.connection.close()
python
def save_work_request_and_close(self, ch, method, properties, body): """ Save message body and close connection """ self.work_request = pickle.loads(body) ch.basic_ack(delivery_tag=method.delivery_tag) ch.stop_consuming() self.connection.close()
[ "def", "save_work_request_and_close", "(", "self", ",", "ch", ",", "method", ",", "properties", ",", "body", ")", ":", "self", ".", "work_request", "=", "pickle", ".", "loads", "(", "body", ")", "ch", ".", "basic_ack", "(", "delivery_tag", "=", "method", ...
Save message body and close connection
[ "Save", "message", "body", "and", "close", "connection" ]
b90ccc79a874714e0776af8badf505bb2b56c0ec
https://github.com/Duke-GCB/lando-messaging/blob/b90ccc79a874714e0776af8badf505bb2b56c0ec/lando_messaging/workqueue.py#L327-L334
train
59,058
tBaxter/tango-photos
build/lib/photos/templatetags/gallery_tags.py
get_related_galleries
def get_related_galleries(gallery, count=5): """ Gets latest related galleries from same section as originating gallery. Count defaults to five but can be overridden. Usage: {% get_related_galleries gallery <10> %} """ # just get the first cat. If they assigned to more than one, tough try:...
python
def get_related_galleries(gallery, count=5): """ Gets latest related galleries from same section as originating gallery. Count defaults to five but can be overridden. Usage: {% get_related_galleries gallery <10> %} """ # just get the first cat. If they assigned to more than one, tough try:...
[ "def", "get_related_galleries", "(", "gallery", ",", "count", "=", "5", ")", ":", "# just get the first cat. If they assigned to more than one, tough", "try", ":", "cat", "=", "gallery", ".", "sections", ".", "all", "(", ")", "[", "0", "]", "related", "=", "cat"...
Gets latest related galleries from same section as originating gallery. Count defaults to five but can be overridden. Usage: {% get_related_galleries gallery <10> %}
[ "Gets", "latest", "related", "galleries", "from", "same", "section", "as", "originating", "gallery", "." ]
aca52c6d6425cd6016468107a677479216285fc3
https://github.com/tBaxter/tango-photos/blob/aca52c6d6425cd6016468107a677479216285fc3/build/lib/photos/templatetags/gallery_tags.py#L20-L34
train
59,059
ministryofjustice/django-moj-irat
moj_irat/healthchecks.py
HealthcheckRegistry.load_healthchecks
def load_healthchecks(self): """ Loads healthchecks. """ self.load_default_healthchecks() if getattr(settings, 'AUTODISCOVER_HEALTHCHECKS', True): self.autodiscover_healthchecks() self._registry_loaded = True
python
def load_healthchecks(self): """ Loads healthchecks. """ self.load_default_healthchecks() if getattr(settings, 'AUTODISCOVER_HEALTHCHECKS', True): self.autodiscover_healthchecks() self._registry_loaded = True
[ "def", "load_healthchecks", "(", "self", ")", ":", "self", ".", "load_default_healthchecks", "(", ")", "if", "getattr", "(", "settings", ",", "'AUTODISCOVER_HEALTHCHECKS'", ",", "True", ")", ":", "self", ".", "autodiscover_healthchecks", "(", ")", "self", ".", ...
Loads healthchecks.
[ "Loads", "healthchecks", "." ]
c1588426fffce783bef6d8b9d73395a5e9a833c9
https://github.com/ministryofjustice/django-moj-irat/blob/c1588426fffce783bef6d8b9d73395a5e9a833c9/moj_irat/healthchecks.py#L162-L169
train
59,060
ministryofjustice/django-moj-irat
moj_irat/healthchecks.py
HealthcheckRegistry.load_default_healthchecks
def load_default_healthchecks(self): """ Loads healthchecks specified in settings.HEALTHCHECKS as dotted import paths to the classes. Defaults are listed in `DEFAULT_HEALTHCHECKS`. """ default_healthchecks = getattr(settings, 'HEALTHCHECKS', DEFAULT_HEALTHCHECKS) for heal...
python
def load_default_healthchecks(self): """ Loads healthchecks specified in settings.HEALTHCHECKS as dotted import paths to the classes. Defaults are listed in `DEFAULT_HEALTHCHECKS`. """ default_healthchecks = getattr(settings, 'HEALTHCHECKS', DEFAULT_HEALTHCHECKS) for heal...
[ "def", "load_default_healthchecks", "(", "self", ")", ":", "default_healthchecks", "=", "getattr", "(", "settings", ",", "'HEALTHCHECKS'", ",", "DEFAULT_HEALTHCHECKS", ")", "for", "healthcheck", "in", "default_healthchecks", ":", "healthcheck", "=", "import_string", "...
Loads healthchecks specified in settings.HEALTHCHECKS as dotted import paths to the classes. Defaults are listed in `DEFAULT_HEALTHCHECKS`.
[ "Loads", "healthchecks", "specified", "in", "settings", ".", "HEALTHCHECKS", "as", "dotted", "import", "paths", "to", "the", "classes", ".", "Defaults", "are", "listed", "in", "DEFAULT_HEALTHCHECKS", "." ]
c1588426fffce783bef6d8b9d73395a5e9a833c9
https://github.com/ministryofjustice/django-moj-irat/blob/c1588426fffce783bef6d8b9d73395a5e9a833c9/moj_irat/healthchecks.py#L171-L179
train
59,061
ministryofjustice/django-moj-irat
moj_irat/healthchecks.py
HealthcheckRegistry.run_healthchecks
def run_healthchecks(self): """ Runs all registered healthchecks and returns a list of HealthcheckResponse. """ if not self._registry_loaded: self.load_healthchecks() def get_healthcheck_name(hc): if hasattr(hc, 'name'): return hc....
python
def run_healthchecks(self): """ Runs all registered healthchecks and returns a list of HealthcheckResponse. """ if not self._registry_loaded: self.load_healthchecks() def get_healthcheck_name(hc): if hasattr(hc, 'name'): return hc....
[ "def", "run_healthchecks", "(", "self", ")", ":", "if", "not", "self", ".", "_registry_loaded", ":", "self", ".", "load_healthchecks", "(", ")", "def", "get_healthcheck_name", "(", "hc", ")", ":", "if", "hasattr", "(", "hc", ",", "'name'", ")", ":", "ret...
Runs all registered healthchecks and returns a list of HealthcheckResponse.
[ "Runs", "all", "registered", "healthchecks", "and", "returns", "a", "list", "of", "HealthcheckResponse", "." ]
c1588426fffce783bef6d8b9d73395a5e9a833c9
https://github.com/ministryofjustice/django-moj-irat/blob/c1588426fffce783bef6d8b9d73395a5e9a833c9/moj_irat/healthchecks.py#L196-L228
train
59,062
astralblue/asynciotimemachine
asynciotimemachine.py
TimeMachine.advance_by
def advance_by(self, amount): """Advance the time reference by the given amount. :param `float` amount: number of seconds to advance. :raise `ValueError`: if *amount* is negative. """ if amount < 0: raise ValueError("cannot retreat time reference: amount {} < 0" ...
python
def advance_by(self, amount): """Advance the time reference by the given amount. :param `float` amount: number of seconds to advance. :raise `ValueError`: if *amount* is negative. """ if amount < 0: raise ValueError("cannot retreat time reference: amount {} < 0" ...
[ "def", "advance_by", "(", "self", ",", "amount", ")", ":", "if", "amount", "<", "0", ":", "raise", "ValueError", "(", "\"cannot retreat time reference: amount {} < 0\"", ".", "format", "(", "amount", ")", ")", "self", ".", "__delta", "+=", "amount" ]
Advance the time reference by the given amount. :param `float` amount: number of seconds to advance. :raise `ValueError`: if *amount* is negative.
[ "Advance", "the", "time", "reference", "by", "the", "given", "amount", "." ]
0fef71f45ce467f3112f6f9eea18272162f46447
https://github.com/astralblue/asynciotimemachine/blob/0fef71f45ce467f3112f6f9eea18272162f46447/asynciotimemachine.py#L27-L36
train
59,063
astralblue/asynciotimemachine
asynciotimemachine.py
TimeMachine.advance_to
def advance_to(self, timestamp): """Advance the time reference so that now is the given timestamp. :param `float` timestamp: the new current timestamp. :raise `ValueError`: if *timestamp* is in the past. """ now = self.__original_time() if timestamp < now: ra...
python
def advance_to(self, timestamp): """Advance the time reference so that now is the given timestamp. :param `float` timestamp: the new current timestamp. :raise `ValueError`: if *timestamp* is in the past. """ now = self.__original_time() if timestamp < now: ra...
[ "def", "advance_to", "(", "self", ",", "timestamp", ")", ":", "now", "=", "self", ".", "__original_time", "(", ")", "if", "timestamp", "<", "now", ":", "raise", "ValueError", "(", "\"cannot retreat time reference: \"", "\"target {} < now {}\"", ".", "format", "(...
Advance the time reference so that now is the given timestamp. :param `float` timestamp: the new current timestamp. :raise `ValueError`: if *timestamp* is in the past.
[ "Advance", "the", "time", "reference", "so", "that", "now", "is", "the", "given", "timestamp", "." ]
0fef71f45ce467f3112f6f9eea18272162f46447
https://github.com/astralblue/asynciotimemachine/blob/0fef71f45ce467f3112f6f9eea18272162f46447/asynciotimemachine.py#L38-L49
train
59,064
jpatrickdill/faste
faste/caches.py
LFUCache.reset_frequencies
def reset_frequencies(self, frequency=0): """Resets all stored frequencies for the cache :keyword int frequency: Frequency to reset to, must be >= 0""" frequency = max(frequency, 0) for key in self._store.keys(): self._store[key] = (self._store[key][0], frequency) ...
python
def reset_frequencies(self, frequency=0): """Resets all stored frequencies for the cache :keyword int frequency: Frequency to reset to, must be >= 0""" frequency = max(frequency, 0) for key in self._store.keys(): self._store[key] = (self._store[key][0], frequency) ...
[ "def", "reset_frequencies", "(", "self", ",", "frequency", "=", "0", ")", ":", "frequency", "=", "max", "(", "frequency", ",", "0", ")", "for", "key", "in", "self", ".", "_store", ".", "keys", "(", ")", ":", "self", ".", "_store", "[", "key", "]", ...
Resets all stored frequencies for the cache :keyword int frequency: Frequency to reset to, must be >= 0
[ "Resets", "all", "stored", "frequencies", "for", "the", "cache" ]
9d2ec1a670bc8d9889c3982d423c49d149f13dae
https://github.com/jpatrickdill/faste/blob/9d2ec1a670bc8d9889c3982d423c49d149f13dae/faste/caches.py#L427-L437
train
59,065
jpatrickdill/faste
faste/caches.py
TimeoutCache.oldest
def oldest(self): """ Gets key, value pair for oldest item in cache :returns: tuple """ if len(self._store) == 0: return kv = min(self._store.items(), key=lambda x: x[1][1]) return kv[0], kv[1][0]
python
def oldest(self): """ Gets key, value pair for oldest item in cache :returns: tuple """ if len(self._store) == 0: return kv = min(self._store.items(), key=lambda x: x[1][1]) return kv[0], kv[1][0]
[ "def", "oldest", "(", "self", ")", ":", "if", "len", "(", "self", ".", "_store", ")", "==", "0", ":", "return", "kv", "=", "min", "(", "self", ".", "_store", ".", "items", "(", ")", ",", "key", "=", "lambda", "x", ":", "x", "[", "1", "]", "...
Gets key, value pair for oldest item in cache :returns: tuple
[ "Gets", "key", "value", "pair", "for", "oldest", "item", "in", "cache" ]
9d2ec1a670bc8d9889c3982d423c49d149f13dae
https://github.com/jpatrickdill/faste/blob/9d2ec1a670bc8d9889c3982d423c49d149f13dae/faste/caches.py#L543-L554
train
59,066
bernii/querystring-parser
querystring_parser/parser.py
parser_helper
def parser_helper(key, val): ''' Helper for parser function @param key: @param val: ''' start_bracket = key.find("[") end_bracket = key.find("]") pdict = {} if has_variable_name(key): # var['key'][3] pdict[key[:key.find("[")]] = parser_helper(key[start_bracket:], v...
python
def parser_helper(key, val): ''' Helper for parser function @param key: @param val: ''' start_bracket = key.find("[") end_bracket = key.find("]") pdict = {} if has_variable_name(key): # var['key'][3] pdict[key[:key.find("[")]] = parser_helper(key[start_bracket:], v...
[ "def", "parser_helper", "(", "key", ",", "val", ")", ":", "start_bracket", "=", "key", ".", "find", "(", "\"[\"", ")", "end_bracket", "=", "key", ".", "find", "(", "\"]\"", ")", "pdict", "=", "{", "}", "if", "has_variable_name", "(", "key", ")", ":",...
Helper for parser function @param key: @param val:
[ "Helper", "for", "parser", "function" ]
1d3b652512d55622a37b5f5712909ea41490454b
https://github.com/bernii/querystring-parser/blob/1d3b652512d55622a37b5f5712909ea41490454b/querystring_parser/parser.py#L88-L113
train
59,067
bernii/querystring-parser
querystring_parser/parser.py
parse
def parse(query_string, unquote=True, normalized=False, encoding=DEFAULT_ENCODING): ''' Main parse function @param query_string: @param unquote: unquote html query string ? @param encoding: An optional encoding used to decode the keys and values. Defaults to utf-8, which the W3C declares as a d...
python
def parse(query_string, unquote=True, normalized=False, encoding=DEFAULT_ENCODING): ''' Main parse function @param query_string: @param unquote: unquote html query string ? @param encoding: An optional encoding used to decode the keys and values. Defaults to utf-8, which the W3C declares as a d...
[ "def", "parse", "(", "query_string", ",", "unquote", "=", "True", ",", "normalized", "=", "False", ",", "encoding", "=", "DEFAULT_ENCODING", ")", ":", "mydict", "=", "{", "}", "plist", "=", "[", "]", "if", "query_string", "==", "\"\"", ":", "return", "...
Main parse function @param query_string: @param unquote: unquote html query string ? @param encoding: An optional encoding used to decode the keys and values. Defaults to utf-8, which the W3C declares as a defaul in the W3C algorithm for encoding. @see http://www.w3.org/TR/html5/forms.html#applicati...
[ "Main", "parse", "function" ]
1d3b652512d55622a37b5f5712909ea41490454b
https://github.com/bernii/querystring-parser/blob/1d3b652512d55622a37b5f5712909ea41490454b/querystring_parser/parser.py#L115-L166
train
59,068
striglia/pyramid_swagger
pyramid_swagger/spec.py
validate_swagger_schema
def validate_swagger_schema(schema_dir, resource_listing): """Validate the structure of Swagger schemas against the spec. **Valid only for Swagger v1.2 spec** Note: It is possible that resource_listing is not present in the schema_dir. The path is passed in the call so that ssv can fetch the api-d...
python
def validate_swagger_schema(schema_dir, resource_listing): """Validate the structure of Swagger schemas against the spec. **Valid only for Swagger v1.2 spec** Note: It is possible that resource_listing is not present in the schema_dir. The path is passed in the call so that ssv can fetch the api-d...
[ "def", "validate_swagger_schema", "(", "schema_dir", ",", "resource_listing", ")", ":", "schema_filepath", "=", "os", ".", "path", ".", "join", "(", "schema_dir", ",", "API_DOCS_FILENAME", ")", "swagger_spec_validator", ".", "validator12", ".", "validate_spec", "(",...
Validate the structure of Swagger schemas against the spec. **Valid only for Swagger v1.2 spec** Note: It is possible that resource_listing is not present in the schema_dir. The path is passed in the call so that ssv can fetch the api-declaration files from the path. :param resource_listing: Swag...
[ "Validate", "the", "structure", "of", "Swagger", "schemas", "against", "the", "spec", "." ]
1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45
https://github.com/striglia/pyramid_swagger/blob/1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45/pyramid_swagger/spec.py#L18-L37
train
59,069
striglia/pyramid_swagger
pyramid_swagger/load_schema.py
build_param_schema
def build_param_schema(schema, param_type): """Turn a swagger endpoint schema into an equivalent one to validate our request. As an example, this would take this swagger schema: { "paramType": "query", "name": "query", "description": "Location to query", ...
python
def build_param_schema(schema, param_type): """Turn a swagger endpoint schema into an equivalent one to validate our request. As an example, this would take this swagger schema: { "paramType": "query", "name": "query", "description": "Location to query", ...
[ "def", "build_param_schema", "(", "schema", ",", "param_type", ")", ":", "properties", "=", "filter_params_by_type", "(", "schema", ",", "param_type", ")", "if", "not", "properties", ":", "return", "# Generate a jsonschema that describes the set of all query parameters. We"...
Turn a swagger endpoint schema into an equivalent one to validate our request. As an example, this would take this swagger schema: { "paramType": "query", "name": "query", "description": "Location to query", "type": "string", "required": true ...
[ "Turn", "a", "swagger", "endpoint", "schema", "into", "an", "equivalent", "one", "to", "validate", "our", "request", "." ]
1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45
https://github.com/striglia/pyramid_swagger/blob/1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45/pyramid_swagger/load_schema.py#L28-L65
train
59,070
striglia/pyramid_swagger
pyramid_swagger/load_schema.py
required_validator
def required_validator(validator, req, instance, schema): """Swagger 1.2 expects `required` to be a bool in the Parameter object, but a list of properties in a Model object. """ if schema.get('paramType'): if req is True and not instance: return [ValidationError("%s is required" % sc...
python
def required_validator(validator, req, instance, schema): """Swagger 1.2 expects `required` to be a bool in the Parameter object, but a list of properties in a Model object. """ if schema.get('paramType'): if req is True and not instance: return [ValidationError("%s is required" % sc...
[ "def", "required_validator", "(", "validator", ",", "req", ",", "instance", ",", "schema", ")", ":", "if", "schema", ".", "get", "(", "'paramType'", ")", ":", "if", "req", "is", "True", "and", "not", "instance", ":", "return", "[", "ValidationError", "("...
Swagger 1.2 expects `required` to be a bool in the Parameter object, but a list of properties in a Model object.
[ "Swagger", "1", ".", "2", "expects", "required", "to", "be", "a", "bool", "in", "the", "Parameter", "object", "but", "a", "list", "of", "properties", "in", "a", "Model", "object", "." ]
1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45
https://github.com/striglia/pyramid_swagger/blob/1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45/pyramid_swagger/load_schema.py#L103-L111
train
59,071
striglia/pyramid_swagger
pyramid_swagger/load_schema.py
load_schema
def load_schema(schema_path): """Prepare the api specification for request and response validation. :returns: a mapping from :class:`RequestMatcher` to :class:`ValidatorMap` for every operation in the api specification. :rtype: dict """ with open(schema_path, 'r') as schema_file: sc...
python
def load_schema(schema_path): """Prepare the api specification for request and response validation. :returns: a mapping from :class:`RequestMatcher` to :class:`ValidatorMap` for every operation in the api specification. :rtype: dict """ with open(schema_path, 'r') as schema_file: sc...
[ "def", "load_schema", "(", "schema_path", ")", ":", "with", "open", "(", "schema_path", ",", "'r'", ")", "as", "schema_file", ":", "schema", "=", "simplejson", ".", "load", "(", "schema_file", ")", "resolver", "=", "RefResolver", "(", "''", ",", "''", ",...
Prepare the api specification for request and response validation. :returns: a mapping from :class:`RequestMatcher` to :class:`ValidatorMap` for every operation in the api specification. :rtype: dict
[ "Prepare", "the", "api", "specification", "for", "request", "and", "response", "validation", "." ]
1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45
https://github.com/striglia/pyramid_swagger/blob/1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45/pyramid_swagger/load_schema.py#L269-L279
train
59,072
striglia/pyramid_swagger
pyramid_swagger/tween.py
get_swagger_objects
def get_swagger_objects(settings, route_info, registry): """Returns appropriate swagger handler and swagger spec schema. Swagger Handler contains callables that isolate implementation differences in the tween to handle both Swagger 1.2 and Swagger 2.0. Exception is made when `settings.prefer_20_routes...
python
def get_swagger_objects(settings, route_info, registry): """Returns appropriate swagger handler and swagger spec schema. Swagger Handler contains callables that isolate implementation differences in the tween to handle both Swagger 1.2 and Swagger 2.0. Exception is made when `settings.prefer_20_routes...
[ "def", "get_swagger_objects", "(", "settings", ",", "route_info", ",", "registry", ")", ":", "enabled_swagger_versions", "=", "get_swagger_versions", "(", "registry", ".", "settings", ")", "schema12", "=", "registry", ".", "settings", "[", "'pyramid_swagger.schema12'"...
Returns appropriate swagger handler and swagger spec schema. Swagger Handler contains callables that isolate implementation differences in the tween to handle both Swagger 1.2 and Swagger 2.0. Exception is made when `settings.prefer_20_routes` are non-empty and ['1.2', '2.0'] both are present in avail...
[ "Returns", "appropriate", "swagger", "handler", "and", "swagger", "spec", "schema", "." ]
1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45
https://github.com/striglia/pyramid_swagger/blob/1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45/pyramid_swagger/tween.py#L107-L141
train
59,073
striglia/pyramid_swagger
pyramid_swagger/tween.py
validation_tween_factory
def validation_tween_factory(handler, registry): """Pyramid tween for performing validation. Note this is very simple -- it validates requests, responses, and paths while delegating to the relevant matching view. """ settings = load_settings(registry) route_mapper = registry.queryUtility(IRoute...
python
def validation_tween_factory(handler, registry): """Pyramid tween for performing validation. Note this is very simple -- it validates requests, responses, and paths while delegating to the relevant matching view. """ settings = load_settings(registry) route_mapper = registry.queryUtility(IRoute...
[ "def", "validation_tween_factory", "(", "handler", ",", "registry", ")", ":", "settings", "=", "load_settings", "(", "registry", ")", "route_mapper", "=", "registry", ".", "queryUtility", "(", "IRoutesMapper", ")", "validation_context", "=", "_get_validation_context",...
Pyramid tween for performing validation. Note this is very simple -- it validates requests, responses, and paths while delegating to the relevant matching view.
[ "Pyramid", "tween", "for", "performing", "validation", "." ]
1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45
https://github.com/striglia/pyramid_swagger/blob/1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45/pyramid_swagger/tween.py#L144-L201
train
59,074
striglia/pyramid_swagger
pyramid_swagger/tween.py
handle_request
def handle_request(request, validator_map, **kwargs): """Validate the request against the swagger spec and return a dict with all parameter values available in the request, casted to the expected python type. :param request: a :class:`PyramidSwaggerRequest` to validate :param validator_map: a :clas...
python
def handle_request(request, validator_map, **kwargs): """Validate the request against the swagger spec and return a dict with all parameter values available in the request, casted to the expected python type. :param request: a :class:`PyramidSwaggerRequest` to validate :param validator_map: a :clas...
[ "def", "handle_request", "(", "request", ",", "validator_map", ",", "*", "*", "kwargs", ")", ":", "request_data", "=", "{", "}", "validation_pairs", "=", "[", "]", "for", "validator", ",", "values", "in", "[", "(", "validator_map", ".", "query", ",", "re...
Validate the request against the swagger spec and return a dict with all parameter values available in the request, casted to the expected python type. :param request: a :class:`PyramidSwaggerRequest` to validate :param validator_map: a :class:`pyramid_swagger.load_schema.ValidatorMap` used to ...
[ "Validate", "the", "request", "against", "the", "swagger", "spec", "and", "return", "a", "dict", "with", "all", "parameter", "values", "available", "in", "the", "request", "casted", "to", "the", "expected", "python", "type", "." ]
1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45
https://github.com/striglia/pyramid_swagger/blob/1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45/pyramid_swagger/tween.py#L328-L363
train
59,075
striglia/pyramid_swagger
pyramid_swagger/tween.py
build_swagger12_handler
def build_swagger12_handler(schema): """Builds a swagger12 handler or returns None if no schema is present. :type schema: :class:`pyramid_swagger.model.SwaggerSchema` :rtype: :class:`SwaggerHandler` or None """ if schema: return SwaggerHandler( op_for_request=schema.validators_f...
python
def build_swagger12_handler(schema): """Builds a swagger12 handler or returns None if no schema is present. :type schema: :class:`pyramid_swagger.model.SwaggerSchema` :rtype: :class:`SwaggerHandler` or None """ if schema: return SwaggerHandler( op_for_request=schema.validators_f...
[ "def", "build_swagger12_handler", "(", "schema", ")", ":", "if", "schema", ":", "return", "SwaggerHandler", "(", "op_for_request", "=", "schema", ".", "validators_for_request", ",", "handle_request", "=", "handle_request", ",", "handle_response", "=", "validate_respon...
Builds a swagger12 handler or returns None if no schema is present. :type schema: :class:`pyramid_swagger.model.SwaggerSchema` :rtype: :class:`SwaggerHandler` or None
[ "Builds", "a", "swagger12", "handler", "or", "returns", "None", "if", "no", "schema", "is", "present", "." ]
1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45
https://github.com/striglia/pyramid_swagger/blob/1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45/pyramid_swagger/tween.py#L404-L415
train
59,076
striglia/pyramid_swagger
pyramid_swagger/tween.py
validate_response
def validate_response(response, validator_map): """Validates response against our schemas. :param response: the response object to validate :type response: :class:`pyramid.response.Response` :type validator_map: :class:`pyramid_swagger.load_schema.ValidatorMap` """ validator = validator_map.res...
python
def validate_response(response, validator_map): """Validates response against our schemas. :param response: the response object to validate :type response: :class:`pyramid.response.Response` :type validator_map: :class:`pyramid_swagger.load_schema.ValidatorMap` """ validator = validator_map.res...
[ "def", "validate_response", "(", "response", ",", "validator_map", ")", ":", "validator", "=", "validator_map", ".", "response", "# Short circuit if we are supposed to not validate anything.", "returns_nothing", "=", "validator", ".", "schema", ".", "get", "(", "'type'", ...
Validates response against our schemas. :param response: the response object to validate :type response: :class:`pyramid.response.Response` :type validator_map: :class:`pyramid_swagger.load_schema.ValidatorMap`
[ "Validates", "response", "against", "our", "schemas", "." ]
1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45
https://github.com/striglia/pyramid_swagger/blob/1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45/pyramid_swagger/tween.py#L542-L561
train
59,077
striglia/pyramid_swagger
pyramid_swagger/tween.py
swaggerize_response
def swaggerize_response(response, op): """ Delegate handling the Swagger concerns of the response to bravado-core. :type response: :class:`pyramid.response.Response` :type op: :class:`bravado_core.operation.Operation` """ response_spec = get_response_spec(response.status_int, op) bravado_co...
python
def swaggerize_response(response, op): """ Delegate handling the Swagger concerns of the response to bravado-core. :type response: :class:`pyramid.response.Response` :type op: :class:`bravado_core.operation.Operation` """ response_spec = get_response_spec(response.status_int, op) bravado_co...
[ "def", "swaggerize_response", "(", "response", ",", "op", ")", ":", "response_spec", "=", "get_response_spec", "(", "response", ".", "status_int", ",", "op", ")", "bravado_core", ".", "response", ".", "validate_response", "(", "response_spec", ",", "op", ",", ...
Delegate handling the Swagger concerns of the response to bravado-core. :type response: :class:`pyramid.response.Response` :type op: :class:`bravado_core.operation.Operation`
[ "Delegate", "handling", "the", "Swagger", "concerns", "of", "the", "response", "to", "bravado", "-", "core", "." ]
1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45
https://github.com/striglia/pyramid_swagger/blob/1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45/pyramid_swagger/tween.py#L592-L601
train
59,078
striglia/pyramid_swagger
pyramid_swagger/tween.py
get_op_for_request
def get_op_for_request(request, route_info, spec): """ Find out which operation in the Swagger schema corresponds to the given pyramid request. :type request: :class:`pyramid.request.Request` :type route_info: dict (usually has 'match' and 'route' keys) :type spec: :class:`bravado_core.spec.Spe...
python
def get_op_for_request(request, route_info, spec): """ Find out which operation in the Swagger schema corresponds to the given pyramid request. :type request: :class:`pyramid.request.Request` :type route_info: dict (usually has 'match' and 'route' keys) :type spec: :class:`bravado_core.spec.Spe...
[ "def", "get_op_for_request", "(", "request", ",", "route_info", ",", "spec", ")", ":", "# pyramid.urldispath.Route", "route", "=", "route_info", "[", "'route'", "]", "if", "hasattr", "(", "route", ",", "'path'", ")", ":", "route_path", "=", "route", ".", "pa...
Find out which operation in the Swagger schema corresponds to the given pyramid request. :type request: :class:`pyramid.request.Request` :type route_info: dict (usually has 'match' and 'route' keys) :type spec: :class:`bravado_core.spec.Spec` :rtype: :class:`bravado_core.operation.Operation` :r...
[ "Find", "out", "which", "operation", "in", "the", "Swagger", "schema", "corresponds", "to", "the", "given", "pyramid", "request", "." ]
1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45
https://github.com/striglia/pyramid_swagger/blob/1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45/pyramid_swagger/tween.py#L604-L634
train
59,079
striglia/pyramid_swagger
pyramid_swagger/tween.py
get_swagger_versions
def get_swagger_versions(settings): """ Validates and returns the versions of the Swagger Spec that this pyramid application supports. :type settings: dict :return: list of strings. eg ['1.2', '2.0'] :raises: ValueError when an unsupported Swagger version is encountered. """ swagger_ver...
python
def get_swagger_versions(settings): """ Validates and returns the versions of the Swagger Spec that this pyramid application supports. :type settings: dict :return: list of strings. eg ['1.2', '2.0'] :raises: ValueError when an unsupported Swagger version is encountered. """ swagger_ver...
[ "def", "get_swagger_versions", "(", "settings", ")", ":", "swagger_versions", "=", "set", "(", "aslist", "(", "settings", ".", "get", "(", "'pyramid_swagger.swagger_versions'", ",", "DEFAULT_SWAGGER_VERSIONS", ")", ")", ")", "if", "len", "(", "swagger_versions", "...
Validates and returns the versions of the Swagger Spec that this pyramid application supports. :type settings: dict :return: list of strings. eg ['1.2', '2.0'] :raises: ValueError when an unsupported Swagger version is encountered.
[ "Validates", "and", "returns", "the", "versions", "of", "the", "Swagger", "Spec", "that", "this", "pyramid", "application", "supports", "." ]
1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45
https://github.com/striglia/pyramid_swagger/blob/1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45/pyramid_swagger/tween.py#L637-L656
train
59,080
striglia/pyramid_swagger
pyramid_swagger/api.py
register_api_doc_endpoints
def register_api_doc_endpoints(config, endpoints, base_path='/api-docs'): """Create and register pyramid endpoints to service swagger api docs. Routes and views will be registered on the `config` at `path`. :param config: a pyramid configuration to register the new views and routes :type config: :clas...
python
def register_api_doc_endpoints(config, endpoints, base_path='/api-docs'): """Create and register pyramid endpoints to service swagger api docs. Routes and views will be registered on the `config` at `path`. :param config: a pyramid configuration to register the new views and routes :type config: :clas...
[ "def", "register_api_doc_endpoints", "(", "config", ",", "endpoints", ",", "base_path", "=", "'/api-docs'", ")", ":", "for", "endpoint", "in", "endpoints", ":", "path", "=", "base_path", ".", "rstrip", "(", "'/'", ")", "+", "endpoint", ".", "path", "config",...
Create and register pyramid endpoints to service swagger api docs. Routes and views will be registered on the `config` at `path`. :param config: a pyramid configuration to register the new views and routes :type config: :class:`pyramid.config.Configurator` :param endpoints: a list of endpoints to regi...
[ "Create", "and", "register", "pyramid", "endpoints", "to", "service", "swagger", "api", "docs", ".", "Routes", "and", "views", "will", "be", "registered", "on", "the", "config", "at", "path", "." ]
1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45
https://github.com/striglia/pyramid_swagger/blob/1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45/pyramid_swagger/api.py#L19-L37
train
59,081
striglia/pyramid_swagger
pyramid_swagger/api.py
build_swagger_12_api_declaration_view
def build_swagger_12_api_declaration_view(api_declaration_json): """Thanks to the magic of closures, this means we gracefully return JSON without file IO at request time. """ def view_for_api_declaration(request): # Note that we rewrite basePath to always point at this server's root. ret...
python
def build_swagger_12_api_declaration_view(api_declaration_json): """Thanks to the magic of closures, this means we gracefully return JSON without file IO at request time. """ def view_for_api_declaration(request): # Note that we rewrite basePath to always point at this server's root. ret...
[ "def", "build_swagger_12_api_declaration_view", "(", "api_declaration_json", ")", ":", "def", "view_for_api_declaration", "(", "request", ")", ":", "# Note that we rewrite basePath to always point at this server's root.", "return", "dict", "(", "api_declaration_json", ",", "baseP...
Thanks to the magic of closures, this means we gracefully return JSON without file IO at request time.
[ "Thanks", "to", "the", "magic", "of", "closures", "this", "means", "we", "gracefully", "return", "JSON", "without", "file", "IO", "at", "request", "time", "." ]
1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45
https://github.com/striglia/pyramid_swagger/blob/1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45/pyramid_swagger/api.py#L93-L103
train
59,082
striglia/pyramid_swagger
pyramid_swagger/model.py
partial_path_match
def partial_path_match(path1, path2, kwarg_re=r'\{.*\}'): """Validates if path1 and path2 matches, ignoring any kwargs in the string. We need this to ensure we can match Swagger patterns like: /foo/{id} against the observed pyramid path /foo/1 :param path1: path of a url :type path...
python
def partial_path_match(path1, path2, kwarg_re=r'\{.*\}'): """Validates if path1 and path2 matches, ignoring any kwargs in the string. We need this to ensure we can match Swagger patterns like: /foo/{id} against the observed pyramid path /foo/1 :param path1: path of a url :type path...
[ "def", "partial_path_match", "(", "path1", ",", "path2", ",", "kwarg_re", "=", "r'\\{.*\\}'", ")", ":", "split_p1", "=", "path1", ".", "split", "(", "'/'", ")", "split_p2", "=", "path2", ".", "split", "(", "'/'", ")", "pat", "=", "re", ".", "compile", ...
Validates if path1 and path2 matches, ignoring any kwargs in the string. We need this to ensure we can match Swagger patterns like: /foo/{id} against the observed pyramid path /foo/1 :param path1: path of a url :type path1: string :param path2: path of a url :type path2: string...
[ "Validates", "if", "path1", "and", "path2", "matches", "ignoring", "any", "kwargs", "in", "the", "string", "." ]
1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45
https://github.com/striglia/pyramid_swagger/blob/1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45/pyramid_swagger/model.py#L61-L87
train
59,083
striglia/pyramid_swagger
pyramid_swagger/model.py
SwaggerSchema.validators_for_request
def validators_for_request(self, request, **kwargs): """Takes a request and returns a validator mapping for the request. :param request: A Pyramid request to fetch schemas for :type request: :class:`pyramid.request.Request` :returns: a :class:`pyramid_swagger.load_schema.ValidatorMap` w...
python
def validators_for_request(self, request, **kwargs): """Takes a request and returns a validator mapping for the request. :param request: A Pyramid request to fetch schemas for :type request: :class:`pyramid.request.Request` :returns: a :class:`pyramid_swagger.load_schema.ValidatorMap` w...
[ "def", "validators_for_request", "(", "self", ",", "request", ",", "*", "*", "kwargs", ")", ":", "for", "resource_validator", "in", "self", ".", "resource_validators", ":", "for", "matcher", ",", "validator_map", "in", "resource_validator", ".", "items", "(", ...
Takes a request and returns a validator mapping for the request. :param request: A Pyramid request to fetch schemas for :type request: :class:`pyramid.request.Request` :returns: a :class:`pyramid_swagger.load_schema.ValidatorMap` which can be used to validate `request`
[ "Takes", "a", "request", "and", "returns", "a", "validator", "mapping", "for", "the", "request", "." ]
1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45
https://github.com/striglia/pyramid_swagger/blob/1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45/pyramid_swagger/model.py#L39-L55
train
59,084
striglia/pyramid_swagger
pyramid_swagger/ingest.py
build_schema_mapping
def build_schema_mapping(schema_dir, resource_listing): """Discovers schema file locations and relations. :param schema_dir: the directory schema files live inside :type schema_dir: string :param resource_listing: A swagger resource listing :type resource_listing: dict :returns: a mapping from...
python
def build_schema_mapping(schema_dir, resource_listing): """Discovers schema file locations and relations. :param schema_dir: the directory schema files live inside :type schema_dir: string :param resource_listing: A swagger resource listing :type resource_listing: dict :returns: a mapping from...
[ "def", "build_schema_mapping", "(", "schema_dir", ",", "resource_listing", ")", ":", "def", "resource_name_to_filepath", "(", "name", ")", ":", "return", "os", ".", "path", ".", "join", "(", "schema_dir", ",", "'{0}.json'", ".", "format", "(", "name", ")", "...
Discovers schema file locations and relations. :param schema_dir: the directory schema files live inside :type schema_dir: string :param resource_listing: A swagger resource listing :type resource_listing: dict :returns: a mapping from resource name to file path :rtype: dict
[ "Discovers", "schema", "file", "locations", "and", "relations", "." ]
1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45
https://github.com/striglia/pyramid_swagger/blob/1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45/pyramid_swagger/ingest.py#L63-L79
train
59,085
striglia/pyramid_swagger
pyramid_swagger/ingest.py
_load_resource_listing
def _load_resource_listing(resource_listing): """Load the resource listing from file, handling errors. :param resource_listing: path to the api-docs resource listing file :type resource_listing: string :returns: contents of the resource listing file :rtype: dict """ try: with open(...
python
def _load_resource_listing(resource_listing): """Load the resource listing from file, handling errors. :param resource_listing: path to the api-docs resource listing file :type resource_listing: string :returns: contents of the resource listing file :rtype: dict """ try: with open(...
[ "def", "_load_resource_listing", "(", "resource_listing", ")", ":", "try", ":", "with", "open", "(", "resource_listing", ")", "as", "resource_listing_file", ":", "return", "simplejson", ".", "load", "(", "resource_listing_file", ")", "# If not found, raise a more user-f...
Load the resource listing from file, handling errors. :param resource_listing: path to the api-docs resource listing file :type resource_listing: string :returns: contents of the resource listing file :rtype: dict
[ "Load", "the", "resource", "listing", "from", "file", "handling", "errors", "." ]
1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45
https://github.com/striglia/pyramid_swagger/blob/1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45/pyramid_swagger/ingest.py#L82-L98
train
59,086
striglia/pyramid_swagger
pyramid_swagger/ingest.py
get_resource_listing
def get_resource_listing(schema_dir, should_generate_resource_listing): """Return the resource listing document. :param schema_dir: the directory which contains swagger spec files :type schema_dir: string :param should_generate_resource_listing: when True a resource listing will be generated f...
python
def get_resource_listing(schema_dir, should_generate_resource_listing): """Return the resource listing document. :param schema_dir: the directory which contains swagger spec files :type schema_dir: string :param should_generate_resource_listing: when True a resource listing will be generated f...
[ "def", "get_resource_listing", "(", "schema_dir", ",", "should_generate_resource_listing", ")", ":", "listing_filename", "=", "os", ".", "path", ".", "join", "(", "schema_dir", ",", "API_DOCS_FILENAME", ")", "resource_listing", "=", "_load_resource_listing", "(", "lis...
Return the resource listing document. :param schema_dir: the directory which contains swagger spec files :type schema_dir: string :param should_generate_resource_listing: when True a resource listing will be generated from the list of *.json files in the schema_dir. Otherwise return the co...
[ "Return", "the", "resource", "listing", "document", "." ]
1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45
https://github.com/striglia/pyramid_swagger/blob/1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45/pyramid_swagger/ingest.py#L113-L129
train
59,087
striglia/pyramid_swagger
pyramid_swagger/ingest.py
compile_swagger_schema
def compile_swagger_schema(schema_dir, resource_listing): """Build a SwaggerSchema from various files. :param schema_dir: the directory schema files live inside :type schema_dir: string :returns: a SwaggerSchema object """ mapping = build_schema_mapping(schema_dir, resource_listing) resourc...
python
def compile_swagger_schema(schema_dir, resource_listing): """Build a SwaggerSchema from various files. :param schema_dir: the directory schema files live inside :type schema_dir: string :returns: a SwaggerSchema object """ mapping = build_schema_mapping(schema_dir, resource_listing) resourc...
[ "def", "compile_swagger_schema", "(", "schema_dir", ",", "resource_listing", ")", ":", "mapping", "=", "build_schema_mapping", "(", "schema_dir", ",", "resource_listing", ")", "resource_validators", "=", "ingest_resources", "(", "mapping", ",", "schema_dir", ")", "end...
Build a SwaggerSchema from various files. :param schema_dir: the directory schema files live inside :type schema_dir: string :returns: a SwaggerSchema object
[ "Build", "a", "SwaggerSchema", "from", "various", "files", "." ]
1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45
https://github.com/striglia/pyramid_swagger/blob/1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45/pyramid_swagger/ingest.py#L132-L142
train
59,088
striglia/pyramid_swagger
pyramid_swagger/ingest.py
create_bravado_core_config
def create_bravado_core_config(settings): """Create a configuration dict for bravado_core based on pyramid_swagger settings. :param settings: pyramid registry settings with configuration for building a swagger schema :type settings: dict :returns: config dict suitable for passing into ...
python
def create_bravado_core_config(settings): """Create a configuration dict for bravado_core based on pyramid_swagger settings. :param settings: pyramid registry settings with configuration for building a swagger schema :type settings: dict :returns: config dict suitable for passing into ...
[ "def", "create_bravado_core_config", "(", "settings", ")", ":", "# Map pyramid_swagger config key -> bravado_core config key", "config_keys", "=", "{", "'pyramid_swagger.enable_request_validation'", ":", "'validate_requests'", ",", "'pyramid_swagger.enable_response_validation'", ":", ...
Create a configuration dict for bravado_core based on pyramid_swagger settings. :param settings: pyramid registry settings with configuration for building a swagger schema :type settings: dict :returns: config dict suitable for passing into bravado_core.spec.Spec.from_dict(..) :rtyp...
[ "Create", "a", "configuration", "dict", "for", "bravado_core", "based", "on", "pyramid_swagger", "settings", "." ]
1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45
https://github.com/striglia/pyramid_swagger/blob/1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45/pyramid_swagger/ingest.py#L195-L244
train
59,089
striglia/pyramid_swagger
pyramid_swagger/ingest.py
ingest_resources
def ingest_resources(mapping, schema_dir): """Consume the Swagger schemas and produce a queryable datastructure. :param mapping: Map from resource name to filepath of its api declaration :type mapping: dict :param schema_dir: the directory schema files live inside :type schema_dir: string :retu...
python
def ingest_resources(mapping, schema_dir): """Consume the Swagger schemas and produce a queryable datastructure. :param mapping: Map from resource name to filepath of its api declaration :type mapping: dict :param schema_dir: the directory schema files live inside :type schema_dir: string :retu...
[ "def", "ingest_resources", "(", "mapping", ",", "schema_dir", ")", ":", "ingested_resources", "=", "[", "]", "for", "name", ",", "filepath", "in", "iteritems", "(", "mapping", ")", ":", "try", ":", "ingested_resources", ".", "append", "(", "load_schema", "("...
Consume the Swagger schemas and produce a queryable datastructure. :param mapping: Map from resource name to filepath of its api declaration :type mapping: dict :param schema_dir: the directory schema files live inside :type schema_dir: string :returns: A list of mapping from :class:`RequestMatcher...
[ "Consume", "the", "Swagger", "schemas", "and", "produce", "a", "queryable", "datastructure", "." ]
1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45
https://github.com/striglia/pyramid_swagger/blob/1dbc0b4f23e2e5f4ed575c116f3f7d0e83e30d45/pyramid_swagger/ingest.py#L247-L270
train
59,090
nco/pynco
nco/nco.py
Nco.read_array
def read_array(self, infile, var_name): """Directly return a numpy array for a given variable name""" file_handle = self.read_cdf(infile) try: # return the data array return file_handle.variables[var_name][:] except KeyError: print("Cannot find variabl...
python
def read_array(self, infile, var_name): """Directly return a numpy array for a given variable name""" file_handle = self.read_cdf(infile) try: # return the data array return file_handle.variables[var_name][:] except KeyError: print("Cannot find variabl...
[ "def", "read_array", "(", "self", ",", "infile", ",", "var_name", ")", ":", "file_handle", "=", "self", ".", "read_cdf", "(", "infile", ")", "try", ":", "# return the data array", "return", "file_handle", ".", "variables", "[", "var_name", "]", "[", ":", "...
Directly return a numpy array for a given variable name
[ "Directly", "return", "a", "numpy", "array", "for", "a", "given", "variable", "name" ]
4161de9755b531825e83f684c964441bff9ffa7d
https://github.com/nco/pynco/blob/4161de9755b531825e83f684c964441bff9ffa7d/nco/nco.py#L493-L501
train
59,091
nco/pynco
nco/nco.py
Nco.read_ma_array
def read_ma_array(self, infile, var_name): """Create a masked array based on cdf's FillValue""" file_obj = self.read_cdf(infile) # .data is not backwards compatible to old scipy versions, [:] is data = file_obj.variables[var_name][:] # load numpy if available try: ...
python
def read_ma_array(self, infile, var_name): """Create a masked array based on cdf's FillValue""" file_obj = self.read_cdf(infile) # .data is not backwards compatible to old scipy versions, [:] is data = file_obj.variables[var_name][:] # load numpy if available try: ...
[ "def", "read_ma_array", "(", "self", ",", "infile", ",", "var_name", ")", ":", "file_obj", "=", "self", ".", "read_cdf", "(", "infile", ")", "# .data is not backwards compatible to old scipy versions, [:] is", "data", "=", "file_obj", ".", "variables", "[", "var_nam...
Create a masked array based on cdf's FillValue
[ "Create", "a", "masked", "array", "based", "on", "cdf", "s", "FillValue" ]
4161de9755b531825e83f684c964441bff9ffa7d
https://github.com/nco/pynco/blob/4161de9755b531825e83f684c964441bff9ffa7d/nco/nco.py#L503-L524
train
59,092
vbwagner/ctypescrypto
ctypescrypto/mac.py
MAC.digest
def digest(self,data=None): """ Method digest is redefined to return keyed MAC value instead of just digest. """ if data is not None: self.update(data) b=create_string_buffer(256) size=c_size_t(256) if libcrypto.EVP_DigestSignFinal(self.ctx,b,p...
python
def digest(self,data=None): """ Method digest is redefined to return keyed MAC value instead of just digest. """ if data is not None: self.update(data) b=create_string_buffer(256) size=c_size_t(256) if libcrypto.EVP_DigestSignFinal(self.ctx,b,p...
[ "def", "digest", "(", "self", ",", "data", "=", "None", ")", ":", "if", "data", "is", "not", "None", ":", "self", ".", "update", "(", "data", ")", "b", "=", "create_string_buffer", "(", "256", ")", "size", "=", "c_size_t", "(", "256", ")", "if", ...
Method digest is redefined to return keyed MAC value instead of just digest.
[ "Method", "digest", "is", "redefined", "to", "return", "keyed", "MAC", "value", "instead", "of", "just", "digest", "." ]
33c32904cf5e04901f87f90e2499634b8feecd3e
https://github.com/vbwagner/ctypescrypto/blob/33c32904cf5e04901f87f90e2499634b8feecd3e/ctypescrypto/mac.py#L72-L84
train
59,093
vbwagner/ctypescrypto
ctypescrypto/rand.py
bytes
def bytes(num, check_result=False): """ Returns num bytes of cryptographically strong pseudo-random bytes. If checkc_result is True, raises error if PRNG is not seeded enough """ if num <= 0: raise ValueError("'num' should be > 0") buf = create_string_buffer(num) result = libcry...
python
def bytes(num, check_result=False): """ Returns num bytes of cryptographically strong pseudo-random bytes. If checkc_result is True, raises error if PRNG is not seeded enough """ if num <= 0: raise ValueError("'num' should be > 0") buf = create_string_buffer(num) result = libcry...
[ "def", "bytes", "(", "num", ",", "check_result", "=", "False", ")", ":", "if", "num", "<=", "0", ":", "raise", "ValueError", "(", "\"'num' should be > 0\"", ")", "buf", "=", "create_string_buffer", "(", "num", ")", "result", "=", "libcrypto", ".", "RAND_by...
Returns num bytes of cryptographically strong pseudo-random bytes. If checkc_result is True, raises error if PRNG is not seeded enough
[ "Returns", "num", "bytes", "of", "cryptographically", "strong", "pseudo", "-", "random", "bytes", ".", "If", "checkc_result", "is", "True", "raises", "error", "if", "PRNG", "is", "not", "seeded", "enough" ]
33c32904cf5e04901f87f90e2499634b8feecd3e
https://github.com/vbwagner/ctypescrypto/blob/33c32904cf5e04901f87f90e2499634b8feecd3e/ctypescrypto/rand.py#L15-L28
train
59,094
vbwagner/ctypescrypto
ctypescrypto/oid.py
create
def create(dotted, shortname, longname): """ Creates new OID in the database @param dotted - dotted-decimal representation of new OID @param shortname - short name for new OID @param longname - long name for new OID @returns Oid object corresponding to new OID This function should be used...
python
def create(dotted, shortname, longname): """ Creates new OID in the database @param dotted - dotted-decimal representation of new OID @param shortname - short name for new OID @param longname - long name for new OID @returns Oid object corresponding to new OID This function should be used...
[ "def", "create", "(", "dotted", ",", "shortname", ",", "longname", ")", ":", "if", "pyver", ">", "2", ":", "dotted", "=", "dotted", ".", "encode", "(", "'ascii'", ")", "shortname", "=", "shortname", ".", "encode", "(", "'utf-8'", ")", "longname", "=", ...
Creates new OID in the database @param dotted - dotted-decimal representation of new OID @param shortname - short name for new OID @param longname - long name for new OID @returns Oid object corresponding to new OID This function should be used with exreme care. Whenever possible, it is bette...
[ "Creates", "new", "OID", "in", "the", "database" ]
33c32904cf5e04901f87f90e2499634b8feecd3e
https://github.com/vbwagner/ctypescrypto/blob/33c32904cf5e04901f87f90e2499634b8feecd3e/ctypescrypto/oid.py#L125-L150
train
59,095
vbwagner/ctypescrypto
ctypescrypto/oid.py
Oid.dotted
def dotted(self): " Returns dotted-decimal reperesentation " obj = libcrypto.OBJ_nid2obj(self.nid) buf = create_string_buffer(256) libcrypto.OBJ_obj2txt(buf, 256, obj, 1) if pyver == 2: return buf.value else: return buf.value.decode('ascii')
python
def dotted(self): " Returns dotted-decimal reperesentation " obj = libcrypto.OBJ_nid2obj(self.nid) buf = create_string_buffer(256) libcrypto.OBJ_obj2txt(buf, 256, obj, 1) if pyver == 2: return buf.value else: return buf.value.decode('ascii')
[ "def", "dotted", "(", "self", ")", ":", "obj", "=", "libcrypto", ".", "OBJ_nid2obj", "(", "self", ".", "nid", ")", "buf", "=", "create_string_buffer", "(", "256", ")", "libcrypto", ".", "OBJ_obj2txt", "(", "buf", ",", "256", ",", "obj", ",", "1", ")"...
Returns dotted-decimal reperesentation
[ "Returns", "dotted", "-", "decimal", "reperesentation" ]
33c32904cf5e04901f87f90e2499634b8feecd3e
https://github.com/vbwagner/ctypescrypto/blob/33c32904cf5e04901f87f90e2499634b8feecd3e/ctypescrypto/oid.py#L99-L107
train
59,096
vbwagner/ctypescrypto
ctypescrypto/oid.py
Oid.fromobj
def fromobj(obj): """ Creates an OID object from the pointer to ASN1_OBJECT c structure. This method intended for internal use for submodules which deal with libcrypto ASN1 parsing functions, such as x509 or CMS """ nid = libcrypto.OBJ_obj2nid(obj) if nid == 0: ...
python
def fromobj(obj): """ Creates an OID object from the pointer to ASN1_OBJECT c structure. This method intended for internal use for submodules which deal with libcrypto ASN1 parsing functions, such as x509 or CMS """ nid = libcrypto.OBJ_obj2nid(obj) if nid == 0: ...
[ "def", "fromobj", "(", "obj", ")", ":", "nid", "=", "libcrypto", ".", "OBJ_obj2nid", "(", "obj", ")", "if", "nid", "==", "0", ":", "buf", "=", "create_string_buffer", "(", "80", ")", "dotted_len", "=", "libcrypto", ".", "OBJ_obj2txt", "(", "buf", ",", ...
Creates an OID object from the pointer to ASN1_OBJECT c structure. This method intended for internal use for submodules which deal with libcrypto ASN1 parsing functions, such as x509 or CMS
[ "Creates", "an", "OID", "object", "from", "the", "pointer", "to", "ASN1_OBJECT", "c", "structure", ".", "This", "method", "intended", "for", "internal", "use", "for", "submodules", "which", "deal", "with", "libcrypto", "ASN1", "parsing", "functions", "such", "...
33c32904cf5e04901f87f90e2499634b8feecd3e
https://github.com/vbwagner/ctypescrypto/blob/33c32904cf5e04901f87f90e2499634b8feecd3e/ctypescrypto/oid.py#L109-L123
train
59,097
vbwagner/ctypescrypto
ctypescrypto/pkey.py
_password_callback
def _password_callback(c): """ Converts given user function or string to C password callback function, passable to openssl. IF function is passed, it would be called upon reading or writing PEM format private key with one argument which is True if we are writing key and should verify passphrase...
python
def _password_callback(c): """ Converts given user function or string to C password callback function, passable to openssl. IF function is passed, it would be called upon reading or writing PEM format private key with one argument which is True if we are writing key and should verify passphrase...
[ "def", "_password_callback", "(", "c", ")", ":", "if", "c", "is", "None", ":", "return", "PW_CALLBACK_FUNC", "(", "0", ")", "if", "callable", "(", "c", ")", ":", "if", "pyver", "==", "2", ":", "def", "__cb", "(", "buf", ",", "length", ",", "rwflag"...
Converts given user function or string to C password callback function, passable to openssl. IF function is passed, it would be called upon reading or writing PEM format private key with one argument which is True if we are writing key and should verify passphrase and false if we are reading
[ "Converts", "given", "user", "function", "or", "string", "to", "C", "password", "callback", "function", "passable", "to", "openssl", "." ]
33c32904cf5e04901f87f90e2499634b8feecd3e
https://github.com/vbwagner/ctypescrypto/blob/33c32904cf5e04901f87f90e2499634b8feecd3e/ctypescrypto/pkey.py#L22-L54
train
59,098
vbwagner/ctypescrypto
ctypescrypto/pkey.py
PKey.verify
def verify(self, digest, signature, **kwargs): """ Verifies given signature on given digest Returns True if Ok, False if don't match Keyword arguments allows to set algorithm-specific parameters """ ctx = libcrypto.EVP_PKEY_CTX_new(self.key, None) if ctx i...
python
def verify(self, digest, signature, **kwargs): """ Verifies given signature on given digest Returns True if Ok, False if don't match Keyword arguments allows to set algorithm-specific parameters """ ctx = libcrypto.EVP_PKEY_CTX_new(self.key, None) if ctx i...
[ "def", "verify", "(", "self", ",", "digest", ",", "signature", ",", "*", "*", "kwargs", ")", ":", "ctx", "=", "libcrypto", ".", "EVP_PKEY_CTX_new", "(", "self", ".", "key", ",", "None", ")", "if", "ctx", "is", "None", ":", "raise", "PKeyError", "(", ...
Verifies given signature on given digest Returns True if Ok, False if don't match Keyword arguments allows to set algorithm-specific parameters
[ "Verifies", "given", "signature", "on", "given", "digest", "Returns", "True", "if", "Ok", "False", "if", "don", "t", "match", "Keyword", "arguments", "allows", "to", "set", "algorithm", "-", "specific", "parameters" ]
33c32904cf5e04901f87f90e2499634b8feecd3e
https://github.com/vbwagner/ctypescrypto/blob/33c32904cf5e04901f87f90e2499634b8feecd3e/ctypescrypto/pkey.py#L195-L213
train
59,099