Fixed some pyflakes issues.

- Legacy-Id: 17304
This commit is contained in:
Henrik Levkowetz 2020-02-18 19:39:03 +00:00
parent ab99478913
commit aabd237656
2 changed files with 7 additions and 27 deletions

View file

@ -3,44 +3,24 @@
from __future__ import absolute_import, print_function, unicode_literals
import glob
import gzip
import os
import warnings
import zipfile
from collections import defaultdict
from itertools import product, chain
from itertools import chain
import debug # pyflakes:ignore
from django.apps import apps
from django.conf import settings
from django.contrib.admin.utils import NestedObjects
from django.core import serializers
from django.core.exceptions import ImproperlyConfigured
from django.core.management.base import BaseCommand, CommandError
from django.core.management.color import no_style
from django.core.management.commands.loaddata import Command as LoadCommand, SingleZipReader, humanize
from django.core.management.utils import parse_apps_and_model_labels
from django.db import DEFAULT_DB_ALIAS, DatabaseError, IntegrityError, connections, router, transaction
from django.core.management.base import CommandError
from django.core.management.commands.loaddata import Command as LoadCommand, humanize
from django.db import DatabaseError, IntegrityError, router, transaction
from django.db.models import ManyToManyField
from django.utils import lru_cache
from django.utils._os import upath
from django.utils.encoding import force_text
from django.utils.functional import cached_property
from django.utils.glob import glob_escape
from ietf.utils.models import ForeignKey
try:
import bz2
has_bz2 = True
except ImportError:
has_bz2 = False
def flatten(l):
if isinstance(l, list):
for el in l:

View file

@ -6,7 +6,7 @@ import collections
import io
import re
import sys
import warnings
from django.apps import apps
from django.core import serializers
@ -110,7 +110,7 @@ class Command(DumpdataCommand):
if not table in pks:
pks[table] = []
fields = match.group('fields')
fields = [ f.strip("`") for f in re.split(r"(`[^`]+`)", fields) if f and not re.match(r'\s*,\s*', f)]
fields = [ f.strip("`") for f in re.split(r"(`[^`]+`)", fields) if f and not re.match(r'\s*,\s*', f)] # pyflakes:ignore
values = match.group('values')
values = [ v.strip("'") for v in re.split(r"(\d+|'[^']*'|NULL)", values) if v and not re.match(r'\s*,\s*', v) ]
try:
@ -119,7 +119,7 @@ class Command(DumpdataCommand):
pk = values[ididx]
pks[table].append(pk)
count += 1
except (KeyError, ValueError) as e:
except (KeyError, ValueError):
pass
return pks, count