Exemple #1
0
def display_faction(faction):
    if faction == 'anarch':
        return style('', ['anarch'])
    elif faction == 'criminal':
        return style('', ['criminal'])
    elif faction == 'shaper':
        return style('', ['shaper'])
    elif faction == 'haas-bioroid':
        return style('', ['haas-bioroid'])
    elif faction == 'jinteki':
        return style('', ['jinteki'])
    elif faction == 'nbn':
        return style('', ['nbn'])
    elif faction == 'weyland-consortium':
        return style('', ['weyland-consortium'])
    elif faction == 'adam':
        return style('', ['adam'])
    elif faction == 'sunny-lebeau':
        return style('', ['sunny-lebeau'])
    elif faction == 'apex':
        return style('', ['apex'])
    elif faction.startswith('neutral'):
        return ' '
    else:
        return '?'
Exemple #2
0
    def __init__(self, *args, **kwargs):
        super(win, self).__init__(*args, **kwargs)
        self.Show()
        self.SetIcon(wx.Icon("icons/icon.ico"))
        self.Center()
        # self.SetSize(1000,600)
        self.Maximize(True)

        self.cfg = configparser.RawConfigParser()
        self.cfg.read('style.cfg')
        self.par = dict(self.cfg.items("settings"))
        for p in self.par:
            self.par[p] = self.par[p].split("#", 1)[0].strip()

        globals().update(self.par)

        self.statusbar = self.CreateStatusBar(3)
        self.statusbar.SetStatusWidths([-1, -4, -1])
        self.statusbar.SetBackgroundColour('#BDBDBD')
        self.statusbar.SetForegroundColour('#FFFFFF')
        self.timer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.statlineinfo)
        self.timer.Start(40)
        self.Bind(wx.EVT_CLOSE, self.close)
        menu.Menu(self)
        style.style(self)
        self.init()
Exemple #3
0
def testDB():
    style("Testing connection")
    ping = redis.ping()
    if ping == True:
        print("Redis DB connected!")
    else:
        print("DB not conencted!")
def Rflush():
    style("REDIS flush")
    print("Are you sure?")
    i = input()
    if i == 'yes':
        redis.flushall()
        print("DB flushed")
    else:
        pass
def Rget():
    style("REDIS get")
    print("format : get key")
    cmd, key = input("> ").split()

    if (cmd == 'get'):
        if key:
            if (redis.get(key)):
                print(redis.get(key).decode("utf-8"))
            else:
                print("(nil)")
        else:
            print("provide key")
    else:
        print("wrong format")
def Rzrank():
    style("REDIS zrank")
    print("Format : zrank key member")
    cmd, key, member = input("> ").split()

    if (cmd=='zrank'):
        if key:
            if member:
                print(redis.zrank(key, member))
            else:
                print("provide member")
        else:
            print("provide key")
    else:
        print("wrong format")
Exemple #7
0
 def awaitLiquidity(self):
     spinner = Halo(text='await Liquidity', spinner=spinneroptions)
     spinner.start()
     while True:
         sleep(0.07)
         try:
             self.TXN.getOutputfromBNBtoToken()[0]
             spinner.stop()
             break
         except Exception as e:
             print(e)
             if "UPDATE" in str(e):
                 print(e)
                 sys.exit()
             continue
     print(style().GREEN+"[DONE] Liquidity is Added!"+ style().RESET)
def Rset():
    style("REDIS set")
    print("format : set key value")
    cmd, key, value = input("> ").split()

    if (cmd == 'set'):
        if key:
            if value:
                redis.set(key, value)
                print("OK")
            else:
                print("provide value")
        else:
            print("provide key")
    else:
        print("wrong format")
Exemple #9
0
    def relayout(self):
        self.timer.start("Style")
        style(self.nodes, self.rules)
        self.timer.stop()

        self.page = Page()
        self.layout = BlockLayout(self.page, self.nodes)
        self.timer.start("Layout1")
        self.layout.layout1()
        self.timer.stop()
        self.timer.start("Layout2")
        self.layout.layout2(0)
        self.timer.stop()
        self.maxh = self.layout.height()
        self.timer.start("Display list")
        self.display_list = self.layout.display_list()
        self.timer.stop()
        self.render()
