Skip to content

Commit

Permalink
Please isort again
Browse files Browse the repository at this point in the history
  • Loading branch information
liZe committed Mar 10, 2019
1 parent 1eea5a4 commit 167ebce
Show file tree
Hide file tree
Showing 50 changed files with 74 additions and 74 deletions.
6 changes: 3 additions & 3 deletions weasyprint/css/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
import cssselect2
import tinycss2

from .. import CSS
from ..logger import LOGGER, PROGRESS_LOGGER
from ..urls import URLFetchingError, get_url_attribute, url_join
from . import computed_values
from .properties import INHERITED, INITIAL_NOT_COMPUTED, INITIAL_VALUES
from .utils import remove_whitespace, split_on_comma
from .validation import preprocess_declarations
from .validation.descriptors import preprocess_descriptors
from .. import CSS
from ..logger import LOGGER, PROGRESS_LOGGER
from ..urls import URLFetchingError, get_url_attribute, url_join

# Reject anything not in here:
PSEUDO_ELEMENTS = (None, 'before', 'after', 'first-line', 'first-letter')
Expand Down
6 changes: 3 additions & 3 deletions weasyprint/css/computed_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@

from tinycss2.color3 import parse_color

from .properties import INITIAL_VALUES, Dimension
from .utils import (
ANGLE_TO_RADIANS, LENGTH_UNITS, LENGTHS_TO_PIXELS, safe_urljoin)
from .. import text
from ..logger import LOGGER
from ..urls import get_link_attribute
from .properties import INITIAL_VALUES, Dimension
from .utils import (
ANGLE_TO_RADIANS, LENGTH_UNITS, LENGTHS_TO_PIXELS, safe_urljoin)

ZERO_PIXELS = Dimension(0, 'px')

Expand Down
2 changes: 1 addition & 1 deletion weasyprint/css/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@

from tinycss2.color3 import parse_color

from .properties import Dimension
from ..formatting_structure import counters
from ..images import LinearGradient, RadialGradient
from ..urls import iri_to_uri, url_is_absolute
from .properties import Dimension

# http://dev.w3.org/csswg/css3-values/#angles
# 1<unit> is this many radians.
Expand Down
4 changes: 2 additions & 2 deletions weasyprint/css/validation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@

from tinycss2 import serialize

from ... import LOGGER
from ..utils import InvalidValues, remove_whitespace
from .expanders import EXPANDERS
from .properties import PREFIX, PROPRIETARY, UNSTABLE, validate_non_shorthand
from ..utils import InvalidValues, remove_whitespace
from ... import LOGGER

