Skip to content

Commit

Permalink
Merge branch 'pr_pydantic' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
dickmao committed Oct 17, 2021
2 parents 8d0de31 + ec96294 commit ee96119
Show file tree
Hide file tree
Showing 11 changed files with 405 additions and 563 deletions.
4 changes: 2 additions & 2 deletions elpy-rpc.el
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ needed packages from `elpy-rpc--get-package-list'."
"Return the list of packages to be installed in the RPC virtualenv."
(let ((rpc-python-version (elpy-rpc--get-python-version)))
(if (version< rpc-python-version "3.6.0")
'("jedi" "flake8" "autopep8" "yapf")
'("jedi" "flake8" "autopep8" "yapf" "black"))))
'("jedi" "flake8" "autopep8" "yapf" "pydantic")
'("jedi" "flake8" "autopep8" "yapf" "black" "pydantic"))))

(defun elpy-rpc--get-python-version ()
"Return the RPC python version."
Expand Down
36 changes: 36 additions & 0 deletions elpy/api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from pathlib import Path
from typing import Any, List, NamedTuple, NoReturn, Optional, Tuple, Union

from pydantic import BaseModel


class Result(BaseModel):
pass


class ServerMsg(BaseModel):
pass


class NameResult(Result):
name: str
offset: int
filename: str


class RefactoringResult(Result):
success: bool
project_path: Path
diff: str
changed_files: List[Path]
error_msg: Optional[str]


class ErrorMsg(ServerMsg):
id: int
error: Union[dict, Result]


class ResponceMsg(ServerMsg):
id: int
result: Union[dict, List, str, Result]
Loading

0 comments on commit ee96119

Please sign in to comment.