'''
Created on 25 Jul 2013

@author: hicksj
'''
from model.ModelObject import ModelObject

class Player(ModelObject):
    '''
    classdocs
    '''

    @staticmethod
    def load(node):
        answer = Player()
        data = ModelObject.extractData(node)
        value = data.get('name', None)
        if value != None:
            answer.name = value[0].text
        value = data.get('id', None)
        if value != None:
            answer.id = value
        return answer

    def __init__(self):
        self.name = None
        self.id = None


import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from IPython.display import display
from evds import evdsAPI
import csv

#### for taking EVDS data into Python

evds = evdsAPI('Lb4qWxFtXa')
data = evds.get_data(['TP.KKHARTUT.KT1','TP.KKHARTUT.KT16'], startdate="10-03-2020", enddate="06-08-2020")
data_pandas = pd.DataFrame(data)

with open('full_data.csv') as csv_file:
    csv_reader = csv.reader(csv_file, delimiter = ',')
    line_count = -1
    data_case = []
    data_death = []
    for row in csv_reader:
            if row[1]  == 'Turkey':
                if row[6] != '':
                    line_count += 1
                    if (line_count % 7) == 0:
                        data_case.append(row[6])
                        data_death.append(row[7])
                        data_pandas2 = pd.DataFrame({"Weekly Cases": data_case})
                        data_pandas3 = pd.DataFrame({"Weekly Deaths": data_death})
data_pandas = data_pandas.join(data_pandas2)
data_pandas = data_pandas.join(data_pandas3)
display(data_pandas)


from setuptools import setup, find_packages
from codecs import open
from os import path

BASE_DIR = path.abspath(path.dirname(__file__))

with open(path.join(BASE_DIR, 'README.rst'), encoding='utf-8') as f:
    long_description = f.read()

setup(
    name='subst',
    version='0.4.0',
    description='`subst` is simple utility to replace one string into another in given list of files.',
    long_description=long_description,
    url='http://msztolcman.github.io/subst/',
    author='Marcin Sztolcman',
    author_email='marcin@urzenia.net',
    license='MIT',

    # See https://pypi.python.org/pypi?%3Aaction=list_classifiers
    classifiers=[
        'Development Status :: 4 - Beta',
        'Environment :: Console',
        'Intended Audience :: Developers',
        'Intended Audience :: Other Audience',
        'Intended Audience :: System Administrators',
        'License :: OSI Approved :: MIT License',
        'Topic :: Text Processing',
        'Topic :: Utilities',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.3',
        'Programming Language :: Python :: 3.4',
        'Programming Language :: Python :: 3.5',
        'Programming Language :: Python :: 3.6',
    ],
    py_modules=['subst'],

    keywords='sed text processing',

    entry_points={
        'console_scripts': [
            'subst=subst:main',
        ],
    },
)


# AUTHOR: Written by Junhyeok Jeong (jeongju@oregonstate.edu)
# ID: 933196042
# CLASS: CS325 - 400 (2019 Fall)
# ASSIGNMENT: Homework 2

import string
import numpy
import random
import time

def stoogesort(array, first, last):
	if  last <= first:
		return

#step 1: if first element is bigger than last element, then swap
	if int(array[first]) > int(array[last]):
		temp = array[last]
		array[last] = array[first]
		array[first] = temp

#step 2: if there are 3 or more elements in the array, then
	if last - first + 1 >= 3:
		one_third = int(((last - first + 1) / 3))

#recursively call stooge sort with the initial 2/3 of the array
		stoogesort(array, first, (last - one_third))
#recursively call stooge sort with the last 2/3 of the array
		stoogesort(array, first + one_third, last)
#recursively call stooge sort with the initial 2/3 of the array again
		stoogesort(array, first, (last - one_third))

n = 0

#creat an array with n (the number of elements)
for j in range(10):
	array = []
	n = n+ 50

#set array element's value randomly
	for i in range(0, n):
		array.append(random.randint(0,10000))

#measure start time
	start_time = time.time()

#stooge sort
	stoogesort(array, 0, n-1)

	print("array size n: {}, running time: {} seconds ".format(n, time.time() - start_time))