Skip to content

Commit

Permalink
Convert relative package imports to absolute
Browse files Browse the repository at this point in the history
  • Loading branch information
ReeceStevens committed Sep 25, 2017
1 parent eb5ccac commit d26a169
Show file tree
Hide file tree
Showing 17 changed files with 34 additions and 31 deletions.
6 changes: 3 additions & 3 deletions dicom_standard/extract_attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
'''
import sys

from . import parse_lib as pl
from . import parse_relations as pr
from .table_utils import table_to_dict
from dicom_standard import parse_lib as pl
from dicom_standard import parse_relations as pr
from dicom_standard.table_utils import table_to_dict

COLUMN_TITLES = ['tag', 'name', 'keyword', 'valueRepresentation', 'valueMultiplicity', 'retired']
ATTR_TABLE_ID = 'table_6-1'
Expand Down
6 changes: 3 additions & 3 deletions dicom_standard/extract_ciod_module_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import sys
import re

from . import parse_lib as pl
from . import parse_relations as pr
from .table_utils import expand_spans, table_to_dict, stringify_table, tdiv_to_table_list
from dicom_standard import parse_lib as pl
from dicom_standard import parse_relations as pr
from dicom_standard.table_utils import expand_spans, table_to_dict, stringify_table, tdiv_to_table_list

CHAPTER_ID = 'chapter_A'
TABLE_SUFFIX = re.compile(".*IOD Modules$")
Expand Down
8 changes: 4 additions & 4 deletions dicom_standard/extract_macros.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

from bs4 import BeautifulSoup, Tag

from . import parse_lib as pl
from . import parse_relations as pr
from .table_utils import expand_spans, stringify_table, tdiv_to_table_list, TableListType
from .macro_utils import get_id_from_link, MetadataTableType
from dicom_standard import parse_lib as pl
from dicom_standard import parse_relations as pr
from dicom_standard.table_utils import expand_spans, stringify_table, tdiv_to_table_list, TableListType
from dicom_standard.macro_utils import get_id_from_link, MetadataTableType

# Macros and modules require the same metadata and formatting,
# so they can share these two functions.
Expand Down
6 changes: 3 additions & 3 deletions dicom_standard/extract_modules_with_attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import sys
import re

from . import parse_lib as pl
from . import parse_relations as pr
from table_utils import expand_spans, table_to_dict, stringify_table, tdiv_to_table_list
from dicom_standard import parse_lib as pl
from dicom_standard import parse_relations as pr
from dicom_standard.table_utils import expand_spans, table_to_dict, stringify_table, tdiv_to_table_list

CHAPTER_ID = 'chapter_C'
TABLE_SUFFIX = re.compile("(.*Module Attributes$)|(.*Module Table$)")
Expand Down
2 changes: 1 addition & 1 deletion dicom_standard/extract_sections.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import re
import os

from .parse_lib import parse_html_file, write_pretty_json
from dicom_standard.parse_lib import parse_html_file, write_pretty_json

REFERENCED_IDS_RE = re.compile(r'(sect.*)|(figure.*)|(biblio.*)|(table.*)|(note.*)')

Expand Down
2 changes: 1 addition & 1 deletion dicom_standard/hierarchy_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from bs4 import Tag

from . import parse_lib as pl
from dicom_standard import parse_lib as pl


def get_hierarchy_markers(name: str) -> str:
Expand Down
2 changes: 1 addition & 1 deletion dicom_standard/macro_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from bs4 import BeautifulSoup, Tag

from .hierarchy_utils import get_hierarchy_markers
from dicom_standard.hierarchy_utils import get_hierarchy_markers

MetadataTableType = Dict[str, Any]
MacrosType = Dict[str, MetadataTableType]
Expand Down
11 changes: 7 additions & 4 deletions dicom_standard/parse_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from bs4 import BeautifulSoup, NavigableString, Tag

from . import parse_relations as pr
from dicom_standard import parse_relations as pr

BASE_DICOM_URL = "http://dicom.nema.org/medical/dicom/current/output/html/"
BASE_SHORT_DICOM_SECTION_URL = "http://dicom.nema.org/medical/dicom/current/output/chtml/"
Expand Down Expand Up @@ -82,9 +82,12 @@ def clean_html(html: str) -> str:
'''
parsed_html = BeautifulSoup(html, 'html.parser')
top_level_tag = get_top_level_tag(parsed_html)
remove_attributes_from_html_tags(top_level_tag)
remove_empty_children(top_level_tag)
return resolve_relative_resource_urls(str(top_level_tag))
if isinstance(top_level_tag, NavigableString):
return str(top_level_tag)
else:
remove_attributes_from_html_tags(top_level_tag)
remove_empty_children(top_level_tag)
return resolve_relative_resource_urls(str(top_level_tag))


def get_top_level_tag(parsed_html: BeautifulSoup) -> Tag:
Expand Down
2 changes: 1 addition & 1 deletion dicom_standard/postprocess_mark_references.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from bs4 import BeautifulSoup

from . import parse_lib as pl
from dicom_standard import parse_lib as pl

IGNORED_REFS_RE = re.compile(r'(.*ftp.*)|(.*http.*)|(.*part05.*)|(.*chapter.*)|(.*PS3.*)|(.*DCM.*)|(.*glossentry.*)')

Expand Down
2 changes: 1 addition & 1 deletion dicom_standard/postprocess_save_references.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from bs4 import BeautifulSoup

from . import parse_lib as pl
from dicom_standard import parse_lib as pl


def find_reference_html_in_sections(pairs, section_listing):
Expand Down
2 changes: 1 addition & 1 deletion dicom_standard/postprocess_update_reference_links.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys

from . import parse_lib as pl
from dicom_standard import parse_lib as pl


def update_sourceurls(module_attr_pairs, references):
Expand Down
6 changes: 3 additions & 3 deletions dicom_standard/preprocess_modules_with_attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
'''
import sys

from . import parse_lib as pl
from .macro_utils import expand_macro_rows
from .hierarchy_utils import record_hierarchy_for_module
from dicom_standard import parse_lib as pl
from dicom_standard.macro_utils import expand_macro_rows
from dicom_standard.hierarchy_utils import record_hierarchy_for_module


def expand_all_macros(module_attr_tables, macros):
Expand Down
2 changes: 1 addition & 1 deletion dicom_standard/process_ciod_module_relationship.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
'''
import sys

from . import parse_lib as pl
from dicom_standard import parse_lib as pl


def define_all_relationships(ciod_module_list):
Expand Down
2 changes: 1 addition & 1 deletion dicom_standard/process_ciods.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
'''
import sys

from . import parse_lib as pl
from dicom_standard import parse_lib as pl


def ciods_from_extracted_list(ciod_module_list):
Expand Down
2 changes: 1 addition & 1 deletion dicom_standard/process_module_attribute_relationship.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys

from . import parse_lib as pl
from dicom_standard import parse_lib as pl


def module_attr_relationship_table(module_attr_relationship_list):
Expand Down
2 changes: 1 addition & 1 deletion dicom_standard/process_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
'''
import sys

from . import parse_lib as pl
from dicom_standard import parse_lib as pl


def modules_from_tables(tables):
Expand Down
2 changes: 1 addition & 1 deletion dicom_standard/table_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from copy import copy
from bs4 import Tag

from . import parse_relations as pr
from dicom_standard import parse_relations as pr

TableListType = List[List[Tag]]

Expand Down

0 comments on commit d26a169

Please sign in to comment.