Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Pylint cleanup round 4.

  • Loading branch information...
commit 204860a06c88f3699e44f5ca85154eb828d158b0 1 parent 1dc5e9f
@jk0 jk0 authored
Showing with 29 additions and 23 deletions.
  1. +19 −23 pyhole/utils.py
  2. +10 −0 pylintrc
View
42 pyhole/utils.py
@@ -20,7 +20,6 @@
import os
import optparse
import re
-import sys
from BeautifulSoup import BeautifulStoneSoup
@@ -33,25 +32,25 @@
def admin(func):
"""Administration Decorator"""
- def f(self, *args, **kwargs):
+ def wrap(self, *args, **kwargs):
if self.irc.source in self.irc.admins:
func(self, *args, **kwargs)
else:
self.irc.reply("Sorry, you are not authorized to do that.")
- f.__doc__ = func.__doc__
- f.__name__ = func.__name__
- f.__module__ = func.__module__
- return f
+ wrap.__doc__ = func.__doc__
+ wrap.__name__ = func.__name__
+ wrap.__module__ = func.__module__
+ return wrap
def spawn(func):
"""Greenthread Spawning Decorator"""
- def f(self, *args, **kwargs):
+ def wrap(self, *args, **kwargs):
eventlet.spawn_n(func, self, *args, **kwargs)
- f.__doc__ = func.__doc__
- f.__name__ = func.__name__
- f.__module__ = func.__module__
- return f
+ wrap.__doc__ = func.__doc__
+ wrap.__name__ = func.__name__
+ wrap.__module__ = func.__module__
+ return wrap
def decode_entities(html):
@@ -85,7 +84,7 @@ def build_options():
def get_option(option):
"""Retrive an option from the command line."""
- options, args = build_options()
+ options, _args = build_options()
return vars(options).get(option)
@@ -124,22 +123,19 @@ def get_config(section="Pyhole"):
return config.Config(get_conf_file(), section)
-def write_file(dir, file, data):
+def write_file(directory, file_name, data):
"""Write data to file"""
- dir = get_directory(dir)
+ directory = get_directory(directory)
+ with open(directory + file_name, "w") as open_file:
+ open_file.write(str(data).strip())
- with open(dir + file, "w") as f:
- f.write(str(data).strip())
-
-def read_file(dir, file):
+def read_file(directory, file_name):
"""Read and return the data in file"""
- dir = get_directory(dir)
-
+ directory = get_directory(directory)
try:
- with open(dir + file, "r") as f:
- data = f.read()
-
+ with open(directory + file_name, "r") as open_file:
+ data = open_file.read()
return data
except IOError:
return None
View
10 pylintrc
@@ -0,0 +1,10 @@
+[Messages Control]
+# W0511: TODOs in code comments are fine.
+# W0142: *args and **kwargs are fine.
+disable = W0511,W0142
+no-docstring-rgx=((__.*__)|([tT]est.*)|setUp|tearDown)$
+
+[Design]
+max-public-methods=100
+min-public-methods=0
+max-args=6
Please sign in to comment.
Something went wrong with that request. Please try again.