Exemple #10
0
 def awaitBlocks(self):
     spinner = Halo(text='await Blocks', spinner=spinneroptions)
     spinner.start()
     waitForBlock = self.TXN.getBlockHigh() + self.wb
     while True:
         sleep(0.13)
         if self.TXN.getBlockHigh() > waitForBlock:
             spinner.stop()
             break
     print(style().GREEN+"[DONE] Wait Blocks finish!")
Exemple #11
0
def Rzadd():
    style("REDIS zadd")
    print("Format : zadd key score member")
    cmd, key, score, member = input("> ").split()

    if (cmd == 'zadd'):
        if key:
            if score:
                if member:
                    redis.zadd(key, {member: score})
                    print("OK")
                else:
                    print("provide member")
            else:
                print("provide score")
        else:
            print("provide key")
    else:
        print("wrong format")
Exemple #12
0
def Rsetex():
    style("REDIS setex")
    print("Format : setex key expire value")
    cmd, key, expire, value = input("> ").split()

    if (cmd == 'setex'):
        if key:
            if expire:
                if value:
                    redis.setex(key, expire, value)
                    print("OK")
                else:
                    print("provide value")
            else:
                print("provide expire time")
        else:
            print("provide key")
    else:
        print("wrong format")
Exemple #13
0
 def awaitTrailingStopLoss(self):
     highestLastPrice = 0
     while True:
         sleep(0.3)
         try:
             LastPrice = float(self.TXN.getOutputfromTokentoBNB()[0] / (10**18))
             if LastPrice > highestLastPrice:
                 highestLastPrice = LastPrice
                 TrailingStopLoss = self.calcNewTrailingStop(LastPrice)
             if LastPrice < TrailingStopLoss:
                 print(style().GREEN+"[TRAILING STOP LOSS] Triggert!"+ style().RESET)
                 self.awaitSell()
                 break
             print("Sell below","{0:.8f}".format(TrailingStopLoss),"| CurrentOutput:", "{0:.8f}".format(LastPrice), end="\r")
         except Exception as e:
             if "UPDATE" in str(e):
                 print(e)
                 sys.exit()
     print(style().GREEN+"[DONE] TrailingStopLoss Finished!"+ style().RESET)
Exemple #14
0
def mainMenu():
    again = 'yes'
    while (again == 'yes'):
        style("Choose commands : ")
        print("1. redis get")
        print("2. redis set")
        print("3. redis setex")
        print("4. redis zadd")
        print("5. redis zrange")
        print("6. redis zrank")
        print("7. Redis flush")
        print("--")
        print("8. Back")
        print("9. Exit")
        print()
    
        ch2 = int(input("> "))
        print()

        if ch2==1:
            Rget()
        elif ch2==2:
            Rset()
        elif ch2==3:
            Rsetex()
        elif ch2==4:
            Rzadd()
        elif ch2==5:
            Rzrange()
        elif ch2==6:
            Rzrank()
        elif ch2==7:
            Rflush()
        elif ch2==8:
            break
        elif ch2==9:
            exit()


        print()
        again = input("wanna play again? (yes/no) : ")
        print()
Exemple #15
0
def dbMenu():
    again = 'yes'
    while (again == 'yes'):
        style("Getting more of Redis DB")
        print("1. test connectivity")
        print("2. get current DB zise")
        print("3. get redis DB info")
        print("9. Exit")
        ch = int(input("> "))

        if ch == 1:
            testDB()
        if ch == 2:
            sizeDB()
        elif ch == 3:
            infoDB()
        elif ch == 9:
            exit()

        print()

        again = input("enquire more about redis DB? (yes/no) :")
def Rzrange():
    style("REDIS zrange")
    print("Format : zrange key from to")
    cmd, key, start, end = input("> ").split()

    if (cmd=='zrange'):
        if key:
            if start:
                if end:
                    data = redis.zrange(key, start, end)
                    if data:
                        for i in data:
                            print(i.decode('utf-8'))
                    else:
                        print("empty list or set")
                else:
                    print("provide end")
            else:
                print("provide expire start")
        else:
            print("provide key")
    else:
        print("wrong format")
