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
Showing
5 changed files
with
95 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Sooo... If you want to git checkout different branches, you need to update the git repo to fetch ALL sources | ||
git config --local --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* |
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,49 @@ | ||
import logging | ||
logger = logging.getLogger("Factory") | ||
|
||
import ast | ||
import enforce | ||
|
||
from .pyPath import Path | ||
from .pyPathGroup import PathGroup | ||
|
||
@enforce.runtime_validation | ||
class Factory: | ||
|
||
def __init__(self, project): | ||
self._project = project | ||
|
||
def path(self) -> Path: | ||
"""pySym.pyPath.Path: Path object for this project.""" | ||
|
||
# Read in the file | ||
with open(self._project.file_name, "r") as f: | ||
source = f.read() | ||
|
||
# Parse it | ||
body = ast.parse(source).body | ||
|
||
# Return the new path | ||
return Path(body,source=source) | ||
|
||
def path_group(self) -> PathGroup: | ||
"""pySym.pyPathGroup.PathGroup: Basic PathGroup object for this project.""" | ||
return PathGroup(self.path) | ||
|
||
############## | ||
# Properties # | ||
############## | ||
|
||
@property | ||
def _project(self): | ||
"""pySym.Project.Project: Associated Project object.""" | ||
return self.__project | ||
|
||
@_project.setter | ||
def _project(self, project) -> None: | ||
if type(project) is not Project: | ||
raise Exception("Invalid type for project ({0}) should be type Project".format(type(project))) | ||
|
||
self.__project = project | ||
|
||
from .Project import Project |
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,41 @@ | ||
import logging | ||
logger = logging.getLogger("Project") | ||
|
||
import enforce | ||
import os | ||
|
||
#@enforce.runtime_validation | ||
class Project: | ||
|
||
def __init__(self, file): | ||
self.file_name = file | ||
self.factory = Factory(self) | ||
|
||
############## | ||
# Properties # | ||
############## | ||
|
||
@property | ||
def factory(self): | ||
return self.__factory | ||
|
||
@factory.setter | ||
def factory(self, factory) -> None: | ||
self.__factory = factory | ||
|
||
@property | ||
def file_name(self) -> str: | ||
"""str: Name of the file that's being symbolically executed.""" | ||
return self.__file_name | ||
|
||
@file_name.setter | ||
def file_name(self, file_name: str) -> None: | ||
file_name = os.path.abspath(file_name) | ||
|
||
# Make sure this is a real file. | ||
if not os.path.isfile(file_name): | ||
raise Exception("Not a valid file: {file_name:s}".format(file_name=file_name)) | ||
|
||
self.__file_name = file_name | ||
|
||
from .Factory import Factory |
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,5 +1,7 @@ | ||
#!/usr/bin/env python3 | ||
|
||
from .Project import Project | ||
|
||
""" | ||
import ast | ||
import argparse | ||
|
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