Esempio n. 1
0
 def draw_mode(self):
     """ draws node """
     siz = self.size_
     with pushMatrix():
         translate(self.pos.x, self.pos.y, self.pos.z)
         if Cell.debug_mode:
             fill(255, 0, 100)
             text(self.module, 0, 0)
         noFill()  # stroke(0)
         i, j, k = self.index
         for (ni, nj, nk) in Cell.ONL:
             nb = Cell.grid.get((i + ni, j + nj, k + nk), None)
             if nb and nb.state:
                 stroke(200)
                 bar(0, 0, 0, ni * siz, nj * siz, nk * siz)
                 # stroke(64, 200, 200)
                 # with pushMatrix():
                 #     translate(ni * siz / 3, nj * siz / 3, nk * siz / 3)
                 #     box(siz / 3)
         for (ni, nj, nk) in Cell.DNL:
             nb = Cell.grid.get((i + ni, j + nj, k + nk), None)
             if nb and nb.state:
                 stroke(64 + (ni * 2 + nj * 3 + nk * 5) * 16, 255, 200)
                 bar(0, 0, 0, ni * siz, nj * siz, nk * siz,
                     ni * 2 + nj * 3 + nk * 5)
Esempio n. 2
0
def foo():
    result = 0
    for i in range(100000):
        result += i
    for i in range(5):
        bar()
    return result
Esempio n. 3
0
def main():
    logger.info('Entering main ...')
    logger.debug('This is a demo for logging.')
    f = Foo()
    f.do_foo(42)
    bar.bar()
    logger.info('Leaving main ...')
def main():
    while True:
        name = bar.get_customer_name()
        found = bar.customer_lookup(name, bar_data.customer_preferences_list)
        if found:
            preferences = bar_data.customer_preferences_list[name]
        else:
            preferences = bar.drink_preferences(bar_data.questions)
        bar_data.customer_preferences_list.update({name: preferences})
    #       print(customer_preferences_list)
        drink = bar.construct_drink(preferences, bar_data.ingredients)
        if not drink:
            print("Your drink has no ingredients!! Please try again")
        else:
            print("\nI have created a drink according to your preferences. It will contain:")
            for ingredient in drink:
                print("A {}".format(ingredient))
                bar.bar(ingredient, bar_data.inventory)
            print("""Your drink is called a "{}, {}"!!""".format(random.choice(bar_data.adjective_list), random.choice(bar_data.nouns_list)))
        print("")
        print("Would you like another drink?")
        # Loop to check for legal entry:
        while True:
            repeat = str.lower(input("Please enter your response: (y/n)"))
            print(repeat)
            if repeat in "yn":
                break
            else:
                print("""Incorrect entry, please enter "y" or "n".""")
        if repeat not in "y":
            print("Goodbye")
            break
Esempio n. 5
0
    def draw_mode(self):
        """ draws node """
        siz = self.size_
        with pushMatrix():
            translate(self.pos.x, self.pos.y, self.pos.z)
            if Cell.debug_mode:
                fill(255, 0, 100)
                text(self.module, 0, 0)
            noFill()  # stroke(0)
            # rotation = {"11110": PI,
            #             "10110": PI,
            #             "00101": PI,
            #             "11101": HALF_PI,
            #             "01110": HALF_PI,
            #             "11100": HALF_PI,
            #             "00110": HALF_PI,
            #             "11111": HALF_PI * self.ang,
            #             "10111": PI + HALF_PI,
            #             "00111": PI + HALF_PI,
            #             "01100": PI + HALF_PI
            #             }
            # rotation appropriate for each type
            # rotate(rotation.get(self.module, 0))

            # for i in range(Cell.step_start,
            #                Cell.step_end,
            #                Cell.step):  # (-28, 29, 7):
            #     #translate(0, 0, (a + i))
            #     stroke(16 + i * 8, 255, 255)
            #     #stroke(self.index[2] * 8, 255, 255)
            #     # fill(200,10)
            #     box(siz / 3 + i)
            i, j, k = self.index
            for (ni, nj, nk) in Cell.ONL:
                nb = Cell.grid.get((i + ni, j + nj, k + nk), None)
                if nb and nb.state:
                    stroke(64, 255, 100)
                    bar(0, 0, 0,
                         ni * siz / 2, nj * siz / 2, nk * siz / 2)
                    # stroke(64, 200, 200)
                    # with pushMatrix():
                    #     translate(ni * siz / 3, nj * siz / 3, nk * siz / 3)
                    #     box(siz / 3)
            stroke(128, 255, 100)
            for (ni, nj, nk) in Cell.DNL:
                nb = Cell.grid.get((i + ni, j + nj, k + nk), None)
                if nb and nb.state:
                    bar(0, 0, 0,
                         ni * siz / 2, nj * siz / 2, nk * siz / 2)
