Skip to content

Commit 43d8e35

Browse files
committed
Rename json_path to reflect actual path contents #143
1 parent e9d87e0 commit 43d8e35

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/sasctl/pzmm/write_json_files.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -960,7 +960,7 @@ def convertDataRole(self, dataRole):
960960
return conversion
961961

962962
@classmethod
963-
def create_requirements_json(cls, json_path=Path.cwd()):
963+
def create_requirements_json(cls, model_path=Path.cwd()):
964964
"""
965965
Searches the model directory for Python scripts and pickle files and determines their Python package
966966
dependencies.
@@ -980,7 +980,7 @@ def create_requirements_json(cls, json_path=Path.cwd()):
980980
981981
Parameters
982982
----------
983-
json_path : str, optional
983+
model_path : str, optional
984984
The path to a Python project, by default the current working directory.
985985
986986
Returns
@@ -995,11 +995,11 @@ def create_requirements_json(cls, json_path=Path.cwd()):
995995
"""
996996

997997
pickle_packages = []
998-
pickle_files = cls.get_pickle_file(json_path)
998+
pickle_files = cls.get_pickle_file(model_path)
999999
for pickle_file in pickle_files:
10001000
pickle_packages.append(cls.get_pickle_dependencies(pickle_file))
10011001

1002-
code_dependencies = cls.get_code_dependencies(json_path)
1002+
code_dependencies = cls.get_code_dependencies(model_path)
10031003

10041004
package_list = list(pickle_packages) + code_dependencies
10051005
package_list = list(set(list(flatten(package_list))))
@@ -1027,7 +1027,7 @@ def create_requirements_json(cls, json_path=Path.cwd()):
10271027
"command": f"pip install {package}=={version}",
10281028
}
10291029
)
1030-
with open(Path(json_path) / "requirements.json", "w") as file:
1030+
with open(Path(model_path) / "requirements.json", "w") as file:
10311031
file.write(json.dumps(json_dicts, indent=4))
10321032

10331033
return json_dicts
@@ -1086,15 +1086,15 @@ def package_not_found_output(package_name, package_versions):
10861086
return package_and_version
10871087

10881088
@classmethod
1089-
def get_code_dependencies(cls, json_path=Path.cwd()):
1089+
def get_code_dependencies(cls, model_path=Path.cwd()):
10901090
"""
10911091
Get the package dependencies for all Python scripts in the provided directory path.
10921092
10931093
Note that currently this functionality only works for .py files.
10941094
10951095
Parameters
10961096
----------
1097-
json_path : string, optional
1097+
model_path : string, optional
10981098
File location for the output JSON file. Default is the current working directory.
10991099
11001100
Returns
@@ -1103,7 +1103,7 @@ def get_code_dependencies(cls, json_path=Path.cwd()):
11031103
List of found package dependencies.
11041104
"""
11051105
file_names = []
1106-
file_names.extend(sorted(Path(json_path).glob("*.py")))
1106+
file_names.extend(sorted(Path(model_path).glob("*.py")))
11071107

11081108
import_info = []
11091109
for file in file_names:

0 commit comments

Comments
 (0)