Skip to content

Commit

Permalink
Updated yolo.py
Browse files Browse the repository at this point in the history
Added .pylintrc; lint_changed_files.sh
  • Loading branch information
dasdebanna committed Sep 14, 2024
1 parent ab541b7 commit cb714ca
Show file tree
Hide file tree
Showing 3 changed files with 329 additions and 13 deletions.
311 changes: 311 additions & 0 deletions src/.pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,311 @@
[MESSAGES CONTROL]

# Only show warnings with the listed confidence levels. Leave empty to show
# all. Valid levels: HIGH, CONTROL_FLOW, INFERENCE, INFERENCE_FAILURE,
# UNDEFINED.
confidence=HIGH,
CONTROL_FLOW,
INFERENCE,
INFERENCE_FAILURE,
UNDEFINED

# Disable the message, report, category or checker with the given id(s). You
# can either give multiple identifiers separated by comma (,) or put this
# option multiple times (only on the command line, not in the configuration
# file where it should appear only once). You can also use "--disable=all" to
# disable everything first and then re-enable specific checks. For example, if
# you want to run only the similarities checker, you can use "--disable=all
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use "--disable=all --enable=classes
# --disable=W".
disable=
trailing-whitespace,
too-many-arguments,
too-many-locals,
fixme,
invalid-name,
unused-import,
no-else-return,
consider-using-from-import,
unused-argument,
import-error,
line-too-long,
missing-final-newline,
missing-function-docstring,
too-many-branches,
too-many-statements,
too-many-instance-attributes,
too-many-public-methods,
too-many-return-statements,
too-many-nested-blocks,
too-few-public-methods,
too-many-lines,
too-many-boolean-expressions,
too-many-format-args,
too-many-try-statements,
too-many-continue-statements,
too-many-asserts,
too-many-assignments,
too-many-else-branches,
too-many-parameters,
too-many-raises,
too-many-returns,
too-many-yields,
too-many-branches,
too-many-statements,
too-many-instance-attributes,
too-many-public-methods,
too-many-return-statements,
too-many-nested-blocks,
too-few-public-methods,
too-many-lines,
too-many-boolean-expressions,
too-many-format-args,
too-many-try-statements,
too-many-continue-statements,
too-many-asserts,
too-many-assignments,
too-many-else-branches,
too-many-parameters,
too-many-raises,
too-many-returns,
too-many-yields,
too-many-branches,
too-many-statements,
too-many-instance-attributes,
too-many-public-methods,
too-many-return-statements,
too-many-nested-blocks,
too-few-public-methods,
too-many-lines,
too-many-boolean-expressions,
too-many-format-args,
too-many-try-statements,
too-many-continue-statements,
too-many-asserts,
too-many-assignments,
too-many-else-branches,
too-many-parameters,
too-many-raises,
too-many-returns,
too-many-yields,
too-many-branches,
too-many-statements,
too-many-instance-attributes,
too-many-public-methods,
too-many-return-statements,
too-many-nested-blocks,
too-few-public-methods,
too-many-lines,
too-many-boolean-expressions,
too-many-format-args,
too-many-try-statements,
too-many-continue-statements,
too-many-asserts,
too-many-assignments,
too-many-else-branches,
too-many-parameters,
too-many-raises,
too-many-returns,
too-many-yields,
too-many-branches,
too-many-statements,
too-many-instance-attributes,
too-many-public-methods,
too-many-return-statements,
too-many-nested-blocks,
too-few-public-methods,
too-many-lines,
too-many-boolean-expressions,
too-many-format-args,
too-many-try-statements,
too-many-continue-statements,
too-many-asserts,
too-many-assignments,
too-many-else-branches,
too-many-parameters,
too-many-raises,
too-many-returns,
too-many-yields,
too-many-branches,
too-many-statements,
too-many-instance-attributes,
too-many-public-methods,
too-many-return-statements,
too-many-nested-blocks,
too-few-public-methods,
too-many-lines,
too-many-boolean-expressions,
too-many-format-args,
too-many-try-statements,
too-many-continue-statements,
too-many-asserts,
too-many-assignments,
too-many-else-branches,
too-many-parameters,
too-many-raises,
too-many-returns,
too-many-yields,
too-many-branches,
too-many-statements,
too-many-instance-attributes,
too-many-public-methods,
too-many-return-statements,
too-many-nested-blocks,
too-few-public-methods,
too-many-lines,
too-many-boolean-expressions,
too-many-format-args,
too-many-try-statements,
too-many-continue-statements,
too-many-asserts,
too-many-assignments,
too-many-else-branches,
too-many-parameters,
too-many-raises,
too-many-returns,
too-many-yields,
too-many-branches,
too-many-statements,
too-many-instance-attributes,
too-many-public-methods,
too-many-return-statements,
too-many-nested-blocks,
too-few-public-methods,
too-many-lines,
too-many-boolean-expressions,
too-many-format-args,
too-many-try-statements,
too-many-continue-statements,
too-many-asserts,
too-many-assignments,
too-many-else-branches,
too-many-parameters,
too-many-raises,
too-many-returns,
too-many-yields,
too-many-branches,
too-many-statements,
too-many-instance-attributes,
too-many-public-methods,
too-many-return-statements,
too-many-nested-blocks,
too-few-public-methods,
too-many-lines,
too-many-boolean-expressions,
too-many-format-args,
too-many-try-statements,
too-many-continue-statements,
too-many-asserts,
too-many-assignments,
too-many-else-branches,
too-many-parameters,
too-many-raises,
too-many-returns,
too-many-yields,
too-many-branches,
too-many-statements,
too-many-instance-attributes,
too-many-public-methods,
too-many-return-statements,
too-many-nested-blocks,
too-few-public-methods,
too-many-lines,
too-many-boolean-expressions,
too-many-format-args,
too-many-try-statements,
too-many-continue-statements,
too-many-asserts,
too-many-assignments,
too-many-else-branches,
too-many-parameters,
too-many-raises,
too-many-returns,
too-many-yields,
too-many-branches,
too-many-statements,
too-many-instance-attributes,
too-many-public-methods,
too-many-return-statements,
too-many-nested-blocks,
too-few-public-methods,
too-many-lines,
too-many-boolean-expressions,
too-many-format-args,
too-many-try-statements,
too-many-continue-statements,
too-many-asserts,
too-many-assignments,
too-many-else-branches,
too-many-parameters,
too-many-raises,
too-many-returns,
too-many-yields,
too-many-branches,
too-many-statements,
too-many-instance-attributes,
too-many-public-methods,
too-many-return-statements,
too-many-nested-blocks,
too-few-public-methods,
too-many-lines,
too-many-boolean-expressions,
too-many-format-args,
too-many-try-statements,
too-many-continue-statements,
too-many-asserts,
too-many-assignments,
too-many-else-branches,
too-many-parameters,
too-many-raises,
too-many-returns,
too-many-yields,
too-many-branches,
too-many-statements,
too-many-instance-attributes,
too-many-public-methods,
too-many-return-statements,
too-many-nested-blocks,
too-few-public-methods,
too-many-lines,
too-many-boolean-expressions,
too-many-format-args,
too-many-try-statements,
too-many-continue-statements,
too-many-asserts,
too-many-assignments,
too-many-else-branches,
too-many-parameters,
too-many-raises,
too-many-returns,
too-many-yields,
too-many-branches,
too-many-statements,
too-many-instance-attributes,
too-many-public-methods,
too-many-return-statements,
too-many-nested-blocks,
too-few-public-methods,
too-many-lines,
too-many-boolean-expressions,
too-many-format-args,
too-many-try-statements,
too-many-continue-statements,
too-many-asserts,
too-many-assignments,
too-many-else-branches,
too-many-parameters,
too-many-raises,
too-many-returns,
too-many-yields,
too-many-branches,
too-many-statements,
too-many-instance-attributes,
too-many-public-methods,
too-many-return-statements,
too-many-nested-blocks,
too-few-public-methods,
too-many-lines,
too-many-boolean-expressions,
too-many-format-args,
missing-module-docstring,
14 changes: 14 additions & 0 deletions src/lint_changed_files.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

