Skip to content

Commit

Permalink
review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
clavedeluna committed Oct 25, 2023
1 parent e9cc4d7 commit 66f3c48
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/codemodder/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class CodemodExecutionContext: # pylint: disable=too-many-instance-attributes
dry_run: bool = False
verbose: bool = False
registry: CodemodRegistry
repo_manager: PythonRepoManager

def __init__(
self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class SetupCfgParser(BaseParser):
def file_name(self):
return "setup.cfg"

def _parse_dependencies_from_toml(self, config: configparser.ConfigParser):
def _parse_dependencies_from_cfg(self, config: configparser.ConfigParser):
# todo: handle cases for
# 1. no dependencies, no options dict
# setup_requires, tests_require, extras_require
Expand All @@ -32,6 +32,6 @@ def _parse_file(self, file: Path):
return PackageStore(
type=self.file_name,
file=str(file),
dependencies=self._parse_dependencies_from_toml(config),
dependencies=self._parse_dependencies_from_cfg(config),
py_versions=self._parse_py_versions(config),
)
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def _parse_py_versions(self, version_str):
return [clean_simplestring(version_str)]

def _parse_file(self, file: Path):
visitor = SetupCallVisotor()
visitor = SetupCallVisitor()
with open(str(file), "r", encoding="utf-8") as f:
# todo: handle failure in parsing
module = cst.parse_module(f.read())
Expand All @@ -47,7 +47,7 @@ def _parse_file(self, file: Path):
)


class SetupCallVisotor(cst.CSTVisitor):
class SetupCallVisitor(cst.CSTVisitor):
def __init__(self):
self.python_requires = None
self.install_requires = None
Expand Down
2 changes: 1 addition & 1 deletion src/codemodder/project_analysis/file_parsers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
def clean_simplestring(node: cst.SimpleString | str) -> str:
if isinstance(node, str):
return node.strip('"')
return node.value.strip('"')
return node.raw_value

0 comments on commit 66f3c48

Please sign in to comment.