Exemple #17
0
def main():
    print(styleDict['bold'])
    tprint("Hortum-CLI", font="cyberlarge")
    print(styleDict['clear'])
    print('''Developed by Aurora Long
2021
github
PRs Welcome!
''')
    while True:
        try:
            sess = PromptSession()
            print(
                style('loading' + style('...', ['blinking']),
                      ['bold', 'italic']))
            cards_r = requests.get(
                'https://netrunnerdb.com/api/2.0/public/cards')
            packs_r = requests.get(
                'https://netrunnerdb.com/api/2.0/public/packs')
            delete_last_line()
            cards = json.loads(cards_r.text)['data']
            packs = json.loads(packs_r.text)['data']
            card_names = list(map(lambda x: x['stripped_title'], cards))
            #autocomplete = reduce(lambda a,b: {**a,**b}, list(map(lambda x: reduce(lambda a,b: {b:a}, (x.split()+[None])[::-1]), card_names)))
            p = sess.prompt('> ',
                            completer=DeduplicateCompleter(
                                FuzzyWordCompleter(card_names)))
            #p = sess.prompt('> ', completer=DeduplicateCompleter(merge_completers([NestedCompleter.from_nested_dict(autocomplete),FuzzyWordCompleter(card_names)])), complete_while_typing=True)
            suggestions = list(fuzzyfinder(p.strip(), card_names))
            card = list(
                filter(lambda x: x['stripped_title'] == suggestions[0],
                       cards))[0]
            pack = list(filter(lambda x: x['code'] == card['pack_code'],
                               packs))[0]
            display_card(card, pack['cycle_code'], pack['name'])
        except KeyboardInterrupt:
            break
Exemple #18
0
    def __init__(self, iterations=1000, distance=1.0, layout=LAYOUT_SPRING):

        self.nodes = []
        self.edges = []
        self.root = None

        # Calculates positions for nodes.
        self.layout = layout_.__dict__[layout + "_layout"](self, iterations)
        self.d = node(None).r * 2.5 * distance

        # Hover, click and drag event handler.
        self.events = event.events(self, _ctx)

        # Enhanced dictionary of all styles.
        self.styles = style.styles(self)
        self.styles.append(style.style(style.DEFAULT, _ctx))
        self.alpha = 0

        # Try to specialize intensive math operations.
        try:
            import psyco
            psyco.bind(self.layout._bounds)
            psyco.bind(self.layout.iterate)
            psyco.bind(self.__or__)
            psyco.bind(cluster.flatten)
            psyco.bind(cluster.subgraph)
            psyco.bind(cluster.clique)
            psyco.bind(cluster.partition)
            psyco.bind(proximity.dijkstra_shortest_path)
            psyco.bind(proximity.brandes_betweenness_centrality)
            psyco.bind(proximity.eigenvector_centrality)
            psyco.bind(style.edge_arrow)
            psyco.bind(style.edge_label)
            #print "using psyco"
        except:
            pass

        self.times = {}
        self.times['other'] = 0.
        self.times['edges'] = 0.
        self.times['nodes'] = 0.
        self.times['events'] = 0.
        self.times['path'] = 0.
        self.times['node_ids'] = 0.
        self.times['iter'] = 0
    def __init__(self, iterations=1000, distance=1.0, layout=LAYOUT_SPRING):
        
        self.nodes = []
        self.edges = []
        self.root  = None
        
        # Calculates positions for nodes.
        self.layout = layout_.__dict__[layout+"_layout"](self, iterations)
        self.d = node(None).r * 2.5 * distance
        
        # Hover, click and drag event handler.
        self.events = event.events(self, _ctx)
        
        # Enhanced dictionary of all styles.
        self.styles = style.styles(self)
        self.styles.append(style.style(style.DEFAULT, _ctx))
        self.alpha = 0

        # Try to specialize intensive math operations.
        try:
            import psyco
            psyco.bind(self.layout._bounds)
            psyco.bind(self.layout.iterate)
            psyco.bind(self.__or__)
            psyco.bind(cluster.flatten)
            psyco.bind(cluster.subgraph)
            psyco.bind(cluster.clique)
            psyco.bind(cluster.partition)
            psyco.bind(proximity.dijkstra_shortest_path)
            psyco.bind(proximity.brandes_betweenness_centrality)
            psyco.bind(proximity.eigenvector_centrality)
            psyco.bind(style.edge_arrow)
            psyco.bind(style.edge_label)
            #print "using psyco"
        except:
            pass

        self.times = {}
        self.times['other'] = 0.
        self.times['edges'] = 0.
        self.times['nodes'] = 0.
        self.times['events'] = 0.
        self.times['path'] = 0.
        self.times['node_ids'] = 0.
        self.times['iter'] = 0
