def test_one(self):
     x = piv.PhonFeats(ini.connect(),
                       ('p', 't', 'k', 'b', 'd', 'g', 'f', 's', 'ʃ', 'h',
                        'm', 'n', 'ŋ', 'r', 'l', 'j', 'ʋ'))
     correct = ['-syll', '-round', '-constr_gl', '-stress', '-long', '-tap']
     test = x.features_common(False)
     assert set(correct) == set(test)
    def test_five(self):

        x = piv.PhonFeats(ini.connect(), ('d', 'z', 'n', 'l'),
                          TestCheckMatch.nae)
        correct = True
        test = x.check_match(['+voice', '-dist'])
        assert correct == test
    def test_four(self):

        x = piv.PhonFeats(ini.connect(), ('v', 'z', 'ʒ', 'ð'),
                          TestCheckMatch.nae)
        correct = True
        test = x.check_match(['+voice', '+continuant', '-approx'])
        assert correct == test
    def test_two(self):

        x = piv.PhonFeats(ini.connect(), ('i', 'ɪ', 'u', 'ʊ'),
                          TestCheckMatch.nae)
        correct = True
        test = x.check_match(['+syll', '+high'])
        assert correct == test
 def test_two(self):
     x = piv.PhonFeats(ini.connect(), ('v', 'z', 'ʒ', 'ð'),
                       TestCheckContrast.hawaiian)
     correct = False  # [n] and [m] will have the same specification
     x.compute_inventory_dict()
     test = x.check_contrast(
         ['back', 'continuant', 'lat', 'delayed_release', 'nasal'])
     assert correct == test
 def test_four(self):
     fin = ('p', 't', 'k', 'b', 'd', 'g', 'f', 's', 'ʃ', 'h', 'm', 'n', 'ŋ',
            'r', 'l', 'j', 'ʋ')
     x = piv.PhonFeats(ini.connect(), ('p', 't', 'k', 'g'), fin)
     correct = [
         'labial', 'coronal', 'anterior', 'dist', 'dorsal', 'high', 'low',
         'voice', 'strident'
     ]
     test = x.features_uncommon(False)
     assert set(correct) == set(test)
    def test_one(self):

        x = piv.PhonFeats(ini.connect(), ('p', 't', 'k'), TestCheckMatch.nae)
        correct = True
        test = x.check_match([
            '+cons', '-son', '-syll', '-round', '-voice', '-spread_gl',
            '-constr_gl', '-continuant', '-lat', '-delayed_release', '-nasal',
            '-stress', '-long', '-approx', '-tap', '-trill', '-labiodental'
        ])
        assert correct == test
 def test_one(self):
     x = piv.PhonFeats(ini.connect(), ('p'), TestSegFeatList.hawaiian)
     correct = [
         '+cons', '+son', '-syll', '-labial', '-round', '+coronal',
         '+anterior', '-dist', '-dorsal', '0high', '0low', '0back',
         '0tense', '+voice', '-spread_gl', '-constr_gl', '-continuant',
         '-strident', '-lat', '0delayed_release', '+nasal', '-stress',
         '-long', '-approx', '-tap', '-trill', '-labiodental', '0front'
     ]
     test = x.segment_feature_list('n')
     assert set(correct) == set(test)
 def test_three(self):
     fin = ('p', 't', 'k', 'b', 'd', 'g', 'f', 's', 'ʃ', 'h', 'm', 'n', 'ŋ',
            'r', 'l', 'j', 'ʋ')
     x = piv.PhonFeats(ini.connect(), ('p', 't', 'k', 'g'), fin)
     correct = [
         'cons', 'son', 'labial', 'coronal', 'anterior', 'dist', 'dorsal',
         'high', 'low', 'back', 'tense', 'voice', 'spread_gl', 'continuant',
         'strident', 'lat', 'delayed_release', 'nasal', 'approx', 'trill',
         'labiodental', 'front'
     ]
     test = x.features_uncommon(True)
     assert set(correct) == set(test)
