Skip to content

Commit

Permalink
Remove wildcard imports
Browse files Browse the repository at this point in the history
Use explicit imports rather than wildcards. This is more maintainable.
  • Loading branch information
Timmmm committed Nov 4, 2024
1 parent 8c459ce commit dbfff96
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 15 deletions.
3 changes: 2 additions & 1 deletion c_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
import os
import pprint

from shared_utils import *
from constants import causes, csrs, csrs32
from shared_utils import InstrDict, arg_lut

pp = pprint.PrettyPrinter(indent=2)
logging.basicConfig(level=logging.INFO, format="%(levelname)s:: %(message)s")
Expand Down
6 changes: 2 additions & 4 deletions chisel_utils.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import logging
import pprint

from constants import *

# from shared_utils import overlaps, overlap_allowed, extension_overlap_allowed, instruction_overlap_allowed, process_enc_line, same_base_isa, add_segmented_vls_insn, expand_nf_field
from shared_utils import *
from constants import causes, csrs, csrs32
from shared_utils import InstrDict, instr_dict_2_extensions

pp = pprint.PrettyPrinter(indent=2)
logging.basicConfig(level=logging.INFO, format="%(levelname)s:: %(message)s")
Expand Down
2 changes: 1 addition & 1 deletion go_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import pprint
import sys

from shared_utils import *
from shared_utils import InstrDict, signed

pp = pprint.PrettyPrinter(indent=2)
logging.basicConfig(level=logging.INFO, format="%(levelname)s:: %(message)s")
Expand Down
4 changes: 2 additions & 2 deletions latex_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import pprint
from typing import TextIO

from constants import *
from shared_utils import *
from constants import latex_fixed_fields, latex_inst_type, latex_mapping
from shared_utils import InstrDict, arg_lut, create_inst_dict

pp = pprint.PrettyPrinter(indent=2)
logging.basicConfig(level=logging.INFO, format="%(levelname)s:: %(message)s")
Expand Down
6 changes: 2 additions & 4 deletions rust_utils.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import logging
import pprint

from constants import *

# from shared_utils import overlaps, overlap_allowed, extension_overlap_allowed, instruction_overlap_allowed, process_enc_line, same_base_isa, add_segmented_vls_insn, expand_nf_field
from shared_utils import *
from constants import causes, csrs, csrs32
from shared_utils import InstrDict

pp = pprint.PrettyPrinter(indent=2)
logging.basicConfig(level=logging.INFO, format="%(levelname)s:: %(message)s")
Expand Down
10 changes: 9 additions & 1 deletion shared_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@
from itertools import chain
from typing import Dict, TypedDict

from constants import *
from constants import (
arg_lut,
fixed_ranges,
imported_regex,
overlapping_extensions,
overlapping_instructions,
pseudo_regex,
single_fixed,
)

LOG_FORMAT = "%(levelname)s:: %(message)s"
LOG_LEVEL = logging.INFO
Expand Down
3 changes: 2 additions & 1 deletion sverilog_utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import logging
import pprint

from shared_utils import *
from constants import csrs, csrs32
from shared_utils import InstrDict

pp = pprint.PrettyPrinter(indent=2)
logging.basicConfig(level=logging.INFO, format="%(levelname)s:: %(message)s")
Expand Down
20 changes: 19 additions & 1 deletion test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,25 @@
import unittest
from unittest.mock import Mock, patch

from shared_utils import *
from shared_utils import (
InstrDict,
check_arg_lut,
check_overlapping_bits,
extract_isa_type,
find_extension_file,
handle_arg_lut_mapping,
initialize_encoding,
is_rv_variant,
overlaps,
pad_to_equal_length,
parse_instruction_line,
process_enc_line,
process_fixed_ranges,
process_standard_instructions,
same_base_isa,
update_encoding_for_fixed_range,
validate_bit_range,
)


class EncodingUtilsTest(unittest.TestCase):
Expand Down

0 comments on commit dbfff96

Please sign in to comment.