-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fd1f6dc
commit e5dc664
Showing
5 changed files
with
104 additions
and
162 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
src/codemodder/project_analysis/file_parsers/setup_py_file_parser.py
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,7 +0,0 @@ | ||
import libcst as cst | ||
|
||
|
||
def clean_simplestring(node: cst.SimpleString | str) -> str: | ||
if isinstance(node, str): | ||
return node.strip('"') | ||
return node.raw_value | ||
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import libcst as cst | ||
|
||
|
||
def clean_simplestring(node: cst.SimpleString | str) -> str: | ||
if isinstance(node, str): | ||
return node.strip('"') | ||
return node.raw_value | ||
|
||
|
||
def true_value(node: cst.Name | cst.SimpleString) -> str | int | bool: | ||
match node: | ||
case cst.SimpleString(): | ||
return clean_simplestring(node) | ||
case cst.Name(): | ||
val = node.value | ||
if val.lower() == "true": | ||
return True | ||
elif val.lower() == "false": | ||
return False | ||
return val | ||
return "" |
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
Oops, something went wrong.