Skip to content
Open
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
24 changes: 12 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ jobs:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up python
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: 3.8.5
python-version: 3.11.1

- name: Load cached venv
id: cached-poetry-dependencies
Expand Down Expand Up @@ -39,9 +39,9 @@ jobs:
uses: actions/checkout@v3

- name: Set up python
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: 3.8.5
python-version: 3.11.1

- name: Load cached venv
id: cached-poetry-dependencies
Expand Down Expand Up @@ -70,9 +70,9 @@ jobs:
uses: actions/checkout@v3

- name: Set up python
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: 3.8.5
python-version: 3.11.1

- name: Load cached venv
id: cached-poetry-dependencies
Expand Down Expand Up @@ -101,9 +101,9 @@ jobs:
uses: actions/checkout@v3

- name: Set up python
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: 3.8.5
python-version: 3.11.1

- name: Load cached venv
id: cached-poetry-dependencies
Expand Down Expand Up @@ -132,9 +132,9 @@ jobs:
uses: actions/checkout@v3

- name: Set up python
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: 3.8.5
python-version: 3.11.1

- name: Load cached venv
id: cached-poetry-dependencies
Expand Down Expand Up @@ -165,9 +165,9 @@ jobs:
uses: actions/checkout@v3

- name: Set up python
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: 3.8.5
python-version: 3.11.1

- name: Load cached venv
id: cached-poetry-dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ jobs:
uses: actions/checkout@v3

- name: Set up python
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: 3.8.5
python-version: 3.11.1

- name: Load cached venv
id: cached-poetry-dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/update_doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ jobs:
uses: actions/checkout@v3

- name: Set up python
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: 3.8.5
python-version: 3.11.1

- name: Load cached venv
id: cached-poetry-dependencies
Expand Down
10 changes: 6 additions & 4 deletions braincube_connector/bases/base_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ def create_collection_from_path(
while True:
json_data = client.request_ws(
"{path}?offset={offset}&size={size}".format(
path=request_path.format(webservice="braincube"), offset=offset, size=page_size,
path=request_path.format(webservice="braincube"),
offset=offset,
size=page_size,
),
braincube_name=braincube_name,
)
Expand All @@ -144,15 +146,15 @@ def create_collection_from_path(
offset += page_size
return entity_list

def get_metadata(self) -> Dict[str, Any]:
def get_metadata(self) -> Dict[str, Any]: # noqa: WPS615
"""Gets the metadata of the Object.

Returns:
A dictionary of metadata.
"""
return self._metadata

def get_bcid(self) -> str:
def get_bcid(self) -> str: # noqa: WPS615
"""Get the entity's bcId.

Returns:
Expand Down Expand Up @@ -205,7 +207,7 @@ def get_parameter_key(cls, key) -> str:
parameter_key if parameter_key else cls.__base__.get_parameter_key(key) # type: ignore
)

def get_name(self):
def get_name(self): # noqa: WPS615
"""Get the entity's name.

Returns:
Expand Down
11 changes: 7 additions & 4 deletions braincube_connector/bases/resource_getter.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def __init__(self):
self._braincube_name = constants.EMPTY_STRING
self._parent_entity = None

def get_braincube_name(self):
def get_braincube_name(self): # noqa: WPS615
"""Get an object's braincube name.

Returns:
Expand Down Expand Up @@ -58,15 +58,18 @@ def _get_resource(
*generate_path(
self._path,
resource_class.entity_path.replace("{bcid}", str(bcid)),
resource_class.request_one_path if not singleton_path else singleton_path,
singleton_path if singleton_path else resource_class.request_one_path,
),
self,
braincube_name=self.get_braincube_name(),
**kwargs,
)

def _get_resource_list(
self, resource_class: Any, collection_path: str = constants.EMPTY_STRING, **kwargs,
self,
resource_class: Any,
collection_path: str = constants.EMPTY_STRING,
**kwargs,
):
"""Get a list a of resources from a list of ids.

Expand All @@ -82,7 +85,7 @@ def _get_resource_list(
*generate_path(
self._path,
resource_class.entity_path,
resource_class.request_many_path if not collection_path else collection_path,
collection_path if collection_path else resource_class.request_many_path,
request_list=True,
),
self,
Expand Down
9 changes: 6 additions & 3 deletions braincube_connector/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ class Client(base.Base):
"""A Client handles html requests."""

def __init__(
self, config_file: str = None, config_dict: Dict[str, str] = None, timeout: int = 60,
self,
config_file: str = None,
config_dict: Dict[str, str] = None,
timeout: int = 60,
) -> None:
"""Initialize Client.

Expand All @@ -26,7 +29,7 @@ def __init__(
timeout: Combined connect and read timeout for HTTP requests, in seconds.
"""
if instances.get_instance(INSTANCE_KEY) is not None:
raise Exception("A client has already been inialized.")
raise Exception("A client has already been inialized.") # noqa: WPS454
else:
self._config_dict = tools.check_config(config_dict=config_dict, config_file=config_file)
self._sso_url = tools.get_sso_base_url(self._config_dict)
Expand Down Expand Up @@ -87,7 +90,7 @@ def request_ws(
return request_result.json()
return request_result

def get_braincube_infos(self) -> Dict[str, Any]:
def get_braincube_infos(self) -> Dict[str, Any]: # noqa: WPS615
"""Get the information about the braincubes available to the client.

Returns:
Expand Down
4 changes: 3 additions & 1 deletion braincube_connector/data/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ def _to_datetime(dates: List["str"]):
Returns:
A datetime object.
"""
dates = pd.to_datetime(dates, errors="coerce", format="%Y%m%d_%H%M%S").to_series()
dates = pd.to_datetime(
dates, errors="coerce", format="%Y%m%d_%H%M%S" # noqa: WPS323
).to_series()
return [pandas_timestamp_to_datetime(timestamp) for timestamp in dates]


Expand Down
2 changes: 1 addition & 1 deletion braincube_connector/memory_base/nested_resources/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from braincube_connector.memory_base.nested_resources import condition_container, mb_child, rule

BCID = "bcId"
VARIABLE = "variable"
VARIABLE = "variable" # noqa: WPS110
POSITIVE_EVENTS = "positiveEvents"
NEGATIVE_EVENTS = "negativeEvents"

Expand Down
3 changes: 2 additions & 1 deletion braincube_connector/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ def get_sso_base_url(config: Dict[str, str]) -> str:
An URL to the Braincube SSO API
"""
default_base_url = "{protocol}://{domain}".format(
protocol=constants.DEFAULT_PROTOCOL, domain=config.get(constants.DOMAIN_KEY),
protocol=constants.DEFAULT_PROTOCOL,
domain=config.get(constants.DOMAIN_KEY),
)

base_url = config.get(constants.SSO_BASE_URL_KEY, default_base_url)
Expand Down
3 changes: 3 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
[mypy]
no_implicit_optional = False

[mypy-pandas.*]
ignore_missing_imports = True
Loading