Skip to content

Remove pylint noqa comments #3322

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions python/nav/Snmp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
else:
BACKEND = 'pynetsnmp'

# These wildcard imports are informed, not just accidents.
# pylint: disable=W0401
if BACKEND == 'pynetsnmp':
if sys.platform == "darwin" and not os.getenv("DYLD_LIBRARY_PATH"):
# horrible workaround for MacOS problems, described at length at
Expand Down
2 changes: 0 additions & 2 deletions python/nav/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,11 @@ def is_cached(self):
"""Returns True if this object is stored in an ObjectCache dictionary"""
return self._cache is not None

# pylint: disable=R0201
def is_invalid(self):
"""Returns True if this object is too old (or invalid in some
other way) to remain in the cache."""
return False

# pylint: disable=R0201
def refresh(self):
"""Refresh the object, if possible"""
return False
Expand Down
2 changes: 0 additions & 2 deletions python/nav/arnold.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
NONBLOCKFILE = os.path.join("arnold", "nonblock.conf")
_logger = logging.getLogger(__name__)

# pylint: disable=C0103
Candidate = namedtuple("Candidate", "camid ip mac interface endtime")


Expand Down Expand Up @@ -533,7 +532,6 @@ def get_host_name(ip):
return hostname


# pylint: disable=E1103
def get_netbios(ip):
"""Get netbiosname of computer with ip"""

Expand Down
2 changes: 0 additions & 2 deletions python/nav/asyncdns.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,8 @@
from twisted.names import client
from twisted.internet import defer, task

# pylint: disable=E1101
from twisted.internet import reactor

# pylint: disable=W0611
from twisted.names.error import DNSUnknownError
from twisted.names.error import DomainError, AuthoritativeDomainError
from twisted.names.error import DNSQueryTimeoutError, DNSFormatError
Expand Down
3 changes: 0 additions & 3 deletions python/nav/bin/navclean.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,6 @@ def clean(self, expiry: str, dry_run: bool = False):
return cursor.rowcount


# pylint: disable=missing-docstring


class ArpDeleter(RecordCleaner):
expiry_type = "arp"
selector = "WHERE end_time < {expiry}"
Expand Down
1 change: 0 additions & 1 deletion python/nav/bin/navdump.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
# more details. You should have received a copy of the GNU General Public
# License along with NAV. If not, see <http://www.gnu.org/licenses/>.
#
# pylint: disable=C0111
"""Dumps core information from NAV to textfiles importable by SeedDB"""

import sys
Expand Down
1 change: 0 additions & 1 deletion python/nav/buildconf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""NAV build configuration variables."""

# pylint: disable=invalid-name
from importlib import metadata
import os
import sysconfig
Expand Down
2 changes: 0 additions & 2 deletions python/nav/bulkimport.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
# License along with NAV. If not, see <http://www.gnu.org/licenses/>.
#
"""Import seed data in bulk."""
# no importer implementations have public methods, disable R0903 warning
# pylint: disable=R0903


import json
Expand Down
2 changes: 0 additions & 2 deletions python/nav/bulkparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,6 @@ def get_header(cls):
return header


# don't complain about simple iterators, mr. Pylint!
# pylint: disable=R0903
class CommentStripper:
"""Iterator that strips comments from the input iterator"""

Expand Down
1 change: 0 additions & 1 deletion python/nav/daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,6 @@ def daemonize(pidfile, stdin=None, stdout=None, stderr=None):
return True


# pylint: disable=W0703
def daemonexit(pidfile):
"""
Clean up after daemon process. This functions is only runned by the
Expand Down
2 changes: 0 additions & 2 deletions python/nav/db/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,6 @@ def _retrier(*args, **kwargs):
class ConnectionParameters(object):
"""Database Connection parameters"""

# this data container class needs all these args, period.
# pylint: disable=R0913
def __init__(self, dbhost, dbport, dbname, user, password):
self.dbhost = dbhost
self.dbport = dbport
Expand Down
1 change: 0 additions & 1 deletion python/nav/debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ def log_stacktrace(logger, stacktrace):
logger.debug("--- end of stack trace ---")


# pylint: disable=W0703
def _dumpvars(varitems):
for var, val in varitems:
try:
Expand Down
2 changes: 0 additions & 2 deletions python/nav/django/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,9 @@
if _config_dir:
sys.path.append(os.path.join(_config_dir, "python"))
try:
# pylint: disable=E0602
LOCAL_SETTINGS
except NameError:
try:
# pylint: disable=F0401
from local_settings import *
except ImportError:
pass
Expand Down
2 changes: 0 additions & 2 deletions python/nav/django/templatetags/date_and_time.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
"""Template filters and tags for helping with dates and datetimes"""

from datetime import timedelta

# pylint: disable=W0702,C0103
from django import template
from django.template.defaultfilters import date, time
from nav.django.settings import DATETIME_FORMAT, SHORT_TIME_FORMAT
Expand Down
1 change: 0 additions & 1 deletion python/nav/django/templatetags/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
from django import template
from django.utils.timesince import timesince

