Fix some pylint warnings
This commit is contained in:
parent
909c726c75
commit
40db466c57
2 changed files with 15 additions and 7 deletions
3
.pylintrc
Normal file
3
.pylintrc
Normal file
|
@ -0,0 +1,3 @@
|
|||
[MESSAGES CONTROL]
|
||||
disable=locally-disabled,
|
||||
redefined-outer-name,
|
|
@ -1,4 +1,9 @@
|
|||
#!/usr/bin/python3
|
||||
""""
|
||||
Entrypoint of a Woodpecker CI docker image plugin that permit to publish Debian
|
||||
packages on a Aptly repository using its API
|
||||
"""
|
||||
|
||||
import datetime
|
||||
import os
|
||||
import re
|
||||
|
@ -76,8 +81,8 @@ if MAX_RETRY:
|
|||
def list_files_in_changes_file(filepath):
|
||||
""" List files included by a changes file """
|
||||
dirpath = os.path.dirname(filepath)
|
||||
with open(filepath, "r", encoding="utf-8") as fd:
|
||||
changes_file = fd.read()
|
||||
with open(filepath, "r", encoding="utf-8") as file_desc:
|
||||
changes_file = file_desc.read()
|
||||
|
||||
parser = PackagesParser(changes_file)
|
||||
files = []
|
||||
|
@ -101,8 +106,8 @@ def changes_file2package_name(changes_file):
|
|||
def upload_file(package_name, filepath):
|
||||
""" Upload a file using Aptly API """
|
||||
url = f'{API_URL}/files/{package_name}'
|
||||
with open(filepath, 'rb') as fd:
|
||||
result = session.post(url, files={'file': fd})
|
||||
with open(filepath, 'rb') as file_desc:
|
||||
result = session.post(url, files={'file': file_desc})
|
||||
return (
|
||||
result.status_code == 200 and
|
||||
f'{package_name}/{os.path.basename(filepath)}' in result.json()
|
||||
|
@ -167,9 +172,9 @@ url = f'{API_URL}/repos/{REPO_NAME}/snapshots'
|
|||
payload = {'Name': snap_name}
|
||||
result = session.post(url, json=payload)
|
||||
try:
|
||||
data = result.json()
|
||||
except Exception:
|
||||
data = {}
|
||||
data = result.json()
|
||||
except Exception: # pylint: disable=broad-except
|
||||
data = {}
|
||||
error = (
|
||||
result.status_code < 200 or
|
||||
result.status_code > 299 or
|
||||
|
|
Loading…
Reference in a new issue