forked from scrapy/itemloaders
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
616 additions
and
522 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Apply black format | ||
627f3bd9ea5210f40dbd5697eff9351bb5af019c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
default_language_version: | ||
python: python3.10 | ||
repos: | ||
- hooks: | ||
- id: black | ||
language_version: python3 | ||
repo: https://github.com/ambv/black | ||
rev: 23.3.0 | ||
- hooks: | ||
- id: isort | ||
language_version: python3 | ||
repo: https://github.com/PyCQA/isort | ||
rev: 5.12.0 | ||
- hooks: | ||
- id: flake8 | ||
language_version: python3 | ||
additional_dependencies: | ||
- flake8-bugbear | ||
- flake8-comprehensions | ||
- flake8-debugger | ||
- flake8-docstrings | ||
- flake8-string-format | ||
repo: https://github.com/pycqa/flake8 | ||
rev: 6.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +0,0 @@ | ||
|
||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
"""Common functions used in Item Loaders code""" | ||
|
||
from functools import partial | ||
|
||
from itemloaders.utils import get_func_args | ||
|
||
|
||
def wrap_loader_context(function, context): | ||
"""Wrap functions that receive loader_context to contain the context | ||
"pre-loaded" and expose a interface that receives only one argument | ||
""" | ||
if 'loader_context' in get_func_args(function): | ||
if "loader_context" in get_func_args(function): | ||
return partial(function, loader_context=context) | ||
else: | ||
return function |
Oops, something went wrong.