@@ -855,7 +855,7 @@ def whitespace_before_comment(logical_line, tokens):
855
855
856
856
857
857
def imports_on_separate_lines (logical_line ):
858
- r"""Imports should usually be on separate lines.
858
+ r"""Place imports on separate lines.
859
859
860
860
Okay: import os\nimport sys
861
861
E401: import sys, os
@@ -875,8 +875,10 @@ def imports_on_separate_lines(logical_line):
875
875
876
876
def module_imports_on_top_of_file (
877
877
logical_line , indent_level , checker_state , noqa ):
878
- r"""Imports are always put at the top of the file, just after any module
879
- comments and docstrings, and before module globals and constants.
878
+ r"""Place imports at the top of the file.
879
+
880
+ Always put imports at the top of the file, just after any module comments
881
+ and docstrings, and before module globals and constants.
880
882
881
883
Okay: import os
882
884
Okay: # this is a comment\nimport os
@@ -1184,7 +1186,7 @@ def python_3000_not_equal(logical_line):
1184
1186
1185
1187
1186
1188
def python_3000_backticks (logical_line ):
1187
- r"""Backticks are removed in Python 3: use repr() instead .
1189
+ r"""Use repr() instead of backticks in Python 3.
1188
1190
1189
1191
Okay: val = repr(1 + 2)
1190
1192
W604: val = `1 + 2`
@@ -1223,7 +1225,9 @@ def readlines(filename):
1223
1225
isidentifier = str .isidentifier
1224
1226
1225
1227
def stdin_get_value ():
1228
+ """Read the value from stdin."""
1226
1229
return TextIOWrapper (sys .stdin .buffer , errors = 'ignore' ).read ()
1230
+
1227
1231
noqa = re .compile (r'# no(?:qa|pep8)\b' , re .I ).search
1228
1232
1229
1233
@@ -1457,7 +1461,7 @@ def run_check(self, check, argument_names):
1457
1461
return check (* arguments )
1458
1462
1459
1463
def init_checker_state (self , name , argument_names ):
1460
- """ Prepares a custom state for the specific checker plugin."""
1464
+ """Prepare custom state for the specific checker plugin."""
1461
1465
if 'checker_state' in argument_names :
1462
1466
self .checker_state = self ._checker_states .setdefault (name , {})
1463
1467
@@ -1739,6 +1743,7 @@ def print_benchmark(self):
1739
1743
1740
1744
class FileReport (BaseReport ):
1741
1745
"""Collect the results of the checks and print only the filenames."""
1746
+
1742
1747
print_filename = True
1743
1748
1744
1749
@@ -1946,6 +1951,7 @@ def get_checks(self, argument_name):
1946
1951
1947
1952
1948
1953
def get_parser (prog = 'pep8' , version = __version__ ):
1954
+ """Create the parser for the program."""
1949
1955
parser = OptionParser (prog = prog , version = version ,
1950
1956
usage = "%prog [options] input ..." )
1951
1957
parser .config_options = [
@@ -2007,7 +2013,7 @@ def get_parser(prog='pep8', version=__version__):
2007
2013
2008
2014
2009
2015
def read_config (options , args , arglist , parser ):
2010
- """Read and parse configurations
2016
+ """Read and parse configurations.
2011
2017
2012
2018
If a config file is specified on the command line with the "--config"
2013
2019
option, then only it is used for configuration.
0 commit comments