8000 httpx based python-gitlab by vishes-shell · Pull Request #1 · vishes-shell/python-gitlab · GitHub
[go: up one dir, main page]

Skip to content

httpx based python-gitlab #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Feb 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
182 changes: 93 additions & 89 deletions gitlab/__init__.py

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions gitlab/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,17 +174,17 @@ def __init__(self, manager, obj_cls, _list):
self._obj_cls = obj_cls
self._list = _list

def __iter__(self):
def __aiter__(self):
return self

def __len__(self):
return len(self._list)

def __next__(self):
return self.next()
async def __anext__(self):
return await self.next()

def next(self):
data = self._list.next()
async def next(self):
data = await self._list.next()
return self._obj_cls(self.manager, data)

@property
Expand Down
4 changes: 2 additions & 2 deletions gitlab/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
def register_custom_action(cls_names, mandatory=tuple(), optional=tuple()):
def wrap(f):
@functools.wraps(f)
def wrapped_f(*args, **kwargs):
return f(*args, **kwargs)
async def wrapped_f(*args, **kwargs):
return await f(*args, **kwargs)

# in_obj defines whether the method belongs to the obj or the manager
in_obj = True
Expand Down
4 changes: 2 additions & 2 deletions gitlab/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,9 @@ def on_http_error(error):

def wrap(f):
@functools.wraps(f)
def wrapped_f(*args, **kwargs):
async def wrapped_f(*args, **kwargs):
try:
return f(*args, **kwargs)
return await f(*args, **kwargs)
except GitlabHttpError as e:
raise error(e.error_message, e.response_code, e.response_body)

Expand Down
Loading
0