@@ -259,6 +259,20 @@ def process_args(args):
259
259
if args .ansi_log and "ansi" not in seen_output :
260
260
LOGGER .warning (_ ("--ansi-log has no effect when ansi is not among the output formats" ))
261
261
262
+ if args .https or args .ssh :
263
+ if args .offline :
264
+ LOGGER .warning (_ ("Using either --https and --ssh will have no effect when running offline" ))
265
+ args .auth_method = None
266
+ elif args .https and args .ssh :
267
+ LOGGER .warning (_ ("--https and --ssh have no effect when used together" ))
268
+ args .auth_method = None
269
+ elif args .https :
270
+ args .auth_method = "https"
271
+ else :
272
+ args .auth_method = "ssh"
273
+ else :
274
+ args .auth_method = None
275
+
262
276
263
277
class LoggerWriter :
264
278
def __init__ (self , logger , level ):
@@ -334,6 +348,18 @@ def main():
334
348
parser .add_argument ("--no-install-dependencies" ,
335
349
action = "store_true" ,
336
350
help = _ ("do not install dependencies (only works with --local)" ))
351
+ parser .add_argument ("--assertion-rewrite" ,
352
+ action = "store" ,
353
+ nargs = "?" ,
354
+ const = "enabled" ,
355
+ choices = ["true" , "enabled" , "1" , "on" , "false" , "disabled" , "0" , "off" ],
356
+ help = _ ("enable or disable assertion rewriting; overrides ENABLE_CHECK50_ASSERT flag in the checks file" ))
357
+ parser .add_argument ("--https" ,
358
+ action = "store_true" ,
359
+ help = _ ("force authentication via HTTPS" ))
360
+ parser .add_argument ("--ssh" ,
361
+ action = "store_true" ,
362
+ help = _ ("force authentication via SSH" ))
337
363
parser .add_argument ("-V" , "--version" ,
338
364
action = "version" ,
339
365
version = f"%(prog)s { __version__ } " )
@@ -355,7 +381,7 @@ def main():
355
381
356
382
# If remote, push files to GitHub and await results
357
383
if not args .local :
358
- commit_hash = lib50 .push ("check50" , internal .slug , internal .CONFIG_LOADER , data = {"check50" : True })[1 ]
384
+ commit_hash = lib50 .push ("check50" , internal .slug , internal .CONFIG_LOADER , data = {"check50" : True }, auth_method = args . auth_method )[1 ]
359
385
with lib50 .ProgressBar ("Waiting for results" ) if "ansi" in args .output else nullcontext ():
360
386
tag_hash , results = await_results (commit_hash , internal .slug )
361
387
@@ -392,7 +418,13 @@ def main():
392
418
original_checks_file = (internal .check_dir / config ["checks" ]).resolve ()
393
419
394
420
# If the user has enabled the rewrite feature
395
- if assertions .rewrite_enabled (str (original_checks_file )):
421
+ assertion_rewrite_enabled = False
422
+ if args .assertion_rewrite is not None :
423
+ assertion_rewrite_enabled = args .assertion_rewrite .lower () in ("true" , "1" , "enabled" , "on" )
424
+ else :
425
+ assertion_rewrite_enabled = assertions .rewrite_enabled (str (original_checks_file ))
426
+
427
+ if assertion_rewrite_enabled :
396
428
# Create a temporary copy of the checks file
397
429
with tempfile .NamedTemporaryFile (suffix = ".py" , delete = False ) as tmp :
398
430
checks_file = Path (tmp .name )
0 commit comments