Skip to content

Commit

Permalink
Cleanup ignore warnings (#89)
Browse files Browse the repository at this point in the history
* Remove unused imports

* Do not use deprecated ignore_warnings
  • Loading branch information
elacuesta authored Nov 28, 2024
1 parent a731b96 commit ca676e1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 2 additions & 2 deletions sh_scrapy/crawl.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,14 @@ def _run_script(dist, script_name, namespace):
exec(code, namespace, namespace)



def _run_usercode(spider, args, apisettings_func,
log_handler=None, commands_module=None):
try:
from scrapy.exceptions import ScrapyDeprecationWarning
from sh_scrapy.settings import populate_settings

with ignore_warnings(category=ScrapyDeprecationWarning):
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=ScrapyDeprecationWarning)
settings = populate_settings(apisettings_func(), spider)
if commands_module:
settings.set('COMMANDS_MODULE', commands_module, priority=40)
Expand Down
2 changes: 0 additions & 2 deletions sh_scrapy/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@
import scrapy
from scrapy import signals
from scrapy import version_info as SCRAPY_VERSION_INFO
from scrapy.exceptions import ScrapyDeprecationWarning
from scrapy.exporters import PythonItemExporter
from scrapy.http import Request
from scrapy.utils.deprecate import create_deprecated_class

from sh_scrapy import hsref
from sh_scrapy.crawl import ignore_warnings
from sh_scrapy.exceptions import SHScrapyDeprecationWarning
from sh_scrapy.middlewares import HS_PARENT_ID_KEY, request_id_sequence
from sh_scrapy.writer import pipe_writer
Expand Down

0 comments on commit ca676e1

Please sign in to comment.