@@ -402,8 +402,11 @@ def parse_module(self):
402
402
children = list (self .parse_definitions (Module , all = True ))
403
403
assert self .current is None , self .current
404
404
end = self .line
405
- module = Module (self .filename , self .source , start , end ,
406
- [], docstring , children , None , self .all )
405
+ cls = Module
406
+ if self .filename .endswith ('__init__.py' ):
407
+ cls = Package
408
+ module = cls (self .filename , self .source , start , end ,
409
+ [], docstring , children , None , self .all )
407
410
for child in module .children :
408
411
child .parent = module
409
412
log .debug ("finished parsing module." )
@@ -584,6 +587,7 @@ def to_rst(cls):
584
587
D101 = D1xx .create_error ('D101' , 'Missing docstring in public class' )
585
588
D102 = D1xx .create_error ('D102' , 'Missing docstring in public method' )
586
589
D103 = D1xx .create_error ('D103' , 'Missing docstring in public function' )
590
+ D104 = D1xx .create_error ('D104' , 'Missing docstring in public package' )
587
591
588
592
D2xx = ErrorRegistry .create_group ('D2' , 'Whitespace Issues' )
589
593
D200 = D2xx .create_error ('D200' , 'One-line docstring should fit on one line '
@@ -930,7 +934,8 @@ def check_docstring_missing(self, definition, docstring):
930
934
if (not docstring and definition .is_public or
931
935
docstring and is_blank (eval (docstring ))):
932
936
codes = {Module : D100 , Class : D101 , NestedClass : D101 ,
933
- Method : D102 , Function : D103 , NestedFunction : D103 }
937
+ Method : D102 , Function : D103 , NestedFunction : D103 ,
938
+ Package : D104 }
934
939
return codes [type (definition )]()
935
940
936
941
@check_for (Definition )
0 commit comments