本文整理汇总了Python中Filter.Filter类的典型用法代码示例。如果您正苦于以下问题:Python Filter类的具体用法?Python Filter怎么用?Python Filter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Filter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: onBtnLoadCur
def onBtnLoadCur(self):
filter = Filter()
filter.exec()
if filter.ret:
print(filter.sel)
self.plotCur = filter.sel
pass
示例2: get_movies
def get_movies(self, page=0, limit=5, filter=None, order='m.title ASC'):
sql = "select m.title, m.description, m.airdate, m.full_path, m.parent_dir, m.added, m.id, datetime(m.watched, 'localtime'), m.runtime, m.poster from movie m"
if filter is not None:
_f = Filter("movie", {"movie": "m"})
sql += _f.genFilter(filter)
sql += " ORDER BY %s LIMIT ?, ?" % order
movies = self.sql.select(sql, (page * limit, limit,))
html = []
for movie in movies:
content = {}
content["id"] = movie[6]
content["title"] = movie[0] if movie[0] is not None else movie[4]
content["desc"] = movie[1] if not movie[1] is None else ""
content["path"] = "file:///opt/sybhttpd/localhost.drives/NETWORK_SHARE/mediaui/Movies/%s" % (movie[3])
content["fanart"] = movie[9] if movie[9] is not None else "movie_fanart.png"
content["added"] = self.convert_date_to_dayssince(movie[5])
content["watchedicon"] = "/images/unwatched.png" if movie[7] is None else "/images/watched.png"
content["watcheddate"] = self.convert_watched_to_dayssince(movie[7])
content["fulltitle"] = content["title"]
content["runtime"] = self.convert_runtime_seconds(movie[8])
content["year"] = self.strip_year_from_date(movie[2])
if content["desc"].__len__() > 300:
content["desc"] = content["desc"][:300] + "..."
if content["title"].__len__() > 30:
content["title"] = content["title"][:30] + "..."
html.append(content)
return html
示例3: __init__
def __init__(self, args, current=None):
'''
Constructor
'''
options = ["Exclude loans with public records"]
Filter.__init__(self, args, options, current)
示例4: __init__
def __init__(self, args, current=None):
'''
Constructor
'''
options = [12, 24, 60]
Filter.__init__(self, args, options, current)
示例5: main
def main():
HOME_PATH = "D:\\SENTIFI_DATA\\filter\\"
FILE_PATH_TO_JSON_MESSAGES = HOME_PATH + "messages.json"
FILE_PATH_TO_JSON_CRITERIA = HOME_PATH + "criteria.json"
json_messages = IOUtils().read_json_data_from_file(FILE_PATH_TO_JSON_MESSAGES)
json_criteria = IOUtils().read_json_data_from_file(FILE_PATH_TO_JSON_CRITERIA)
list_criteria = []
for criteria in json_criteria:
item = SentifiSearchItem(criteria)
list_criteria.append(item)
list_messages = []
for json_item in json_messages:
message = SentifiMessage(json_item)
list_messages.append(message)
#For each message, compare its soid to criteria's soid
for message in list_messages:
for criteria in list_criteria:
if message.soid == criteria.soid:
filter = Filter(message, criteria)
filter.apply()
for msg in list_messages:
message.display()
return list_messages
示例6: __init__
def __init__(self, args, current=None):
'''
Constructor
'''
options = [float(n) for n in range(5000, 30000, 5000)]
Filter.__init__(self, args, options, current)
示例7: __init__
def __init__(self, args, current=None):
'''
Constructor
'''
options = [1.0, 5.0, 10.0]
Filter.__init__(self, args, options, current)
示例8: __init__
def __init__(self, args, current=None):
'''
Constructor
'''
purpose_bitmap = {'other': 1 << 0,
'debt_consolidation': 1 << 1,
'educational': 1 << 2,
'credit_card': 1 << 3,
'car': 1 << 4,
'home_improvement': 1 << 5,
'small_business': 1 << 6,
'vacation': 1 << 7,
'moving': 1 << 8,
'wedding': 1 << 9,
'house': 1 << 10,
'medical': 1 << 11,
'major_purchase': 1 << 12,
'renewable_energy': 1 << 13,
}
self.conversion_table = purpose_bitmap.copy()
options = self.powerBitSet(purpose_bitmap.values())
Filter.__init__(self, args, options, current)
示例9: __init__
def __init__(self, args, current=None):
'''
Constructor
'''
options = list(range(25, 250, 50))
Filter.__init__(self, args, options, current)
示例10: getGrayscaleImagesImp
def getGrayscaleImagesImp(images):
if isinstance(images, collections.Iterable):
grayscaleImages = []
for image in images:
grayscaleImages.append(Filter.getGrayscale(image))
return grayscaleImages
else:
return Filter.getGrayscale(images)
示例11: getCannyImp
def getCannyImp(images):
if isinstance(images, collections.Iterable):
cannyImages = []
for image in images:
cannyImages.append(Filter.getCanny(image))
return cannyImages
else:
return Filter.getCanny(images)
示例12: __init__
def __init__(self, args, current=None):
'''
Construct a set similar to this based on the passed in grades
'A',
'AB',
'ABC',
'ABCD',
'ABCDE',
'ABCDEF',
'ABCDEFG',
'B',
'BC',
'BCD',
'BCDE',
'BCDEF',
'BCDEFG',
'C',
'CD',
'CDE',
'CDEF',
'CDEFG',
'D',
'DE',
'DEF',
'DEFG',
'E',
'EF',
'EFG',
'F',
'FG',
'G'
'''
options = []
grades_bitmap = {'A': 1 << 0,
'B': 1 << 1,
'C': 1 << 2,
'D': 1 << 3,
'E': 1 << 4,
'F': 1 << 5,
'G': 1 << 6,
}
self.conversion_table = grades_bitmap.copy()
self.reverse_table = {v:k for k, v in grades_bitmap.items()}
num_grades = len(args.grades)
for i in range(1, num_grades + 1):
for j in range(num_grades):
if (j + i) <= num_grades:
grades = args.grades[j:j + i]
grades_bit_value = 0
for grade in grades:
grades_bit_value += grades_bitmap[grade]
options.append(grades_bit_value)
self.conversion_table[grades] = grades_bit_value
self.reverse_table[grades_bit_value] = grades
Filter.__init__(self, args, options, current)
示例13: __init__
def __init__(self, args, current=None):
'''
Constructor
'''
options = [0, 1, 2, 3, 4, 5]
Filter.__init__(self, args, options, current)
self.reverse_table = ["MORTGAGE", "OWN", "RENT", "OTHER", "NONE", "NULL"]
示例14: onBtnLoadRef
def onBtnLoadRef(self):
filter = Filter()
filter.exec()
if filter.ret:
print(filter.sel)
self.plotsRef = filter.sel
pass
示例15: __init__
def __init__(self, args, current=None):
'''
Constructor
'''
options = [
1 << 0, # 0
1 << 0 | 1 << 1 | 1 << 2 | 1 << 3, # 0, 1-3
1 << 0 | 1 << 1 | 1 << 2 | 1 << 3, # 0, 1-3, 4
1 << 1 | 1 << 2 | 1 << 3, # 1-3
1 << 1 | 1 << 2 | 1 << 3 | 1 << 4, # 1-3, 4
1 << 4, # 4
1 << 5 | 1 << 6 | 1 << 7 | 1 << 8 | 1 << 9 | 1 << 10 | 1 << 11, # 5 - 11
]
Filter.__init__(self, args, options, current)