def __call__(self, item): LOG.debug("Applying all subfilters. Item = %s" % item) v = item for R in self._sub_filters: LOG.debug("** Applying subfilter %s to %s" % (R, v)) v = R(v) LOG.debug("** Result after filtering = %s\n" % v) LOG.debug("Finished applying all subfilters. Item = %s" % item) return v
def _filter(self, item): import inspect T = type(item) if inspect.isclass(T): for M in inspect.getmro(T): N = '__filter_{}__'.format(M.__name__) if hasattr(self, N): LOG.debug("Applying method %s of %s to %s" %(N,self,item)) return getattr(self, N)(item) return self.__filter_default__(item) else: N = '__filter_{}'.format(T.__name__) if hasattr(self, N): expr = 'self.{}(item)'.format(N) LOG.debug('Executing {}'.format(expr)) return eval(expr) else: return self.__filter_default__(item)
def __call__(self, item): LOG.debug("Applying all subfilters. Item = %s" % item) v = item k = self._filter_status.keys() for R in self._sub_filters: if R.name not in k or self._filter_status[R.name]: LOG.debug("** Applying subfilter %s to %s" % (R, v)) v = R(v) LOG.debug("** Result after filtering = %s\n" % v) LOG.debug("Finished applying all subfilters. Item = %s" % item) return v
def gdsii_output(self, file_name=None, unit=RDD.GDSII.UNIT, grid=RDD.GDSII.GRID, layer_map=None): library = Library(name=self.name, unit=unit, grid=grid) D = deepcopy(self) F = RDD.FILTERS.OUTPUT.PORTS library += F(D) if layer_map is None: layer_map = RDD.GDSII.EXPORT_LAYER_MAP output = OutputGdsii(file_name=file_name, layer_map=layer_map) output.write(library) LOG.debug("Finished writing structure to GDS2.")
def filter_default(self, item): if hasattr(item, 'is_empty'): if item.is_empty(): LOG.debug('Emptyfilter is filtering out : {}'.format(item)) return [] return [item]
def filter___LayerElement__(self, item): if item.layer in self.purposes: return [item] else: LOG.debug("LayerFilterAllow is filtering out item %s" % item) return []
def filter___LayerElement__(self, item): if item.layer in self.layers: LOG.debug("LayerFilterDelete is filtering out item %s" % item) return [] else: return [item]