Skip to content

Commit afe7044

Browse files
author
Rasmus Oscar Welander
committed
Fixed linting errors, added __init__.py in exceptions
1 parent 053eef1 commit afe7044

10 files changed

+45
-66
lines changed

src/cs3resource.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def from_file_ref_and_endpoint(cls, file: str, endpoint: str | None = None) -> "
8181
if file.find("/") > 0:
8282
# assume we have an relative path,
8383
parent_id = file[: file.find("/")]
84-
rel_path = file[file.find("/") :]
84+
rel_path = file[file.find("/"):]
8585
else:
8686
# assume we have an opaque fileid
8787
opaque_id = file

src/exceptions/__init__.py

Whitespace-only changes.

tests/fixtures.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@
1414
from unittest.mock import Mock, patch
1515
from configparser import ConfigParser
1616
import cs3.rpc.v1beta1.code_pb2 as cs3code
17-
from cs3client import CS3Client
18-
from file import File
19-
from auth import Auth
20-
from user import User
21-
from statuscodehandler import StatusCodeHandler
22-
from share import Share
23-
from app import App
24-
from checkpoint import Checkpoint
25-
from config import Config
2617
import base64
2718
import json
2819

29-
sys.path.append("../src/")
20+
sys.path.append("src/")
21+
from cs3client import CS3Client # noqa: E402
22+
from file import File # noqa: E402
23+
from auth import Auth # noqa: E402
24+
from user import User # noqa: E402
25+
from statuscodehandler import StatusCodeHandler # noqa: E402
26+
from share import Share # noqa: E402
27+
from app import App # noqa: E402
28+
from checkpoint import Checkpoint # noqa: E402
29+
from config import Config # noqa: E402
3030

3131

3232
@pytest.fixture

tests/test_app.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,20 @@
99
"""
1010

1111
import sys
12+
import cs3.rpc.v1beta1.code_pb2 as cs3code
13+
from unittest.mock import Mock, patch
14+
import pytest
1215

1316
sys.path.append("src/")
1417

15-
from exceptions.exceptions import (
18+
from exceptions.exceptions import ( # noqa: E402
1619
AuthenticationException,
1720
NotFoundException,
1821
UnknownException,
1922
)
23+
from cs3resource import Resource # noqa: E402
2024

21-
from cs3resource import Resource
22-
23-
import cs3.rpc.v1beta1.code_pb2 as cs3code
24-
from fixtures import ( # noqa: F401 (they are used, the framework is not detecting it)
25+
from fixtures import ( # noqa: F401, E402 (they are used, the framework is not detecting it)
2526
mock_config,
2627
mock_logger,
2728
mock_authentication,
@@ -30,13 +31,6 @@
3031
mock_status_code_handler,
3132
)
3233

33-
from unittest.mock import Mock, patch
34-
35-
import pytest
36-
37-
sys.path.append("src/")
38-
39-
4034
# Test cases for the App class
4135
# Test cases for the App class `list_app_providers` method using parameterized tests
4236

tests/test_checkpoint.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,21 @@
99
"""
1010

1111
import sys
12+
from unittest.mock import Mock, patch
13+
import pytest
14+
import cs3.rpc.v1beta1.code_pb2 as cs3code
1215

1316
sys.path.append("src/")
1417

