Exemplo n.º 1
0
    def build(self):
        if not self.image_is_built():
            self.build_image()

        if not self.artifacts_are_built():
            show('Building artifacts.', 'info')
            self.build_artifacts()
            show('Done', 'info')
Exemplo n.º 2
0
 def image_is_built(self):
     try:
         client = docker.from_env()
         image = client.images.get(self.image)
         show('Build image ' + self.image + ' found. Skipping image build.',
              'info')
         return True
     except docker.errors.ImageNotFound:
         return False
Exemplo n.º 3
0
 def build_image(self):
     show('Building build image ' + self.image + '.', 'info')
     repo_dir = os.path.join(os.environ.get('WORKSPACE'), 'repos',
                             self.repo)
     clone(self.repo, repo_dir, self.branch)
     client = docker.from_env()
     client.images.build(path=repo_dir, tag=self.image)
     shutil.rmtree(repo_dir)
     show('Done', 'info')
Exemplo n.º 4
0
 def artifacts_are_built(self):
     expected_artifacts = self.get_artifacts_names()
     for expected_artifact in expected_artifacts:
         if not os.path.isfile(
                 os.path.join(
                     os.environ.get('HYPRIOT_ARTIFACTS_VOLUME_PATH'),
                     expected_artifact)):
             return False
     show('Artifacts found. Skipping artifacts build.', 'info')
     return True
Exemplo n.º 5
0
    def run(self):
        s = socket.socket()  # Create a socket object
        s.bind((socket.gethostname(), 37156))

        s.listen(5)
        c, addr = s.accept()
        next_line = c.recv(1024).decode()
        prev = ""

        while next_line != "q":
            if next_line == "&^EMPTY":
                next_line = ""
            cmds = next_line.split(";")
            if len(prev) > 0:
                cmds[0] = prev + "\n" + cmds[0]

            send = []

            for cmd in (cmds if len(next_line) > 0 and next_line[-1] == ";"
                        else cmds[:-1]):
                if cmd == "":
                    continue
                lines = [x.split(" ") for x in cmd.split("\n")]
                lines = [line for line in lines if len(line) > 0]

                if lines[0][0] == "a":
                    send.append(self.alarm_clock.add_argparse(lines))
                elif lines[0][0] == "v":
                    output.show(self.alarm_clock.show_events(), "schedule")
                    send.append("Opened schedule :D\n")
                elif lines[0][0] == "r":
                    send.append(self.alarm_clock.remove(lines[0][1]))
                elif lines[0][0] == "c":
                    send.append(self.alarm_clock.chain(lines))
                elif lines[0][0] == "d":
                    send.append(self.alarm_clock.delay(lines))
                else:
                    send.append("wtf did u jsut say to me\n")

            if len(next_line) > 0 and next_line[-1] == ";":
                prev = ""
            else:
                prev = cmds[-1]
                send.append("..")

            c.send("".join(send).encode())
            next_line = c.recv(1024).decode()

        c.send("q".encode())
        c.close()
        s.close()
Exemplo n.º 6
0
def run(args):
    verbosity = os.environ.get('VERBOSITY')
    client = docker.from_env()
    if verbosity != 'debug':
        client.containers.run(**args)
    else:
        args['detach'] = True
        container = client.containers.run(**args)
        show('**************Build Output**************', 'debug')
        for line in container.logs(stream=True):
            show(line.strip(), 'debug')
        show('****************************************', 'debug')
Exemplo n.º 7
0
# -*- coding: utf-8 -*-
"""
Created on Tue May 19 14:40:32 2020

@author: douzi
"""

import output

if __name__=='__main__':
    output.show()
Exemplo n.º 8
0
# MAIN

import numpy as np
import create
import simplex
import gomory
import output

# Вариант 18
c = np.array([7, 7, 6])
b = np.array([8, 2, 6])

A = np.array([[2, 1, 1], [1, 2, 0], [0, 0.5, 4]])

print("\nИсходная simplex-таблица\n")
obj = create.Create(c, b, A)
output.show(obj)

while (obj.gomory):
    print("\nПреобразованная simplex-таблица\n")
    simplex.Simplex(obj)
    output.show(obj)

    print("\nВызываем метод Гомори\n")
    gomory.Gomory(obj)
    output.show(obj)
    pass

