print("downloading tracker report...") f = o.open(url_csv) if f.headers['Content-Type'] != 'text/comma-separated-values': return None content = f.read().decode('utf8') f.close() return content if __name__ == '__main__': parser = optparse.OptionParser( usage='usage: %prog [options] search string', description='Search Blender Bug Tracker') parser.add_option('-u', '--unassigned', action='store_true', dest='unassigned', help='show only unassigned bugs') parser.add_option('-c', '--categories', action='store_true', dest='cats', help='show bug category') parser.add_option('-l', '--link', action='store_true', dest='links', help='show link to bug details') options, filter_args = parser.parse_args() unassigned_only = options.unassigned show_cats = options.cats
os.environ['MAVLINK09'] = '1' mavversion = "1" elif mavversionArg == "2.0" or mav20 == True: os.environ['MAVLINK20'] = '1' mavversion = "2" else: mavversion = None if __name__ == '__main__': from optparse import OptionParser parser = OptionParser("mavproxy.py [options]") parser.add_option("--master", dest="master", action='append', metavar="DEVICE[,BAUD]", help="MAVLink master port and optional baud rate", default=[]) parser.add_option("--out", dest="output", action='append', metavar="DEVICE[,BAUD]", help="MAVLink output port and optional baud rate", default=[]) parser.add_option("--baudrate", dest="baudrate", type='int', help="default serial baud rate", default=57600) parser.add_option("--sitl", dest="sitl",
f.close() print("downloading tracker report...") f = o.open(url_csv) if f.headers["Content-Type"] != "text/comma-separated-values": return None content = f.read().decode("utf8") f.close() return content if __name__ == "__main__": parser = optparse.OptionParser( usage="usage: %prog [options] search string", description="Search Blender Bug Tracker" ) parser.add_option("-u", "--unassigned", action="store_true", dest="unassigned", help="show only unassigned bugs") parser.add_option("-c", "--categories", action="store_true", dest="cats", help="show bug category") parser.add_option("-l", "--link", action="store_true", dest="links", help="show link to bug details") options, filter_args = parser.parse_args() unassigned_only = options.unassigned show_cats = options.cats show_links = options.links # check if our local copy is recent, if not: # login and download the latest CSV from bugtracker if not cache_is_recent(): print("local copy too old -> fetching a recent one..") # are USERNAME / PASSWORD provided? if not, prompt for any missing if USERNAME == "": USERNAME = raw_input("Username: ")
import html.parser pars = html.parser.HTMLParser() try: import xml.etree.cElementTree as et except ImportError: import xml.etree.ElementTree as et from . import utils from .utils import UnicodeReader, UnicodeWriter from . import db from . import utils parser = OptionParser() parser.add_option("-p", "--pathways", dest="pathways", default='', help="pathways to import from MetaCyc") parser.add_option("-r", "--reactions", dest="reactions", default='', help="directly import non-pathway reactions") parser.add_option("-i", "--iterate", action="store_true", dest="recursive", default=False, help="iterate tree to find subpathways recursively (on pathomxways only)") parser.add_option("-s", "--search", dest="search", default=None, help="only load pathways matching this regex") (options, args) = parser.parse_args() reaction_directions = { 'LEFT-TO-RIGHT': 'forward', 'RIGHT-TO-LEFT': 'back',
print ("Starting server {0} at http://localhost:{1}.".format(OmniDB.settings.OMNIDB_VERSION,str(port))) logger.info("Starting server {0} at http://localhost:{1}.".format(OmniDB.settings.OMNIDB_VERSION,str(port))) cherrypy.engine.start() init_browser(port) cherrypy.engine.block() else: print('Tried 20 different ports without success, closing...') logger.info('Tried 20 different ports without success, closing...') if __name__ == "__main__": #default port parser = optparse.OptionParser(version=OmniDB.settings.OMNIDB_VERSION) parser.add_option("-p", "--port", dest="port", default=OmniDB.settings.OMNIDB_DEFAULT_APP_PORT, type=int, help="listening port") parser.add_option("-w", "--wsport", dest="wsport", default=OmniDB.settings.WS_QUERY_PORT, type=int, help="websocket port") (options, args) = parser.parse_args() #Choosing empty port port = options.wsport num_attempts = 0 print('''Starting OmniDB websocket...''') logger.info('''Starting OmniDB websocket...''') print('''Checking port availability...''') logger.info('''Checking port availability...''')
cherrypy.tree.graft(WSGIHandler()) print("Starting {0} at http://localhost:{1}".format( OmniDB.settings.OMNIDB_VERSION, str(server_port))) cherrypy.engine.start() print("Open OmniDB in your favorite browser") print("Press Ctrl+C to exit") cherrypy.engine.block() if __name__ == "__main__": #default port parser = optparse.OptionParser(version=OmniDB.settings.OMNIDB_VERSION) parser.add_option("-p", "--port", dest="port", default=OmniDB.settings.OMNIDB_DEFAULT_PORT, type=int, help="listening port") (options, args) = parser.parse_args() #Removing Expired Sessions SessionStore.clear_expired() #Websocket Core ws_core.start_wsserver_thread() server_port = options.port DjangoApplication().run()
def print_article(htmlparser, article): pass try: print("%%#PAGE " + article.title) print(str(htmlparser.unescape(article.markup))) print("\n\n\f") except IOError: sys.exit(0) # broken stdout => broken pipe except Exception as e: sys.stderr.write("\nError extracting article: " + str(e) + "\n") if __name__ == "__main__": try: parser = OptionParser(usage="usage: %s [-d output-directory] <stdin>" % sys.argv[0]) parser.add_option("-d", action="store", type="string", dest="directory", help="directory where to store the articles") (options, args) = parser.parse_args() if len(args) > 0: print(parser.usage) exit(1) htmlparser = html.parser.HTMLParser() if options.directory != None: do_article = lambda a: save_article(htmlparser, a, options.directory) else: do_article = lambda a: print_article(htmlparser, a) parser = WikiParser(do_article) parser.process()
if not os.path.isdir(to_dir): os.makedirs(to_dir) if not os.path.isdir(by_instance): os.makedirs(by_instance) plt.savefig(os.path.join(to_dir,"%s.%s.%s.%s.png" % (metric_name,statistic,opt.period_min,instance))) plt.savefig(os.path.join(by_instance,"%s.%s.%s.%s.png" % (metric_name,statistic,opt.period_min,instance))) if opt.show_plot: plt.show() plt.close(fig) if __name__ == "__main__": parser = OptionParser() parser.add_option("-b", "--instance", dest="instance", default='') parser.add_option("-p", "--period_min", dest="period_min", type=int,default=5) parser.add_option("-f", "--from_min", dest="from_min", type=int, default=60) parser.add_option("-t", "--to_min", dest="to_min",type=int, default=0) parser.add_option("-s", "--statistic", dest="statistic",type=str, default='Average') #Maximum parser.add_option("-m", "--metric_name", dest="metric_name",type=str, default='CPUUtilization') parser.add_option("-g", "--show_plot", action="store_true",dest="show_plot", default=False) parser.add_option("-r", "--show_report", action="store_true",dest="show_report", default=False) parser.add_option("-n", "--namespace", dest="namespace",type=str, default='AWS/EC2') parser.add_option("-d", "--plot_dir", dest="plot_dir",type=str, default='plots') parser.add_option("-e", "--timestamp", dest="timestamp",type=str, default=datetime.now().strftime('%Y%m%d_%H%M%S')) (opt, _) = parser.parse_args()
def filter_remove_entities(text): return re.sub("&#[a-zA-Z]+", '', text) def get_filter_names(): return [k.replace('filter_','') for k,v in globals().items() if k.startswith('filter_')] def get_filter(name): return eval('filter_' + re.sub('[^a-zA-Z_]','',name)) if __name__ == '__main__': from optparse import OptionParser usage = "usage: %prog [options] <remote url or local filename>" parser = OptionParser(usage=usage) parser.add_option("-e", "--encoding", dest="encoding", default=None, help="manually specifies the encoding to use when interpreting the url") parser.add_option("-c", "--cache", dest="cache", action='store_true', default=False, help="stores and loads data from cache") parser.add_option("-d", "--cacheDir", dest="cacheDir", default='_cache', help="the directory where cache files will be stored") parser.add_option("-u", "--userAgent", dest="userAgent", default=None, help="The user-agent to use when requesting URLs.") parser.add_option("-f", "--filters", dest="filters", default=None, choices=get_filter_names(), help="a comma-delimited list of pre-processing filters to apply, one of [%s]" % '|'.join(get_filter_names()))
print("Open OmniDB in your favorite browser") print("Press Ctrl+C to exit") cherrypy.engine.block() else: print('Tried 20 different ports without success, closing...') logger.info('Tried 20 different ports without success, closing...') if __name__ == "__main__": parser = optparse.OptionParser(version=OmniDB.settings.OMNIDB_VERSION) parser.add_option("-p", "--port", dest="port", default=None, type=int, help="listening port") parser.add_option("-w", "--wsport", dest="wsport", default=None, type=int, help="websocket port") parser.add_option("-H", "--host", dest="host", default=None, type=str,
is_ssl = Config.getboolean('webserver', 'is_ssl') except: is_ssl = False try: ssl_certificate_file = Config.get('webserver', 'ssl_certificate_file') except: ssl_certificate_file = '' try: ssl_key_file = Config.get('webserver', 'ssl_key_file') except: ssl_key_file = '' parser = optparse.OptionParser(version=OmniDB.settings.OMNIDB_VERSION) parser.add_option("-p", "--port", dest="port", default=listening_port, type=int, help="listening port") parser.add_option("-w", "--wsport", dest="wsport", default=ws_port, type=int, help="websocket port") parser.add_option("-H", "--host", dest="host", default=listening_address, type=str,
try: import xml.etree.cElementTree as et except ImportError: import xml.etree.ElementTree as et from . import utils from .utils import UnicodeReader, UnicodeWriter from . import db from . import utils parser = OptionParser() parser.add_option("-p", "--pathways", dest="pathways", default='', help="pathways to import from MetaCyc") parser.add_option("-r", "--reactions", dest="reactions", default='', help="directly import non-pathway reactions") parser.add_option( "-i", "--iterate", action="store_true", dest="recursive", default=False,
cef.CreateBrowserSync( url="http://localhost:{0}?user=admin&pwd=admin".format( str(server_port)), window_title="OmniDB") cef.MessageLoop() cef.Shutdown() if __name__ == "__main__": OmniDB.settings.DESKTOP_MODE = True #default port parser = optparse.OptionParser(version=OmniDB.settings.OMNIDB_VERSION) parser.add_option("-p", "--port", dest="port", default=None, type=int, help="listening port") parser.add_option("-c", "--configfile", dest="conf", default=OmniDB.settings.CONFFILE, type=str, help="configuration file") (options, args) = parser.parse_args() #Parsing config file Config = configparser.ConfigParser() Config.read(options.conf)
try: is_ssl = Config.getboolean('webserver', 'is_ssl') except: is_ssl = False try: ssl_certificate_file = Config.get('webserver', 'ssl_certificate_file') except: ssl_certificate_file = '' try: ssl_key_file = Config.get('webserver', 'ssl_key_file') except: ssl_key_file = '' parser = optparse.OptionParser(version=OmniDB.settings.OMNIDB_VERSION) parser.add_option("-p", "--port", dest="port", default=listening_port, type=int, help="listening port") parser.add_option("-w", "--wsport", dest="wsport", default=ws_port, type=int, help="websocket port") parser.add_option("-H", "--host", dest="host", default=listening_address, type=str, help="listening address") (options, args) = parser.parse_args() #Choosing empty port port = options.wsport num_attempts = 0