def render_to_image(html_source, css_source, height, width, renderer):
	tree = html.parse(html_source)
	rules = css.parse(css_source)

	styled_tree = style.style(tree, rules)

	layout_tree = [layout.build_layout_tree(node) for node in styled_tree if layout.get_display(node) is not layout.Display.NONE]

	root = layout.Dimensions.default()
	root.content.width = width

	for node in layout_tree:
		node.layout(root)

	renderer = painting.Renderer(width, height, renderer)
	image = renderer.render(layout_tree)

	return image
Exemple #21
0
 def StartUP(self):
     self.TXN = TXN(self.token, self.amountForSnipe)
     if args.sellonly:
         print("Start SellOnly, Selling Now all tokens!")
         inp = input("please confirm y/n\n")
         if inp.lower() == "y": 
             print(self.TXN.sell_tokens()[1])
             sys.exit()
         else:
             sys.exit()
     if args.buyonly:
         print(f"Start BuyOnly, buy now with {self.amountForSnipe}BNB tokens!")
         print(self.TXN.buy_token()[1])
         sys.exit()
     if args.nobuy != True:
         self.awaitLiquidity()
     honeyTax = self.getTaxHoneypot()
     if honeyTax[1] > self.settings["MaxSellTax"]:
         print(style().RED+"Token SellTax exceeds Settings.json, exiting!")
         sys.exit()
     if honeyTax[2] > self.settings["MaxBuyTax"]:
         print(style().RED+"Token BuyTax exceeds Settings.json, exiting!")
         sys.exit()
     if self.hp == True:
         print(style().YELLOW +"Checking Token is Honeypot..." + style().RESET)
         if honeyTax[0] == True:
             print(style.RED + "Token is Honeypot, exiting")
             sys.exit() 
         elif honeyTax[0] == False:
             print(style().GREEN +"[DONE] Token is NOT a Honeypot!" + style().RESET)
     if self.wb != 0: 
         self.awaitBlocks()
     if args.nobuy != True:
         self.awaitBuy()
     self.awaitApprove()
     if self.tsl != 0:
         self.awaitTrailingStopLoss()
         sys.exit()
     if self.stoploss != 0 or self.takeProfitOutput != 0:
         self.awaitProfitloss()
     print(style().GREEN + "[DONE] TradingTigers Sniper Bot finish!" + style().RESET)
Exemple #22
0
 def awaitProfitloss(self):
     TokenBalance = round(self.TXN.get_token_balance(),5)
     while True:
         sleep(0.3)
         try:
             Output = float(self.TXN.getOutputfromTokentoBNB()[0] / (10**18))
             print(f"Token Balance: {TokenBalance} current output:", "{0:.8f}".format(Output), end="\r")
             if self.takeProfitOutput != 0:
                 if Output >= self.takeProfitOutput:
                     print()
                     print(style().GREEN+"[TAKE PROFIT] Triggert!"+ style().RESET)
                     self.awaitSell()
                     break
             if self.stoploss != 0:
                 if Output <= self.stoploss:
                     print()
                     print(style().GREEN+"[STOP LOSS] Triggert!"+ style().RESET)
                     self.awaitSell()
                     break
         except Exception as e:
             if "UPDATE" in str(e):
                 print(e)
                 sys.exit()
     print(style().GREEN+"[DONE] TakeProfit/StopLoss Finished!"+ style().RESET)
Exemple #23
0
	print 'initFile.txt file does not exist, creating one. Modify it and run docmaker again.'
	fl = open('initFile.txt', 'w')
	fl.write('title: My Project\ndescription: My Project discription\n exclude:  Html  arxiv  CMakeFiles')
	fl.close()
	sys.exit()