class TestFeatUncommon:
    x = piv.PhonFeats(ini.connect(), ('p', 't', 'v'))

    def test_one(self):
        correct = [
            'labial', 'coronal', 'anterior', 'dist', 'voice', 'continuant',
            'strident', 'delayed_release', 'labiodental'
        ]

        test = TestFeatUncommon.x.features_uncommon(False)
        assert set(correct) == set(test)

    def test_two(self):
        nae = ('p', 't', 'k', 'ʔ', 'b', 'd', 'g', 'f', 'θ', 's', 'ʃ', 'h', 'v',
               'ð', 'z', 'ʒ', 't͡ʃ', 'd͡ʒ', 'm', 'n', 'ŋ', 'l', 'ɹ', 'w', 'j',
               'i', 'ɪ', 'u', 'ʊ', 'e', 'ɛ', 'ə', 'ʌ', 'ɔ', 'æ', 'ɑ')
        x = piv.PhonFeats(ini.connect(),
                          ('p', 't', 'k', 'b', 'd', 'g', 'f', 's', 'ʃ', 'h',
                           'm', 'n', 'ŋ', 'r', 'l', 'j', 'ʋ'))
        # print("LOOK: ", x.features_common())

        correct = [
            'cons', 'son', 'labial', 'coronal', 'anterior', 'dist', 'dorsal',
            'high', 'low', 'back', 'tense', 'voice', 'spread_gl', 'continuant',
            'strident', 'lat', 'delayed_release', 'nasal', 'approx', 'trill',
            'labiodental', 'front'
        ]
        test = x.features_uncommon(False)
        assert set(correct) == set(test)

    def test_three(self):
        fin = ('p', 't', 'k', 'b', 'd', 'g', 'f', 's', 'ʃ', 'h', 'm', 'n', 'ŋ',
               'r', 'l', 'j', 'ʋ')
        x = piv.PhonFeats(ini.connect(), ('p', 't', 'k', 'g'), fin)
        correct = [
            'cons', 'son', 'labial', 'coronal', 'anterior', 'dist', 'dorsal',
            'high', 'low', 'back', 'tense', 'voice', 'spread_gl', 'continuant',
            'strident', 'lat', 'delayed_release', 'nasal', 'approx', 'trill',
            'labiodental', 'front'
        ]
        test = x.features_uncommon(True)
        assert set(correct) == set(test)

    def test_four(self):
        fin = ('p', 't', 'k', 'b', 'd', 'g', 'f', 's', 'ʃ', 'h', 'm', 'n', 'ŋ',
               'r', 'l', 'j', 'ʋ')
        x = piv.PhonFeats(ini.connect(), ('p', 't', 'k', 'g'), fin)
        correct = [
            'labial', 'coronal', 'anterior', 'dist', 'dorsal', 'high', 'low',
            'voice', 'strident'
        ]
        test = x.features_uncommon(False)
        assert set(correct) == set(test)
Beispiel #11
0
def main(argv):
    if not (4 <= len(argv) <= 5):
        return BAD_ARGS
    argv.append(None)
    k = 1
    dbname = argv[k]
    verb = argv[k + 1]
    key = argv[k + 2]
    value = argv[k + 3]
    if verb not in ['get', 'set', 'delete']:
        return BAD_ARGS
    db = init.connect(dbname)
    try:
        if verb == 'get':
            sys.stdout.write(db.getitem(key))
        elif verb == 'set':
            db.setitem(key, value)  
            #db.commit()
        else:
            return
    except KeyError:
        print('Key not found', file = sys.stderr)
        return BAD_KEY
    return OK
Beispiel #12
0
#!/usr/bin/env python3

import matplotlib.pyplot as plt

from bson.code import Code
from pprint import pprint
from time import time

from init import connect

orders = connect()
labels = []

mapper_func = open('mapper.js', 'r').read()
reducer_func = open('reducer.js', 'r').read()

def log(legend, label, value):
    print(f'\t{legend}:\t\t{value}')

def draw(legend, data):
    labels_ = []
    for i, item in enumerate(data):
        labels_.append(f'{labels[i]} ({item})')

    plt.clf()
    plt.pie(data, labels=labels_, colors=['lightcoral', 'lightskyblue'], autopct='%1.1f%%')
    filename = legend.replace(' ', '-')
    plt.savefig(f'images/{filename}.png')