Esempio n. 6
0
def test_patch_on_import_does_work(mock_foo):
    mock_foo.return_value = 'foo'

    expected = 'foo'
    result = bar()

    assert expected == result
Esempio n. 7
0
def remplir(taille, nom, buffer=500000):
    taille = int(taille)
    buffer = int(buffer)
    c = bar(0, int(taille / buffer), " Creation of the file")
    f = open(nom, 'wb')
    verbose('The file \'{}\' was created'.format(nom))
    #f.write(b'\xff'*taille)
    if int(taille / buffer) == 0:
        verbose(
            'File size ({}o) is inferior to the buffer size ({}o) so writing directlly into the file {}o'
            .format(str(taille), str(buffer), str(taille)))
        f.write(b'\xff' * taille)
    else:
        verbose(
            'File size ({}o) is superior to the buffer size ({}o) so, writing {}o {} times plus {}o'
            .format(str(taille), str(buffer), str(buffer),
                    str(int(taille / buffer)),
                    str(taille - (buffer * int(taille / buffer)))))
        left = taille
        for i in range(int(taille / buffer) + 1):
            if left > buffer:

                c.disp(i + 1)
                f.write(b'\xff' * buffer)
                left -= buffer
            else:
                print()
                verbose('Adding {}o'.format(str(left)))
                f.write(b'\xff' * left)
                left = 0
                break
        print()
Esempio n. 8
0
 def __init__(self, screensize, image, thrust, rotor, scale):
     self.acc = 0
     self.vel = [0, 0]
     loc_x = int(screensize[0]/2)
     loc_y = int(screensize[1]/2)
     self.loc = [loc_x, loc_y]
     self.thrust = thrust
     self.angle = 0
     self.rotor = rotor
     self.rot = 0
     self.scale = scale
     im = pygame.image.load(file('data', 'triangle.png')).convert_alpha()
     if scale == [1, 1]:
         self.im = im
     else:
         self.im = pygame.transform.scale(im, [50*scale[0], 50*scale[1]])
     self.consumption = 0
     self.fuel = 1000
     self.rect = self.im.get_rect()
     self.mask = pygame.mask.from_surface(self.im)
     self.rect.topleft = self.loc[0], self.loc[1]
     self.score = 0
     self.color = [255, 255, 255]
     barsize = [scale[0] * 200, scale[1] * 20]
     bar_loc = [screensize[0]-barsize[0]-30*scale[0], 10*scale[1]]
     self.fuelbar = bar(1000, barsize, bar_loc, self.color, scale)
     self.lives = 2
     self.invuln = True
     self.invuln_timer = 180
     self.extra_count = 0
