Skip to content

Commit

Permalink
Improve mypy support
Browse files Browse the repository at this point in the history
  • Loading branch information
twizmwazin committed Jul 13, 2023
1 parent 7ca5583 commit b28cf82
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
11 changes: 10 additions & 1 deletion angrmanagement/plugins/plugin_description.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import pathlib
from dataclasses import field
from typing import Dict, List, Optional
from typing import ClassVar, Dict, List, Optional, Type

import marshmallow.validate
import tomlkit
from marshmallow import Schema
from marshmallow_dataclass import dataclass


@dataclass
class MetadataDescription:
Schema: ClassVar[Type[Schema]] = Schema # placate mypy

version: int = field(metadata={"validate": marshmallow.validate.OneOf([0])})


Expand All @@ -18,6 +21,8 @@ class PackageDescription:
Describes a plugin package.
"""

Schema: ClassVar[Type[Schema]] = Schema # placate mypy

name: str = field()
version: str = field()
platforms: List[str] = field(default_factory=lambda: ["any"])
Expand All @@ -33,6 +38,8 @@ class PluginDescription:
Describes an angr management plugin. Can be generated from plugin.toml.
"""

Schema: ClassVar[Type[Schema]] = Schema # placate mypy

name: str = field()
entrypoint: str = field()
platforms: Optional[List[str]] = field(default=None)
Expand All @@ -46,6 +53,8 @@ class PluginConfigFileDescription:
Describes a plugin config file.
"""

Schema: ClassVar[Type[Schema]] = Schema # placate mypy

metadata: MetadataDescription = field()
package: PackageDescription = field()
plugins: Dict[str, PluginDescription] = field(default_factory=dict)
Expand Down
1 change: 1 addition & 0 deletions angrmanagement/py.typed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PARTIAL
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ pyinstaller =

[options.package_data]
angrmanagement =
py.typed
resources/fonts/*.ttf
resources/images/*
resources/themes/**/*

0 comments on commit b28cf82

Please sign in to comment.