Exemple #1
0
def users(request):
    q = request.POST.get('content')
    print('1111')
    print(q)
    error_msg = ''
    if not q:
        error_msg = '请输入关键词'
        return render(request, 'users.html', {'error_msg': error_msg})
    post_list = tag_user.objects.filter(user=q)
    print(post_list)
    if not post_list:
        error_msg = '该开发者录入ing,请稍后查询该开发者'
        testing.main(q)
        return render(request, 'index.html', {'error_msg': error_msg})
    else:
        print("dskdnk")
        data = {}
        data['tag_user'] = post_list
        user_list = user_3.objects.filter(login=q)
        data['user_list'] = user_list
        rank_list = rank_all.objects.filter(login=q)
        data['rank_list'] = rank_list
        item_list = items.objects.filter(owner=q)
        data['item_list'] = item_list
        blog_list = blog.objects.filter(login=q)
        data['blog_list'] = blog_list
        analyze_list = user_analyze3.objects.filter(login=q)
        data['analyze_list'] = analyze_list
        image_url = User_image.objects.filter(login=q)
        data['image'] = image_url
        return render(request, 'users.html', {
            'error_msg': error_msg,
            'data': data
        })
Exemple #2
0
def looper():
	file_results =[]
	for cat in cat_list:
		for n_size in n_size_list:
			for stpwords in stopwords_options:
				print("in it")
				cleaning.main(cat,n_size,stpwords)
				cleaned_eda.main()
				train_test_split.main()
				preprocessing.main()
				#preprocessed_eda.main()
				modelselection.main()
				training.main()
				accuracy = testing.main()
				results.main(cat,n_size,stpwords,'balanced',accuracy,file_results)
	df = pd.DataFrame(file_results,columns=cols)
	df.to_csv('balanced_new_results.csv')
Exemple #3
0
        simulator = SevenCardStud.Simulator()
        self.assertIsNotNone(simulator)
        self.assertEqual(simulator.GAME_NAME, "Seven-card Stud")
        result = simulator.simulate_game()
        self.assertIsNotNone(result)
        self.assertIsInstance(result, Result)
        stats = simulator.simulate_games(number_of_games=4)
        self.assertIsNotNone(stats)
        self.assertIsInstance(stats, Stats)

    def test_HiLoSimulator(self):
        """Test SevenCardStud.HiLoSimulator"""
        simulator = SevenCardStud.HiLoSimulator()
        self.assertIsNotNone(simulator)
        self.assertEqual(simulator.GAME_NAME, "Seven-card Stud Hi/Lo")
        result = simulator.simulate_game()
        self.assertIsNotNone(result)
        self.assertIsInstance(result, Result)
        stats = simulator.simulate_games(number_of_games=4)
        self.assertIsNotNone(stats)
        self.assertIsInstance(stats, Stats)

    def test_Simulator_TooManyHandsException(self):
        """Test SevenCardStud.Simulator generating NotEnoughCardsException"""
        self.assertRaises(TooManyHandsException,
                          SevenCardStud.Simulator,
                          number_of_hands=9)

if __name__ == "__main__":
    testing.main()
## GNU Lesser General Public License Usage
## Alternatively, this file may be used under the terms of the GNU Lesser
## General Public License version 3 as published by the Free Software
## Foundation and appearing in the file LICENSE.LGPL3 included in the
## packaging of this file. Please review the following information to
## ensure the GNU Lesser General Public License version 3 requirements
## will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
##
## GNU General Public License Usage
## Alternatively, this file may be used under the terms of the GNU
## General Public License version 2.0 or (at your option) the GNU General
## Public license version 3 or any later version approved by the KDE Free
## Qt Foundation. The licenses are as published by the Free Software
## Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
## included in the packaging of this file. Please review the following
## information to ensure the GNU General Public License requirements will
## be met: https://www.gnu.org/licenses/gpl-2.0.html and
## https://www.gnu.org/licenses/gpl-3.0.html.
##
## $QT_END_LICENSE$
##
#############################################################################

from __future__ import print_function, absolute_import

import sys
import testing
import testing.blacklist  # just to be sure it's us...