Esempio n. 9
0
File: Main.py Progetto: rkptrs/KBE
    def xfoil(self):
        clmaxfoil = np.zeros(20)
        p_bar = bar()
        p_bar.update(0)
        for j in range(20):
            y = j / 20 * self.input.wing_span
            if y < self.input.kink_position:
                chord = self.input.root_chord - (
                    self.hld_size.chordroot -
                    self.hld_size.chordkink) * (y / self.input.kink_position)
            else:
                y1 = y - self.input.kink_position
                span = self.input.wing_span - self.input.kink_position
                chord = self.hld_size.chordkink - (
                    self.hld_size.chordkink - self.hld_size.chordtip) * (y1 /
                                                                         span)
            xfoil_analysis = XfoilAnalysis(
                lifting_surface=self.avl_wing.surface1,
                cutting_plane_span_fraction=j / 20,
                flydir=True,
                reynolds_number=self.reynolds(chord),
                root_section=self.avl_wing.root_section,
                tip_section=self.avl_wing.kink_section,
                mach=self.mach)

            clmaxfoil[j] = xfoil_analysis.clmax
            p_bar.update(j * 5)
        p_bar.update(100)
        p_bar.kill()
        return clmaxfoil
Esempio n. 10
0
def test_patch_on_definition_does_not_work(mock_foo):
    mock_foo.return_value = 'foo'

    expected = 'foo'
    result = bar()

    assert expected == result
Esempio n. 11
0
 def __init__(self):
     import bar
     #PHI
     self.phi = phi.phi()
     self.Npiso = "piso"
     #Menu bar
     #self.menu = info.info_area()
     #self.menu.init()
     #Info bar
     self.info = bar.bar()
     self.tim = bar.tim()
     self.objetos_pantalla = []
     self.FT = True
Esempio n. 12
0
def get_acc(src, dst):
    with open(src, mode="r", encoding="utf-8") as source:
        pinyin = source.readlines()

    with open(dst, mode="r", encoding="utf-8") as source:
        sentence = source.readlines()

    correct = 0
    for i, j in bar(zip(pinyin, sentence)):
        correct += count_same(i, j)

    total = sum([len(i.strip()) for i in sentence])
    return correct / total
Esempio n. 13
0
def get_news(lines):
    pure_lines = list()
    p = ',|\.|/|;|\'|`|\[|\]|<|>|\?|:|"|\{|\}|\~|!|@|#|\$|%|\^|&|\(|\)|-|=|\_|\+|,|。|、|;|:' \
        '|‘|\'|【|】|·|!| |…|(|)|[a-z]|[A-Z]|[0-9]'

    for line in bar(lines):
        news = json.loads(line.strip())
        title = news['title']
        text = news['html']

        for i in re.split(p, title):
            if i:
                pure_lines.append(i)

        for i in re.split(p, text):
            if i:
                pure_lines.append(i)

    return pure_lines
Esempio n. 14
0
    def __init__(self, tradeEngine):

        self.onIntiLoadHist = True
        self.papiIndex = []
        self.tradeEngine = tradeEngine
        # self.eventEngine=eventEngine/WUSHURU
        self.i = 0
        self.strategyName = 'strategy'
        self.kLen = 3

        #  self.bar=barG(self.onbar)
        #  self.symbol=['BMW.DE','DAI.DE','zhishutick'] CHXE%20Buy%20CHIXXETRA%20Limit%20DAY
        #  self.symbol=['3188.HK','0939.HK','2327.HK','0175.HK']
        # self.symbol = ['BMW.DE','DAI.DE','SAP.DE','DTE.DE']
        #  self.symbol=['KROT3.BZ','CSNA3.BZ','PETR4.BZ','VALE3.BZ']
        #  self.symbol=['8411.JP','8306.JP','6502.JP','7201.JP','5301.JP','6501.JP','6752.JP','8604.JP']
        self.symbol = [
            'BMW.DE', 'DAI.DE', 'BAS.DE', 'SAP.DE', 'BAYN.DE', 'TKA.DE',
            'DTE.DE', 'LHA.DE', 'SIE.DE'
        ]
        self.symbolHistTickdata = {}
        self.symbolBarDict = {}
        self.strategyOrderDict = {}
        #state
        self.buySignalDict = {}
        self.orderSendingDict = {}
        self.buyTrigerPriceDict = {}
        self.symbolpostionDict = {}
        self.buyStopPriceDict = {}
        self.buyTargetPriceDict = {}

        for s in self.symbol:
            self.symbolBarDict[s] = bar(self.onBar, s, 1)
            self.buySignalDict[s] = 0
            self.orderSendingDict[s] = 0

            self.buyTrigerPriceDict[s] = 9999.99
            self.symbolpostionDict[s] = 0
            self.buyStopPriceDict[s] = 0.0
            self.buyTargetPriceDict[s] = 9999.99
        if self.onIntiLoadHist == True:
            self.onInit()
