From e1497f5e98387fa547e251ccf02ba179adc95202 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jul 09 2015 08:32:08 +0000 Subject: Project wide pep8 clean up --- diff --git a/pagure/api/fork.py b/pagure/api/fork.py index 9a0adba..436443c 100644 --- a/pagure/api/fork.py +++ b/pagure/api/fork.py @@ -39,20 +39,20 @@ def api_pull_request_views(repo, username=None): Parameters ^^^^^^^^^^ - +----------------+-----------+---------------+-----------------------------+ - | Key | Type | Optionality | Description | - +================+===========+===============+=============================+ - | ``status`` | boolean | Optional | | Filter the status of | - | | | | pull requests. Default: | - | | | | ``True`` (opened pull | - | | | | requests) | - +----------------+-----------+---------------+-----------------------------+ - | ``assignee`` | string | Optional | | Filter the assignee of | - | | | | pull requests | - +----------------+-----------+---------------+-----------------------------+ - | ``author`` | string | Optional | | Filter the author of | - | | | | pull requests | - +----------------+-----------+---------------+-----------------------------+ + +---------------+----------+--------------+----------------------------+ + | Key | Type | Optionality | Description | + +===============+==========+==============+============================+ + | ``status`` | boolean | Optional | | Filter the status of | + | | | | pull requests. Default: | + | | | | ``True`` (opened pull | + | | | | requests) | + +---------------+----------+--------------+----------------------------+ + | ``assignee`` | string | Optional | | Filter the assignee of | + | | | | pull requests | + +---------------+----------+--------------+----------------------------+ + | ``author`` | string | Optional | | Filter the author of | + | | | | pull requests | + +---------------+----------+--------------+----------------------------+ Sample response ^^^^^^^^^^^^^^^ @@ -404,25 +404,25 @@ def api_pull_request_add_comment(repo, requestid, username=None): Input ^^^^^ - +----------------+----------+---------------+------------------------------+ - | Key | Type | Optionality | Description | - +================+==========+===============+==============================+ - | ``comment`` | string | Mandatory | | The comment to add | - | | | | to the pull request | - +----------------+----------+---------------+------------------------------+ - | ``commit`` | string | Optional | | The hash of the specific | - | | | | commit you wish to | - | | | | comment on | - +----------------+----------+---------------+------------------------------+ - | ``filename`` | string | Optional | | The filename of the | - | | | | specific file you wish | - | | | | to comment on | - +----------------+----------+---------------+------------------------------+ - | ``row`` | int | Optional | | Used in combination | - | | | | with filename to comment | - | | | | on a specific row | - | | | | of a file | - +----------------+----------+---------------+------------------------------+ + +---------------+---------+--------------+-----------------------------+ + | Key | Type | Optionality | Description | + +===============+=========+==============+=============================+ + | ``comment`` | string | Mandatory | | The comment to add | + | | | | to the pull request | + +---------------+---------+--------------+-----------------------------+ + | ``commit`` | string | Optional | | The hash of the specific | + | | | | commit you wish to | + | | | | comment on | + +---------------+---------+--------------+-----------------------------+ + | ``filename`` | string | Optional | | The filename of the | + | | | | specific file you wish | + | | | | to comment on | + +---------------+---------+--------------+-----------------------------+ + | ``row`` | int | Optional | | Used in combination | + | | | | with filename to comment | + | | | | on a specific row | + | | | | of a file | + +---------------+---------+--------------+-----------------------------+ Sample response ^^^^^^^^^^^^^^^ @@ -511,44 +511,44 @@ def api_pull_request_add_flag(repo, requestid, username=None): Input ^^^^^ - +----------------+----------+---------------+------------------------------+ - | Key | Type | Optionality | Description | - +================+==========+===============+==============================+ - | ``username`` | string | Mandatory | | The name of the | - | | | | application to be | - | | | | presented to users | - | | | | on the pull request page | - +----------------+----------+---------------+------------------------------+ - | ``percent`` | int | Mandatory | | A percentage of | - | | | | completion compared to | - | | | | the goal. The percentage | - | | | | also determine the | - | | | | background color of the | - | | | | flag on the pull-request | - | | | | page | - +----------------+----------+---------------+------------------------------+ - | ``comment`` | string | Mandatory | | A short message | - | | | | summarizing the | - | | | | presented results | - +----------------+----------+---------------+------------------------------+ - | ``url`` | string | Mandatory | | A URL to the result | - | | | | of this flag | - +----------------+----------+---------------+------------------------------+ - | ``uid`` | string | Optional | | A unique identifier used | - | | | | to identify a flag on a | - | | | | pull-request. If the | - | | | | provided UID matches an | - | | | | existing one, then the | - | | | | API call will update the | - | | | | existing one rather than | - | | | | create a new one. | - | | | | Maximum Length: 32 | - | | | | characters. Default: an | - | | | | auto generated UID | - +----------------+----------+---------------+------------------------------+ - | ``commit`` | string | Optional | | The hash of the commit | - | | | | you use | - +----------------+----------+---------------+------------------------------+ + +---------------+---------+--------------+-----------------------------+ + | Key | Type | Optionality | Description | + +===============+=========+==============+=============================+ + | ``username`` | string | Mandatory | | The name of the | + | | | | application to be | + | | | | presented to users | + | | | | on the pull request page | + +---------------+---------+--------------+-----------------------------+ + | ``percent`` | int | Mandatory | | A percentage of | + | | | | completion compared to | + | | | | the goal. The percentage | + | | | | also determine the | + | | | | background color of the | + | | | | flag on the pull-request | + | | | | page | + +---------------+---------+--------------+-----------------------------+ + | ``comment`` | string | Mandatory | | A short message | + | | | | summarizing the | + | | | | presented results | + +---------------+---------+--------------+-----------------------------+ + | ``url`` | string | Mandatory | | A URL to the result | + | | | | of this flag | + +---------------+---------+--------------+-----------------------------+ + | ``uid`` | string | Optional | | A unique identifier used | + | | | | to identify a flag on a | + | | | | pull-request. If the | + | | | | provided UID matches an | + | | | | existing one, then the | + | | | | API call will update the | + | | | | existing one rather than | + | | | | create a new one. | + | | | | Maximum Length: 32 | + | | | | characters. Default: an | + | | | | auto generated UID | + +---------------+---------+--------------+-----------------------------+ + | ``commit`` | string | Optional | | The hash of the commit | + | | | | you use | + +---------------+---------+--------------+-----------------------------+ Sample response ^^^^^^^^^^^^^^^ diff --git a/pagure/api/issue.py b/pagure/api/issue.py index 32eba50..e88d5c7 100644 --- a/pagure/api/issue.py +++ b/pagure/api/issue.py @@ -42,18 +42,18 @@ def api_new_issue(repo, username=None): Input ^^^^^ - +---------------+-----------+---------------+------------------------------+ - | Key | Type | Optionality | Description | - +===============+===========+===============+==============================+ - | ``title`` | string | Mandatory | The title of the issue | - +---------------+-----------+---------------+------------------------------+ - | ``content`` | string | Mandatory | | The description of the | - | | | | issue | - +---------------+-----------+---------------+------------------------------+ - | ``private`` | boolean | Optional | | Include this key if | - | | | | you want a private issue | - | | | | to be created | - +---------------+-----------+---------------+------------------------------+ + +--------------+----------+--------------+-----------------------------+ + | Key | Type | Optionality | Description | + +==============+==========+==============+=============================+ + | ``title`` | string | Mandatory | The title of the issue | + +--------------+----------+--------------+-----------------------------+ + | ``content`` | string | Mandatory | | The description of the | + | | | | issue | + +--------------+----------+--------------+-----------------------------+ + | ``private`` | boolean | Optional | | Include this key if | + | | | | you want a private issue | + | | | | to be created | + +--------------+----------+--------------+-----------------------------+ Sample response ^^^^^^^^^^^^^^^ @@ -156,27 +156,27 @@ def api_view_issues(repo, username=None): Parameters ^^^^^^^^^^ - +----------------+----------+---------------+---------------------------+ - | Key | Type | Optionality | Description | - +================+==========+===============+===========================+ - | ``status`` | string | Optional | | Filters the status of | - | | | | issues. Default: | - | | | | ``Open`` | - +----------------+----------+---------------+---------------------------+ - | ``tags`` | string | Optional | | A list of tags you | - | | | | wish to filter. If | - | | | | you want to filter | - | | | | for issues not having | - | | | | a tag, add an | - | | | | exclamation mark in | - | | | | front of it | - +----------------+----------+---------------+---------------------------+ - | ``assignee`` | string | Optional | | Filter the issues | - | | | | by assignee | - +----------------+----------+---------------+---------------------------+ - | ``author`` | string | Optional | | Filter the issues | - | | | | by creator | - +----------------+----------+---------------+---------------------------+ + +---------------+---------+--------------+---------------------------+ + | Key | Type | Optionality | Description | + +===============+=========+==============+===========================+ + | ``status`` | string | Optional | | Filters the status of | + | | | | issues. Default: | + | | | | ``Open`` | + +---------------+---------+--------------+---------------------------+ + | ``tags`` | string | Optional | | A list of tags you | + | | | | wish to filter. If | + | | | | you want to filter | + | | | | for issues not having | + | | | | a tag, add an | + | | | | exclamation mark in | + | | | | front of it | + +---------------+---------+--------------+---------------------------+ + | ``assignee`` | string | Optional | | Filter the issues | + | | | | by assignee | + +---------------+---------+--------------+---------------------------+ + | ``author`` | string | Optional | | Filter the issues | + | | | | by creator | + +---------------+---------+--------------+---------------------------+ Sample response ^^^^^^^^^^^^^^^ @@ -397,7 +397,7 @@ def api_view_issue_comment(repo, issueid, commentid, username=None): :: { - "avatar_url": "https://seccdn.libravatar.org/avatar/...?s=16&d=retro", + "avatar_url": "https://seccdn.libravatar.org/avatar/...", "comment": "9", "comment_date": "2015-07-01 15:08", "date_created": "1435756127", @@ -476,11 +476,11 @@ def api_change_status_issue(repo, issueid, username=None): Input ^^^^^ - +--------------+----------+---------------+-------------------------------+ - | Key | Type | Optionality | Description | - +==============+==========+===============+===============================+ - | ``status`` | string | Mandatory | The new status of the issue | - +--------------+----------+---------------+-------------------------------+ + +-------------+---------+--------------+------------------------------+ + | Key | Type | Optionality | Description | + +=============+=========+==============+==============================+ + | ``status`` | string | Mandatory | The new status of the issue | + +-------------+---------+--------------+------------------------------+ Sample response ^^^^^^^^^^^^^^^ @@ -569,12 +569,12 @@ def api_comment_issue(repo, issueid, username=None): Input ^^^^^ - +---------------+----------+---------------+---------------------------+ - | Key | Type | Optionality | Description | - +===============+==========+===============+===========================+ - | ``comment`` | string | Mandatory | | The comment to add to | - | | | | the issue | - +---------------+----------+---------------+---------------------------+ + +--------------+----------+---------------+---------------------------+ + | Key | Type | Optionality | Description | + +==============+==========+===============+===========================+ + | ``comment`` | string | Mandatory | | The comment to add to | + | | | | the issue | + +--------------+----------+---------------+---------------------------+ Sample response ^^^^^^^^^^^^^^^ diff --git a/pagure/forms.py b/pagure/forms.py index 6bef2c8..cdd8e5d 100644 --- a/pagure/forms.py +++ b/pagure/forms.py @@ -327,4 +327,3 @@ class EditFileForm(wtf.Form): self.email.choices = [ (email.email, email.email) for email in kwargs['emails'] ] - diff --git a/pagure/lib/__init__.py b/pagure/lib/__init__.py index 91615aa..4926dc1 100644 --- a/pagure/lib/__init__.py +++ b/pagure/lib/__init__.py @@ -1125,7 +1125,7 @@ def fork_project(session, user, repo, gitfolder, frepo = pygit2.clone_repository(reponame, forkreponame, bare=True) # Clone all the branches as well - for branch in frepo.listall_branches(pygit2.GIT_BRANCH_REMOTE): + for branch in frepo.listall_branches(pygit2.GIT_BRANCH_REMOTE): if branch == 'origin/master': continue br = frepo.lookup_branch(branch, pygit2.GIT_BRANCH_REMOTE) @@ -1625,6 +1625,7 @@ def close_pull_request(session, request, user, requestfolder, merged=True): ) ) + def reset_status_pull_request(session, project): ''' Reset the status of all opened Pull-Requests of a project. ''' @@ -1786,7 +1787,7 @@ def update_user_ssh(session, user, ssh_key): message = 'Nothing to update' ssh_key = ssh_key.strip().replace('\n', '') \ - if ssh_key and ssh_key.strip() else None + if ssh_key and ssh_key.strip() else None if ssh_key != user.public_ssh_key: user.public_ssh_key = ssh_key diff --git a/pagure/lib/git.py b/pagure/lib/git.py index a9f3a5b..a207e48 100644 --- a/pagure/lib/git.py +++ b/pagure/lib/git.py @@ -872,7 +872,7 @@ def merge_pull_request( if request.project.settings.get( 'Enforce_signed-off_commits_in_pull-request', False): for commit in diff_commits: - if not 'signed-off-by' in commit.message.lower(): + if 'signed-off-by' not in commit.message.lower(): raise pagure.exceptions.PagureException( 'This repo enforces that all commits are ' 'signed off by their author. ') diff --git a/pagure/ui/fork.py b/pagure/ui/fork.py index 7775763..6407c09 100644 --- a/pagure/ui/fork.py +++ b/pagure/ui/fork.py @@ -705,7 +705,7 @@ def new_request_pull(repo, branch_to, branch_from, username=None): if repo.settings.get( 'Enforce_signed-off_commits_in_pull-request', False): for commit in diff_commits: - if not 'signed-off-by' in commit.message.lower(): + if 'signed-off-by' not in commit.message.lower(): raise pagure.exceptions.PagureException( 'This repo enforces that all commits are ' 'signed off by their author. ') diff --git a/pagure/ui/repo.py b/pagure/ui/repo.py index d98b785..c447382 100644 --- a/pagure/ui/repo.py +++ b/pagure/ui/repo.py @@ -1321,7 +1321,8 @@ def edit_file(repo, branchname, filename, username=None): @APP.route('///delete', methods=['POST']) -@APP.route('/fork////delete', methods=['POST']) +@APP.route('/fork////delete', + methods=['POST']) @cla_required def delete_branch(repo, branchname, username=None): """ Delete the branch of a project.