Skip to content

Commit f30244c

Browse files
sort imports (#307)
- add hook - sort imports --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent b0ecd5c commit f30244c

File tree

78 files changed

+613
-388
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+613
-388
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ repos:
2020
rev: 22.12.0
2121
hooks:
2222
- id: black-jupyter
23+
- repo: https://github.com/PyCQA/isort
24+
rev: 5.12.0
25+
hooks:
26+
- id: isort
27+
files: \.py$
2328
# numpydoc
2429
- repo: https://github.com/Carreau/velin
2530
rev: 0.0.12

doc/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
# documentation root, use os.path.abspath to make it absolute, like shown here.
1212
#
1313
import os
14-
import sys
1514
import subprocess
15+
import sys
1616
from datetime import date
1717

1818
# sys.path.insert(0, os.path.abspath('.'))

dpdispatcher/__init__.py

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import logging
2-
import os, sys
2+
import os
3+
import sys
34
import warnings
45

56
ROOT_PATH = tuple(__path__)[0]
@@ -39,24 +40,19 @@
3940
except ImportError:
4041
__version__ = "unkown"
4142

42-
from .submission import Submission
43-
from .submission import Task
44-
from .submission import Job
45-
from .submission import Resources
46-
from .slurm import Slurm
47-
from .pbs import PBS
48-
from .pbs import Torque
49-
from .shell import Shell
50-
from .lsf import LSF
51-
from .dp_cloud_server import DpCloudServer, Lebesgue
5243
from .distributed_shell import DistributedShell
53-
from .machine import Machine
54-
44+
from .dp_cloud_server import DpCloudServer, Lebesgue
45+
from .dp_cloud_server_context import DpCloudServerContext, LebesgueContext
46+
from .hdfs_context import HDFSContext
5547
from .lazy_local_context import LazyLocalContext
5648
from .local_context import LocalContext
49+
from .lsf import LSF
50+
from .machine import Machine
51+
from .pbs import PBS, Torque
52+
from .shell import Shell
53+
from .slurm import Slurm
5754
from .ssh_context import SSHContext
58-
from .dp_cloud_server_context import DpCloudServerContext, LebesgueContext
59-
from .hdfs_context import HDFSContext
55+
from .submission import Job, Resources, Submission, Task
6056

6157

6258
def info():

dpdispatcher/arginfo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from dpdispatcher.submission import Resources, Task
21
from dpdispatcher.machine import Machine
2+
from dpdispatcher.submission import Resources, Task
33

44
resources_dargs = Resources.arginfo
55
machine_dargs = Machine.arginfo

dpdispatcher/base_context.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
from abc import ABCMeta, abstractmethod
2-
from dargs import Argument
32
from typing import List, Optional, Tuple
43

4+
from dargs import Argument
5+
56
from dpdispatcher import dlog
67

78

dpdispatcher/distributed_shell.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
from dpdispatcher.JobStatus import JobStatus
1+
import subprocess as sp
2+
23
from dpdispatcher import dlog
4+
from dpdispatcher.JobStatus import JobStatus
35
from dpdispatcher.machine import Machine
46
from dpdispatcher.utils import run_cmd_with_all_output
5-
import subprocess as sp
6-
77

88
shell_script_header_template = """
99
#!/bin/bash -l

dpdispatcher/dp_cloud_server.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
import warnings
66

77
from dpdispatcher import dlog
8-
from dpdispatcher.JobStatus import JobStatus
9-
from dpdispatcher.dpcloudserver import zip_file
10-
from dpdispatcher.dpcloudserver import Client
8+
from dpdispatcher.dpcloudserver import Client, zip_file
119
from dpdispatcher.dpcloudserver.config import ALI_OSS_BUCKET_URL
10+
from dpdispatcher.JobStatus import JobStatus
1211
from dpdispatcher.machine import Machine
1312

1413
shell_script_header_template = """

dpdispatcher/dp_cloud_server_context.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
#!/usr/bin/env python
22
# coding: utf-8
33
# %%
4+
import os
5+
import shutil
46
import time
57
import uuid
8+
from typing import List
69

10+
import tqdm
711
from dargs.dargs import Argument
8-
from dpdispatcher.base_context import BaseContext
9-
from typing import List
10-
import os
12+
1113
from dpdispatcher import dlog
14+
from dpdispatcher.base_context import BaseContext
1215

1316
# from dpdispatcher.submission import Machine
1417
# from . import dlog
15-
from .dpcloudserver import Client
16-
from .dpcloudserver import zip_file
17-
import shutil
18-
import tqdm
18+
from .dpcloudserver import Client, zip_file
1919

2020
# from zip_file import zip_files
2121
from .dpcloudserver.config import ALI_OSS_BUCKET_URL

dpdispatcher/dpcloudserver/client.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@
33
import re
44
import time
55
import urllib.parse
6-
import requests
7-
from .retcode import RETCODE
8-
from .config import HTTP_TIME_OUT, API_HOST, API_LOGGER_STACK_INFO
96
from urllib.parse import urljoin
107

8+
import requests
9+
1110
from dpdispatcher import dlog
1211

12+
from .config import API_HOST, API_LOGGER_STACK_INFO, HTTP_TIME_OUT
13+
from .retcode import RETCODE
14+
1315
try:
1416
import oss2
1517
from oss2 import SizedFileAdapter, determine_part_size

dpdispatcher/dpcloudserver/temp_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#%%
22
import os
33
import sys
4-
import uuid
54
import unittest
5+
import uuid
66

77
from dpdispatcher.dpcloudserver import api
88
from dpdispatcher.dpcloudserver.zip_file import zip_files

0 commit comments

Comments
 (0)