def purchase_by_gender():
    mapper = Code(mapper_func)
Beispiel #13
0
def shell():
	
	#--meta variable
	remote_dir = []
	remote_git = []
	
	local_dir = 'none'
	local_git = 'none'
	root_dir = os.environ['HOME']+'/gitDFS'
	pit = root_dir
	last = root_dir

	#--initialization
	print "Welcome to gitDFS~~~"
	local_name = raw_input('please type in the name of the local machine, skip this, type \'s \':')
	if local_name!='s':
		(local_dir,local_git) = init.local(local_name)
	else: 
		f = open(os.environ['HOME']+'/os_project/info/local_name','r')
		name = f.read()
		name = str.split(name,'\n')
		name = name[0]
		local_name = name
		print 'local_name is:'+local_name
		local_dir = root_dir+'/'+local_name
		local_git = root_dir+'/'+local_name+'.git'
		print 'local_dir is:'+local_dir+', local_git is:'+local_git
		print '==============================================================================='

	#--cmd execution
	cmd = raw_input('gitDFS >>')
	while(cmd!='exit()'):
		if cmd == 'connect':
			(remote_dir,remote_git) = init.connect()
		elif cmd == 'ls -r':
			cur_dir = auxi.getCurrentDir(pit)
			if (pit.find('_remote')!=-1): #-- remote ls
				#print 'remote ls'
				if auxi.check_remote(remote_git,remote_dir):
					git_r = auxi.getRemoteGit(remote_git,remote_dir,pit)
					#(sta,info) = commands.getstatusoutput('git pull '+git_r)
					refresh(cur_dir,git_r)
					os.system('ls '+pit)
				else:
					print 'error occurred in '+cmd
			elif (pit.find('.git')!=-1): #-- git ls
				#print 'git ls'
				os.system('ls '+pit)
			else: #-- local ls
				#print 'local ls'
				if auxi.check_local(local_git,local_dir):
					#(sta,info) = commands.getstatusoutput('git pull '+local_git)
					refresh_local(local_name,local_git)
					os.system('ls '+pit)
				else:
					print 'error occurred in '+cmd
		elif cmd == 'ls':
			os.system('ls '+pit)
		elif cmd.find('cd')!=-1:
			dest = str.split(cmd,' ')
			dest = dest[-1]
			(sta,next) = commands.getstatusoutput('ls '+pit)
			if not (dest in next) and (dest != '..'):
				print dest+' does not exisit'
				
			elif not os.path.exists(pit+'/'+dest):
				print dest+' is not a directory'
				
			elif dest == '..':
				(pit,last) = auxi.cd_back(dest,pit,last)
			else:
				(pit,last) = auxi.cd_forward(dest,pit,last)
		elif cmd == 'pwd':
			print pit

		elif cmd.count('read -r')==1:
			objFile = str.split(cmd,' ')
			objFile = objFile[-1]
			objFile_whole = pit+'/'+objFile
			if not os.path.isfile(objFile_whole):
				print 'file '+objFile+' does not exist'
				
			else:
				cur_dir = auxi.getCurrentDir(pit)
				if pit.find('_remote')!=-1: #-- remote read
					print 'remote read'
					git_r = auxi.getRemoteGit(remote_git,remote_dir,pit)
					#exe_fetch = 'git --git-dir=../gitDFS/'+cur_dir+'/.git fetch'
					#print 'fetch:'+exe_fetch
					#(sta,info) = commands.getstatusoutput(exe_fetch)
					#print info
					#exe_merge = 'git --git-dir=../gitDFS/'+cur_dir+'/.git --work-tree=../gitDFS/'+cur_dir+' merge origin/master'
					#print 'merge:'+exe_merge
					#(sta1,info1) = commands.getstatusoutput(exe_merge)
					#print info1
					refresh(cur_dir,git_r)
					os.system('chmod a+r '+objFile_whole)
					os.system('vim '+objFile_whole)
				elif pit.find('.git')!=-1:  #-- git read
					os.system('chmod a+r '+ objFile_whole)
					os.system('vim '+objFile_whole)
				else: #-- local read
					#(sta,info) = commands.getstatusoutput('git pull '+local_git)
					refresh_local(local_name,local_git)
					os.system('chmod a+r '+ objFile_whole)
					os.system('vim '+objFile_whole)

		elif cmd.count('read')==1 and cmd.count('read -r')==0:
			objFile = str.split(cmd,' ')
			objFile = objFile[-1]
			objFile_whole = pit+'/'+objFile
			os.system('chmod a+r '+objFile_whole)
			os.system('vim '+objFile_whole)

			
		elif cmd.find('write')!=-1:
			objFile = str.split(cmd,' ')
			objFile = objFile[-1]
			objFile_whole = pit+'/'+objFile
			existed = 'T'
			newFile = 'OFF'
			if not os.path.isfile(objFile_whole):
				existed = 'F'
				print 'file '+objFile+' does not exist,do you want to create a new one? (y/n)'
				choose = raw_input()
				if choose == 'y':
					newFile = 'ON'
				elif choose == 'n':
					newFile = 'OFF'
				else:
					print 'neither y nor n, invalid input.'

			if existed == 'F' and newFile == 'OFF':
				print 'no file is created.'
			else:
				cur_dir = auxi.getCurrentDir(pit)
				if pit.find('_remote')!=-1:  #-- remote write
					print 'remote write'
					if cmd.count('write -r')==1:
						if existed == 'T':
							refresh(cur_dir)
						else:
							print 'the file '+objFile+' does not exist, you can\'t use command:'+cmd
							return
					if existed == 'F':
						f = open(objFile_whole,'w')
						f.close()

					os.system('chmod a+w+r '+objFile_whole)
					auxi.write(objFile_whole)
					msg = raw_input('please type in the modify message:')
					git_r = auxi.getRemoteGit(remote_git,remote_dir,pit)
					update(msg,cur_dir,objFile,git_r)
				elif pit.find('.git')!=-1:  #-- git write, forbidden
					print 'you cannot modiy .git directory'
				else:  #-- local write
					print 'local write'
					if cmd.count('write -r')==1:
						if existed == 'T':
							refresh_local(local_name,local_git)
						else:
							print 'the file '+objFile+' does not exist, you can\'t use command:'+cmd
							return
					if existed == 'F':
						f = open(objFile_whole,'w')
						f.close()

					os.system('chmod a+w+r '+objFile_whole)
					os.system('vim '+objFile_whole)
					msg = raw_input('please type in the modify message:')
					update_local(msg,local_name,objFile,local_git)
			
		cmd = raw_input('gitDFS >> ')
	print "exit the gitDFS shell"
