import typing -> from typing import
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
-import logging
-import typing
-from typing import Dict
+from logging import getLogger
+from typing import Dict, Any, Optional, Mapping
from marshmallow import Schema, fields, post_load, pre_load, ValidationError
from marshmallow_enum import EnumField
@@ -41,7 +40,7 @@ from packit.config.package_config import (
)
from packit.sync import SyncFilesItem
-logger = logging.getLogger(__name__)
+logger = getLogger(__name__)
class FilesToSyncField(fields.Field):
@@ -50,14 +49,14 @@ class FilesToSyncField(fields.Field):
Accepts str or dict {'src': str, 'dest':str}
"""
- def _serialize(self, value: typing.Any, attr: str, obj: typing.Any, **kwargs):
+ def _serialize(self, value: Any, attr: str, obj: Any, **kwargs):
raise NotImplementedError
def _deserialize(
self,
- value: typing.Any,
- attr: typing.Optional[str],
- data: typing.Optional[typing.Mapping[str, typing.Any]],
+ value: Any,
+ attr: Optional[str],
+ data: Optional[Mapping[str, Any]],
**kwargs,
) -> SyncFilesItem:
if isinstance(value, dict):
@@ -84,16 +83,16 @@ class ActionField(fields.Field):
Field class representing Action.
"""
- def _serialize(self, value: typing.Any, attr: str, obj: typing.Any, **kwargs):
+ def _serialize(self, value: Any, attr: str, obj: Any, **kwargs):
raise NotImplementedError
def _deserialize(
self,
- value: typing.Any,
- attr: typing.Optional[str],
- data: typing.Optional[typing.Mapping[ActionName, typing.Any]],
+ value: Any,
+ attr: Optional[str],
+ data: Optional[Mapping[ActionName, Any]],
**kwargs,
- ) -> typing.Dict:
+ ) -> Dict:
if not isinstance(value, dict):
raise ValidationError("Invalid data provided. dict required")
@@ -121,14 +120,14 @@ class NotProcessedField(fields.Field):
:param str additional_message: additional warning message to be displayed
"""
- def _serialize(self, value: typing.Any, attr: str, obj: typing.Any, **kwargs):
+ def _serialize(self, value: Any, attr: str, obj: Any, **kwargs):
raise NotImplementedError
def _deserialize(
self,
- value: typing.Any,
- attr: typing.Optional[str],
- data: typing.Optional[typing.Mapping[str, typing.Any]],
+ value: Any,
+ attr: Optional[str],
+ data: Optional[Mapping[str, Any]],
**kwargs,
):
logger.warning(f"{self.name} is no longer being processed.")
