Fix linter issues

This commit is contained in:
Alex Burlacu 2023-07-19 17:28:58 +03:00
parent 028a835676
commit cc875f0fbe
7 changed files with 16 additions and 18 deletions

View File

@ -20,6 +20,7 @@ except ImportError as err:
"install with: pip install boto3"
) from err
@attr.s
class AWSDriver(CloudDriver):
"""AWS Driver"""
@ -59,7 +60,7 @@ class AWSDriver(CloudDriver):
launch_specification = ConfigFactory.from_dict(
{
"ImageId": resource_conf["ami_id"],
"Monitoring": {'Enabled':bool(resource_conf.get('enable_monitoring', False))},
"Monitoring": {'Enabled': bool(resource_conf.get('enable_monitoring', False))},
"InstanceType": resource_conf["instance_type"],
}
)

View File

@ -3,7 +3,6 @@ import itertools
import json
import logging
import os
import re
import sys
import warnings
from copy import copy
@ -34,12 +33,12 @@ from ...backend_interface.task.development.worker import DevWorker
from ...backend_interface.session import SendError
from ...backend_api import Session
from ...backend_api.services import tasks, models, events, projects
from ...backend_api.session.defs import ENV_OFFLINE_MODE
# from ...backend_api.session.defs import ENV_OFFLINE_MODE
from ...utilities.pyhocon import ConfigTree, ConfigFactory
from ...utilities.config import config_dict_to_text, text_to_config_dict
from ...errors import ArtifactUriDeleteError
from ..base import IdObjectBase, InterfaceBase
from ..base import IdObjectBase # , InterfaceBase
from ..metrics import Metrics, Reporter
from ..model import Model
from ..setupuploadmixin import SetupUploadMixin
@ -376,7 +375,6 @@ class Task(IdObjectBase, AccessMixin, SetupUploadMixin):
self._edit(type=tasks.TaskTypeEnum(task_type))
return id
def _set_storage_uri(self, value):
value = value.rstrip('/') if value else None
self._storage_uri = StorageHelper.conform_url(value)

View File

@ -70,7 +70,7 @@ class PatchGradio:
# noinspection PyBroadException
try:
return original_fn(*args, **kwargs)
except Exception as e:
except Exception:
del kwargs["root_path"]
return original_fn(*args, **kwargs)

View File

@ -242,7 +242,7 @@ def parse_known_host(parsed_host):
print('Assuming files and api ports are unchanged and use the same (' + parsed_host.scheme + ') protocol')
api_host = parsed_host.scheme + "://" + parsed_host.netloc + ':8008' + parsed_host.path
web_host = parsed_host.scheme + "://" + parsed_host.netloc + parsed_host.path
files_host = parsed_host.scheme + "://" + parsed_host.netloc+ ':8081' + parsed_host.path
files_host = parsed_host.scheme + "://" + parsed_host.netloc + ':8081' + parsed_host.path
else:
print("Warning! Could not parse host name")
api_host = ''

View File

@ -2981,7 +2981,7 @@ class Dataset(object):
task = Task.get_task(task_id=id_)
dataset_struct_entry = {
"job_id": id_[len("offline-"):] if id_.startswith("offline-") else id_, # .removeprefix not supported < Python 3.9
"job_id": id_[len("offline-"):] if id_.startswith("offline-") else id_, # .removeprefix not supported < Python 3.9
"status": task.status
}
# noinspection PyProtectedMember

View File

@ -116,6 +116,7 @@ class _Driver(object):
cls._file_server_hosts = hosts
return cls._file_server_hosts
class _HttpDriver(_Driver):
""" LibCloud http/https adapter (simple, enough for now) """
@ -1797,7 +1798,6 @@ class _FileStorageDriver(_Driver):
return os.path.isfile(object_name)
class StorageHelper(object):
""" Storage helper.
Used by the entire system to download/upload files.
@ -2433,7 +2433,7 @@ class StorageHelper(object):
result_dest_path = canonized_dest_path if return_canonized else dest_path
if self.scheme in StorageHelper._quotable_uri_schemes: # TODO: fix-driver-schema
if self.scheme in StorageHelper._quotable_uri_schemes: # TODO: fix-driver-schema
# quote link
result_dest_path = quote_url(result_dest_path, StorageHelper._quotable_uri_schemes)
@ -2451,7 +2451,7 @@ class StorageHelper(object):
result_path = canonized_dest_path if return_canonized else dest_path
if cb and self.scheme in StorageHelper._quotable_uri_schemes: # TODO: fix-driver-schema
if cb and self.scheme in StorageHelper._quotable_uri_schemes: # TODO: fix-driver-schema
# store original callback
a_cb = cb
@ -2976,7 +2976,6 @@ class StorageHelper(object):
)
def normalize_local_path(local_path):
"""
Get a normalized local path