Skip to content

Commit

Permalink
format: add isort to manage import order
Browse files Browse the repository at this point in the history
Signed-off-by: vsoch <vsoch@users.noreply.github.com>
  • Loading branch information
vsoch committed Oct 19, 2022
1 parent af3aa90 commit 37366fe
Show file tree
Hide file tree
Showing 60 changed files with 165 additions and 161 deletions.
11 changes: 6 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ repos:
types: [python]
entry: black

# - id: isort
# name: isort
# language: python
# types: [python]
# entry: isort
- id: isort
name: isort
args: [--filter-files]
language: python
types: [python]
entry: isort

- id: flake8
name: flake8
Expand Down
7 changes: 5 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ target-version = ['py36']
exclude = ["^env/", "^src/bindings/python/flux/utils/*/*.py", "^src/bindings/python/flux/utils/*/*/*.py"]

[tool.isort]
profile = "isort"
exclude = ["^env/"]
profile = "black" # needed for black/isort compatibility
skip = [
"src/bindings/python/flux/job/kvs.py",
"src/bindings/python/flux/job/__init__.py",
"src/bindings/python/flux/resource/__init__.py"]

[tool.mypy]
python_version = 3.6
Expand Down
1 change: 1 addition & 0 deletions src/bindings/python/_flux/_core_build.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from pathlib import Path

from cffi import FFI

ffi = FFI()
Expand Down
3 changes: 2 additions & 1 deletion src/bindings/python/_flux/_hostlist_build.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from cffi import FFI
from pathlib import Path

from cffi import FFI

ffi = FFI()

