Linting python scripts
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
This commit is contained in:
parent
5e0ad1134d
commit
f513e7cbcd
29 changed files with 17 additions and 43 deletions
|
@ -60,7 +60,7 @@ MSG_FORMAT = "%(now)s\t%(count)s\t%(category)s\t%(name)s\t%(data)s\n"
|
||||||
def getlogin():
|
def getlogin():
|
||||||
try:
|
try:
|
||||||
user = os.getlogin()
|
user = os.getlogin()
|
||||||
except OSError as e:
|
except OSError:
|
||||||
user = pwd.getpwuid(os.geteuid())[0]
|
user = pwd.getpwuid(os.geteuid())[0]
|
||||||
return user
|
return user
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ import os
|
||||||
import json
|
import json
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import time
|
|
||||||
|
|
||||||
import koji
|
import koji
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,6 @@ import time
|
||||||
import traceback
|
import traceback
|
||||||
import json
|
import json
|
||||||
|
|
||||||
import base64
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,7 @@
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import sys
|
import sys
|
||||||
import requests
|
import requests
|
||||||
import json
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import logging
|
|
||||||
|
|
||||||
req = requests.get('https://bodhi.fedoraproject.org/composes/')
|
req = requests.get('https://bodhi.fedoraproject.org/composes/')
|
||||||
bodhi_composes = req.json()
|
bodhi_composes = req.json()
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from glob import glob
|
from glob import glob
|
||||||
from datetime import date
|
from datetime import date
|
||||||
from os import walk,listdir
|
from os import listdir
|
||||||
from os.path import exists
|
from os.path import exists
|
||||||
from bz2 import BZ2File
|
from bz2 import BZ2File
|
||||||
import smtplib
|
import smtplib
|
||||||
|
|
|
@ -73,7 +73,7 @@ def scan_all():
|
||||||
info()
|
info()
|
||||||
|
|
||||||
if 'verbose' in sys.argv:
|
if 'verbose' in sys.argv:
|
||||||
import pprint;
|
import pprint
|
||||||
pprint.pprint(dict(active))
|
pprint.pprint(dict(active))
|
||||||
pprint.pprint(dict(inactive))
|
pprint.pprint(dict(inactive))
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@ import difflib
|
||||||
from operator import itemgetter
|
from operator import itemgetter
|
||||||
import tempfile
|
import tempfile
|
||||||
import os
|
import os
|
||||||
import shutil
|
|
||||||
|
|
||||||
##
|
##
|
||||||
# This is for testing purposes, so you can invoke this from the
|
# This is for testing purposes, so you can invoke this from the
|
||||||
|
@ -24,7 +23,7 @@ import shutil
|
||||||
# file.
|
# file.
|
||||||
#
|
#
|
||||||
sys.path.insert(0, '../py/')
|
sys.path.insert(0, '../py/')
|
||||||
from epylog import Result, InternalModule
|
from epylog import InternalModule
|
||||||
|
|
||||||
class common_unparsed_mod(InternalModule):
|
class common_unparsed_mod(InternalModule):
|
||||||
def __init__(self, opts, logger):
|
def __init__(self, opts, logger):
|
||||||
|
|
|
@ -32,7 +32,7 @@ import re
|
||||||
# file.
|
# file.
|
||||||
#
|
#
|
||||||
sys.path.insert(0, '../py/')
|
sys.path.insert(0, '../py/')
|
||||||
from epylog import Result, InternalModule
|
from epylog import InternalModule
|
||||||
|
|
||||||
class kojiload_mod(InternalModule):
|
class kojiload_mod(InternalModule):
|
||||||
##
|
##
|
||||||
|
|
|
@ -34,7 +34,7 @@ import time
|
||||||
import os
|
import os
|
||||||
import sqlite3 as sqlite
|
import sqlite3 as sqlite
|
||||||
sys.path.insert(0, '../py/')
|
sys.path.insert(0, '../py/')
|
||||||
from epylog import Result, InternalModule
|
from epylog import InternalModule
|
||||||
|
|
||||||
|
|
||||||
def executeSQL(cursor, query, params=None):
|
def executeSQL(cursor, query, params=None):
|
||||||
|
|
|
@ -14,7 +14,7 @@ import re
|
||||||
# file.
|
# file.
|
||||||
#
|
#
|
||||||
sys.path.insert(0, '../py/')
|
sys.path.insert(0, '../py/')
|
||||||
from epylog import Result, InternalModule
|
from epylog import InternalModule
|
||||||
|
|
||||||
class selinux_mod(InternalModule):
|
class selinux_mod(InternalModule):
|
||||||
def __init__(self, opts, logger):
|
def __init__(self, opts, logger):
|
||||||
|
|
|
@ -14,7 +14,7 @@ import re
|
||||||
# file.
|
# file.
|
||||||
#
|
#
|
||||||
sys.path.insert(0, '../py/')
|
sys.path.insert(0, '../py/')
|
||||||
from epylog import Result, InternalModule
|
from epylog import InternalModule
|
||||||
|
|
||||||
class sudo_mod(InternalModule):
|
class sudo_mod(InternalModule):
|
||||||
def __init__(self, opts, logger):
|
def __init__(self, opts, logger):
|
||||||
|
|
|
@ -13,7 +13,6 @@ import tempfile
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import time
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
# Look for a specific version of modulemd. The 1.x series does not
|
# 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"):
|
elif myfile.endswith(".xz"):
|
||||||
openfunc=lzma.LZMAFile
|
openfunc=lzma.LZMAFile
|
||||||
else:
|
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)
|
sys.exit(1)
|
||||||
with openfunc(filename=myfile, mode='r') as zipf:
|
with openfunc(filename=myfile, mode='r') as zipf:
|
||||||
mmdcts = zipf.read().decode('utf-8')
|
mmdcts = zipf.read().decode('utf-8')
|
||||||
|
@ -270,7 +269,7 @@ def _get_recursive_dependencies(all_deps, idx, stream, ignore_missing_deps):
|
||||||
try:
|
try:
|
||||||
_get_recursive_dependencies(
|
_get_recursive_dependencies(
|
||||||
local_deps, idx, inner_stream, ignore_missing_deps)
|
local_deps, idx, inner_stream, ignore_missing_deps)
|
||||||
except FileNotFoundError as e:
|
except FileNotFoundError:
|
||||||
# Could not find all of this stream's dependencies in
|
# Could not find all of this stream's dependencies in
|
||||||
# the repo
|
# the repo
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -13,8 +13,6 @@ import tempfile
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import time
|
|
||||||
import logging
|
|
||||||
|
|
||||||
# Look for a specific version of modulemd. The 1.x series does not
|
# Look for a specific version of modulemd. The 1.x series does not
|
||||||
# have the tools we need.
|
# have the tools we need.
|
||||||
|
@ -116,7 +114,7 @@ def _parse_repository_modular(repo_info, package_sack):
|
||||||
elif myfile.endswith(".xz"):
|
elif myfile.endswith(".xz"):
|
||||||
openfunc=lzma.LZMAFile
|
openfunc=lzma.LZMAFile
|
||||||
else:
|
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)
|
sys.exit(1)
|
||||||
with openfunc(filename=myfile, mode='r') as gzf:
|
with openfunc(filename=myfile, mode='r') as gzf:
|
||||||
mmdcts = gzf.read().decode('utf-8')
|
mmdcts = gzf.read().decode('utf-8')
|
||||||
|
@ -212,7 +210,7 @@ def get_default_modules(directory):
|
||||||
elif myfile.endswith(".xz"):
|
elif myfile.endswith(".xz"):
|
||||||
openfunc=lzma.LZMAFile
|
openfunc=lzma.LZMAFile
|
||||||
else:
|
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)
|
sys.exit(1)
|
||||||
with openfunc(filename=myfile, mode='r') as gzf:
|
with openfunc(filename=myfile, mode='r') as gzf:
|
||||||
mmdcts = gzf.read().decode('utf-8')
|
mmdcts = gzf.read().decode('utf-8')
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
from ipsilon.providers.saml2idp import IdpMetadataGenerator, Certificate
|
from ipsilon.providers.saml2idp import IdpMetadataGenerator, Certificate
|
||||||
from datetime import timedelta
|
|
||||||
cert = Certificate()
|
cert = Certificate()
|
||||||
cert.import_cert('/etc/ipsilon/root/saml2/idp.crt', '/etc/ipsilon/root/saml2/idp.key')
|
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))
|
#meta = IdpMetadataGenerator('https://id{{ env_suffix }}.fedoraproject.org', cert, timedelta(3600))
|
||||||
|
|
|
@ -4,15 +4,12 @@ hosted in pagure.io
|
||||||
"""
|
"""
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import datetime
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import sched
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from fedora_messaging import api, config, message
|
from fedora_messaging import config, message
|
||||||
|
|
||||||
|
|
||||||
_log = logging.getLogger("mirror_from_pagure_bus")
|
_log = logging.getLogger("mirror_from_pagure_bus")
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import socket
|
|
||||||
import sys
|
import sys
|
||||||
import zmq
|
import zmq
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import socket
|
|
||||||
import sys
|
import sys
|
||||||
import zmq
|
import zmq
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import socket
|
|
||||||
import sys
|
import sys
|
||||||
import zmq
|
import zmq
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import socket
|
|
||||||
import sys
|
import sys
|
||||||
import zmq
|
import zmq
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import socket
|
|
||||||
import sys
|
import sys
|
||||||
import zmq
|
import zmq
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import socket
|
|
||||||
import sys
|
import sys
|
||||||
import zmq
|
import zmq
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ def main():
|
||||||
hard_states = [
|
hard_states = [
|
||||||
x
|
x
|
||||||
for x in [int(x["last_hard_state"]) for x in host["services"]]
|
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
|
need_newline = False
|
||||||
if host["notifications_enabled"] == "0" and not hard_states:
|
if host["notifications_enabled"] == "0" and not hard_states:
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
from kerneltest.app import APP as application
|
|
|
@ -212,7 +212,7 @@ def handle_client(client_reader, client_writer):
|
||||||
|
|
||||||
except OSError:
|
except OSError:
|
||||||
log.info("Client closed connection")
|
log.info("Client closed connection")
|
||||||
except ConnectionResetError as err:
|
except ConnectionResetError:
|
||||||
log.exception("ERROR: ConnectionResetError in handle_client")
|
log.exception("ERROR: ConnectionResetError in handle_client")
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
log.exception("ERROR: Exception in handle_client")
|
log.exception("ERROR: Exception in handle_client")
|
||||||
|
@ -274,7 +274,7 @@ def main():
|
||||||
loop.run_forever()
|
loop.run_forever()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
pass
|
pass
|
||||||
except ConnectionResetError as err:
|
except ConnectionResetError:
|
||||||
log.exception("ERROR: ConnectionResetError in main")
|
log.exception("ERROR: ConnectionResetError in main")
|
||||||
except Exception:
|
except Exception:
|
||||||
log.exception("ERROR: Exception in main")
|
log.exception("ERROR: Exception in main")
|
||||||
|
|
|
@ -21,9 +21,7 @@
|
||||||
import grp
|
import grp
|
||||||
import hashlib
|
import hashlib
|
||||||
import logging
|
import logging
|
||||||
import os
|
|
||||||
import pwd
|
import pwd
|
||||||
import stat
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from jinja2 import Template
|
from jinja2 import Template
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
from __future__ import unicode_literals, print_function
|
from __future__ import unicode_literals, print_function
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import string
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
|
@ -13,20 +13,18 @@ requires:
|
||||||
|
|
||||||
# These two lines are needed to run on EL6
|
# These two lines are needed to run on EL6
|
||||||
__requires__ = ['SQLAlchemy >= 0.7']
|
__requires__ = ['SQLAlchemy >= 0.7']
|
||||||
import pkg_resources
|
|
||||||
|
|
||||||
|
|
||||||
import contextlib
|
import contextlib
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
|
|
||||||
# Database related part
|
# 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.ext.declarative import declarative_base
|
||||||
from sqlalchemy.orm import sessionmaker
|
from sqlalchemy.orm import sessionmaker
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,6 @@ import sys
|
||||||
import re
|
import re
|
||||||
import optparse
|
import optparse
|
||||||
import os
|
import os
|
||||||
import string
|
|
||||||
|
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
from __future__ import absolute_import, division, print_function
|
from __future__ import absolute_import, division, print_function
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import re
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue