Skip to content

Commit

Permalink
Run isort
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Forbes committed Jun 21, 2017
1 parent b6c94c8 commit 96a358f
Show file tree
Hide file tree
Showing 15 changed files with 48 additions and 36 deletions.
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from setuptools import setup, find_packages
import os
import platform
import warnings
import os

from setuptools import find_packages, setup

requires = ["BeautifulSoup4", "cssutils", 'requests', 'webcolors',
'pygments', 'lxml', 'contexttimer', 'docopt']
Expand Down
5 changes: 3 additions & 2 deletions tests/comparison/generate_report.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import pathlib
import shutil
import subprocess
import sys

from selenium import webdriver
import subprocess
from wand.image import Image
from wand.color import Color
from wand.image import Image

image_directory = pathlib.Path("images")

Expand Down
4 changes: 3 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import pathlib

import pytest

from wordinserter import parsers
import pathlib

docs = pathlib.Path(__file__).parent / 'docs'

Expand Down
5 changes: 3 additions & 2 deletions tests/test_normalize.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from wordinserter.operations import Table, TableRow, TableCell
from wordinserter.parsers.fixes import table_colspans
import pytest

from wordinserter.operations import Table, TableCell, TableRow
from wordinserter.parsers.fixes import table_colspans


class TestNormalizeTable:
# Lists of (table_length, given, expected) table colspans
Expand Down
1 change: 0 additions & 1 deletion tests/test_parse_docs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
def test_parse_doc(html_parser, html_document):
with html_document.open() as fd:
html_parser.parse(fd.read())

2 changes: 0 additions & 2 deletions wordinserter/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@

from .parsers import HTMLParser, MarkdownParser
from .renderers import COMRenderer
from .utils import CombinedConstants
from .exceptions import InsertError
import inspect

parsers = {
Expand Down
6 changes: 4 additions & 2 deletions wordinserter/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@
--hidden Hide the Word window while rendering
"""

from wordinserter import parse, insert
import pathlib
import sys
import tempfile

from contexttimer import Timer
from docopt import docopt
import tempfile

from comtypes.client import CreateObject
from wordinserter import insert, parse


def get_file_contents(path):
Expand Down
4 changes: 2 additions & 2 deletions wordinserter/operations.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import codecs
import tempfile
import warnings
from urllib.parse import urlsplit

import requests
import tempfile
from urllib.parse import urlsplit


class RenderData(object):
Expand Down
2 changes: 1 addition & 1 deletion wordinserter/parsers/fixes/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from .list_elements import normalize_list_elements
from .whitespace import correct_whitespace
from .table_colspans import normalize_table_colspans
from .table_colspans import normalize_table_colspans
1 change: 0 additions & 1 deletion wordinserter/parsers/fixes/table_colspans.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,3 @@ def normalize_table(table: Table):
child.colspan = colspan_left

colspan_left -= child.colspan

3 changes: 2 additions & 1 deletion wordinserter/parsers/fixes/whitespace.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from wordinserter.operations import Text, Operation, CodeBlock, Paragraph
import re

from wordinserter.operations import CodeBlock, Operation, Paragraph, Text

_COLLAPSE_REGEX = re.compile(r'\s+')


Expand Down
22 changes: 13 additions & 9 deletions wordinserter/parsers/html.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import re
from collections import defaultdict
from functools import partial

from wordinserter.parsers.fixes import normalize_list_elements, correct_whitespace, normalize_table_colspans
from . import BaseParser
from ..operations import Paragraph, Bold, Italic, UnderLine, Text, \
CodeBlock, Group, IgnoredOperation, Style, Image, HyperLink, BulletList, \
NumberedList, ListElement, Table, TableRow, TableCell, TableHead, TableBody, Format, Footnote, Span, \
LineBreak, Heading
import bs4
from functools import partial
import cssutils
import re

from wordinserter.parsers.fixes import (correct_whitespace,
normalize_list_elements,
normalize_table_colspans)

from . import BaseParser
from ..operations import (Bold, BulletList, CodeBlock, Footnote, Format, Group,
Heading, HyperLink, IgnoredOperation, Image, Italic,
LineBreak, ListElement, NumberedList, Paragraph,
Span, Style, Table, TableBody, TableCell, TableHead,
TableRow, Text, UnderLine)

_COLLAPSE_REGEX = re.compile(r'\s+')

Expand Down Expand Up @@ -202,4 +207,3 @@ def _build_format(self, element):
args[name] = style.value.strip()

return Format(**args)

10 changes: 5 additions & 5 deletions wordinserter/parsers/markdown.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from . import BaseParser, ParseException

from ..operations import Paragraph, Bold, Italic, UnderLine, Text,\
CodeBlock, Group, IgnoredOperation, Style, Image, HyperLink, BulletList,\
NumberedList, ListElement, BaseList, Table, TableRow, TableCell, TableHead, Format, InlineCode

from ..operations import (BaseList, Bold, BulletList, CodeBlock, Format, Group,
HyperLink, IgnoredOperation, Image, InlineCode,
Italic, ListElement, NumberedList, Paragraph, Style,
Table, TableCell, TableHead, TableRow, Text,
UnderLine)
from .html import HTMLParser


Expand Down
12 changes: 8 additions & 4 deletions wordinserter/renderers/com.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
from . import BaseRenderer, renders
from ..operations import Text, Bold, Italic, UnderLine, Paragraph, LineBreak, CodeBlock, Style, Image, HyperLink, \
BulletList, NumberedList, ListElement, BaseList, Table, TableCell, TableRow, Format, \
InlineCode, Footnote, Span, Group, Heading
import warnings

import webcolors

from . import BaseRenderer, renders
from ..operations import (BaseList, Bold, BulletList, CodeBlock, Footnote,
Format, Group, Heading, HyperLink, Image, InlineCode,
Italic, LineBreak, ListElement, NumberedList,
Paragraph, Span, Style, Table, TableCell, TableRow,
Text, UnderLine)

WORD_WDCOLORINDEX_MAPPING = {
'lightgreen': 'wdBrightGreen',
'darkblue': 'wdDarkBlue',
Expand Down
2 changes: 1 addition & 1 deletion wordinserter/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from wordinserter.operations import Text, ChildlessOperation
from wordinserter.operations import ChildlessOperation, Text


class _NotFound(object):
Expand Down

0 comments on commit 96a358f

Please sign in to comment.