Skip to content
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
1 change: 0 additions & 1 deletion setup_validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# This software is licensed under the terms of the BSD license.
# http://opensource.org/licenses/BSD-3-Clause

import sys
from distutils.core import setup
from validate import __version__ as VERSION

Expand Down
4 changes: 2 additions & 2 deletions src/configobj/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ def __init__(self, section):

def interpolate(self, key, value):
# short-cut
if not self._cookie in value:
if self._cookie not in value:
return value

def recursive_interpolate(key, value, section, backtrail):
Expand Down Expand Up @@ -2237,7 +2237,7 @@ def validate_entry(entry, spec, val, missing, ret_true, ret_false):
if entry in ('__many__', '___many___'):
# reserved names
continue
if (not entry in section.scalars) or (entry in section.defaults):
if (entry not in section.scalars) or (entry in section.defaults):
# missing entries
# or entries from defaults
missing = True
Expand Down
13 changes: 7 additions & 6 deletions src/configobj/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@

import re
import sys
from pprint import pprint


_list_arg = re.compile(r'''
Expand Down Expand Up @@ -264,7 +263,8 @@ def dottedQuadToNum(ip):
"""

# import here to avoid it when ip_addr values are not used
import socket, struct
import socket
import struct

try:
return struct.unpack('!L',
Expand Down Expand Up @@ -314,7 +314,8 @@ def numToDottedQuad(num):
"""

# import here to avoid it when ip_addr values are not used
import socket, struct
import socket
import struct

# no need to intercept here, 4294967295L is fine
if num > int(4294967295) or num < 0:
Expand Down Expand Up @@ -653,7 +654,7 @@ def _parse_check(self, check):
keymatch = self._key_arg.match(arg)
if keymatch:
val = keymatch.group(2)
if not val in ("'None'", '"None"'):
if val not in ("'None'", '"None"'):
# Special case a quoted None
val = self._unquote(val)
fun_kwargs[keymatch.group(1)] = val
Expand Down Expand Up @@ -740,7 +741,7 @@ def _is_num_param(names, values, to_float=False):
elif isinstance(val, (int, float, str)):
try:
out_params.append(fun(val))
except ValueError as e:
except ValueError:
raise VdtParamError(name, val)
else:
raise VdtParamError(name, val)
Expand Down Expand Up @@ -1301,7 +1302,7 @@ def is_option(value, *options):
"""
if not isinstance(value, str):
raise VdtTypeError(value)
if not value in options:
if value not in options:
raise VdtValueError(value)
return value

Expand Down
3 changes: 0 additions & 3 deletions src/tests/configobj_doctests.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,9 @@

import sys

from io import StringIO

import sys

from configobj import *
from configobj.validate import Validator


def _test_validate():
Expand Down
2 changes: 1 addition & 1 deletion src/tests/test_validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from configobj import ConfigObj
import pytest
from configobj.validate import Validator, VdtValueTooSmallError
from configobj.validate import VdtValueTooSmallError


class TestImporting(object):
Expand Down
Loading