@@ -837,7 +837,7 @@ def whitespace_before_comment(logical_line, tokens):
837
837
838
838
839
839
def imports_on_separate_lines (logical_line ):
840
- r"""Imports should usually be on separate lines.
840
+ r"""Place imports on separate lines.
841
841
842
842
Okay: import os\nimport sys
843
843
E401: import sys, os
@@ -857,8 +857,10 @@ def imports_on_separate_lines(logical_line):
857
857
858
858
def module_imports_on_top_of_file (
859
859
logical_line , indent_level , checker_state , noqa ):
860
- r"""Imports are always put at the top of the file, just after any module
861
- comments and docstrings, and before module globals and constants.
860
+ r"""Place imports at the top of the file.
861
+
862
+ Always put imports at the top of the file, just after any module comments
863
+ and docstrings, and before module globals and constants.
862
864
863
865
Okay: import os
864
866
Okay: # this is a comment\nimport os
@@ -1166,7 +1168,7 @@ def python_3000_not_equal(logical_line):
1166
1168
1167
1169
1168
1170
def python_3000_backticks (logical_line ):
1169
- r"""Backticks are removed in Python 3: use repr() instead .
1171
+ r"""Use repr() instead of backticks in Python 3.
1170
1172
1171
1173
Okay: val = repr(1 + 2)
1172
1174
W604: val = `1 + 2`
@@ -1205,7 +1207,9 @@ def readlines(filename):
1205
1207
isidentifier = str .isidentifier
1206
1208
1207
1209
def stdin_get_value ():
1210
+ """Read the value from stdin."""
1208
1211
return TextIOWrapper (sys .stdin .buffer , errors = 'ignore' ).read ()
1212
+
1209
1213
noqa = re .compile (r'# no(?:qa|pep8)\b' , re .I ).search
1210
1214
1211
1215
@@ -1439,7 +1443,7 @@ def run_check(self, check, argument_names):
1439
1443
return check (* arguments )
1440
1444
1441
1445
def init_checker_state (self , name , argument_names ):
1442
- """ Prepares a custom state for the specific checker plugin."""
1446
+ """Prepare custom state for the specific checker plugin."""
1443
1447
if 'checker_state' in argument_names :
1444
1448
self .checker_state = self ._checker_states .setdefault (name , {})
1445
1449
@@ -1721,6 +1725,7 @@ def print_benchmark(self):
1721
1725
1722
1726
class FileReport (BaseReport ):
1723
1727
"""Collect the results of the checks and print only the filenames."""
1728
+
1724
1729
print_filename = True
1725
1730
1726
1731
@@ -1928,6 +1933,7 @@ def get_checks(self, argument_name):
1928
1933
1929
1934
1930
1935
def get_parser (prog = 'pep8' , version = __version__ ):
1936
+ """Create the parser for the program."""
1931
1937
parser = OptionParser (prog = prog , version = version ,
1932
1938
usage = "%prog [options] input ..." )
1933
1939
parser .config_options = [
@@ -1989,7 +1995,7 @@ def get_parser(prog='pep8', version=__version__):
1989
1995
1990
1996
1991
1997
def read_config (options , args , arglist , parser ):
1992
- """Read and parse configurations
1998
+ """Read and parse configurations.
1993
1999
1994
2000
If a config file is specified on the command line with the "--config"
1995
2001
option, then only it is used for configuration.
0 commit comments