Minor code style improvements

pull/19/head
Andrew Krasichkov 2017-04-29 11:19:37 +03:00
parent 411b74f7ba
commit 3dc9bde70b
11 changed files with 25 additions and 33 deletions

View File

@ -5,7 +5,6 @@ from six.moves import StringIO
from gixy.core.plugins_manager import PluginsManager
# used while parsing args to keep track of where they came from
_COMMAND_LINE_SOURCE_KEY = 'command_line'
_ENV_VAR_SOURCE_KEY = 'environment_variables'

View File

@ -1,7 +1,6 @@
from gixy.core.regexp import Regexp
from gixy.core.variable import Variable
BUILTIN_VARIABLES = {
# http://nginx.org/en/docs/http/ngx_http_core_module.html#var_uri
'uri': '/[^\x20\t]*',

View File

@ -9,7 +9,6 @@ class Config(object):
output_format=None,
output_file=None,
allow_includes=True):
self.severity = severity
self.output_format = output_format
self.output_file = output_file

View File

@ -3,7 +3,6 @@ import copy
from gixy.core.utils import is_indexed_name
LOG = logging.getLogger(__name__)
CONTEXTS = []

View File

@ -1,5 +1,4 @@
class Issue(object):
def __init__(self, plugin, summary=None, description=None,
severity=None, reason=None, help_url=None, directives=None):
self.plugin = plugin

View File

@ -5,7 +5,6 @@ from gixy.plugins.plugin import Plugin
class PluginsManager(object):
def __init__(self, config=None):
self.imported = False
self.config = config

View File

@ -21,14 +21,17 @@ try:
from _sre import MAXREPEAT
except ImportError:
import _sre
MAXREPEAT = _sre.MAXREPEAT = 65535
# SRE standard exception (access as sre.error)
# should this really be here?
class error(Exception):
pass
# operators
FAILURE = "failure"
@ -148,6 +151,7 @@ CHCODES = [
CATEGORY_UNI_NOT_LINEBREAK
]
def makedict(list):
d = {}
i = 0
@ -156,6 +160,7 @@ def makedict(list):
i = i + 1
return d
OPCODES = makedict(OPCODES)
ATCODES = makedict(ATCODES)
CHCODES = makedict(CHCODES)
@ -219,4 +224,3 @@ SRE_FLAG_DEBUG = 128 # debugging
SRE_INFO_PREFIX = 1 # has prefix
SRE_INFO_LITERAL = 2 # entire pattern is literal (given by prefix)
SRE_INFO_CHARSET = 4 # pattern starts with character from given set

View File

@ -4,7 +4,6 @@ import logging
from gixy.core.regexp import Regexp
from gixy.core.context import get_context
LOG = logging.getLogger(__name__)
# See ngx_http_script_compile in http/ngx_http_script.c
EXTRACT_RE = re.compile(r'\$([1-9]|[a-z_][a-z0-9_]*|\{[a-z0-9_]+\})', re.IGNORECASE)

View File

@ -1,7 +1,6 @@
import os
from gixy.directives.directive import Directive
DIRECTIVES = {}

View File

@ -1,4 +1,3 @@
"""NginxParser is a member object of the NginxConfigurator class."""
import os
import glob
import logging
@ -13,7 +12,6 @@ LOG = logging.getLogger(__name__)
class NginxParser(object):
def __init__(self, file_path, allow_includes=True):
self.base_file_path = file_path
self.cwd = os.path.dirname(file_path)

View File

@ -1,4 +1,3 @@
"""Very low-level nginx config parser based on pyparsing."""
import re
import logging
from cached_property import cached_property
@ -7,7 +6,6 @@ from pyparsing import (
Literal, Suppress, White, Word, alphanums, Forward, Group, Optional, Combine,
Keyword, OneOrMore, ZeroOrMore, Regex, QuotedString, nestedExpr)
LOG = logging.getLogger(__name__)