testing.main()
        self._test_template()

    def _template(self, xml_file, source_xml_dict, i):
        mega_meeting = _MegaMeetingExtraArgs(self.config, source_xml_dict, {})
        doc_insts_mega = mega_meeting.document_instances()
        msg = '%s: MegaMeeting: %s: %s' % (i, xml_file, len(doc_insts_mega))
        self.log.info(msg)
        print msg
        sys.stdout.flush()
        self._validate_gift(doc_insts_mega)

        page_meeting = _PageMeetingExtraArgs(self.config, source_xml_dict, {})
        doc_insts_page = page_meeting.document_instances()
        msg = '%s: PageMeeting: %s: %s' % (i, xml_file, len(doc_insts_page))
        self.log.info(msg)
        print msg
        sys.stdout.flush()
        self._validate_gift(doc_insts_page)


suite = unittest.TestSuite([
    unittest.TestLoader().loadTestsFromTestCase(TestMeetingBulkConversion),
    ])

django_test.tearDown()


if __name__ == "__main__":
    import testing
    testing.main(suite)
Exemple #6
0
        table = Table(players=players)
        active_players = table.get_active_players()
        # players[3] shouldn't be in players since they are sitting out
        # with stack == 0
        self.assertIsNotNone(active_players)
        self.assertEqual(len(active_players), 3)
        self.assertNotIn(players[3], active_players)

    def test_Table_get_next_player(self):
        """Test Table.get_next_player() method."""
        players = [ Player(name="One", stack=100),
                    Player(name="Two", stack=200),
                    Player(name="Three", stack=500),
                    Player(name="Four", stack=0)
                    ]
        table = Table()
        table.seat_players(players, in_order=True)
        self.assertEqual(table.get_next_player(players[0]), players[1])
        self.assertEqual(table.get_next_player(players[1]), players[2])
        self.assertEqual(table.get_next_player(players[2]), players[3])
        self.assertEqual(table.get_next_player(players[3]), players[0])
        self.assertEqual(
            table.get_next_player(players[0], filter=lambda p: p.stack > 300),
            players[2])
        table.set_dealer(players[1])
        self.assertEqual(table.get_dealer(), players[1])
        self.assertEqual(str(table), "1: One 2: Two* 3: Three 4: Four")

if __name__ == "__main__":
    testing.main(doctest_modules=[pyPoker.Player])
Exemple #7
0
		w_director = df_with_director['audience_average']

		df_wo_director = data2[~data2['enwiki_title'].isin(df_with_director['enwiki_title'].tolist())]
		wo_director = df_wo_director['audience_average']
		return stats.mannwhitneyu(w_director, wo_director).pvalue

	directors_pvalue['audience_average_w/o_director'] = directors_pvalue['director'].apply(mean_wo_director)
	directors_pvalue['audience_average_difference'] = directors_pvalue['audience_average_w_director'] - directors_pvalue['audience_average_w/o_director']
	directors_pvalue['pvalue'] = directors_pvalue['director'].apply(find_director_pvalue)
	directors_pvalue = directors_pvalue.sort_values(by=['audience_average_difference'],ascending=False)
	directors_pvalue.to_csv('directors_pvalue.csv', index=False)

	lst_col = 'director'
	df12 = pd.DataFrame({col:np.repeat(data[col].values, data[lst_col].str.len())\
	    for col in data.columns.difference([lst_col])}).assign(**{lst_col:np.concatenate(data[lst_col].values)})[data.columns.tolist()]

	df13 = df12['director'].value_counts()
	df13 = df13.reset_index()
	df13 = df13.loc[df13['director'] >= 30]

	df14 = df12[df12["director"].isin(df13['index'].tolist())]
	df15 = df14.groupby('enwiki_title')['director'].apply(list)
	df15 = df15.reset_index()

	data2 = data.join(df15.set_index('enwiki_title'), on='enwiki_title', lsuffix='_drop', rsuffix='')
	data2 = data2.drop(columns='director_drop')
	data2 = data2[data2.director.notnull()]
	
if __name__ == '__main__':
	main()