Skip to content
Closed
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
16 changes: 12 additions & 4 deletions bert_e/git_host/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@
self.data = data

@classmethod
def get(cls, client, url=None, params={}, headers={}, **kwargs):
def get(cls, client, url=None, params=None, headers=None,
**kwargs):
"""Get a Githost object.

The result is parsed using cls.GET_SCHEMA, of cls.SCHEMA if absent.
Expand All @@ -129,6 +130,8 @@
Returns:
The result of the query, parsed by the shema.
"""
params = {} if params is None else params
headers = {} if headers is None else headers
url = url or cls.GET_URL
if url is None:
raise InvalidOperation(
Expand All @@ -141,7 +144,8 @@
return obj

@classmethod
def list(cls, client, url=None, params={}, headers={}, **kwargs):
def list(cls, client, url=None, params=None, headers=None,
**kwargs):
"""List objects.

The result is parsed using cls.LIST_SCHEMA, or cls.GET_SCHEMA if
Expand All @@ -154,6 +158,8 @@
The elements of the response as they are parsed by the schema.

"""
params = {} if params is None else params
headers = {} if headers is None else headers

Check warning on line 162 in bert_e/git_host/base.py

View check run for this annotation

Codecov / codecov/patch

bert_e/git_host/base.py#L161-L162

Added lines #L161 - L162 were not covered by tests
url = url or cls.LIST_URL
if url is None:
raise InvalidOperation(
Expand All @@ -180,8 +186,9 @@
return cls(**load_schema(schema_cls, data, **kwargs), _validate=False)

@classmethod
def create(cls, client, data, headers={}, url=None, **kwargs):
def create(cls, client, data, headers=None, url=None, **kwargs):
"""Create an object."""
headers = {} if headers is None else headers
url = url or cls.CREATE_URL
if url is None:
raise InvalidOperation(
Expand All @@ -196,8 +203,9 @@
return obj

@classmethod
def update(cls, client, data, headers={}, url=None, **kwargs):
def update(cls, client, data, headers=None, url=None, **kwargs):
"""Update an object."""
headers = {} if headers is None else headers

Check warning on line 208 in bert_e/git_host/base.py

View check run for this annotation

Codecov / codecov/patch

bert_e/git_host/base.py#L208

Added line #L208 was not covered by tests
url = url or cls.UPDATE_URL or cls.GET_URL
if url is None:
raise InvalidOperation(
Expand Down
Loading