import logging
import logging.handlers
import os
import pwd
import sys
import time
import functools
import traceback
time.localtime
functools.partial
sys.exit(1)
_________________________
import cx_Oracle
import csv
import datetime
from optparse import OptionParser
from report_utils import write_cursor_to_file, send_email
writer = csv.writer(filename)
text = 'something'
writer.writerow(text)
db = cx_Oracle.connect(connection_stirng)
cursor = db.cursor
sproc = os.path.expandvars($DataBaseName.storedProcName)
cursor.callfunc(sproc, int, [refcursor])
opt_parser = OptionParser()
opt_parser.add_option(variables)
_________________________
import subprocess
import sys
import threading
subprocess.Popen()
listening_event = treading.Event()
async_waiter = threading.Thread()
async_waiter.daemon = true/false;
async_waiter.start()
thread_handle.join
thread_handle.isAlive()
_________________________
import argparse
import os
import db_utils
import solace_utils as solace
import xml.etree.ElementTree as ET
import stringIO
arg_parser = argparse.ArgumentParser
arg_parser.add_argument();
global args
args = arg_parser.parse_args()
sql = "some select statement with where clause'
db_utils.DBConnection(database='STATIC_DB') as db:
return db.get_single_value_from_db(sql=sql)
root = ET.Element("ElementName")
sub1 = ET.SubElement(root, "SubElem name")
sub2 = ET.SubElement(root, "SubElem name2")
root = ET.fromstring(Str)
Str = ET.tostring(root)
listener = solace.listenForMsgAsync()
solace.sendMsg()
solace.waitForResponse()
import mplotlib
import math
matplotlib.use('Agg')
import mplotlib.pyplot as plt
import mplotlib.ticker as mtick
from mplotlib import dates
from mplotlib.dates import date2num
from mplotlib.font_manager import FontProperties
writer.writerow(string)
graph -
x_axis = []
y_axis = []
y_axis2 = []
y_axis3 = []
x_axis = x_axis + (units - could be dates)
y_axis = y_axis + (units - could be prices)
y_axis2 = y_axis + (units - could be vol)
y_axis3 = y_axis + (units - could be moving average)
plt.gcf().clear()
plt1 = plt.subplot(111)
plt.gca().set_xlim([x[0], x[-1]])
ax = None
ax = plt.gcf().axes[0]
line1 = plt.plot(x, y_axis, label = "", color = "")
line1 = plt.plot(x, y_axis2, label = "", color = "")
line1 = plt.plot(x, y_axis3, label = "", color = "")
plt.suptitle('some title', fontsize)
plt.bar(x[:1], y_axis[0], width = 'decide', align = 'centre', label = 'soomething', color = '')
fontP = FontProperties()
fontP.set_size('small')
ax.legend(, , , use fontP here)
plt.savefig(filename)