15-
from exceptions.exceptions import (
18+
from exceptions.exceptions import ( # noqa: E402
1619
AuthenticationException,
1720
NotFoundException,
1821
UnknownException,
1922
)
2023

21-
from cs3resource import Resource
24+
from cs3resource import Resource # noqa: E402
2225

23-
import cs3.rpc.v1beta1.code_pb2 as cs3code
24-
from fixtures import ( # noqa: F401 (they are used, the framework is not detecting it)
26+
from fixtures import ( # noqa: F401, E402 (they are used, the framework is not detecting it)
2527
mock_config,
2628
mock_logger,
2729
mock_authentication,
@@ -30,11 +32,7 @@
3032
mock_status_code_handler,
3133
)
3234

33-
from unittest.mock import Mock, patch
34-
35-
import pytest
3635

37-
sys.path.append("src/")
3836
# Test cases for the Checkpoint class
3937

4038

tests/test_cs3client.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
sys.path.append("src/")
1414

15-
from fixtures import ( # noqa: F401 (they are used, the framework is not detecting it)
15+
from fixtures import ( # noqa: F401, E402 (they are used, the framework is not detecting it)
1616
cs3_client_insecure,
1717
cs3_client_secure,
1818
mock_config,
@@ -21,8 +21,6 @@
2121
create_mock_jwt,
2222
)
2323

24-
sys.path.append("src/")
25-
2624

2725
def test_cs3client_initialization_secure(cs3_client_secure): # noqa: F811 (not a redefinition)
2826
client = cs3_client_secure

tests/test_file.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,27 @@
99
"""
1010

1111
import sys
12+
import pytest
13+
from unittest.mock import Mock, patch
14+
import cs3.rpc.v1beta1.code_pb2 as cs3code
1215

1316
sys.path.append("src/")
1417

15-
from cs3resource import Resource
16-
from exceptions.exceptions import (
18+
from cs3resource import Resource # noqa: E402
19+
from exceptions.exceptions import ( # noqa: E402
1720
AuthenticationException,
1821
NotFoundException,
1922
FileLockedException,
2023
UnknownException,
2124
)
22-
import cs3.rpc.v1beta1.code_pb2 as cs3code
23-
from fixtures import ( # noqa: F401 (they are used, the framework is not detecting it)
25+
from fixtures import ( # noqa: F401, E402 (they are used, the framework is not detecting it)
2426
mock_config,
2527
mock_logger,
2628
mock_authentication,
2729
mock_gateway,
2830
file_instance,
2931
mock_status_code_handler,
3032
)
31-
from unittest.mock import Mock, patch
32-
import pytest
33-
34-
sys.path.append("src/")
3533

3634

3735
@pytest.mark.parametrize(

tests/test_resource.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,13 @@
99
"""
1010

1111
import sys
12-
13-
sys.path.append("src/")
14-
1512
import unittest
1613
import cs3.storage.provider.v1beta1.resources_pb2 as cs3spr
17-
from cs3resource import Resource
1814

1915
sys.path.append("src/")
2016

17+
from cs3resource import Resource # noqa: E402
18+
2119

2220
class TestResource(unittest.TestCase):
2321

tests/test_share.py

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,22 @@
99
"""
1010

1111
import sys
12+
import pytest
13+
from unittest.mock import Mock, patch
14+
import cs3.sharing.collaboration.v1beta1.resources_pb2 as cs3scr
15+
import cs3.sharing.link.v1beta1.link_api_pb2 as cs3slapi
16+
import cs3.storage.provider.v1beta1.resources_pb2 as cs3spr
17+
import cs3.rpc.v1beta1.code_pb2 as cs3code
1218

1319
sys.path.append("src/")
14-
15-
from exceptions.exceptions import (
20+
from exceptions.exceptions import ( # noqa: E402
1621
AuthenticationException,
1722
NotFoundException,
1823
UnknownException,
1924
FileLockedException,
2025
AlreadyExistsException,
2126
)
22-
23-
import cs3.sharing.collaboration.v1beta1.resources_pb2 as cs3scr
24-
import cs3.sharing.link.v1beta1.link_api_pb2 as cs3slapi
25-
import cs3.storage.provider.v1beta1.resources_pb2 as cs3spr
26-
27-
import cs3.rpc.v1beta1.code_pb2 as cs3code
28-
from fixtures import ( # noqa: F401 (they are used, the framework is not detecting it)
27+
from fixtures import ( # noqa: F401, E402 (they are used, the framework is not detecting it)
2928
mock_config,
3029
mock_logger,
3130
mock_authentication,
@@ -35,12 +34,6 @@
3534
)
3635

3736

38-
from unittest.mock import Mock, patch
39-
40-
import pytest
41-
42-
sys.path.append("src/")
43-
4437
# Test cases for the Share class `get_share` method using parameterized tests
4538

4639

tests/test_user.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,25 @@
99
"""
1010

1111
import sys
12+
import pytest
13+
from unittest.mock import Mock, patch
14+
import cs3.rpc.v1beta1.code_pb2 as cs3code
1215

1316
sys.path.append("src/")
1417

15-
from exceptions.exceptions import (
18+
from exceptions.exceptions import ( # noqa: E402
1619
AuthenticationException,
1720
NotFoundException,
1821
UnknownException,
1922
)
20-
import cs3.rpc.v1beta1.code_pb2 as cs3code
21-
from fixtures import ( # noqa: F401 (they are used, the framework is not detecting it)
23+
from fixtures import ( # noqa: F401, E402 (they are used, the framework is not detecting it)
2224
mock_config,
2325
mock_logger,
2426
mock_authentication,
2527
mock_gateway,
2628
user_instance,
2729
mock_status_code_handler,
2830
)
29-
from unittest.mock import Mock, patch
30-
import pytest
3131

3232

3333
# Test cases for the User class

0 commit comments

Comments
 (0)