示例#1
0
 def transition(self, event):
     k = core.Core()
     state = k.checkstate()
     prevStateRes = 'state/' + state + '/resourses'
     stateperehod = 'state/' + state + '/transition'
     config_n = configparser.ConfigParser()
     config_n.read(r'D:\Diploma\testProg\THOR\configTest.ini')
     if config_n.has_option(stateperehod, event):
         staten = config_n.get(stateperehod, event)
         self.logger.info("Transition from " + state + " to " + staten)
         nextStateRes = 'state/' + staten + '/resourses'
         for res in config_n.options(
                 nextStateRes):  #for each resourse in state
             if config_n.get(prevStateRes, res) != config_n.get(
                     nextStateRes, res):  # if resourse state mismatch
                 resourse = 'group/' + res
                 if config_n.has_option(
                         resourse, 'power_method'
                 ):  #if power_method option in group section
                     if config_n.get(resourse, 'power_method'
                                     ) == 'PBSmodel':  #section for PBSMODEL
                         powerchange = PBSmodel.PBSMODEL()
                         if config_n.get(prevStateRes,
                                         res) == 'on':  #if it was turned on
                             powerchange.suspend()
                         else:
                             powerchange.resume()
                 else:
                     members = config_n.get(resourse, 'members').split(
                         ",")  #if powermetod in node
                     for node in members:
                         nodeSection = "node/" + node
                         if config_n.get(
                                 nodeSection, 'power_method'
                         ) == 'PowerMethod':  #section for power_method
                             powerchange = PowerMethod.POWERMETHOD(
                                 config_n.get(nodeSection, 'id'))
                         if config_n.get(prevStateRes,
                                         res) == 'on':  #if it was turned on
                             powerchange.poweroff()
                         else:
                             powerchange.poweron()
         time.sleep(2)
         ch = core.Core()
         stateafter = ch.checkstate()
         if stateafter != staten:
             self.logger.error(stateafter + ' +++++++++++++++++ ' + staten)
             ch.transition(event)
示例#2
0
 def do_pow(self, pipe):
     nonce = -10000000  # Start nonce at negative 10 million so that the chosen nonce is likely to be small in length
     nonceStart = nonce
     data = self.data
     metadata = self.metadata
     puzzle = self.puzzle
     difficulty = self.difficulty
     mcore = core.Core(
     )  # I think we make a new core here because of multiprocess bugs
     while True:
         # Break if shutdown received
         if pipe.poll() and pipe.recv() == 'shutdown':
             break
         # Load nonce into block metadata
         metadata['pow'] = nonce
         # Serialize metadata, combine with block data
         payload = json.dumps(metadata).encode() + b'\n' + data
         # Check sha3_256 hash of block, compare to puzzle. Send payload if puzzle finished
         token = mcore._crypto.sha3Hash(payload)
         token = onionrutils.OnionrUtils.bytesToStr(
             token)  # ensure token is string
         if puzzle == token[0:difficulty]:
             pipe.send(payload)
             break
         nonce += 1
示例#3
0
def chech_for_modifier(modifier):
    '''
    Initialize core with 100 blocks.
    Core is automatically initialized with DAT.F $0, $0.
    Only 3 blocks are required, but MOD core_size is being applied to some operations,
    so core_size must be greater.
    '''
    test_core = core.Core(100)
    # add instructions to core
    test_core.set_at(
        0,
        instruction.Instruction(None, test_core.size, "NOP", modifier, "$", 1,
                                "$", 2))
    test_core.set_at(
        1,
        instruction.Instruction(None, test_core.size, "ADD", "B", "#", 3, "*",
                                4))
    test_core.set_at(
        2,
        instruction.Instruction(None, test_core.size, "MOV", "AB", "{", 5, "}",
                                7))
    # execute only the first instruction
    test_core.execute(0)
    # check if it was executed correctly (if no blocks have been changed)
    assert test_core.get_at(0) == instruction.Instruction(
        None, test_core.size, "NOP", modifier, "$", 1, "$", 2)
    assert test_core.get_at(1) == instruction.Instruction(
        None, test_core.size, "ADD", "B", "#", 3, "*", 4)
    assert test_core.get_at(2) == instruction.Instruction(
        None, test_core.size, "MOV", "AB", "{", 5, "}", 7)
    for i in range(3, 100):
        assert test_core.get_at(i) == instruction.Instruction(
            None, test_core.size, "DAT", "F", "$", 0, "$", 0)
