Example #1
0
def main():
    create_dir(NETWORK_DIR)

    # delete old data
    print("=== reset old data ===")
    reset = Reset(NODE_DIR)
    reset.reset()

    # Create new data folder
    print("=== create env folder ===")
    env = Env(NUM_OF_NODE, NODE_DIR)
    env.create()

    # Create Account
    print("=== create accounts ===")
    account = Account(NODE_DIR, NETWORK_DIR)
    account.create()

    # Init Geth(Genesis)
    print("=== init genesis ===")
    genesis = Genesis(GENESIS_FILE, NETWORK_ID, NODE_DIR, INITIAL_BALANCE)
    genesis.create_genesis_json(account.public_key_list)
    genesis.init_geth()

    # Create_network
    print("=== create network ===")
    network = Network(**NETWORK_PARAMS)
    network.create_network()

    # Validate network
    print("=== validate network ===")
    rpc_ip = NETWORK_PARAMS["rpc"]["ip"]
    w3 = Web3(HTTPProvider(f"http://{rpc_ip}:10000"))
    print(w3.net.peerCount)
Example #2
0
 def resetActionExec(self, window, item):
     msg = QtGui.QMessageBox()
     msg.setText(QtGui.QApplication.translate(
                             "ImportWindow", "Are you sure you want to reset selected serie?", None,
                             QtGui.QApplication.UnicodeUTF8))
     msg.setStandardButtons(msg.No | msg.Yes)
     msg.setDefaultButton(msg.No)
     msg.show()
     msgResult = msg.exec_()
     if msgResult == msg.Yes:
         series = self.getSeriesFromItem(item)
         reset = Reset(self)
         reset.processReset(series[0])
Example #3
0
def main():
    suites = []
    suites.append(eventlist.suite())
    suites.append(filesystem.suite())
    suites.append(photo.suite())
    suites.append(importer.suite())
    suites.append(config.suite())
    allTests = unittest.TestSuite(suites)
    runner = unittest.TextTestRunner()
    reset = Reset()
    reset.fill() #fill imagesdir with images
    runner.run(allTests)
    reset.empty() #delete images in imagesdir
Example #4
0
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
print 'forge.py'
import sys
import datetime
from reset import Reset
reset = Reset()
device = reset.device

load_MoLi1 = MonkeyRunner.loadImageFromFile('./MoLi1.png','png') 
load_MoLi2 = MonkeyRunner.loadImageFromFile('./MoLi2.png','png') 
load_MoLi3 = MonkeyRunner.loadImageFromFile('./MoLi3.png','png') 

def checkForge():
    print 'check forge'
    img = device.takeSnapshot()
    #img = img.getSubImage((414,130,94,26))
    #img = img.getSubImage((414,176,94,26))
    img = img.getSubImage((414,222,94,26))
    img.writeToFile('./' + datetime.datetime.now().strftime("%Y%m%d%H%M%S") + '.png')
    if (img.sameAs(load_MoLi3, 0.9)):
        print 'MoLi'
    else:
        return True

play = True
while play:
    reset.resetGame(device)
    device.drag((700,555),(100,555),0.1,1); print 'swipe left'; MonkeyRunner.sleep(1);
    device.drag((700,555),(100,555),0.1,1); print 'swipe left'; MonkeyRunner.sleep(1);
    device.touch(270,800, MonkeyDevice.DOWN_AND_UP); print 'click NPC'; MonkeyRunner.sleep(1);
    device.touch(200,700, MonkeyDevice.DOWN_AND_UP); print 'choice forge'; MonkeyRunner.sleep(1);
Example #5
0
from portfolio import Portfolio
from settings_page import SettingsPage
from confirmation import Confirmation
from reset import Reset
from unlock import Unlock
from sassutils.wsgi import SassMiddleware

app = Flask(__name__)
app.secret_key == os.urandom(24)
app.wsgi_app = SassMiddleware(
    app.wsgi_app,
    {__name__: ("static/sass", "static/stylesheets", "static/stylesheets")},
)

app.add_url_rule("/", view_func=Index.as_view("index"), methods=["GET"])
app.add_url_rule("/portfolio",
                 view_func=Portfolio.as_view("portfolio"),
                 methods=["GET"])
app.add_url_rule("/settings",
                 view_func=SettingsPage.as_view("settings"),
                 methods=["GET"])
app.add_url_rule("/confirmation",
                 view_func=Confirmation.as_view("confirmation"),
                 methods=["GET"])
app.add_url_rule("/reset", view_func=Reset.as_view("reset"), methods=["GET"])
app.add_url_rule("/unlock",
                 view_func=Unlock.as_view("unlock"),
                 methods=["GET"])
if __name__ == "__main__":
    app.run(debug=True)
Example #6
0
            if (settings.RPC().isEnabled() and CBool(request["playing"])):
                RPC.update(details=request["title"],
                           state="by " + request["artist"],
                           large_image="icon",
                           large_text="made by dripnyan")
            else:
                RPC.clear()

        self.wfile.write(json.dumps(request).encode("utf-8"))

    def log_message(self, format, *args):
        return


def CBool(value):
    if isinstance(value, str) and value.lower() == "false":
        return False
    return bool(value)


def conv(request):
    request = json.dumps(request).replace("[", "").replace("]", "")
    return json.loads(request)


try:
    server = HTTPServer(("", 8000), JsonResponseHandler)
    server.serve_forever()
except KeyboardInterrupt:
    Reset()