def main(): sys.excepthook = excepthook QApplication.setDesktopSettingsAware(False) QApplication.setStyle(QStyleFactory.create("Fusion")) app = QApplication(sys.argv) app.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps) sys.stderr.write("\n") cli = BaseCLI( "DERIVA Authentication Agent", "For more information see: https://github.com/informatics-isi-edu/deriva-qt", VERSION) cli.parser.add_argument( "--cookie-persistence", action="store_true", help="Enable cookie and local storage persistence for QtWebEngine.") args = cli.parse_cli() config = read_config(args.config_file, create_default=False) if args.config_file else None authWindow = AuthWindow(config, args.credential_file, cookie_persistence=args.cookie_persistence) authWindow.show() ret = app.exec_() return ret
def main(): cli = BaseCLI("annotation rollback tool", None, version=__version__, hostname_required=True) cli.parser.add_argument("--catalog", default=1, metavar="<1>", help="Catalog number. Default: 1") cli.parser.add_argument("--snapshot", metavar="<snapshot ID", help="Catalog snapshot ID. Example: 2QG-VWP6-0YG0") args = cli.parse_cli() credential = get_credential(args.host, args.credential_file) rollback_annotation(args.host, args.catalog, snaptime=args.snapshot, credential=credential)
def main(): logger = logging.getLogger(__name__) logger.setLevel("WARNING") cli = BaseCLI(__name__, "Create a sitemap from a table specified on the command line or a set of tables from a config file", __version__, hostname_required=True) cli.remove_options(["--credential-file", "--token", "--oauth2-token"]) cli.parser.add_argument("--catalog", default=1, metavar="<1>", help="Catalog number") cli.parser.add_argument("-p", "--priority", type=float, help="A floating-point number between 0.0 and 1.0 indicating the table's priority") cli.parser.add_argument("-s", "--schema", help="the name of the schema of the (single) table to include") cli.parser.add_argument("-t", "--table", help="the name of the (single) table to include") args = cli.parse_cli() if args.priority is not None: if args.priority < 0 or args.priority > 1: logger.error("priority should be a floating-point number between 0 and 1") sys.exit(1) if not ((args.schema and args.table) or args.config_file): logger.error("must specify either a schema and table or a config file") sys.exit(1) sb = SitemapBuilder("https", args.host, args.catalog) if args.schema and args.table: sb.add_table_spec(args.schema, args.table, priority=args.priority) if args.config_file: rows = json.load(open(args.config_file)) for row in rows: if row.get("schema") is None or row.get("table") is None: logger.warning("malformed entry in {f}: schema or table is missing. Skipping".format(f=args.config_file)) next if row.get("priority") is None: priority = args.priority else: try: priority = float(row.get("priority")) if priority < 0 or priority > 1: logger.warning("bad priority '{p}' - should be a floating-point number between 0 and 1. Ignoring".format(p=priority)) priority = args.priority except ValueError: logger.warning("malformed priority '{p}' - should be a floating-point number between 0 and 1. Ignoring".format(p=row.get("priority"))) priority = args.priority sb.add_table_spec(row["schema"], row["table"], priority=priority) sb.write_sitemap(sys.stdout) return 0
for row in data: if row.get("Description") is None: row["Description"] = row["Name"] if __name__ == '__main__': cli = BaseCLI("load tables into demo server", None, hostname_required=True) cli.parser.add_argument("--directory", "-d", type=str, help="Parent directory of data files", default="./data") cli.parser.add_argument("--all", "-a", action="store_const", const=True, help="load all tables") cli.parser.add_argument("catalog", type=int) cli.parser.add_argument("--table", type=str, action="append", help="table(s) to load") args = cli.parse_cli() credentials = get_credential(args.host) dl = DemoLoad(args.host, args.catalog, credentials, args.directory) if not (args.table or args.all): print("Specify --all or at least one table") sys.exit(1) dl.load(args.table if args.table else None)