Skip to content

Commit

Permalink
Merge pull request #502 from PrefectHQ/sort
Browse files Browse the repository at this point in the history
Import order fixing
  • Loading branch information
joshmeek committed Jan 9, 2019
2 parents bbf05c0 + bb3b086 commit 522a3bd
Show file tree
Hide file tree
Showing 64 changed files with 183 additions and 160 deletions.
4 changes: 2 additions & 2 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest
import sys
from cryptography.fernet import Fernet

import pytest
from cryptography.fernet import Fernet

import prefect
from prefect.engine.executors import LocalExecutor, SynchronousExecutor
Expand Down
1 change: 0 additions & 1 deletion docs/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import sys


if sys.version_info < (3, 6):
collect_ignore = ["test_generate_docs.py"]
9 changes: 4 additions & 5 deletions docs/generate_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,21 @@
"""
import importlib
import inspect
import nbformat as nbf
import os
import re
import shutil
import subprocess
import textwrap
import toml
import toolz
import warnings

from functools import partial

import nbformat as nbf
import toml
import toolz

import prefect
from tokenizer import format_code


OUTLINE_PATH = os.path.join(os.path.dirname(__file__), "outline.toml")
outline_config = toml.load(OUTLINE_PATH)

Expand Down
12 changes: 6 additions & 6 deletions docs/test_generate_docs.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import pytest
import sys

pytest.mark.skipif(sys.version_info < (3, 6))
pytestmark = pytest.mark.formatting

from functools import partial, wraps

import pytest
from toolz import curry

from generate_docs import (
OUTLINE,
create_absolute_path,
format_doc,
format_lists,
Expand All @@ -16,11 +14,13 @@
get_call_signature,
get_class_methods,
get_source,
OUTLINE,
)
from prefect import task
from prefect.engine.state import State

pytest.mark.skipif(sys.version_info < (3, 6))
pytestmark = pytest.mark.formatting


def no_args():
pass
Expand Down
2 changes: 1 addition & 1 deletion docs/tokenizer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from collections import namedtuple
from pygments.lexers import Python3Lexer

from pygments.lexers import Python3Lexer
from pygments.token import Comment, Keyword, Name, Number, Operator, Punctuation, String


Expand Down
1 change: 0 additions & 1 deletion examples/map_reduce.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from prefect import Flow, task


# ------------------------------------
# define some tasks

Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ env =
usedevelop = True

[isort]
skip = __init__.py
skip = __init__.py,/engine/executors/dask.py
multi_line_output = 3

[mypy]
Expand Down
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Licensed under LICENSE.md; also available at https://www.prefect.io/licenses/alpha-eula

from setuptools import find_packages, setup

import configparser
import sys

from setuptools import find_packages, setup

import versioneer

config = configparser.ConfigParser()
Expand Down
8 changes: 4 additions & 4 deletions src/prefect/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
import json
import logging
import os
from typing import Any, TYPE_CHECKING, Optional, Union, Dict, List
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union

import prefect
from prefect.utilities.exceptions import ClientError, AuthorizationError
from prefect.utilities.exceptions import AuthorizationError, ClientError
from prefect.utilities.graphql import (
EnumValue,
parse_graphql,
with_args,
GraphQLResult,
as_nested_dict,
parse_graphql,
with_args,
)

if TYPE_CHECKING:
Expand Down
4 changes: 2 additions & 2 deletions src/prefect/client/result_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
Anytime a task needs its output or inputs stored, a result handler is used to determine where this data should be stored (and how it can be retrieved).
"""
import base64
import cloudpickle
import tempfile

from typing import Any

import cloudpickle

from prefect import config
from prefect.client.client import Client

Expand Down
1 change: 0 additions & 1 deletion src/prefect/core/flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
from prefect.utilities.serialization import to_qualified_name
from prefect.utilities.tasks import as_task, unmapped


ParameterDetails = TypedDict("ParameterDetails", {"default": Any, "required": bool})


