Skip to content

Commit

Permalink
[cdd/compound/exmod_utils.py] Remove old version of `emit_files_from_…
Browse files Browse the repository at this point in the history
…module_and_return_imports`
  • Loading branch information
SamuelMarks committed Oct 9, 2023
1 parent 8d14b6b commit 38859bf
Showing 1 changed file with 0 additions and 93 deletions.
93 changes: 0 additions & 93 deletions cdd/compound/exmod_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,99 +629,6 @@ def emit_files_from_module_and_return_imports(
)


def emit_files_from_module_and_return_imports2(
module_name,
module_root_dir,
new_module_name,
emit_name,
module,
output_directory,
mock_imports,
no_word_wrap,
dry_run,
filesystem_layout,
):
"""
Emit type `emit_name` of all files in `module_root_dir` into `output_directory`
on `new_module_name` hierarchy. Then return the new imports.
:param module_name: Name of existing module
:type module_name: ```str```
:param module_root_dir: Root dir of existing module
:type module_root_dir: ```str```
:param new_module_name: New module name
:type new_module_name: ```str```
:param emit_name: What type(s) to generate.
:type emit_name: ```List[Literal["argparse", "class", "function", "json_schema",
"pydantic", "sqlalchemy", "sqlalchemy_table", "sqlalchemy_hybrid"]]```
:param module: Module itself
:type module: ```Module```
:param output_directory: Where to place the generated exposed interfaces to the given `--module`.
:type output_directory: ```str```
:param mock_imports: Whether to generate mock TensorFlow imports
:type mock_imports: ```bool```
:param no_word_wrap: Whether word-wrap is disabled (on emission).
:type no_word_wrap: ```Optional[Literal[True]]```
:param dry_run: Show what would be created; don't actually write to the filesystem
:type dry_run: ```bool```
:param filesystem_layout: Hierarchy of folder and file names generated. "java" is file per package per name.
:type filesystem_layout: ```Literal["java", "as_input"]```
:return: List of `ImportFrom` refering to generated module
:rtype: ```List[ImportFrom]```
"""
_emit_file_on_hierarchy = partial(
emit_file_on_hierarchy,
emit_name=emit_name,
module_name=module_name,
new_module_name=new_module_name,
mock_imports=mock_imports,
filesystem_layout=filesystem_layout,
output_directory=output_directory,
no_word_wrap=no_word_wrap,
dry_run=dry_run,
)
# Might need some `groupby` in case multiple files are in the one project; same for `get_module_contents`
return list(
map(
_emit_file_on_hierarchy,
map(
lambda name_source: (
name_source[0],
(
lambda filename: filename[len(module_name) + 1 :]
if filename.startswith(module_name)
else filename
)(relative_filename(getfile(name_source[1]))),
{"params": OrderedDict(), "returns": OrderedDict()}
if dry_run
else cdd.class_.parse.class_(
name_source[1], merge_inner_function="__init__"
),
),
map(
lambda name_source: (
name_source[0][len(module_name) + 1 :],
name_source[1],
),
get_module_contents(
module, module_root_dir=module_root_dir
).items(),
),
),
),
)


__all__ = [
"get_module_contents",
"emit_file_on_hierarchy",
Expand Down

0 comments on commit 38859bf

Please sign in to comment.