Beispiel #14
0
from haasomeapi.enums.EnumFundPosition import EnumFundPosition
from haasomeapi.enums.EnumMadHatterIndicators import EnumMadHatterIndicators
from haasomeapi.enums.EnumMadHatterSafeties import EnumMadHatterSafeties
from haasomeapi.enums.EnumOrderType import EnumOrderType
from haasomeapi.enums.EnumPriceSource import EnumPriceSource




def tunersi(therange):
    for x in range(therange):
        tuneRsiLength(therange)


import init
haasomeClient = init.connect()
import botsellector
import interval as iiv


def
    if res[0] == None:  # or not Helpers.IsOnRightMachine(res[0])
        print("An error occurred: {0}".format(res[1]))
    else:
        print("Success")

        license_key = res[0]
        print("Feature 1: " + str(license_key.f1))
        print("License expires: " + str(license_key.expires))
    return trial_key
 def test_two(self):
     x = piv.PhonFeats(ini.connect(), ('v', 'z', 'ʒ', 'ð'), TestMinFeat.nae)
     correct = ['+voice', '+continuant', '-approx']
     test = x.min_feats()
     assert set(correct) == set(test)
 def test_one(self):
     x = piv.PhonFeats(ini.connect(), ('d', 'z', 'n', 'l'), TestMinFeat.nae)
     correct = ['+voice', '-dist']
     test = x.min_feats()
     assert set(correct) == set(test)