print("\nЦелосчисленное решение")
output.result(obj)
Exemplo n.º 9
0
     outp.show_c_info(c_count, c_list)
     outp.show_c_info2(
         c_count,
         c_list)  # This will write the output in 'Courses Info.txt'
     print()
 elif answer == "X":
     print()
     s_mark = inp.student_mark(s_count, s_list, c_count, c_list)
     all_mark.append(s_mark)
     inp.update(all_mark)
     print()
     outp.show_mark(s_mark)
     print()
 elif answer == "Y":
     print()
     outp.show(all_mark)
     outp.show2(
         all_mark)  # This will write the output in 'Students Mark.txt'
     print()
     gpa_list = inp.calculate_gpa(s_count, c_count, all_mark)
     outp.show_gpa(
         gpa_list)  # This also write the output in 'Students GPA.txt'
     print()
 elif answer == "Z":
     print("Bravo Six, we're going dark !.... ")
     break
 else:
     print()
     print("Action not recognized")
     print()
     continue
Exemplo n.º 10
0
#!E:/Installed Setup/Python/python

import cgi, os
import cgitb; cgitb.enable()
import os
import ginger
import output


if __name__=='__main__':
    form = cgi.FieldStorage()
    fileitem = form['uploadReview']
    if fileitem.filename:
        fn = os.path.basename(fileitem.filename)
        name,ext=os.path.splitext(fileitem.filename)
        open('files/' + str(name)+str(ext), 'wb').write(fileitem.file.read())
        filename=str(name)+str(ext)
        ginger.main('files/'+filename)
    output.show(1)
    
    
Exemplo n.º 11
0
    with open(default_configs_path, 'r') as configs_file:
        default_configs = json.loads(configs_file.read())

    if os.path.isfile(user_configs_path):
        with open(user_configs_path, 'r') as configs_file:
            user_configs = json.loads(configs_file.read())

    if user_configs is None:
        return default_configs
    else:
        for key in user_configs:
            merged_key = default_configs[key].copy()
            merged_key.update(user_configs[key])
            user_configs[key] = merged_key
        return user_configs

if __name__ == "__main__":
    configs = get_configs()
    for artifact in ARTIFACTS:
        if artifact[0] in configs:
            build_inst = artifact[1](configs)

            show('*************************************************', 'info')
            show('Building component: ' + build_inst.get_description(), 'info')
            show('*************************************************', 'info')

            if not build_inst.is_built():
                build_inst.build()

            show('\n', 'info')
Exemplo n.º 12
0
#!E:/Installed Setup/Python/python

import cgi, os
import cgitb; cgitb.enable()
import os
import output
import extraction


if __name__=='__main__':
    extraction.mine("comments.txt")
    output.show(3)
Exemplo n.º 13
0
#!E:/Installed Setup/Python/python

import cgi, os
import cgitb; cgitb.enable()
import os
import output
import extraction


if __name__=='__main__':
    extraction.implicit("implicit.txt")
    output.show(4)
Exemplo n.º 14
0
#!/usr/bin/python3
# wraith.py

# Entry point
#
# Parses command-line arguments and hooks up the other modules.

import os

import load_conf
import run_commands
import image
import output

os.environ ['WRAITH_PATH'] = os.path.dirname (__file__)

conf_file = os.path.join (os.path.expandvars ('${WRAITH_PATH}'), 'config.toml')
#conf_file = os.path.join (os.path.expandvars ('${WRAITH_PATH}'), 'terroo.toml')

config = load_conf.load (conf_file)

img = image.draw (config)

info = run_commands.run (config)

output.show (config, img, info)

# TODO:
#   Handle errors
Exemplo n.º 15
0
#!E:/Installed Setup/Python/python

import cgi, os
import cgitb; cgitb.enable()
import os
import output
import extraction


if __name__=='__main__':
    extraction.check()
    extraction.classify('corrected.txt')
    output.show(2)
Exemplo n.º 16
0
#!E:/Installed Setup/Python/python

import cgi, os
import cgitb; cgitb.enable()
import os
import output
import ranking



if __name__=="__main__":
    ranking.rank("explicit.txt","implicit.txt")
    output.show(5)