Merge pull request #1720 from scrapy/deprecations

[MRG+1] deprecated unused and untested code in scrapy.utils.datatypes
This commit is contained in:
Paul Tremberth 2016-01-26 13:25:21 +01:00
commit 52daa1b953
1 changed files with 24 additions and 1 deletions

View File

@ -7,11 +7,22 @@ This module must not depend on any module outside the Standard Library.
import copy
import six
import warnings
from collections import OrderedDict
from scrapy.exceptions import ScrapyDeprecationWarning
class MultiValueDictKeyError(KeyError):
pass
def __init__(self, *args, **kwargs):
warnings.warn(
"scrapy.utils.datatypes.MultiValueDictKeyError is deprecated "
"and will be removed in future releases.",
category=ScrapyDeprecationWarning,
stacklevel=2
)
super(MultiValueDictKeyError, self).__init__(*args, **kwargs)
class MultiValueDict(dict):
"""
@ -31,6 +42,10 @@ class MultiValueDict(dict):
single name-value pairs.
"""
def __init__(self, key_to_list_mapping=()):
warnings.warn("scrapy.utils.datatypes.MultiValueDict is deprecated "
"and will be removed in future releases.",
category=ScrapyDeprecationWarning,
stacklevel=2)
dict.__init__(self, key_to_list_mapping)
def __repr__(self):
@ -137,10 +152,18 @@ class MultiValueDict(dict):
for key, value in six.iteritems(kwargs):
self.setlistdefault(key, []).append(value)
class SiteNode(object):
"""Class to represent a site node (page, image or any other file)"""
def __init__(self, url):
warnings.warn(
"scrapy.utils.datatypes.SiteNode is deprecated "
"and will be removed in future releases.",
category=ScrapyDeprecationWarning,
stacklevel=2
)
self.url = url
self.itemnames = []
self.children = []