ffi.set_source(
Expand Down
1 change: 1 addition & 0 deletions src/bindings/python/_flux/_idset_build.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from pathlib import Path

from cffi import FFI

ffi = FFI()
Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/_flux/_rlist_build.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from pathlib import Path
from cffi import FFI

from _hostlist_build import ffi as hostlist_ffi
from _idset_build import ffi as idset_ffi
from cffi import FFI

ffi = FFI()

Expand Down
1 change: 1 addition & 0 deletions src/bindings/python/_flux/_security_build.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from pathlib import Path

from cffi import FFI

ffi = FFI()
Expand Down
3 changes: 1 addition & 2 deletions src/bindings/python/_flux/make_clean_header.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@
# SPDX-License-Identifier: LGPL-3.0
###############################################################

import argparse
import os
import re

import argparse

parser = argparse.ArgumentParser()

parser.add_argument("header", help="C header file to parse", type=str)
Expand Down
1 change: 1 addition & 0 deletions src/bindings/python/flux/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"""
import flux.core.handle


# Manually lazy
# pylint: disable=invalid-name
def Flux(*args, **kwargs):
Expand Down
3 changes: 2 additions & 1 deletion src/bindings/python/flux/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@

"""Global constants for the flux interface"""

import sys
import re
import sys

from _flux._core import lib

MOD = sys.modules[__name__]
Expand Down
17 changes: 7 additions & 10 deletions src/bindings/python/flux/core/handle.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,15 @@
import threading
from contextlib import contextmanager

from flux.wrapper import Wrapper
from _flux._core import ffi, lib
from flux.constants import FLUX_POLLERR, FLUX_POLLIN, FLUX_POLLOUT
from flux.core.inner import raw
from flux.core.watchers import FDWatcher, SignalWatcher, TimerWatcher
from flux.future import Future
from flux.message import Message, MessageWatcher
from flux.rpc import RPC
from flux.message import Message
from flux.util import encode_topic, encode_payload
from flux.core.inner import raw
from flux.message import MessageWatcher
from flux.core.watchers import TimerWatcher
from flux.core.watchers import SignalWatcher
from flux.core.watchers import FDWatcher
from flux.constants import FLUX_POLLIN, FLUX_POLLOUT, FLUX_POLLERR
from _flux._core import ffi, lib
from flux.util import encode_payload, encode_topic
from flux.wrapper import Wrapper


# pylint: disable=too-many-public-methods
Expand Down
1 change: 1 addition & 0 deletions src/bindings/python/flux/core/trampoline.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
###############################################################

import importlib

from _flux._core import lib
from flux.core.handle import Flux

Expand Down
3 changes: 2 additions & 1 deletion src/bindings/python/flux/core/watchers.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
import abc
import errno
import signal
from flux.core.inner import raw, lib, ffi

from flux.core.inner import ffi, lib, raw

__all__ = ["TimerWatcher", "FDWatcher", "SignalWatcher"]

Expand Down
3 changes: 1 addition & 2 deletions src/bindings/python/flux/future.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@
###############################################################

import errno

from typing import Dict

from flux.core.inner import ffi, lib, raw
from flux.util import check_future_error, interruptible
from flux.wrapper import Wrapper, WrapperPimpl
from flux.core.inner import ffi, lib, raw

# Reference count dictionary to keep futures with a pending `then` callback
# alive, even if there are no remaining references to the future in the user's
Expand Down
3 changes: 2 additions & 1 deletion src/bindings/python/flux/hostlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
# SPDX-License-Identifier: LGPL-3.0
###############################################################

import numbers
import collections
import numbers

from _flux._hostlist import ffi, lib
from flux.wrapper import Wrapper, WrapperPimpl

Expand Down
3 changes: 2 additions & 1 deletion src/bindings/python/flux/idset.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
# SPDX-License-Identifier: LGPL-3.0
###############################################################

import numbers
import collections
import numbers

from _flux._idset import ffi, lib
from flux.wrapper import Wrapper, WrapperPimpl

Expand Down
4 changes: 2 additions & 2 deletions src/bindings/python/flux/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
# SPDX-License-Identifier: LGPL-3.0
###############################################################

import sys
import importlib
import os
import pkgutil
import importlib
import sys


def import_plugins_pkg(ns_pkg):
Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/flux/job/JobID.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
# SPDX-License-Identifier: LGPL-3.0
###############################################################

from flux.job._wrapper import _RAW as RAW
from _flux._core import ffi
from flux.job._wrapper import _RAW as RAW


def id_parse(jobid_str):
Expand Down
11 changes: 5 additions & 6 deletions src/bindings/python/flux/job/Jobspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,16 @@
#
# SPDX-License-Identifier: LGPL-3.0
###############################################################
import os
import math
import json
import errno
import datetime
import collections
import collections.abc as abc
import datetime
import errno
import json
import math
import numbers
import os

import yaml

from _flux._core import ffi
from flux.util import parse_fsd, set_treedict

Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/flux/job/_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
# SPDX-License-Identifier: LGPL-3.0
###############################################################

from flux.wrapper import Wrapper
from _flux._core import ffi, lib
from flux.wrapper import Wrapper


class JobWrapper(Wrapper):
Expand Down
5 changes: 2 additions & 3 deletions src/bindings/python/flux/job/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@
#
# SPDX-License-Identifier: LGPL-3.0
###############################################################
import json
import errno
import json

from _flux._core import ffi
from flux.future import Future
from flux.job._wrapper import _RAW as RAW
from _flux._core import ffi


# Names of events that may appear in the main eventlog (i.e. ``eventlog="eventlog"``)
# See Flux RFC 21 for documentation on each event.
Expand Down
13 changes: 6 additions & 7 deletions src/bindings/python/flux/job/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,18 @@
This module defines the ``FluxExecutor`` and ``FluxExecutorFuture`` classes.
"""

import threading
import logging
import itertools
import collections
import concurrent.futures
import weakref
import time
import itertools
import logging
import os
import threading
import time
import weakref

import flux
from flux.job.event import MAIN_EVENTS, JobException, event_watch_async
from flux.job.submit import submit_async, submit_get_id
from flux.job.event import event_watch_async, JobException, MAIN_EVENTS


_SubmitPackage = collections.namedtuple(
"_SubmitPackage", ["submit_args", "submit_kwargs", "future"]
Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/flux/job/frobnicator/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
# SPDX-License-Identifier: LGPL-3.0
###############################################################

from flux.job.frobnicator.frobnicator import JobFrobnicator, FrobnicatorPlugin
from flux.job.frobnicator.frobnicator import FrobnicatorPlugin, JobFrobnicator
4 changes: 2 additions & 2 deletions src/bindings/python/flux/job/frobnicator/frobnicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
# SPDX-License-Identifier: LGPL-3.0
###############################################################

import os
import argparse
import os
from abc import abstractmethod

import flux
from flux.importer import import_plugins, import_path
from flux.importer import import_path, import_plugins
from flux.job import Jobspec


Expand Down
8 changes: 4 additions & 4 deletions src/bindings/python/flux/job/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@
# SPDX-License-Identifier: LGPL-3.0
###############################################################

import json
import os
import time
import pwd
import json
import string
import time
from collections import namedtuple

import flux.constants
from flux.memoized_property import memoized_property
from flux.core.inner import raw
from flux.job.JobID import JobID
from flux.job.stats import JobStats
from flux.memoized_property import memoized_property
from flux.resource import SchedResourceList
from flux.uri import JobURI
from flux.core.inner import raw


def statetostr(stateid, fmt="L"):
Expand Down
6 changes: 3 additions & 3 deletions src/bindings/python/flux/job/kill.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
# SPDX-License-Identifier: LGPL-3.0
###############################################################
import signal
from typing import Union, Optional
from typing import Optional, Union

from _flux._core import ffi
from flux.core.handle import Flux # for typing
from flux.future import Future
from flux.job._wrapper import _RAW as RAW
from flux.core.handle import Flux # for typing
from flux.job.JobID import JobID # for typing
from _flux._core import ffi


def kill_async(
Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/flux/job/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
#
# SPDX-License-Identifier: LGPL-3.0
###############################################################
import errno
import os
import pwd
import errno

import flux.constants
from flux.future import WaitAllFuture
Expand Down
6 changes: 3 additions & 3 deletions src/bindings/python/flux/job/submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
###############################################################
import errno

from _flux._core import ffi, lib
from flux import constants
from flux.util import check_future_error
from flux.future import Future
from flux.job import JobID
from flux.job.Jobspec import _convert_jobspec_arg_to_string
from flux.job._wrapper import _RAW as RAW
from _flux._core import ffi, lib
from flux.job.Jobspec import _convert_jobspec_arg_to_string
from flux.util import check_future_error


class SubmitFuture(Future):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"""

import errno

from flux.job.validator import ValidatorPlugin


Expand Down
1 change: 1 addition & 0 deletions src/bindings/python/flux/job/validator/plugins/jobspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"""

import json

from flux.job import validate_jobspec
from flux.job.validator import ValidatorPlugin

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import errno
from os.path import basename

from flux.job.validator import ValidatorPlugin


Expand Down

0 comments on commit 37366fe

Please sign in to comment.