-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1065 from open-contracting/dataclasses
feat: Switch to dataclasses
- Loading branch information
Showing
28 changed files
with
540 additions
and
488 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
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
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 |
---|---|---|
|
@@ -40,8 +40,8 @@ | |
} | ||
}, | ||
"required": [ | ||
"data", | ||
"data_type" | ||
"data_type", | ||
"data" | ||
] | ||
} | ||
} | ||
|
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,34 +1,35 @@ | ||
# https://docs.scrapy.org/en/latest/topics/items.html | ||
import typing | ||
from dataclasses import dataclass | ||
|
||
import scrapy | ||
|
||
|
||
class Item(scrapy.Item): | ||
file_name = scrapy.Field() | ||
url = scrapy.Field() | ||
validate = True | ||
@dataclass | ||
class Item: | ||
file_name: str | ||
url: str | ||
|
||
|
||
@dataclass | ||
class File(Item): | ||
data = scrapy.Field() | ||
data_type = scrapy.Field() | ||
|
||
data_type: str | ||
data: typing.Any | ||
# Added by the FilesStore extension, for the KingfisherProcessAPI2 extension to refer to the file. | ||
path = scrapy.Field() | ||
path: str = "" | ||
|
||
|
||
@dataclass | ||
class FileItem(Item): | ||
number = scrapy.Field() | ||
data = scrapy.Field() | ||
data_type = scrapy.Field() | ||
|
||
data_type: str | ||
data: typing.Any | ||
number: int | ||
# Added by the FilesStore extension, for the KingfisherProcessAPI2 extension to refer to the file. | ||
path = scrapy.Field() | ||
path: str = "" | ||
|
||
|
||
@dataclass | ||
class FileError(Item): | ||
errors = scrapy.Field() | ||
errors: dict | ||
|
||
|
||
class PluckedItem(scrapy.Item): | ||
value = scrapy.Field() | ||
@dataclass | ||
class PluckedItem: | ||
value: typing.Any |
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
Oops, something went wrong.