Expand Down
3 changes: 2 additions & 1 deletion src/prefect/engine/cache_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@
A cache validator returns `True` if the cache is still valid, and `False` otherwise.
"""
from typing import Any, Dict, Iterable

import pendulum
from toolz import curry
from typing import Any, Dict, Iterable

import prefect

Expand Down
4 changes: 2 additions & 2 deletions src/prefect/engine/cloud/task_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
from prefect.client import Client
from prefect.client.result_handlers import ResultHandler
from prefect.core import Edge, Task
from prefect.utilities.graphql import with_args
from prefect.engine.runner import ENDRUN
from prefect.engine.state import Failed, State, Mapped
from prefect.engine.state import Failed, Mapped, State
from prefect.engine.task_runner import TaskRunner
from prefect.utilities.graphql import with_args


class CloudTaskRunner(TaskRunner):
Expand Down
2 changes: 1 addition & 1 deletion src/prefect/engine/executors/base.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import datetime
import uuid
from contextlib import contextmanager
from typing import Any, Callable, Dict, List, Iterator
from typing import Any, Callable, Dict, Iterator, List

import prefect
from prefect.utilities.executors import multiprocessing_timeout
Expand Down
13 changes: 6 additions & 7 deletions src/prefect/engine/executors/dask.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
# Licensed under LICENSE.md; also available at https://www.prefect.io/licenses/alpha-eula

import datetime
import logging
import queue
import sys
import warnings
from contextlib import contextmanager
from typing import Any, Callable, Iterable, Iterator, List

if sys.version_info < (3, 5):
raise ImportError(
"""The DaskExecutor is only locally compatible with Python 3.5+"""
)

import datetime
from contextlib import contextmanager
from distributed import Client, fire_and_forget, Future, Queue, worker_client
from typing import Any, Callable, Iterable, Iterator, List

import queue
import warnings
from distributed import Client, Future, Queue, fire_and_forget, worker_client

from prefect import config
from prefect.engine.executors.base import Executor
Expand Down
2 changes: 1 addition & 1 deletion src/prefect/engine/executors/local.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Licensed under LICENSE.md; also available at https://www.prefect.io/licenses/alpha-eula

import datetime
from typing import Any, Callable, List, Iterable
from typing import Any, Callable, Iterable, List

from prefect.engine.executors.base import Executor
from prefect.utilities.executors import main_thread_timeout
Expand Down
2 changes: 1 addition & 1 deletion src/prefect/engine/executors/sync.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Licensed under LICENSE.md; also available at https://www.prefect.io/licenses/alpha-eula

import datetime
import warnings
from contextlib import contextmanager
from queue import Queue
from typing import Any, Callable, Iterable, Iterator, List

import dask
import dask.bag
import warnings

from prefect.engine.executors.base import Executor

Expand Down
4 changes: 2 additions & 2 deletions src/prefect/engine/runner.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import collections
import functools
from typing import Any, Callable, Iterable, Tuple, Dict, Optional
from typing import Any, Callable, Dict, Iterable, Optional, Tuple

import prefect
from prefect.engine import signals
from prefect.engine.state import State, Failed, Submitted, Pending
from prefect.engine.state import Failed, Pending, State, Submitted
from prefect.utilities import logging


Expand Down
3 changes: 2 additions & 1 deletion src/prefect/engine/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
"""
import copy
import datetime
from typing import Any, Dict, List, Union

import pendulum
from typing import Any, Dict, Union, List

import prefect
from prefect.client.result_handlers import ResultHandler
Expand Down
2 changes: 1 addition & 1 deletion src/prefect/engine/task_runner.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Licensed under LICENSE.md; also available at https://www.prefect.io/licenses/alpha-eula
import itertools
import collections
import copy
import itertools
import threading
from functools import partial, wraps
from typing import (
Expand Down
3 changes: 2 additions & 1 deletion src/prefect/serialization/edge.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from marshmallow import fields

import prefect
from prefect.utilities.serialization import VersionedSchema, version
from prefect.serialization.task import TaskSchema
from prefect.utilities.serialization import VersionedSchema, version


@version("0.3.3")
Expand Down
3 changes: 2 additions & 1 deletion src/prefect/tasks/templates/jinja2.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Licensed under LICENSE.md; also available at https://www.prefect.io/licenses/alpha-eula

from jinja2 import Template
from typing import Any

from jinja2 import Template

import prefect
from prefect import Task

Expand Down
15 changes: 7 additions & 8 deletions src/prefect/utilities/airflow_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,17 @@
For more details, see [the Airflow conversion tutorial](../../tutorials/airflow_migration.html).
"""

import sqlite3
import warnings
import os
import pickle
import sqlite3
import subprocess
import tempfile
import warnings
from collections import defaultdict
from contextlib import closing
from typing import Any, Dict, List

import prefect

try:
import airflow
Expand All @@ -20,12 +25,6 @@
"The airflow_utils conversion tools require `airflow` to be installed."
)

from collections import defaultdict
from contextlib import closing
from typing import Dict, List, Any

import prefect


__all__ = ["AirFlow"]

Expand Down
3 changes: 2 additions & 1 deletion src/prefect/utilities/datetimes.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Licensed under LICENSE.md; also available at https://www.prefect.io/licenses/alpha-eula

import pendulum
import datetime
from typing import Any, Callable

import pendulum


def retry_delay(
interval: datetime.timedelta = None,
Expand Down
6 changes: 3 additions & 3 deletions src/prefect/utilities/debug.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Licensed under LICENSE.md; also available at https://www.prefect.io/licenses/alpha-eula

import cloudpickle
import os
import subprocess
import tempfile

from contextlib import contextmanager
import textwrap
from contextlib import contextmanager
from typing import Any, Iterator

import cloudpickle

import prefect
from prefect.engine import state

Expand Down
6 changes: 3 additions & 3 deletions src/prefect/utilities/executors.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# Licensed under LICENSE.md; also available at https://www.prefect.io/licenses/alpha-eula

import dask
import dask.bag
import datetime
import multiprocessing
import signal
import threading
from functools import wraps
from typing import Any, Callable, Dict, List, Union

import dask
import dask.bag

import prefect
from prefect.core.edge import Edge


StateList = Union["prefect.engine.state.State", List["prefect.engine.state.State"]]


Expand Down
3 changes: 2 additions & 1 deletion src/prefect/utilities/graphql.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import json
import re
import uuid
import textwrap
import uuid
from collections.abc import KeysView, ValuesView
from typing import Any, Union

from prefect.utilities.collections import DotDict, as_nested_dict


Expand Down
Loading

0 comments on commit 522a3bd

Please sign in to comment.