Skip to content

Commit 709fc5f

Browse files
committed
Merge pull request #32 from kalessin/debugrequired
allow to disable application of extra required attributes for testing purposes
2 parents 8ced454 + 8c6b632 commit 709fc5f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scrapely/extraction/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class InstanceBasedLearningExtractor(object):
2626
extract data from web pages.
2727
"""
2828

29-
def __init__(self, td_pairs, trace=False):
29+
def __init__(self, td_pairs, trace=False, apply_extrarequired=True):
3030
"""Initialise this extractor
3131
3232
td_pairs is a list of (template, item descriptor) pairs.
@@ -54,7 +54,7 @@ def __init__(self, td_pairs, trace=False):
5454
modified_parsed_tdpairs = []
5555
# apply extra required attributes
5656
for parsed, (t, descriptor) in parsed_tdpairs:
57-
if descriptor is not None:
57+
if descriptor is not None and apply_extrarequired:
5858
descriptor = descriptor.copy()
5959
for attr in parsed.extra_required_attrs:
6060
descriptor._required_attributes.append(attr)

0 commit comments

Comments
 (0)