Linting python scripts

Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
This commit is contained in:
Jiri Podivin 2024-08-30 17:24:34 +02:00 committed by kevin
parent 5e0ad1134d
commit f513e7cbcd
29 changed files with 17 additions and 43 deletions

View file

@ -60,7 +60,7 @@ MSG_FORMAT = "%(now)s\t%(count)s\t%(category)s\t%(name)s\t%(data)s\n"
def getlogin():
try:
user = os.getlogin()
except OSError as e:
except OSError:
user = pwd.getpwuid(os.geteuid())[0]
return user

View file

@ -6,7 +6,6 @@ import os
import json
import subprocess
import sys
import time
import koji

View file

@ -18,7 +18,6 @@ import time
import traceback
import json
import base64
import requests

View file

@ -2,9 +2,7 @@
from __future__ import print_function
import sys
import requests
import json
import subprocess
import logging
req = requests.get('https://bodhi.fedoraproject.org/composes/')
bodhi_composes = req.json()

View file

@ -1,6 +1,6 @@
from glob import glob
from datetime import date
from os import walk,listdir
from os import listdir
from os.path import exists
from bz2 import BZ2File
import smtplib

View file

@ -73,7 +73,7 @@ def scan_all():
info()
if 'verbose' in sys.argv:
import pprint;
import pprint
pprint.pprint(dict(active))
pprint.pprint(dict(inactive))

View file

@ -16,7 +16,6 @@ import difflib
from operator import itemgetter
import tempfile
import os
import shutil
##
# This is for testing purposes, so you can invoke this from the
@ -24,7 +23,7 @@ import shutil
# file.
#
sys.path.insert(0, '../py/')
from epylog import Result, InternalModule
from epylog import InternalModule
class common_unparsed_mod(InternalModule):
def __init__(self, opts, logger):

View file

@ -32,7 +32,7 @@ import re
# file.
#
sys.path.insert(0, '../py/')
from epylog import Result, InternalModule
from epylog import InternalModule
class kojiload_mod(InternalModule):
##

View file

@ -34,7 +34,7 @@ import time
import os
import sqlite3 as sqlite
sys.path.insert(0, '../py/')
from epylog import Result, InternalModule
from epylog import InternalModule
def executeSQL(cursor, query, params=None):

View file

@ -14,7 +14,7 @@ import re
# file.
#
sys.path.insert(0, '../py/')
from epylog import Result, InternalModule
from epylog import InternalModule
class selinux_mod(InternalModule):
def __init__(self, opts, logger):

View file

@ -14,7 +14,7 @@ import re
# file.
#
sys.path.insert(0, '../py/')
from epylog import Result, InternalModule
from epylog import InternalModule
class sudo_mod(InternalModule):
def __init__(self, opts, logger):

View file

@ -13,7 +13,6 @@ import tempfile
import os
import subprocess
import sys
import time
import logging
# Look for a specific version of modulemd. The 1.x series does not
@ -89,7 +88,7 @@ def _get_modulemd(directory=None, repo_info=None):
elif myfile.endswith(".xz"):
openfunc=lzma.LZMAFile
else:
print("This file type is not fixed in this hack. Please fix code. (2021-05-20)");
print("This file type is not fixed in this hack. Please fix code. (2021-05-20)")
sys.exit(1)
with openfunc(filename=myfile, mode='r') as zipf:
mmdcts = zipf.read().decode('utf-8')
@ -270,7 +269,7 @@ def _get_recursive_dependencies(all_deps, idx, stream, ignore_missing_deps):
try:
_get_recursive_dependencies(
local_deps, idx, inner_stream, ignore_missing_deps)
except FileNotFoundError as e:
except FileNotFoundError:
# Could not find all of this stream's dependencies in
# the repo
continue

View file