# pylint: disable=C0103
register = template.Library()


Expand Down
1 change: 0 additions & 1 deletion python/nav/enterprise/ids.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# IANA assigned enterprise numbers
# As published at http://www.iana.org/assignments/enterprise-numbers
# Generated by iana-enterprise.py on 2015-12-18 13:42:26.546064
# pylint: skip-file
#
VENDOR_ID_RESERVED = 0
VENDOR_ID_NXNETWORKS = 1
Expand Down
2 changes: 0 additions & 2 deletions python/nav/eventengine/alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,4 @@ def _matcher(name):
]


# pylint sucks on namedtuples
# pylint: disable=C0103
TemplateDetails = namedtuple("TemplateDetails", "name msgtype language")
2 changes: 0 additions & 2 deletions python/nav/eventengine/unresolved.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ def get_map():

def update():
"""Updates the map of unresolved alerts from the database"""
# yes mr. pylint, we use global state, this module acts as a singleton
# pylint: disable=W0603
global _unresolved_alerts_map
unresolved = AlertHistory.objects.filter(end_time__gte=INFINITY)
_unresolved_alerts_map = dict((alert.get_key(), alert) for alert in unresolved)
Expand Down
3 changes: 0 additions & 3 deletions python/nav/ipdevpoll/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ def __init__(self, netbox, agent, containers, config: IpdevpollConfig = None):
self.containers = containers
self.config = config
# touch _logger to initialize logging context right away
# pylint: disable=W0104
self._logger

def __str__(self):
Expand All @@ -63,8 +62,6 @@ def handle(self):
"""Handle plugin business, return a deferred."""
raise NotImplementedError

# this is an API, so netbox goes unused in the base class:
# pylint: disable=W0613
@classmethod
def can_handle(cls, netbox):
"""Verifies whether this plugin can/wants to handle polling for this
Expand Down
2 changes: 0 additions & 2 deletions python/nav/ipdevpoll/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,6 @@ def get_netbox_filter(section, config=None):
return []


# this is a data container class, mr. pylint!
# pylint: disable=R0913,R0903
class JobDescriptor(object):
"""A data structure describing a job."""

Expand Down
1 change: 0 additions & 1 deletion python/nav/ipdevpoll/dataloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ def __init__(self):
super(NetboxLoader, self).__init__()
self.peak_count = 0
# touch _logger to initialize logging context right away
# pylint: disable=W0104
self._logger

def load_all_s(self):
Expand Down
4 changes: 0 additions & 4 deletions python/nav/ipdevpoll/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ def _get_willing_plugins(self, plugin_classes):
raise
# We very intentionally log and ignore unhandled exception here, to ensure
# the stability of the ipdevpoll daemon
# pylint: disable = broad-except
except Exception:
self._logger.exception("Unhandled exception from can_handle(): %r", cls)
can_handle = False
Expand Down Expand Up @@ -326,8 +325,6 @@ def save(result):
df.addCallback(wrap_up_job)
return df

# pylint is unable to find reactor members:
# pylint: disable=E1101
shutdown_trigger_id = reactor.addSystemEventTrigger(
"before", "shutdown", self.cancel
)
Expand Down Expand Up @@ -534,7 +531,6 @@ def get_instance_count(cls):
"""
return len([o for o in gc.get_objects() if isinstance(o, cls)])

# pylint: disable=W0703
@defer.inlineCallbacks
def _log_job_externally(self, success=True):
"""Logs a job to the database"""
Expand Down
1 change: 0 additions & 1 deletion python/nav/ipdevpoll/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ def _set_format(self, fmt):
self._style._fmt = fmt


