coercer.core.Filter

 1#!/usr/bin/env python3
 2# -*- coding: utf-8 -*-
 3# File name          : Filter.py
 4# Author             : Podalirius (@podalirius_)
 5# Date created       : 15 Sep 2022
 6
 7class Filter(object):
 8    """
 9    Documentation for class Filter
10    """
11
12    def __init__(self, filter_method_name=None, filter_protocol_name=None, filter_pipe_name=None):
13        super(Filter, self).__init__()
14        self.filter_method_name = filter_method_name
15        self.filter_protocol_name = filter_protocol_name
16        self.filter_pipe_name = filter_pipe_name
17
18    def method_matches_filter(self, instance):
19        """
20        Function method_matches_filter
21
22        Parameters:
23            ?:instance
24
25        Return:
26            bool:outcome
27        """
28        outcome = True
29        #
30        if self.filter_method_name is not None:
31            if self.filter_method_name in instance.function["name"]:
32                outcome = outcome and True
33            else:
34                outcome = outcome and False
35        #
36        if self.filter_protocol_name is not None:
37            if (self.filter_protocol_name in instance.protocol["shortname"]) or (self.filter_protocol_name in instance.protocol["longname"]):
38                outcome = outcome and True
39            else:
40                outcome = outcome and False
41        return outcome
42
43    def pipe_matches_filter(self, pipe_name):
44        """
45        Function pipe_matches_filter
46
47        Parameters:
48            ?:pipe_name
49
50        Return:
51            bool:outcome
52        """
53        outcome = True
54        #
55        if self.filter_pipe_name is not None:
56            if self.filter_pipe_name in pipe_name:
57                outcome = outcome and True
58            else:
59                outcome = outcome and False
60        return outcome
class Filter:
 8class Filter(object):
 9    """
10    Documentation for class Filter
11    """
12
13    def __init__(self, filter_method_name=None, filter_protocol_name=None, filter_pipe_name=None):
14        super(Filter, self).__init__()
15        self.filter_method_name = filter_method_name
16        self.filter_protocol_name = filter_protocol_name
17        self.filter_pipe_name = filter_pipe_name
18
19    def method_matches_filter(self, instance):
20        """
21        Function method_matches_filter
22
23        Parameters:
24            ?:instance
25
26        Return:
27            bool:outcome
28        """
29        outcome = True
30        #
31        if self.filter_method_name is not None:
32            if self.filter_method_name in instance.function["name"]:
33                outcome = outcome and True
34            else:
35                outcome = outcome and False
36        #
37        if self.filter_protocol_name is not None:
38            if (self.filter_protocol_name in instance.protocol["shortname"]) or (self.filter_protocol_name in instance.protocol["longname"]):
39                outcome = outcome and True
40            else:
41                outcome = outcome and False
42        return outcome
43
44    def pipe_matches_filter(self, pipe_name):
45        """
46        Function pipe_matches_filter
47
48        Parameters:
49            ?:pipe_name
50
51        Return:
52            bool:outcome
53        """
54        outcome = True
55        #
56        if self.filter_pipe_name is not None:
57            if self.filter_pipe_name in pipe_name:
58                outcome = outcome and True
59            else:
60                outcome = outcome and False
61        return outcome

Documentation for class Filter

Filter( filter_method_name=None, filter_protocol_name=None, filter_pipe_name=None)
13    def __init__(self, filter_method_name=None, filter_protocol_name=None, filter_pipe_name=None):
14        super(Filter, self).__init__()
15        self.filter_method_name = filter_method_name
16        self.filter_protocol_name = filter_protocol_name
17        self.filter_pipe_name = filter_pipe_name
def method_matches_filter(self, instance):
19    def method_matches_filter(self, instance):
20        """
21        Function method_matches_filter
22
23        Parameters:
24            ?:instance
25
26        Return:
27            bool:outcome
28        """
29        outcome = True
30        #
31        if self.filter_method_name is not None:
32            if self.filter_method_name in instance.function["name"]:
33                outcome = outcome and True
34            else:
35                outcome = outcome and False
36        #
37        if self.filter_protocol_name is not None:
38            if (self.filter_protocol_name in instance.protocol["shortname"]) or (self.filter_protocol_name in instance.protocol["longname"]):
39                outcome = outcome and True
40            else:
41                outcome = outcome and False
42        return outcome

Function method_matches_filter

Parameters: ?:instance

Return: bool:outcome

def pipe_matches_filter(self, pipe_name):
44    def pipe_matches_filter(self, pipe_name):
45        """
46        Function pipe_matches_filter
47
48        Parameters:
49            ?:pipe_name
50
51        Return:
52            bool:outcome
53        """
54        outcome = True
55        #
56        if self.filter_pipe_name is not None:
57            if self.filter_pipe_name in pipe_name:
58                outcome = outcome and True
59            else:
60                outcome = outcome and False
61        return outcome

Function pipe_matches_filter

Parameters: ?:pipe_name

Return: bool:outcome