Skip to content

Commit

Permalink
Merge pull request #2 from Zheaoli/fix-type-hint-error
Browse files Browse the repository at this point in the history
Fix type hint error
  • Loading branch information
Zheaoli authored Jan 8, 2020
2 parents 7d397d3 + 990a02c commit ad20c63
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,5 @@ venv.bak/
# mypy
.mypy_cache/
.idea
.pytest_cache
.pytest_cache
.vscode
4 changes: 4 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Release History
===============

0.0.3(2020-01-08)

* fix type hint error

0.0.1(2019-08-28)

* support basic function
2 changes: 1 addition & 1 deletion yuque_py/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

__all__ = ["Yuque"]

__version__ = "0.0.2"
__version__ = "0.0.3"
8 changes: 4 additions & 4 deletions yuque_py/clients/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def request(
@staticmethod
def _get_request(
request_url: str,
requests_data: typing.Dict[str, typing.Any],
requests_data: typing.Optional[typing.Dict[str, typing.Any]],
request_header: typing.Dict[str, str],
) -> requests.Response:
if requests_data:
Expand All @@ -55,23 +55,23 @@ def _get_request(
@staticmethod
def _post_request(
request_url: str,
requests_data: typing.Dict[str, typing.Any],
requests_data: typing.Optional[typing.Dict[str, typing.Any]],
request_header: typing.Dict[str, str],
) -> requests.Response:
return requests.post(request_url, json=requests_data, headers=request_header)

@staticmethod
def _put_request(
request_url: str,
requests_data: typing.Dict[str, typing.Any],
requests_data: typing.Optional[typing.Dict[str, typing.Any]],
request_header: typing.Dict[str, str],
) -> requests.Response:
return requests.put(request_url, json=requests_data, headers=request_header)

@staticmethod
def _delete_request(
request_url: str,
requests_data: typing.Dict[str, typing.Any],
requests_data: typing.Optional[typing.Dict[str, typing.Any]],
request_header: typing.Dict[str, str],
) -> requests.Response:
return requests.delete(request_url, headers=request_header)
2 changes: 1 addition & 1 deletion yuque_py/models/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def delete(self, namespace: str) -> typing.Dict:
return self._client.request(f"repos/{namespace}", method="DELETE")

@staticmethod
def _get_url(user: str, group: str):
def _get_url(user: typing.Optional[str], group: typing.Optional[str]):
assert user or group
api = f"users/{user}/repos" if user else f"groups/{group}/repos"
return api

0 comments on commit ad20c63

Please sign in to comment.