From c791b2ee5ca201bd870f5a07c53121a9981473c1 Mon Sep 17 00:00:00 2001 From: Ta Quang Trung Date: Tue, 18 Apr 2023 15:53:13 +0800 Subject: [PATCH] restructure modules --- solc_detect/__init__.py | 8 ++++---- solc_detect/__main__.py | 8 +++----- solc_detect/{lib.py => solc_detect.py} | 2 +- 3 files changed, 8 insertions(+), 10 deletions(-) rename solc_detect/{lib.py => solc_detect.py} (98%) diff --git a/solc_detect/__init__.py b/solc_detect/__init__.py index 156fea7..4304369 100644 --- a/solc_detect/__init__.py +++ b/solc_detect/__init__.py @@ -1,18 +1,18 @@ #!/usr/bin/env python3 -from . import lib +from solc_detect import solc_detect def find_pragma_solc_version(input_file): """Find the Solidity version declared in pragma of a smart contract.""" - return lib.find_pragma_solc_version(input_file) + return solc_detect.find_pragma_solc_version(input_file) def find_best_solc_version(input_file): """Find the best version of Solc compiler for a smart contract.""" - return lib.find_best_solc_version(input_file) + return solc_detect.find_best_solc_version(input_file) def find_best_solc_version_for_pragma(pragma_version): """Find the best version of Solc compiler for pragma.""" - return lib.find_best_solc_version_for_pragma(pragma_version) + return solc_detect.find_best_solc_version_for_pragma(pragma_version) diff --git a/solc_detect/__main__.py b/solc_detect/__main__.py index c2956da..fd5da4e 100644 --- a/solc_detect/__main__.py +++ b/solc_detect/__main__.py @@ -10,9 +10,7 @@ import toml -import solc_detect - -from . import lib +from solc_detect import solc_detect def configure_cli_arguments(): @@ -75,11 +73,11 @@ def main(): arg_parser.print_usage() arg_parser.exit() - pragma_version = lib.find_pragma_solc_version(input_file) + pragma_version = solc_detect.find_pragma_solc_version(input_file) if args.verbose: print("Detected pragmas:", pragma_version) - best_version = lib.find_best_solc_version_for_pragma(pragma_version) + best_version = solc_detect.find_best_solc_version_for_pragma(pragma_version) if args.verbose: print("Best version:", best_version) else: diff --git a/solc_detect/lib.py b/solc_detect/solc_detect.py similarity index 98% rename from solc_detect/lib.py rename to solc_detect/solc_detect.py index e3953c7..eedfdba 100644 --- a/solc_detect/lib.py +++ b/solc_detect/solc_detect.py @@ -9,7 +9,7 @@ import nodesemver import semantic_version -from . import pragma_parser +from solc_detect import pragma_parser # from semantic_version import NpmSpec, Version