forked from MiguelMarcelino/py2many
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check for module presence of least used external modules
- Loading branch information
1 parent
ac11b64
commit a8df62e
Showing
9 changed files
with
158 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,22 @@ | ||
|
||
import ast | ||
import tqdm | ||
from typing import Callable, Dict, Tuple, Union | ||
try: | ||
import tqdm | ||
except ImportError: | ||
tqdm = None | ||
|
||
class JuliaExternalModulePlugins(): | ||
def visit_tqdm(self, node: ast.Call, vargs: list[str], kwargs: list[tuple[str,str]]): | ||
self._usings.add("ProgressBars") | ||
# Using tqdm alias (Identical to using ProgressBar) | ||
return f"tqdm({', '.join(vargs)})" | ||
|
||
if tqdm: | ||
FuncType = Union[Callable, str] | ||
|
||
FuncType = Union[Callable, str] | ||
|
||
FUNC_DISPATCH_TABLE: Dict[FuncType, Tuple[Callable, bool]] = { | ||
tqdm.tqdm: (JuliaExternalModulePlugins.visit_tqdm, True), | ||
} | ||
FUNC_DISPATCH_TABLE: Dict[FuncType, Tuple[Callable, bool]] = { | ||
tqdm.tqdm: (JuliaExternalModulePlugins.visit_tqdm, True), | ||
} | ||
|
||
IGNORED_MODULE_SET = set(["tqdm"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
import ast | ||
import zipfile | ||
|
||
from typing import Callable, Dict, Tuple, Union | ||
try: | ||
import zipfile | ||
except ImportError: | ||
zipfile = None | ||
|
||
class JuliaExternalModulePlugins: | ||
def visit_zipfile(t_self, node: ast.Call, vargs: list[str]): | ||
t_self._usings.add("ZipFile") | ||
return f"ZipFile.Reader({vargs[0]})" | ||
|
||
FuncType = Union[Callable, str] | ||
if zipfile: | ||
FuncType = Union[Callable, str] | ||
|
||
FUNC_DISPATCH_TABLE: Dict[FuncType, Tuple[Callable, bool]] = { | ||
zipfile.ZipFile: (JuliaExternalModulePlugins.visit_zipfile, False), | ||
} | ||
FUNC_DISPATCH_TABLE: Dict[FuncType, Tuple[Callable, bool]] = { | ||
zipfile.ZipFile: (JuliaExternalModulePlugins.visit_zipfile, False), | ||
} |