Skip to content

Commit 45cb3dc

Browse files
committed
Clean up code
1 parent 31447f9 commit 45cb3dc

7 files changed

Lines changed: 9 additions & 12 deletions

File tree

‎lean/commands/lean.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1111
# See the License for the specific language governing permissions and
1212
# limitations under the License.
13-
from typing import Optional
1413

1514
from click import group, option, Context, pass_context, echo
1615

‎lean/commands/live/deploy.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# limitations under the License.
1313

1414
from pathlib import Path
15-
from typing import Any, Dict, List, Optional, Tuple
15+
from typing import List, Optional, Tuple
1616
from click import option, argument, Choice
1717
from lean.click import LeanCommand, PathParameter
1818
from lean.components.util.name_rename import rename_internal_config_to_user_friendly_format

‎lean/components/api/live_client.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@
1111
# See the License for the specific language governing permissions and
1212
# limitations under the License.
1313

14-
from datetime import datetime
1514
from typing import List, Optional
1615

1716
from lean.components.api.api_client import *
18-
from lean.models.api import QCFullLiveAlgorithm, QCLiveAlgorithmStatus, QCMinimalLiveAlgorithm, QCNotificationMethod, QCRestResponse
17+
from lean.models.api import QCFullLiveAlgorithm, QCMinimalLiveAlgorithm, QCNotificationMethod, QCRestResponse
1918

2019

2120
class LiveClient:

‎lean/components/util/compiler.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,14 @@ def _compile() -> Dict[str, Any]:
111111
"mounts": [],
112112
"volumes": {}
113113
}
114-
lean_runner.mount_project_and_library_directories(project_dir, run_options)
115-
lean_runner.setup_language_specific_run_options(run_options, project_dir, algorithm_file, False, False)
116114

117115
project_config = project_config_manager.get_project_config(project_dir)
118116
engine_image = cli_config_manager.get_engine_image(
119117
project_config.get("engine-image", None))
120118

119+
lean_runner.mount_project_and_library_directories(project_dir, run_options)
120+
lean_runner.setup_language_specific_run_options(run_options, project_dir, algorithm_file, False, False, engine_image)
121+
121122
message["result"] = docker_manager.run_image(engine_image, **run_options)
122123
temp_manager.delete_temporary_directories_when_done = False
123124
return message
@@ -153,8 +154,7 @@ def _parse_python_errors(python_output: str, color_coding_required: bool) -> lis
153154
errors.append(f"{bcolors.FAIL}Build Error File: {match[0]} Line {match[1]} Column {match[2]} - {match[3]}{bcolors.ENDC}\n")
154155
else:
155156
errors.append(f"Build Error File: {match[0]} Line {match[1]} Column {match[2]} - {match[3]}\n")
156-
157-
for match in re.findall(r"\*\*\* Sorry: ([^(]+) \(([^,]+), line (\d+)\)", python_output):
157+
for match in findall(r"\*\*\* Sorry: ([^(]+) \(([^,]+), line (\d+)\)", python_output):
158158
if color_coding_required:
159159
errors.append(f"{bcolors.FAIL}Build Error File: {match[1]} Line {match[2]} Column 0 - {match[0]}{bcolors.ENDC}\n")
160160
else:

‎lean/components/util/project_manager.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,6 @@ def restore_csharp_project(self, csproj_file: Path, no_local: bool) -> None:
366366
"""
367367
from shutil import which
368368
from subprocess import run, STDOUT, PIPE
369-
from lean.models.errors import MoreInfoError
370369

371370
if no_local:
372371
return

‎lean/main.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def main() -> None:
9797
if temp_manager.delete_temporary_directories_when_done:
9898
temp_manager.delete_temporary_directories()
9999
except Exception as exception:
100-
from traceback import format_exc, print_exc
100+
from traceback import format_exc
101101
from click import UsageError, Abort
102102
from requests import exceptions
103103
from io import StringIO

‎lean/models/pydantic.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
# We keep all this imports here, even if not used like validator, so other files can import them through this file
1717
# to avoid having to check the pydantic version in every file.
1818
# All imports should be done through this file to avoid pydantic version related errors.
19-
from pydantic import BaseModel, ValidationError, Field, validator
19+
from pydantic import BaseModel, ValidationError
2020
else:
21-
from pydantic.v1 import BaseModel, ValidationError, Field, validator
21+
from pydantic.v1 import BaseModel, ValidationError
2222

2323
class WrappedBaseModel(BaseModel):
2424
"""A version of Pydantic's BaseModel which makes the input data accessible in case of a validation error."""

0 commit comments

Comments
 (0)