@@ -56,7 +56,7 @@ def next(obj, default=nothing):
56
56
tokenize_open = open
57
57
58
58
59
- __version__ = '0.7.1-alpha '
59
+ __version__ = '1.0.0a0 '
60
60
__all__ = ('check' ,)
61
61
62
62
NO_VIOLATIONS_RETURN_CODE = 0
@@ -1052,9 +1052,10 @@ def _create_check_config(cls, options, use_dafaults=True):
1052
1052
return CheckConfiguration (checked_codes = checked_codes ,
1053
1053
match = match , match_dir = match_dir )
1054
1054
1055
- def _get_section_name (parser ):
1055
+ @classmethod
1056
+ def _get_section_name (cls , parser ):
1056
1057
"""Parse options from relevant section."""
1057
- for section_name in POSSIBLE_SECTION_NAMES :
1058
+ for section_name in cls . POSSIBLE_SECTION_NAMES :
1058
1059
if parser .has_section (section_name ):
1059
1060
return section_name
1060
1061
@@ -1073,7 +1074,7 @@ def _get_config_file_in_folder(cls, path):
1073
1074
for fn in cls .PROJECT_CONFIG_FILES :
1074
1075
config = RawConfigParser ()
1075
1076
full_path = os .path .join (path , fn )
1076
- if config .read (full_path ) and self ._get_section_name (config ):
1077
+ if config .read (full_path ) and cls ._get_section_name (config ):
1077
1078
return full_path
1078
1079
1079
1080
@staticmethod
@@ -1271,9 +1272,7 @@ class StdoutFilter(logging.Filter):
1271
1272
def filter (self , record ):
1272
1273
return record .levelno in (logging .DEBUG , logging .INFO )
1273
1274
1274
- if log .handlers :
1275
- for handler in log .handlers :
1276
- log .removeHandler (handler )
1275
+ log .handlers = []
1277
1276
1278
1277
stdout_handler = logging .StreamHandler (sys .stdout )
1279
1278
stdout_handler .setLevel (logging .WARNING )
@@ -1307,9 +1306,9 @@ def run_pydocstyle(used_pep257=False):
1307
1306
setup_stream_handlers (run_conf )
1308
1307
1309
1308
if used_pep257 :
1310
- log .warning ("Deprecation Warning:"
1309
+ log .warning ("Deprecation Warning:\n "
1311
1310
"pep257 has been renamed to pydocstyle and the use of the "
1312
- "pep257 executable is deprecated and will be removed in"
1311
+ "pep257 executable is deprecated and will be removed in "
1313
1312
"version 2.0.0. Please use pydocstyle instead." )
1314
1313
1315
1314
log .debug ("starting in debug mode." )
@@ -1665,12 +1664,16 @@ def SKIP_check_return_type(self, function, docstring):
1665
1664
return Error ()
1666
1665
1667
1666
1668
- def main ():
1667
+ def main (use_pep257 = False ):
1669
1668
try :
1670
- sys .exit (run_pydocstyle ())
1669
+ sys .exit (run_pydocstyle (use_pep257 ))
1671
1670
except KeyboardInterrupt :
1672
1671
pass
1673
1672
1674
1673
1674
+ def main_pep257 ():
1675
+ main (use_pep257 = True )
1676
+
1677
+
1675
1678
if __name__ == '__main__' :
1676
1679
main ()
0 commit comments