{"size": 916, "ext": "rktl", "max_stars_repo_path": "pkgs/racket-test-core/tests/racket/censor.rktl", "max_stars_repo_name": "lkh01/racket", "max_stars_repo_stars_event_min_datetime": "2018-07-05T21:18:24.000Z", "max_stars_repo_stars_event_max_datetime": "2021-06-04T14:48:37.000Z", "max_issues_repo_path": "pkgs/racket-test-core/tests/racket/censor.rktl", "max_issues_repo_name": "lkh01/racket", "max_issues_repo_issues_event_min_datetime": "2017-05-10T07:33:20.000Z", "max_issues_repo_issues_event_max_datetime": "2018-07-19T15:49:46.000Z", "max_forks_repo_path": "pkgs/racket-test-core/tests/racket/censor.rktl", "max_forks_repo_name": "lkh01/racket", "max_forks_repo_forks_event_min_datetime": "2016-04-25T11:47:57.000Z", "max_forks_repo_forks_event_max_datetime": "2017-05-09T14:52:48.000Z"}
{"max_stars_count": 4, "max_issues_count": 9, "max_forks_count": 3, "avg_line_length": 24.1052631579, "max_line_length": 65, "alphanum_fraction": 0.5120087336}

; run a thunk using a censor that removes dangerous chars from a 
; string for printing to a terminal
(lambda (thunk)
  (let ([censor (lambda (s)
		  (list->bytes
		   (let loop ([s (bytes->list s)])
		     (if (null? s)
			 null
			 (let ([c (car s)])
			   (cond
			    [(and (or (< c 32) (>= c #o200))
				  (not (= c 10)))
			     (append (cons (char->integer #\{)
					   (map
					    char->integer
					    (string->list 
					     (number->string c))))
				     (cons (char->integer #\})
					   (loop (cdr s))))]
			    [else
			     (cons c (loop (cdr s)))]))))))])
    (let* ([oldp (current-output-port)]
	   [cp (make-output-port
		'censor
		oldp
		(lambda (s start end nonblock? breakable?)
		  (display (censor (subbytes s start end)) oldp)
		  (- end start))
		void)])
      (dynamic-wind
       (lambda () (current-output-port cp))
       thunk
       (lambda ()
	 (current-output-port oldp))))))


