Пример #1
0
    def __init__(self, properties_dict={}, **kwargs):
        # TODO replace properties_dict with **kwargs ? Then the initialization in all classes are unified
        properties = Track.DEFAULT_PROPERTIES.copy()
        properties.update(properties_dict)
        properties.update(kwargs)
        self.properties = format_properties(properties)

        name = self.properties.get('name')
        if name:
            assert isinstance(name, str), "Track name must be a `str`."
        else:
            name = self.__class__.__name__ + ".{}".format(
                self.__class__.counts)
        Track.tracks[name] = self
        self.properties['name'] = name
        self.name = name

        # disable call mixin class
        # super().__init__()
        self.coverages = []

        # load features from global feature stack
        features_stack = get_feature_stack()
        for features in features_stack:
            self.properties.update(features.properties)

        # load coverages from global coverages stack
        coverage_stack = get_coverage_stack()
        for coverage in coverage_stack:
            self.coverages.append(coverage)

        self.ax = None
Пример #2
0
    def __init__(self, properties_dict):
        self.properties = format_properties(properties_dict)
        name = self.properties.get("name")
        if name is not None:
            assert isinstance(name, str), "Coverage name must be a `str`."
        else:
            name = self.__class__.__name__ + ".{}".format(
                self.__class__._counts)
        self.properties['name'] = name

        stack = get_feature_stack()
        for feature in stack:
            self.properties[feature.key] = feature.value

        self.track = None
Пример #3
0
    def __init__(self, properties_dict):
        self.properties = properties_dict
        self.__bool2str()
        name = self.properties.get('name')
        if name is not None:
            assert isinstance(name, str), "Track name must be a `str`."
        else:
            name = self.__class__.__name__ + ".{}".format(
                self.__class__._counts)
        self.properties['name'] = name
        super().__init__()
        self.coverages = []

        # load features from global feature stack
        features_stack = get_feature_stack()
        for features in features_stack:
            self.properties[features.key] = features.value

        # load coverages from global coverages stack
        coverage_stack = get_coverage_stack()
        for coverage in coverage_stack:
            self.coverages.append(coverage)
Пример #4
0
 def __exit__(self, type, value, traceback):
     stack = get_feature_stack()
     stack.pop()
Пример #5
0
 def __enter__(self):
     stack = get_feature_stack()
     stack.append(self)
     return self