Skip to content

Commit

Permalink
Update to isort 5.8 (#11204)
Browse files Browse the repository at this point in the history
* update examples

* use conda for 3.9 now

* use force_grid_wrap=4

* remove profile

* Update bokeh/util/string.py

Co-authored-by: Mateusz Paprocki <mattpap@gmail.com>

* add missing  boilerplate

Co-authored-by: Mateusz Paprocki <mattpap@gmail.com>
  • Loading branch information
bryevdv and mattpap committed Apr 28, 2021
1 parent 9a7aac8 commit dc42b28
Show file tree
Hide file tree
Showing 192 changed files with 845 additions and 289 deletions.
9 changes: 9 additions & 0 deletions bokeh/.isort.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
[isort]
force_grid_wrap=4
line_length=165
multi_line_output=3

indented_import_headings=False
include_trailing_comma=True

import_heading_stdlib=Standard library imports
import_heading_thirdparty=External imports
import_heading_firstparty=Bokeh imports
import_heading_localfolder=Bokeh imports

known_first_party=bokeh
known_third_party=boto,django,mock,selenium,sphinx
1 change: 1 addition & 0 deletions bokeh/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def main():
'''
import sys

from bokeh.command.bootstrap import main as _main

# Main entry point (see setup.py)
Expand Down
7 changes: 6 additions & 1 deletion bokeh/_testing/plugins/jupyter_notebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@
import subprocess
import sys
import time
from os.path import dirname, exists, join, pardir
from os.path import (
dirname,
exists,
join,
pardir,
)

# External imports
import pytest
Expand Down
8 changes: 7 additions & 1 deletion bokeh/_testing/util/screenshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@
import os
import subprocess
import sys
from os.path import abspath, dirname, join, pardir, split
from os.path import (
abspath,
dirname,
join,
pardir,
split,
)

# Bokeh imports
from bokeh.util.terminal import fail, trace
Expand Down
1 change: 1 addition & 0 deletions bokeh/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

"""Git implementation of _version.py."""

# Standard library imports
import errno
import os
import re
Expand Down
7 changes: 6 additions & 1 deletion bokeh/application/handlers/directory.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@

# Standard library imports
import sys
from os.path import basename, dirname, exists, join
from os.path import (
basename,
dirname,
exists,
join,
)

# External imports
from jinja2 import Environment, FileSystemLoader
Expand Down
4 changes: 2 additions & 2 deletions bokeh/colors/hsl.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
import colorsys

# Bokeh imports
from .color import Color
from ..util.deprecation import deprecated
from .color import Color

#-----------------------------------------------------------------------------
# Globals and constants
Expand Down Expand Up @@ -138,7 +138,7 @@ def to_rgb(self):
:class:`~bokeh.colors.rgb.RGB`
'''
from .rgb import RGB # prevent circular import
from .rgb import RGB # prevent circular import
r, g, b = colorsys.hls_to_rgb(float(self.h)/360, self.l, self.s)
return RGB(round(r*255), round(g*255), round(b*255), self.a)

Expand Down
2 changes: 1 addition & 1 deletion bokeh/colors/rgb.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def to_hsl(self):
:class:`~bokeh.colors.hsl.HSL`
'''
from .hsl import HSL # prevent circular import
from .hsl import HSL # prevent circular import
h, l, s = colorsys.rgb_to_hls(float(self.r)/255, float(self.g)/255, float(self.b)/255)
return HSL(round(h*360), s, l, self.a)

Expand Down
1 change: 1 addition & 0 deletions bokeh/command/subcommands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def _collect() -> List[Type[Subcommand]]:
from importlib import import_module
from os import listdir
from os.path import dirname

# reference type by module as fully
results = []

Expand Down
8 changes: 7 additions & 1 deletion bokeh/command/subcommands/file_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@
import sys
from abc import abstractmethod
from os.path import splitext
from typing import Dict, List, Optional, Tuple, Union
from typing import (
Dict,
List,
Optional,
Tuple,
Union,
)

# Bokeh imports
from ...document import Document
Expand Down
5 changes: 1 addition & 4 deletions bokeh/command/subcommands/serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,10 +421,7 @@ def get_login_url(request_handler):
from bokeh.application import Application
from bokeh.resources import DEFAULT_SERVER_PORT
from bokeh.server.auth_provider import AuthModule, NullAuth
from bokeh.server.tornado import (
DEFAULT_SESSION_TOKEN_EXPIRATION,
DEFAULT_WEBSOCKET_MAX_MESSAGE_SIZE_BYTES,
)
from bokeh.server.tornado import DEFAULT_SESSION_TOKEN_EXPIRATION, DEFAULT_WEBSOCKET_MAX_MESSAGE_SIZE_BYTES
from bokeh.settings import settings
from bokeh.util.logconfig import basicConfig
from bokeh.util.string import format_docstring, nice_join
Expand Down
8 changes: 7 additions & 1 deletion bokeh/command/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@
import os
import sys
import warnings
from typing import Dict, Iterator, List, Optional, Sequence
from typing import (
Dict,
Iterator,
List,
Optional,
Sequence,
)

# Bokeh imports
from bokeh.application import Application
Expand Down
10 changes: 8 additions & 2 deletions bokeh/core/has_props.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@
# Standard library imports
import difflib
from functools import lru_cache
from typing import Any, Dict, Optional, Set, Union
from typing import (
Any,
Dict,
Optional,
Set,
Union,
)
from warnings import warn

# Bokeh imports
Expand Down Expand Up @@ -459,7 +465,7 @@ def dataspecs(cls):
set[str] : names of ``DataSpec`` properties
'''
from .property.dataspec import DataSpec # avoid circular import
from .property.dataspec import DataSpec # avoid circular import
return {k: v for k, v in cls.properties(_with_props=True).items() if isinstance(v, DataSpec)}

def properties_with_values(self, *, include_defaults: bool = True, include_undefined: bool = False) -> Dict[str, Any]:
Expand Down
2 changes: 1 addition & 1 deletion bokeh/core/json_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,8 @@ def default(self, obj):
'''

from ..model import Model
from ..colors import Color
from ..model import Model
from .has_props import HasProps

# array types -- use force_list here, only binary
Expand Down
1 change: 1 addition & 0 deletions bokeh/core/property/_sphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
'''

# Standard library imports
#-----------------------------------------------------------------------------
# Boilerplate
#-----------------------------------------------------------------------------
Expand Down
8 changes: 7 additions & 1 deletion bokeh/core/property/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@
#-----------------------------------------------------------------------------

# Standard library imports
from collections.abc import Container, Iterable, Mapping, Sequence, Sized
from collections.abc import (
Container,
Iterable,
Mapping,
Sequence,
Sized,
)

# Bokeh imports
from ...util.serialization import decode_base64_dict, transform_column_source_data
Expand Down
14 changes: 12 additions & 2 deletions bokeh/core/property/dataspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,19 @@
from .enum import Enum
from .instance import Instance
from .nullable import Nullable
from .primitive import Float, Int, Null, String
from .primitive import (
Float,
Int,
Null,
String,
)
from .singletons import Undefined
from .visual import DashPattern, FontSize, HatchPatternType, MarkerType
from .visual import (
DashPattern,
FontSize,
HatchPatternType,
MarkerType,
)

#-----------------------------------------------------------------------------
# Globals and constants
Expand Down
6 changes: 1 addition & 5 deletions bokeh/core/property/datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@
import datetime

# Bokeh imports
from ...util.serialization import (
convert_date_to_datetime,
is_datetime_type,
is_timedelta_type,
)
from ...util.serialization import convert_date_to_datetime, is_datetime_type, is_timedelta_type
from .bases import Property
from .primitive import bokeh_integer_types
from .singletons import Undefined
Expand Down
4 changes: 2 additions & 2 deletions bokeh/core/property_mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ class SomeGlyph(Glyph):
FontSizeSpec,
FontStyleSpec,
HatchPatternSpec,
Instance,
Int,
IntSpec,
LineCapSpec,
LineJoinSpec,
Instance,
Int,
Nullable,
NumberSpec,
Size,
Expand Down
10 changes: 9 additions & 1 deletion bokeh/core/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,15 @@
#-----------------------------------------------------------------------------

# Standard library imports
from typing import Any, Callable, Dict, Iterator, Optional, Type, Union
from typing import (
Any,
Callable,
Dict,
Iterator,
Optional,
Type,
Union,
)

# Bokeh imports
from ..model import Model
Expand Down
7 changes: 6 additions & 1 deletion bokeh/core/validation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@
#-----------------------------------------------------------------------------

# Bokeh imports
from .check import check_integrity, process_validation_issues, silence, silenced
from .check import (
check_integrity,
process_validation_issues,
silence,
silenced,
)
from .decorators import error, warning

#-----------------------------------------------------------------------------
Expand Down
6 changes: 2 additions & 4 deletions bokeh/core/validation/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,9 @@ def _validator(code_or_name, validator_type):
'''
if validator_type == "error":
from .errors import codes
from .errors import EXT
from .errors import EXT, codes
elif validator_type == "warning":
from .warnings import codes
from .warnings import EXT
from .warnings import EXT, codes
else:
pass # TODO (bev) ValueError?

Expand Down
15 changes: 8 additions & 7 deletions bokeh/document/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@
from functools import wraps
from inspect import isclass
from json import loads
from typing import Any, Callable, Dict, List
from typing import (
Any,
Callable,
Dict,
List,
)

# External imports
import jinja2
Expand Down Expand Up @@ -65,11 +70,7 @@
TitleChangedEvent,
)
from .locking import UnlockedDocumentProxy
from .util import (
initialize_references_json,
instantiate_references_json,
references_json,
)
from .util import initialize_references_json, instantiate_references_json, references_json

#-----------------------------------------------------------------------------
# Globals and constants
Expand Down Expand Up @@ -1192,7 +1193,7 @@ def _with_self_as_curdoc(self, f):
'''
'''
from bokeh.io.doc import set_curdoc, curdoc
from bokeh.io.doc import curdoc, set_curdoc
old_doc = curdoc()
try:
if getattr(f, "nolock", False):
Expand Down
8 changes: 7 additions & 1 deletion bokeh/driving.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,13 @@ def update(i):

# Standard library imports
from functools import partial
from typing import Any, Callable, Iterable, Iterator, Sequence
from typing import (
Any,
Callable,
Iterable,
Iterator,
Sequence,
)

#-----------------------------------------------------------------------------
# Globals and constants
Expand Down
7 changes: 6 additions & 1 deletion bokeh/embed/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@

# Bokeh imports
from .server import server_document, server_session
from .standalone import autoload_static, components, file_html, json_item
from .standalone import (
autoload_static,
components,
file_html,
json_item,
)

#-----------------------------------------------------------------------------
# Globals and constants
Expand Down
16 changes: 14 additions & 2 deletions bokeh/embed/bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,20 @@

# Standard library imports
import json
from os.path import abspath, basename, dirname, exists, join, normpath
from typing import Dict, List, NamedTuple, Optional
from os.path import (
abspath,
basename,
dirname,
exists,
join,
normpath,
)
from typing import (
Dict,
List,
NamedTuple,
Optional,
)
from warnings import warn

# Bokeh imports
Expand Down

0 comments on commit dc42b28

Please sign in to comment.