The following issues were found

database/sqlite/sqlite3.c
679 issues
readlink - This accepts filename arguments; if an attacker can move those files or change the link content, a race condition results. Also, it does not terminate with ASCII NUL.
Security

Line: 34075 Column: 42 CWE codes: 362 20
Suggestion: Reconsider approach

              #define osGetpagesize ((int(*)(void))aSyscall[25].pCurrent)

#if defined(HAVE_READLINK)
  { "readlink",     (sqlite3_syscall_ptr)readlink,        0 },
#else
  { "readlink",     (sqlite3_syscall_ptr)0,               0 },
#endif
#define osReadlink ((ssize_t(*)(const char*,char*,size_t))aSyscall[26].pCurrent)


            

Reported by FlawFinder.

access - This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition
Security

Line: 33945 Column: 42 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

                { "close",        (sqlite3_syscall_ptr)close,      0  },
#define osClose     ((int(*)(int))aSyscall[1].pCurrent)

  { "access",       (sqlite3_syscall_ptr)access,     0  },
#define osAccess    ((int(*)(const char*,int))aSyscall[2].pCurrent)

  { "getcwd",       (sqlite3_syscall_ptr)getcwd,     0  },
#define osGetcwd    ((char*(*)(char*,size_t))aSyscall[3].pCurrent)


            

Reported by FlawFinder.

printf - If format strings can be influenced by an attacker, they can be exploited
Security

Line: 51828 Column: 28 CWE codes: 134
Suggestion: Use a constant for the format specification

              */
#if 0
int sqlite3PagerTrace=1;  /* True to enable tracing */
#define sqlite3DebugPrintf printf
#define PAGERTRACE(X)     if( sqlite3PagerTrace ){ sqlite3DebugPrintf X; }
#else
#define PAGERTRACE(X)
#endif


            

Reported by FlawFinder.

printf - If format strings can be influenced by an attacker, they can be exploited
Security

Line: 64516 Column: 42 CWE codes: 134
Suggestion: Use a constant for the format specification

              */
#if 0
int sqlite3BtreeTrace=1;  /* True to enable tracing */
# define TRACE(X)  if(sqlite3BtreeTrace){printf X;fflush(stdout);}
#else
# define TRACE(X)
#endif

/*

            

Reported by FlawFinder.

fprintf - If format strings can be influenced by an attacker, they can be exploited
Security

Line: 79592 Column: 3 CWE codes: 134
Suggestion: Use a constant for the format specification

                /* NB:  The sqlite3OpcodeName() function is implemented by code created
  ** by the mkopcodeh.awk and mkopcodec.awk scripts which extract the
  ** information from the vdbe.c source text */
  fprintf(pOut, zFormat1, pc,
      sqlite3OpcodeName(pOp->opcode), pOp->p1, pOp->p2, pOp->p3,
      zP4 ? zP4 : "", pOp->p5,
      zCom ? zCom : ""
  );
  fflush(pOut);

            

Reported by FlawFinder.

printf - If format strings can be influenced by an attacker, they can be exploited
Security