Esempio n. 15
0
    def __init__(self, tradeEngine):

        self.papiIndex = []
        self.tradeEngine = tradeEngine
        # self.eventEngine=eventEngine/WUSHURU
        self.i = 0
        self.strategyName = 'strategy02'

        #  self.bar=barG(self.onbar)
        #  self.symbol=['BMW.DE','DAI.DE','zhishutick'] CHXE%20Buy%20CHIXXETRA%20Limit%20DAY
        #  self.symbol=['3188.HK','0939.HK','2327.HK','0175.HK']
        self.symbol = []  #['BMW.DE','DAI.DE','GLE.PA','BNP.PA','CS.PA']
        # self.symbol=['8411.JP','8306.JP','6502.JP','7201.JP','1088.HK','0939.HK','0175.HK','3328.HK']
        self.symbolHistTickdata = {}
        self.symbolBarDict = {}
        self.strategyOrderDict = {}
        for s in self.symbol:
            self.symbolBarDict[s] = bar(1)

        self.onInit()
Esempio n. 16
0
from bar import bar


if __name__ == "__main__":
    bar()
Esempio n. 17
0
    return pure_lines


if __name__ == '__main__':
    start = time.time()

    print("Program start :\nThe program will be completed in 8 minutes")
    paths = [
        "../data/sina_news_gbk/2016-0{}.txt".format(num)
        for num in range(1, 10)
    ]

    # get pure lines
    lines = list()
    for path in bar(paths):
        with open(path, mode="r", encoding="gbk") as source:
            lines.extend(source.readlines())

    pure_lines = get_news(lines)
    del lines
    print("data prepared")

    # create dict {word : frequency}
    word3_freq = defaultdict(int)
    words3_list = ((line[i] + line[i + 1] + line[i + 2]
                    for i in range(len(line) - 2)) for line in pure_lines)

    for words in bar(words3_list):
        for word in words:
            word3_freq[word] += 1
Esempio n. 18
0
from viterbi_3gram import viterbi
import argparse
from bar import bar

parser = argparse.ArgumentParser()
parser.add_argument("--input", type=str, required=True, help="input file path")
parser.add_argument("--output",
                    type=str,
                    required=True,
                    help="output file path")
args = parser.parse_args()

with open(args.input, mode="r") as source:
    result = list()
    for line in bar(source.readlines()):
        sentence = viterbi(line.strip().split(" "))
        result.append(sentence + "\n")

    with open(args.output, mode="w", encoding="utf-8") as target:
        target.writelines(result)
from graph_de import graph_de
from pie_plotting import pie_plotting
from CSV_create import csv_create
from value_count import value_count
from face_emotion_recognition import video_capture
from bar import bar
import matplotlib.animation as animation
import matplotlib.pyplot as plt
from confidence_gui import GUI_Confidence

if __name__ == "__main__":

    graph = video_capture()

    #csv = csv_create(result, text)

    angry, disgust, fear, happy, sad, surprise, neutral = graph_de(graph)

    pie_plotting(angry, disgust, fear, happy, sad, surprise, neutral,
                 'foo.png')

    result = value_count(angry, disgust, fear, happy, sad, surprise, neutral)
    bar(angry, disgust, fear, happy, sad, surprise, neutral)
    GUI_Confidence(result)
Esempio n. 20
0
from foo import *
import bar

print('Вызываю foo(x) от 10')
foo(10)

print('Вызываю bar(x) от 100 = ' + str(bar.bar(100)))

Esempio n. 21
0
import foo
import bar
import nima

foo.foo()
bar.bar()
nima.nima()
Esempio n. 22
0
    return pure_lines