# pylint: disable=R0903
class ContextLogger(object):
"""Descriptor for getting an appropriate logger instance.

Expand Down
1 change: 0 additions & 1 deletion python/nav/ipdevpoll/neighbor.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ def _get_netbox_catids():
)


# pylint: disable=R0903
class Neighbor(object):
"Abstract base class for neigbor identification"

Expand Down
5 changes: 1 addition & 4 deletions python/nav/ipdevpoll/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ def shutdown(self):
self.done = True
return {}

# pylint: disable=no-self-use
@Ping.responder
def ping(self):
"""Returns the string "pong" as a response to a ping"""
Expand Down Expand Up @@ -280,7 +279,6 @@ def pid(self):
"""Returns the PID number of the worker process, if started"""
try:
if not self._pid:
# pylint: disable=protected-access
self._pid = self.process.transport._process.pid
except AttributeError:
return None
Expand Down Expand Up @@ -314,7 +312,6 @@ def _euthanize_unresponsive_worker(self, timeout=10):
except twisted.internet.defer.TimeoutError:
self._logger.warning("PING: Timed out for %r", self)
is_alive = False
except Exception: # pylint: disable=broad-except
self._logger.exception(
"PING: Unhandled exception while pinging %r", self
)
Expand All @@ -328,7 +325,7 @@ def _euthanize_unresponsive_worker(self, timeout=10):
"PING: Not responding, attempting to kill: %r", self
)
os.kill(self.pid, signal.SIGTERM)
except Exception: # pylint: disable=broad-except
except Exception:
self._logger.exception(
"PING: Ignoring unhandled exception when killing worker %r", self
)
Expand Down
5 changes: 0 additions & 5 deletions python/nav/ipdevpoll/shadows/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,6 @@
# Shadow classes. Not all of these will be used to store data, but
# may be used to retrieve and cache existing database records.

# Shadow classes usually don't need docstrings - these can be found in the
# Django models being shadowed:
# pylint: disable=C0111

ALERT_TYPE_MAPPING = {
"hardware_version": "deviceHwUpgrade",
Expand Down Expand Up @@ -139,8 +136,6 @@ class Vendor(Shadow):
__shadowclass__ = manage.Vendor


# pylint is unable to see which members are created dynamically by metaclass:
# pylint: disable=E0203,W0201
class Module(Shadow):
__shadowclass__ = manage.Module
__lookups__ = [('netbox', 'device'), ('netbox', 'name')]
Expand Down
2 changes: 0 additions & 2 deletions python/nav/ipdevpoll/shadows/adjacency.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ def _delete_expired(self):
expired.delete()


# pylint: disable=C0111
class AdjacencyCandidate(Shadow):
__shadowclass__ = manage.AdjacencyCandidate
manager = AdjacencyManager
Expand Down Expand Up @@ -211,7 +210,6 @@ def cleanup(self):
).delete()


# pylint: disable=C0111,W0201,E0203
class UnrecognizedNeighbor(Shadow):
__shadowclass__ = manage.UnrecognizedNeighbor
__lookups__ = [('netbox', 'interface', 'remote_id')]
Expand Down
4 changes: 0 additions & 4 deletions python/nav/ipdevpoll/shadows/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
MISSING_THRESHOLD = datetime.timedelta(days=1)
INFINITY = datetime.datetime.max

# pylint: disable=C0111


class InterfaceManager(DefaultManager):
_found_existing_map = {}
Expand Down Expand Up @@ -295,8 +293,6 @@ def get_linkstate_filter(self):
return link_filter


# pylint is unable to see which members are created dynamically by metaclass:
# pylint: disable=W0201,E0203
class Interface(Shadow):
__shadowclass__ = manage.Interface
manager = InterfaceManager
Expand Down
1 change: 0 additions & 1 deletion python/nav/ipdevpoll/shadows/netbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
from nav.ipdevpoll.storage import Shadow


# pylint: disable=C0111
class Netbox(Shadow):
__shadowclass__ = manage.Netbox
__lookups__ = ['sysname', 'ip']
Expand Down
1 change: 0 additions & 1 deletion python/nav/ipdevpoll/shadows/swportblocked.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ def cleanup(self):
manage.SwPortBlocked.objects.filter(id__in=[b.id for b in gone]).delete()


# pylint: disable=W0201,E0203,C0111
class SwPortBlocked(Shadow):
__shadowclass__ = manage.SwPortBlocked
manager = SwPortBlockedManager
Expand Down
9 changes: 0 additions & 9 deletions python/nav/ipdevpoll/snmp/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ def _wrapper(*args, **kwargs):
return wraps(func)(_wrapper)


# pylint: disable=R0903
class AgentProxyMixIn(object):
"""Common AgentProxy mix-in class.

Expand Down Expand Up @@ -114,27 +113,19 @@ def __repr__(self):
ident=id(self),
)

# hey, we're mimicking someone else's API here, never mind the bollocks:
# pylint: disable=C0111,C0103
@cache_for_session
def getTable(self, *args, **kwargs):
kwargs['maxRepetitions'] = self.snmp_parameters.max_repetitions
return super(AgentProxyMixIn, self).getTable(*args, **kwargs)

# hey, we're mimicking someone else's API here, never mind the bollocks:
# pylint: disable=C0111,C0103
@throttled
def _get(self, *args, **kwargs):
return super(AgentProxyMixIn, self)._get(*args, **kwargs)

# hey, we're mimicking someone else's API here, never mind the bollocks:
# pylint: disable=C0111,C0103
@throttled
def _walk(self, *args, **kwargs):
return super(AgentProxyMixIn, self)._walk(*args, **kwargs)

# hey, we're mimicking someone else's API here, never mind the bollocks:
# pylint: disable=C0111,C0103
@throttled
def _getbulk(self, *args, **kwargs):
return super(AgentProxyMixIn, self)._getbulk(*args, **kwargs)
Expand Down
2 changes: 0 additions & 2 deletions python/nav/ipdevpoll/snmp/pynetsnmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@
# License along with NAV. If not, see <http://www.gnu.org/licenses/>.
#
"""pynetsnmp compatibility"""
# pylint: disable=C0103,C0111,W0703,R0903,W0611

import inspect
import os

import sys

# pylint: disable=wrong-import-position
# don't have NET-SNMP load and parse MIB modules, we don't use them
# and we don't need all the parsing errors in our logs
os.environ['MIBS'] = ''
Expand Down
Loading
Loading