示例#4
0
    def __init__(self):
        self.reading_calibration = True

        # Initialise wiimote, will be created at beginning of loop.
        self.wiimote = None
        # Instantiate CORE / Chassis module and store in the launcher.
        self.core = core.Core(VL53L0X.tof_lib)

        GPIO.setwarnings(False)
        self.GPIO = GPIO

        self.challenge = None
        self.challenge_thread = None

        # Shutting down status
        self.shutting_down = False

        self.killed = False

        # WiiMote LED counter to indicate mode
        # NOTE: the int value will be shown as binary on the wiimote.
        self.MODE_NONE = 1
        self.MODE_RC = 2
        self.MODE_WALL = 3
        self.MODE_MAZE = 4
        self.MODE_CALIBRATION = 5

        self.mode = self.MODE_NONE

        # create oled object, nominating the correct I2C bus, default address
        self.oled = ssd1306(VL53L0X.i2cbus)
示例#5
0
def chech_for_modifier(modifier):
    '''
    Initialize core with 100 blocks.
    Core is automatically initialized with DAT.F $0, $0.
    Only 3 blocks are required, but MOD core_size is being applied to some operations,
    so core_size must be greater.
    '''
    test_core = core.Core(100)
    test_warior = warior.Warior("test_warior", "#ff0000")
    test_core.add_warior(test_warior)
    # add instruction to core
    test_core.set_at(
        0,
        instruction.Instruction(test_warior, test_core.size, "DAT", modifier,
                                "$", 0, "$", 0))
    # execute only the first instruction
    test_core.execute_current_ins()
    # check if it was executed correctly (if no blocks have been changed)
    assert test_core.get_at(0) == instruction.Instruction(
        test_warior, test_core.size, "DAT", modifier, "$", 0, "$", 0)
    for i in range(1, 100):
        assert test_core.get_at(i) == instruction.Instruction(
            None, test_core.size, "DAT", "F", "$", 0, "$", 0)
    # check if process has been terminated
    assert len(test_warior.processes) == 0
示例#6
0
    def exists(bHash):
        '''
            Checks if a block is saved to file or not

            Inputs:
            - hash (str/Block):
              - if (Block): check if this block is saved to file
              - if (str): check if a block by this hash is in file

            Outputs:
            - (bool): whether or not the block file exists
        '''

        # no input data? scrap it.
        if bHash is None:
            return False
        '''
        if type(hash) == Block:
            blockfile = hash.getBlockFile()
        else:
            blockfile = onionrcore.Core().dataDir + 'blocks/%s.dat' % hash
        '''
        if isinstance(bHash, Block):
            bHash = bHash.getHash()

        ret = isinstance(onionrstorage.getData(onionrcore.Core(), bHash),
                         type(None))

        return not ret
示例#7
0
def test_a_zero():
    '''
    Initialize core with 100 blocks.
    Core is automatically initialized with DAT.F $0, $0.
    Only 3 blocks are required, but MOD core_size is being applied to some operations,
    so core_size must be greater.
    '''
    test_core = core.Core(100)
    test_warior = warior.Warior("test_warior", "#ff0000")
    test_core.add_warior(test_warior)
    # add instructions to core
    test_core.set_at(
        0,
        instruction.Instruction(test_warior, test_core.size, "MOD", "A", "$",
                                1, "$", 2))
    test_core.set_at(
        1,
        instruction.Instruction(None, test_core.size, "ADD", "B", "#", 0, "*",
                                4))
    test_core.set_at(
        2,
        instruction.Instruction(None, test_core.size, "SUB", "AB", "{", 5, "}",
                                7))
    # execute only the first instruction
    test_core.execute_current_ins()
    # check if it was executed correctly (if process has been terminated)
    assert len(test_warior.processes) == 0