#-----------------------------------------------------------

arg = ''
args = sys.argv
if(len(args) == 2): arg = args[1]
elif(len(args) == 1): arg = '.'
else: 
	print 'wrong argument: exiting'	
	sys.exit()

style.style()
dirList, title, description = initialize.init(arg)

writeTOC(dirList, arg)

for dirr in dirList:
	writeHeader(dirr)
	writeSource(dirr)
	writeFiles(dirr)

writeIndex(dirList)
writeMain(title, description)
writeBlank()

# table of content for each alphabet directory
al = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
Exemple #24
0
 def marked_node(s, node, alpha=1.0):
     style.style(None, _ctx).node(s, node, alpha)
     r = node.r * 0.3
     _ctx.fill(s.stroke)
     _ctx.oval(node.x - r, node.y - r, r * 2, r * 2)
Exemple #25
0
 def important_node(s, node, alpha=1.0):
     style.style(None, _ctx).node(s, node, alpha)
     r = node.r * 1.4
     _ctx.nofill()
     _ctx.oval(node.x - r, node.y - r, r * 2, r * 2)
Exemple #26
0
def display_title(title):
    return style(title, ['bold', 'underline'])
Exemple #27
0
def display_flavor(flavor):
    return style(
        flavor.replace('<champion>',
                       styleDict['dim']).replace('</champion>',
                                                 styleDict['clear']),
        ['dim', 'italic'])
Exemple #28
0
def display_type(card_type):
    return style(card_type.capitalize(), ['italic', 'bold'])
Exemple #29
0
    def __init__(self, args=None, data=None, single=True):
        self.style = style(single)
        self.data = data
        self.config = table_config()

        if None != args:
            if args.column_width == -1:
                try:
                    self.stdscr = curses.initscr()
                    curses.cbreak()
                    curses.noecho()
                    self.stdscr.keypad(1)
                    self.config.row_height, self.config.column_width = self.stdscr.getmaxyx(
                    )
                finally:
                    curses.nocbreak()
                    self.stdscr.keypad(0)
                    curses.echo()
                    curses.endwin()
            else:
                self.config.row_height = args.column_height
                self.config.column_width = args.column_width

            self.args = args
            self.config.file = args.file
            self.config.remove_quote = args.remove_quote
            self.config.block_quote == args.block_quote

            self.config.header_on_line = args.header_on_line
            self.config.data_on_line = args.data_on_line
            self.config.hide_comments = args.hide_comments
            self.config.hide_errors = args.hide_errors
            self.config.hide_whitespace = args.hide_whitespace
            self.config.no_clip = False
            self.config.delimiters['field'] = args.delimiter
            self.config.header = args.header
            self.config.footer = args.footer
            self.config.header_every = args.header_every
            #auto name columns
            if args.column_count > -1:
                self.config.column_count = args.column_count
                self.config.columns = []
                for n in range(0, self.config.column_count):
                    self.config.columns.append("column{}".format(n + 1))

            # when specifically setting columns up... iverrides auto naming columns
            if None != args.columns:
                self.config.set_columns(args.columns)

            if args.page > -1 and args.length > 1:
                self.config.starts_on = args.page * args.length + 1
            if self.args.line > -1:
                self.config.starts_on = args.line
            self.config.length = args.length

        else:
            self.args = None

        self.config.is_temp_file = False
        self.results = []

        self.format()
 def important_node(s, node, alpha=1.0):
     style.style(None, _ctx).node(s, node, alpha)
     r = node.r * 1.4
     _ctx.nofill()
     _ctx.oval(node.x-r, node.y-r, r*2, r*2)
Exemple #31
0
	sing_mins = [all_mins[k][i] for k in range(probes)]
	sing_avgs = [all_avgs[k][i] for k in range(probes)]
	res_mins.append(sum(sing_mins) / float(probes))
	res_avgs.append(sum(sing_avgs) / float(probes))
	std_avgs = [(all_avgs[k][i] - res_avgs[i])**2 for k in range(probes)]
	res_std_avgs.append(math.sqrt(sum(std_avgs) / float(probes)))
	std_mins = [(all_mins[k][i] - res_mins[i])**2 for k in range(probes)]
	res_std_mins.append(math.sqrt(sum(std_mins) / float(probes)))