# Get the list of changed Python files
CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRTUXB HEAD~1 HEAD | grep -E '\.py$')

# Check if there are any changed Python files
if [ -z "$CHANGED_FILES" ]; then
echo "No Python files changed."
exit 0
fi

# Run Pylint on the changed Python files
echo "Running Pylint on the changed Python files..."
pylint $CHANGED_FILES
17 changes: 4 additions & 13 deletions src/yolo.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
# pylint: disable=trailing-whitespace
""" suppressing """
# pylint: disable=too-many-arguments
# pylint: disable=too-many-locals
# pylint: disable=fixme
# pylint: disable=invalid-name
# pylint: disable=unused-import
# pylint: disable=no-else-return
import os
import torch
import torch.nn as nn # pylint: disable=consider-using-from-import
import torch.optim as optim # pylint: disable=consider-using-from-import

import torch.nn as nn
import torch.optim as optim
from tqdm import tqdm

# implemented following
Expand Down Expand Up @@ -361,9 +352,9 @@ def load_checkpoint(checkpoint_file, model):

# for param_group in optimizer.param_groups:
# param_group["lr"] = lr
# pylint: disable=unused-argument

def yolo(pretrained=False, **kwargs):
r"""Yolov3 implementation from https://www.geeksforgeeks.org/yolov3-from-scratch-using-pytorch/
"""Yolov3 implementation from https://www.geeksforgeeks.org/yolov3-from-scratch-using-pytorch/
Args:
progress (bool): If True, displays a progress bar of the download to stderr
"""
Expand Down

0 comments on commit cb714ca

Please sign in to comment.