Skip to content

Commit 7715561

Browse files
[ruff] Enable pydoc rules (#3288)
### Changes Enable rule https://docs.astral.sh/ruff/rules/#pydocstyle-d ignored rules: ``` "D100", # undocumented-public-module "D101", # undocumented-public-class "D102", # undocumented-public-method "D103", # undocumented-public-function "D104", # undocumented-public-package "D105", # undocumented-magic-method "D106", # undocumented-public-nested-class "D107", # undocumented-public-init "D200", # unnecessary-multiline-docstring "D203", # incorrect-blank-line-before-class "D205", # missing-blank-line-after-summary "D212", # multi-line-summary-first-line "D400", # missing-trailing-period "D401", # non-imperative-mood "D402", # signature-in-docstring "D404", # docstring-starts-with-this "D413", # missing-blank-line-after-last-section "D415", # missing-terminal-punctuation "D417", # undocumented-param ``` Some rules is not supported because used not supported style or require add or change documentation in too many files
1 parent 5951153 commit 7715561

File tree

82 files changed

+68
-131
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+68
-131
lines changed

nncf/common/composite_compression.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ def calculate(self, *args: Any, **kwargs: Any) -> Any:
7575
7676
:return: The compression loss value.
7777
"""
78-
7978
if len(self._child_losses) == 0:
8079
msg = "Cannot calculate the loss value because the number of child loss is 0."
8180
raise nncf.InternalError(msg)

nncf/common/graph/graph.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,6 @@ def get_previous_nodes(self, node: NNCFNode) -> List[NNCFNode]:
343343
:param node: Consumer node.
344344
:return: List of producers nodes of provided node.
345345
"""
346-
347346
nx_node_keys = self._nx_graph.pred[self._node_id_to_key_dict[node.node_id]]
348347
return [self._nodes[key] for key in nx_node_keys]
349348

@@ -723,7 +722,6 @@ def get_nncf_graph_pattern_io(self, match: List[str]) -> NNCFGraphPatternIO:
723722
`match` list
724723
:return: NNCFGraphPatternIO object describing the inputs and outputs of the matched subgraph
725724
"""
726-
727725
in_edge_boundary, out_edge_boundary = NNCFGraph._get_edge_boundaries(match, self._nx_graph)
728726
boundary = in_edge_boundary + out_edge_boundary
729727
input_nncf_edges = []

nncf/common/graph/graph_matching.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def _is_subgraph_matching_strict(graph: nx.DiGraph, pattern: nx.DiGraph, subgrap
5757
3) External successors or predecessors of the nodes which are not starting and last.
5858
If any of these conditions is True, than returns False, otherwise - True.
5959
The checks are skipped for NON_PATTERN_NODE_TYPE.
60+
6061
Example:
6162
This subgraph matching is not strict.
6263
(conv2d + BN + ReLU pattern):
@@ -71,6 +72,7 @@ def _is_subgraph_matching_strict(graph: nx.DiGraph, pattern: nx.DiGraph, subgrap
7172
(cat)----/
7273
|
7374
...
75+
7476
:param graph: The model graph.
7577
:param pattern: The matched pattern.
7678
:param subgraph: A subgraph of the model graph including the nodes outside the pattern.

nncf/common/graph/patterns/patterns.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ def __add__(self, other: "GraphPattern") -> "GraphPattern":
101101
:param other: GraphPattern that will be added.
102102
:return: resulted GraphPattern.
103103
"""
104-
105104
final_pattern = GraphPattern()
106105
for self_subgraph in self.get_weakly_connected_subgraphs():
107106
for other_subgraph in other.get_weakly_connected_subgraphs():

nncf/common/insertion_point_graph.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ def __init__(
8787
If left unspecified, every node in `nncf_graph` will be allowed to have a single post-hook for its output
8888
(post-hooking separate tensors in an operation's output is not currently supported)
8989
"""
90-
9190
super().__init__()
9291
self._base_nx_graph = deepcopy(nncf_graph.get_nx_graph_copy())
9392

@@ -320,7 +319,6 @@ def get_ip_graph_with_merged_hw_optimized_operations(
320319
:param full_fusing_pattern: The GraphPatttern object representing a composition of fusing pattern variants.
321320
:return: The InsertionPointGraph with nodes fused according to pattern matching.
322321
"""
323-
324322
merged_ip_graph = deepcopy(self)
325323
matches = find_subgraphs_matching_pattern(merged_ip_graph.get_base_nx_graph(), full_fusing_pattern)
326324
for match in matches:

nncf/common/logging/track_progress.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ def __init__(
179179
it takes to process sequence elements. Useful when processing time is strongly non-uniform.
180180
:return: An iterable of the values in the sequence.
181181
"""
182-
183182
self.sequence = sequence
184183
self.weights = weights
185184
self.total = sum(self.weights) if self.weights is not None else total

nncf/common/pruning/mask_propagation.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ def symbolic_mask_propagation(
9494
are supported by the NNCF pruning algorithm.
9595
:return: Dict of node indices vs the decision made by symbolic mask propagation algorithm.
9696
"""
97-
9897
can_be_closing_convs = self._get_can_closing_convs(prunable_layers_types)
9998
can_prune_by_dim: Dict[int, PruningAnalysisDecision] = {k: None for k in can_be_closing_convs} # type: ignore
10099
for node in self._graph.topological_sort():

nncf/common/pruning/node_selector.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ def create_pruning_groups(self, graph: NNCFGraph) -> Clusterization[NNCFNode]:
9191
:param graph: Graph to work with and their initialization parameters as values.
9292
:return: Clusterization of pruned nodes.
9393
"""
94-
9594
all_nodes_to_prune = graph.get_nodes_by_types(self._prune_operations_types) # NNCFNodes here
9695

9796
# 1. Clusters for special ops
@@ -218,7 +217,6 @@ def _pruning_dimensions_analysis(
218217
are supported by the NNCF pruning algorithm
219218
:return: Pruning node analysis after model analyzer, pruning algo compatibility and pruning dimensions checks.
220219
"""
221-
222220
nodes_of_group_with_non_eq_pruning_dim = self._check_internal_groups_dim(pruned_nodes_clusterization)
223221
can_prune_after_check_updated = can_prune_after_check.copy()
224222
for node_id, val in nodes_of_group_with_non_eq_pruning_dim.items():

nncf/common/quantization/initialization/range.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ def __init__(
8787
specified type of range initialization will be applied. It can be
8888
quantizers group for activations or weights.
8989
"""
90-
9190
super().__init__(
9291
range_init_config.init_type, range_init_config.num_init_samples, range_init_config.init_type_specific_params
9392
)

nncf/common/quantization/quantizer_propagation/graph.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,6 @@ def all_outputs_are_quantized(self, node_key: str) -> bool:
797797
:return: True if all paths from the given node to the first
798798
input quantizable nodes have an activation quantizer, False otherwise.
799799
"""
800-
801800
nodes_keys_stack = deque(self.successors(node_key))
802801
while nodes_keys_stack:
803802
node_key = nodes_keys_stack.popleft()
@@ -1424,7 +1423,6 @@ def _handle_output_quantizers_for_weights_as_outputs_ops(
14241423
:return: A MultiConfigQuantizerSetup with weights-as-outputs-dependent quantizers removed where possible
14251424
and shared inputs/unified scales group adjusted to reflect the change.
14261425
"""
1427-
14281426
# For the weights-are-outputs quantized operations, need to find out the dependent activation quantizers in
14291427
# the multiconfig setup and see if it is possible to avoid requantization by selecting a common configuration
14301428
# subset. If yes and the activation quantizer becomes unnecessary, need to unify the scales of the weight

0 commit comments

Comments
 (0)