res_avgs_low = [res_avgs[i] - res_std_avgs[i] for i in range(max_generation)]
res_avgs_high = [res_avgs[i] + res_std_avgs[i] for i in range(max_generation)]

res_mins_low = [res_mins[i] - res_std_mins[i] for i in range(max_generation)]
res_mins_high = [res_mins[i] + res_std_mins[i] for i in range(max_generation)]

style.style(matplotlib)
fig = plt.figure()
ax = fig.add_subplot(111)
plt.ylim(-6.5, -3.5)
plt.xlim(0, 20)
plt.plot(xs, res_mins, label = "minimum", c = "black")
plt.plot(xs, res_avgs, label = "średnia", c = "black", ls = "dashed")
plt.xlabel("Generacja")
plt.ylabel("Wartość funkcji")
plt.legend(loc = "best")
ax.set_xticks([0,4,8,12,16,20])
plt.grid()
#plt.fill_between(xs, res_avgs_high, res_avgs_low, facecolor='black', alpha=0.3)
plt.fill_between(xs, res_mins_high, res_mins_low, facecolor='black', alpha=0.3)
#plt.show()  
Exemple #32
0
 def get_style(self):
     #todo style object wrapper, even mutable style
     return style.style(self.lib.Item_getStyle(self.obj))
Exemple #33
0
def infoDB():
    style("Getting DB Info")
    data = redis.info()
    for key, value in data.items():
        print(key, ":", value)
Exemple #34
0
 def get_style(self):
     #todo style object wrapper, even mutable style
     return style.style(self.lib.Item_getStyle(self.obj))
Exemple #35
0
 def SayWelcome(self):
     print(style().YELLOW + ascii+ style().RESET)
     print(style().GREEN +"""Attention, You pay a 0.7% Tax on your swap amount!"""+ style().RESET)
     print(style().GREEN +"Start Sniper Tool with following arguments:"+ style().RESET)
     print(style().BLUE + "---------------------------------"+ style().RESET)
     print(style().YELLOW + "Amount for Buy:",style().GREEN + str(self.amount) + " BNB"+ style().RESET)
     print(style().YELLOW + "Token to Interact :",style().GREEN + str(self.token) + style().RESET)
     print(style().YELLOW + "Transaction to send:",style().GREEN + str(self.tx)+ style().RESET)
     print(style().YELLOW + "Amount per transaction :",style().GREEN + str("{0:.8f}".format(self.amountForSnipe))+ style().RESET)
     print(style().YELLOW + "Await Blocks before buy :",style().GREEN + str(self.wb)+ style().RESET)
     if self.tp != 0:
         print(style().YELLOW + "Take Profit Percent :",style().GREEN + str(self.tp)+ style().RESET)
         print(style().YELLOW + "Target Output for Take Profit:",style().GREEN +str("{0:.8f}".format(self.takeProfitOutput))+ style().RESET)
     if self.sl != 0:
         print(style().YELLOW + "Stop loss Percent :",style().GREEN + str(self.sl)+ style().RESET)
         print(style().YELLOW + "Sell if Output is smaller as:",style().GREEN +str("{0:.8f}".format(self.stoploss))+ style().RESET)
     print(style().BLUE + "---------------------------------"+ style().RESET)
 def marked_node(s, node, alpha=1.0):
     style.style(None, _ctx).node(s, node, alpha)
     r = node.r * 0.3
     _ctx.fill(s.stroke)
     _ctx.oval(node.x-r, node.y-r, r*2, r*2)
from style import style
from db import dbMenu
from commands import mainMenu

if __name__ == "__main__":
    cont = 'yes'
    while (cont == 'yes'):
        style(" Redis Hands-on ")
        print("1. Setup Redis")
        print("2. Play with Redis Commands")
        print("3. More on Redis DB")
        print("--")
        print("4. Exit")
        print()
        ch = int(input("> "))
        print()

        if (ch == 1):
            pass
        elif (ch == 2):
            mainMenu()
        elif (ch == 3):
            dbMenu()
        elif ch == 9:
            exit()

        print()
        cont = str(input("Run the entire program again? (yes/no) : "))
        print()