コード例 #1
0
def add_child(node):
    logger.clear()
    
    name = str(random.randrange(100000))
    title = 'atitle'
    
    repository.add_favorite(repositoryDirectory, name, title,  node.getFullPath() + '/')

    favorite = Favorite(title, name)
    favorite.parent = node     
    
    logger.set_commits(repository.get_commits(repositoryDirectory))
    return favorite
コード例 #2
0
def add_child(node):
    logger.clear()

    name = str(random.randrange(100000))
    title = 'atitle'

    repository.add_favorite(repositoryDirectory, name, title,
                            node.getFullPath() + '/')

    favorite = Favorite(title, name)
    favorite.parent = node

    logger.set_commits(repository.get_commits(repositoryDirectory))
    return favorite
コード例 #3
0
ファイル: favoritesrepo.py プロジェクト: cefolger/favorites
 def get_favorite_from_directory(self, directory, name):
     titleFile = open(directory + '/title', 'r')
     title = titleFile.readline()
     titleFile.close()
     favorite = Favorite(title, name)
     
     if os.path.exists(directory + '/type'):
         typeFile = open(directory + '/type', 'r')
         pageType = typeFile.readline()
         typeFile.close()
         
         pageFile = open(directory + '/page', 'r')
         pageUrl = pageFile.readline()
         pageFile.close()
         
         if pageType == 'html':
             page = favorite.add_html_page(pageUrl)
     
     return favorite
コード例 #4
0
from model.statistic import Statistic
from model.statistic import track_activity
from model.ping import Ping
from model.revision import Revision

if __name__ == "__main__":
    Category.create_table(fail_silently=True)
    Bot.create_table(fail_silently=True)
    Country.create_table(fail_silently=True)
    Channel.create_table(fail_silently=True)
    User.create_table(fail_silently=True)
    Suggestion.create_table(fail_silently=True)
    Group.create_table(fail_silently=True)
    Notifications.create_table(fail_silently=True)
    Keyword.create_table(fail_silently=True)
    Favorite.create_table(fail_silently=True)
    APIAccess.create_table(fail_silently=True)

    APIAccess.insert({
        'user': User.get(User.username == 'Bfaschatsbot'),
        'token': '474609801:AAFrSFYP9YXPFa5OmQReEjTn6Rs44XQVuDM',
    }).execute()

    # Country.insert_many([
    #     {'name': 'Italy', 'emoji': '🇮🇹'},
    #     {'name': 'Brazil', 'emoji': '🇧🇷'},
    #     {'name': 'Great Britain', 'emoji': '🇬🇧'},
    #     {'name': 'Spin', 'emoji': '🇪🇸'},
    #     {'name': 'Iran', 'emoji': '🇮🇷'},
    #     {'name': 'Indonesia', 'emoji': '🇮🇩'},
    #     {'name': 'Russia', 'emoji': '🇷🇺'},