"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tools/sapp/sapp/query_builder.py" between
pyre-check-0.0.53.tar.gz and pyre-check-0.0.54.tar.gz

About: Pyre is a performant type checker for Python (ships with Pysa, a security focused static analysis tool).

query_builder.py  (pyre-check-0.0.53):query_builder.py  (pyre-check-0.0.54)
skipping to change at line 59 skipping to change at line 59
def session(self): def session(self):
if self._session is None: if self._session is None:
raise Exception("No current session found for query!") raise Exception("No current session found for query!")
return self._session return self._session
def with_session(self, session): def with_session(self, session):
self._session = session self._session = session
return self return self
def get(self) -> List: def get(self) -> List:
# pyre-fixme[6]: Expected `Session` for 1st param but got `None`.
query = self.get_session_query(self._session) query = self.get_session_query(self._session)
for filter_type, filter_conditions in self.issue_filters.items(): for filter_type, filter_conditions in self.issue_filters.items():
if filter_type == Filter.codes: if filter_type == Filter.codes:
column = Issue.code column = Issue.code
elif filter_type == Filter.callables: elif filter_type == Filter.callables:
column = CallableText.contents column = CallableText.contents
elif filter_type == Filter.file_names: elif filter_type == Filter.file_names:
column = FilenameText.contents column = FilenameText.contents
elif filter_type == Filter.trace_length_to_sources: elif filter_type == Filter.trace_length_to_sources:
column = IssueInstance.min_trace_length_to_sources column = IssueInstance.min_trace_length_to_sources
skipping to change at line 110 skipping to change at line 111
any_feature_set |= set(filter_condition) any_feature_set |= set(filter_condition)
elif filter_type == Filter.all_features: elif filter_type == Filter.all_features:
all_feature_set |= set(filter_condition) all_feature_set |= set(filter_condition)
elif filter_type == Filter.exclude_features: elif filter_type == Filter.exclude_features:
exclude_feature_set |= set(filter_condition) exclude_feature_set |= set(filter_condition)
else: else:
raise Exception(f"Invalid filter type provided: {filter_type}") raise Exception(f"Invalid filter type provided: {filter_type}")
features_list = [ features_list = [
self.get_leaves_issue_instance( self.get_leaves_issue_instance(
self._session, int(issue.id), SharedTextKind.FEATURE # pyre-fixme[6]: Expected `Session` for 1st param but got `N
one`.
self._session,
int(issue.id),
SharedTextKind.FEATURE,
) )
for issue in issues for issue in issues
] ]
for issue, features in zip(issues.copy(), features_list): for issue, features in zip(issues.copy(), features_list):
if any_feature_set and not (features & any_feature_set): if any_feature_set and not (features & any_feature_set):
issues.remove(issue) issues.remove(issue)
elif all_feature_set and not ( elif all_feature_set and not (
features & all_feature_set == all_feature_set features & all_feature_set == all_feature_set
): ):
issues.remove(issue) issues.remove(issue)
skipping to change at line 164 skipping to change at line 168
self.breadcrumb_filters[Filter.all_features] += features self.breadcrumb_filters[Filter.all_features] += features
return self return self
def where_exclude_features(self, features: List[str]) -> "IssueQueryBuilder" : def where_exclude_features(self, features: List[str]) -> "IssueQueryBuilder" :
self.breadcrumb_filters[Filter.exclude_features] += features self.breadcrumb_filters[Filter.exclude_features] += features
return self return self
def sources(self, issues) -> List[Set[str]]: def sources(self, issues) -> List[Set[str]]:
return [ return [
self.get_leaves_issue_instance( self.get_leaves_issue_instance(
self._session, int(issue.id), SharedTextKind.SINK # pyre-fixme[6]: Expected `Session` for 1st param but got `None`
.
self._session,
int(issue.id),
SharedTextKind.SINK,
) )
for issue in issues for issue in issues
] ]
def sinks(self, issues) -> List[Set[str]]: def sinks(self, issues) -> List[Set[str]]:
return [ return [
self.get_leaves_issue_instance( self.get_leaves_issue_instance(
self._session, int(issue.id), SharedTextKind.SOURCE # pyre-fixme[6]: Expected `Session` for 1st param but got `None`
.
self._session,
int(issue.id),
SharedTextKind.SOURCE,
) )
for issue in issues for issue in issues
] ]
def features(self, issues) -> List[Set[str]]: def features(self, issues) -> List[Set[str]]:
return [ return [
self.get_leaves_issue_instance( self.get_leaves_issue_instance(
self._session, int(issue.id), SharedTextKind.FEATURE # pyre-fixme[6]: Expected `Session` for 1st param but got `None`
.
self._session,
int(issue.id),
SharedTextKind.FEATURE,
) )
for issue in issues for issue in issues
] ]
def get_session_query(self, session: Session) -> Query: def get_session_query(self, session: Session) -> Query:
return ( return (
session.query( session.query(
IssueInstance.id, IssueInstance.id,
FilenameText.contents.label("filename"), FilenameText.contents.label("filename"),
IssueInstance.location, IssueInstance.location,
 End of changes. 5 change blocks. 
4 lines changed or deleted 21 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)