示例#8
0
    def getBlocks(type=None,
                  signer=None,
                  signed=None,
                  reverse=False,
                  core=None):
        '''
            Returns a list of Block objects based on supplied filters

            Inputs:
            - type (str): filters by block type
            - signer (str/list): filters by signer (one in the list has to be a signer)
            - signed (bool): filters out by whether or not the block is signed
            - reverse (bool): reverses the list if True
            - core (Core): lets you optionally supply a core instance so one doesn't need to be started

            Outputs:
            - (list): a list of Block objects that match the input
        '''

        try:
            core = (core if not core is None else onionrcore.Core())

            relevant_blocks = list()
            blocks = (core.getBlockList()
                      if type is None else core.getBlocksByType(type))

            for block in blocks:
                if Block.exists(block):
                    block = Block(block, core=core)

                    relevant = True

                    if (not signed is None) and (block.isSigned() !=
                                                 bool(signed)):
                        relevant = False
                    if not signer is None:
                        if isinstance(signer, (str, )):
                            signer = [signer]

                        isSigner = False
                        for key in signer:
                            if block.isSigner(key):
                                isSigner = True
                                break

                        if not isSigner:
                            relevant = False

                    if relevant:
                        relevant_blocks.append(block)

            if bool(reverse):
                relevant_blocks.reverse()

            return relevant_blocks
        except Exception as e:
            logger.debug(('Failed to get blocks: %s' % str(e)) +
                         logger.parse_error())

        return list()
示例#9
0
def test_ab():
    '''
    Initialize core with 100 blocks.
    Core is automatically initialized with DAT.F $0, $0.
    Only 3 blocks are required, but MOD core_size is being applied to some operations,
    so core_size must be greater.
    '''
    test_core = core.Core(100)
    # add instructions to core
    test_core.set_at(
        0,
        instruction.Instruction(None, test_core.size, "MOD", "AB", "$", 1, "$",
                                2))
    test_core.set_at(
        1,
        instruction.Instruction(None, test_core.size, "ADD", "B", "#", 3, "*",
                                4))
    test_core.set_at(
        2,
        instruction.Instruction(None, test_core.size, "SUB", "AB", "{", 5, "}",
                                7))
    # execute only the first instruction
    test_core.execute(0)
    # check if it was executed correctly (if third block was updated with correct values)
    assert test_core.get_at(2) == instruction.Instruction(
        None, test_core.size, "SUB", "AB", "{", 5, "}", 1)
示例#10
0
    def __init__(self):
        self.reading_calibration = True

        # Initialise wiimote, will be created at beginning of loop.
        self.wiimote = None
        # Instantiate CORE / Chassis module and store in the launcher.
        self.core = core.Core(VL53L0X.tof_lib)

        GPIO.setwarnings(False)
        self.GPIO = GPIO

        self.challenge = None
        self.challenge_thread = None

        # Shutting down status
        self.shutting_down = False

        self.killed = False

        # Mode/Challenge Dictionary
        self.menu_list = OrderedDict((
            (Mode.MODE_POWER, "Power Off"),
            (Mode.MODE_RC, "RC"),
            (Mode.MODE_WALL, "Wall"),
            (Mode.MODE_MAZE, "Maze"),
            (Mode.MODE_CALIBRATION, "Calibration")
        ))
        self.current_mode = Mode.MODE_NONE
        self.menu_mode = Mode.MODE_RC

        # Create oled object, nominating the correct I2C bus, default address
        # Note: Set to None if you need to disable screen
        self.oled = ssd1306(VL53L0X.i2cbus)
示例#11
0
def main(port=4118, parentpid=None):
    """Main entry point. Parse command line options and start up a server."""
    if os.environ.has_key("LDTP_DEBUG"):
        _ldtp_debug = True
    else:
        _ldtp_debug = False
    _ldtp_debug_file = os.environ.get('LDTP_DEBUG_FILE', None)
    server = LDTPServer(('', port),
                        allow_none=True,
                        logRequests=_ldtp_debug,
                        requestHandler=RequestHandler)
    server.register_introspection_functions()
    server.register_multicall_functions()
    ldtp_inst = core.Core()
    server.register_instance(ldtp_inst)
    if parentpid:
        thread.start_new_thread(notifyclient, (parentpid, ))
    try:
        server.serve_forever()
    except KeyboardInterrupt:
        pass
    except:
        if _ldtp_debug:
            print(traceback.format_exc())
        if _ldtp_debug_file:
            with open(_ldtp_debug_file, "a") as fp:
                fp.write(traceback.format_exc())
