mirror of
https://github.com/super-linter/super-linter.git
synced 2024-12-26 09:12:09 -05:00
Fix python test for flake8
This commit is contained in:
parent
f372e4668b
commit
6c2e32ce14
1 changed files with 12 additions and 7 deletions
|
@ -3,9 +3,9 @@ from os import getenv, path
|
|||
from pprint import pprint
|
||||
import sys
|
||||
|
||||
import click # pylint: disable=import-error
|
||||
from dotenv import load_dotenv # pylint: disable=import-error
|
||||
import requests # pylint: disable=import-error
|
||||
import click # pylint: disable=import-error
|
||||
from dotenv import load_dotenv # pylint: disable=import-error
|
||||
import requests # pylint: disable=import-error
|
||||
|
||||
env = load_dotenv()
|
||||
api_url = getenv('API_URL', default='https://api.github.com/graphql')
|
||||
|
@ -13,8 +13,8 @@ github_token = getenv("GITHUB_TOKEN", default=None)
|
|||
|
||||
if github_token is None:
|
||||
sys.exit("GitHub Token is not set." +
|
||||
"Please set the GITHUB_TOKEN env variable in your system or " +
|
||||
"the .env file of your project.")
|
||||
"Please set the GITHUB_TOKEN env variable in your system or " +
|
||||
"the .env file of your project.")
|
||||
|
||||
client_id = getenv('CLIENT_ID', default='copy_labels.py')
|
||||
headers = {
|
||||
|
@ -23,6 +23,7 @@ headers = {
|
|||
'Content-Type': 'application/json'
|
||||
}
|
||||
|
||||
|
||||
def create_label(repo_id, label):
|
||||
"""
|
||||
Create label in the supplied repo.
|
||||
|
@ -52,6 +53,7 @@ def create_label(repo_id, label):
|
|||
|
||||
return response
|
||||
|
||||
|
||||
def get_labels(owner, repo):
|
||||
"""
|
||||
Gets a list of labels from the supplied repo.
|
||||
|
@ -62,7 +64,7 @@ def get_labels(owner, repo):
|
|||
:return: A tuple with the GitHub id for the repository and a list of labels defined in the repository
|
||||
"""
|
||||
|
||||
query_variables = { "owner": owner, "name": repo, }
|
||||
query_variables = {"owner": owner, "name": repo, }
|
||||
|
||||
with open(path.join(path.dirname(__file__), 'queries/get_repo_data.gql'), 'r') as query_file:
|
||||
query = "".join(query_file.readlines())
|
||||
|
@ -83,6 +85,7 @@ def get_labels(owner, repo):
|
|||
'[ERROR] getting issue labels. Status Code: {status_code} - Message: {result}'.format(
|
||||
status_code=status_code, result=result["message"]))
|
||||
|
||||
|
||||
def delete_label(label_id):
|
||||
"""
|
||||
Delete the specified label
|
||||
|
@ -106,6 +109,7 @@ def delete_label(label_id):
|
|||
|
||||
return result
|
||||
|
||||
|
||||
@click.command()
|
||||
@click.option('--dry', is_flag=True)
|
||||
@click.argument('source_repo')
|
||||
|
@ -149,7 +153,8 @@ def copy_labels(source_repo, target_repo, dry):
|
|||
|
||||
print('Done')
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Pylint doesn't know that @click.command takes care of injecting the
|
||||
# function parameters. Disabling Pylint error.
|
||||
copy_labels() # pylint: disable=no-value-for-parameter
|
||||
copy_labels() # pylint: disable=no-value-for-parameter
|
||||
|
|
Loading…
Reference in a new issue