Skip to content

Commit 25b64e1

Browse files
committed
fix cyclic import and other clean
1 parent de29802 commit 25b64e1

File tree

8 files changed

+13
-13
lines changed

8 files changed

+13
-13
lines changed

pubweb/auth/iam.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from requests_aws4auth import AWS4Auth
44

55
from pubweb import config
6-
from pubweb.auth import AuthInfo
6+
from pubweb.auth.base import AuthInfo
77
from pubweb.models.auth import Creds
88

99

pubweb/auth/username.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
from pycognito import AWSSRP
33
from requests.auth import AuthBase
44

5-
from pubweb import config
6-
from pubweb.auth import AuthInfo
5+
from pubweb.auth.base import AuthInfo
6+
from pubweb.config import config
77

88

99
class UsernameAndPasswordAuth(AuthInfo):

pubweb/cli/interactive/workflow_args.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ def _prompt_repository_version(repo: Repository) -> Union[GitRelease, Branch]:
307307
if version_type == 'release':
308308

309309
# Get the releases which are available
310-
version_list = [x for x in repo.get_releases()]
310+
version_list = repo.get_releases()
311311
pretty_version_list = [f"{x.tag_name} ({x.title})" for x in version_list]
312312

313313
version = ask(

pubweb/clients/s3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def build_client(creds: Creds):
2828
aws_session_token=creds['SessionToken'])
2929

3030

31-
class ProgressPercentage(object):
31+
class ProgressPercentage:
3232
def __init__(self, progress: tqdm):
3333
self._lock = threading.Lock()
3434
self.progress = progress

pubweb/models/form_specification.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def validate_params(self, params: Dict):
4040
try:
4141
jsonschema.validate(instance=params, schema=self._form_spec_raw)
4242
except jsonschema.ValidationError as e:
43-
raise RuntimeError(f'Parameter at {e.json_path} error: {e.message}')
43+
raise RuntimeError(f'Parameter at {e.json_path} error: {e.message}') from e
4444

4545
def print(self):
4646
"""

pubweb/models/process.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ class RunAnalysisCommand(NamedTuple):
9797
def to_json(self):
9898
try:
9999
param_json = json.dumps(self.params)
100-
except TypeError:
101-
raise RuntimeError('Params invalid')
100+
except TypeError as e:
101+
raise RuntimeError('Params invalid') from e
102102

103103
return {
104104
'name': self.name,

pubweb/services/file.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from functools import partial
33
from typing import List
44

5-
from pubweb.auth import IAMAuth
5+
from pubweb.auth.iam import IAMAuth
66
from pubweb.clients import ApiClient, S3Client
77
from pubweb.file_utils import upload_directory, download_directory
88
from pubweb.models.auth import Creds
@@ -75,5 +75,5 @@ class FileEnabledService(BaseService):
7575
_file_service: FileService
7676

7777
def __init__(self, api_client: ApiClient, file_service: FileService):
78-
super(FileEnabledService, self).__init__(api_client)
78+
super().__init__(api_client)
7979
self._file_service = file_service

pubweb/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ def parse_json_date(json_date: str) -> Optional[datetime]:
2121

2222

2323
def safe_load_json(json_str: Optional[str]):
24-
if json_str is not None:
25-
return json.loads(json_str)
26-
else:
24+
if json_str is None:
2725
return {}
2826

27+
return json.loads(json_str)
28+
2929

3030
def format_date(date: Union[str, datetime]) -> str:
3131
if isinstance(date, str):

0 commit comments

Comments
 (0)