Line: 85789 Column: 5 CWE codes: 134
Suggestion: Use a constant for the format specification

                if( p->flags & MEM_Undefined ){
    printf(" undefined");
  }else if( p->flags & MEM_Null ){
    printf(p->flags & MEM_Zero ? " NULL-nochng" : " NULL");
  }else if( (p->flags & (MEM_Int|MEM_Str))==(MEM_Int|MEM_Str) ){
    printf(" si:%lld", p->u.i);
  }else if( (p->flags & (MEM_IntReal))!=0 ){
    printf(" ir:%lld", p->u.i);
  }else if( p->flags & MEM_Int ){

            

Reported by FlawFinder.

printf - If format strings can be influenced by an attacker, they can be exploited
Security

Line: 119025 Column: 14 CWE codes: 134
Suggestion: Use a constant for the format specification

                  FUNCTION2(typeof,            1, 0, 0, typeofFunc,  SQLITE_FUNC_TYPEOF),
    FUNCTION2(length,            1, 0, 0, lengthFunc,  SQLITE_FUNC_LENGTH),
    FUNCTION(instr,              2, 0, 0, instrFunc        ),
    FUNCTION(printf,            -1, 0, 0, printfFunc       ),
    FUNCTION(unicode,            1, 0, 0, unicodeFunc      ),
    FUNCTION(char,              -1, 0, 0, charFunc         ),
    FUNCTION(abs,                1, 0, 0, absFunc          ),
#ifndef SQLITE_OMIT_FLOATING_POINT
    FUNCTION(round,              1, 0, 0, roundFunc        ),

            

Reported by FlawFinder.

printf - If format strings can be influenced by an attacker, they can be exploited
Security

Line: 192472 Column: 35 CWE codes: 134
Suggestion: Use a constant for the format specification

              /* Enable -DGEOPOLY_ENABLE_DEBUG for debugging facilities */
#ifdef GEOPOLY_ENABLE_DEBUG
  static int geo_debug = 0;
# define GEODEBUG(X) if(geo_debug)printf X
#else
# define GEODEBUG(X)
#endif

#ifndef JSON_NULL   /* The following stuff repeats things found in json1 */

            

Reported by FlawFinder.

InitializeCriticalSection - Exceptions can be thrown in low-memory situations
Security

Line: 27053 Column: 7 CWE codes:
Suggestion: Use InitializeCriticalSectionAndSpinCount instead

              #if SQLITE_OS_WINRT
      InitializeCriticalSectionEx(&winMutex_staticMutexes[i].mutex, 0, 0);
#else
      InitializeCriticalSection(&winMutex_staticMutexes[i].mutex);
#endif
    }
    winMutex_isInit = 1;
  }else{
    /* Another thread is (in the process of) initializing the static

            

Reported by FlawFinder.

InitializeCriticalSection - Exceptions can be thrown in low-memory situations
Security

Line: 27147 Column: 9 CWE codes:
Suggestion: Use InitializeCriticalSectionAndSpinCount instead

              #if SQLITE_OS_WINRT
        InitializeCriticalSectionEx(&p->mutex, 0, 0);
#else
        InitializeCriticalSection(&p->mutex);
#endif
      }
      break;
    }
    default: {

            

Reported by FlawFinder.

collectors/python.d.plugin/python_modules/pyyaml3/scanner.py
446 issues
Attempted relative import beyond top-level package
Error

Line: 30 Column: 1

              
__all__ = ['Scanner', 'ScannerError']

from .error import MarkedYAMLError
from .tokens import *

class ScannerError(MarkedYAMLError):
    pass


            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 31 Column: 1

              __all__ = ['Scanner', 'ScannerError']

from .error import MarkedYAMLError
from .tokens import *

class ScannerError(MarkedYAMLError):
    pass

class SimpleKey:

            

Reported by Pylint.

Instance of 'Scanner' has no 'column' member
Error

Line: 164 Column: 28

              
        # Compare the current indentation and column. It may add some tokens
        # and decrease the current indentation level.
        self.unwind_indent(self.column)

        # Peek the next character.
        ch = self.peek()

        # Is it the end of stream?

            

Reported by Pylint.

Instance of 'Scanner' has no 'peek' member
Error

Line: 167 Column: 14

                      self.unwind_indent(self.column)

        # Peek the next character.
        ch = self.peek()

        # Is it the end of stream?
        if ch == '\0':
            return self.fetch_stream_end()


            

Reported by Pylint.

Instance of 'Scanner' has no 'get_mark' member
Error

Line: 258 Column: 17

                      # No? It's an error. Let's produce a nice error message.
        raise ScannerError("while scanning for the next token", None,
                "found character %r that cannot start any token" % ch,
                self.get_mark())

    # Simple keys treatment.

    def next_possible_simple_key(self):
        # Return the number of the nearest possible simple key. Actually we

            

Reported by Pylint.

Instance of 'Scanner' has no 'line' member
Error

Line: 286 Column: 28

                      # height (may cause problems if indentation is broken though).
        for level in list(self.possible_simple_keys):
            key = self.possible_simple_keys[level]
            if key.line != self.line  \
                    or self.index-key.index > 1024:
                if key.required:
                    raise ScannerError("while scanning a simple key", key.mark,
                            "could not found expected ':'", self.get_mark())
                del self.possible_simple_keys[level]

            

Reported by Pylint.

Instance of 'Scanner' has no 'index' member
Error

Line: 287 Column: 24

                      for level in list(self.possible_simple_keys):
            key = self.possible_simple_keys[level]
            if key.line != self.line  \
                    or self.index-key.index > 1024:
                if key.required:
                    raise ScannerError("while scanning a simple key", key.mark,
                            "could not found expected ':'", self.get_mark())
                del self.possible_simple_keys[level]


            

Reported by Pylint.

Instance of 'Scanner' has no 'get_mark' member
Error

Line: 290 Column: 61

                                  or self.index-key.index > 1024:
                if key.required:
                    raise ScannerError("while scanning a simple key", key.mark,
                            "could not found expected ':'", self.get_mark())
                del self.possible_simple_keys[level]

    def save_possible_simple_key(self):
        # The next token may start a simple key. We check if it's possible
        # and save its position. This function is called for

            

Reported by Pylint.

Instance of 'Scanner' has no 'column' member
Error

Line: 299 Column: 59

                      #   ALIAS, ANCHOR, TAG, SCALAR(flow), '[', and '{'.

        # Check if a simple key is required at the current position.
        required = not self.flow_level and self.indent == self.column

        # A simple key is required only if it is the first token in the current
        # line. Therefore it is always allowed.
        assert self.allow_simple_key or not required


            

Reported by Pylint.

Instance of 'Scanner' has no 'line' member
Error

Line: 311 Column: 33

                          self.remove_possible_simple_key()
            token_number = self.tokens_taken+len(self.tokens)
            key = SimpleKey(token_number, required,
                    self.index, self.line, self.column, self.get_mark())
            self.possible_simple_keys[self.flow_level] = key

    def remove_possible_simple_key(self):
        # Remove the saved possible key position at the current flow level.
        if self.flow_level in self.possible_simple_keys:

            

Reported by Pylint.

collectors/python.d.plugin/python_modules/pyyaml2/parser.py
244 issues
Unable to import 'error'
Error

Line: 65 Column: 1

              
__all__ = ['Parser', 'ParserError']

from error import MarkedYAMLError
from tokens import *
from events import *
from scanner import *

class ParserError(MarkedYAMLError):

            

Reported by Pylint.

Unable to import 'tokens'
Error

Line: 66 Column: 1

              __all__ = ['Parser', 'ParserError']

from error import MarkedYAMLError
from tokens import *
from events import *
from scanner import *

class ParserError(MarkedYAMLError):
    pass

            

Reported by Pylint.

Unable to import 'events'
Error

Line: 67 Column: 1

              
from error import MarkedYAMLError
from tokens import *
from events import *
from scanner import *

class ParserError(MarkedYAMLError):
    pass


            

Reported by Pylint.

Unable to import 'scanner'
Error

Line: 68 Column: 1

              from error import MarkedYAMLError
from tokens import *
from events import *
from scanner import *

class ParserError(MarkedYAMLError):
    pass

class Parser(object):

            

Reported by Pylint.

Instance of 'Parser' has no 'get_token' member
Error

Line: 131 Column: 17

                  def parse_stream_start(self):

        # Parse the stream start.
        token = self.get_token()
        event = StreamStartEvent(token.start_mark, token.end_mark,
                encoding=token.encoding)

        # Prepare the next state.
        self.state = self.parse_implicit_document_start

            

Reported by Pylint.

Undefined variable 'StreamStartEvent'
Error

Line: 132 Column: 17

              
        # Parse the stream start.
        token = self.get_token()
        event = StreamStartEvent(token.start_mark, token.end_mark,
                encoding=token.encoding)

        # Prepare the next state.
        self.state = self.parse_implicit_document_start


            

Reported by Pylint.

Undefined variable 'DirectiveToken'
Error

Line: 143 Column: 33

                  def parse_implicit_document_start(self):

        # Parse an implicit document.
        if not self.check_token(DirectiveToken, DocumentStartToken,
                StreamEndToken):
            self.tag_handles = self.DEFAULT_TAGS
            token = self.peek_token()
            start_mark = end_mark = token.start_mark
            event = DocumentStartEvent(start_mark, end_mark,

            

Reported by Pylint.

Instance of 'Parser' has no 'check_token' member
Error

Line: 143 Column: 16

                  def parse_implicit_document_start(self):

        # Parse an implicit document.
        if not self.check_token(DirectiveToken, DocumentStartToken,
                StreamEndToken):
            self.tag_handles = self.DEFAULT_TAGS
            token = self.peek_token()
            start_mark = end_mark = token.start_mark
            event = DocumentStartEvent(start_mark, end_mark,

            

Reported by Pylint.

Undefined variable 'DocumentStartToken'
Error

Line: 143 Column: 49

                  def parse_implicit_document_start(self):

        # Parse an implicit document.
        if not self.check_token(DirectiveToken, DocumentStartToken,
                StreamEndToken):
            self.tag_handles = self.DEFAULT_TAGS
            token = self.peek_token()
            start_mark = end_mark = token.start_mark
            event = DocumentStartEvent(start_mark, end_mark,

            

Reported by Pylint.

Undefined variable 'StreamEndToken'
Error

Line: 144 Column: 17

              
        # Parse an implicit document.
        if not self.check_token(DirectiveToken, DocumentStartToken,
                StreamEndToken):
            self.tag_handles = self.DEFAULT_TAGS
            token = self.peek_token()
            start_mark = end_mark = token.start_mark
            event = DocumentStartEvent(start_mark, end_mark,
                    explicit=False)

            

Reported by Pylint.

collectors/python.d.plugin/python_modules/pyyaml3/parser.py
243 issues
Attempted relative import beyond top-level package
Error

Line: 65 Column: 1

              
__all__ = ['Parser', 'ParserError']

from .error import MarkedYAMLError
from .tokens import *
from .events import *
from .scanner import *

class ParserError(MarkedYAMLError):

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 66 Column: 1

              __all__ = ['Parser', 'ParserError']

from .error import MarkedYAMLError
from .tokens import *
from .events import *
from .scanner import *

class ParserError(MarkedYAMLError):
    pass

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 67 Column: 1

              
from .error import MarkedYAMLError
from .tokens import *
from .events import *
from .scanner import *

class ParserError(MarkedYAMLError):
    pass


            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 68 Column: 1

              from .error import MarkedYAMLError
from .tokens import *
from .events import *
from .scanner import *

class ParserError(MarkedYAMLError):
    pass

class Parser:

            

Reported by Pylint.

Instance of 'Parser' has no 'get_token' member
Error

Line: 131 Column: 17

                  def parse_stream_start(self):

        # Parse the stream start.
        token = self.get_token()
        event = StreamStartEvent(token.start_mark, token.end_mark,
                encoding=token.encoding)

        # Prepare the next state.
        self.state = self.parse_implicit_document_start

            

Reported by Pylint.

Undefined variable 'StreamStartEvent'
Error

Line: 132 Column: 17

              
        # Parse the stream start.
        token = self.get_token()
        event = StreamStartEvent(token.start_mark, token.end_mark,
                encoding=token.encoding)

        # Prepare the next state.
        self.state = self.parse_implicit_document_start


            

Reported by Pylint.

Instance of 'Parser' has no 'check_token' member
Error

Line: 143 Column: 16

                  def parse_implicit_document_start(self):

        # Parse an implicit document.
        if not self.check_token(DirectiveToken, DocumentStartToken,
                StreamEndToken):
            self.tag_handles = self.DEFAULT_TAGS
            token = self.peek_token()
            start_mark = end_mark = token.start_mark
            event = DocumentStartEvent(start_mark, end_mark,

            

Reported by Pylint.

Undefined variable 'DirectiveToken'
Error

Line: 143 Column: 33

                  def parse_implicit_document_start(self):

        # Parse an implicit document.
        if not self.check_token(DirectiveToken, DocumentStartToken,
                StreamEndToken):
            self.tag_handles = self.DEFAULT_TAGS
            token = self.peek_token()
            start_mark = end_mark = token.start_mark
            event = DocumentStartEvent(start_mark, end_mark,

            

Reported by Pylint.

Undefined variable 'DocumentStartToken'
Error

Line: 143 Column: 49

                  def parse_implicit_document_start(self):

        # Parse an implicit document.
        if not self.check_token(DirectiveToken, DocumentStartToken,
                StreamEndToken):
            self.tag_handles = self.DEFAULT_TAGS
            token = self.peek_token()
            start_mark = end_mark = token.start_mark
            event = DocumentStartEvent(start_mark, end_mark,

            

Reported by Pylint.

Undefined variable 'StreamEndToken'
Error

Line: 144 Column: 17

              
        # Parse an implicit document.
        if not self.check_token(DirectiveToken, DocumentStartToken,
                StreamEndToken):
            self.tag_handles = self.DEFAULT_TAGS
            token = self.peek_token()
            start_mark = end_mark = token.start_mark
            event = DocumentStartEvent(start_mark, end_mark,
                    explicit=False)

            

Reported by Pylint.

collectors/python.d.plugin/python_modules/urllib3/packages/six.py
181 issues
Undefined variable 'basestring'
Error

Line: 33 Column: 20

              
    MAXSIZE = sys.maxsize
else:
    string_types = basestring,
    integer_types = (int, long)
    class_types = (type, types.ClassType)
    text_type = unicode
    binary_type = str


            

Reported by Pylint.

Undefined variable 'long'
Error

Line: 34 Column: 27

                  MAXSIZE = sys.maxsize
else:
    string_types = basestring,
    integer_types = (int, long)
    class_types = (type, types.ClassType)
    text_type = unicode
    binary_type = str

    if sys.platform.startswith("java"):

            

Reported by Pylint.

Module 'types' has no 'ClassType' member
Error

Line: 35 Column: 26

              else:
    string_types = basestring,
    integer_types = (int, long)
    class_types = (type, types.ClassType)
    text_type = unicode
    binary_type = str

    if sys.platform.startswith("java"):
        # Jython always uses 32 bits.

            

Reported by Pylint.

Undefined variable 'unicode'
Error

Line: 36 Column: 17

                  string_types = basestring,
    integer_types = (int, long)
    class_types = (type, types.ClassType)
    text_type = unicode
    binary_type = str

    if sys.platform.startswith("java"):
        # Jython always uses 32 bits.
        MAXSIZE = int((1 << 31) - 1)

            

Reported by Pylint.

Instance of '_LazyDescr' has no '_resolve' member
Error

Line: 76 Column: 18

                      self.name = name

    def __get__(self, obj, tp):
        result = self._resolve()
        setattr(obj, self.name, result)  # Invokes __set__.
        try:
            # This is a bit ugly, but it avoids running this again by
            # removing this descriptor.
            delattr(obj.__class__, self.name)

            

Reported by Pylint.

Class 'Iterator' has no '__next__' member
Error

Line: 542 Column: 20

                  class Iterator(object):

        def next(self):
            return type(self).__next__(self)

    callable = callable
_add_doc(get_unbound_function,
         """Get the function out of a possibly unbound function""")


            

Reported by Pylint.

Undefined variable 'unicode'
Error

Line: 631 Column: 16

                  # Workaround for standalone backslash

    def u(s):
        return unicode(s.replace(r'\\', r'\\\\'), "unicode_escape")
    unichr = unichr
    int2byte = chr

    def byte2int(bs):
        return ord(bs[0])

            

Reported by Pylint.

Module 'itertools' has no 'imap' member
Error

Line: 640 Column: 35

              
    def indexbytes(buf, i):
        return ord(buf[i])
    iterbytes = functools.partial(itertools.imap, ord)
    import StringIO
    StringIO = BytesIO = StringIO.StringIO
    _assertCountEqual = "assertItemsEqual"
    _assertRaisesRegex = "assertRaisesRegexp"
    _assertRegex = "assertRegexpMatches"

            

Reported by Pylint.

Unable to import 'StringIO'
Error

Line: 641 Column: 5

                  def indexbytes(buf, i):
        return ord(buf[i])
    iterbytes = functools.partial(itertools.imap, ord)
    import StringIO
    StringIO = BytesIO = StringIO.StringIO
    _assertCountEqual = "assertItemsEqual"
    _assertRaisesRegex = "assertRaisesRegexp"
    _assertRegex = "assertRegexpMatches"
_add_doc(b, """Byte literal""")

            

Reported by Pylint.

Undefined variable 'basestring'
Error

Line: 714 Column: 37

                          return

        def write(data):
            if not isinstance(data, basestring):
                data = str(data)
            # If the file has an encoding, encode unicode with it.
            if (isinstance(fp, file) and
                    isinstance(data, unicode) and
                    fp.encoding is not None):

            

Reported by Pylint.

collectors/python.d.plugin/python_modules/pyyaml2/emitter.py
155 issues
Unable to import 'error'
Error

Line: 12 Column: 1

              
__all__ = ['Emitter', 'EmitterError']

from error import YAMLError
from events import *

class EmitterError(YAMLError):
    pass


            

Reported by Pylint.

Unable to import 'events'
Error

Line: 13 Column: 1

              __all__ = ['Emitter', 'EmitterError']

from error import YAMLError
from events import *

class EmitterError(YAMLError):
    pass

class ScalarAnalysis(object):

            

Reported by Pylint.

Undefined variable 'DocumentStartEvent'
Error

Line: 125 Column: 30

                      if not self.events:
            return True
        event = self.events[0]
        if isinstance(event, DocumentStartEvent):
            return self.need_events(1)
        elif isinstance(event, SequenceStartEvent):
            return self.need_events(2)
        elif isinstance(event, MappingStartEvent):
            return self.need_events(3)

            

Reported by Pylint.

Undefined variable 'SequenceStartEvent'
Error

Line: 127 Column: 32

                      event = self.events[0]
        if isinstance(event, DocumentStartEvent):
            return self.need_events(1)
        elif isinstance(event, SequenceStartEvent):
            return self.need_events(2)
        elif isinstance(event, MappingStartEvent):
            return self.need_events(3)
        else:
            return False

            

Reported by Pylint.

Undefined variable 'MappingStartEvent'
Error

Line: 129 Column: 32

                          return self.need_events(1)
        elif isinstance(event, SequenceStartEvent):
            return self.need_events(2)
        elif isinstance(event, MappingStartEvent):
            return self.need_events(3)
        else:
            return False

    def need_events(self, count):

            

Reported by Pylint.

Undefined variable 'DocumentStartEvent'
Error

Line: 137 Column: 35

                  def need_events(self, count):
        level = 0
        for event in self.events[1:]:
            if isinstance(event, (DocumentStartEvent, CollectionStartEvent)):
                level += 1
            elif isinstance(event, (DocumentEndEvent, CollectionEndEvent)):
                level -= 1
            elif isinstance(event, StreamEndEvent):
                level = -1

            

Reported by Pylint.

Undefined variable 'CollectionStartEvent'
Error

Line: 137 Column: 55

                  def need_events(self, count):
        level = 0
        for event in self.events[1:]:
            if isinstance(event, (DocumentStartEvent, CollectionStartEvent)):
                level += 1
            elif isinstance(event, (DocumentEndEvent, CollectionEndEvent)):
                level -= 1
            elif isinstance(event, StreamEndEvent):
                level = -1

            

Reported by Pylint.

Undefined variable 'CollectionEndEvent'
Error

Line: 139 Column: 55

                      for event in self.events[1:]:
            if isinstance(event, (DocumentStartEvent, CollectionStartEvent)):
                level += 1
            elif isinstance(event, (DocumentEndEvent, CollectionEndEvent)):
                level -= 1
            elif isinstance(event, StreamEndEvent):
                level = -1
            if level < 0:
                return False

            

Reported by Pylint.

Undefined variable 'DocumentEndEvent'
Error

Line: 139 Column: 37

                      for event in self.events[1:]:
            if isinstance(event, (DocumentStartEvent, CollectionStartEvent)):
                level += 1
            elif isinstance(event, (DocumentEndEvent, CollectionEndEvent)):
                level -= 1
            elif isinstance(event, StreamEndEvent):
                level = -1
            if level < 0:
                return False

            

Reported by Pylint.

Undefined variable 'StreamEndEvent'
Error

Line: 141 Column: 36

                              level += 1
            elif isinstance(event, (DocumentEndEvent, CollectionEndEvent)):
                level -= 1
            elif isinstance(event, StreamEndEvent):
                level = -1
            if level < 0:
                return False
        return (len(self.events) < count+1)


            

Reported by Pylint.

collectors/python.d.plugin/python_modules/pyyaml3/emitter.py
152 issues
Attempted relative import beyond top-level package
Error

Line: 12 Column: 1

              
__all__ = ['Emitter', 'EmitterError']

from .error import YAMLError
from .events import *

class EmitterError(YAMLError):
    pass


            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 13 Column: 1

              __all__ = ['Emitter', 'EmitterError']

from .error import YAMLError
from .events import *

class EmitterError(YAMLError):
    pass

class ScalarAnalysis:

            

Reported by Pylint.

Undefined variable 'DocumentStartEvent'
Error

Line: 125 Column: 30

                      if not self.events:
            return True
        event = self.events[0]
        if isinstance(event, DocumentStartEvent):
            return self.need_events(1)
        elif isinstance(event, SequenceStartEvent):
            return self.need_events(2)
        elif isinstance(event, MappingStartEvent):
            return self.need_events(3)

            

Reported by Pylint.

Undefined variable 'SequenceStartEvent'
Error

Line: 127 Column: 32

                      event = self.events[0]
        if isinstance(event, DocumentStartEvent):
            return self.need_events(1)
        elif isinstance(event, SequenceStartEvent):
            return self.need_events(2)
        elif isinstance(event, MappingStartEvent):
            return self.need_events(3)
        else:
            return False

            

Reported by Pylint.

Undefined variable 'MappingStartEvent'
Error

Line: 129 Column: 32

                          return self.need_events(1)
        elif isinstance(event, SequenceStartEvent):
            return self.need_events(2)
        elif isinstance(event, MappingStartEvent):
            return self.need_events(3)
        else:
            return False

    def need_events(self, count):

            

Reported by Pylint.

Undefined variable 'CollectionStartEvent'
Error

Line: 137 Column: 55

                  def need_events(self, count):
        level = 0
        for event in self.events[1:]:
            if isinstance(event, (DocumentStartEvent, CollectionStartEvent)):
                level += 1
            elif isinstance(event, (DocumentEndEvent, CollectionEndEvent)):
                level -= 1
            elif isinstance(event, StreamEndEvent):
                level = -1

            

Reported by Pylint.

Undefined variable 'DocumentStartEvent'
Error

Line: 137 Column: 35

                  def need_events(self, count):
        level = 0
        for event in self.events[1:]:
            if isinstance(event, (DocumentStartEvent, CollectionStartEvent)):
                level += 1
            elif isinstance(event, (DocumentEndEvent, CollectionEndEvent)):
                level -= 1
            elif isinstance(event, StreamEndEvent):
                level = -1

            

Reported by Pylint.

Undefined variable 'DocumentEndEvent'
Error

Line: 139 Column: 37

                      for event in self.events[1:]:
            if isinstance(event, (DocumentStartEvent, CollectionStartEvent)):
                level += 1
            elif isinstance(event, (DocumentEndEvent, CollectionEndEvent)):
                level -= 1
            elif isinstance(event, StreamEndEvent):
                level = -1
            if level < 0:
                return False

            

Reported by Pylint.

Undefined variable 'CollectionEndEvent'
Error

Line: 139 Column: 55

                      for event in self.events[1:]:
            if isinstance(event, (DocumentStartEvent, CollectionStartEvent)):
                level += 1
            elif isinstance(event, (DocumentEndEvent, CollectionEndEvent)):
                level -= 1
            elif isinstance(event, StreamEndEvent):
                level = -1
            if level < 0:
                return False

            

Reported by Pylint.

Undefined variable 'StreamEndEvent'
Error

Line: 141 Column: 36

                              level += 1
            elif isinstance(event, (DocumentEndEvent, CollectionEndEvent)):
                level -= 1
            elif isinstance(event, StreamEndEvent):
                level = -1
            if level < 0:
                return False
        return (len(self.events) < count+1)


            

Reported by Pylint.

tests/api/fuzzer.py
130 issues
Redefining name 's' from outer scope (line 375)
Error

Line: 16 Column: 10

              # Utilities


def some(s):
    return random.choice(sorted(s))


def not_some(s):
    test_set = random.choice([string.ascii_uppercase + string.ascii_lowercase,

            

Reported by Pylint.

Redefining name 's' from outer scope (line 375)
Error

Line: 20 Column: 14

                  return random.choice(sorted(s))


def not_some(s):
    test_set = random.choice([string.ascii_uppercase + string.ascii_lowercase,
                              string.digits,
                              string.digits + ".E-",
                              '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJK'
                              'LMNOPQRSTUVWXYZ!"#$%\'()*+,-./:;<=>?@[\\]^_`{|}~ '])

            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 41 Column: 12

                      if base_path[0] == '/':
            base_path = base_path[1:]
        return url_tuple.netloc, posixpath.join(url_tuple.path, base_path)
    except Exception as e:
        L.error(f"Critical failure decoding arguments -> {e}")
        sys.exit(-1)


#######################################################################################################################

            

Reported by Pylint.

Use lazy % formatting in logging functions
Error

Line: 42 Column: 9

                          base_path = base_path[1:]
        return url_tuple.netloc, posixpath.join(url_tuple.path, base_path)
    except Exception as e:
        L.error(f"Critical failure decoding arguments -> {e}")
        sys.exit(-1)


#######################################################################################################################
# Data-model and processing

            

Reported by Pylint.

Redefining name 'name' from outer scope (line 368)
Error

Line: 51 Column: 24

              

class Param(object):
    def __init__(self, name, location, kind):
        self.location = location
        self.kind = kind
        self.name = name
        self.values = set()


            

Reported by Pylint.

Redefining name 'resp' from outer scope (line 377)
Error

Line: 61 Column: 51

                      print(f"{self.name} in {self.location} is {self.kind} : {{{self.values}}}")


def does_response_fit_schema(schema_path, schema, resp):
    '''The schema_path argument tells us where we are (globally) in the schema. The schema argument is the
       sub-tree within the schema json that we are validating against. The resp is the json subtree from the
       target host's response.

       The basic idea is this: swagger defines a model of valid json trees. In this sense it is a formal

            

Reported by Pylint.

Use lazy % formatting in logging functions
Error

Line: 81 Column: 9

                  '''
    success = True
    if "type" not in schema:
        L.error(f"Cannot progress past {schema_path} -> no type specified in dictionary")
        print(json.dumps(schema, indent=2))
        return False
    if schema["type"] == "object":
        if isinstance(resp, dict) and "properties" in schema and isinstance(schema["properties"], dict):
            L.debug(f"Validate properties against dictionary at {schema_path}")

            

Reported by Pylint.

Use lazy % formatting in logging functions
Error

Line: 86 Column: 13

                      return False
    if schema["type"] == "object":
        if isinstance(resp, dict) and "properties" in schema and isinstance(schema["properties"], dict):
            L.debug(f"Validate properties against dictionary at {schema_path}")
            for k, v in schema["properties"].items():
                L.debug(f"Validate {k} received with {v}")
                if v.get("required", False) and k not in resp:
                    L.error(f"Missing {k} in response at {schema_path}")
                    print(json.dumps(resp, indent=2))

            

Reported by Pylint.

Use lazy % formatting in logging functions
Error

Line: 88 Column: 17

                      if isinstance(resp, dict) and "properties" in schema and isinstance(schema["properties"], dict):
            L.debug(f"Validate properties against dictionary at {schema_path}")
            for k, v in schema["properties"].items():
                L.debug(f"Validate {k} received with {v}")
                if v.get("required", False) and k not in resp:
                    L.error(f"Missing {k} in response at {schema_path}")
                    print(json.dumps(resp, indent=2))
                    return False
                if k in resp:

            

Reported by Pylint.

Use lazy % formatting in logging functions
Error

Line: 90 Column: 21

                          for k, v in schema["properties"].items():
                L.debug(f"Validate {k} received with {v}")
                if v.get("required", False) and k not in resp:
                    L.error(f"Missing {k} in response at {schema_path}")
                    print(json.dumps(resp, indent=2))
                    return False
                if k in resp:
                    if not does_response_fit_schema(posixpath.join(schema_path, k), v, resp[k]):
                        success = False

            

Reported by Pylint.

collectors/python.d.plugin/python_modules/third_party/lm_sensors.py
122 issues
Unused import BigEndianStructure from wildcard import
Error

Line: 14 Column: 1

              @copyright: LGPLv2 (same as libsensors) <http://opensource.org/licenses/LGPL-2.1>
"""

from ctypes import *
import ctypes.util

_libc = cdll.LoadLibrary(ctypes.util.find_library("c"))
# see https://github.com/paroj/sensors.py/issues/1
_libc.free.argtypes = [c_void_p]

            

Reported by Pylint.

Unused import oledll from wildcard import
Error

Line: 14 Column: 1

              @copyright: LGPLv2 (same as libsensors) <http://opensource.org/licenses/LGPL-2.1>
"""

from ctypes import *
import ctypes.util

_libc = cdll.LoadLibrary(ctypes.util.find_library("c"))
# see https://github.com/paroj/sensors.py/issues/1
_libc.free.argtypes = [c_void_p]

            

Reported by Pylint.

Unused import GetLastError from wildcard import
Error

Line: 14 Column: 1

              @copyright: LGPLv2 (same as libsensors) <http://opensource.org/licenses/LGPL-2.1>
"""

from ctypes import *
import ctypes.util

_libc = cdll.LoadLibrary(ctypes.util.find_library("c"))
# see https://github.com/paroj/sensors.py/issues/1
_libc.free.argtypes = [c_void_p]

            

Reported by Pylint.

Unused import WinError from wildcard import
Error

Line: 14 Column: 1

              @copyright: LGPLv2 (same as libsensors) <http://opensource.org/licenses/LGPL-2.1>
"""

from ctypes import *
import ctypes.util

_libc = cdll.LoadLibrary(ctypes.util.find_library("c"))
# see https://github.com/paroj/sensors.py/issues/1
_libc.free.argtypes = [c_void_p]

            

Reported by Pylint.

Unused import c_size_t from wildcard import
Error

Line: 14 Column: 1

              @copyright: LGPLv2 (same as libsensors) <http://opensource.org/licenses/LGPL-2.1>
"""

from ctypes import *
import ctypes.util

_libc = cdll.LoadLibrary(ctypes.util.find_library("c"))
# see https://github.com/paroj/sensors.py/issues/1
_libc.free.argtypes = [c_void_p]

            

Reported by Pylint.

Unused import c_ssize_t from wildcard import
Error

Line: 14 Column: 1

              @copyright: LGPLv2 (same as libsensors) <http://opensource.org/licenses/LGPL-2.1>
"""

from ctypes import *
import ctypes.util

_libc = cdll.LoadLibrary(ctypes.util.find_library("c"))
# see https://github.com/paroj/sensors.py/issues/1
_libc.free.argtypes = [c_void_p]

            

Reported by Pylint.

Unused import memmove from wildcard import
Error

Line: 14 Column: 1

              @copyright: LGPLv2 (same as libsensors) <http://opensource.org/licenses/LGPL-2.1>
"""

from ctypes import *
import ctypes.util

_libc = cdll.LoadLibrary(ctypes.util.find_library("c"))
# see https://github.com/paroj/sensors.py/issues/1
_libc.free.argtypes = [c_void_p]

            

Reported by Pylint.

Unused import c_char from wildcard import
Error

Line: 14 Column: 1

              @copyright: LGPLv2 (same as libsensors) <http://opensource.org/licenses/LGPL-2.1>
"""

from ctypes import *
import ctypes.util

_libc = cdll.LoadLibrary(ctypes.util.find_library("c"))
# see https://github.com/paroj/sensors.py/issues/1
_libc.free.argtypes = [c_void_p]

            

Reported by Pylint.

Unused import PYFUNCTYPE from wildcard import
Error

Line: 14 Column: 1

              @copyright: LGPLv2 (same as libsensors) <http://opensource.org/licenses/LGPL-2.1>
"""

from ctypes import *
import ctypes.util

_libc = cdll.LoadLibrary(ctypes.util.find_library("c"))
# see https://github.com/paroj/sensors.py/issues/1
_libc.free.argtypes = [c_void_p]

            

Reported by Pylint.

Unused import string_at from wildcard import
Error

Line: 14 Column: 1

              @copyright: LGPLv2 (same as libsensors) <http://opensource.org/licenses/LGPL-2.1>
"""

from ctypes import *
import ctypes.util

_libc = cdll.LoadLibrary(ctypes.util.find_library("c"))
# see https://github.com/paroj/sensors.py/issues/1
_libc.free.argtypes = [c_void_p]

            

Reported by Pylint.

collectors/python.d.plugin/python_modules/pyyaml3/constructor.py
110 issues
Attempted relative import beyond top-level package
Error

Line: 6 Column: 1

              __all__ = ['BaseConstructor', 'SafeConstructor', 'Constructor',
    'ConstructorError']

from .error import *
from .nodes import *

import collections, datetime, base64, binascii, re, sys, types

class ConstructorError(MarkedYAMLError):

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 7 Column: 1

                  'ConstructorError']

from .error import *
from .nodes import *

import collections, datetime, base64, binascii, re, sys, types

class ConstructorError(MarkedYAMLError):
    pass

            

Reported by Pylint.

Undefined variable 'MarkedYAMLError'
Error

Line: 11 Column: 24

              
import collections, datetime, base64, binascii, re, sys, types

class ConstructorError(MarkedYAMLError):
    pass

class BaseConstructor:

    yaml_constructors = {}

            

Reported by Pylint.

Instance of 'BaseConstructor' has no 'check_node' member
Error

Line: 27 Column: 16

              
    def check_data(self):
        # If there are more documents available?
        return self.check_node()

    def get_data(self):
        # Construct and return the next document.
        if self.check_node():
            return self.construct_document(self.get_node())

            

Reported by Pylint.

Instance of 'BaseConstructor' has no 'check_node' member
Error

Line: 31 Column: 12

              
    def get_data(self):
        # Construct and return the next document.
        if self.check_node():
            return self.construct_document(self.get_node())

    def get_single_data(self):
        # Ensure that the stream contains a single document and construct it.
        node = self.get_single_node()

            

Reported by Pylint.

Instance of 'BaseConstructor' has no 'get_node' member
Error

Line: 32 Column: 44

                  def get_data(self):
        # Construct and return the next document.
        if self.check_node():
            return self.construct_document(self.get_node())

    def get_single_data(self):
        # Ensure that the stream contains a single document and construct it.
        node = self.get_single_node()
        if node is not None:

            

Reported by Pylint.

Instance of 'BaseConstructor' has no 'get_single_node' member
Error

Line: 36 Column: 16

              
    def get_single_data(self):
        # Ensure that the stream contains a single document and construct it.
        node = self.get_single_node()
        if node is not None:
            return self.construct_document(node)
        return None

    def construct_document(self, node):

            

Reported by Pylint.

Undefined variable 'ScalarNode'
Error

Line: 80 Column: 39

                                  constructor = self.yaml_multi_constructors[None]
                elif None in self.yaml_constructors:
                    constructor = self.yaml_constructors[None]
                elif isinstance(node, ScalarNode):
                    constructor = self.__class__.construct_scalar
                elif isinstance(node, SequenceNode):
                    constructor = self.__class__.construct_sequence
                elif isinstance(node, MappingNode):
                    constructor = self.__class__.construct_mapping

            

Reported by Pylint.

Undefined variable 'SequenceNode'
Error

Line: 82 Column: 39

                                  constructor = self.yaml_constructors[None]
                elif isinstance(node, ScalarNode):
                    constructor = self.__class__.construct_scalar
                elif isinstance(node, SequenceNode):
                    constructor = self.__class__.construct_sequence
                elif isinstance(node, MappingNode):
                    constructor = self.__class__.construct_mapping
        if tag_suffix is None:
            data = constructor(self, node)

            

Reported by Pylint.

Undefined variable 'MappingNode'
Error

Line: 84 Column: 39

                                  constructor = self.__class__.construct_scalar
                elif isinstance(node, SequenceNode):
                    constructor = self.__class__.construct_sequence
                elif isinstance(node, MappingNode):
                    constructor = self.__class__.construct_mapping
        if tag_suffix is None:
            data = constructor(self, node)
        else:
            data = constructor(self, tag_suffix, node)

            

Reported by Pylint.