foyou-datclass


Namefoyou-datclass JSON
Version 0.0.5 PyPI version JSON
download
home_pagehttps://github.com/foyoux/foyou-datclass
Summaryparse json to dataclass
upload_time2022-12-28 13:34:55
maintainer
docs_urlNone
authorfoyou
requires_python>=3.7.*
licenseGPL-3.0
keywords ring kugou
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # foyou-datclass

Python 数据类相关

## 设计一下

### 样例1

<details>

- 输入 - Result

```json
{
  "code": 400501,
  "message": "no found ad",
  "data": null
}
```

- 输出

```python
@dataclass
class Result(DatClass):
    code: int = None
    message: str = None
    data: str = None
```

</details>

### 样例2

<details>

- 输入 Message

```json
{
  "medalName": "求知",
  "sourceUrl": "https://ask.csdn.net/new",
  "getLevel": 1,
  "desc": "发布1个问题",
  "getImageUrl": "https://csdnimg.cn/c0535f9cefbd4cc0a4878be28bfc4590.png",
  "getTime": "2022-07-15",
  "ifShow": true,
  "medalType": 2,
  "medalId": 114,
  "getMedalTime": null,
  "status": null
}
```

- 输出

```python
@dataclass
class Message(DatClass):
    medal_name: str = None
    source_url = str = None
    get_level: int = None
    desc: str = None
    get_image_url: str = None
    get_time: str = None
    if_show: bool = None
    medal_type: int = None
    medal_id: int = None
    get_medal_time: str = None
    status: str = None
```

</details>

### 样例3

输入 Config

```json
{
  "code": -1,
  "subcode": -1,
  "data": {
    "hotkey": []
  }
}
```

输出

```python
@dataclass
class Config(DatClass):
    code: int = None
    subcode: int = None
    data: Dict = None
```


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/foyoux/foyou-datclass",
    "name": "foyou-datclass",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7.*",
    "maintainer_email": "",
    "keywords": "ring kugou",
    "author": "foyou",
    "author_email": "yimi.0822@qq.com",
    "download_url": "https://files.pythonhosted.org/packages/20/36/ee93ed2869154b92e586a4db6d9c100e9141b71300c374e32b78bf9fc1cf/foyou-datclass-0.0.5.tar.gz",
    "platform": null,
    "description": "# foyou-datclass\n\nPython \u6570\u636e\u7c7b\u76f8\u5173\n\n## \u8bbe\u8ba1\u4e00\u4e0b\n\n### \u6837\u4f8b1\n\n<details>\n\n- \u8f93\u5165 - Result\n\n```json\n{\n  \"code\": 400501,\n  \"message\": \"no found ad\",\n  \"data\": null\n}\n```\n\n- \u8f93\u51fa\n\n```python\n@dataclass\nclass Result(DatClass):\n    code: int = None\n    message: str = None\n    data: str = None\n```\n\n</details>\n\n### \u6837\u4f8b2\n\n<details>\n\n- \u8f93\u5165 Message\n\n```json\n{\n  \"medalName\": \"\u6c42\u77e5\",\n  \"sourceUrl\": \"https://ask.csdn.net/new\",\n  \"getLevel\": 1,\n  \"desc\": \"\u53d1\u5e031\u4e2a\u95ee\u9898\",\n  \"getImageUrl\": \"https://csdnimg.cn/c0535f9cefbd4cc0a4878be28bfc4590.png\",\n  \"getTime\": \"2022-07-15\",\n  \"ifShow\": true,\n  \"medalType\": 2,\n  \"medalId\": 114,\n  \"getMedalTime\": null,\n  \"status\": null\n}\n```\n\n- \u8f93\u51fa\n\n```python\n@dataclass\nclass Message(DatClass):\n    medal_name: str = None\n    source_url = str = None\n    get_level: int = None\n    desc: str = None\n    get_image_url: str = None\n    get_time: str = None\n    if_show: bool = None\n    medal_type: int = None\n    medal_id: int = None\n    get_medal_time: str = None\n    status: str = None\n```\n\n</details>\n\n### \u6837\u4f8b3\n\n\u8f93\u5165 Config\n\n```json\n{\n  \"code\": -1,\n  \"subcode\": -1,\n  \"data\": {\n    \"hotkey\": []\n  }\n}\n```\n\n\u8f93\u51fa\n\n```python\n@dataclass\nclass Config(DatClass):\n    code: int = None\n    subcode: int = None\n    data: Dict = None\n```\n\n",
    "bugtrack_url": null,
    "license": "GPL-3.0",
    "summary": "parse json to dataclass",
    "version": "0.0.5",
    "split_keywords": [
        "ring",
        "kugou"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "c726666ec09eac2dda8450ded70a2fa8",
                "sha256": "12203e1f29dda7417bdb6f1c23a0bc1bec8282860dc22ff2a4b42ff90a480c8b"
            },
            "downloads": -1,
            "filename": "foyou_datclass-0.0.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c726666ec09eac2dda8450ded70a2fa8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7.*",
            "size": 15906,
            "upload_time": "2022-12-28T13:34:53",
            "upload_time_iso_8601": "2022-12-28T13:34:53.957005Z",
            "url": "https://files.pythonhosted.org/packages/55/3a/f59f6d26b480b441be8d2d4749366dc888316005e9277d1531cb519462ea/foyou_datclass-0.0.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "a6c8088b1c937f2c3f283f9e7e132827",
                "sha256": "a4c1bd851eb605a5d6b13ef80f5a91b9e23730d8ccb9b74f145426c263ffabea"
            },
            "downloads": -1,
            "filename": "foyou-datclass-0.0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "a6c8088b1c937f2c3f283f9e7e132827",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7.*",
            "size": 15945,
            "upload_time": "2022-12-28T13:34:55",
            "upload_time_iso_8601": "2022-12-28T13:34:55.218317Z",
            "url": "https://files.pythonhosted.org/packages/20/36/ee93ed2869154b92e586a4db6d9c100e9141b71300c374e32b78bf9fc1cf/foyou-datclass-0.0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-28 13:34:55",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "foyoux",
    "github_project": "foyou-datclass",
    "lcname": "foyou-datclass"
}
        
Elapsed time: 0.02580s