示例#12
0
 def pow(self, reporting=False):
     startTime = math.floor(time.time())
     self.hashing = True
     self.reporting = reporting
     iFound = False  # if current thread is the one that found the answer
     answer = ''
     heartbeat = 200000
     hbCount = 0
     myCore = core.Core()
     while self.hashing:
         rand = nacl.utils.random()
         token = nacl.hash.blake2b(rand + self.data).decode()
         #print(token)
         if self.puzzle == token[0:self.difficulty]:
             self.hashing = False
             iFound = True
             break
     else:
         logger.debug('POW thread exiting, another thread found result')
     if iFound:
         endTime = math.floor(time.time())
         if self.reporting:
             logger.info('Found token ' + token, timestamp=True)
             logger.info('rand value: ' + base64.b64encode(rand).decode())
             logger.info('took ' + str(endTime - startTime) + ' seconds',
                         timestamp=True)
         self.result = (token, rand)
示例#13
0
def upload_file():
    if request.method == 'POST':
        # check if the post request has the file part
        if 'file' not in request.files:
            flash('No file part')
            return redirect(request.url)
        file = request.files['file']

        if file.filename == '':
            flash('No file selected for uploading')
            return redirect(request.url)

        if file and allowed_file(file.filename):
            file.save(file.filename)

            nuc = core.Core(file.filename)

            flash(f"mass = {nuc.mass} gr")
            flash(f"day = {nuc.day}")

            os.remove(file.filename)
            return redirect('/')

        else:
            flash('Allowed file types are txt, pdf, png, jpg, jpeg, gif')
            return redirect(request.url)
示例#14
0
    def __init__(self, data, forceDifficulty=0, threadCount=1):
        self.foundHash = False
        self.difficulty = 0
        self.data = data
        self.threadCount = threadCount
        self.rounds = 0

        if forceDifficulty == 0:
            dataLen = sys.getsizeof(data)
            self.difficulty = math.floor(dataLen / 1000000)
            if self.difficulty <= 2:
                self.difficulty = 4
        else:
            self.difficulty = forceDifficulty

        try:
            self.data = self.data.encode()
        except AttributeError:
            pass

        self.data = nacl.hash.blake2b(self.data)

        logger.info('Computing POW (difficulty: %s)...' % self.difficulty)

        self.mainHash = '0' * 70
        self.puzzle = self.mainHash[0:min(self.difficulty, len(self.mainHash))]

        myCore = core.Core()
        for i in range(max(1, threadCount)):
            t = threading.Thread(name='thread%s' % i,
                                 target=self.pow,
                                 args=(True, myCore))
            t.start()
示例#15
0
def reset_tor():
    c = core.Core()
    tor_dir = c.dataDir + 'tordata'
    if os.path.exists(tor_dir):
        if c._utils.localCommand('/ping') == 'pong!':
            logger.warn('Cannot delete Tor data while Onionr is running')
        else:
            shutil.rmtree(tor_dir)
示例#16
0
文件: __init__.py 项目: mit2nil/rltk
def init():
    """
    Initialization method.

    Returns:
        object: RLTK object
    """
    return core.Core()
示例#17
0
文件: run_core.py 项目: vlall/etk
def run_parallel_worker(worker_id, input_chunk_path, output_chunk_path,
                        config_path):
    print 'start worker #{}'.format(worker_id)
    c = core.Core(json.load(codecs.open(config_path, 'r')))
    run_serial(input_chunk_path,
               output_chunk_path,
               c,
               prefix='worker #{}:'.format(worker_id))
    print 'worker #{} finished'.format(worker_id)
示例#18
0
文件: arnf.py 项目: elemenohpi/ARNF
def main():
    print("\n\n######################################################\n")
    print("ARNF V1.0b \n")
    print("######################################################\n")

    print("Parsing the arguements...\n")

    argParser = argparse.ArgumentParser(
        description="A tool to study Artificial Regulatory Networks.")
    argParser.add_argument(
        '-gc',
        '--generateConfig',
        help=
        "Generates the default config.ini file. Note: removes the existing file.",
        action="store_true")
    argParser.add_argument(
        '-gus',
        '--generateUniqueSeq',
        help=
        "Generates the default inputs.ini file. Note: removes the existing file.",
        action="store_true")
    argParser.add_argument(
        '-sp',
        '--simplePlot',
        help=
        "Plots the files on the output folder. Can have these values: Task, Evolution"
    )
    args = argParser.parse_args()

    if args.generateConfig:
        generateConfig()
        print("ARNF: config.ini generated. Exiting!\n")
        exit(1)

    if args.generateUniqueSeq:
        generateUniqueSeq()
        print("ARNF: inputs.ini generated. Exiting!\n")
        exit(1)

    if args.simplePlot:
        Plotter = PL.Plotter()
        Plotter.simplePlot(args.simplePlot)
        print("ARNF: Plot generated. Exiting!\n")
        exit(1)

    print("Running the core...\n")

    if not os.path.isfile("config.ini"):
        print("ARNF: config.ini file does not exist! Exiting!\n")
        exit(1)

    configParser = configparser.ConfigParser()
    configParser.read("config.ini")
    random.seed(configParser['CORE']['seed'])
    coreObj = core.Core()
    coreObj.run()
