Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
UNSAFE_THEME_TAGS = ("implementation", "browser", "xul:browser", "xul:script")
SELF_CLOSING_TAGS = ("area", "base", "basefont", "br", "col", "frame", "hr",
"img", "input", "li", "link", "meta", "p", "param", )
SAFE_IFRAME_TYPES = ("content", "content-primary", "content-targetable", )
TAG_NOT_OPENED = "Tag (%s) being closed before it is opened."
DOM_MUTATION_HANDLERS = (
"ondomattrmodified", "ondomattributenamechanged",
"ondomcharacterdatamodified", "ondomelementnamechanged",
"ondomnodeinserted", "ondomnodeinsertedintodocument", "ondomnoderemoved",
"ondomnoderemovedfromdocument", "ondomsubtreemodified", )
UNSAFE_THEME_XBL = ("constructor", "destructor", "field", "getter",
"implementation", "setter", )
class MarkupParser(htmlparser.HTMLParser):
"""Parse and analyze the versious components of markup files."""
def __init__(self, err, strict=True, debug=False):
htmlparser.HTMLParser.__init__(self)
self.err = err
self.line = 0
self.strict = strict
self.debug = debug
self.context = None
self.xml_state = []
self.xml_line_stack = []
self.xml_buffer = []
self.xbl = False
#================================================================
console.append(search_actions)
order = request.vars.order or ''
if sortable:
if order and not order=='None':
tablename,fieldname = order.split('~')[-1].split('.',1)
sort_field = db[tablename][fieldname]
exception = sort_field.type in ('date','datetime','time')
if exception:
orderby = (order[:1]=='~' and sort_field) or ~sort_field
else:
orderby = (order[:1]=='~' and ~sort_field) or sort_field
head = TR(_class=ui.get('header'))
if selectable:
head.append(TH(_class=ui.get('default')))
for field in fields:
if columns and not str(field) in columns: continue
if not field.readable: continue
key = str(field)
header = headers.get(str(field),
hasattr(field,'label') and field.label or key)
if sortable:
if key == order:
key, marker = '~'+order, sorter_icons[0]
elif key == order[1:]:
marker = sorter_icons[1]
else:
marker = ''
header = A(header,marker,_href=url(vars=dict(
#================================================================
console.append(search_actions)
order = request.vars.order or ''
if sortable:
if order and not order=='None':
tablename,fieldname = order.split('~')[-1].split('.',1)
sort_field = db[tablename][fieldname]
exception = sort_field.type in ('date','datetime','time')
if exception:
orderby = (order[:1]=='~' and sort_field) or ~sort_field
else:
orderby = (order[:1]=='~' and ~sort_field) or sort_field
head = TR(_class=ui.get('header'))
if selectable:
head.append(TH(_class=ui.get('default')))
for field in fields:
if columns and not str(field) in columns: continue
if not field.readable: continue
key = str(field)
header = headers.get(str(field),
hasattr(field,'label') and field.label or key)
if sortable:
if key == order:
key, marker = '~'+order, sorter_icons[0]
elif key == order[1:]:
marker = sorter_icons[1]
else:
marker = ''
header = A(header,marker,_href=url(vars=dict(
# vars=dict(keywords=request.vars.keywords or ''))))
#================================================================
options =[]
for k,v in sorted(exportManager.items()):
if hasattr(v, "__getitem__"):
label = v[1]
else:
label = k
options.append(OPTION(T(label),_value=k))
##FIXME ?
mysignature = url(args=['export']).split('?', 1)
mysignature = psq(mysignature[-1]).get('_signature', [None])[-1]
f = FORM(BUTTON(SPAN(_class=ui.get('buttonexport')),
"Export", _type="submit", _class=ui.get('button')),
SELECT(options, _name="export_type"),
INPUT(_type="hidden", _name="order",
_value=request.vars.order),
INPUT(_type="hidden", _name="_signature",
_value=mysignature),
INPUT(_type="hidden", _name="keywords",
_value=request.vars.keywords or ''),
_method="GET", _action=url(args=['export']))
search_actions.append(f)
#================================================================
console.append(search_actions)
order = request.vars.order or ''
if sortable:
if order and not order=='None':
# vars=dict(keywords=request.vars.keywords or ''))))
#================================================================
options =[]
for k,v in sorted(exportManager.items()):
if hasattr(v, "__getitem__"):
label = v[1]
else:
label = k
options.append(OPTION(T(label),_value=k))
##FIXME ?
mysignature = url(args=['export']).split('?', 1)
mysignature = psq(mysignature[-1]).get('_signature', [None])[-1]
f = FORM(BUTTON(SPAN(_class=ui.get('buttonexport')),
"Export", _type="submit", _class=ui.get('button')),
SELECT(options, _name="export_type"),
INPUT(_type="hidden", _name="order",
_value=request.vars.order),
INPUT(_type="hidden", _name="_signature",
_value=mysignature),
INPUT(_type="hidden", _name="keywords",
_value=request.vars.keywords or ''),
_method="GET", _action=url(args=['export']))
search_actions.append(f)
#================================================================
console.append(search_actions)
order = request.vars.order or ''
if sortable:
if order and not order=='None':
bibcodeauthor = ''
try:
response = urllib.request.urlopen(adsquery)
html = response.read().decode('utf-8')
hsplit = html.split("\n")
if len(hsplit) > 5:
bibcodeauthor = hsplit[5]
except:
pass
if not bibcodeauthor:
warnings.warn(
"Bibcode didn't return authors, not converting"
"this bibcode.")
self.catalog.bibauthor_dict[bibcode] = unescape(
bibcodeauthor).strip()
for source in self[self._KEYS.SOURCES]:
if (SOURCE.BIBCODE in source and
source[SOURCE.BIBCODE] in self.catalog.bibauthor_dict
and
self.catalog.bibauthor_dict[source[SOURCE.BIBCODE]]):
source[SOURCE.REFERENCE] = self.catalog.bibauthor_dict[
source[SOURCE.BIBCODE]]
if (SOURCE.NAME not in source and SOURCE.BIBCODE in source and
source[SOURCE.BIBCODE]):
source[SOURCE.NAME] = source[SOURCE.BIBCODE]
if self._KEYS.REDSHIFT in self:
self[self._KEYS.REDSHIFT] = list(
sorted(
request = requests.get("http://localhost:8080/translate/{}?{}".format(language, urllib.parse.urlencode({"q": text.lower()})), timeout=3)
try:
await ctx.send(request.json()["message"].replace("'", "`") + " :no_entry:")
except:
input_text = request.json()["from"]["language"]["iso"]
if "-" in input_text:
input_text = input_text.split("-")[0]
if input_text == "iw":
input_text = "Hebrew"
elif len(input_text) == 2:
input_text = languages.get(part1=input_text).name
elif len(input_text) == 3:
input_text = languages.get(part3=input_text).name
s=discord.Embed(colour=0x4285f4)
s.set_author(name="Google Translate", icon_url="https://upload.wikimedia.org/wikipedia/commons/d/db/Google_Translate_Icon.png")
s.add_field(name="Input Text ({})".format(input_text), value=html.unescape(request.json()["from"]["text"]["value"]) if request.json()["from"]["text"]["value"] else text, inline=False)
s.add_field(name="Output Text ({})".format(language.title()), value=request.json()["text"])
await ctx.send(embed=s)
data.append( "%s" % stepName )
data.append( "%s" % self.__gethtml(stepDescription) )
data.append( "%s" % self.__gethtml(stepExpected) )
data.append( "" )
data.append( "" )
r = requests.post("%s/rest/domains/%s/projects/%s/design-steps" % (self.WsUrl, self.WsDomain, self.WsProject),
cookies={ 'LWSSO_COOKIE_KEY': self.WsLwssoCookie, 'QCSession': self.WsQcSession } ,
headers = {'Content-Type': 'application/xml;charset=utf-8'},
data="\n".join(data).encode("utf8"),
proxies=self.WsProxies, verify=self.WsCheckSsl)
if r.status_code != 201:
errTitle = r.text.split("<title>")[1].split("</title>", 1)[0]
errTitle = html.unescape(errTitle)
raise Exception( "Unable to create step: %s - %s" % (r.status_code, errTitle) )
return True
allowed = omit(allowed, omit_start)
excluded = {
"a": ["a"],
"button": formctrl + ["a", "form", "isindex", "fieldset", "iframe"],
"dir": block,
"form": ["form"],
"label": ["label"],
"menu": block,
"pre": pre_exclusion
}
excluded = setify(excluded)
class HTMLParser(base.HTMLParser):
def __init__(self, entities=None):
base.HTMLParser.__init__(self)
self.tag_stack = []
self.excluded = frozenset()
self.excluded_stack = []
self.data = []
self.data_stack = []
self.decls = []
if entities:
self.entities = entities
else:
self.entities = {}
def top(self):
if self.tag_stack == []:
async def async_setup_platform(
hass, config, async_add_entities, discovery_info=None): # pylint: disable=unused-argument
"""Setup sensor platform."""
channel_id = config['channel_id']
session = async_create_clientsession(hass)
try:
url = BASE_URL.format(channel_id)
async with async_timeout.timeout(10, loop=hass.loop):
response = await session.get(url)
info = await response.text()
name = html.parser.HTMLParser().unescape(
info.split('<title>')[1].split('</')[0])
except Exception: # pylint: disable=broad-except
name = None
if name is not None:
async_add_entities([YoutubeSensor(channel_id, name, session)], True)
</title>