@ -13,8 +13,6 @@ import tempfile
import os
import subprocess
import sys
import time
import logging
# Look for a specific version of modulemd. The 1.x series does not
# have the tools we need.
@ -116,7 +114,7 @@ def _parse_repository_modular(repo_info, package_sack):
elif myfile.endswith(".xz"):
openfunc=lzma.LZMAFile
else:
print("This file type is not fixed in this hack. Please fix code. (2021-05-20)");
print("This file type is not fixed in this hack. Please fix code. (2021-05-20)")
sys.exit(1)
with openfunc(filename=myfile, mode='r') as gzf:
mmdcts = gzf.read().decode('utf-8')
@ -212,7 +210,7 @@ def get_default_modules(directory):
elif myfile.endswith(".xz"):
openfunc=lzma.LZMAFile
else:
print("This file type is not fixed in this hack. Please fix code. (2021-05-20)");
print("This file type is not fixed in this hack. Please fix code. (2021-05-20)")
sys.exit(1)
with openfunc(filename=myfile, mode='r') as gzf:
mmdcts = gzf.read().decode('utf-8')

View file

@ -1,7 +1,6 @@
#!/usr/bin/env python3
from ipsilon.providers.saml2idp import IdpMetadataGenerator, Certificate
from datetime import timedelta
cert = Certificate()
cert.import_cert('/etc/ipsilon/root/saml2/idp.crt', '/etc/ipsilon/root/saml2/idp.key')
#meta = IdpMetadataGenerator('https://id{{ env_suffix }}.fedoraproject.org', cert, timedelta(3600))

View file

@ -4,15 +4,12 @@ hosted in pagure.io
"""
from __future__ import print_function
import datetime
import logging
import os
import sched
import subprocess
import sys
import time
from fedora_messaging import api, config, message
from fedora_messaging import config, message
_log = logging.getLogger("mirror_from_pagure_bus")

View file

@ -2,7 +2,6 @@
import json
import os
import socket
import sys
import zmq

View file

@ -2,7 +2,6 @@
import json
import os
import socket
import sys
import zmq

View file

@ -2,7 +2,6 @@
import json
import os
import socket
import sys
import zmq

View file

@ -2,7 +2,6 @@
import json
import os
import socket
import sys
import zmq

View file

@ -2,7 +2,6 @@
import json
import os
import socket
import sys
import zmq

View file

@ -2,7 +2,6 @@
import json
import os
import socket
import sys
import zmq

View file

@ -86,7 +86,7 @@ def main():
hard_states = [
x
for x in [int(x["last_hard_state"]) for x in host["services"]]
if not x in [0, 1]
if x not in [0, 1]
]
need_newline = False
if host["notifications_enabled"] == "0" and not hard_states:

View file

@ -1 +0,0 @@
from kerneltest.app import APP as application

View file

@ -212,7 +212,7 @@ def handle_client(client_reader, client_writer):
except OSError:
log.info("Client closed connection")
except ConnectionResetError as err:
except ConnectionResetError:
log.exception("ERROR: ConnectionResetError in handle_client")
except Exception as err:
log.exception("ERROR: Exception in handle_client")
@ -274,7 +274,7 @@ def main():
loop.run_forever()
except KeyboardInterrupt:
pass
except ConnectionResetError as err:
except ConnectionResetError:
log.exception("ERROR: ConnectionResetError in main")
except Exception:
log.exception("ERROR: Exception in main")

View file

@ -21,9 +21,7 @@
import grp
import hashlib
import logging
import os
import pwd
import stat
from pathlib import Path
from jinja2 import Template

View file

@ -3,7 +3,6 @@
from __future__ import unicode_literals, print_function
import os
import string
import subprocess
import sys

View file

@ -13,20 +13,18 @@ requires:
# These two lines are needed to run on EL6
__requires__ = ['SQLAlchemy >= 0.7']
import pkg_resources
import contextlib
import json
import os
import shutil
import sys
import tempfile
# Database related part
from sqlalchemy import Column, ForeignKey, Integer, Text, create_engine
from sqlalchemy import Column, Integer, Text, create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker

View file

@ -23,7 +23,6 @@ import sys
import re
import optparse
import os
import string
'''

View file

@ -6,7 +6,6 @@
from __future__ import absolute_import, division, print_function
import json
import re
import requests
from ansible.module_utils.basic import AnsibleModule