示例#19
0
    def testHashValidation(self):
        logger.debug('-'*26 + '\n')
        logger.info('Running hash validation test...')

        import core
        myCore = core.Core()
        if not myCore._utils.validateHash("$324dfgfdg") and myCore._utils.validateHash("f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2") and not myCore._utils.validateHash("f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd$"):
            self.assertTrue(True)
        else:
            self.assertTrue(False)
示例#20
0
    def __init__(self, target, ing):

        self.target = target
        self.empty_gui = False
        self.version = VERSION
        self.ing = ing

        self.uicore = core.Core()

        # Check if target name is an URL, pyew stores it as 'raw'
        self.uicore.is_url(self.target)

        if self.target:
            # Just open the target if path is correct or an url
            if self.uicore.pyew.format != 'URL' and not os.path.isfile(
                    self.target):
                print "Incorrect file argument:", FAIL, self.target, ENDC
                sys.exit(1)

            # Use threads to avoid freezing the GUI load
            thread = threading.Thread(target=self.load_file,
                                      args=(self.target, ))
            thread.start()
            # This call must not depend on load_file data
            GObject.timeout_add(500, self.show_file_data, thread)
        else:
            self.empty_gui = True

        Gtk.Settings.get_default().set_long_property("gtk-button-images", True,
                                                     "main")

        # Create VBox to contain top buttons and other VBox
        self.supervb = Gtk.VBox(False, 1)

        # Create top buttons and add to VBox
        self.topbuttons = self.ing.bokken_tb

        # Create VBox to contain textviews and statusbar
        self.mainvb = Gtk.VBox(False, 1)
        self.supervb.pack_start(self.mainvb, True, True, 1)

        # Initialize and add TextViews
        self.tviews = textviews.TextViews(self.uicore)

        # Add textviews and statusbar to the VBox
        self.mainvb.pack_start(self.tviews, True, True, 1)

        # Start the throbber while the thread is running...
        self.topbuttons.throbber.running(True)

        # Disable all until file loads
        self.disable_all()

        if self.empty_gui:
            self.show_empty_gui()
    def __init__(self, window):

        QtCore.QObject.__init__(self)

        # print('main thread id: {}'.format(QtCore.QThread.currentThreadId()))
        self.window = window
        self.core = core.Core()

        self.settings = QSettings('settings.ini', QSettings.IniFormat)

        self.previewQueue = Queue()

        self.previewThread = QtCore.QThread(self)
        self.previewWorker = preview_thread.Worker(self, self.previewQueue)

        self.previewWorker.moveToThread(self.previewThread)
        self.previewWorker.imageCreated.connect(self.showPreviewImage)

        self.previewThread.start()

        self.timer = QtCore.QTimer(self)
        self.timer.timeout.connect(self.processTask.emit)
        self.timer.start(500)

        window.pushButton_selectInput.clicked.connect(self.openInputFileDialog)
        window.pushButton_selectOutput.clicked.connect(
            self.openOutputFileDialog)
        window.pushButton_createVideo.clicked.connect(
            self.createAudioVisualisation)
        window.pushButton_selectBackground.clicked.connect(
            self.openBackgroundFileDialog)

        window.fontComboBox.currentFontChanged.connect(self.drawPreview)
        window.lineEdit_title.textChanged.connect(self.drawPreview)

        window.progressBar_create.setValue(0)
        window.setWindowTitle("Audio Visualizer")
        window.pushButton_selectInput.setText("Select Input Music File")
        window.pushButton_selectOutput.setText("Select Output Video File")
        window.pushButton_selectBackground.setText("Select Background Image")
        window.label_font.setText("Title Font")
        window.label_title.setText("Title Text")
        window.pushButton_createVideo.setText("Create Video")
        window.groupBox_create.setTitle("Create")
        window.groupBox_settings.setTitle("Settings")
        window.groupBox_preview.setTitle("Preview")

        titleFont = self.settings.value("titleFont")
        if not titleFont == None:
            window.fontComboBox.setCurrentFont(QFont(titleFont))

        self.drawPreview()

        window.show()
