Apply isort
This commit is contained in:
parent
6f8078eea3
commit
344615483a
5
setup.py
5
setup.py
@ -2,9 +2,10 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from setuptools import setup, find_packages
|
|
||||||
|
|
||||||
from src.wireviz import __version__, CMD_NAME, APP_URL
|
from setuptools import find_packages, setup
|
||||||
|
|
||||||
|
from src.wireviz import APP_URL, CMD_NAME, __version__
|
||||||
|
|
||||||
README_PATH = Path(__file__).parent / 'docs' / 'README.md'
|
README_PATH = Path(__file__).parent / 'docs' / 'README.md'
|
||||||
|
|
||||||
|
|||||||
@ -1,13 +1,12 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from dataclasses import InitVar, dataclass, field
|
||||||
from enum import Enum, auto
|
from enum import Enum, auto
|
||||||
from typing import Dict, List, Optional, Tuple, Union
|
|
||||||
from dataclasses import dataclass, field, InitVar
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from typing import Dict, List, Optional, Tuple, Union
|
||||||
|
|
||||||
from wireviz.wv_helper import int2tuple, aspect_ratio
|
from wireviz.wv_colors import COLOR_CODES, Color, ColorMode, Colors, ColorScheme
|
||||||
from wireviz.wv_colors import Color, Colors, ColorMode, ColorScheme, COLOR_CODES
|
from wireviz.wv_helper import aspect_ratio, int2tuple
|
||||||
|
|
||||||
|
|
||||||
# Each type alias have their legal values described in comments - validation might be implemented in the future
|
# Each type alias have their legal values described in comments - validation might be implemented in the future
|
||||||
PlainText = str # Text not containing HTML tags nor newlines
|
PlainText = str # Text not containing HTML tags nor newlines
|
||||||
|
|||||||
@ -1,25 +1,57 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from graphviz import Graph
|
|
||||||
from collections import Counter
|
|
||||||
from typing import Any, List, Union
|
|
||||||
from dataclasses import dataclass
|
|
||||||
from pathlib import Path
|
|
||||||
from itertools import zip_longest
|
|
||||||
import re
|
import re
|
||||||
|
from collections import Counter
|
||||||
|
from dataclasses import dataclass
|
||||||
|
from itertools import zip_longest
|
||||||
|
from pathlib import Path
|
||||||
|
from typing import Any, List, Union
|
||||||
|
|
||||||
from wireviz import wv_colors, __version__, APP_NAME, APP_URL
|
from graphviz import Graph
|
||||||
from wireviz.DataClasses import Cable, Connector, MatePin, MateComponent, Metadata, Options, Tweak, Side
|
|
||||||
|
from wireviz import APP_NAME, APP_URL, __version__, wv_colors
|
||||||
|
from wireviz.DataClasses import (
|
||||||
|
Cable,
|
||||||
|
Connector,
|
||||||
|
MateComponent,
|
||||||
|
MatePin,
|
||||||
|
Metadata,
|
||||||
|
Options,
|
||||||
|
Tweak,
|
||||||
|
Side,
|
||||||
|
)
|
||||||
|
from wireviz.wv_bom import (
|
||||||
|
HEADER_MPN,
|
||||||
|
HEADER_PN,
|
||||||
|
HEADER_SPN,
|
||||||
|
bom_list,
|
||||||
|
component_table_entry,
|
||||||
|
generate_bom,
|
||||||
|
get_additional_component_table,
|
||||||
|
pn_info_string,
|
||||||
|
)
|
||||||
from wireviz.wv_colors import get_color_hex, translate_color
|
from wireviz.wv_colors import get_color_hex, translate_color
|
||||||
from wireviz.wv_gv_html import nested_html_table, \
|
from wireviz.wv_gv_html import (
|
||||||
html_bgcolor_attr, html_bgcolor, html_colorbar, \
|
html_bgcolor,
|
||||||
html_image, html_caption, remove_links, html_line_breaks
|
html_bgcolor_attr,
|
||||||
from wireviz.wv_bom import pn_info_string, component_table_entry, \
|
html_caption,
|
||||||
get_additional_component_table, bom_list, generate_bom, \
|
html_colorbar,
|
||||||
HEADER_PN, HEADER_MPN, HEADER_SPN
|
html_image,
|
||||||
|
html_line_breaks,
|
||||||
|
nested_html_table,
|
||||||
|
remove_links,
|
||||||
|
)
|
||||||
|
from wireviz.wv_helper import (
|
||||||
|
awg_equiv,
|
||||||
|
flatten2d,
|
||||||
|
is_arrow,
|
||||||
|
mm2_equiv,
|
||||||
|
open_file_read,
|
||||||
|
open_file_write,
|
||||||
|
tuplelist2tsv,
|
||||||
|
)
|
||||||
from wireviz.wv_html import generate_html_output
|
from wireviz.wv_html import generate_html_output
|
||||||
from wireviz.wv_helper import awg_equiv, mm2_equiv, tuplelist2tsv, flatten2d, \
|
|
||||||
open_file_read, open_file_write, is_arrow
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class Harness:
|
class Harness:
|
||||||
|
|||||||
@ -3,15 +3,15 @@
|
|||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
from pathlib import Path
|
|
||||||
import sys
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
script_path = Path(__file__).absolute()
|
script_path = Path(__file__).absolute()
|
||||||
|
|
||||||
sys.path.insert(0, str(script_path.parent.parent)) # to find wireviz module
|
sys.path.insert(0, str(script_path.parent.parent)) # to find wireviz module
|
||||||
from wireviz import wireviz, __version__, APP_NAME
|
from wv_helper import open_file_append, open_file_read, open_file_write
|
||||||
from wv_helper import open_file_write, open_file_read, open_file_append
|
|
||||||
|
|
||||||
|
from wireviz import APP_NAME, __version__, wireviz
|
||||||
|
|
||||||
dir = script_path.parent.parent.parent
|
dir = script_path.parent.parent.parent
|
||||||
readme = 'readme.md'
|
readme = 'readme.md'
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from pathlib import Path
|
|
||||||
import sys
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
from typing import Any, Dict, List, Tuple
|
from typing import Any, Dict, List, Tuple
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
@ -12,7 +12,13 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
from wireviz.DataClasses import Metadata, Options, Tweak
|
from wireviz.DataClasses import Metadata, Options, Tweak
|
||||||
from wireviz.Harness import Harness
|
from wireviz.Harness import Harness
|
||||||
from wireviz.wv_helper import expand, get_single_key_and_value, is_arrow, open_file_read, smart_file_resolve
|
from wireviz.wv_helper import (
|
||||||
|
expand,
|
||||||
|
get_single_key_and_value,
|
||||||
|
is_arrow,
|
||||||
|
open_file_read,
|
||||||
|
smart_file_resolve,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def parse_text(yaml_str: str, file_out: (str, Path) = None, output_formats: (None, str, Tuple[str]) = ('html','png','svg','tsv'), return_types: (None, str, Tuple[str]) = None, image_paths: List = []) -> Any:
|
def parse_text(yaml_str: str, file_out: (str, Path) = None, output_formats: (None, str, Tuple[str]) = ('html','png','svg','tsv'), return_types: (None, str, Tuple[str]) = None, image_paths: List = []) -> Any:
|
||||||
|
|||||||
@ -1,16 +1,16 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from pathlib import Path
|
|
||||||
import sys
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
import click
|
import click
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
|
||||||
|
|
||||||
from wireviz import APP_NAME, __version__
|
|
||||||
import wireviz.wireviz as wv
|
import wireviz.wireviz as wv
|
||||||
|
from wireviz import APP_NAME, __version__
|
||||||
from wireviz.wv_helper import open_file_read
|
from wireviz.wv_helper import open_file_read
|
||||||
|
|
||||||
format_codes = {'c': 'csv', 'g': 'gv', 'h': 'html', 'p': 'png', 'P': 'pdf', 's': 'svg', 't': 'tsv'}
|
format_codes = {'c': 'csv', 'g': 'gv', 'h': 'html', 'p': 'png', 'P': 'pdf', 's': 'svg', 't': 'tsv'}
|
||||||
|
|||||||
@ -1,12 +1,13 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from typing import List, Optional, Union
|
|
||||||
import re
|
import re
|
||||||
|
from typing import List, Optional, Union
|
||||||
|
|
||||||
from wireviz.DataClasses import Color
|
from wireviz.DataClasses import Color
|
||||||
from wireviz.wv_colors import translate_color
|
from wireviz.wv_colors import translate_color
|
||||||
from wireviz.wv_helper import remove_links
|
from wireviz.wv_helper import remove_links
|
||||||
|
|
||||||
|
|
||||||
def nested_html_table(rows: List[Union[str, List[Optional[str]], None]], table_attrs: str = '') -> str:
|
def nested_html_table(rows: List[Union[str, List[Optional[str]], None]], table_attrs: str = '') -> str:
|
||||||
# input: list, each item may be scalar or list
|
# input: list, each item may be scalar or list
|
||||||
# output: a parent table with one child table per parent item that is list, and one cell per parent item that is scalar
|
# output: a parent table with one child table per parent item that is list, and one cell per parent item that is scalar
|
||||||
@ -73,6 +74,7 @@ def html_caption(image):
|
|||||||
|
|
||||||
def html_size_attr(image):
|
def html_size_attr(image):
|
||||||
from wireviz.DataClasses import Image
|
from wireviz.DataClasses import Image
|
||||||
|
|
||||||
# Return Graphviz HTML attributes to specify minimum or fixed size of a TABLE or TD object
|
# Return Graphviz HTML attributes to specify minimum or fixed size of a TABLE or TD object
|
||||||
return ((f' width="{image.width}"' if image.width else '')
|
return ((f' width="{image.width}"' if image.width else '')
|
||||||
+ (f' height="{image.height}"' if image.height else '')
|
+ (f' height="{image.height}"' if image.height else '')
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from typing import Dict, List
|
|
||||||
from pathlib import Path
|
|
||||||
import re
|
import re
|
||||||
|
from pathlib import Path
|
||||||
|
from typing import Dict, List
|
||||||
|
|
||||||
awg_equiv_table = {
|
awg_equiv_table = {
|
||||||
'0.09': '28',
|
'0.09': '28',
|
||||||
|
|||||||
@ -1,13 +1,19 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import re
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Dict, List, Union
|
from typing import Dict, List, Union
|
||||||
import re
|
|
||||||
|
|
||||||
from wireviz import __version__, APP_NAME, APP_URL, wv_colors
|
from wireviz import APP_NAME, APP_URL, __version__, wv_colors
|
||||||
from wireviz.DataClasses import Metadata, Options
|
from wireviz.DataClasses import Metadata, Options
|
||||||
from wireviz.wv_helper import flatten2d, open_file_read, open_file_write, smart_file_resolve
|
|
||||||
from wireviz.wv_gv_html import html_line_breaks
|
from wireviz.wv_gv_html import html_line_breaks
|
||||||
|
from wireviz.wv_helper import (
|
||||||
|
flatten2d,
|
||||||
|
open_file_read,
|
||||||
|
open_file_write,
|
||||||
|
smart_file_resolve,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def generate_html_output(filename: Union[str, Path], bom_list: List[List[str]], metadata: Metadata, options: Options):
|
def generate_html_output(filename: Union[str, Path], bom_list: List[List[str]], metadata: Metadata, options: Options):
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user