# Not applicable to the print media
NOT_PRINT_MEDIA = {
Expand Down
4 changes: 2 additions & 2 deletions weasyprint/css/validation/descriptors.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@

import tinycss2

from . import properties
from ...logger import LOGGER
from ..utils import (
InvalidValues, comma_separated_list, get_keyword, get_single_keyword,
get_url, remove_whitespace, single_keyword, single_token)
from ...logger import LOGGER
from . import properties

DESCRIPTORS = {}

Expand Down
6 changes: 3 additions & 3 deletions weasyprint/css/validation/expanders.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@

from tinycss2.color3 import parse_color

from ..properties import INITIAL_VALUES, Dimension
from ..utils import (
InvalidValues, get_keyword, get_single_keyword, split_on_comma)
from .descriptors import expand_font_variant
from .properties import (
background_attachment, background_image, background_position,
Expand All @@ -21,9 +24,6 @@
flex_wrap, font_family, font_size, font_stretch, font_style, font_weight,
line_height, list_style_image, list_style_position, list_style_type,
other_colors, overflow_wrap, validate_non_shorthand)
from ..properties import INITIAL_VALUES, Dimension
from ..utils import (
InvalidValues, get_keyword, get_single_keyword, split_on_comma)

EXPANDERS = {}

Expand Down
2 changes: 1 addition & 1 deletion weasyprint/css/validation/properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@

from tinycss2.color3 import parse_color

from ...formatting_structure import counters
from .. import computed_values
from ..properties import KNOWN_PROPERTIES, Dimension
from ..utils import (
InvalidValues, comma_separated_list, get_angle, get_content_list,
get_content_list_token, get_image, get_keyword, get_length, get_resolution,
get_single_keyword, get_url, parse_2d_position, parse_background_position,
parse_function, single_keyword, single_token)
from ...formatting_structure import counters

PREFIX = '-weasy-'
PROPRIETARY = set()
Expand Down
2 changes: 1 addition & 1 deletion weasyprint/formatting_structure/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@

import tinycss2.color3

from . import boxes, counters
from .. import html
from ..css import properties
from ..logger import LOGGER
from . import boxes, counters

# Maps values of the ``display`` CSS property to box types.
BOX_TYPE_FROM_DISPLAY = {
Expand Down
4 changes: 2 additions & 2 deletions weasyprint/layout/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@

from collections import defaultdict

from ..formatting_structure import boxes
from ..logger import PROGRESS_LOGGER
from .absolute import absolute_box_layout, absolute_layout
from .backgrounds import layout_backgrounds
from .pages import make_all_pages, make_margin_boxes
from ..formatting_structure import boxes
from ..logger import PROGRESS_LOGGER


def initialize_page_maker(context, root_box):
Expand Down
2 changes: 1 addition & 1 deletion weasyprint/layout/absolute.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
"""

from ..formatting_structure import boxes
from .markers import list_marker_layout
from .min_max import handle_min_max_width
from .percentages import resolve_percentages, resolve_position_percentages
from .preferred import shrink_to_fit
from .tables import table_wrapper_width
from ..formatting_structure import boxes


class AbsolutePlaceholder(object):
Expand Down
2 changes: 1 addition & 1 deletion weasyprint/layout/backgrounds.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
from collections import namedtuple
from itertools import cycle

from ..formatting_structure import boxes
from . import replaced
from .percentages import resolve_radii_percentages
from ..formatting_structure import boxes

Background = namedtuple('Background', 'color, layers, image_rendering')
BackgroundLayer = namedtuple(
Expand Down
2 changes: 1 addition & 1 deletion weasyprint/layout/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"""

from ..formatting_structure import boxes
from .absolute import AbsolutePlaceholder, absolute_layout
from .columns import columns_layout
from .flex import flex_layout
Expand All @@ -20,7 +21,6 @@
from .min_max import handle_min_max_width
from .percentages import resolve_percentages, resolve_position_percentages
from .tables import table_layout, table_wrapper_width
from ..formatting_structure import boxes


def block_level_layout(context, box, max_position_y, skip_stack,
Expand Down
2 changes: 1 addition & 1 deletion weasyprint/layout/columns.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

from math import floor

from ..formatting_structure import boxes
from .absolute import absolute_layout
from .percentages import resolve_percentages
from ..formatting_structure import boxes


def columns_layout(context, box, max_position_y, skip_stack, containing_block,
Expand Down
4 changes: 2 additions & 2 deletions weasyprint/layout/flex.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
import sys
from math import log10

from ..css.properties import Dimension
from ..formatting_structure import boxes
from .markers import list_marker_layout
from .percentages import resolve_one_percentage, resolve_percentages
from .preferred import max_content_width, min_content_width
from .tables import find_in_flow_baseline
from ..css.properties import Dimension
from ..formatting_structure import boxes


class FlexLine(list):
Expand Down
2 changes: 1 addition & 1 deletion weasyprint/layout/float.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
"""

from ..formatting_structure import boxes
from .markers import list_marker_layout
from .min_max import handle_min_max_width
from .percentages import resolve_percentages, resolve_position_percentages
from .preferred import shrink_to_fit
from .tables import table_wrapper_width
from ..formatting_structure import boxes


@handle_min_max_width
Expand Down
8 changes: 4 additions & 4 deletions weasyprint/layout/inlines.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@

import unicodedata

from ..css import computed_from_cascaded
from ..css.computed_values import ex_ratio, strut_layout
from ..formatting_structure import boxes
from ..text import can_break_text, split_first_line
from .absolute import AbsolutePlaceholder, absolute_layout
from .flex import flex_layout
from .float import avoid_collisions, float_layout
Expand All @@ -20,10 +24,6 @@
inline_min_content_width, shrink_to_fit, trailing_whitespace_size)
from .replaced import image_marker_layout
from .tables import find_in_flow_baseline, table_wrapper_width
from ..css import computed_from_cascaded
from ..css.computed_values import ex_ratio, strut_layout
from ..formatting_structure import boxes
from ..text import can_break_text, split_first_line


def iter_line_boxes(context, box, position_y, skip_stack, containing_block,
Expand Down
4 changes: 2 additions & 2 deletions weasyprint/layout/markers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
"""

from ..formatting_structure import boxes
from ..text import split_first_line
from .percentages import resolve_percentages
from .replaced import image_marker_layout
from .tables import find_in_flow_baseline
from ..formatting_structure import boxes
from ..text import split_first_line


def list_marker_layout(context, box):
Expand Down
8 changes: 4 additions & 4 deletions weasyprint/layout/pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@

import copy

from ..css import (
PageType, computed_from_cascaded, matching_page_types, set_computed_styles)
from ..formatting_structure import boxes, build
from ..logger import PROGRESS_LOGGER
from .absolute import absolute_layout
from .blocks import block_container_layout, block_level_layout
from .min_max import handle_min_max_height, handle_min_max_width
from .percentages import resolve_percentages
from .preferred import max_content_width, min_content_width
from ..css import (
PageType, computed_from_cascaded, matching_page_types, set_computed_styles)
from ..formatting_structure import boxes, build
from ..logger import PROGRESS_LOGGER


class OrientedBox(object):
Expand Down
2 changes: 1 addition & 1 deletion weasyprint/layout/preferred.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

import sys

from .replaced import default_image_sizing
from .. import text
from ..formatting_structure import boxes
from .replaced import default_image_sizing


def shrink_to_fit(context, box, available_width):
Expand Down
4 changes: 2 additions & 2 deletions weasyprint/layout/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
"""

from .percentages import resolve_one_percentage, resolve_percentages
from .preferred import max_content_width, table_and_columns_preferred_widths
from ..formatting_structure import boxes
from ..logger import LOGGER
from .percentages import resolve_one_percentage, resolve_percentages
from .preferred import max_content_width, table_and_columns_preferred_widths


def table_layout(context, table, max_position_y, skip_stack,
Expand Down
2 changes: 1 addition & 1 deletion weasyprint/tests/test_acid2.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
"""

from .. import HTML
from .test_draw import assert_pixels_equal, image_to_pixels
from .testing_utils import (
assert_no_logs, capture_logs, requires, resource_filename)
from .. import HTML


@assert_no_logs
Expand Down
4 changes: 2 additions & 2 deletions weasyprint/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
import py
import pytest

from .. import CSS, HTML, __main__, default_url_fetcher
from ..urls import path2url
from .test_draw import B, _, assert_pixels_equal, image_to_pixels, r
from .testing_utils import (
FakeHTML, assert_no_logs, capture_logs, http_server, resource_filename)
from .. import CSS, HTML, __main__, default_url_fetcher
from ..urls import path2url


def _test_resource(class_, basename, check, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion weasyprint/tests/test_boxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@

import pytest

from .testing_utils import BASE_URL, FakeHTML, assert_no_logs, capture_logs
from .. import images
from ..css import PageType, get_all_computed_styles
from ..css.targets import TargetCollector
from ..formatting_structure import boxes, build, counters
from ..layout.pages import set_page_type_computed_styles
from .testing_utils import BASE_URL, FakeHTML, assert_no_logs, capture_logs

PROPER_CHILDREN = dict((key, tuple(map(tuple, value))) for key, value in {
# Children can be of *any* type in *one* of the lists.
Expand Down
4 changes: 2 additions & 2 deletions weasyprint/tests/test_css.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
import pytest
import tinycss2

from .testing_utils import (
BASE_URL, FakeHTML, assert_no_logs, capture_logs, resource_filename)
from .. import CSS, css, default_url_fetcher
from ..css import PageType, get_all_computed_styles, parse_page_selectors
from ..css.computed_values import strut_layout
from ..layout.pages import set_page_type_computed_styles
from ..urls import path2url
from .testing_utils import (
BASE_URL, FakeHTML, assert_no_logs, capture_logs, resource_filename)


@assert_no_logs
Expand Down
2 changes: 1 addition & 1 deletion weasyprint/tests/test_css_descriptors.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

import tinycss2

from .testing_utils import assert_no_logs, capture_logs
from ..css import preprocess_stylesheet
from ..css.validation.descriptors import preprocess_descriptors
from .testing_utils import assert_no_logs, capture_logs


@assert_no_logs
Expand Down
2 changes: 1 addition & 1 deletion weasyprint/tests/test_css_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
import pytest
import tinycss2

from .testing_utils import assert_no_logs, capture_logs
from ..css import preprocess_declarations
from ..css.computed_values import ZERO_PIXELS
from ..css.properties import INITIAL_VALUES, Dimension
from ..images import LinearGradient, RadialGradient
from .testing_utils import assert_no_logs, capture_logs


def expand_to_dict(css, expected_error=None):
Expand Down
2 changes: 1 addition & 1 deletion weasyprint/tests/test_draw/test_background.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

import pytest

from . import B, G, _, assert_pixels, r
from ..testing_utils import assert_no_logs
from . import B, G, _, assert_pixels, r


@assert_no_logs
Expand Down
2 changes: 1 addition & 1 deletion weasyprint/tests/test_draw/test_before_after.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"""

from . import assert_same_rendering
from ..testing_utils import assert_no_logs
from . import assert_same_rendering


@assert_no_logs
Expand Down
Loading

2 comments on commit 167ebce

@Tontyna
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happened to isort? This commit makes my pytest fail with 17 x isort-check error, wants me to reverse your chages...

@liZe
Copy link
Member Author

@liZe liZe commented on 167ebce Mar 10, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isort decided to change the order for relative imports … before reverting the change … 2 weeks after. See PyCQA/isort#417. Updating to 4.3.10+ fixes the problem.

Please sign in to comment.