示例#22
0
    def test_pubkey_validator(self):
        # Test ed25519 public key validity
        valid = 'JZ5VE72GUS3C7BOHDRIYZX4B5U5EJMCMLKHLYCVBQQF3UKHYIRRQ===='
        invalid = [None, '', '    ', 'dfsg', '\n', 'JZ5VE72GUS3C7BOHDRIYZX4B5U5EJMCMLKHLYCVBQQF3UKHYIR$Q====']
        c = core.Core()
        print('testing', valid)
        self.assertTrue(c._utils.validatePubKey(valid))

        for x in invalid:
            #print('testing', x)
            self.assertFalse(c._utils.validatePubKey(x))
示例#23
0
    def __init__(self, onionr, data):
        self.onionr = onionr
        self.data = data
        if self.onionr is None:
            self.core = onionrcore.Core()
        else:
            self.core = self.onionr.onionrCore

        self.daemon = DaemonAPI(self)
        self.plugins = PluginAPI(self)
        self.commands = CommandAPI(self)
示例#24
0
    def test_integer_string(self):
        valid = ["1", "100", 100, "-5", -5]
        invalid = ['test', "1d3434", "1e100", None]
        c = core.Core()

        for x in valid:
            #print('testing', x)
            self.assertTrue(c._utils.isIntegerString(x))   
        
        for x in invalid:
            #print('testing', x)
            self.assertFalse(c._utils.isIntegerString(x))
示例#25
0
    def testPeer_b_addPeerToDB(self):
        logger.debug('-'*26 + '\n')
        logger.info('Running peer db insertion test...')

        import core
        myCore = core.Core()
        if not os.path.exists('data/peers.db'):
            myCore.createPeerDB()
        if myCore.addPeer('6M5MXL237OK57ITHVYN5WGHANPGOMKS5C3PJLHBBNKFFJQOIDOJA====') and not myCore.addPeer('NFXHMYLMNFSAU==='):
            self.assertTrue(True)
        else:
            self.assertTrue(False)
示例#26
0
def connect(parent_stage, core1_id, core2_id):  # Connects two cores (automatically creates the connection core)
    con_id = '???' # what would be the id of the new connection core??

    x = (core1_id.loc[0] + core2_id.loc[
        0]) / 2  # Calculate the location of the connection's core based on the location of the two cores to be connected
    y = (core1_id.loc[1] + core2_id.loc[1]) / 2
    con_loc = [x, y]

    con_id = core.Core(x, y)  # create new core
    app_connect(con_id, core1_id, core2_id)  # add a connection Rune to it

    core1_id.conns.append(con_id)  # store the connection's id in each connected core
    core2_id.conns.append(con_id)
示例#27
0
    def testPeer_a_DBCreation(self):
        logger.debug('-'*26 + '\n')
        logger.info('Running peer db creation test...')

        if os.path.exists('data/peers.db'):
            os.remove('data/peers.db')
        import core
        myCore = core.Core()
        myCore.createPeerDB()
        if os.path.exists('data/peers.db'):
            self.assertTrue(True)
        else:
            self.assertTrue(False)
示例#28
0
    def _process_modules(self):
        response = ''
        for k, v in self.doc['module'].iteritems():
            if k == 'core':
                response += core.Core().process_core(v)
            else:
                status = mod.ModuleHome().module_status(k)
                core.Common().add_to_log("2", "Application",
                                         "Module: " + k + " Status: " + status)
                if status == "active":
                    modx = __import__(k)
                    response += modx.Main().process_request(v)

        return response
示例#29
0
    def testData_a_Decrypt(self):
        self.assertTrue(True)
        return

        logger.debug('-'*26 + '\n')
        logger.info('Running data dir decrypt test...')

        import core
        myCore = core.Core()
        myCore.dataDirDecrypt('password')
        if os.path.exists('data/'):
            self.assertTrue(True)
        else:
            self.assertTrue(False)
示例#30
0
def main():
    org = input('path to the target image : ')
    new = input('path to save the result  : ')
    loo = int(input('how far you want to reduce the image : '))

    imob = imager.Imager(org, new)
    coob = core.Core(imob)
    build = coob.buildseam
    remove = coob.image.removeSeam
    dp = coob.DP
    for i in range(loo):
        print(i)
        seam = build(dp())
        remove(seam)
    imob.crop(loo)