if __name__ == '__main__':
    start = time.time()

    print("Program start :\nThe program will be completed in 11 minutes")
    paths = [
        "../data/sina_news_gbk/2016-0{}.txt".format(num)
        for num in range(1, 10)
    ]

    # get pure lines
    lines = list()
    for path in bar(paths):
        with open(path, mode="r", encoding="gbk") as source:
            lines.extend(source.readlines())

    pure_lines = get_news(lines)
    del lines
    print("data prepared")

    # create dict {word : frequency}
    word4_freq = defaultdict(int)
    words4_list = ((line[i] + line[i + 1] + line[i + 2] + line[i + 3]
                    for i in range(len(line) - 3)) for line in pure_lines)

    for words in bar(words4_list):
        for word in words:
            word4_freq[word] += 1
Esempio n. 23
0
import bar

print(bar.bar())
Esempio n. 24
0
 def test_bar(self):
     with patch('bar.foo', mock_foo):
         print(bar())
         self.assertEqual(bar(), 'mock_foo')
Esempio n. 25
0
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
from bar import bar
from ..foo.foo import foo

if __name__ == "__main__":
    # f = foo()
    b = bar()
# splash_window

splash_window = Tk()
splash_window.geometry("1240x590")
splash_window.title("LIVER DISEASE PREDICTION USING ML")
img = ImageTk.PhotoImage(PIL.Image.open('UI-Materials/sd2.png'))
panel = Label(splash_window, image=img)
panel.pack(side="top", fill="both", expand="yes")
splash_window.after(3000, lambda: splash_window.destroy())

progress = ttk.Progressbar(splash_window,
                           orient=HORIZONTAL,
                           length=1280,
                           mode='determinate')
progress.pack(ipady=45)
bar(progress, splash_window)

splash_window.mainloop()

# root_window

root = Tk()
global i
root.geometry("1100x840")
root.title("LIVER DISEASE PREDICTION USING ML")
root.config(bg="#ffffff")

Heading = Label(root,
                text="LIVER DISEASE PREDICTION USING MACHINE LEARNING",
                font="Cooper 30",
                bg="#ffffff",
Esempio n. 27
0
def fn():
    bar()
    print('im foo')
Esempio n. 28
0
from bar import bar

if __name__ == "__main__":
    bar()
Esempio n. 29
0
import os

import boto3
from bar import bar
from bar.baz import baz
from foo import foo

_ = boto3

if __name__ == "__main__":
    INIT_FILENAME = "__init__.py"
    dirname = os.path.dirname(os.path.abspath(__file__))
    assert bar() == os.path.join(dirname, "bar", INIT_FILENAME)
    assert baz() == os.path.join(dirname, "bar", "baz", INIT_FILENAME)
    assert foo() == os.path.join(dirname, "foo", INIT_FILENAME)
Esempio n. 30
0
from bar import bar

print('Running app-test-2')
print(bar())
Esempio n. 31
0
 def test_bar(self):
     self.assertEqual(bar.bar(), 'bar')
Esempio n. 32
0
import sys
sys.path.append('nested')
import bar
print(bar.foo())  # 'bar'
print(bar.bar())  # 'foo'
def foo():
    return "foo" + bar()
Esempio n. 34
0
bars = []

for (BAR_DATETIME, 
     BAR_OPEN, 
     BAR_CLOSE, 
     BAR_HIGH, 
     BAR_LOW, 
     BAR_VOLUME, 
     BAR_LENGTH) in cursor:
    
    ''' create a bar '''
    bars.append(bar(BAR_DATETIME, 
                    BAR_LENGTH, 
                    BAR_OPEN, 
                    BAR_CLOSE, 
                    BAR_HIGH, 
                    BAR_LOW, 
                    BAR_VOLUME))
    
''' close the connection and cleanup '''
cursor.close(); cnx.close()
del cursor    ; del cnx

''' create the series '''
idx_    = []; close_  = []; volume_ = []

''' feed the series '''
for i in bars:                   
    idx_.append    (i.startDate)
    close_.append  (i.close    )