Skip to content

Commit

Permalink
Fix pylint issues.
Browse files Browse the repository at this point in the history
Fix issues raised by pylint. Add rc file for pylint.
  • Loading branch information
gareth-palmer committed Jun 9, 2021
1 parent 646514a commit ddac047
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
10 changes: 10 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[MASTER]
persistent=no
dummy-variables-rgx=(_+[a-zA-Z0-9]*?$)|dummy|unused
extension-pkg-whitelist=lxml

[MESSAGES CONTROL]
disable=missing-module-docstring,missing-class-docstring,missing-function-docstring,line-too-long,bad-whitespace,too-many-branches,too-many-statements,too-many-arguments,too-many-locals,redefined-builtin,redefined-argument-from-local,no-else-continue,broad-except,consider-using-sys-exit,len-as-condition,invalid-name,unused-argument,wrong-import-position

[REPORTS]
output-format=text
8 changes: 4 additions & 4 deletions cgiexecute
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,10 @@ def main():
url, priority = argument, 0

if not re.search(r'(?x) ^ (?: (?: Dial | EditDial) : [0-9#*]+'
' | (?: Key | SoftKey | Init) : [a-zA-Z]+'
' | Play : [a-zA-Z0-9._\-]+'
' | Display : (?: Off | On | Default) (:? : [0-9]+)?'
' | https? :// [^ ]+) $', url):
r' | (?: Key | SoftKey | Init) : [a-zA-Z]+'
r' | Play : [a-zA-Z0-9._\-]+'
r' | Display : (?: Off | On | Default) (:? : [0-9]+)?'
r' | https? :// [^ ]+) $', url):
raise ProgramError(f'Invalid URL: {url}')

if len(urls) == 3:
Expand Down
16 changes: 8 additions & 8 deletions mediastream
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import requests
import requests.auth
import gi
gi.require_version('Gst', '1.0')
from gi.repository import GObject, GLib, Gst
from gi.repository import GLib, Gst


class ProgramError(Exception):
Expand Down Expand Up @@ -100,7 +100,7 @@ def stream_media(target_hostnames, multicast_address, port, codec, wav_file):
file_src = Gst.ElementFactory.make('filesrc', None)

if file_src is None:
raise PogramError('No \'filesrc\' plugin')
raise ProgramError('No \'filesrc\' plugin')

file_src.set_property('location', wav_file)

Expand Down Expand Up @@ -171,7 +171,7 @@ def stream_media(target_hostnames, multicast_address, port, codec, wav_file):

udp_sink.set_property('sync', True)

def bus_message(self, message, main_loop):
def bus_message(unused, message, main_loop):
if message.type == Gst.MessageType.EOS:
main_loop.quit()

Expand Down Expand Up @@ -320,11 +320,11 @@ def main():
if codec not in ('g711', 'g722'):
raise ProgramError(f'Invalid codec: {codec}')

elif option in ('-u', '--username'):
username = argument
elif option in ('-u', '--username'):
username = argument

elif option in ('-p', '--password'):
password = argument
elif option in ('-p', '--password'):
password = argument

elif option in ('-H', '--help'):
help = True
Expand All @@ -351,7 +351,7 @@ def main():
target_hostnames = []

for target_hostname in arguments:
if not re.search('(?xi) ^ (?: [a-z0-9\-]+ \.)* [a-z0-9\-]+ $', target_hostname):
if not re.search(r'(?xi) ^ (?: [a-z0-9\-]+ \.)* [a-z0-9\-]+ $', target_hostname):
raise ProgramError(f'Invalid target host: {target_hostname}')

target_hostnames.append(target_hostname)
Expand Down

0 comments on commit ddac047

Please sign in to comment.