@cli.command()<EOL>@click.option('<STR_LIT>', default=None, help='<STR_LIT:description>')<EOL>@click.option('<STR_LIT>', default=None, help='<STR_LIT>')<EOL>@click.option('<STR_LIT>', default=True, help="<STR_LIT>")<EOL>@click.option('<STR_LIT>', default=False, is_flag=True, help="<STR_LIT>")<EOL>def push(description, datasets, wait, verbose):
<EOL>config = _get_config()<EOL>file_patterns = config["<STR_LIT>"]<EOL>if not isinstance(file_patterns, type([])):<EOL><INDENT>file_patterns = [file_patterns]<EOL><DEDENT>if datasets:<EOL><INDENT>datasets_string = datasets.split('<STR_LIT:U+002C>')<EOL><DEDENT>else:<EOL><INDENT>datasets_string = config.get("<STR_LIT>", '<STR_LIT>')<EOL><DEDENT>files = {CONFIG_FILE}  <EOL>for pattern in file_patterns:<EOL><INDENT>files.update(glob.glob(pattern))<EOL><DEDENT>if not files:<EOL><INDENT>print("<STR_LIT>")<EOL>exit(-<NUM_LIT:1>)<EOL><DEDENT>if verbose:<EOL><INDENT>print("<STR_LIT>")<EOL>print("<STR_LIT>")<EOL>for path in files:<EOL><INDENT>print("<STR_LIT:\t>", path)<EOL><DEDENT>print("<STR_LIT>")<EOL><DEDENT>_print("<STR_LIT>")<EOL>if not os.path.exists("<STR_LIT>"):<EOL><INDENT>os.mkdir("<STR_LIT>")<EOL><DEDENT>zip_path = '<STR_LIT>' % str(datetime.datetime.now())<EOL>with ZipFile(zip_path, '<STR_LIT:w>') as zip_file:<EOL><INDENT>for path in files:<EOL><INDENT>zip_file.write(path)<EOL><DEDENT><DEDENT>cprint("<STR_LIT>", '<STR_LIT>')<EOL>with open(zip_path, '<STR_LIT:rb>') as zip_file:<EOL><INDENT>_print("<STR_LIT>")<EOL>try:<EOL><INDENT>response = requests.post(<EOL>URL_SUBMIT,<EOL>files={<EOL>"<STR_LIT>": zip_file,<EOL>},<EOL>data={<EOL>"<STR_LIT:name>": config["<STR_LIT:name>"],<EOL>"<STR_LIT:description>": description or '<STR_LIT>',<EOL>"<STR_LIT>": config["<STR_LIT>"],<EOL>"<STR_LIT>": datasets_string,<EOL>"<STR_LIT>": wait,<EOL>},<EOL>stream=wait  <EOL>)<EOL>if response.status_code == <NUM_LIT:200>:<EOL><INDENT>cprint("<STR_LIT>", '<STR_LIT>')<EOL>if wait:<EOL><INDENT>_print("<STR_LIT>")<EOL>cprint("<STR_LIT:U+0020>" * <NUM_LIT>, '<STR_LIT>', attrs=('<STR_LIT>',))<EOL>chunk_buffer = "<STR_LIT>"<EOL>for chunk in response.iter_content(chunk_size=<NUM_LIT:1>):<EOL><INDENT>chunk_buffer += chunk<EOL>if chunk == '<STR_LIT:\r>':<EOL><INDENT>try:<EOL><INDENT>data = json.loads(chunk_buffer)<EOL>if "<STR_LIT>" not in data or "<STR_LIT>" not in data:<EOL><INDENT>print("<STR_LIT>")<EOL>continue<EOL><DEDENT><DEDENT>except (ValueError,):<EOL><INDENT>continue<EOL><DEDENT>if data["<STR_LIT>"]:<EOL><INDENT>data["<STR_LIT>"] = data["<STR_LIT>"].replace("<STR_LIT>", "<STR_LIT>")<EOL>_print(data["<STR_LIT>"])<EOL><DEDENT>if data["<STR_LIT>"]:<EOL><INDENT>_print(colored(data["<STR_LIT>"], '<STR_LIT>'))<EOL><DEDENT>chunk_buffer = "<STR_LIT>"<EOL><DEDENT><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>cprint(response.json()["<STR_LIT:error>"], '<STR_LIT>')<EOL><DEDENT><DEDENT>except requests.exceptions.ConnectionError:<EOL><INDENT>cprint("<STR_LIT>", '<STR_LIT>')<EOL>exit(-<NUM_LIT:2>)<EOL><DEDENT><DEDENT>
Publish your submission to brains