Skip to content

Commit 7188493

Browse files
committed
refactor: 根据 sonarlint 提示修改异味代码
1 parent 8fcf39e commit 7188493

22 files changed

Lines changed: 234 additions & 228 deletions

bgesdk/client.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141

4242
endpoints = [v['endpoint'] for v in constants.ENDPOINTS]
4343

44+
ACCESS_TOKEN_API = '/oauth2/access_token'
45+
4446

4547
def progress_callback(bytes_consumed, total_bytes):
4648
sys.stdout.write(
@@ -65,7 +67,7 @@ def alive(self):
6567
self.endpoint, max_retries=max_retries, verbose=verbose)
6668
try:
6769
request.get('/ping', timeout=timeout)
68-
except Exception as e:
70+
except Exception:
6971
return False
7072
return True
7173

@@ -151,7 +153,7 @@ def exchange_authorization_code(self, code, redirect_uri):
151153
request = HTTPRequest(
152154
self.endpoint, max_retries=max_retries, verbose=verbose)
153155
result = request.post(
154-
'/oauth2/access_token', data=data, timeout=timeout)
156+
ACCESS_TOKEN_API, data=data, timeout=timeout)
155157
return models.AuthorizationCodeToken(self, result)
156158

157159
def exchange_refresh_token(self, refresh_token):
@@ -175,7 +177,7 @@ def exchange_refresh_token(self, refresh_token):
175177
request = HTTPRequest(
176178
self.endpoint, max_retries=max_retries, verbose=verbose)
177179
result = request.post(
178-
'/oauth2/access_token', data=data, timeout=timeout)
180+
ACCESS_TOKEN_API, data=data, timeout=timeout)
179181
return models.AuthorizationCodeToken(self, result)
180182

181183
def get_credentials_token(self):
@@ -195,7 +197,7 @@ def get_credentials_token(self):
195197
request = HTTPRequest(
196198
self.endpoint, max_retries=max_retries, verbose=verbose)
197199
result = request.post(
198-
'/oauth2/access_token', data=data, timeout=timeout)
200+
ACCESS_TOKEN_API, data=data, timeout=timeout)
199201
return models.ClientCredentialsToken(self, result)
200202

201203
def get_api(self, access_token):

bgesdk/management/command.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def __init__(self, parser, command_name=None, **kwargs):
2020
self.add_arguments(parser)
2121

2222
def add_arguments(self, parser):
23-
pass
23+
"""添加自定义命令参数"""
2424

2525
@abstractmethod
2626
def handler(self, args):

bgesdk/management/commands/api/commands/aggregate_omics_data.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
from bgesdk.management import constants
77
from bgesdk.management.command import BaseCommand
88
from bgesdk.management.utils import (
9-
get_active_project, config_get, read_config, output
9+
get_active_project,
10+
config_get,
11+
read_config,
12+
output
1013
)
1114
from bgesdk.models import ModelEncoder
1215
from bgesdk.version import __version__

bgesdk/management/commands/api/commands/download.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
from bgesdk.management import constants
77
from bgesdk.management.command import BaseCommand
88
from bgesdk.management.utils import (
9-
get_active_project, config_get, read_config, output
9+
get_active_project,
10+
config_get,
11+
read_config,
12+
output
1013
)
1114
from bgesdk.version import __version__
1215

bgesdk/management/commands/api/commands/get_data_items.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
from bgesdk.management import constants
77
from bgesdk.management.command import BaseCommand
88
from bgesdk.management.utils import (
9-
get_active_project, config_get, read_config, output
9+
get_active_project,
10+
config_get,
11+
read_config,
12+
output
1013
)
1114
from bgesdk.models import ModelEncoder
1215
from bgesdk.version import __version__

bgesdk/management/commands/api/commands/get_func_abundance.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
from bgesdk.management import constants
77
from bgesdk.management.command import BaseCommand
88
from bgesdk.management.utils import (
9-
get_active_project, config_get, read_config, output
9+
get_active_project,
10+
config_get,
11+
read_config,
12+
output
1013
)
1114
from bgesdk.models import ModelEncoder
1215
from bgesdk.version import __version__

bgesdk/management/commands/api/commands/get_gene_abundance.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
from bgesdk.management import constants
77
from bgesdk.management.command import BaseCommand
88
from bgesdk.management.utils import (
9-
get_active_project, config_get, read_config, output
9+
get_active_project,
10+
config_get,
11+
read_config,
12+
output
1013
)
1114
from bgesdk.models import ModelEncoder
1215
from bgesdk.version import __version__

bgesdk/management/commands/api/commands/get_range_stream.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
from bgesdk.management import constants
77
from bgesdk.management.command import BaseCommand
88
from bgesdk.management.utils import (
9-
get_active_project, config_get, read_config, output
9+
get_active_project,
10+
config_get,
11+
read_config,
12+
output
1013
)
1114
from bgesdk.models import ModelEncoder
1215
from bgesdk.version import __version__
@@ -36,12 +39,12 @@ def add_arguments(self, parser):
3639
parser.add_argument(
3740
'--start_time',
3841
type=str,
39-
help='数据元编号。'
42+
help='起始时间。'
4043
)
4144
parser.add_argument(
4245
'--end_time',
4346
type=str,
44-
help='数据元编号。'
47+
help='终止时间。'
4548
)
4649
parser.add_argument(
4750
'--sort_direction',

bgesdk/management/commands/api/commands/get_samples.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
from bgesdk.management import constants
77
from bgesdk.management.command import BaseCommand
88
from bgesdk.management.utils import (
9-
get_active_project, config_get, read_config, output
9+
get_active_project,
10+
config_get,
11+
read_config,
12+
output
1013
)
1114
from bgesdk.models import ModelEncoder
1215
from bgesdk.version import __version__

bgesdk/management/commands/api/commands/get_taxon_abundance.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
from bgesdk.management import constants
77
from bgesdk.management.command import BaseCommand
88
from bgesdk.management.utils import (
9-
get_active_project, config_get, read_config, output
9+
get_active_project,
10+
config_get,
11+
read_config,
12+
output
1013
)
1114
from bgesdk.models import ModelEncoder
1215
from bgesdk.version import __version__

0 commit comments

Comments
 (0)