Compare commits

..

No commits in common. "017a694bfdb5b7701822cb228005496c44881e1b" and "68141fbbf29e0d0230363f65a785df8c8f5bbed2" have entirely different histories.

3 changed files with 15 additions and 14 deletions

View File

@ -1,6 +1,5 @@
import time import time
from pastebin.client import PastebinClient from pastebin.client import PastebinClient, search_by_language
from pastebin.util import search_by_language
def main(): def main():

View File

@ -182,3 +182,17 @@ class PastebinClient(PastebinAPI):
self.pastes[i] for i, paste in enumerate(self.pastes) self.pastes[i] for i, paste in enumerate(self.pastes)
if paste.lang.lower() == lang.lower() if paste.lang.lower() == lang.lower()
] ]
def search_by_language(pastes, lang):
return [
pastes[i] for i, paste in enumerate(pastes)
if paste.lang.lower() == lang.lower()
]
def search_by_category(pastes, category):
return [
pastes[i] for i, paste in enumerate(pastes)
if paste.category == category
]

View File

@ -1,12 +0,0 @@
def search_by_language(pastes, lang):
return [
pastes[i] for i, paste in enumerate(pastes)
if paste.lang.lower() == lang.lower()
]
def search_by_category(pastes, category):
return [
pastes[i] for i, paste in enumerate(pastes)
if paste.category == category
]