Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
LOGGER.error('Prerequisite environment variable for upload missing, cannot continue.')
raise SystemExit(1)
upload_command = ('twine upload dist/* '
f'-u {os.environ.get("PYPI_UPLOAD_USERNAME")} '
f'-p {os.environ.get("PYPI_UPLOAD_PASSWORD")} '
'--skip-existing '
f'--repository-url {os.environ.get("PYPI_URL")}')
LOGGER.info('Trying to upload built artifact...')
success = execute_command(upload_command)
if success:
LOGGER.info('%s Successfully uploaded artifact! %s',
emojize(':white_heavy_check_mark:'),
emojize(':thumbs_up:'))
else:
LOGGER.error('%s Errors found in uploading artifact! %s',
emojize(':cross_mark:'),
emojize(':crying_face:'))
raise SystemExit(0 if success else 1)
def process_request(self, path, query_string, content):
payload = parse_qs(content)
path = path.split("/")
conversation_id = path[1]
if not conversation_id:
raise ValueError("conversation id must be provided in path")
if "text" in payload:
try:
text = emoji.emojize(str(payload["text"][0]), use_aliases=True)
except NameError: # emoji library likely missing
text = str(payload["text"][0])
if "user_name" in payload:
if "slackbot" not in str(payload["user_name"][0]):
text = self._remap_internal_slack_ids(text)
response = "<b>" + str(payload["user_name"][0]) + ":</b> " + unescape(text)
reprocessor_context = self._bot._handlers.attach_reprocessor( _slack_repeater_cleaner,
return_as_dict = True )
yield from self.send_data( conversation_id,
response,
context = { 'base': {
'tags': ['slack', 'relay'],
'source': 'slack',
def predict(img_path, out_path):
""" Predicts multiple images and saves them in .mat format
on an output path
\b
example command:
python pathgan-cli.py --img_path /root/sharedfolder/Images --out_path /root/sharedfolder/predict_scanpaths/salient360_submission_code/output
- On Marc's Computer -
python pathgan-cli.py --img_path /Users/massens/Documents/playground/titan/salient360_submission_code/submission_evaluation/test_images --out_path /Users/massens/Documents/
"""
print('\n\n###########################')
print(emoji.emojize(':fire: Starting program '))
print(emoji.emojize(':thinking_face: Make sure that the generator weights are in ../weights/'))
print('\n\n###########################')
print(img_path)
pathgan.predict_and_save(img_path, out_path)
def get_camera_settings(fname):
with open(fname, "rb") as f:
tags = exifread.process_file(f)
brand = tags["Image Make"].printable
model = tags["Image Model"].printable
lens = tags["EXIF LensModel"].printable
focal_length = tags["EXIF FocalLength"]
shutter_speed = tags["EXIF ExposureTime"].printable
apeture = tags["EXIF FNumber"].printable
iso = tags["EXIF ISOSpeedRatings"].printable
s = f" {brand} {model} | {lens} @ {focal_length} mm | ƒ/{apeture} | {shutter_speed} sec | ISO {iso}"
return emoji.emojize(":camera:") + "⚙: " + s
def _relay_msg(self, msg, conv_id, image_id=None):
try:
user = Base.slacks[self.team].users[msg.user]["name"]
except KeyError:
# Bot message with no corresponding Slack user.
user = msg.user_name
try:
source = Base.slacks[self.team].channels[msg.channel]["name"]
except KeyError:
source = self.team
yield from self._send_to_internal_chat(conv_id,
from_slack.convert(emoji.emojize(msg.text, use_aliases=True),
Base.slacks[self.team]),
{"source_user": user,
"source_uid": msg.user,
"source_title": source,
"source_edited": msg.edited,
"source_action": msg.action},
image_id=image_id)
def button(bot, update):
query = update.callback_query
if query.data == "1":
em = emoji.emojize(':smile:', use_aliases=True)
bot.editMessageText(text="Oh wow! %s " % em,
chat_id=query.message.chat_id,
message_id=query.message.message_id)
if query.data == "2":
em = emoji.emojize(':expressionless:', use_aliases=True)
bot.editMessageText(text="Does it matter? %s " % em,
chat_id=query.message.chat_id,
message_id=query.message.message_id)
if query.data == "3":
em = emoji.emojize(':disappointed:', use_aliases=True)
bot.editMessageText(text="Oh man! %s " % em,
chat_id=query.message.chat_id,
message_id=query.message.message_id)
# Sending the OTP
print('executing otp-send')
self.execute_script_with_jquery(
self.load_jQuery, self.otp_send, wait=True)
# Extracting the OTP and logging in
print('executing exploit :)')
self.execute_script_with_jquery(
self.load_jQuery, self.exploit)
# Extracting victim data
victim = self.driver.find_element_by_id(
'ContentPlaceHolder1_txtStudentName').get_attribute('value')
# Print victim data on successfull execution of program
print(emoji.emojize('{} is compromised :thumbs_up:').format(victim))
if message.content_type == 'text':
testo = testobase + message.text.replace("_", "\_")
if message.reply_to_message is not None and message.text is not None:
testo = "%s\n\n%s" % (testo, emoji.emojize(lang('alert_reply', userid), use_aliases=True))
bot.send_message(userid, testo, parse_mode="markdown", reply_markup=markup, disable_web_page_preview="true")
bot.forward_message(userid, message.chat.id, message.reply_to_message.message_id)
else:
bot.send_message(userid, testo, parse_mode="markdown", reply_markup=markup, disable_web_page_preview="true")
elif message.content_type == 'photo' or message.content_type == 'video':
bot.send_message(userid, testobase, parse_mode="markdown", reply_markup=markup, disable_web_page_preview="true")
bot.forward_message(userid, message.chat.id, message.message_id)
if message.reply_to_message is not None:
bot.send_message(userid, emoji.emojize(lang('alert_reply', userid), use_aliases=True), parse_mode="markdown", reply_markup=markup)
bot.forward_message(userid, message.chat.id, message.reply_to_message.message_id, disable_web_page_preview="true")
send_log(message)
store_info(message)
def emoji_shortcode_to_unicode(text):
"""Convert standard emoji short codes to unicode emoji in
the provided text.
text - The text to parse.
Returns the modified text.
"""
return emoji.emojize(text, use_aliases=True)
def get_start_text(uid):
return emojize('Welcome to %s!! :v:\n\nYour Telegram ID is: %d\n\n'
'This code can be used by an admin to add your account to the white list. :muscle:\n'
'If you don\'t know any Admins, who could do this for you, I\'m sorry but '
'I cannot manage to give the access to the entire world.. :sob:' % (
bot_me.first_name,
uid
), use_aliases=True)